[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202405061031.43EE1C4@keescook>
Date: Mon, 6 May 2024 10:36:06 -0700
From: Kees Cook <keescook@...omium.org>
To: Joao Moreira <joao@...rdrivepizza.com>
Cc: Peter Zijlstra <peterz@...radead.org>, x86@...nel.org,
Sami Tolvanen <samitolvanen@...gle.com>,
linux-kernel@...r.kernel.org, Mark Rutland <mark.rutland@....com>,
Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH] x86/ibt: Implement FineIBT
*thread necromancy*
On Tue, Nov 01, 2022 at 02:50:22PM -0700, Joao Moreira wrote:
> On 2022-11-01 14:39, Kees Cook wrote:
> > On Mon, Oct 31, 2022 at 12:13:50PM -0700, Joao Moreira wrote:
> > > On 2022-10-18 22:19, Kees Cook wrote:
> > > > On Tue, Oct 18, 2022 at 09:48:42PM -0700, Joao Moreira wrote:
> > > > > > > Is it useful to get the compiler to emit 0xcc with
> > > > > > > -fpatchable-function-entry under any circumstance? I can probably
> > > > > > > change
> > > > > > > that quickly if needed/useful.
> > > > > >
> > > > > > Having it emit 0xcc for the bytes in front of the symbol might be
> > > > > > interesting. It would mean a few kernel changes, but nothing too hard.
> > >
> > > Should I push for this within clang? I have the patch semi-ready
> > > (below) and
> > > would have some cycles this week for polishing it.
> >
> > Sure! While the NOP vs CC issue isn't very interesting when IBT is
> > available, it's nice for non-IBT to make attackers have to target
> > addresses precisely.
> >
> > If it's really invasive or hard to maintain in Clang (or objtool),
> > then I'd say leave it as-is.
>
> The Clang implementation is actually quite simple and, IIRC, I heard in the
> past someone mentioning that trapping instructions actually provide benefits
> for holding undesired straight-line speculation. Maybe someone can comment
> on that, or even if that is really relevant.
>
> Meanwhile I'll work on pushing it then.
I happened to be looking at in-memory CFI preambles again and noticed
that there's still a NOP sled at every function that got a __cfi_...
target (which only matters in the non-IBT world).
I can't find a PR for your NOP->INT3 patch:
https://github.com/lvwr/llvm-project/commit/ca9029c4536d0544e35dff85e4806803e256841f
Are you able to get this refreshed and landed?
Thanks!
-Kees
--
Kees Cook
Powered by blists - more mailing lists