From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A17B82FFDD5 for ; Thu, 13 Aug 2026 00:26:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786580812; cv=none; b=RNJZaJwNqWV72MFWVOA/7R7UomMeJ2bwSMcXst9+1pXqZFS0Izky9OTpkIAEY1hLSFrimvnli9flhKQYKCCXCGrhGtUpw327achpIShaSNLTyBLnd8H2JzrcIrZe8oFpHOMZcdPiLK7epVO0XPsGTt/cds7Yey+MJaMPXelsSLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786580812; c=relaxed/simple; bh=veTqDKWVWhuIMMVDuiWZUa0YQ97OCY9TCpyTNIzkWzs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=VPxd2A/rtQ0lzey4zpHElzvjXQaERlRqDdw6AwsXd02xL/l+QMyyYBLBEXJdCpyQ/Tq2LG2ExtF/ad8Q1Dj/br3Ix7NwOnPz29t9+Cxs9c8HYDLCjzI1xR+8anjzjrmajSxOoQoHOvKVRCa3cAq276FJHq6VZ6d8rm5jMehjnhs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--tweek.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=BpGa6Uw+; arc=none smtp.client-ip=209.85.215.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--tweek.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BpGa6Uw+" Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-cbee5bab340so1762108a12.2 for ; Wed, 12 Aug 2026 17:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786580811; x=1787185611; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:from:to:cc :subject:date:message-id:reply-to:content-type; bh=MCduZZ2cuHkGfG92sUop8F3LbOgQDBWvf7V8w/75FyY=; b=BpGa6Uw+JcqlAX/GhW4ZSNPN+9v2CEFpjqNXk0pGEXz6J+uuTcwqCHg9/ElHQpJi3c GDG0+IVoRU4qrKKjrdWPaS3Wr36fe0kQVL3ULLZ3B4yfDVy1I2ZZonLpi61GfG4HmzcW kDSf0+91GW1oa3JydlwgbtsqPPqjhZT+gQwf0aBFyFq1Z7+23zziJ49UN0+8+wB0C/t8 RZ/Cjr/lPP5IYsWAjpZEKu5t09Y2xlNU0Y3MHJ2W0X1c1RUOXx8oJobQL6nshOX+c65w xnFHAfGZNi9iUw1iLx6MhEJAm5BZALdEIiVU45+yf5vq6onxhjjKbATpT4UMXxgrT9wX G45g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786580811; x=1787185611; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=MCduZZ2cuHkGfG92sUop8F3LbOgQDBWvf7V8w/75FyY=; b=dwVKSGXHsQhvPUTqgDp95PWNFQzSwmdP59ZiPVXjmJtuCGcy/ek1/mPXZFXs8OGwxL lbw61Y1TPHy8Oy82m7kI7kjdwBHFF/5/TOdqp0c4bWcZXRVaZYJN3I9PBkdtY9SGspSB qzPfwcjkZ9aSTwHlHBNhB4WpopZqh7WDBshKmOQFUi9IAXniEhfeFG0g4g1c+zay65dI lOFMlcshkbprEPvnvRGdMXbZ9uCqByAz95wcstngZQH6CtmUhPTVwnpY4sM8H1pu5OlQ N3wdFvHrBKhxeQbV2LSvOBHfHCKkkW3tzBGAtq5ViJdWBq6ZogdP63RlmPdJBuqZXJ0G S4NQ== X-Forwarded-Encrypted: i=1; AHgh+RowXjX9DXw2jc08YvEIdwrq549BJm41xysui/Yj2mPCQkylY1QPjkgPe837HWYqoksQ9sukTce+TMcQTeY=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/8rDpikYGuVa4M0XzusWgSFijdeRtA3+sZx7NDdR7zOixTlEH c6zQ9Q9FBXoubNmpuLtWe7zyS0X7vd8FqdUFtzQo1w+8wf0fotk916E7J3+J9RQpk9842wgWKxJ EyA== X-Received: from dyw11.prod.google.com ([2002:a05:7300:880b:b0:313:afba:b76]) (user=tweek job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:9211:b0:3c4:397a:69b8 with SMTP id adf61e73a8af0-3cc5539bfb4mr3469072637.21.1786580810724; Wed, 12 Aug 2026 17:26:50 -0700 (PDT) Date: Thu, 13 Aug 2026 10:26:17 +1000 In-Reply-To: <20260813002618.3755631-1-tweek@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260813002618.3755631-1-tweek@google.com> X-Mailer: git-send-email 2.55.0.691.gc56d675ccc-goog Message-ID: <20260813002618.3755631-5-tweek@google.com> Subject: [PATCH bpf-next 4/5] selinux: Add BPF_LOADER_LOAD_FD syscall permission From: "=?UTF-8?q?Thi=C3=A9baud=20Weksteen?=" To: Paul Moore , Stephen Smalley , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Jeffrey Vander Stoep Cc: "=?UTF-8?q?Thi=C3=A9baud=20Weksteen?=" , Ondrej Mosnacek , Eric Suen , Blaise Boscaccy , Sid Nayyar , Neill Kapron , Eric Biggers , Greg Kroah-Hartman , KP Singh , bpf@vger.kernel.org, selinux@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Add the BPF_LOADER_LOAD_FD permission to gate the bpf syscall command of the same name. Signed-off-by: Thi=C3=A9baud Weksteen --- security/selinux/hooks.c | 4 ++++ security/selinux/include/classmap.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index e7c5993f6954..b4ff5ea5306d 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -7196,6 +7196,10 @@ static int selinux_bpf(int cmd, union bpf_attr *attr= , ret =3D avc_has_perm(sid, sid, SECCLASS_BPF, BPF__PROG_LOAD, NULL); break; + case BPF_LOADER_LOAD_FD: + ret =3D avc_has_perm(sid, sid, SECCLASS_BPF, BPF__LOADER_LOAD_FD, + NULL); + break; default: ret =3D 0; break; diff --git a/security/selinux/include/classmap.h b/security/selinux/include= /classmap.h index 453522ca87df..4c6cc71b233c 100644 --- a/security/selinux/include/classmap.h +++ b/security/selinux/include/classmap.h @@ -171,7 +171,7 @@ const struct security_class_mapping secclass_map[] =3D = { { "infiniband_endport", { "manage_subnet", NULL } }, { "bpf", { "map_create", "map_read", "map_write", "prog_load", "prog_run", - "map_create_as", "prog_load_as", NULL } }, + "map_create_as", "prog_load_as", "loader_load_fd", NULL } }, { "xdp_socket", { COMMON_SOCK_PERMS, NULL } }, { "mctp_socket", { COMMON_SOCK_PERMS, NULL } }, { "perf_event", --=20 2.55.0.691.gc56d675ccc-goog