[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEjxPJ6HBGaPVbWFBTYgDDpDX6duvpJvCinSJP863kM69=qWqg@mail.gmail.com>
Date: Mon, 4 Jan 2021 09:22:22 -0500
From: Stephen Smalley <stephen.smalley.work@...il.com>
To: Stephen Brennan <stephen.s.brennan@...cle.com>
Cc: Alexey Dobriyan <adobriyan@...il.com>,
James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
LSM List <linux-security-module@...r.kernel.org>,
Paul Moore <paul@...l-moore.com>,
Eric Paris <eparis@...isplace.org>,
SElinux list <selinux@...r.kernel.org>,
Casey Schaufler <casey@...aufler-ca.com>,
Eric Biederman <ebiederm@...ssion.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Linux FS Devel <linux-fsdevel@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v3 2/2] proc: ensure security hook is called after exec
On Mon, Jan 4, 2021 at 9:16 AM Stephen Smalley
<stephen.smalley.work@...il.com> wrote:
>
> On Fri, Dec 18, 2020 at 7:06 PM Stephen Brennan
> <stephen.s.brennan@...cle.com> wrote:
> >
> > Smack needs its security_task_to_inode() hook to be called when a task
> > execs a new executable. Store the self_exec_id of the task and call the
> > hook via pid_update_inode() whenever the exec_id changes.
> >
> > Signed-off-by: Stephen Brennan <stephen.s.brennan@...cle.com>
>
> Sorry to be late in responding, but the proc inode security structure
> needs to be updated not only upon a context-changing exec but also
> upon a setcon(3) aka write to /proc/self/attr/current just like the
> uid/gid needs to be updated not only upon a setuid exec but also upon
> a setuid(2). I'm also unclear as to why you can't call
> security_task_to_inode during RCU lookup; it doesn't block/sleep
> AFAICT.
> All it does is take a spinlock and update a few fields.
You could also optimize this by comparing the sid similar to how the
uid/gid are compared and only updating it within the hook if it has
not yet been initialized or has changed since it was originally set.
Powered by blists - more mailing lists