qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-arm] [PATCH] linux-user/syscall: let recvfrom(struct sockaddr


From: Laurent Vivier
Subject: Re: [Qemu-arm] [PATCH] linux-user/syscall: let recvfrom(struct sockaddr *) use abi_ulong
Date: Tue, 23 Jan 2018 17:38:58 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

Le 23/01/2018 à 17:27, Guido Günther a écrit :
> Hi,
> On Tue, Jan 23, 2018 at 05:12:26PM +0100, Laurent Vivier wrote:
>> Le 23/01/2018 à 16:23, Guido Günther a écrit :
>>> Hi,
>>> Thanks for having a look!
>>>
>>> On Tue, Jan 23, 2018 at 11:52:22AM -0300, Philippe Mathieu-Daudé wrote:
>>>> Currently recvfrom() is restricted to handle 32-bit pointers,
>>>> remove this limit for 64-bit hosts.
>>>>
>>>> This fixes:
>>>>
>>>>   31572 socket(AF_NETLINK, SOCK_RAW, NETLINK_AUDIT) = 3
>>>>   ...
>>>>   31572 sendto(3, {{len=124, type=0x454 /* NLMSG_??? */, 
>>>> flags=NLM_F_REQUEST|NLM_F_ACK, seq=1, pid=0}, "op=test:message acct=\"?\" 
>>>> exe=\"/tmp/nl-bad-addr\" hostname=localhost addr=? terminal=/dev/pts/2 
>>>> res=success\0\0\0"}, 124, 0, 0xfffffa3897d0, 0) = 124
>>>>   31572 ppoll([{fd=3, events=POLLIN}], 1, {tv_sec=0, tv_nsec=500000000}, 
>>>> NULL, 0) = 1 ([{fd=3, revents=POLLIN}], left {tv_sec=0, tv_nsec=499993180})
>>>>   31572 recvfrom(3, 0x112a50eb4, 8988, MSG_PEEK|MSG_DONTWAIT, 
>>>> 0xfffffa3897e0, 0x42) = -1 EFAULT (Bad address)
...
>> Could you try:
>>
>> strace -f chroot . /usr/bin/qemu-arm-static tmp/nl-bad-addr
>>
>> to see if the fault comes from the kernel or from QEMU.
> 
> Full strace is attached of
> 
>     strace -f -s2048 -onl-bad-addr.strace chroot armhf-chroot/ 
> tmp/qemu-arm-static tmp/a.out
> 
> is attched. The error is at the very end.
...
> 9559  socket(AF_NETLINK, SOCK_RAW, NETLINK_AUDIT) = 3
> 9559  fcntl(3, F_SETFD, FD_CLOEXEC)     = 0
...
> 9559  sendto(3, {{len=120, type=0x454 /* NLMSG_??? */, 
> flags=NLM_F_REQUEST|NLM_F_ACK, seq=1, pid=0}, "op=test:message acct=\"?\" 
> exe=\"/tmp/a.out\" hostname=localhost addr=::1 terminal=/dev/pts/2 
> res=success\0\0\0"}, 120, 0, 0xffffcdb29840, 0) = 120
> 9559  ppoll([{fd=3, events=POLLIN}], 1, {tv_sec=0, tv_nsec=500000000}, NULL, 
> 0) = 1 ([{fd=3, revents=POLLIN}], left {tv_sec=0, tv_nsec=499951056})
> 9559  recvfrom(3, 0xffff9404ae84, 8988, MSG_PEEK|MSG_DONTWAIT, 
> 0xffffcdb29850, 0x42) = -1 EFAULT (Bad address)

So the problem seems to be with the pointer/buffer we pass to the kernel
(either host_msg or addr). It's weird...

Thanks,
Laurent



reply via email to

[Prev in Thread] Current Thread [Next in Thread]