rpms/kernel/devel linux-2.6-x86_64-add-ppoll-pselect.patch, NONE, 1.1 linux-2.6-x86_64-generic-sigsuspend.patch, NONE, 1.1 linux-2.6-x86_64-tif-restore-sigmask.patch, NONE, 1.1 kernel-2.6.spec, 1.1870, 1.1871

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Jan 23 20:40:47 UTC 2006


Author: dwmw2

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv28865

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-x86_64-add-ppoll-pselect.patch 
	linux-2.6-x86_64-generic-sigsuspend.patch 
	linux-2.6-x86_64-tif-restore-sigmask.patch 
Log Message:
Add pselect/ppoll on x86_64

linux-2.6-x86_64-add-ppoll-pselect.patch:
 arch/x86_64/ia32/ia32entry.S     |    2 ++
 include/asm-x86_64/ia32_unistd.h |    4 +++-
 include/asm-x86_64/unistd.h      |    6 +++++-
 3 files changed, 10 insertions(+), 2 deletions(-)

--- NEW FILE linux-2.6-x86_64-add-ppoll-pselect.patch ---
Add ppoll/pselect syscalls

Signed-off-by: Andi Kleen <ak at suse.de>

Index: linux/include/asm-x86_64/unistd.h
===================================================================
--- linux.orig/include/asm-x86_64/unistd.h
+++ linux/include/asm-x86_64/unistd.h
@@ -599,8 +599,12 @@ __SYSCALL(__NR_readlinkat, sys_readlinka
 __SYSCALL(__NR_fchmodat, sys_fchmodat)
 #define __NR_faccessat		269
 __SYSCALL(__NR_faccessat, sys_faccessat)
+#define __NR_pselect6		270
+__SYSCALL(__NR_pselect6, sys_pselect6)
+#define __NR_ppoll		271
+__SYSCALL(__NR_ppoll, sys_ppoll)
 
-#define __NR_syscall_max __NR_faccessat
+#define __NR_syscall_max __NR_ppoll
 
 #ifndef __NO_STUBS
 
Index: linux/arch/x86_64/ia32/ia32entry.S
===================================================================
--- linux.orig/arch/x86_64/ia32/ia32entry.S
+++ linux/arch/x86_64/ia32/ia32entry.S
@@ -685,6 +685,8 @@ ia32_sys_call_table:
 	.quad sys_readlinkat		/* 305 */
 	.quad sys_fchmodat
 	.quad sys_faccessat
+	.quad compat_sys_pselect6
+	.quad compat_sys_ppoll
 ia32_syscall_end:		
 	.rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
 		.quad ni_syscall
Index: linux/include/asm-x86_64/ia32_unistd.h
===================================================================
--- linux.orig/include/asm-x86_64/ia32_unistd.h
+++ linux/include/asm-x86_64/ia32_unistd.h
@@ -313,7 +313,9 @@
 #define __NR_ia32_readlinkat		305
 #define __NR_ia32_fchmodat		306
 #define __NR_ia32_faccessat		307
+#define __NR_ia32_pselect6		308
+#define __NR_ia32_ppoll			309
 
-#define IA32_NR_syscalls 308	/* must be > than biggest syscall! */
+#define IA32_NR_syscalls 310	/* must be > than biggest syscall! */
 
 #endif /* _ASM_X86_64_IA32_UNISTD_H_ */

linux-2.6-x86_64-generic-sigsuspend.patch:
 arch/x86_64/kernel/signal.c |   32 --------------------------------
 include/asm-x86_64/unistd.h |    1 +
 2 files changed, 1 insertion(+), 32 deletions(-)

--- NEW FILE linux-2.6-x86_64-generic-sigsuspend.patch ---
Use generic rt_sigsuspend

Needed for next patch

Signed-off-by: Andi Kleen <ak at suse.de>

Index: linux/arch/x86_64/kernel/signal.c
===================================================================
--- linux.orig/arch/x86_64/kernel/signal.c
+++ linux/arch/x86_64/kernel/signal.c
@@ -40,44 +40,12 @@ int ia32_setup_frame(int sig, struct k_s
             sigset_t *set, struct pt_regs * regs); 
 
 asmlinkage long
-sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs *regs)
-{
-	sigset_t saveset, newset;
-
-	/* XXX: Don't preclude handling different sized sigset_t's.  */
-	if (sigsetsize != sizeof(sigset_t))
-		return -EINVAL;
-
-	if (copy_from_user(&newset, unewset, sizeof(newset)))
-		return -EFAULT;
-	sigdelsetmask(&newset, ~_BLOCKABLE);
-
-	spin_lock_irq(&current->sighand->siglock);
-	saveset = current->blocked;
-	current->blocked = newset;
-	recalc_sigpending();
-	spin_unlock_irq(&current->sighand->siglock);
-#ifdef DEBUG_SIG
-	printk("rt_sigsuspend savset(%lx) newset(%lx) regs(%p) rip(%lx)\n",
-		saveset, newset, regs, regs->rip);
-#endif 
-	regs->rax = -EINTR;
-	while (1) {
-		current->state = TASK_INTERRUPTIBLE;
-		schedule();
-		if (do_signal(regs, &saveset))
-			return -EINTR;
-	}
-}
-
-asmlinkage long
 sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
 		struct pt_regs *regs)
 {
 	return do_sigaltstack(uss, uoss, regs->rsp);
 }
 
