rpms/kernel/devel patch-2.6.30-git15.bz2.sign, NONE, 1.1 sched-introduce-SCHED_RESET_ON_FORK-scheduling-policy-flag.patch, NONE, 1.1 .cvsignore, 1.1081, 1.1082 config-generic, 1.290, 1.291 config-powerpc-generic, 1.45, 1.46 config-powerpc32-generic, 1.32, 1.33 kernel.spec, 1.1578, 1.1579 sources, 1.1039, 1.1040 upstream, 1.953, 1.954 patch-2.6.30-git14.bz2.sign, 1.1, NONE

Kyle McMartin kyle at fedoraproject.org
Sat Jun 20 19:36:45 UTC 2009


Author: kyle

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv18636

Modified Files:
	.cvsignore config-generic config-powerpc-generic 
	config-powerpc32-generic kernel.spec sources upstream 
Added Files:
	patch-2.6.30-git15.bz2.sign 
	sched-introduce-SCHED_RESET_ON_FORK-scheduling-policy-flag.patch 
Removed Files:
	patch-2.6.30-git14.bz2.sign 
Log Message:
* Sat Jun 20 2009 Kyle McMartin <kyle at redhat.com> 2.6.31.0.16.rc0.git15
- 2.6.30-git15
- config changes:
 - generic:
  - CONFIG_LBDAF=y
 - staging:
  - CONFIG_USB_SERIAL_QUATECH2 is not set
  - CONFIG_VT6655 is not set
  - CONFIG_USB_CPC is not set
  - CONFIG_RDC_17F3101X is not set
  - CONFIG_FB_UDL is not set
 - ppc32:
  - CONFIG_KMETER1=y
 - ppc generic:
  - CONFIG_PPC_DISABLE_WERROR is not set
- lirc disabled due to i2c detach_client removal.



--- NEW FILE patch-2.6.30-git15.bz2.sign ---
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: See http://www.kernel.org/signature.html for info

iD4DBQBKPNGcyGugalF9Dw4RAlU1AJ43MIuOrkrTrIxhOE8l3YChMRz+dwCYitJB
4S1+tOQDiSKk44TEanWatg==
=l5h+
-----END PGP SIGNATURE-----

sched-introduce-SCHED_RESET_ON_FORK-scheduling-policy-flag.patch:

--- NEW FILE sched-introduce-SCHED_RESET_ON_FORK-scheduling-policy-flag.patch ---
From: Lennart Poettering <lennart at poettering.net>
Date: Mon, 15 Jun 2009 15:17:47 +0000 (+0200)
Subject: sched: Introduce SCHED_RESET_ON_FORK scheduling policy flag
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fx86%2Flinux-2.6-tip.git;a=commitdiff_plain;h=ca94c442535a44d508c99a77e54f21a59f4fc462

sched: Introduce SCHED_RESET_ON_FORK scheduling policy flag

This patch introduces a new flag SCHED_RESET_ON_FORK which can be passed
to the kernel via sched_setscheduler(), ORed in the policy parameter. If
set this will make sure that when the process forks a) the scheduling
priority is reset to DEFAULT_PRIO if it was higher and b) the scheduling
policy is reset to SCHED_NORMAL if it was either SCHED_FIFO or SCHED_RR.

Why have this?

Currently, if a process is real-time scheduled this will 'leak' to all
its child processes. For security reasons it is often (always?) a good
idea to make sure that if a process acquires RT scheduling this is
confined to this process and only this process. More specifically this
makes the per-process resource limit RLIMIT_RTTIME useful for security
purposes, because it makes it impossible to use a fork bomb to
circumvent the per-process RLIMIT_RTTIME accounting.

This feature is also useful for tools like 'renice' which can then
change the nice level of a process without having this spill to all its
child processes.

Why expose this via sched_setscheduler() and not other syscalls such as
prctl() or sched_setparam()?

prctl() does not take a pid parameter. Due to that it would be
impossible to modify this flag for other processes than the current one.

The struct passed to sched_setparam() can unfortunately not be extended
without breaking compatibility, since sched_setparam() lacks a size
parameter.

