lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 5 May 2020 12:23:53 -0400
From:   bfields@...ldses.org (J. Bruce Fields)
To:     Tejun Heo <tj@...nel.org>
Cc:     "J. Bruce Fields" <bfields@...hat.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        "open list:NFS, SUNRPC, AND..." <linux-nfs@...r.kernel.org>,
        Jeff Layton <jlayton@...hat.com>,
        David Howells <dhowells@...hat.com>, Shaohua Li <shli@...com>,
        Oleg Nesterov <oleg@...hat.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0/4] allow multiple kthreadd's

On Tue, May 05, 2020 at 11:54:05AM -0400, Tejun Heo wrote:
> Hello, Bruce.
> 
> On Mon, May 04, 2020 at 10:15:14PM -0400, J. Bruce Fields wrote:
> > We're currently using it to pass the struct svc_rqst that a new nfsd
> > thread needs.  But once the new thread has gotten that, I guess it could
> > set kthread->data to some global value that it uses to say "I'm a knfsd
> > thread"?
> > 
> > I suppose that would work.
> > 
> > Though now I'm feeling greedy: it would be nice to have both some kind
> > of global flag, *and* keep kthread->data pointing to svc_rqst (as that
> > would give me a simpler and quicker way to figure out which client is
> > conflicting).  Could I take a flag bit in kthread->flags, maybe?
> 
> Hmm... that'd be solvable if kthread->data can point to a struct which does
> both things, right?

Isn't this some sort of chicken-and-egg problem?

If you don't know whether a given kthread is an nfsd thread or not, then
it's not safe to assume that kthread->data points to some nfsd-specific
structure that might tell you whether it's an nfsd thread.

> Because it doesn't have free() callback, it's a bit
> awkward but the threadfn itself can unlink and RCU-free it before returning.

It's only ever going to be referenced from the thread itself.  This is
just a way to ask "am I running as an nfsd thread?" when we're deep
inside generic filesystem code somewhere.  So I don't think there's any
complicated lifetime issues here.

--b.

Powered by blists - more mailing lists