linux-user fixes for 2.1
[Qemu-devel] [PULL for-2.1 1/5] SIOCGIFINDEX: fix typo
In reply to [email protected]From: Joakim Tjernlund <[email protected]>
Wrong type was used in ioctl definition.
--- linux-user/ioctls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/ioctls.h +1 -1
@@ -118,7 +118,7 @@ IOCTL(SIOCSIFMEM, IOC_W, MK_PTR(MK_STRUCT(STRUCT_ptr_ifreq))) IOCTL(SIOCADDMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) IOCTL(SIOCDELMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) - IOCTL(SIOCGIFINDEX, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) + IOCTL(SIOCGIFINDEX, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) IOCTL(SIOCSIFLINK, 0, TYPE_NULL)IOCTL_SPECIAL (SIOCGIFCONF ,IOC_W |IOC_R , do_ioctl_ifconf,MK_PTR (MK_STRUCT (STRUCT_ifconf)))
Signature · 1 line
2.0.0
From: Riku Voipio <[email protected]>
The following changes since commit 0a9934eef166836c8100fce72f7f837cb8b2ed2b:
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2014-07-14 17:01:45 +0100)
are available in the git repository at:
git://git.linaro.org/people/riku.voipio/qemu.git linux-user-for-upstream
for you to fetch changes up to b545f63fa974ebffd55d70ca615572d497e543dc:
linux-user: use TARGET_SA_ONSTACK in get_sigframe (2014-07-15 17:08:41 +0300)
----------------------------------------------------------------
Joakim Tjernlund (4):
SIOCGIFINDEX: fix typo
qemu-user: Impl. setsockopt(SO_BINDTODEVICE)
linux-user: handle AF_PACKET sockaddrs in target_to_host_sockaddr alloca one extra byte sockets
Riku Voipio (1):
linux-user: use TARGET_SA_ONSTACK in get_sigframe
linux-user/ioctls.h | 2 +- linux-user/signal.c | 7 ++++--- linux-user/syscall.c | 32 +++++++++++++++++++++++++++++--- linux-user/syscall_defs.h | 10 ++++++++++ 4 files changed, 44 insertions(+), 7 deletions(-)
Signature · 1 line
2.0.0
[Qemu-devel] [PULL for-2.1 4/5] alloca one extra byte sockets
From: Joakim Tjernlund <[email protected]>
target_to_host_sockaddr() may increase the lenth with 1 byte for AF_UNIX sockets so allocate 1 extra byte.
--- linux-user/syscall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
linux-user/syscall.c +3 -3
@@ -1984,7 +1984,7 @@ static abi_long do_connect(int sockfd, abi_ulong target_addr,return -TARGET_EINVAL ; } - addr =alloca (addrlen); + addr =alloca (addrlen+1 ); ret =target_to_host_sockaddr (addr, target_addr, addrlen);if (ret)
@@ -2005,7 +2005,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,if (msgp->msg_name) { msg.msg_namelen =tswap32 (msgp->msg_namelen); - msg.msg_name =alloca (msg.msg_namelen); + msg.msg_name =alloca (msg.msg_namelen+1 ); ret =target_to_host_sockaddr (msg.msg_name,tswapal (msgp->msg_name), msg.msg_namelen);if (ret) {
@@ -2268,7 +2268,7 @@ static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags,if (!host_msg)return -TARGET_EFAULT ;if (target_addr) { - addr =alloca (addrlen); + addr =alloca (addrlen+1 ); ret =target_to_host_sockaddr (addr, target_addr, addrlen);if (ret) {unlock_user (host_msg, msg,0 );
Signature · 1 line
2.0.0
[Qemu-devel] [PULL for-2.1 3/5] linux-user: handle AF_PACKET sockaddrs in target_to_host_sockaddr
In reply to [email protected]From: Joakim Tjernlund <[email protected]>
Implement conversion of the AF_PACKET sockaddr subtype in target_to_host_sockaddr.
--- linux-user/syscall.c | 7 +++++++ linux-user/syscall_defs.h | 10 ++++++++++ 2 files changed, 17 insertions(+)
linux-user/syscall.c +7 -0
@@ -1140,6 +1140,13 @@ static inline abi_long target_to_host_sockaddr(struct sockaddr *addr,memcpy (addr, target_saddr, len); addr->sa_family = sa_family; +if (sa_family ==AF_PACKET ) { +struct target_sockaddr_ll *lladdr; + + lladdr = (struct target_sockaddr_ll *)addr; + lladdr->sll_ifindex =tswap32 (lladdr->sll_ifindex); + lladdr->sll_hatype =tswap16 (lladdr->sll_hatype); + }unlock_user (target_saddr, target_addr,0 );return 0 ;
linux-user/syscall_defs.h +10 -0
@@ -121,6 +121,16 @@ struct target_sockaddr {uint8_t sa_data[14 ]; }; +struct target_sockaddr_ll { +uint16_t sll_family;/* Always AF_PACKET */ +uint16_t sll_protocol;/* Physical layer protocol */ +int sll_ifindex;/* Interface number */ +uint16_t sll_hatype;/* ARP hardware type */ +uint8_t sll_pkttype;/* Packet type */ +uint8_t sll_halen;/* Length of address */ +uint8_t sll_addr[8 ];/* Physical layer address */ +}; +struct target_sock_filter {abi_ushort code;uint8_t jt;
Signature · 1 line
2.0.0
[Qemu-devel] [PULL for-2.1 5/5] linux-user: use TARGET_SA_ONSTACK in get_sigframe
In reply to [email protected]From: Riku Voipio <[email protected]>
As reported by Laurent, which should use TARGET_SA_ONSTACK on arm, microblaze and openrisc targets like we do on all others. Practical matter is minimal as for almost all archs SA_ONSTACK is 0x08000000:
http://lxr.free-electrons.com/ident?i=SA_ONSTACK
--- linux-user/signal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
linux-user/signal.c +4 -3
@@ -1305,7 +1305,7 @@ static abi_ulong get_sigframe(struct target_sigaction *ka, CPUARMState *env)/* * This is the X/Open sanctioned signal stack switching. */ -if ((ka->sa_flags &SA_ONSTACK ) && !sas_ss_flags (sp)) { +if ((ka->sa_flags &TARGET_SA_ONSTACK ) && !sas_ss_flags (sp)) { sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size; }
@@ -3509,8 +3509,9 @@ static abi_ulong get_sigframe(struct target_sigaction *ka, {abi_ulong sp = env->regs[1 ]; -if ((ka->sa_flags &SA_ONSTACK ) !=0 && !on_sig_stack (sp)) +if ((ka->sa_flags &TARGET_SA_ONSTACK ) !=0 && !on_sig_stack (sp)) { sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size; + }return ((sp - frame_size) &-8UL ); }
@@ -3891,7 +3892,7 @@ static inline abi_ulong get_sigframe(struct target_sigaction *ka,/* redzone */ /* This is the X/Open sanctioned signal stack switching. */ -if ((ka->sa_flags &SA_ONSTACK ) !=0 && !onsigstack) { +if ((ka->sa_flags &TARGET_SA_ONSTACK ) !=0 && !onsigstack) { sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size; }
Signature · 1 line
2.0.0
[Qemu-devel] [PULL for-2.1 2/5] qemu-user: Impl. setsockopt(SO_BINDTODEVICE)
In reply to [email protected]From: Joakim Tjernlund <[email protected]>
--- linux-user/syscall.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
linux-user/syscall.c +19 -0
@@ -1497,6 +1497,25 @@ set_timeout:unlock_user_struct (tfprog, optval_addr,1 );return ret; } +case TARGET_SO_BINDTODEVICE : + { +char *dev_ifname, *addr_ifname; + +if (optlen >IFNAMSIZ -1 ) { + optlen =IFNAMSIZ -1 ; + } + dev_ifname =lock_user (VERIFY_READ , optval_addr, optlen,1 ); +if (!dev_ifname) { +return -TARGET_EFAULT ; + } + optname =SO_BINDTODEVICE ; + addr_ifname =alloca (IFNAMSIZ ); +memcpy (addr_ifname, dev_ifname, optlen); + addr_ifname[optlen] =0 ; + ret =get_errno (setsockopt (sockfd, level, optname, addr_ifname, optlen)); +unlock_user (dev_ifname, optval_addr,0 ); +return ret; + }/* Options with 'int' argument. */ case TARGET_SO_DEBUG : optname =SO_DEBUG ;
Signature · 1 line
2.0.0
Peter Maydell
AppliedQuoted 6 lines · On 15 July 2014 15:24, <[email protected]> wrote:
From: Riku Voipio <[email protected]>
The following changes since commit
0a9934eef166836c8100fce72f7f837cb8b2ed2b:Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2014-07-14 17:01:45 +0100)
Quoted 8 lines
are available in the git repository at:
git://git.linaro.org/people/riku.voipio/qemu.gitlinux-user-for-upstreamfor you to fetch changes up to
b545f63fa974ebffd55d70ca615572d497e543dc:linux-user: use
TARGET_SA_ONSTACKinget_sigframe(2014-07-15 17:08:41 +0300)
Applied, thanks.
-- PMM