[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YJPKNSNVf34a39qC@hirez.programming.kicks-ass.net>
Date: Thu, 6 May 2021 12:51:33 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: "Christopher M. Riedl" <cmr@...ux.ibm.com>
Cc: linuxppc-dev@...ts.ozlabs.org, tglx@...utronix.de, x86@...nel.org,
linux-hardening@...r.kernel.org, keescook@...omium.org
Subject: Re: [RESEND PATCH v4 10/11] powerpc: Protect patching_mm with a lock
On Wed, May 05, 2021 at 11:34:51PM -0500, Christopher M. Riedl wrote:
> Powerpc allows for multiple CPUs to patch concurrently. When patching
> with STRICT_KERNEL_RWX a single patching_mm is allocated for use by all
> CPUs for the few times that patching occurs. Use a spinlock to protect
> the patching_mm from concurrent use.
>
> Modify patch_instruction() to acquire the lock, perform the patch op,
> and then release the lock.
>
> Also introduce {lock,unlock}_patching() along with
> patch_instruction_unlocked() to avoid per-iteration lock overhead when
> patch_instruction() is called in a loop. A follow-up patch converts some
> uses of patch_instruction() to use patch_instruction_unlocked() instead.
x86 uses text_mutex for all this, why not do the same?
Powered by blists - more mailing lists