rpms/kernel/devel linux-2.6-x86_64-tif-restore-sigmask.patch, 1.2, 1.3 linux-2.6-x86_64-add-ppoll-pselect.patch, 1.2, 1.3 kernel-2.6.spec, 1.2342, 1.2343

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Sun Jul 2 22:20:12 UTC 2006


Author: dwmw2

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

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-x86_64-tif-restore-sigmask.patch 
	linux-2.6-x86_64-add-ppoll-pselect.patch 
Log Message:
ppoll and pselect on x86_64 again

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(-)

Index: linux-2.6-x86_64-tif-restore-sigmask.patch
===================================================================
RCS file: linux-2.6-x86_64-tif-restore-sigmask.patch
diff -N linux-2.6-x86_64-tif-restore-sigmask.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ linux-2.6-x86_64-tif-restore-sigmask.patch	2 Jul 2006 22:20:10 -0000	1.3
@@ -0,0 +1,227 @@
+diff --git a/arch/x86_64/ia32/ia32_signal.c b/arch/x86_64/ia32/ia32_signal.c
+index 25e5ca2..549de43 100644
+--- a/arch/x86_64/ia32/ia32_signal.c
++++ b/arch/x86_64/ia32/ia32_signal.c
+@@ -113,25 +113,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
+@@ -508,11 +502,11 @@ #if DEBUG_SIG
+ 		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,
+@@ -595,7 +589,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);
+ 
+@@ -604,9 +598,9 @@ #if DEBUG_SIG
+ 		current->comm, current->pid, frame, regs->rip, frame->pretcode);
+ #endif
+ 
+-	return 1;
++	return 0;
+ 
+ give_sigsegv:
+ 	force_sigsegv(sig, current);
+-	return 0;
++	return -EFAULT;
+ }
+diff --git a/arch/x86_64/kernel/signal.c b/arch/x86_64/kernel/signal.c
+index 2816117..d7e92fb 100644
+--- a/arch/x86_64/kernel/signal.c
++++ b/arch/x86_64/kernel/signal.c
+@@ -341,11 +341,11 @@ #ifdef DEBUG_SIG
+ 		current->comm, current->pid, frame, regs->rip, frame->pretcode);
+ #endif
+ 
+-	return 1;
++	return 0;
+ 
+ give_sigsegv:
+ 	force_sigsegv(sig, current);
+-	return 0;
++	return -EFAULT;
+ }
+ 
+ /*
+@@ -408,7 +408,7 @@ #ifdef CONFIG_IA32_EMULATION
+ #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))
+@@ -425,11 +425,12 @@ #endif
+  * 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
+@@ -438,9 +439,11 @@ int do_signal(struct pt_regs *regs, sigs
+ 	 * if so.
+ 	 */
+ 	if (!user_mode(regs))
+-		return 1;
++		return;
+ 
+-	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);
+@@ -454,30 +457,46 @@ 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;
+ 	}
+ 
+ 	/* Did we come from a system call? */
+ 	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",
+@@ -491,8 +510,8 @@ #endif
+ 	}
+ 
+ 	/* 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)
+diff --git a/include/asm-x86_64/signal.h b/include/asm-x86_64/signal.h
+index cef7a7d..00f2d38 100644
+--- a/include/asm-x86_64/signal.h
++++ b/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.  */
+ 
+diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h
+index 2029b00..790c512 100644
+--- a/include/asm-x86_64/thread_info.h
++++ b/include/asm-x86_64/thread_info.h
+@@ -114,6 +114,7 @@ #define TIF_SINGLESTEP		4	/* reenable si
+ #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 */
+ /* 16 free */
+ #define TIF_IA32		17	/* 32bit process */ 
+ #define TIF_FORK		18	/* ret_from_fork */
+@@ -128,6 +129,7 @@ #define _TIF_NEED_RESCHED	(1<<TIF_NEED_R
+ #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_IA32		(1<<TIF_IA32)
+ #define _TIF_FORK		(1<<TIF_FORK)
+ #define _TIF_ABI_PENDING	(1<<TIF_ABI_PENDING)

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

Index: linux-2.6-x86_64-add-ppoll-pselect.patch
===================================================================
RCS file: linux-2.6-x86_64-add-ppoll-pselect.patch
diff -N linux-2.6-x86_64-add-ppoll-pselect.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ linux-2.6-x86_64-add-ppoll-pselect.patch	2 Jul 2006 22:20:10 -0000	1.3
@@ -0,0 +1,31 @@
+diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
+index 5a92fed..07399fe 100644
+--- a/arch/x86_64/ia32/ia32entry.S
++++ b/arch/x86_64/ia32/ia32entry.S
+@@ -687,8 +687,8 @@ #endif
+ 	.quad sys_readlinkat		/* 305 */
+ 	.quad sys_fchmodat
+ 	.quad sys_faccessat
+-	.quad quiet_ni_syscall		/* pselect6 for now */
+-	.quad quiet_ni_syscall		/* ppoll for now */
++	.quad compat_sys_pselect6
++	.quad compat_sys_ppoll
+ 	.quad sys_unshare		/* 310 */
+ 	.quad compat_sys_set_robust_list
+ 	.quad compat_sys_get_robust_list
+diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
+index feb77cb..0a08bbf 100644
+--- a/include/asm-x86_64/unistd.h
++++ b/include/asm-x86_64/unistd.h
+@@ -600,9 +600,9 @@ __SYSCALL(__NR_fchmodat, sys_fchmodat)
+ #define __NR_faccessat		269
+ __SYSCALL(__NR_faccessat, sys_faccessat)
+ #define __NR_pselect6		270
+-__SYSCALL(__NR_pselect6, sys_ni_syscall)	/* for now */
++__SYSCALL(__NR_pselect6, sys_pselect6)
+ #define __NR_ppoll		271
+-__SYSCALL(__NR_ppoll,	sys_ni_syscall)		/* for now */
++__SYSCALL(__NR_ppoll,	sys_ppoll)
+ #define __NR_unshare		272
+ __SYSCALL(__NR_unshare,	sys_unshare)
+ #define __NR_set_robust_list	273


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.2342
retrieving revision 1.2343
diff -u -r1.2342 -r1.2343
--- kernel-2.6.spec	2 Jul 2006 03:23:39 -0000	1.2342
+++ kernel-2.6.spec	2 Jul 2006 22:20:10 -0000	1.2343
@@ -256,6 +256,8 @@
 Patch203: linux-2.6-x86_64-silence-up-apic-errors.patch
 Patch205: linux-2.6-x86_64-smp-on-uphw-cpucount.patch
 Patch206: linux-2.6-x86-hp-reboot.patch
+Patch207: linux-2.6-x86_64-tif-restore-sigmask.patch
+Patch208: linux-2.6-x86_64-add-ppoll-pselect.patch
 
 # 300 - 399   ppc(64)
 Patch302: linux-2.6-offb-find-fb.patch
@@ -727,6 +729,10 @@
 %patch205 -p1
 # Reboot through BIOS on HP systems,.
 %patch206 -p1
+# Support TIF_RESTORE_SIGMASK on x86_64
+%patch207 -p1
+# Add ppoll and pselect syscalls
+%patch208 -p1
 
 #
 # ppc64
@@ -1562,6 +1568,9 @@
 %endif
 
 %changelog
+* Sun Jul  2 2006 David Woodhouse <dwmw2 at redhat.com>
+- Add ppoll() and pselect() on x86_64 again
+
 * Sat Jul  1 2006 Dave Jones <davej at redhat.com>
 - 2.6.17-git19
 




More information about the fedora-cvs-commits mailing list