-
 /*
  * Do a signal return; undo the signal stack.
  */
Index: linux/include/asm-x86_64/unistd.h
===================================================================
--- linux.orig/include/asm-x86_64/unistd.h
+++ linux/include/asm-x86_64/unistd.h
@@ -639,6 +639,7 @@ do { \
 #define __ARCH_WANT_SYS_RT_SIGACTION
 #define __ARCH_WANT_SYS_TIME
 #define __ARCH_WANT_COMPAT_SYS_TIME
+#define __ARCH_WANT_SYS_RT_SIGSUSPEND
 #endif
 
 #ifndef __KERNEL_SYSCALLS__

linux-2.6-x86_64-tif-restore-sigmask.patch:
 arch/x86_64/ia32/ia32_signal.c   |   28 ++++++++-------------
 arch/x86_64/kernel/signal.c      |   51 ++++++++++++++++++++++++++-------------
 include/asm-x86_64/signal.h      |    4 ---
 include/asm-x86_64/thread_info.h |    2 +
 4 files changed, 48 insertions(+), 37 deletions(-)

--- NEW FILE linux-2.6-x86_64-tif-restore-sigmask.patch ---
Implement TIF_RESTORE_SIGMASK

Needed for ppoll/pselect.

Closely follows the i386 patch from David Howells

Signed-off-by: Andi Kleen <ak at suse.de>

Index: linux/arch/x86_64/ia32/ia32_signal.c
===================================================================
--- linux.orig/arch/x86_64/ia32/ia32_signal.c
+++ linux/arch/x86_64/ia32/ia32_signal.c
@@ -115,25 +115,19 @@ int copy_siginfo_from_user32(siginfo_t *
 }
 
 asmlinkage long
-sys32_sigsuspend(int history0, int history1, old_sigset_t mask,
-		 struct pt_regs *regs)
+sys32_sigsuspend(int history0, int history1, old_sigset_t mask)
 {
-	sigset_t saveset;
-
 	mask &= _BLOCKABLE;
 	spin_lock_irq(&current->sighand->siglock);
-	saveset = current->blocked;
+	current->saved_sigmask = current->blocked;
 	siginitset(&current->blocked, mask);
 	recalc_sigpending();
 	spin_unlock_irq(&current->sighand->siglock);
 
-	regs->rax = -EINTR;
-	while (1) {
-		current->state = TASK_INTERRUPTIBLE;
-		schedule();
-		if (do_signal(regs, &saveset))
-			return -EINTR;
-	}
+	current->state = TASK_INTERRUPTIBLE;
+	schedule();
+	set_thread_flag(TIF_RESTORE_SIGMASK);
+	return -ERESTARTNOHAND;
 }
 
 asmlinkage long
@@ -510,11 +504,11 @@ int ia32_setup_frame(int sig, struct k_s
 		current->comm, current->pid, frame, regs->rip, frame->pretcode);
 #endif
 
-	return 1;
+	return 0;
 
 give_sigsegv:
 	force_sigsegv(sig, current);
-	return 0;
+	return -EFAULT;
 }
 
 int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
