From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "debug@rivosinc.com" <debug@rivosinc.com>
Cc: "Yu, Yu-cheng" <yu-cheng.yu@intel.com>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"broonie@kernel.org" <broonie@kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>,
"pjw@kernel.org" <pjw@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
"zong.li@sifive.com" <zong.li@sifive.com>
Subject: Re: [GIT PULL] RISC-V updates for v7.0
Date: Thu, 19 Feb 2026 17:40:21 +0000 [thread overview]
Message-ID: <d1b2468975079ae4eda4d976dfa81bcb236399c4.camel@intel.com> (raw)
In-Reply-To: <aZZuGYQUy11Gse7x@debug.ba.rivosinc.com>
On Wed, 2026-02-18 at 17:57 -0800, Deepak Gupta wrote:
> x86 doesn't have any equivalent BTI bit in PTEs to mark code pages. IIRC, it
> does have mechanism where a bitmap has to be prepared and each entry in bitmap
> encodes whether a page is legacy code page (without `endbr64`) or a modern code
> page (with `endbr64`). And CPU will consult this bitmap to suppress the fault.
This might not be the right thread to get into the gory implementation details,
but at a high level, I had looked at two ways to tie it into the ARM interface.
One worked with the bitmap, and the plumbing to connect it to PROT_BTI was
horrible. The other simply handled the #CP exceptions and checked the vma. If
RIP had !PROT_BTI, it cleared the TRACKER bit and continued. It was pretty slick
and small. This of course penalizes any non-IBT DSO that is loaded by an IBT
executable and is targeted by an indirect call. But it wasn't as much of
disaster as you might expect. I have the numbers somewhere.
>
> As of today almost all distros and packages are shipping with
> `-fcf-protection=full` compile flag and that means all userspace binaries should
> have `endbr64` compiled in (i.e. modern binaries).
This is actually more of a problem than a solution. The automatic CFI enabling
dream didn't quite work. In the end, glibc made the shadow stack feature so you
need to opt-in via TUNABLE env var, instead of opt-out.
> This is a lot of throwaway work to support a usecase which likely doesn't exist
> because most distros anyway compile binaries with `endbr64` and even if such a
> use case exist, its perf characteristics will suck quite bad and security
> guarantees are also poor (worst of both world).
>
> So my suggestion would be to keep it like shadow stack:
>
> Loader takes a decision whether to enable forward cfi for current task or not
> (like it is done for shadow stack)
>
> Hopefully Intel will deprecate legacy interworking part of Intel CET in future
> generation(s) and simplify it.
One of the reasons to use a PROT_BTI type interface was to make it work like ARM
for reasons like up the thread, but also because distro-wide enabling is hard in
the long tail. I think it would be nice to take the learnings from shadow stack
distro enabling and try to make IBT so that it could more safely be turned on
automatically, via a more flexible intermediary step. Like a "mixed mode" that
warns about mismatched executables, but prioritizes not breaking any user
visible behavior. But this is a much larger topic.
But taking a step back, while I'm still keen on doing user IBT, the longer time
goes on, the more it becomes an "if" rather than a "when". You probably
shouldn't count on any of this too much for RISC-V enabling decisions.
next prev parent reply other threads:[~2026-02-19 17:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 23:39 Paul Walmsley
2026-02-13 3:35 ` Linus Torvalds
2026-02-14 0:23 ` Paul Walmsley
2026-02-14 4:14 ` Linus Torvalds
2026-02-16 21:54 ` Linus Walleij
2026-02-16 14:20 ` Mark Brown
2026-02-16 21:55 ` Linus Torvalds
2026-02-18 19:57 ` Deepak Gupta
2026-02-18 21:58 ` Edgecombe, Rick P
2026-02-19 0:01 ` Mark Brown
2026-02-19 1:28 ` Deepak Gupta
2026-02-19 1:57 ` Deepak Gupta
2026-02-19 17:40 ` Edgecombe, Rick P [this message]
2026-02-26 13:23 ` Peter Zijlstra
2026-02-26 21:04 ` Deepak Gupta
2026-02-13 3:37 ` pr-tracker-bot
2026-02-20 4:11 ` patchwork-bot+linux-riscv
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=d1b2468975079ae4eda4d976dfa81bcb236399c4.camel@intel.com \
--to=rick.p.edgecombe@intel.com \
--cc=broonie@kernel.org \
--cc=debug@rivosinc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=yu-cheng.yu@intel.com \
--cc=zong.li@sifive.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