Skip to contentSkip to conversation

waitid system call

PATCH Andi Kleen 2 participants 2 messages Aug 16, 2004 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#1 lore raw

Roland McGrath <[email protected]> writes:

Are you sure you converted the new _rusage member properly in the 64->32bit siginfo converter? struct rusage uses long.

Review

Quoted 11 lines
(quoted diff) +11 -0
+asmlinkage long sys32_waitid(int which, compat_pid_t pid,
+			     siginfo_t32 __user *uinfo, int options)
+{
+	siginfo_t info;
+	long ret;
+	mm_segment_t old_fs = get_fs();
+
+	info.si_signo = 0;
+	set_fs (KERNEL_DS);
+	ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options);
+	set_fs (old_fs);

Better use compat_alloc_user_space() for this. Otherwise it won't work for UML/x86-64. Also that will make it easier to port to other architectures.

+ /* 1 if group stopped since last SIGCONT, -1 if SIGCONT since report */
+ int stop_state;

Can't this be merged into some other field? No need to waste memory unnecessarily.

-Andi

#2 lore raw
Quoted 2 lines

Are you sure you converted the new _rusage member properly in the 64->32bit siginfo converter? struct rusage uses long.

Aha! Indeed I did not. Thanks for pointing that out.

Quoted 3 lines

Better use compat_alloc_user_space() for this. Otherwise it won't work for UML/x86-64. Also that will make it easier to port to other architectures.

I followed the model of sys32_rt_sigtimedwait and various compat_* functions in kernel/compat.c. In fact, nothing in kernel/compat.c uses compat_alloc_user_space--and most things in arch/x86_64/ia32/sys_ia32.c use the direct stack method as well. To address your concerns, I imagine all these places should be changed en masse.

Quoted 6 lines
(quoted diff) +2 -0
+	/* 1 if group stopped since last SIGCONT, -1 if SIGCONT since report */
+  	int			stop_state;

Can't this be merged into some other field? No need to waste memory unnecessarily.

I think it could be merged into group_stop_count. I just didn't really want to perturb all that code for the first go-round. I can make an attempt at that if all the other potential concerns with the patch are ironed out. So far the patch doesn't really touch existing signal code paths much at all, so it's easier to evaluate.

Thanks,
Roland