<feed xmlns='http://www.w3.org/2005/Atom'>
<title>blackbird-op-linux/security/safesetid, branch master</title>
<subtitle>Blackbird™ Linux sources for OpenPOWER</subtitle>
<id>https://git.raptorcs.com/git/blackbird-op-linux/atom?h=master</id>
<link rel='self' href='https://git.raptorcs.com/git/blackbird-op-linux/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/blackbird-op-linux/'/>
<updated>2019-10-30T15:45:57+00:00</updated>
<entry>
<title>security/safesetid: Replace rcu_swap_protected() with rcu_replace_pointer()</title>
<updated>2019-10-30T15:45:57+00:00</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@kernel.org</email>
</author>
<published>2019-10-04T22:07:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/blackbird-op-linux/commit/?id=a60a5746004d7dbb68cbccd4c16d0529e2b2d1d9'/>
<id>urn:sha1:a60a5746004d7dbb68cbccd4c16d0529e2b2d1d9</id>
<content type='text'>
This commit replaces the use of rcu_swap_protected() with the more
intuitively appealing rcu_replace_pointer() as a step towards removing
rcu_swap_protected().

Link: https://lore.kernel.org/lkml/CAHk-=wiAsJLw1egFEE=Z7-GGtM6wcvtyytXZA1+BHqta4gg6Hw@mail.gmail.com/
Reported-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Reported-by: Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
[ paulmck: From rcu_replace() to rcu_replace_pointer() per Ingo Molnar. ]
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Cc: Micah Morton &lt;mortonm@chromium.org&gt;
Cc: James Morris &lt;jmorris@namei.org&gt;
Cc: "Serge E. Hallyn" &lt;serge@hallyn.com&gt;
Cc: &lt;linux-security-module@vger.kernel.org&gt;
</content>
</entry>
<entry>
<title>LSM: SafeSetID: Stop releasing uninitialized ruleset</title>
<updated>2019-09-17T18:27:05+00:00</updated>
<author>
<name>Micah Morton</name>
<email>mortonm@chromium.org</email>
</author>
<published>2019-09-17T18:27:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/blackbird-op-linux/commit/?id=21ab8580b383f27b7f59b84ac1699cb26d6c3d69'/>
<id>urn:sha1:21ab8580b383f27b7f59b84ac1699cb26d6c3d69</id>
<content type='text'>
The first time a rule set is configured for SafeSetID, we shouldn't be
trying to release the previously configured ruleset, since there isn't
one. Currently, the pointer that would point to a previously configured
ruleset is uninitialized on first rule set configuration, leading to a
crash when we try to call release_ruleset with that pointer.

Acked-by: Jann Horn &lt;jannh@google.com&gt;
Signed-off-by: Micah Morton &lt;mortonm@chromium.org&gt;
</content>
</entry>
<entry>
<title>LSM: SafeSetID: fix use of literal -1 in capable hook</title>
<updated>2019-07-15T15:08:03+00:00</updated>
<author>
<name>Jann Horn</name>
<email>jannh@google.com</email>
</author>
<published>2019-04-10T16:56:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/blackbird-op-linux/commit/?id=e10337daefecb47209fd2af5f4fab0d1a370737f'/>
<id>urn:sha1:e10337daefecb47209fd2af5f4fab0d1a370737f</id>
<content type='text'>
The capable() hook returns an error number. -EPERM is actually the same as
-1, so this doesn't make a difference in behavior.

Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Signed-off-by: Micah Morton &lt;mortonm@chromium.org&gt;
</content>
</entry>
<entry>
<title>LSM: SafeSetID: verify transitive constrainedness</title>
<updated>2019-07-15T15:07:51+00:00</updated>
<author>
<name>Jann Horn</name>
<email>jannh@google.com</email>
</author>
<published>2019-04-11T20:12:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/blackbird-op-linux/commit/?id=4f72123da579655855301b591535a1415224f123'/>
<id>urn:sha1:4f72123da579655855301b591535a1415224f123</id>
<content type='text'>
Someone might write a ruleset like the following, expecting that it
securely constrains UID 1 to UIDs 1, 2 and 3:

    1:2
    1:3

However, because no constraints are applied to UIDs 2 and 3, an attacker
with UID 1 can simply first switch to UID 2, then switch to any UID from
there. The secure way to write this ruleset would be:

    1:2
    1:3
    2:2
    3:3

, which uses "transition to self" as a way to inhibit the default-allow
policy without allowing anything specific.

