From: Tom Hughes Date: Sat, 11 Sep 2004 14:19:25 +0000 (+0000) Subject: Make the virtualise setrlimit(RLIMIT_DATA) return EPERM when an attempt X-Git-Tag: svn/VALGRIND_3_0_0~1595 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=99fcaf843d728a3bd89f6a650acd7368fc3d168e;p=thirdparty%2Fvalgrind.git Make the virtualise setrlimit(RLIMIT_DATA) return EPERM when an attempt is made to raise either the soft or hard limit above the current hard limit rather than just allowing it. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2690 --- diff --git a/coregrind/vg_syscalls.c b/coregrind/vg_syscalls.c index 14ea259c99..9126c11ce1 100644 --- a/coregrind/vg_syscalls.c +++ b/coregrind/vg_syscalls.c @@ -4693,8 +4693,14 @@ PRE(setrlimit) } } else if (arg1 == VKI_RLIMIT_DATA) { - VG_(client_rlimit_data) = *(vki_rlimit *)arg2; - res = 0; + if (((vki_rlimit *)arg2)->rlim_cur > ((vki_rlimit *)arg2)->rlim_max || + ((vki_rlimit *)arg2)->rlim_max > ((vki_rlimit *)arg2)->rlim_max) { + res = -VKI_EPERM; + } + else { + VG_(client_rlimit_data) = *(vki_rlimit *)arg2; + res = 0; + } } else if (arg1 == VKI_RLIMIT_STACK && tid == 1) { if (((vki_rlimit *)arg2)->rlim_cur > ((vki_rlimit *)arg2)->rlim_max ||