[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [qemu/qemu] e36800: linux-user: add signalfd/signalfd4 sy
From: |
GitHub |
Subject: |
[Qemu-commits] [qemu/qemu] e36800: linux-user: add signalfd/signalfd4 syscalls |
Date: |
Mon, 11 Jan 2016 07:30:05 -0800 |
Branch: refs/heads/master
Home: https://github.com/qemu/qemu
Commit: e36800c91a74b656b4b4c74483863950cf9ec202
https://github.com/qemu/qemu/commit/e36800c91a74b656b4b4c74483863950cf9ec202
Author: Laurent Vivier <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/syscall.c
Log Message:
-----------
linux-user: add signalfd/signalfd4 syscalls
This patch introduces a system very similar to the one used in the kernel
to attach specific functions to a given file descriptor.
In this case, we attach a specific "host_to_target()" translator to the fd
returned by signalfd() to be able to byte-swap the signalfd_siginfo
structure provided by read().
This patch allows to execute the example program given by
man signalfd(2):
#include <sys/signalfd.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#define handle_error(msg) \
do { perror(msg); exit(EXIT_FAILURE); } while (0)
int
main(int argc, char *argv[])
{
sigset_t mask;
int sfd;
struct signalfd_siginfo fdsi;
ssize_t s;
sigemptyset(&mask);
sigaddset(&mask, SIGINT);
sigaddset(&mask, SIGQUIT);
/* Block signals so that they aren't handled
according to their default dispositions */
if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1)
handle_error("sigprocmask");
sfd = signalfd(-1, &mask, 0);
if (sfd == -1)
handle_error("signalfd");
for (;;) {
s = read(sfd, &fdsi, sizeof(struct signalfd_siginfo));
if (s != sizeof(struct signalfd_siginfo))
handle_error("read");
if (fdsi.ssi_signo == SIGINT) {
printf("Got SIGINT\n");
} else if (fdsi.ssi_signo == SIGQUIT) {
printf("Got SIGQUIT\n");
exit(EXIT_SUCCESS);
} else {
printf("Read unexpected signal\n");
}
}
}
$ ./signalfd_demo
^CGot SIGINT
^CGot SIGINT
^\Got SIGQUIT
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: 928bed6a057cedd6110e634865e021a24029785a
https://github.com/qemu/qemu/commit/928bed6a057cedd6110e634865e021a24029785a
Author: Laurent Vivier <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/syscall_defs.h
Log Message:
-----------
linux-user: correctly align target_epoll_event
According to comments in /usr/include/linux/eventpoll.h,
poll_event is packed only on x86_64.
And to be sure fields are correctly aligned in epoll_data,
use abi_XXX types for all of them.
Moreover, fd type is wrong: fd is int, not ulong.
This has been tested with a ppc guest on an x86_64 host:
without this patch, systemd crashes (core).
CC: Alexander Graf <address@hidden>
CC: Peter Maydell <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: 3e24bb3f1277ee25743f0a3274306080df80da2c
https://github.com/qemu/qemu/commit/3e24bb3f1277ee25743f0a3274306080df80da2c
Author: Laurent Vivier <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/syscall.c
Log Message:
-----------
linux-user: in poll(), if nfds is 0, pfd can be NULL
This problem appears with yum in Fedora 20 / PPC64 container.
test case:
#include <stdio.h>
#include <poll.h>
int main(void)
{
int ret;
ret = poll(NULL, 0, 1000);
printf("%d\n", ret);
}
target test environment: Fedora 20 / PPC64
host test environment: Ubuntu 14.0.2 / x86_64
original test result: -1
13451 poll(0,0,1000,274886297496,268566664,268566648) = -1 errno=14 (Bad
address)
patched test result: 0
13536 poll(0,0,1000,274886297496,268566664,268566648) = 0
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: 0e173b24b523b432854689717e09de5c95c158f8
https://github.com/qemu/qemu/commit/0e173b24b523b432854689717e09de5c95c158f8
Author: Harmandeep Kaur <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/syscall.c
Log Message:
-----------
linux-user/syscall.c: malloc()/calloc() to g_malloc()/g_try_malloc()/g_new0()
Convert malloc()/ calloc() calls to g_malloc()/ g_try_malloc()/ g_new0()
All heap memory allocation should go through glib so that we can take
advantage of a single memory allocator and its debugging/tracing features.
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Harmandeep Kaur <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: ff626f2d9e43c74659e8f4c284c62bb223a3bf56
https://github.com/qemu/qemu/commit/ff626f2d9e43c74659e8f4c284c62bb223a3bf56
Author: Laurent Vivier <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/syscall.c
Log Message:
-----------
linux-user: SOCK_PACKET uses network endian to encode protocol in socket()
in PACKET(7) :
packet_socket = socket(AF_PACKET, int socket_type, int protocol);
[...]
protocol is the IEEE 802.3 protocol
number in network order. See the <linux/if_ether.h> include file for a
list of allowed protocols. When protocol is set to htons(ETH_P_ALL)
then all protocols are received. All incoming packets of that protocol
type will be passed to the packet socket before they are passed to the
protocols implemented in the kernel.
[...]
Compatibility
In Linux 2.0, the only way to get a packet socket was by calling
socket(AF_INET, SOCK_PACKET, protocol).
We need to tswap16() the protocol because on big-endian, the ABI is
waiting for, for instance for ETH_P_ALL, 0x0003 (big endian ==
network order), whereas on little-endian it is waiting for 0x0300.
Signed-off-by: Laurent Vivier <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: 5d4d36658578bd5672576e95bec2b5e7a86dd3db
https://github.com/qemu/qemu/commit/5d4d36658578bd5672576e95bec2b5e7a86dd3db
Author: Laurent Vivier <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/syscall.c
Log Message:
-----------
linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure fields
accordingly
Signed-off-by: Laurent Vivier <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: 7b36f78274e701ee17db3171ec7e9f732a60f031
https://github.com/qemu/qemu/commit/7b36f78274e701ee17db3171ec7e9f732a60f031
Author: Laurent Vivier <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/syscall.c
Log Message:
-----------
linux-user: add a function hook to translate sockaddr
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: 0cf227229bfd288a67fd9d4005ee01ffdb492c70
https://github.com/qemu/qemu/commit/0cf227229bfd288a67fd9d4005ee01ffdb492c70
Author: Laurent Vivier <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/syscall.c
Log Message:
-----------
linux-user: manage bind with a socket of SOCK_PACKET type.
This is obsolete, but if we want to use dhcp with an old distro (like debian
etch), we need it. Some users (like dhclient) use SOCK_PACKET with AF_PACKET
and the kernel allows that.
packet(7)
In Linux 2.0, the only way to get a packet socket was by calling
socket(AF_INET, SOCK_PACKET, protocol). This is still supported but
strongly deprecated. The main difference between the two methods is
that SOCK_PACKET uses the old struct sockaddr_pkt to specify an inter‐
face, which doesn't provide physical layer independence.
struct sockaddr_pkt {
unsigned short spkt_family;
unsigned char spkt_device[14];
unsigned short spkt_protocol;
};
spkt_family contains the device type, spkt_protocol is the IEEE 802.3
protocol type as defined in <sys/if_ether.h> and spkt_device is the
device name as a null-terminated string, for example, eth0.
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: 861d72cd28b5793fc367c46b7821a5372b66e3f4
https://github.com/qemu/qemu/commit/861d72cd28b5793fc367c46b7821a5372b66e3f4
Author: Laurent Vivier <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/syscall.c
Log Message:
-----------
linux-user: check fd is >= 0 in
fd_trans_host_to_target_data/fd_trans_host_to_target_addr
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: 2a0fa68fb9761e2eb3dae4034131948d33018dc9
https://github.com/qemu/qemu/commit/2a0fa68fb9761e2eb3dae4034131948d33018dc9
Author: Laurent Vivier <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/signal.c
Log Message:
-----------
linux-user,sh4: fix signal retcode address
To return from a signal, setup_frame() puts an instruction to
be executed in the stack. This sequence calls the syscall sigreturn().
The address of the instruction must be set in the PR register
to be executed.
This patch fixes this: the current code sets the register to the address
of the instruction in the host address space (which can be 64bit whereas
PR is only 32bit), but the virtual CPU can't access this address space,
so we put in PR the address of the instruction in the guest address space.
This patch also removes an useless variable (ret) in the modified functions.
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: e6deac9cf99e013a3e253aff2332836c86d8a52c
https://github.com/qemu/qemu/commit/e6deac9cf99e013a3e253aff2332836c86d8a52c
Author: Chen Gang <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/mmap.c
Log Message:
-----------
linux-user/mmap.c: Always zero MAP_ANONYMOUS memory in mmap_frag()
When mapping MAP_ANONYMOUS memory fragments, still need notice about to
set it zero, or it will cause issues.
Signed-off-by: Chen Gang <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: 27e112f9fd0dcac6c3448f0c71db1b62f0589ffd
https://github.com/qemu/qemu/commit/27e112f9fd0dcac6c3448f0c71db1b62f0589ffd
Author: Michael Tokarev <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/unicore32/target_signal.h
Log Message:
-----------
unicore32: convert get_sp_from_cpustate from macro to inline
All other architectures define get_sp_from_cpustate as an inline function,
only unicore32 uses a #define. With this, some usages are impossible, for
example, enabling sigaltstack in linux-user/syscall.c results in
linux-user/syscall.c: In function ‘do_syscall’:
linux-user/syscall.c:8299:39: error: dereferencing ‘void *’ pointer [-Werror]
get_sp_from_cpustate(arg1, arg2, get_sp_from_cpustate((CPUArchState
*)cpu_env));
^
linux-user/syscall.c:8299:39: error: request for member ‘regs’ in something not
a structure or union
Signed-off-by: Michael Tokarev <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: c0d35736323e5b638aac45bfc25f74fa7b6e10f1
https://github.com/qemu/qemu/commit/c0d35736323e5b638aac45bfc25f74fa7b6e10f1
Author: Michael Tokarev <address@hidden>
Date: 2016-01-08 (Fri, 08 Jan 2016)
Changed paths:
M linux-user/syscall.c
Log Message:
-----------
linux-user: enable sigaltstack for all architectures
There is no reason to limit sigaltstack syscall to just a few
architectures and pretend it is not implemented for others.
If some architecture is not ready for this, that architecture
should be fixed instead.
This fixes LP#1516408.
Signed-off-by: Michael Tokarev <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: fad6c58a3d2b7d4c20754b2b906927905db13392
https://github.com/qemu/qemu/commit/fad6c58a3d2b7d4c20754b2b906927905db13392
Author: Chen Gang <address@hidden>
Date: 2016-01-11 (Mon, 11 Jan 2016)
Changed paths:
M linux-user/syscall.c
Log Message:
-----------
linux-user/syscall.c: Use SOL_SOCKET instead of level for setsockopt()
In this case, level is TARGET_SOL_SOCKET, but we need SOL_SOCKET for
setsockopt().
Signed-off-by: Chen Gang <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: e73eecbdc278970f6d829951293efc2167b6a4c5
https://github.com/qemu/qemu/commit/e73eecbdc278970f6d829951293efc2167b6a4c5
Author: John Paul Adrian Glaubitz <address@hidden>
Date: 2016-01-11 (Mon, 11 Jan 2016)
Changed paths:
M linux-user/m68k/syscall_nr.h
Log Message:
-----------
linux-user: Update m68k syscall definitions to match Linux 4.4.
Signed-off-by: John Paul Adrian Glaubitz <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: 5a53dc5042d9250f2011e54cd065ed360e34d2ac
https://github.com/qemu/qemu/commit/5a53dc5042d9250f2011e54cd065ed360e34d2ac
Author: John Paul Adrian Glaubitz <address@hidden>
Date: 2016-01-11 (Mon, 11 Jan 2016)
Changed paths:
M linux-user/syscall.c
M linux-user/syscall_defs.h
Log Message:
-----------
linux-user: Add SOCKOP_sendmmsg and SOCKOP_recvmmsg socket call, wire them up.
Adds the definitions for the socket calls SOCKOP_sendmmsg
and SOCKOP_recvmmsg and wires them up with the rest of the code.
The necessary function do_sendrecvmmsg() is already present in
linux-user/syscall.c. After adding these two definitions and wiring
them up, I no longer receive an error message about the
unimplemented socket calls when running "apt-get update" on Debian
unstable running on qemu with glibc_2.21 on m68k.
Signed-off-by: John Paul Adrian Glaubitz <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: 530c003252e07f1ea9df7f8a9adb1082d3a2eb08
https://github.com/qemu/qemu/commit/530c003252e07f1ea9df7f8a9adb1082d3a2eb08
Author: Chen Gang <address@hidden>
Date: 2016-01-11 (Mon, 11 Jan 2016)
Changed paths:
M linux-user/mmap.c
Log Message:
-----------
linux-user/mmap.c: Use end instead of real_end in target_mmap
The fragment must effectively be mapped only to "end" not to "real_end"
(which is a host page aligned address, and thus this is not a fragment).
It is consistent with what it is done in the case of one single page.
Signed-off-by: Chen Gang <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Commit: ac0d9dbf33608d0b178e0bd414ec7397ada17834
https://github.com/qemu/qemu/commit/ac0d9dbf33608d0b178e0bd414ec7397ada17834
Author: Peter Maydell <address@hidden>
Date: 2016-01-11 (Mon, 11 Jan 2016)
Changed paths:
M linux-user/m68k/syscall_nr.h
M linux-user/mmap.c
M linux-user/signal.c
M linux-user/syscall.c
M linux-user/syscall_defs.h
Log Message:
-----------
Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160111'
into staging
January 2016 Linux-user queque
# gpg: Signature made Mon 11 Jan 2016 14:13:57 GMT using RSA key ID DE3C9BC0
# gpg: Good signature from "Riku Voipio <address@hidden>"
# gpg: aka "Riku Voipio <address@hidden>"
* remotes/riku/tags/pull-linux-user-20160111:
linux-user/mmap.c: Use end instead of real_end in target_mmap
linux-user: Add SOCKOP_sendmmsg and SOCKOP_recvmmsg socket call, wire them up.
linux-user: Update m68k syscall definitions to match Linux 4.4.
linux-user/syscall.c: Use SOL_SOCKET instead of level for setsockopt()
linux-user: enable sigaltstack for all architectures
unicore32: convert get_sp_from_cpustate from macro to inline
linux-user/mmap.c: Always zero MAP_ANONYMOUS memory in mmap_frag()
linux-user,sh4: fix signal retcode address
linux-user: check fd is >= 0 in
fd_trans_host_to_target_data/fd_trans_host_to_target_addr
linux-user: manage bind with a socket of SOCK_PACKET type.
linux-user: add a function hook to translate sockaddr
linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure fields
accordingly
linux-user: SOCK_PACKET uses network endian to encode protocol in socket()
linux-user/syscall.c: malloc()/calloc() to g_malloc()/g_try_malloc()/g_new0()
linux-user: in poll(), if nfds is 0, pfd can be NULL
linux-user: correctly align target_epoll_event
linux-user: add signalfd/signalfd4 syscalls
Signed-off-by: Peter Maydell <address@hidden>
Compare: https://github.com/qemu/qemu/compare/692a5519ab15...ac0d9dbf3360
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-commits] [qemu/qemu] e36800: linux-user: add signalfd/signalfd4 syscalls,
GitHub <=