linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 10/10] LSM: SafeSetID: fix use of literal -1 in capable hook
@ 2019-04-10 16:56 Micah Morton
  2019-04-10 17:28 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Micah Morton @ 2019-04-10 16:56 UTC (permalink / raw)
  To: jmorris, keescook, casey, linux-security-module; +Cc: Jann Horn, Micah Morton

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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 10/10] LSM: SafeSetID: fix use of literal -1 in capable hook
  2019-04-10 16:56 [PATCH 10/10] LSM: SafeSetID: fix use of literal -1 in capable hook Micah Morton
@ 2019-04-10 17:28 ` Kees Cook
  2019-05-07 15:03   ` Micah Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2019-04-10 17:28 UTC (permalink / raw)
  To: Micah Morton
  Cc: James Morris, Casey Schaufler, linux-security-module, Jann Horn

On Wed, Apr 10, 2019 at 9:56 AM Micah Morton <mortonm@chromium.org> wrote:
>
> 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 <keescook@chromium.org>

-Kees

> ---
>  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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 10/10] LSM: SafeSetID: fix use of literal -1 in capable hook
  2019-04-10 17:28 ` Kees Cook
@ 2019-05-07 15:03   ` Micah Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Micah Morton @ 2019-05-07 15:03 UTC (permalink / raw)
  To: Kees Cook; +Cc: James Morris, Casey Schaufler, linux-security-module, Jann Horn

Ready for merge.

On Wed, Apr 10, 2019 at 10:29 AM Kees Cook <keescook@chromium.org> wrote:
>
> On Wed, Apr 10, 2019 at 9:56 AM Micah Morton <mortonm@chromium.org> wrote:
> >
> > 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 <keescook@chromium.org>
>
> -Kees
>
> > ---
> >  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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-07 15:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-10 16:56 [PATCH 10/10] LSM: SafeSetID: fix use of literal -1 in capable hook Micah Morton
2019-04-10 17:28 ` Kees Cook
2019-05-07 15:03   ` Micah Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).