@@ -597,7 +591,7 @@ int ia32_setup_rt_frame(int sig, struct 
 	regs->ss = __USER32_DS; 
 
 	set_fs(USER_DS);
-    regs->eflags &= ~TF_MASK;
+	regs->eflags &= ~TF_MASK;
     if (test_thread_flag(TIF_SINGLESTEP))
         ptrace_notify(SIGTRAP);
 
@@ -606,9 +600,9 @@ int ia32_setup_rt_frame(int sig, struct 
 		current->comm, current->pid, frame, regs->rip, frame->pretcode);
 #endif
 
-	return 1;
+	return 0;
 
 give_sigsegv:
 	force_sigsegv(sig, current);
-	return 0;
+	return -EFAULT;
 }
Index: linux/arch/x86_64/kernel/signal.c
===================================================================
--- linux.orig/arch/x86_64/kernel/signal.c
+++ linux/arch/x86_64/kernel/signal.c
@@ -312,11 +312,11 @@ static int setup_rt_frame(int sig, struc
 		current->comm, current->pid, frame, regs->rip, frame->pretcode);
 #endif
 
-	return 1;
+	return 0;
 
 give_sigsegv:
 	force_sigsegv(sig, current);
-	return 0;
+	return -EFAULT;
 }
 
 /*
@@ -379,7 +379,7 @@ handle_signal(unsigned long sig, siginfo
 #endif
 	ret = setup_rt_frame(sig, ka, info, oldset, regs);
 
-	if (ret) {
+	if (ret == 0) {
 		spin_lock_irq(&current->sighand->siglock);
 		sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
 		if (!(ka->sa.sa_flags & SA_NODEFER))
@@ -396,11 +396,12 @@ handle_signal(unsigned long sig, siginfo
  * want to handle. Thus you cannot kill init even with a SIGKILL even by
  * mistake.
  */
-int do_signal(struct pt_regs *regs, sigset_t *oldset)
+static void do_signal(struct pt_regs *regs)
 {
 	struct k_sigaction ka;
 	siginfo_t info;
 	int signr;
+	sigset_t *oldset;
 
 	/*
 	 * We want the common case to go fast, which
@@ -409,12 +410,14 @@ int do_signal(struct pt_regs *regs, sigs
 	 * if so.
 	 */
 	if (!user_mode(regs))
-		return 1;
+		return;
 
 	if (try_to_freeze())
 		goto no_signal;
 
-	if (!oldset)
+	if (!test_thread_flag(TIF_RESTORE_SIGMASK))
+		oldset = &current->saved_sigmask;
+	else
 		oldset = &current->blocked;
 
 	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
@@ -428,7 +431,14 @@ int do_signal(struct pt_regs *regs, sigs
 			set_debugreg(current->thread.debugreg7, 7);
 
 		/* Whee!  Actually deliver the signal.  */
-		return handle_signal(signr, &info, &ka, oldset, regs);
+		if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
+			/* a signal was successfully delivered; the saved
+			 * sigmask will have been stored in the signal frame,
+			 * and will be restored by sigreturn, so we can simply
+			 * clear the TIF_RESTORE_SIGMASK flag */
+			clear_thread_flag(TIF_RESTORE_SIGMASK);
+		}
+		return;
 	}
 
  no_signal:
@@ -436,23 +446,32 @@ int do_signal(struct pt_regs *regs, sigs
 	if ((long)regs->orig_rax >= 0) {
 		/* Restart the system call - no handlers present */
 		long res = regs->rax;
-		if (res == -ERESTARTNOHAND ||
-		    res == -ERESTARTSYS ||
-		    res == -ERESTARTNOINTR) {
+		switch (res) {
+		case -ERESTARTNOHAND:
+		case -ERESTARTSYS:
+		case -ERESTARTNOINTR:
 			regs->rax = regs->orig_rax;
 			regs->rip -= 2;
-		}
-		if (regs->rax == (unsigned long)-ERESTART_RESTARTBLOCK) {
+			break;
+		case -ERESTART_RESTARTBLOCK:
 			regs->rax = test_thread_flag(TIF_IA32) ?
 					__NR_ia32_restart_syscall :
 					__NR_restart_syscall;
 			regs->rip -= 2;
+			break;
 		}
 	}
-	return 0;
+
+	/* if there's no signal to deliver, we just put the saved sigmask
+	   back. */
+	if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
+		clear_thread_flag(TIF_RESTORE_SIGMASK);
+		sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
+	}
 }
 
