linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Samuel Holland <samuel.holland@sifive.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	Douglas Anderson <dianders@chromium.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	James Morse <james.morse@arm.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Puranjay Mohan <puranjay@kernel.org>,
	"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
	Ryo Takakura <takakura@valinux.co.jp>,
	Shaoqin Huang <shahuang@redhat.com>,
	Stephen Boyd <swboyd@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: Fix KASAN random tag seed initialization
Date: Wed, 14 Aug 2024 17:18:56 +0100	[thread overview]
Message-ID: <ZrzY8Kk-1PwZlezI@arm.com> (raw)
In-Reply-To: <20240814091005.969756-1-samuel.holland@sifive.com>

On Wed, Aug 14, 2024 at 02:09:53AM -0700, Samuel Holland wrote:
> Currently, kasan_init_sw_tags() is called before setup_per_cpu_areas(),
> so per_cpu(prng_state, cpu) accesses the same address regardless of the
> value of "cpu", and the same seed value gets copied to the percpu area
> for every CPU. Fix this by moving the call to smp_prepare_boot_cpu(),
> which is the first architecture hook after setup_per_cpu_areas().

Even with the fix, given the lower resolution of get_cycles(), there's a
good chance that we still have the same seed on all CPUs. If we want
separate seeds, a better bet would be to initialise each CPU separately
via the secondary_start_kernel() path. I'll let the KASAN people comment
on whether that's important.

-- 
Catalin


  parent reply	other threads:[~2024-08-14 16:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14  9:09 [PATCH] arm64: Fix KASAN random tag seed initialization Samuel Holland
2024-08-14 16:04 ` Andrey Konovalov
2024-08-14 16:18 ` Catalin Marinas [this message]
2024-08-14 17:25   ` Andrey Konovalov
2024-08-15 10:07 ` Catalin Marinas

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=ZrzY8Kk-1PwZlezI@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=ardb@kernel.org \
    --cc=dianders@chromium.org \
    --cc=frederic@kernel.org \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=puranjay@kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=samuel.holland@sifive.com \
    --cc=shahuang@redhat.com \
    --cc=swboyd@chromium.org \
    --cc=takakura@valinux.co.jp \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    /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).