lkml.org 
[lkml]   [2009]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 27/27] x86: add ia32 compat prlimit syscalls
Date
To support 32/64-bit compatibility (rlimit structure contains 2 longs)
for prlimit syscalls, add compat wrappers for them.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: James Morris <jmorris@namei.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
---
arch/x86/ia32/ia32entry.S | 2 ++
kernel/compat.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 581b056..c61ced2 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -841,4 +841,6 @@ ia32_sys_call_table:
.quad compat_sys_pwritev
.quad compat_sys_rt_tgsigqueueinfo /* 335 */
.quad sys_perf_event_open
+ .quad compat_sys_getprlimit
+ .quad compat_sys_setprlimit
ia32_syscall_end:
diff --git a/kernel/compat.c b/kernel/compat.c
index af15719..c1d5704 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -371,6 +371,38 @@ asmlinkage long compat_sys_getrlimit (unsigned int resource,
return ret;
}

+asmlinkage long compat_sys_setprlimit(pid_t pid, unsigned int resource,
+ struct compat_rlimit __user *rlim)
+{
+ mm_segment_t old_fs = get_fs();
+ struct rlimit r;
+ int ret;
+
+ ret = get_compat_rlimit(&r, rlim);
+ if (ret)
+ return ret;
+
+ set_fs(KERNEL_DS);
+ ret = sys_setprlimit(pid, resource, (struct rlimit __force __user *)&r);
+ set_fs(old_fs);
+ return ret;
+}
+
+asmlinkage long compat_sys_getprlimit(pid_t pid, unsigned int resource,
+ struct compat_rlimit __user *rlim)
+{
+ mm_segment_t old_fs = get_fs();
+ struct rlimit r;
+ int ret;
+
+ set_fs(KERNEL_DS);
+ ret = sys_getprlimit(pid, resource, (struct rlimit __force __user *)&r);
+ set_fs(old_fs);
+ if (!ret)
+ ret = put_compat_rlimit(&r, rlim);
+ return ret;
+}
+
int put_compat_rusage(const struct rusage *r, struct compat_rusage __user *ru)
{
if (!access_ok(VERIFY_WRITE, ru, sizeof(*ru)) ||
--
1.6.5.3


\
 
 \ /
  Last update: 2009-11-28 00:11    [W:0.144 / U:0.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site