lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 21 Jun 2019 10:56:07 -0400
From:   Qian Cai <cai@....pw>
To:     Alexander Potapenko <glider@...gle.com>
Cc:     Kees Cook <keescook@...omium.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next v2] mm/page_alloc: fix a false memory corruption

On Fri, 2019-06-21 at 16:37 +0200, Alexander Potapenko wrote:
> On Fri, Jun 21, 2019 at 2:26 PM Qian Cai <cai@....pw> wrote:
> > 
> > On Fri, 2019-06-21 at 12:39 +0200, Alexander Potapenko wrote:
> > > On Fri, Jun 21, 2019 at 3:01 AM Kees Cook <keescook@...omium.org> wrote:
> > > > 
> > > > On Thu, Jun 20, 2019 at 04:46:06PM -0400, Qian Cai wrote:
> > > > > The linux-next commit "mm: security: introduce init_on_alloc=1 and
> > > > > init_on_free=1 boot options" [1] introduced a false positive when
> > > > > init_on_free=1 and page_poison=on, due to the page_poison expects the
> > > > > pattern 0xaa when allocating pages which were overwritten by
> > > > > init_on_free=1 with 0.
> > > > > 
> > > > > Fix it by switching the order between kernel_init_free_pages() and
> > > > > kernel_poison_pages() in free_pages_prepare().
> > > > 
> > > > Cool; this seems like the right approach. Alexander, what do you think?
> > > 
> > > Can using init_on_free together with page_poison bring any value at all?
> > > Isn't it better to decide at boot time which of the two features we're
> > > going to enable?
> > 
> > I think the typical use case is people are using init_on_free=1, and then
> > decide
> > to debug something by enabling page_poison=on. Definitely, don't want
> > init_on_free=1 to disable page_poison as the later has additional checking
> > in
> > the allocation time to make sure that poison pattern set in the free time is
> > still there.
> 
> In addition to information lifetime reduction the idea of init_on_free
> is to ensure the newly allocated objects have predictable contents.
> Therefore it's handy (although not strictly necessary) to keep them
> zero-initialized regardless of other boot-time flags.
> Right now free_pages_prezeroed() relies on that, though this can be changed.
> 
> On the other hand, since page_poison already initializes freed memory,
> we can probably make want_init_on_free() return false in that case to
> avoid extra initialization.
> 
> Side note: if we make it possible to switch betwen 0x00 and 0xAA in
> init_on_free mode, we can merge it with page_poison, performing the
> initialization depending on a boot-time flag and doing heavyweight
> checks under a separate config.

Yes, that would be great which will reduce code duplication.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