Quoting David Howells (dhowells@xxxxxxxxxx): > Serge E. Hallyn <serue@xxxxxxxxxx> wrote: > > > With the following patch applied to the base next-creds-subsys branch, > > you can track that if you login as root, then do 'su hallyn', where > > hallyn is uid 500, then uid 500 gets allocated twice. So free is never > > called on it. > > Which following patch? Argh. The one below :) > Actually, I've suspected that the user_struct accounting is not quite right for > a while. Even before I did my creds stuff, I'd occasionally multiple per-UID > keyrings cropping up with the same ID - indicating multiple user_structs for > the same UID. > > David >From e00a2d98dd1086b0c863d8b416df33280c7c2574 Mon Sep 17 00:00:00 2001 From: Serge Hallyn <serue@xxxxxxxxxx> Date: Mon, 13 Oct 2008 16:36:05 -0500 Subject: [PATCH 1/1] creds: print user_struct refcounts print user_struct refcounts at alloc, and print msg at uid free. Signed-off-by: Serge Hallyn <serue@xxxxxxxxxx> --- kernel/user.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/kernel/user.c b/kernel/user.c index ed4dc57..3b9fd14 100644 --- a/kernel/user.c +++ b/kernel/user.c @@ -317,6 +317,7 @@ done: static inline void free_user(struct user_struct *up, unsigned long flags) { /* restore back the count */ + printk(KERN_NOTICE "%s: freeing a uid (%d)\n", __func__, up->uid); atomic_inc(&up->__count); spin_unlock_irqrestore(&uidhash_lock, flags); @@ -337,6 +338,7 @@ static inline void uids_mutex_unlock(void) { } */ static inline void free_user(struct user_struct *up, unsigned long flags) { + printk(KERN_NOTICE "%s: freeing a uid (%d)\n", __func__, up->uid); uid_hash_remove(up); spin_unlock_irqrestore(&uidhash_lock, flags); sched_destroy_user(up); @@ -431,6 +433,8 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid) } uids_mutex_unlock(); + printk(KERN_NOTICE "%s: alloced a uid (%d) (cnt %lu)\n", __func__, + uid, atomic_read(&up->__count)); return up; -- 1.5.4.3 _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers