mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "Wieczor-Retman, Maciej" <maciej.wieczor-retman@intel.com>
Cc: "linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"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>,
	"x86@kernel.org" <x86@kernel.org>,
	"morbo@google.com" <morbo@google.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"seanjc@google.com" <seanjc@google.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"xin@zytor.com" <xin@zytor.com>,
	"ilpo.jarvinen@linux.intel.com" <ilpo.jarvinen@linux.intel.com>,
	"nathan@kernel.org" <nathan@kernel.org>,
	"oleg@redhat.com" <oleg@redhat.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>,
	"llvm@lists.linux.dev" <llvm@lists.linux.dev>,
	"Mehta, Sohil" <sohil.mehta@intel.com>
Subject: Re: [PATCH v6 1/3] x86/process: Shorten the LAM tag width
Date: Thu, 23 Apr 2026 18:07:57 +0000	[thread overview]
Message-ID: <9ef71635a84720f22290699d9f0606e1736b7638.camel@intel.com> (raw)
In-Reply-To: <aemzYE5td11cWydN@wieczorr-mobl1.localdomain>

On Thu, 2026-04-23 at 10:09 +0200, Maciej Wieczor-Retman wrote:
> 
> > 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.
> 

For LAM (forgetting about chktag for a second), I see three things that are
linked today:
1. What gets communicated to userspace about which bits will actually be ignored
2. What bits the HW actually will ignore.
3. Which bits that the kernel will strip in all of the places where it processes
   userspace addresses.

Yea, I guess I think they should stay linked.

If 1 doesn't match 2, userspace will have trouble understanding what is going
on. GDB, etc will not be able to make sense of things.

If 2 doesn't match 3, that is what I was calling the weird ABI. I don't know
about security issues, but it seems confusing to keep track of at least too, for
the purpose of making sure the wrong memory doesn't get accesses.

> Do you think leaving the untag_mask as it was (bits 62:57) while advertising
> that 4 bits are available would be better? The untag_mask would be more inline
> with what the hardware is doing currently while ABI would promise to long term
> only stick by the 4-bit tags.

Some properly coded thing that does this?

diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 08e72f4298701..a01f935872348 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -965,7 +965,7 @@ long do_arch_prctl_64(struct task_struct *task, int option,
unsigned long arg2)
                if (!cpu_feature_enabled(X86_FEATURE_LAM))
                        return put_user(0, (unsigned long __user *)arg2);
                else
-                       return put_user(LAM_U57_BITS, (unsigned long __user
*)arg2);
+                       return put_user(4, (unsigned long __user *)arg2);
 #endif
        case ARCH_SHSTK_ENABLE:
        case ARCH_SHSTK_DISABLE:

I think it meets my (suggested) goals above. It is weird to hear that the max is
4, and then ask for 4 and get 6. But I guess it's not going to break anything?



  parent reply	other threads:[~2026-04-23 18:08 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
2026-04-23  8:09     ` Maciej Wieczor-Retman
2026-04-23  9:38       ` Maciej Wieczor-Retman
2026-04-23 18:07       ` Edgecombe, Rick P [this message]
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=9ef71635a84720f22290699d9f0606e1736b7638.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

all inboxes | Powered by JetHome®