Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Blaise Boscaccy <bboscaccy@linux.microsoft.com>
To: KP Singh <kpsingh@kernel.org>
Cc: James.Bottomley@hansenpartnership.com, bpf@vger.kernel.org,
	code@tyhicks.com, corbet@lwn.net, davem@davemloft.net,
	dhowells@redhat.com, gnoack@google.com,
	herbert@gondor.apana.org.au, jarkko@kernel.org,
	jmorris@namei.org, jstancek@redhat.com, justinstitt@google.com,
	keyrings@vger.kernel.org, linux-crypto@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-security-module@vger.kernel.org, llvm@lists.linux.dev,
	masahiroy@kernel.org, mic@digikod.net, morbo@google.com,
	nathan@kernel.org, neal@gompa.dev,
	nick.desaulniers+lkml@gmail.com, nicolas@fjasle.eu,
	nkapron@google.com, paul@paul-moore.com,
	roberto.sassu@huawei.com, serge@hallyn.com, shuah@kernel.org,
	teknoraver@meta.com, xiyou.wangcong@gmail.com,
	KP Singh <kpsingh@kernel.org>
Subject: Re: [PATCH v3 0/4] Introducing Hornet LSM
Date: Mon, 05 May 2025 10:30:03 -0700	[thread overview]
Message-ID: <87o6w7ge3o.fsf@microsoft.com> (raw)
In-Reply-To: <20250502210034.284051-1-kpsingh@kernel.org>

KP Singh <kpsingh@kernel.org> writes:

[...]

> Now if you really care about the use-case and want to work with the maintainers
> and implement signing for the community, here's how we think it should be done:
>
> * The core signing logic and the tooling stays in BPF, something that the users
>   are already using. No new tooling.
> * The policy decision on the effect of signing can be built into various
>   existing LSMs. I don't think we need a new LSM for it.
> * A simple UAPI (emphasis on UAPI!) change to union bpf_attr in uapi/bpf.h in
>   the BPF_PROG_LOAD command:
>
> __aligned_u64 signature; 
> __u32 signature_size;

I think having some actual details on the various parties' requirements
here would be helpful. KP, I do look forward to seeing your design;
however, having code signing proposals where the capabilities are
dictated from above and any dissent is dismissed as "you're doing it
wrong" isn't going to be helpful to anyone that needs to use this in
practice.

Also, I don't think anyone actually cares, at least I don't, who calls
verify_pkcs7_signature or whatnot. Verifying signed binary blobs with a
private key is a solved problem and isn't really interesting.

Our requirements for code signing are just an extension of secure boot
and module signing logic:

* Prove all code running in ring zero has been signed
* Not trivially defeatable by root
* Ultimately, no trusted userspace components
* Secure from and not vulnerable to TOCTOU attacks
* Shouldn't be overly vulnerable to supply-chain attacks
* The signature checking logic and control paths should be human-readable
* Work easily and be backportable to stable kernels
* There should be a simple kconfig option to turn this on or off
* This solution needs to be in the mainline kernel

Hornet was implemented to meet those requirements, living in the LSM
subsystem, written in C. As of today, one cannot accomplish those
requirements via BPF-LSM, which is why C was chosen.

One can easily realize there is absolutely no way to have a single
one-size-fits-all signing solution for everything listed in
https://ebpf.io/applications/.

If you want to go the UAPI route, I would wholeheartedly recommend
making it extensible and having this data be available to the policy
LSMs.

enum bpf_signature_type {
  /* x509 signature check against program instructions only */
  BPF_SIGNATURE_PROG_ONLY = 0,
  /* x509 combined signature check against program instructions and used maps */
  BPF_SIGNATURE_PROG_USED_MAPS = 1,
  /* more of these to be determined via usage */ 
  ...
};

_aligned_u64 signature; 
__u32 signature_size;
__u32 signature_type;

The other option for solving this in the general is in-kernel
loaders. That's gotten pushback as well. 

-blaise






  parent reply	other threads:[~2025-05-05 17:30 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02 18:44 [PATCH v3 0/4] Introducing Hornet LSM Blaise Boscaccy
2025-05-02 18:44 ` [PATCH v3 1/4] security: " Blaise Boscaccy
2025-05-04 15:02   ` Paul Moore
2025-05-02 18:44 ` [PATCH v3 2/4] hornet: Introduce sign-ebpf Blaise Boscaccy
2025-05-02 18:44 ` [PATCH v3 3/4] hornet: Add a light skeleton data extractor script Blaise Boscaccy
2025-05-02 18:44 ` [PATCH v3 4/4] selftests/hornet: Add a selftest for the Hornet LSM Blaise Boscaccy
2025-05-02 21:00 ` [PATCH v3 0/4] Introducing " KP Singh
2025-05-04 17:36   ` Paul Moore
2025-05-04 23:25     ` KP Singh
2025-05-05 16:22       ` Paul Moore
2025-05-11  2:01       ` KP Singh
2025-05-14  3:06         ` Paul Moore
2025-05-14 18:48           ` KP Singh
2025-05-16 19:49             ` Paul Moore
2025-05-16 23:49               ` Alexei Starovoitov
2025-05-17 15:02                 ` Paul Moore
2025-05-17 16:13                   ` Alexei Starovoitov
2025-05-18  5:48                     ` Paul Moore
2025-05-18 15:52                       ` Alexei Starovoitov
2025-05-18 21:34                         ` Paul Moore
2025-05-19 22:20                           ` KP Singh
2025-05-19 22:58                             ` Paul Moore
2025-05-21 22:26                               ` Paul Moore
2025-05-19 23:00                             ` Zvi Effron
2025-05-19 23:42                               ` KP Singh
2025-05-14 15:39         ` James Bottomley
2025-05-14 17:17           ` KP Singh
2025-05-14 17:45             ` James Bottomley
2025-05-14 18:35               ` KP Singh
2025-05-14 18:35                 ` KP Singh
2025-05-14 20:31                 ` James Bottomley
2025-05-14 20:41                   ` KP Singh
2025-05-05  9:22     ` Daniel Borkmann
2025-05-05 17:30   ` Blaise Boscaccy [this message]
2025-05-05 20:41     ` KP Singh
2025-05-05 21:04       ` Paul Moore
2025-05-07 17:48       ` James Bottomley
2025-05-07 23:21         ` Paul Moore
2025-05-08 17:44           ` Alexei Starovoitov
2025-05-08 19:23             ` Paul Moore
2025-05-11  2:14               ` KP Singh

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=87o6w7ge3o.fsf@microsoft.com \
    --to=bboscaccy@linux.microsoft.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=bpf@vger.kernel.org \
    --cc=code@tyhicks.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=gnoack@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jarkko@kernel.org \
    --cc=jmorris@namei.org \
    --cc=jstancek@redhat.com \
    --cc=justinstitt@google.com \
    --cc=keyrings@vger.kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=mic@digikod.net \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=neal@gompa.dev \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=nicolas@fjasle.eu \
    --cc=nkapron@google.com \
    --cc=paul@paul-moore.com \
    --cc=roberto.sassu@huawei.com \
    --cc=serge@hallyn.com \
    --cc=shuah@kernel.org \
    --cc=teknoraver@meta.com \
    --cc=xiyou.wangcong@gmail.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