BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Blaise Boscaccy" <bboscaccy@linux.microsoft.com>
Cc: bpf@vger.kernel.org
Subject: Re: [v6 10/10] ipe: Add BPF program load policy enforcement via Hornet integration
Date: Thu, 30 Apr 2026 00:31:50 +0000	[thread overview]
Message-ID: <20260430003151.827D0C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260429191431.2345448-11-bboscaccy@linux.microsoft.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Silent fail-open of `BPF_PROG_LOAD` policies when `CONFIG_IPE_PROP_BPF_SIGNATURE` is disabled
- [Low] Build failure due to unconditional access to conditionally compiled field `ctx->bpf_kernel`
--

commit 168706f9eca9b1981fccd36319334eda60264af6
Author: Blaise Boscaccy <bboscaccy@linux.microsoft.com>

ipe: Add BPF program load policy enforcement via Hornet integration

This commit adds support for the bpf_prog_load_post_integrity LSM hook,
enabling IPE to make policy decisions about BPF program loading based on
integrity verdicts from the Hornet LSM. It introduces the BPF_PROG_LOAD
operation and multiple properties like bpf_signature, bpf_keyring, and
bpf_kernel.

> diff --git a/security/ipe/eval.c b/security/ipe/eval.c
> index 21439c5be336..9a6d583fea12 100644
> --- a/security/ipe/eval.c
> +++ b/security/ipe/eval.c
[ ... ]
> @@ -297,6 +342,32 @@ static bool evaluate_property(const struct ipe_eval_ctx *const ctx,
>  		return evaluate_fsv_sig_false(ctx);
>  	case IPE_PROP_FSV_SIG_TRUE:
>  		return evaluate_fsv_sig_true(ctx);
> +	case IPE_PROP_BPF_SIG_NONE:
> +		return evaluate_bpf_sig(ctx, LSM_INT_VERDICT_NONE);
[ ... ]
> +	case IPE_PROP_BPF_KERNEL_FALSE:
> +		return !ctx->bpf_kernel;
> +	case IPE_PROP_BPF_KERNEL_TRUE:
> +		return ctx->bpf_kernel;

If the kernel is compiled with CONFIG_IPE_PROP_BPF_SIGNATURE disabled,
will this cause a build failure?

In security/ipe/eval.h, the bpf_kernel field is conditionally compiled:

#ifdef CONFIG_IPE_PROP_BPF_SIGNATURE
	enum lsm_integrity_verdict bpf_verdict;
	s32 bpf_keyring_id;
	bool bpf_kernel;
#endif /* CONFIG_IPE_PROP_BPF_SIGNATURE */

Since evaluate_property() accesses ctx->bpf_kernel unconditionally, it seems
this would result in an undefined struct member error when the config is
turned off.

>  	default:
>  		return false;
>  	}

> diff --git a/security/ipe/ipe.c b/security/ipe/ipe.c
> index 495bb765de1b..5af13903287f 100644
> --- a/security/ipe/ipe.c
> +++ b/security/ipe/ipe.c
[ ... ]
> @@ -60,6 +70,10 @@ static struct security_hook_list ipe_hooks[] __ro_after_init = {
>  #ifdef CONFIG_IPE_PROP_FS_VERITY_BUILTIN_SIG
>  	LSM_HOOK_INIT(inode_setintegrity, ipe_inode_setintegrity),
>  #endif /* CONFIG_IPE_PROP_FS_VERITY_BUILTIN_SIG */
> +#ifdef CONFIG_IPE_PROP_BPF_SIGNATURE
> +	LSM_HOOK_INIT(bpf_prog_load_post_integrity, ipe_bpf_prog_load_post_integrity),
> +	LSM_HOOK_INIT(bpf_prog_load, ipe_bpf_prog_load),
> +#endif /* CONFIG_IPE_PROP_BPF_SIGNATURE */
>  };

Does this create a scenario where policies fail-open silently if
CONFIG_IPE_PROP_BPF_SIGNATURE is disabled?

> diff --git a/security/ipe/policy_parser.c b/security/ipe/policy_parser.c
> index 6fa5bebf8471..71f63de56616 100644
> --- a/security/ipe/policy_parser.c
> +++ b/security/ipe/policy_parser.c
[ ... ]
> @@ -237,6 +237,7 @@ static const match_table_t operation_tokens = {
>  	{IPE_OP_KEXEC_INITRAMFS,	"op=KEXEC_INITRAMFS"},
>  	{IPE_OP_POLICY,			"op=POLICY"},
>  	{IPE_OP_X509,			"op=X509_CERT"},
> +	{IPE_OP_BPF_PROG_LOAD,		"op=BPF_PROG_LOAD"},
>  	{IPE_OP_INVALID,		NULL}
>  };

Because BPF_PROG_LOAD is added unconditionally to the parser, an administrator
could load a policy containing "DEFAULT op=BPF_PROG_LOAD action=DENY"
successfully.

However, because the LSM hooks are not registered, IPE will never evaluate
BPF program loads. This results in all BPF loads being silently allowed,
which contradicts the loaded policy.

Could the parser be updated to reject BPF_PROG_LOAD rules when the
corresponding enforcement hooks are disabled?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260429191431.2345448-1-bboscaccy@linux.microsoft.com?part=10

  reply	other threads:[~2026-04-30  0:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29 19:14 [v6 00/10] Reintroduce Hornet LSM Blaise Boscaccy
2026-04-29 19:14 ` [v6 01/10] crypto: pkcs7: add flag for validated trust on a signed info block Blaise Boscaccy
2026-04-29 21:20   ` sashiko-bot
2026-04-29 19:14 ` [v6 02/10] crypto: pkcs7: add ability to extract signed attributes by OID Blaise Boscaccy
2026-04-29 21:42   ` sashiko-bot
2026-04-29 19:14 ` [v6 03/10] crypto: pkcs7: add tests for pkcs7_get_authattr Blaise Boscaccy
2026-04-29 22:03   ` sashiko-bot
2026-04-29 19:14 ` [v6 04/10] lsm: framework for BPF integrity verification Blaise Boscaccy
2026-04-29 22:24   ` sashiko-bot
2026-04-29 19:14 ` [v6 05/10] lsm: security: Add additional enum values for bpf integrity checks Blaise Boscaccy
2026-04-29 19:14 ` [v6 06/10] security: Hornet LSM Blaise Boscaccy
2026-04-29 23:18   ` sashiko-bot
2026-04-29 19:14 ` [v6 07/10] hornet: Introduce gen_sig Blaise Boscaccy
2026-04-29 23:32   ` sashiko-bot
2026-04-29 19:14 ` [v6 08/10] hornet: Add a light skeleton data extractor scripts Blaise Boscaccy
2026-04-29 23:47   ` sashiko-bot
2026-04-29 19:14 ` [v6 09/10] selftests/hornet: Add a selftest for the Hornet LSM Blaise Boscaccy
2026-04-29 23:57   ` sashiko-bot
2026-04-29 19:14 ` [v6 10/10] ipe: Add BPF program load policy enforcement via Hornet integration Blaise Boscaccy
2026-04-30  0:31   ` sashiko-bot [this message]
2026-05-04 23:52   ` Fan Wu
2026-05-07 19:19 ` [v6 00/10] Reintroduce Hornet LSM Paul Moore
2026-05-08 18:03   ` Blaise Boscaccy

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=20260430003151.827D0C19425@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bboscaccy@linux.microsoft.com \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko@lists.linux.dev \
    /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