This is somewhat unintuitive. To make sure that policy authors don't
accidentally write insecure policies because of this, let the kernel verify
that a new ruleset does not contain any entries that are constrained, but
transitively unconstrained.

Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Signed-off-by: Micah Morton &lt;mortonm@chromium.org&gt;
</content>
</entry>
<entry>
<title>LSM: SafeSetID: add read handler</title>
<updated>2019-07-15T15:07:40+00:00</updated>
<author>
<name>Jann Horn</name>
<email>jannh@google.com</email>
</author>
<published>2019-04-11T20:11:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/blackbird-op-linux/commit/?id=fbd9acb2dc2aa55902c48a83f157082849209fba'/>
<id>urn:sha1:fbd9acb2dc2aa55902c48a83f157082849209fba</id>
<content type='text'>
For debugging a running system, it is very helpful to be able to see what
policy the system is using. Add a read handler that can dump out a copy of
the loaded policy.

Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Signed-off-by: Micah Morton &lt;mortonm@chromium.org&gt;
</content>
</entry>
<entry>
<title>LSM: SafeSetID: rewrite userspace API to atomic updates</title>
<updated>2019-07-15T15:07:29+00:00</updated>
<author>
<name>Jann Horn</name>
<email>jannh@google.com</email>
</author>
<published>2019-04-10T16:56:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/blackbird-op-linux/commit/?id=03638e62f55f27e7a96d6b1175e75b7a81e562b3'/>
<id>urn:sha1:03638e62f55f27e7a96d6b1175e75b7a81e562b3</id>
<content type='text'>
The current API of the SafeSetID LSM uses one write() per rule, and applies
each written rule instantly. This has several downsides:

 - While a policy is being loaded, once a single parent-child pair has been
   loaded, the parent is restricted to that specific child, even if
   subsequent rules would allow transitions to other child UIDs. This means
   that during policy loading, set*uid() can randomly fail.
 - To replace the policy without rebooting, it is necessary to first flush
   all old rules. This creates a time window in which no constraints are
   placed on the use of CAP_SETUID.
 - If we want to perform sanity checks on the final policy, this requires
   that the policy isn't constructed in a piecemeal fashion without telling
   the kernel when it's done.

Other kernel APIs - including things like the userns code and netfilter -
avoid this problem by performing updates atomically. Luckily, SafeSetID
hasn't landed in a stable (upstream) release yet, so maybe it's not too
late to completely change the API.

The new API for SafeSetID is: If you want to change the policy, open
"safesetid/whitelist_policy" and write the entire policy,
newline-delimited, in there.

Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Signed-off-by: Micah Morton &lt;mortonm@chromium.org&gt;
</content>
</entry>
<entry>
<title>LSM: SafeSetID: fix userns handling in securityfs</title>
<updated>2019-07-15T15:07:19+00:00</updated>
<author>
<name>Jann Horn</name>
<email>jannh@google.com</email>
</author>
<published>2019-04-10T16:55:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/blackbird-op-linux/commit/?id=71a98971b932174e121bc19056475c601598132f'/>
<id>urn:sha1:71a98971b932174e121bc19056475c601598132f</id>
<content type='text'>
Looking at current_cred() in write handlers is bad form, stop doing that.

Also, let's just require that the write is coming from the initial user
namespace. Especially SAFESETID_WHITELIST_FLUSH requires privilege over all
namespaces, and SAFESETID_WHITELIST_ADD should probably require it as well.

Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Signed-off-by: Micah Morton &lt;mortonm@chromium.org&gt;
</content>
</entry>
<entry>
<title>LSM: SafeSetID: refactor policy parsing</title>
<updated>2019-07-15T15:07:09+00:00</updated>
<author>
<name>Jann Horn</name>
<email>jannh@google.com</email>
</author>
<published>2019-04-10T16:55:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/blackbird-op-linux/commit/?id=78ae7df96d647627ceae0b65eea9e4f83a0a4b66'/>
<id>urn:sha1:78ae7df96d647627ceae0b65eea9e4f83a0a4b66</id>
<content type='text'>
In preparation for changing the policy parsing logic, refactor the line
parsing logic to be less verbose and move it into a separate function.

Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Signed-off-by: Micah Morton &lt;mortonm@chromium.org&gt;
</content>
</entry>
<entry>
<title>LSM: SafeSetID: refactor safesetid_security_capable()</title>
<updated>2019-07-15T15:06:58+00:00</updated>
<author>
<name>Jann Horn</name>
<email>jannh@google.com</email>
</author>
<published>2019-04-10T16:55:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/blackbird-op-linux/commit/?id=8068866c4af124345e2a129be921278aada7830f'/>
<id>urn:sha1:8068866c4af124345e2a129be921278aada7830f</id>
<content type='text'>
At the moment, safesetid_security_capable() has two nested conditional
blocks, and one big comment for all the logic. Chop it up and reduce the
amount of indentation.

Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Signed-off-by: Micah Morton &lt;mortonm@chromium.org&gt;
</content>
</entry>
<entry>
<title>LSM: SafeSetID: refactor policy hash table</title>
<updated>2019-07-15T15:05:48+00:00</updated>
<author>
<name>Jann Horn</name>
<email>jannh@google.com</email>
</author>
<published>2019-04-10T16:55:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/blackbird-op-linux/commit/?id=1cd02a27a9473fed0294561137cfb7dcc9b3aaa0'/>
<id>urn:sha1:1cd02a27a9473fed0294561137cfb7dcc9b3aaa0</id>
<content type='text'>
parent_kuid and child_kuid are kuids, there is no reason to make them
uint64_t. (And anyway, in the kernel, the normal name for that would be
u64, not uint64_t.)

check_setuid_policy_hashtable_key() and
check_setuid_policy_hashtable_key_value() are basically the same thing,
merge them.

Also fix the comment that claimed that (1&lt;&lt;8)==128.

Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Signed-off-by: Micah Morton &lt;mortonm@chromium.org&gt;
</content>
</entry>
</feed>
