mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "nick.desaulniers+lkml@gmail.com"
	<nick.desaulniers+lkml@gmail.com>,
	"shuah@kernel.org" <shuah@kernel.org>,
	"justinstitt@google.com" <justinstitt@google.com>,
	"james.morse@arm.com" <james.morse@arm.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"morbo@google.com" <morbo@google.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"xin@zytor.com" <xin@zytor.com>,
	"ilpo.jarvinen@linux.intel.com" <ilpo.jarvinen@linux.intel.com>,
	"Wieczor-Retman, Maciej" <maciej.wieczor-retman@intel.com>,
	"nathan@kernel.org" <nathan@kernel.org>,
	"oleg@redhat.com" <oleg@redhat.com>,
	"seanjc@google.com" <seanjc@google.com>,
	"hou, wenlong" <houwenlong.hwl@antgroup.com>,
	"ryan.roberts@arm.com" <ryan.roberts@arm.com>,
	"m.wieczorretman@pm.me" <m.wieczorretman@pm.me>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"tglx@kernel.org" <tglx@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>, "bp@alien8.de" <bp@alien8.de>,
	"ljs@kernel.org" <ljs@kernel.org>,
	"perry.yuan@amd.com" <perry.yuan@amd.com>,
	"jgross@suse.com" <jgross@suse.com>,
	"Mehta, Sohil" <sohil.mehta@intel.com>
Cc: "llvm@lists.linux.dev" <llvm@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH v6 1/3] x86/process: Shorten the LAM tag width
Date: Wed, 22 Apr 2026 18:07:29 +0000	[thread overview]
Message-ID: <8bc4ff4b7491c6fea6e17583a6fa249961c08275.camel@intel.com> (raw)
In-Reply-To: <79720f2640839b15f22e3618136b084cb376456b.1775813245.git.m.wieczorretman@pm.me>

On Fri, 2026-04-10 at 09:55 +0000, Maciej Wieczor-Retman wrote:
>  
>  #ifdef CONFIG_ADDRESS_MASKING
>  
> -#define LAM_U57_BITS 6
> +#define LAM_TAG_BITS	4
> +#define LAM_LS_BIT	57
> +#define LAM_MS_BIT	(LAM_LS_BIT + LAM_TAG_BITS - 1) /* 60 */
> +#define LAM_UNTAG_MASK	~GENMASK(LAM_MS_BIT, LAM_LS_BIT)
>  
>  static void enable_lam_func(void *__mm)
>  {
> @@ -814,7 +817,7 @@ static void enable_lam_func(void *__mm)
>  static void mm_enable_lam(struct mm_struct *mm)
>  {
>  	mm->context.lam_cr3_mask = X86_CR3_LAM_U57;
> -	mm->context.untag_mask =  ~GENMASK(62, 57);
> +	mm->context.untag_mask = LAM_UNTAG_MASK;
>  

It's been a bit since I looked at LAM. The untag_mask is used to strip the
addresses passed by userspace, right? So this lies to userspace about the
tagging behavior of the CPU? Userspace still gets the LAM_U57 behavior, but is
told the untag mask is the 4 chcktag bits?

If so, then there will be a difference between userspace accesses to a pointer
and the kernel's handling of a user pointer (mmap(), gup, etc). I don't know
that it is unsafe, but have you thought through the implications? Besides that
though it's a weird ABI.

What is the chktag behavior for bits 61 and 62? Are they ignored or trigger a
#GP?

>  	/*
>  	 * Even though the process must still be single-threaded at this
> @@ -850,7 +853,7 @@ static int prctl_enable_tagged_addr(struct mm_struct *mm, unsigned long nr_bits)
>  		return -EBUSY;
>  	}
>  
> -	if (!nr_bits || nr_bits > LAM_U57_BITS) {
> +	if (!nr_bits || nr_bits > LAM_TAG_BITS) {
>  		mmap_write_unlock(mm);


  parent reply	other threads:[~2026-04-22 18:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10  9:55 [PATCH v6 0/3] x86: Simplifying LAM Maciej Wieczor-Retman
2026-04-10  9:55 ` [PATCH v6 1/3] x86/process: Shorten the LAM tag width Maciej Wieczor-Retman
2026-04-22 17:24   ` Sohil Mehta
2026-04-22 17:53     ` Maciej Wieczor-Retman
2026-04-22 18:07   ` Edgecombe, Rick P [this message]
2026-04-23  8:09     ` Maciej Wieczor-Retman
2026-04-23  9:38       ` Maciej Wieczor-Retman
2026-04-23 18:07       ` Edgecombe, Rick P
2026-04-23 19:10         ` Maciej Wieczor-Retman
2026-04-10  9:55 ` [PATCH v6 2/3] x86/mm: Cleanup comments where LAM_U48 is mentioned Maciej Wieczor-Retman
2026-04-10  9:55 ` [PATCH v6 3/3] selftests/lam: Update LAM tag width and cleanup names Maciej Wieczor-Retman
2026-04-22 18:11   ` Sohil Mehta
2026-04-22 18:36     ` Maciej Wieczor-Retman

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=8bc4ff4b7491c6fea6e17583a6fa249961c08275.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=houwenlong.hwl@antgroup.com \
    --cc=hpa@zytor.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=james.morse@arm.com \
    --cc=jgross@suse.com \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=m.wieczorretman@pm.me \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=oleg@redhat.com \
    --cc=perry.yuan@amd.com \
    --cc=peterz@infradead.org \
    --cc=ryan.roberts@arm.com \
    --cc=seanjc@google.com \
    --cc=shuah@kernel.org \
    --cc=sohil.mehta@intel.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    --cc=xin@zytor.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

Powered by JetHome