linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: Paul Moore <paul@paul-moore.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>,
	"Andrew G. Morgan" <morgan@kernel.org>,
	Gaosheng Cui <cuigaosheng1@huawei.com>,
	akpm@linux-foundation.org, ezk@cs.sunysb.edu,
	linux-security-module@vger.kernel.org
Subject: Re: [PATCH] capabilities: fix undefined behavior in bit shift for CAP_TO_MASK
Date: Thu, 3 Nov 2022 08:24:34 -0500	[thread overview]
Message-ID: <20221103132434.GA30946@mail.hallyn.com> (raw)
In-Reply-To: <CAHC9VhSMFgifrUdMvogne+DC+gx_B9dW5mGsNZ8vstHpUsupOQ@mail.gmail.com>

On Thu, Nov 03, 2022 at 07:57:45AM -0400, Paul Moore wrote:
> On Tue, Nov 1, 2022 at 12:30 AM Serge E. Hallyn <serge@hallyn.com> wrote:
> > On Mon, Oct 31, 2022 at 07:18:54AM -0700, Andrew G. Morgan wrote:
> > > Acked-by: Andrew G. Morgan <morgan@kernel.org>
> > >
> > >
> > > On Mon, Oct 31, 2022 at 4:25 AM Gaosheng Cui <cuigaosheng1@huawei.com> wrote:
> > > >
> > > > Shifting signed 32-bit value by 31 bits is undefined, so changing
> > > > significant bit to unsigned. The UBSAN warning calltrace like below:
> > > >
> > > > UBSAN: shift-out-of-bounds in security/commoncap.c:1252:2
> > > > left shift of 1 by 31 places cannot be represented in type 'int'
> > > > Call Trace:
> > > >  <TASK>
> > > >  dump_stack_lvl+0x7d/0xa5
> > > >  dump_stack+0x15/0x1b
> > > >  ubsan_epilogue+0xe/0x4e
> > > >  __ubsan_handle_shift_out_of_bounds+0x1e7/0x20c
> > > >  cap_task_prctl+0x561/0x6f0
> > > >  security_task_prctl+0x5a/0xb0
> > > >  __x64_sys_prctl+0x61/0x8f0
> > > >  do_syscall_64+0x58/0x80
> > > >  entry_SYSCALL_64_after_hwframe+0x63/0xcd
> > > >  </TASK>
> > > >
> > > > Fixes: e338d263a76a ("Add 64-bit capability support to the kernel")
> > > > Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> >
> > Reviewed-by: Serge Hallyn <serge@hallyn.com>
> >
> > Paul, do you mind including this in your lsm tree?
> 
> Sure, although just a warning that it might not happen until next
> week.  Maybe I'll get some time this weekend but I can't be certain.

Ok, thanks.

I wouldn't mind putting up a capability tree if number of patches were
going to start ramping up, but historically that has not been worth it.

  reply	other threads:[~2022-11-03 13:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31 11:25 [PATCH] capabilities: fix undefined behavior in bit shift for CAP_TO_MASK Gaosheng Cui
2022-10-31 14:18 ` Andrew G. Morgan
2022-11-01  4:30   ` Serge E. Hallyn
2022-11-03 11:57     ` Paul Moore
2022-11-03 13:24       ` Serge E. Hallyn [this message]
2022-11-05  5:33         ` Paul Moore
2022-11-05  5:30 ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221103132434.GA30946@mail.hallyn.com \
    --to=serge@hallyn.com \
    --cc=akpm@linux-foundation.org \
    --cc=cuigaosheng1@huawei.com \
    --cc=ezk@cs.sunysb.edu \
    --cc=linux-security-module@vger.kernel.org \
    --cc=morgan@kernel.org \
    --cc=paul@paul-moore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).