Thread (3 messages) 3 messages, 2 authors, 2019-05-07

Re: [PATCH 10/10] LSM: SafeSetID: fix use of literal -1 in capable hook

From: Micah Morton <mortonm@chromium.org>
Date: 2019-05-07 15:03:55

Ready for merge.

On Wed, Apr 10, 2019 at 10:29 AM Kees Cook [off-list ref] wrote:
On Wed, Apr 10, 2019 at 9:56 AM Micah Morton [off-list ref] wrote:
quoted
From: Jann Horn <jannh@google.com>

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 <jannh@google.com>
Signed-off-by: Micah Morton <mortonm@chromium.org>
Reviewed-by: Kees Cook <redacted>

-Kees
quoted
---
 security/safesetid/lsm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/safesetid/lsm.c b/security/safesetid/lsm.c
index 4ab4d7cdba31..61b84e20f2dd 100644
--- a/security/safesetid/lsm.c
+++ b/security/safesetid/lsm.c
@@ -90,7 +90,7 @@ static int safesetid_security_capable(const struct cred *cred,
         */
        pr_warn("Operation requires CAP_SETUID, which is not available to UID %u for operations besides approved set*uid transitions\n",
                __kuid_val(cred->uid));
-       return -1;
+       return -EPERM;
 }

 /*
--
2.21.0.392.gf8f6787159e-goog

--
Kees Cook
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help