Linux Hardening
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Kevin Brodsky <kevin.brodsky@arm.com>, linux-hardening@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Mark Brown <broonie@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Jann Horn <jannh@google.com>, Jeff Xu <jeffxu@chromium.org>,
	Joey Gouly <joey.gouly@arm.com>, Kees Cook <kees@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Andy Lutomirski <luto@kernel.org>, Marc Zyngier <maz@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Pierre Langlois <pierre.langlois@arm.com>,
	Quentin Perret <qperret@google.com>,
	"Mike Rapoport (IBM)" <rppt@kernel.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Will Deacon <will@kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	Qi Zheng <zhengqi.arch@bytedance.com>,
	linux-arm-kernel@lists.infradead.org, x86@kernel.org
Subject: Re: [RFC PATCH v2 00/15] pkeys-based page table hardening
Date: Thu, 9 Jan 2025 08:30:44 -0800	[thread overview]
Message-ID: <dcc1800c-cf0a-4d88-bc88-982f0709b382@intel.com> (raw)
In-Reply-To: <20250108103250.3188419-1-kevin.brodsky@arm.com>

One of the sticker things in the x86 attempt to do the same thing was
context switching, both between normal tasks and in/out of exceptions
and interrupts.

The easiest place this manifested for us was code chunk like this:

	kpkeys_set_level(KPKEYS_LVL_PGTABLES);
	// modify page tables here
	kpkeys_restore_pkey_reg();

We had to make sure that we didn't get preempted and context switch over
to some other task that _wasn't_ doing page table manipulation while
page table writes were allowed.

On x86, we had to basically start context-switching the kernel pkey
register the same way we do GPRs.

How is SYS_POR_EL0 being context switched?

  parent reply	other threads:[~2025-01-09 16:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08 10:32 [RFC PATCH v2 00/15] pkeys-based page table hardening Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 01/15] mm: Introduce kpkeys Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 02/15] set_memory: Introduce set_memory_pkey() stub Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 03/15] arm64: mm: Enable overlays for all EL1 indirect permissions Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 04/15] arm64: Introduce por_set_pkey_perms() helper Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 05/15] arm64: Implement asm/kpkeys.h using POE Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 06/15] arm64: set_memory: Implement set_memory_pkey() Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 07/15] arm64: Enable kpkeys Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 08/15] mm: Introduce kernel_pgtables_set_pkey() Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 09/15] mm: Introduce kpkeys_hardened_pgtables Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 10/15] mm: Allow __pagetable_ctor() to fail Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 11/15] mm: Map page tables with privileged pkey Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 12/15] arm64: kpkeys: Support KPKEYS_LVL_PGTABLES Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 13/15] arm64: mm: Guard page table writes with kpkeys Kevin Brodsky
2025-01-09  7:17   ` Qi Zheng
2025-01-10 14:05     ` Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 14/15] arm64: Enable kpkeys_hardened_pgtables support Kevin Brodsky
2025-01-08 10:32 ` [RFC PATCH v2 15/15] mm: Add basic tests for kpkeys_hardened_pgtables Kevin Brodsky
2025-01-09 16:30 ` Dave Hansen [this message]
2025-01-13 10:10   ` [RFC PATCH v2 00/15] pkeys-based page table hardening Kevin Brodsky

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=dcc1800c-cf0a-4d88-bc88-982f0709b382@intel.com \
    --to=dave.hansen@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jannh@google.com \
    --cc=jeffxu@chromium.org \
    --cc=joey.gouly@arm.com \
    --cc=kees@kernel.org \
    --cc=kevin.brodsky@arm.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=maz@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pierre.langlois@arm.com \
    --cc=qperret@google.com \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=willy@infradead.org \
    --cc=x86@kernel.org \
    --cc=zhengqi.arch@bytedance.com \
    /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