How to use this from userspace? In your RT program simply replace this:

  sched_setscheduler(pid, SCHED_FIFO, &param);

by this:

  sched_setscheduler(pid, SCHED_FIFO|SCHED_RESET_ON_FORK, &param);

Signed-off-by: Lennart Poettering <lennart at poettering.net>
Acked-by: Peter Zijlstra <a.p.zijlstra at chello.nl>
LKML-Reference: <20090615152714.GA29092 at tango.0pointer.de>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4896fdf..d4a2c66 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -38,6 +38,8 @@
 #define SCHED_BATCH		3
 /* SCHED_ISO: reserved but not implemented yet */
 #define SCHED_IDLE		5
+/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
+#define SCHED_RESET_ON_FORK     0x40000000
 
 #ifdef __KERNEL__
 
@@ -1209,6 +1211,10 @@ struct task_struct {
 	unsigned did_exec:1;
 	unsigned in_execve:1;	/* Tell the LSMs that the process is doing an
 				 * execve */
+
+	/* Revert to default priority/policy when forking */
+	unsigned sched_reset_on_fork:1;
+
 	pid_t pid;
 	pid_t tgid;
 
diff --git a/kernel/sched.c b/kernel/sched.c
index 8ec9d13..32e6ede 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2613,12 +2613,28 @@ void sched_fork(struct task_struct *p, int clone_flags)
 	set_task_cpu(p, cpu);
 
 	/*
-	 * Make sure we do not leak PI boosting priority to the child:
+	 * Revert to default priority/policy on fork if requested. Make sure we
+	 * do not leak PI boosting priority to the child.
 	 */
-	p->prio = current->normal_prio;
+	if (current->sched_reset_on_fork &&
+			(p->policy == SCHED_FIFO || p->policy == SCHED_RR))
+		p->policy = SCHED_NORMAL;
+
+	if (current->sched_reset_on_fork &&
+			(current->normal_prio < DEFAULT_PRIO))
+		p->prio = DEFAULT_PRIO;
+	else
+		p->prio = current->normal_prio;
+
 	if (!rt_prio(p->prio))
 		p->sched_class = &fair_sched_class;
 
+	/*
+	 * We don't need the reset flag anymore after the fork. It has
+	 * fulfilled its duty:
+	 */
+	p->sched_reset_on_fork = 0;
+
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
 	if (likely(sched_info_on()))
 		memset(&p->sched_info, 0, sizeof(p->sched_info));
@@ -6094,17 +6110,25 @@ static int __sched_setscheduler(struct task_struct *p, int policy,
 	unsigned long flags;
 	const struct sched_class *prev_class = p->sched_class;
 	struct rq *rq;
+	int reset_on_fork;
 
 	/* may grab non-irq protected spin_locks */
 	BUG_ON(in_interrupt());
 recheck:
 	/* double check policy once rq lock held */
-	if (policy < 0)
+	if (policy < 0) {
+		reset_on_fork = p->sched_reset_on_fork;
 		policy = oldpolicy = p->policy;
-	else if (policy != SCHED_FIFO && policy != SCHED_RR &&
-			policy != SCHED_NORMAL && policy != SCHED_BATCH &&
-			policy != SCHED_IDLE)
-		return -EINVAL;
+	} else {
+		reset_on_fork = !!(policy & SCHED_RESET_ON_FORK);
+		policy &= ~SCHED_RESET_ON_FORK;
+
+		if (policy != SCHED_FIFO && policy != SCHED_RR &&
+				policy != SCHED_NORMAL && policy != SCHED_BATCH &&
+				policy != SCHED_IDLE)
+			return -EINVAL;
+	}
+
 	/*
 	 * Valid priorities for SCHED_FIFO and SCHED_RR are
 	 * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL,
@@ -6148,6 +6172,10 @@ recheck:
 		/* can't change other user's priorities */
 		if (!check_same_owner(p))
 			return -EPERM;
+
+		/* Normal users shall not reset the sched_reset_on_fork flag */
+		if (p->sched_reset_on_fork && !reset_on_fork)
+			return -EPERM;
 	}
 
 	if (user) {
@@ -6191,6 +6219,8 @@ recheck:
 	if (running)
 		p->sched_class->put_prev_task(rq, p);
 
+	p->sched_reset_on_fork = reset_on_fork;
+
 	oldprio = p->prio;
 	__setscheduler(rq, p, policy, param->sched_priority);
 
@@ -6307,14 +6337,15 @@ SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
 	if (p) {
 		retval = security_task_getscheduler(p);
 		if (!retval)
-			retval = p->policy;
+			retval = p->policy
+				| (p->sched_reset_on_fork ? SCHED_RESET_ON_FORK : 0);
 	}
 	read_unlock(&tasklist_lock);
 	return retval;
 }
 
 /**
- * sys_sched_getscheduler - get the RT priority of a thread
+ * sys_sched_getparam - get the RT priority of a thread
  * @pid: the pid in question.
  * @param: structure containing the RT priority.
  */


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/.cvsignore,v
retrieving revision 1.1081
retrieving revision 1.1082
diff -u -p -r1.1081 -r1.1082
--- .cvsignore	19 Jun 2009 22:06:33 -0000	1.1081
+++ .cvsignore	20 Jun 2009 19:36:13 -0000	1.1082
@@ -5,4 +5,4 @@ kernel-2.6.*.config
 temp-*
 kernel-2.6.30
 linux-2.6.30.tar.bz2
-patch-2.6.30-git14.bz2
+patch-2.6.30-git15.bz2


Index: config-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/config-generic,v
retrieving revision 1.290
retrieving revision 1.291
diff -u -p -r1.290 -r1.291
--- config-generic	19 Jun 2009 22:06:33 -0000	1.290
+++ config-generic	20 Jun 2009 19:36:13 -0000	1.291
@@ -367,6 +367,7 @@ CONFIG_LSF=y
 CONFIG_BLK_DEV_DELKIN=m
 # CONFIG_BLK_DEV_IT8213 is not set
 # CONFIG_BLK_DEV_TC86C001 is not set
+CONFIG_LBDAF=y
 CONFIG_BLK_DEV_BSG=y
 CONFIG_BLK_DEV_INTEGRITY=y
 
@@ -4007,3 +4008,9 @@ CONFIG_IEEE802154_FAKEHARD=m
 
 CONFIG_PPS=m
 # CONFIG_PPS_DEBUG is not set
+
+# CONFIG_USB_SERIAL_QUATECH2 is not set
+# CONFIG_VT6655 is not set
+# CONFIG_USB_CPC is not set
+# CONFIG_RDC_17F3101X is not set
+# CONFIG_FB_UDL is not set


Index: config-powerpc-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/config-powerpc-generic,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -p -r1.45 -r1.46
--- config-powerpc-generic	18 Jun 2009 19:05:53 -0000	1.45
+++ config-powerpc-generic	20 Jun 2009 19:36:14 -0000	1.46
@@ -328,3 +328,5 @@ CONFIG_PPC_EMULATED_STATS=y
 CONFIG_SWIOTLB=y
 
 # CONFIG_RDS is not set
+
+# CONFIG_PPC_DISABLE_WERROR is not set


Index: config-powerpc32-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/config-powerpc32-generic,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -p -r1.32 -r1.33
--- config-powerpc32-generic	18 Jun 2009 19:05:53 -0000	1.32
+++ config-powerpc32-generic	20 Jun 2009 19:36:14 -0000	1.33
@@ -167,6 +167,7 @@ CONFIG_MPC837x_MDS=y
 CONFIG_MPC837x_RDB=y
 CONFIG_SBC834x=y
 CONFIG_ASP834x=y
+CONFIG_KMETER1=y
 CONFIG_MPC8641_HPCN=y
 CONFIG_SBC8641D=y
 CONFIG_MPC8610_HPCD=y


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1578
retrieving revision 1.1579
diff -u -p -r1.1578 -r1.1579
--- kernel.spec	19 Jun 2009 22:37:26 -0000	1.1578
+++ kernel.spec	20 Jun 2009 19:36:14 -0000	1.1579
@@ -58,7 +58,7 @@ Summary: The Linux kernel
 # The rc snapshot level
 %define rcrev 0
 # The git snapshot level
-%define gitrev 14
+%define gitrev 15
 # Set rpm version accordingly
 %define rpmversion 2.6.%{upstream_sublevel}
 %endif
@@ -590,6 +590,8 @@ Patch20: linux-2.6-hotfixes.patch
 Patch21: linux-2.6-tracehook.patch
 Patch22: linux-2.6-utrace.patch
 
+Patch30: sched-introduce-SCHED_RESET_ON_FORK-scheduling-policy-flag.patch
+
 Patch41: linux-2.6-sysrq-c.patch
 
 Patch141: linux-2.6-ps3-storage-alias.patch
@@ -1083,6 +1085,8 @@ ApplyPatch linux-2.6-hotfixes.patch
 ApplyPatch linux-2.6-tracehook.patch
 ApplyPatch linux-2.6-utrace.patch
 
+ApplyPatch sched-introduce-SCHED_RESET_ON_FORK-scheduling-policy-flag.patch
+
 # enable sysrq-c on all kernels, not only kexec
 #ApplyPatch linux-2.6-sysrq-c.patch
 
@@ -1207,7 +1211,7 @@ ApplyPatch linux-2.6-crash-driver.patch
 #ApplyPatch linux-2.6-neigh_-fix-state-transition-INCOMPLETE-_FAILED-via-Netlink-request.patch
 
 # http://www.lirc.org/
-ApplyPatch linux-2.6.29-lirc.patch
+#ApplyPatch linux-2.6.29-lirc.patch
 
 ApplyPatch linux-2.6-e1000-ich9.patch
 
@@ -1823,6 +1827,27 @@ fi
 # and build.
 
 %changelog
+* Sat Jun 20 2009 Kyle McMartin <kyle at redhat.com> 2.6.31.0.16.rc0.git15
+- 2.6.30-git15
+- config changes:
+ - generic:
+  - CONFIG_LBDAF=y
+ - staging:
+  - CONFIG_USB_SERIAL_QUATECH2 is not set
+  - CONFIG_VT6655 is not set
+  - CONFIG_USB_CPC is not set
+  - CONFIG_RDC_17F3101X is not set
+  - CONFIG_FB_UDL is not set
+ - ppc32:
+  - CONFIG_KMETER1=y
+ - ppc generic:
+  - CONFIG_PPC_DISABLE_WERROR is not set
+- lirc disabled due to i2c detach_client removal.
+
+* Sat Jun 20 2009 Kyle McMartin <kyle at redhat.com>
+- sched-introduce-SCHED_RESET_ON_FORK-scheduling-policy-flag.patch: add,
+  queued in tip/sched/core (ca94c442535a44d508c99a77e54f21a59f4fc462)
+
 * Fri Jun 19 2009 Kyle McMartin <kyle at redhat.com> 2.6.31.0.15.rc0.git14
 - Fix up ptrace, hopefully. Builds on x86_64 at least.
 


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/sources,v
retrieving revision 1.1039
retrieving revision 1.1040
diff -u -p -r1.1039 -r1.1040
--- sources	19 Jun 2009 22:06:35 -0000	1.1039
+++ sources	20 Jun 2009 19:36:14 -0000	1.1040
@@ -1,2 +1,2 @@
 7a80058a6382e5108cdb5554d1609615  linux-2.6.30.tar.bz2
-803a66d630550b3b0a5ce1dbd88fa7c7  patch-2.6.30-git14.bz2
+eb1c2b07400ce29fa17f808bac06cc7a  patch-2.6.30-git15.bz2


Index: upstream
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/upstream,v
retrieving revision 1.953
retrieving revision 1.954
diff -u -p -r1.953 -r1.954
--- upstream	19 Jun 2009 22:06:35 -0000	1.953
+++ upstream	20 Jun 2009 19:36:14 -0000	1.954
@@ -1,2 +1,2 @@
 linux-2.6.30.tar.bz2
-patch-2.6.30-git14.bz2
+patch-2.6.30-git15.bz2


--- patch-2.6.30-git14.bz2.sign DELETED ---




More information about the fedora-extras-commits mailing list