Skip to content

Commit

Permalink
linux-user: Do nothing if too small brk is specified
Browse files Browse the repository at this point in the history
Linux 6.4.7 does nothing when a value smaller than the initial brk is
specified.

Fixes: 86f0473 ("linux-user: Fix brk() to release pages")
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230802071754.14876-6-akihiko.odaki@daynix.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
akihikodaki authored and rth7680 committed Aug 6, 2023
1 parent e69e032 commit cb9d5d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions linux-user/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,14 +820,14 @@ abi_long do_brk(abi_ulong brk_val)

/* brk pointers are always untagged */

/* return old brk value if brk_val unchanged or zero */
if (!brk_val || brk_val == target_brk) {
/* return old brk value if brk_val unchanged */
if (brk_val == target_brk) {
return target_brk;
}

/* do not allow to shrink below initial brk value */
if (brk_val < initial_target_brk) {
brk_val = initial_target_brk;
return target_brk;
}

new_brk = TARGET_PAGE_ALIGN(brk_val);
Expand Down

0 comments on commit cb9d5d1

Please sign in to comment.