[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <556484BD.2060004@tycho.nsa.gov>
Date: Tue, 26 May 2015 10:35:41 -0400
From: Stephen Smalley <sds@...ho.nsa.gov>
To: Lukasz Pawelczyk <l.pawelczyk@...sung.com>,
"David S. Miller" <davem@...emloft.net>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
"Kirill A. Shutemov" <kirill@...temov.name>,
"Serge E. Hallyn" <serge@...lyn.com>,
Al Viro <viro@...iv.linux.org.uk>,
Alexey Dobriyan <adobriyan@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Lutomirski <luto@...capital.net>,
Casey Schaufler <casey@...aufler-ca.com>,
David Howells <dhowells@...hat.com>,
Fabian Frederick <fabf@...net.be>,
Greg KH <gregkh@...uxfoundation.org>,
James Morris <james.l.morris@...cle.com>,
Jeff Layton <jlayton@...marydata.com>,
Jingoo Han <jg1.han@...sung.com>,
Joe Perches <joe@...ches.com>,
John Johansen <john.johansen@...onical.com>,
Jonathan Corbet <corbet@....net>,
Kees Cook <keescook@...omium.org>,
Mauro Carvalho Chehab <mchehab@....samsung.com>,
Miklos Szeredi <miklos@...redi.hu>,
Oleg Nesterov <oleg@...hat.com>,
Paul Moore <paul@...l-moore.com>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
Zefan Li <lizefan@...wei.com>,
Rafal Krypa <r.krypa@...sung.com>, linux-doc@...r.kernel.org,
linux-api@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org,
containers@...ts.linux-foundation.org
CC: Lukasz Pawelczyk <havner@...il.com>
Subject: Re: [PATCH v2 0/7] Smack namespace
On 05/25/2015 08:32 AM, Lukasz Pawelczyk wrote:
> --- Design ideas ---
>
> "Smack namespace" is rather "Smack labels namespace" as not the whole
> MAC is namespaced, only the labels. There is a great analogy between
> Smack labels namespace and the user namespace part that remaps UIDs.
>
> The idea is to create a map of labels for a namespace so the namespace
> is only allowed to use those labels. Smack rules are always the same
> as in the init namespace (limited only by what labels are mapped) and
> cannot be manipulated from the child namespace. The map is actually
> only for labels' names. The underlying structures for labels remain
> the same. The filesystem also stores the "unmapped" labels from the
> init namespace.
How do you achieve that without introducing additional hooks or
reworking the current hooks in the setxattr code path? At present, the
security module is allowed to rewrite getxattr requests on the
security.* namespace but it isn't allowed to do that for setxattr, so if
the process invokes setxattr with a mapped label, then it will be the
mapped label that gets passed to the filesystem implementation, not the
unmapped label. The security module may internally store it in unmapped
form and may even return that upon getxattr() calls, but if you then
reboot the system and later fetch from the filesystem, it will get the
mapped label value.
> --- Usage ---
>
> Smack namespace is written using LSM hooks inside user namespace. That
> means it's connected to it.
>
> To create a new Smack namespace you need to unshare() user namespace
> as usual. If that is all you do though, than there is no difference to
> what is now. To activate the Smack namespace you need to fill the
> labels' map. It is in a file /proc/$PID/smack_map.
This should be /proc/$PID/attr/label_map or similar, modeled after the
existing /proc/$PID/attr/current and similar nodes. Then it isn't
module-specific and can be reused for other modules.
> Writing to the map file is not disabled after the first write as it is
> in uid_map. For Smack we have no means to map ranges of labels, hence
> it can really be advantageous to be able to expand the map later
> on. But you can only add to the map. You cannot remove already mapped
> labels. You cannot change the already existing mappings. Also mappings
> has to be 1-1. All requests to create a map where either the unmapped
> or the mapped label already exists in the map will be denied.
Isn't it a concern that I can then add additional labels to the mapping
for which I am not authorized? Or is this mitigated by the fact that I
cannot alter the rules? What about the situation for the predefined
labels in Smack - are you assuming that they will always be mapped up
front in the mapping file?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists