linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Trofimovich <slyfox@gentoo.org>
To: linux-mm@kvack.org, Kees Cook <keescook@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Alexander Potapenko <glider@google.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	bowsingbetee@pm.me
Subject: v5.12+ regression on page_poison=1 i_on_free=0 i_on_alloc=0 warnings
Date: Mon, 12 Jul 2021 00:57:32 +0100	[thread overview]
Message-ID: <20210712005732.4f9bfa78@zn3> (raw)

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


             reply	other threads:[~2021-07-11 23:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-11 23:57 Sergei Trofimovich [this message]
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

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=20210712005732.4f9bfa78@zn3 \
    --to=slyfox@gentoo.org \
    --cc=andreyknvl@gmail.com \
    --cc=bowsingbetee@pm.me \
    --cc=glider@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-mm@kvack.org \
    --cc=tglx@linutronix.de \
    --cc=vbabka@suse.cz \
    /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).