linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* v5.12+ regression on page_poison=1 i_on_free=0 i_on_alloc=0 warnings
@ 2021-07-11 23:57 Sergei Trofimovich
  2021-07-12 21:58 ` [PATCH] mm: page_alloc: fix page_poison=1 / INIT_ON_ALLOC_DEFAULT_ON interaction Sergei Trofimovich
  0 siblings, 1 reply; 7+ messages in thread
From: Sergei Trofimovich @ 2021-07-11 23:57 UTC (permalink / raw)
  To: linux-mm, Kees Cook
  Cc: Thomas Gleixner, Alexander Potapenko, Vlastimil Babka,
	Andrey Konovalov, bowsingbetee

In
  https://bugs.gentoo.org/801481
  https://bugzilla.kernel.org/show_bug.cgi?id=213697
bowsingbetee noticed that the following setup causes kernel to complain
about poisoning on memset(0) pages:

- kernel command: page_poison=1 init_on_free=0 init_on_alloc=0
- kernel config:
  * CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
  * CONFIG_INIT_ON_FREE_DEFAULT_ON=y
  * CONFIG_PAGE_POISONING=y

v5.12 works ok, boots as:
  [    0.009691][    T0] mem auto-init: stack:off, heap alloc:off, heap free:off

v5.13 warns, boots as:
  [    0.009746][    T0] mem auto-init: stack:off, heap alloc:on, heap free:on

Current 5.14-rc1 is also affected:

[    0.009233][    T0] mem auto-init: stack:off, heap alloc:on, heap free:on
[    0.009234][    T0] mem auto-init: clearing system memory may take some time...
[    0.396784][    T0] pagealloc: memory corruption
[    0.396788][    T0] ffff888100000000: 00 00 00 00 00 00 00 00 00 00 00 00 00
                                         00 00 00  ................

I attempted to bisect it and found the follwing relevant commits:

Before the following commit no warnings were present:

  commit 51cba1ebc60df9c4ce034a9f5441169c0d0956c0
  Author: Kees Cook <keescook@chromium.org>
  Date:   Thu Apr 1 16:23:43 2021 -0700
    init_on_alloc: Optimize static branches

Next after this commit kernel does not boot. Makes it harder to
bisect the poisoning warning

After the commit below kernel boots and already complains about
poisoning of zero pages:

  commit 1bb5eab30d68c1a3d9dbc822e1895e6c06dbe748
  Author: Andrey Konovalov <andreyknvl@google.com>
  Date:   Thu Apr 29 23:00:02 2021 -0700
    kasan, mm: integrate page_alloc init with HW_TAGS

It looks like a case of page_poison=1 not having enough
of a priority over init_on_free=0 init_on_alloc=0 at early boot.

-- 

  Sergei


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

end of thread, other threads:[~2021-07-17 18:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-11 23:57 v5.12+ regression on page_poison=1 i_on_free=0 i_on_alloc=0 warnings Sergei Trofimovich
2021-07-12 21:58 ` [PATCH] mm: page_alloc: fix page_poison=1 / INIT_ON_ALLOC_DEFAULT_ON interaction Sergei Trofimovich
2021-07-14  2:00   ` Andrew Morton
2021-07-17 18:18     ` Sergei Trofimovich
2021-07-14  3:10   ` Kees Cook
2021-07-14 11:11     ` bowsingbetee
2021-07-14 21:14       ` Kees Cook

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