Commit 7997f673 authored by Alexander Kartashov's avatar Alexander Kartashov Committed by Pavel Emelyanov

restorer: introduced the struct krlimit

The layout of the struct rlimit depends on the value
of the macro FILE_OFFSET_BITS. If FILE_OFFSET_BITS is 64
the userspace and kernel definitions becomes incoherent
on a 32-bit platform.

The struct krlimit representing the kernel version of
the struct rlimit is introduced to address the issue:
the function restore_rlims() is fixed to convert between
the userspace and kernel representations of the struct.
Signed-off-by: 's avatarAlexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent d63ed7a4
......@@ -61,7 +61,7 @@ __NR_setpriority 141 sys_setpriority (int which, int who, int nice)
__NR_sched_setscheduler 144 sys_sched_setscheduler (int pid, int policy, struct sched_param *p)
__NR_prctl 157 sys_prctl (int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5)
__NR_arch_prctl 158 sys_arch_prctl (int option, unsigned long addr)
__NR_setrlimit 160 sys_setrlimit (int resource, struct rlimit *rlim)
__NR_setrlimit 160 sys_setrlimit (int resource, struct krlimit *rlim)
__NR_mount 165 sys_mount (char *dev_nmae, char *dir_name, char *type, unsigned long flags, void *data)
__NR_umount2 166 sys_umount2 (char *name, int flags)
__NR_gettid 186 sys_gettid (void)
......
......@@ -59,4 +59,9 @@ struct robust_list_head;
struct rlimit;
struct krlimit {
unsigned long rlim_cur;
unsigned long rlim_max;
};
#endif /* __CR_SYSCALL_TYPES_H__ */
......@@ -147,8 +147,13 @@ static void restore_rlims(struct task_restore_core_args *ta)
{
int r;
for (r = 0; r < ta->nr_rlim; r++)
sys_setrlimit(r, &ta->rlims[r]);
for (r = 0; r < ta->nr_rlim; r++) {
struct krlimit krlim;
krlim.rlim_cur = ta->rlims[r].rlim_cur;
krlim.rlim_max = ta->rlims[r].rlim_max;
sys_setrlimit(r, &krlim);
}
}
static int restore_thread_common(struct rt_sigframe *sigframe,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment