All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Borislav Petkov <bp@suse.de>, Dave Hansen <dave.hansen@intel.com>,
	x86-ml <x86@kernel.org>, lkml <linux-kernel@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>
Subject: Re: [GIT PULL] x86/urgent for v5.11-rc7
Date: Mon, 8 Feb 2021 10:02:06 -0500	[thread overview]
Message-ID: <20210208100206.3b74891e@gandalf.local.home> (raw)
In-Reply-To: <20210207224540.ercf5657pftibyaw@treble>

On Sun, 7 Feb 2021 16:45:40 -0600
Josh Poimboeuf <jpoimboe@redhat.com> wrote:

> > I do suspect involved people should start thinking about how they want
> > to deal with functions starting with
> > 
> >         endbr64
> >         call __fentry__
> > 
> > instead of the call being at the very top of the function.  
> 
> FWIW, objtool's already fine with it (otherwise we would have discovered
> the need to disable fcf-protection much sooner).

And this doesn't really affect tracing (note, another user that might be
affected is live kernel patching). The way this change was noticed, was
that there was a report of someone that was be able to connect a bpf
program to a function for one machine but not for another machine. The
other machine had this CET thingy.

The difference is, when you attach a probe to the start of a function,
kprobes will check if the probe address (start of function) is located at a
ftrace location (nop / __fentry__) and if it is, it would use the ftrace
infrastructure instead of attaching an int3 breakpoint. Because of the
enbr64 being at the start of the function, the check returned false (it was
not a ftrace location) and it attached an int3 breakpoint instead.

This uncovered another "bug". Peter Zijlstra made int3 handlers look like
NMIs (in_nmi() would return true in an int3 handler). The BPF programs would
not run in NMI context. But nobody noticed, because people usually attach
BPF programs to the start of a function using kprobes, and since kprobes
would use ftrace handlers (that don't set in_nmi() to true), everything
worked. But when the "endbr64" was added at the start of the program,
kprobes fell back to int3, and suddenly the BPF programs stopped working.

-- Steve

  reply	other threads:[~2021-02-08 15:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-07 10:40 [GIT PULL] x86/urgent for v5.11-rc7 Borislav Petkov
2021-02-07 17:49 ` Linus Torvalds
2021-02-07 17:58   ` Borislav Petkov
2021-02-07 18:15     ` Linus Torvalds
2021-02-07 18:32       ` Dave Hansen
2021-02-07 18:40         ` Linus Torvalds
2021-02-07 22:45       ` Josh Poimboeuf
2021-02-08 15:02         ` Steven Rostedt [this message]
2021-02-08 15:33           ` Josh Poimboeuf
2021-02-08 15:47             ` Peter Zijlstra
2021-02-08 16:15               ` Steven Rostedt
2021-02-09  8:32                 ` Miroslav Benes
2021-02-09 14:49                   ` Steven Rostedt
2021-02-09 15:16                     ` Miroslav Benes
2021-02-09 16:45                     ` Alexei Starovoitov
2021-02-09 16:55                       ` Andy Lutomirski
2021-02-09 18:09                         ` Linus Torvalds
2021-02-09 18:26                           ` Andy Lutomirski
2021-02-09 18:39                             ` Linus Torvalds
2021-02-07 18:19     ` Dave Hansen
2021-02-07 18:31       ` Andy Lutomirski
2021-02-08 10:33         ` Peter Zijlstra
2021-02-07 20:44       ` Alexei Starovoitov
2021-02-07 22:35         ` Dave Hansen
2021-02-08 16:11           ` Yu, Yu-cheng
2021-02-07 18:29 ` pr-tracker-bot

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=20210208100206.3b74891e@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=ast@kernel.org \
    --cc=bp@suse.de \
    --cc=dave.hansen@intel.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.