mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: "Catalin Marinas" <catalin.marinas@gmail.com>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: Possible "struct pid" leak from tty_io.c
Date: Tue, 13 Mar 2007 13:31:52 -0600	[thread overview]
Message-ID: <m1veh5q6s7.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <b0943d9e0703120807t796e6c62k2422a93f6161db3a@mail.gmail.com> (Catalin Marinas's message of "Mon, 12 Mar 2007 15:07:39 +0000")

"Catalin Marinas" <catalin.marinas@gmail.com> writes:

> On 09/03/07, Eric W. Biederman <ebiederm@xmission.com> wrote:
>> If I can manage to focus on this, it looks like the information I need to
>> start fixing this.
>
> I had a look at the second leak reported it seems to be caused by the
> same proc_set_tty() call but, in this case, there is no
> disassociate_tty() call for the task (and the patch I posted is not
> enough). Maybe something like below (no thourough testing):
>
> diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
> index db91398..ea6ca7d 100644
> --- a/drivers/char/tty_io.c
> +++ b/drivers/char/tty_io.c
> @@ -3854,7 +3854,14 @@ EXPORT_SYMBOL(tty_devnum);
>
> void proc_clear_tty(struct task_struct *p)
> {
> +	struct tty_struct *tty;
> +
> 	spin_lock_irq(&p->sighand->siglock);
> +	tty = p->signal->tty;
> +	if (tty) {
> +		put_pid(tty->session);
> +		put_pid(tty->pgrp);
> +	}
> 	p->signal->tty = NULL;
> 	spin_unlock_irq(&p->sighand->siglock);
> }

This patch can't be right.  Not the way proc_clear_tty is called
once for each process in the session, plus we aren't clearing
tty->session and tty->pgrp here. 

If the above patch works it's a fluke.

Still it is the right general area of the code.  I've just started
looking at this it is going to take me a bit to come up to speed on
this code again and see what silly thing is missing.

Eric

  parent reply	other threads:[~2007-03-13 19:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-08 17:27 Catalin Marinas
2007-03-08 18:11 ` Eric W. Biederman
2007-03-09 10:53   ` Catalin Marinas
2007-03-09 16:13     ` Eric W. Biederman
2007-03-09 16:53       ` Catalin Marinas
2007-03-09 16:44   ` Catalin Marinas
2007-03-09 17:09     ` Eric W. Biederman
2007-03-12 15:07       ` Catalin Marinas
2007-03-12 16:12         ` Eric W. Biederman
2007-03-13 19:31         ` Eric W. Biederman [this message]
2007-03-14  9:59           ` Catalin Marinas
2007-03-14 14:40             ` Eric W. Biederman
2007-03-14 17:08               ` Catalin Marinas
2007-03-15 19:15                 ` Eric W. Biederman
2007-03-16 22:01                 ` Eric W. Biederman
2007-03-16 22:44                   ` Catalin Marinas
2007-03-18 18:45                     ` [PATCH] tty: Fix two reported pid leaks Eric W. Biederman
2007-03-18 18:52                       ` [PATCH 0/4] tty: small fixes and cleanups Eric W. Biederman
2007-03-18 18:57                         ` [PATCH 1/4] tty: Remove unnecessary export of proc_clear_tty Eric W. Biederman
2007-03-18 19:03                           ` [PATCH 2/4] tty: Simplify calling of put_pid Eric W. Biederman
2007-03-18 19:08                             ` [PATCH 3/4] tty: Introduce no_tty and use it in selinux Eric W. Biederman
2007-03-18 19:13                               ` [PATCH 4/4] tty: In tiocsctty when we steal a tty hang it up Eric W. Biederman
2007-03-18 20:55                               ` [PATCH 3/4] tty: Introduce no_tty and use it in selinux Alan Cox

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=m1veh5q6s7.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=catalin.marinas@gmail.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®