From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Linux Containers
<containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
"Eric W. Biederman"
<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH RFC] User namespaces: general cleanups
Date: Tue, 14 Oct 2008 09:33:51 -0500 [thread overview]
Message-ID: <20081014143351.GA9611@us.ibm.com> (raw)
In-Reply-To: <5306.1223939456-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Quoting David Howells (dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org):
> Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> 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-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
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-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
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
next prev parent reply other threads:[~2008-10-14 14:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-10 1:19 [PATCH RFC] User namespaces: general cleanups Serge E. Hallyn
[not found] ` <20081010011917.GA8046-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-10-10 10:06 ` David Howells
[not found] ` <30854.1223633214-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-10-10 17:06 ` Serge E. Hallyn
2008-10-13 16:01 ` Serge E. Hallyn
[not found] ` <20081013214108.GA4701-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-10-13 23:10 ` David Howells
[not found] ` <5306.1223939456-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-10-14 14:33 ` Serge E. Hallyn [this message]
[not found] ` <20081013160144.GA10359-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-10-13 21:41 ` Serge E. Hallyn
2008-10-14 17:50 ` David Howells
[not found] ` <29703.1224006618-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-10-14 21:43 ` Serge E. Hallyn
[not found] ` <20081014214327.GA28545-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-10-14 21:47 ` David Howells
2008-10-10 12:58 ` Keys and namespaces David Howells
[not found] ` <414.1223643503-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-10-10 16:46 ` Serge E. Hallyn
2008-10-10 22:30 ` Eric W. Biederman
[not found] ` <m1hc7k13s2.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
2008-10-13 16:27 ` Serge E. Hallyn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081014143351.GA9611@us.ibm.com \
--to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox