]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
linux-user: do prlimit selectively
authorTobias Koch <tobias.koch@nonterra.com>
Thu, 5 Mar 2020 20:24:00 +0000 (21:24 +0100)
committerLaurent Vivier <laurent@vivier.eu>
Fri, 20 Mar 2020 14:51:54 +0000 (15:51 +0100)
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 <tobias.koch@nonterra.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200305202400.27574-1-tobias.koch@nonterra.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/syscall.c

index 8d27d1080752ccbb88949b7fa2c55bc05456b6da..4f2f9eb12b59a33f2ae82a544979c2fb4cfd24db 100644 (file)
@@ -11871,7 +11871,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
         struct target_rlimit64 *target_rnew, *target_rold;
         struct host_rlimit64 rnew, rold, *rnewp = 0;
         int resource = target_to_host_resource(arg2);
-        if (arg3) {
+
+        if (arg3 && (resource != RLIMIT_AS &&
+                     resource != RLIMIT_DATA &&
+                     resource != RLIMIT_STACK)) {
             if (!lock_user_struct(VERIFY_READ, target_rnew, arg3, 1)) {
                 return -TARGET_EFAULT;
             }