All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segoon@openwall.com>
To: kernel-hardening@lists.openwall.com
Cc: Ingo Molnar <mingo@elte.hu>,
	"Paul E. McKenney" <paul.mckenney@linaro.org>,
	Manuel Lauss <manuel.lauss@googlemail.com>,
	linux-kernel@vger.kernel.org, Richard Weinberger <richard@nod.at>,
	torvalds@linux-foundation.org, Marc Zyngier <maz@misterjones.org>
Subject: Re: [kernel-hardening] Re: initcall dependency problem (ns vs. threads)
Date: Mon, 1 Aug 2011 23:22:45 +0400	[thread overview]
Message-ID: <20110801192245.GA7202@albatros> (raw)
In-Reply-To: <20110801120750.5c0e6d2b.akpm@linux-foundation.org>

On Mon, Aug 01, 2011 at 12:07 -0700, Andrew Morton wrote:
> On Mon, 1 Aug 2011 23:03:41 +0400
> Vasiliy Kulikov <segoon@openwall.com> wrote:
> 
> > > Are we talking about init_ipc_ns.ids[] here?  If so, did you try
> > > initializing the three rwsems at compile-time?
> > > 
> > > That's rather a nasty hack though.  It'd be better to run the mystery
> > > init function before starting the threads.
> > 
> > Looks like it solves the race.
> 
> What patch are you talking about here?

Sorry for short sentences :)  I tried the patch you've suggested -
initialize rw_mutex in the init_ipc_ns declaration.  Surely, it solves a
specific race.  As no kernel threads actually use shm, other fields are
not needed to be initialized before do_initcall().

However, it is a bit ugly as it divides namespace initialization code
into init_ipc_ns initialization and other namespaces.  It's better to
use the same code for all namespaces (as it currently is).


> >  However, I think it should be solved on
> > another level.
> 
> What level?

I mean it is a bug of _implicit_ assume that kthreads don't use ns
related information.  So, AFAICS, it can be fixed 2 ways:

1) Move creations of kernel threads somewhere after namespaces
initializations in the init chain.

2) Deferring threads creation until all ns initialization is done.


> >  Other bugs might be hidden with this race.
> 
> What bugs?

I don't speak about specific bugs (I know the only one, which is this shm
related bug), but I suppose some threads might use some ns related
information as well.  At least I don't see whether it is somehow
explicitly denied currently.

Thanks,

-- 
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments

  reply	other threads:[~2011-08-01 19:22 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01 18:01 [kernel-hardening] initcall dependency problem (ns vs. threads) Vasiliy Kulikov
2011-08-01 18:01 ` Vasiliy Kulikov
2011-08-01 18:20 ` [kernel-hardening] " Andrew Morton
2011-08-01 18:20   ` Andrew Morton
2011-08-01 18:34   ` [kernel-hardening] " Vasiliy Kulikov
2011-08-01 19:03   ` Vasiliy Kulikov
2011-08-01 19:07     ` Andrew Morton
2011-08-01 19:22       ` Vasiliy Kulikov [this message]
2011-08-02  0:01     ` Linus Torvalds
2011-08-02 12:45       ` [kernel-hardening] [PATCH] shm: fix a race between shm_exit() and shm_init() Vasiliy Kulikov
2011-08-02 12:45         ` Vasiliy Kulikov
2011-08-02 12:51         ` [kernel-hardening] " Manuel Lauss
2011-08-02 12:51           ` Manuel Lauss
2011-08-02 13:23         ` [kernel-hardening] " Richard Weinberger
2011-08-02 13:23           ` Richard Weinberger
2011-08-02 13:29         ` [kernel-hardening] " Marc Zyngier
2011-08-02 13:29           ` Marc Zyngier
2011-08-02 20:33         ` [kernel-hardening] " Andrew Morton
2011-08-02 20:33           ` Andrew Morton
2011-08-02 20:55         ` [kernel-hardening] " Andrew Morton
2011-08-02 20:55           ` Andrew Morton
2011-08-03  5:30           ` [kernel-hardening] " Manuel Lauss
2011-08-03  5:30             ` Manuel Lauss
2011-08-03  8:05           ` [kernel-hardening] " Marc Zyngier
2011-08-03  8:05             ` Marc Zyngier
2011-08-03  8:19             ` [kernel-hardening] " Linus Torvalds
2011-08-03  8:19               ` Linus Torvalds
2011-08-03 10:04               ` [kernel-hardening] " Manuel Lauss
2011-08-03 10:04                 ` Manuel Lauss
2011-08-03 10:30               ` [kernel-hardening] " Marc Zyngier
2011-08-03 10:30                 ` Marc Zyngier
2011-08-03 13:13                 ` Thadeu Lima de Souza Cascardo
2011-08-03 13:33                   ` Kay Sievers
2011-08-03 13:45                     ` Richard Weinberger
2011-08-04  0:35                 ` [kernel-hardening] " Linus Torvalds
2011-08-04  0:35                   ` Linus Torvalds
2011-08-04  0:50                   ` [kernel-hardening] " Andrew Morton
2011-08-04  0:50                     ` Andrew Morton
2011-08-04  1:01                     ` [kernel-hardening] " Linus Torvalds
2011-08-04  1:01                       ` Linus Torvalds
2011-08-04  1:15                       ` [kernel-hardening] " Kay Sievers
2011-08-04  1:15                         ` Kay Sievers
2011-08-04  8:26                   ` [kernel-hardening] " Marc Zyngier
2011-08-04  8:26                     ` Marc Zyngier
2011-08-03  7:43         ` [kernel-hardening] " Linus Torvalds
2011-08-03  7:43           ` Linus Torvalds
2011-08-03  7:50           ` [kernel-hardening] " Manuel Lauss
2011-08-03  7:50             ` Manuel Lauss
2011-08-03  8:00             ` [kernel-hardening] " Manuel Lauss
2011-08-03  8:00               ` Manuel Lauss
2011-08-03 19:33           ` [kernel-hardening] " Andrew Morton
2011-08-03 19:33             ` Andrew Morton
2011-08-03 19:52             ` [kernel-hardening] " Vasiliy Kulikov

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=20110801192245.GA7202@albatros \
    --to=segoon@openwall.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manuel.lauss@googlemail.com \
    --cc=maz@misterjones.org \
    --cc=mingo@elte.hu \
    --cc=paul.mckenney@linaro.org \
    --cc=richard@nod.at \
    --cc=torvalds@linux-foundation.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.