-void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, __u32 thread_info_flags)
+void
+do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
 {
 #ifdef DEBUG_SIG
 	printk("do_notify_resume flags:%x rip:%lx rsp:%lx caller:%lx pending:%lx\n",
@@ -466,8 +485,8 @@ void do_notify_resume(struct pt_regs *re
 	}
 
 	/* deal with pending signal delivery */
-	if (thread_info_flags & _TIF_SIGPENDING)
-		do_signal(regs,oldset);
+	if (thread_info_flags & (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK))
+		do_signal(regs);
 }
 
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
Index: linux/include/asm-x86_64/signal.h
===================================================================
--- linux.orig/include/asm-x86_64/signal.h
+++ linux/include/asm-x86_64/signal.h
@@ -24,10 +24,6 @@ typedef struct {
 } sigset_t;
 
 
-struct pt_regs; 
-asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
-
-
 #else
 /* Here we must cater to libcs that poke about in kernel headers.  */
 
Index: linux/include/asm-x86_64/thread_info.h
===================================================================
--- linux.orig/include/asm-x86_64/thread_info.h
+++ linux/include/asm-x86_64/thread_info.h
@@ -101,6 +101,7 @@ static inline struct thread_info *stack_
 #define TIF_IRET		5	/* force IRET */
 #define TIF_SYSCALL_AUDIT	7	/* syscall auditing active */
 #define TIF_SECCOMP		8	/* secure computing */
+#define TIF_RESTORE_SIGMASK	9	/* restore signal mask in do_signal */
 #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_IA32		17	/* 32bit process */ 
 #define TIF_FORK		18	/* ret_from_fork */
@@ -115,6 +116,7 @@ static inline struct thread_info *stack_
 #define _TIF_IRET		(1<<TIF_IRET)
 #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
 #define _TIF_SECCOMP		(1<<TIF_SECCOMP)
+#define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_IA32		(1<<TIF_IA32)
 #define _TIF_FORK		(1<<TIF_FORK)


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.1870
retrieving revision 1.1871
diff -u -r1.1870 -r1.1871
--- kernel-2.6.spec	23 Jan 2006 20:26:40 -0000	1.1870
+++ kernel-2.6.spec	23 Jan 2006 20:40:44 -0000	1.1871
@@ -222,6 +222,9 @@
 Patch203: linux-2.6.14-intel-cache-build.patch
 Patch204: linux-2.6-x86_64-silence-up-apic-errors.patch
 Patch205: linux-2.6-edid-check.patch
+Patch206: linux-2.6-x86_64-tif-restore-sigmask.patch
+Patch207: linux-2.6-x86_64-generic-sigsuspend.patch
+Patch208: linux-2.6-x86_64-add-ppoll-pselect.patch
 
 # 300 - 399   ppc(64)
 Patch301: linux-2.6.15-cell-numa-init.patch
@@ -617,6 +620,12 @@
 %patch204 -p1
 # Reboot thru bios on HP laptops.
 %patch205 -p1
+# Implement TIF_RESTORE_SIGMASK
+%patch206 -p1
+# Generic sys_rt_sigsuspend()
+%patch207 -p1
+# Add ppoll/pselect syscalls
+%patch208 -p1
 
 # 
 # ppc64
@@ -1353,6 +1362,7 @@
 %changelog
 * Tue Jan 24 2006 David Woidhouse <dwmw2 at redhat.com>
 - Fix snd_powermac I2C handling
+- Add pselect/ppoll on x86_64
 
 * Sun Jan 22 2006 Dave Jones <davej at redhat.com>
 - Add missing .kernelrelease to kernel-devel (#178491)




More information about the fedora-cvs-commits mailing list