Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Maxwell Bland <mbland@motorola.com>
Cc: "linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"Andrew Wheeler" <awheeler@motorola.com>,
	"Sammy BS2 Que | 阙斌生" <quebs2@motorola.com>,
	"Neill Kapron" <nkapron@google.com>,
	"Todd Kjos" <tkjos@google.com>,
	"Viktor Martensson" <vmartensson@google.com>,
	"Andy Lutomirski" <luto@amacapital.net>,
	"Will Drewry" <wad@chromium.org>,
	"Andy Gross" <agross@kernel.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konrad.dybcio@somainline.org>,
	kernel-team <kernel-team@android.com>
Subject: Re: [RFC] Proposal: Static SECCOMP Policies
Date: Tue, 17 Sep 2024 00:34:28 -0700	[thread overview]
Message-ID: <202409170005.60410C0A4B@keescook> (raw)
In-Reply-To: <SEZPR03MB6786D45BE387F2B378E71A84B4642@SEZPR03MB6786.apcprd03.prod.outlook.com>

On Thu, Sep 12, 2024 at 04:02:53PM +0000, Maxwell Bland wrote:
> operated on around 0.1188 MB). But most importantly, third, without some degree
> of provenance, I have no way of telling if someone has injected malicious code
> into the kernel, and unfortunately even knowing the correct bytes is still
> "iffy", as in order to prevent JIT spray attacks, each of these filters is
> offset by some random number of uint32_t's, making every 4-byte shift of the
> filter a "valid" codepage to be loaded at runtime.

I wanted to focus this thread on the problem, rather than potential
solutions. I think we risk losing sight of getting a complete description
of what is needed if we dive into solutions too quickly.

So, let's start here. What I've seen from the thread is that there isn't
a way to verify that a given JIT matches the cBPF. Is validating the
cBPF itself also needed?

This reminds me of two related topics, which might help either better
define the problem or help find some other folks with similar needs.

- The IMA subsystem has wanted a way to measure (and validate) seccomp
  filters. We could get more details from them for defining this need
  more clearly.

- The JIT needs to be verified against the cBPF that it was generated
  from. We currently do only a single pass and don't validate it once
  the region has been set read-only. We have a standing feature request
  for improving this: https://github.com/KSPP/linux/issues/154

For solutions, I didn't see much discussion around the "orig_prog"
copy of the cBPF. Under CHECKPOINT_RESTORE, the original cBPF remains
associated with the JIT. struct seccomp_filter's struct bpf_prog prog's
orig_prog member. If it has value outside of CHECKPOINT_RESTORE, then
we could do it for those conditions too.

-Kees

-- 
Kees Cook

  parent reply	other threads:[~2024-09-17  7:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12 16:02 [RFC] Proposal: Static SECCOMP Policies Maxwell Bland
2024-09-12 20:57 ` Neill Kapron
2024-09-12 21:39   ` Maciej Żenczykowski
2024-09-13 17:07     ` [External] " Maxwell Bland
2024-09-13 17:12       ` Maxwell Bland
2024-09-13 17:30       ` Maxwell Bland
2024-09-14  4:18         ` Andy Lutomirski
2024-09-17 15:08           ` Maxwell Bland
2024-09-25 18:16             ` Andy Lutomirski
2024-09-25 19:52               ` Maciej Żenczykowski
2024-09-25 19:53                 ` Maciej Żenczykowski
2024-09-30 11:22                   ` Sebastian Ene
2024-09-30 18:43                     ` Maxwell Bland
2024-09-30 23:35                     ` Maciej Żenczykowski
2024-09-30 23:41                       ` Maciej Żenczykowski
2024-10-01 16:34                         ` Maxwell Bland
2024-09-13 18:17       ` Maxwell Bland
2024-09-13 21:16       ` [External] " Maciej Żenczykowski
2024-09-16 22:17         ` Maxwell Bland
2024-09-16 22:50           ` Maciej Żenczykowski
2024-09-17 15:15             ` Maxwell Bland
2024-09-18 19:22               ` Maxwell Bland
2024-09-17  7:34 ` Kees Cook [this message]
2024-09-17 16:54   ` Maxwell Bland
2024-09-17 17:01     ` Maxwell Bland
  -- strict thread matches above, loose matches on Subject: below --
2024-09-12 16:18 Maxwell Bland

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=202409170005.60410C0A4B@keescook \
    --to=kees@kernel.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=awheeler@motorola.com \
    --cc=kernel-team@android.com \
    --cc=konrad.dybcio@somainline.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mbland@motorola.com \
    --cc=nkapron@google.com \
    --cc=quebs2@motorola.com \
    --cc=tkjos@google.com \
    --cc=vmartensson@google.com \
    --cc=wad@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox