aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-03-24 10:43:30 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:30:23 -0400
commit3959214f971417f4162926ac52ad4cd042958caa (patch)
tree1e73536b383a2a8337c09c5630871b2f94a8bcfa /include
parentf6ee649f4b191d316a463ce7e514f9d12fa31c01 (diff)
sched: delayed cleanup of user_struct
During bootup performance tracing we see repeated occurrences of /sys/kernel/uid/* events for the same uid, leading to a, in this case, rather pointless userspace processing for the same uid over and over. This is usually caused by tools which change their uid to "nobody", to run without privileges to read data supplied by untrusted users. This change delays the execution of the (already existing) scheduled work, to cleanup the uid after one second, so the allocated and announced uid can possibly be re-used by another process. This is the current behavior, where almost every invocation of a binary, which changes the uid, creates two events: $ read START < /sys/kernel/uevent_seqnum; \ for i in `seq 100`; do su --shell=/bin/true bin; done; \ read END < /sys/kernel/uevent_seqnum; \ echo $(($END - $START)) 178 With the delayed cleanup, we get only two events, and userspace finishes a bit faster too: $ read START < /sys/kernel/uevent_seqnum; \ for i in `seq 100`; do su --shell=/bin/true bin; done; \ read END < /sys/kernel/uevent_seqnum; \ echo $(($END - $START)) 1 Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/sched.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c900aa530070..7531b1c28201 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -674,7 +674,7 @@ struct user_struct {
674 struct task_group *tg; 674 struct task_group *tg;
675#ifdef CONFIG_SYSFS 675#ifdef CONFIG_SYSFS
676 struct kobject kobj; 676 struct kobject kobj;
677 struct work_struct work; 677 struct delayed_work work;
678#endif 678#endif
679#endif 679#endif
680 680