diff mbox series

[1/6] Revert "linux-user: Make sure initial brk(0) is page-aligned"

Message ID 20230717213545.142598-2-deller@gmx.de (mailing list archive)
State New, archived
Headers show
Series linux-user: brk() syscall fixes and armhf static binary fix | expand

Commit Message

Helge Deller July 17, 2023, 9:35 p.m. UTC
This reverts commit d28b3c90cfad1a7e211ae2bce36ecb9071086129.

It just hides the real bug, and even the Linux kernel may
return page-unaligned addresses.

Signed-off-by: Helge Deller <deller@gmx.de>
Tested-by: Markus F.X.J. Oberhumer <notifications@github.com>
---
 linux-user/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.41.0

Comments

Andreas Schwab July 18, 2023, 1:53 p.m. UTC | #1
On Jul 17 2023, Helge Deller wrote:

> This reverts commit d28b3c90cfad1a7e211ae2bce36ecb9071086129.
>
> It just hides the real bug, and even the Linux kernel may
> return page-unaligned addresses.

The initial brk is always page aligned, see binfmt_elf.c:set_brk and the
various arch_randomize_brk implementations.
Helge Deller July 18, 2023, 3:47 p.m. UTC | #2
On 7/18/23 15:53, Andreas Schwab wrote:
> On Jul 17 2023, Helge Deller wrote:
>
>> This reverts commit d28b3c90cfad1a7e211ae2bce36ecb9071086129.
>>
>> It just hides the real bug, and even the Linux kernel may
>> return page-unaligned addresses.
>
> The initial brk is always page aligned, see binfmt_elf.c:set_brk and the
> various arch_randomize_brk implementations.

Oh, your are absolutely right. I indeed missed to look at binfmt_elf.c:set_brk().
I'll drop this patch in the v2 series.

Thanks!
Helge
diff mbox series

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c99ef9c01e..b9527ab00f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -806,7 +806,7 @@  static abi_ulong brk_page;

 void target_set_brk(abi_ulong new_brk)
 {
-    target_brk = TARGET_PAGE_ALIGN(new_brk);
+    target_brk = new_brk;
     brk_page = HOST_PAGE_ALIGN(target_brk);
 }