Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1525596

Re: [PATCH v2] slab: Add POISON_POINTER_DELTA to ZERO_SIZE_PTR

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] slab: Add POISON_POINTER_DELTA to ZERO_SIZE_PTR
Date 2016-11-18 19:00 +0100
Message-ID <sEVCa-1Ow-5@gated-at.bofh.it> (permalink)
References <sErE6-7my-21@gated-at.bofh.it> <sEVst-1L1-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Nov 18, 2016 at 9:47 AM, Christoph Lameter <cl@linux.com> wrote:
> On Thu, 17 Nov 2016, Michael Ellerman wrote:
>
>> Currently ZERO_OR_NULL_PTR() uses a trick of doing a single check that
>> x <= ZERO_SIZE_PTR, and ignoring the fact that it also matches 1-15.
>
> Well yes that was done so we do not add too many branches all over the
> kernel.....

There are actually very few callers of this macro. (Though it's
possible they're executed frequently.)

>> That no longer really works once we add the poison delta, so split it
>> into two checks. Assign x to a temporary to avoid evaluating it
>> twice (suggested by Kees Cook).
>
> And now you are doing just that.

In this case, what about the original < ZERO_SIZE_PTR check Michael
suggested? At least the one use in usercopy.c needs to be fixed, but
otherwise, it should be fine?

-Kees

-- 
Kees Cook
Nexus Security

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] slab: Add POISON_POINTER_DELTA to ZERO_SIZE_PTR Michael Ellerman <mpe@ellerman.id.au> - 2016-11-17 11:00 +0100
  Re: [PATCH v2] slab: Add POISON_POINTER_DELTA to ZERO_SIZE_PTR Kees Cook <keescook@chromium.org> - 2016-11-17 21:10 +0100
  Re: [PATCH v2] slab: Add POISON_POINTER_DELTA to ZERO_SIZE_PTR Christoph Lameter <cl@linux.com> - 2016-11-18 18:50 +0100
    Re: [PATCH v2] slab: Add POISON_POINTER_DELTA to ZERO_SIZE_PTR Kees Cook <keescook@chromium.org> - 2016-11-18 19:00 +0100
      Re: [PATCH v2] slab: Add POISON_POINTER_DELTA to ZERO_SIZE_PTR Christoph Lameter <cl@linux.com> - 2016-11-18 19:40 +0100

csiph-web