[PATCH] linux-user/mmap.c: check range of mremap result in target address space

2020-10-28 Thread Tobias Koch
`, performing the range check against the actual size of the target address space. It also moves the corresponding block to prevent it from being called incorrectly when the mapping itself fails. Signed-off-by: Tobias Koch --- linux-user/mmap.c | 21 - 1 file changed, 12

Re: [PATCH] linux-user: mremap fails with EFAULT if address range overlaps with stack guard

2020-07-04 Thread Tobias Koch
Ping On 6/16/20 12:10 AM, Tobias Koch wrote: > Ok, so according to the manpage, mremap generates EFAULT when "the range > old_address to old_address+old_size is an > invalid virtual memory address for this process". This is what the kernel > does for the stack guard. Howe

Re: [PATCH] linux-user: mremap fails with EFAULT if address range overlaps with stack guard

2020-06-15 Thread Tobias Koch
to be special-cased to fake kernel behavior. I'm open to other suggestions. I also understand that the code duplication in elfload.c and mmap.c to handle this is undesirable, but the most viable alternative seems to be introducing more globals. On 6/15/20 11:28 PM, Tobias Koch wrote: > Hm,

Re: [PATCH] linux-user: mremap fails with EFAULT if address range overlaps with stack guard

2020-06-15 Thread Tobias Koch
Hm, I see I need to have another look at this :) On 6/15/20 10:17 AM, Tobias Koch wrote: > Hi Laurent, > > the code in musl libc probing the stack is in > >     https://git.musl-libc.org/cgit/musl/plain/src/thread/pthread_getattr_np.c > > The setup in elfload.c doe

Re: [PATCH] linux-user: mremap fails with EFAULT if address range overlaps with stack guard

2020-06-15 Thread Tobias Koch
à 22:05, Tobias Koch a écrit : >> If the address range starting at old_address overlaps with the stack guard it >> is invalid and mremap must fail with EFAULT. The musl c library relies on >> this >> behavior to detect the stack size, which it does by doing consecutive mremaps

[PATCH] linux-user: mremap fails with EFAULT if address range overlaps with stack guard

2020-03-05 Thread Tobias Koch
(such as the Ruby interpreter) that calls pthread_getattr_np under musl will crash on 32 bit targets emulated on a 64 bit host. Signed-off-by: Tobias Koch --- linux-user/mmap.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index

[PATCH v2] linux-user: do prlimit selectively

2020-03-05 Thread Tobias Koch
Analogous to what commit 5dfa88f7 did for setrlimit, this commit selectively ignores limits for memory-related resources in prlimit64 calls. This is to prevent too restrictive limits from causing QEMU itself to malfunction. Signed-off-by: Tobias Koch --- linux-user/syscall.c | 5 - 1 file

[PATCH] linux-user: do prlimit selectively

2020-03-04 Thread Tobias Koch
Analogous to what commit 5dfa88f7 did for setrlimit, this commit selectively ignores limits for memory-related resources in prlimit64 calls. This is to prevent too restrictive limits from causing QEMU itself to malfunction. Signed-off-by: Tobias Koch ---  linux-user/syscall.c | 16

[Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop

2020-02-04 Thread Tobias Koch
I carried out the following test: * fetched the QEMU coming with 18.04, * added this patch, * built an LXD container with arch arm64 and the patched qemu-aarch64-static inside, * launched it on amd64 Previously various systemd services would not come up properly, now they are running like a char

[Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop

2020-02-03 Thread Tobias Koch
Thanks, Laurent! I'll get back to you, asap. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1823790 Title: QEMU mishandling of SO_PEERSEC forces systemd into tight loop Status in QEMU: Confirmed

[Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop

2020-01-28 Thread Tobias Koch
** Changed in: qemu Status: New => Confirmed -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1823790 Title: QEMU mishandling of SO_PEERSEC forces systemd into tight loop Status in QEMU: Con

[Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop

2020-01-28 Thread Tobias Koch
I'm a bit surprised that this bug doesn't get more attention, as it makes it very hard to run qemu-emulated containers of Bionic hosted on Bionic. Running such containers is a common way to cross-compile packages for foreign architectures in the absence of sufficiently powerful target HW. The docu