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]
Message-ID: <202411172043.C19A3963@keescook>
Date: Sun, 17 Nov 2024 20:46:45 -0800
From: Kees Cook <kees@...nel.org>
To: Matthew Wilcox <willy@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] mm: Handle compound pages better in __dump_page()

On Mon, Nov 18, 2024 at 04:10:52AM +0000, Matthew Wilcox wrote:
> folio_test_large() does not touch page[1].  Look:

It does, though. :( It's via the PageTail(), which calls page_is_fake_head():

In function 'page_fixed_fake_head',      
    inlined from 'page_is_fake_head' at ../include/linux/page-flags.h:237:9,
    inlined from 'PageTail' at ../include/linux/page-flags.h:281:47,
    inlined from 'const_folio_flags' at ../include/linux/page-flags.h:309:2,
    inlined from 'folio_test_head' at ../include/linux/page-flags.h:824:9,
    inlined from 'folio_test_large' at ../include/linux/page-flags.h:845:9,
    inlined from '__dump_page' at ../mm/debug.c:138:8:   
../include/asm-generic/rwonce.h:44:26: error: array subscript 9 is outside array bounds of 'struct p
age[1]' [-Werror=array-bounds=]               
   44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
      |                         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
   50 |         __READ_ONCE(x);                                                 \
      |         ^~~~~~~~~~~
../include/linux/page-flags.h:221:38: note: in expansion of macro 'READ_ONCE'
  221 |                 unsigned long head = READ_ONCE(page[1].compound_head);
      |                                      ^~~~~~~~~
../mm/debug.c: In function '__dump_page':
../mm/debug.c:126:21: note: at offset 72 into object 'precise' of size 64
  126 |         struct page precise;
      |                     ^~~~~~~

> > Instead, explicitly make precise 2 pages. Just open-coding page_folio()
> > isn't sufficient to avoid the warning[1].
> 
> Why not?  What goes wrong?  I'm trying to get gcc-15 installed here now

With your original patch applied, I get the above warning.

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