All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm+eric@ccr.net (Eric W. Biederman)
To: Andrea Arcangeli <andrea@e-mind.com>
Cc: linux-mm@kvack.org
Subject: Re: [patch] fixed both processes in D state and the /proc/ oopses [Re: [patch] Fixed the race that was oopsing Linux-2.2.0]
Date: 29 Jan 1999 08:13:05 -0600	[thread overview]
Message-ID: <m17lu6xj4e.fsf@flinx.ccr.net> (raw)
In-Reply-To: Andrea Arcangeli's message of "Fri, 29 Jan 1999 02:47:41 +0100 (CET)"

>>>>> "AA" == Andrea Arcangeli <andrea@e-mind.com> writes:

AA> On Thu, 28 Jan 1999, Linus Torvalds wrote:

>> You're missing the fact that whenever we own the mm, we know that NOBODY

AA> I return to the kernel module stat colletctor example:

AA> To be sure that the kernel stack of the process will not go away under me
AA> I need to held the tasklist_lock. Ok? So i'll do:

AA> 	read_lock(&tasklist_lock);
AA> 	tsk = find_task_by_pid(pid);
AA> 	if (tsk)
AA> 	{
AA> 		struct page * page = mem_map + MAP_NR(tsk);
AA> 		atomic_inc(&page->count);

Actually in the future we should have something increment the task count or 
similiar.  But I suppose keeping a page count should be enough.

AA> 	}
AA> 	read_unlock(&tasklist_lock);
AA> 	mdelay(10000000000000);

AA> So now I can wait all time I want and nobody can free and reuse my task
AA> struct and replace it with garbage under my eyes. OK?

AA> Now I want to play with the tsk->mm of the tsk. OK?

AA> I'll do:

AA> 	unlock_kernel();
AA> 	^^
AA> 	if (tsk->mm && tsk->mm != &init_mm)
AA> 	{
AA> 		mdelay(2000000000000000000);
AA> 		mmget();
AA> 	}

This would need to say.
	mm = tsk->mm;
	mmget(mm);
	if (mm != &init_mm) {
	/* xyz */
	}

And do_exit & exec would need to say:
     old_mm = tsk->mm;
     tsk->mm = new_mm; /* probably init_mm */
     mmput(old_mm);

There does to be a memory barier there to sychronize reads/writes of cache
data.  I forget off had what kind that needs to be.

The fix is just to never let bad sit in the tsk struct while it is valid.

Eric
--
To unsubscribe, send a message with 'unsubscribe linux-mm my@address'
in the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

  parent reply	other threads:[~1999-01-29 18:43 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.3.96.990127123207.15486A-100000@laser.bogus>
     [not found] ` <Pine.LNX.3.96.990127131315.19147A-100000@laser.bogus>
1999-01-27 21:38   ` [patch] fixed both processes in D state and the /proc/ oopses [Re: [patch] Fixed the race that was oopsing Linux-2.2.0] Stephen C. Tweedie
1999-01-27 21:45     ` Linus Torvalds
1999-01-28  1:02     ` Andrea Arcangeli
1999-01-28  2:50       ` Andrea Arcangeli
1999-01-28  4:20         ` [patch] fixed both processes in D state and the /proc/ oopses Tom Holroyd
1999-01-28  6:23         ` Tom Holroyd
1999-01-28 15:09         ` [patch] fixed both processes in D state and the /proc/ oopses [Re: [patch] Fixed the race that was oopsing Linux-2.2.0] Stephen C. Tweedie
1999-01-28 17:54           ` Linus Torvalds
1999-01-28 18:07             ` Stephen C. Tweedie
1999-01-28 18:17               ` Linus Torvalds
1999-01-28 18:25                 ` Stephen C. Tweedie
1999-01-28 19:23                 ` Alan Cox
1999-01-28 19:11                   ` Linus Torvalds
1999-01-28 20:11                     ` Alan Cox
1999-01-28 22:33               ` Andrea Arcangeli
1999-01-28 22:53                 ` Linus Torvalds
1999-01-29  1:47                   ` Andrea Arcangeli
1999-01-29 11:20                     ` MOLNAR Ingo
1999-01-29 12:08                       ` Andrea Arcangeli
1999-01-29 13:19                         ` MOLNAR Ingo
1999-01-29 14:14                           ` Andrea Arcangeli
1999-01-29 17:46                             ` Theodore Y. Ts'o
1999-01-29 14:13                     ` Eric W. Biederman [this message]
1999-01-30 15:42                       ` Andrea Arcangeli
1999-01-30 20:32                         ` Eric W. Biederman
1999-01-31  1:00                           ` Andrea Arcangeli
1999-01-31  8:36                             ` Eric W. Biederman
1999-01-31 19:16                               ` Andrea Arcangeli
1999-01-31 21:56                                 ` Eric W. Biederman
1999-01-29 18:24                     ` Linus Torvalds
1999-01-28 22:04             ` Andrea Arcangeli
1999-01-29  0:17               ` Linus Torvalds
1999-01-28 17:36         ` Linus Torvalds
1999-01-28 15:05       ` Stephen C. Tweedie

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=m17lu6xj4e.fsf@flinx.ccr.net \
    --to=ebiederm+eric@ccr.net \
    --cc=andrea@e-mind.com \
    --cc=linux-mm@kvack.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.