From patchwork Wed Dec 13 14:38:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Michael_Wei=C3=9F?= X-Patchwork-Id: 13491102 X-Patchwork-Delegate: paul@paul-moore.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=aisec.fraunhofer.de header.i=@aisec.fraunhofer.de header.b="wa72759e"; dkim=pass (1024-bit key) header.d=fraunhofer.onmicrosoft.com header.i=@fraunhofer.onmicrosoft.com header.b="jL5W9xhM" Received: from mail-edgeka24.fraunhofer.de (mail-edgeka24.fraunhofer.de [IPv6:2a03:db80:4420:b000::25:24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 725A591 for ; Wed, 13 Dec 2023 06:39:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=aisec.fraunhofer.de; i=@aisec.fraunhofer.de; q=dns/txt; s=emailbd1; t=1702478384; x=1734014384; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=acMlZA/xra8ZJA8XT9qz/nbXxTd/JYij/1sJaqATZAA=; b=wa72759ecBnXUJOd5Ovd1zvpa/o3sN6QuoTM77J58FyCEkd1KjU/5YUE mBeqt3EvWwDhnF2BdGMl7pN5jeD0RVx7i68Rc/QNzWePwG5Ewdt1yjdeY Dqhh2kWgux7ylyJFCkDe99UmmIVMF8ObTelgr4BSXvVVW+98PcPx4ZWUh Rb6Na0yj1cxr+F3HadUEYhcAJLvYcvpIEMBRT6GWq0px+Mw25Qv+1LEtv wh7qn2mr5tuWEx0ULZLfRwfZP9JP1BsrccaR0F88dQhT6T95poLwPQY96 H32B3+2oWtk7oNkQxIIywCIydpHqARriQ322UJ+C13PPlniK3Gr6idhV9 g==; X-CSE-ConnectionGUID: zkE+Kv4mTRSszHMTxPxlSQ== X-CSE-MsgGUID: COe0W31dSFeUtVOMLpUOYw== Authentication-Results: mail-edgeka24.fra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kz68CujhTFQQaVz1c3UmgdkUktYUDP7ET5UMjJnQTKsslwwjTBGNP3bIo1Gjap8 YAoZjjPrnsXHGUpzWzGtpRJz6VQ9UHExVR1lozwPb7EJPpbQo+aee8iHU58Q9hPdgdMUr6OQ 7EBVc9QYclqiYTj9lQRnwCHFBixJqTM5gARqn7ax6Y10LUEFTP23iElDo4EoXCJttnwMLxPD 8KJkPCRk27YZMFt/Gji1pDNajV6/tKVVJtecsjPyXk9HArevHqvuNXcMmisxtYm4jCQ6uFye OyrjkQkhlFN/wK945092qjV36gI6m2Zqz182YweYvC/b09/UIv3WIsVtjudMZNxWN9nWWxzp SImn6UPooXoFMBr4JEuxhqaZvCIfouBuE6lWvyYPDF4g3xoYvSzikX6/Uuhz7jkX9KvmBZRr yVDm8XRrH1FyRHJ68aGR/c8tkes0DqCzUbSv8lKO0kpk6rcJZM7hLk2k5sYq0PYGSHq3k7xi cer X-Talos-CUID: 9a23:LEdxxWmZNdXIqWul/bP8sNHLYiHXOW/e4TTzPRO9NVxSU6+1bGOAwLNgqPM7zg== X-Talos-MUID: 9a23:9lS+bgYaSmtFIOBTnBjh3A45bctTzamTFH4qtLEehu61Knkl X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.04,272,1695679200"; d="scan'208";a="5192938" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeka24.fraunhofer.de with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 15:38:36 +0100 X-CSE-ConnectionGUID: nu86nVvrRsW8njaENf/vQA== X-CSE-MsgGUID: Yd3cNMxSSqWeNwCHxcrtFQ== IronPort-SDR: 6579c1ea_eudvFEcDhuXpb3t7EugF8CGzSwoPqVRQGhy00knICAMJ4XA 0skKpq9RkSDWMm6jiOa7Ljt/OCNUaJJL/9mjsJA== X-IPAS-Result: A0C+AQBtwHll/3+zYZlaHQEBAQEJARIBBQUBQAkcgRkFAQsBgWZSBz6BD4EFhFKDTQEB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uEvBx9a iV9sjzsCWYtN9/YgBFpTntAsW9qBHnm6KdiLN5VdyftWLd2VdAQrsM0aLShxX6Gyb3ssNAzq 9qdqRTDNXxCBxGls7x4gWiM9tI+qjjzImYwc/Ez3xkCSdwa69h6A9lCgGUVmVuXQxHD5IlFJ yaj/A3xQaISDA+dcSxDj0iROjMp9rCiZLgb1o8CxYj7GC1/FCV1II= X-Talos-CUID: 9a23:4t7H7GEsFwDpWWmvqmJh6R5KHP47aEfG8yfWIUaVL2guVoS8HAo= X-Talos-MUID: 9a23:8qRiwAkyqFBA1VywkuyQdnpTOJxjxYG+M3sUrpggpOKkJSdqJxmk2WE= X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.04,272,1695679200"; d="scan'208";a="73956622" Received: from 153-97-179-127.vm.c.fraunhofer.de (HELO smtp.exch.fraunhofer.de) ([153.97.179.127]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 15:38:34 +0100 Received: from XCH-HYBRID-04.ads.fraunhofer.de (10.225.9.46) by XCH-HYBRID-04.ads.fraunhofer.de (10.225.9.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Wed, 13 Dec 2023 15:38:34 +0100 Received: from DEU01-BE0-obe.outbound.protection.outlook.com (104.47.7.168) by XCH-HYBRID-04.ads.fraunhofer.de (10.225.9.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28 via Frontend Transport; Wed, 13 Dec 2023 15:38:34 +0100 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UZ4Q5MxNpoFUcXF5ShoaH8+slCvLV24Y9yRVEJZUwr9POjVxevmXMhZf4iS8+HekAclcJ7f+ZtUJd/RpFVQKzG+9A7rXo+NfcTYia1W67Fi8lEUnbyDjs+lsu+aARyCIxS3eiWqqZaA385RMEbFB/sQXTKmh+dGouwKwI29DsEosQvO+YKcwrYYYGbuSc1ey68ZRWOmhb/4z4QGgMB0rUYSpI98fRBQLdAW5uHEADmRjt3RXj8068vqrR3yOmiqkQGEH9IZVeT6xO8BeRi09EVD4c92embOhfXJECkR/tsIfUrDtmQM9u4nTS8RC2oQ3Cx0ET7ivSbkyzUpu2LDaKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kf7PGGXlKeru3MviIRi+jcvO+FOON4xC3xUeyT0Q+oc=; b=jdr9fC/vAVDGdzr9ClA2XAENReOxdSlb7L4wnhyNzChFdgwBxh6cGg9nj3lR6c5Gpx90Lx0FAB7xXd3/GSddkyidWVFW11g84V3X7oNT3HcyFebKr/fifUhYhgNT6DBq6YouSPA+KKsArPuLNrVlG0pHbbRxPTttbRl0FROgrlBOFr6jSE05ujHJNjdKoYI0uGpTxSGVU8HcqfMMmdWVE00z9ylj/cHVykp4pzxhfKQlix+r+eqLqFF7qAwfy/h55zy1iOoqwpvcaCuXEchSdMqoXNlADVwUjUglmmz4ujIUojEu0j4PNperLe6J2ZBWSvumA40spzK+mZ+YROFiBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=aisec.fraunhofer.de; dmarc=pass action=none header.from=aisec.fraunhofer.de; dkim=pass header.d=aisec.fraunhofer.de; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fraunhofer.onmicrosoft.com; s=selector2-fraunhofer-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kf7PGGXlKeru3MviIRi+jcvO+FOON4xC3xUeyT0Q+oc=; b=jL5W9xhMTD/lTP0LUuvvICe8UZDRf2M94GZNev9gwZsQyyuJ/KDW1DiDrcgk9MlZXjEmy4byl5rdmls56JT41163scZSM7wVpmpM37KqaAFkjvhXzcasZGWy1Qe3QxZC90cmczEflmBkE8T5RzM2y8It1BuHU56pmqbC/EoOilY= Received: from BEZP281MB2791.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:50::14) by FR2P281MB0026.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Wed, 13 Dec 2023 14:38:33 +0000 Received: from BEZP281MB2791.DEUP281.PROD.OUTLOOK.COM ([fe80::d273:9b9b:dadf:e573]) by BEZP281MB2791.DEUP281.PROD.OUTLOOK.COM ([fe80::d273:9b9b:dadf:e573%3]) with mapi id 15.20.7091.022; Wed, 13 Dec 2023 14:38:33 +0000 From: =?utf-8?q?Michael_Wei=C3=9F?= To: Christian Brauner , Alexander Mikhalitsyn , Alexei Starovoitov , Paul Moore CC: Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Quentin Monnet , Alexander Viro , Miklos Szeredi , Amir Goldstein , "Serge E. Hallyn" , , , , , , =?utf-8?q?Michael_Wei=C3=9F?= , Alexander Mikhalitsyn Subject: [RFC PATCH v3 1/3] bpf: cgroup: Introduce helper cgroup_bpf_current_enabled() Date: Wed, 13 Dec 2023 15:38:11 +0100 Message-Id: <20231213143813.6818-2-michael.weiss@aisec.fraunhofer.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231213143813.6818-1-michael.weiss@aisec.fraunhofer.de> References: <20231213143813.6818-1-michael.weiss@aisec.fraunhofer.de> X-ClientProxiedBy: FR0P281CA0006.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::11) To BEZP281MB2791.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:50::14) Precedence: bulk X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BEZP281MB2791:EE_|FR2P281MB0026:EE_ X-MS-Office365-Filtering-Correlation-Id: 33f0d468-c909-4cb8-66a4-08dbfbe92e76 X-LD-Processed: f930300c-c97d-4019-be03-add650a171c4,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sLHo0dGNV+zBI2zXpn5OSkyh+NkoUGF/Gn6/vJnjCqJrx6VM2iL0HufNTcWd7cU6XGLatJYyv9bweU58VMGHVD2xEZGChavC6ekGJoVCDX62VnaTBWFPNBGehlQp3yAvftPODDvrwKb8jMeablKSS8e4j6tVQs3fStkVNVmNjgew37LcFME50TcLK5Z6xBLhchAWUC/HUXPk/ftzQjUSve7HshB8G+mXFni0uabU4Scn5v5iwudlF8xrcWn+27jRQhxcJvyf5y7wLLuzJgzxFZj673ZYcoVPFAgEgd7hIj/LYtNE1P+Qc3HXkSV9t2MSVUFDjsYz+v9F1Cat4bs5DvoVt/MWP0VK/3qSqWjiQgEI83TN/nCe/Ip809PM0Ho+S5zlgxSG8Jm2UJXDiKKxDtE4xDNimUyc04jqacsgV4in+F6Ti3r4KnT+UAw12alLt4B6oRtE5PA1y5H93gMBJ0yoKoehuj3NiAIV3fJZicaM5QV1Z1sRtuH38CXYIzWrK/LWHlt6wJvx856j5Mc5Jf6qfKqOVjNImwqJGrmwUq8ZnOz86oRnHe0jGHSNJDDJeqPFvRZ377N0aTY/SY+SKO9Pf6una+Zxnj788ZMghLc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BEZP281MB2791.DEUP281.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(376002)(136003)(396003)(366004)(39860400002)(346002)(230922051799003)(186009)(451199024)(1800799012)(64100799003)(83380400001)(38100700002)(8936002)(316002)(54906003)(8676002)(2906002)(7416002)(4326008)(5660300002)(66476007)(478600001)(52116002)(41300700001)(66946007)(6512007)(6666004)(6506007)(110136005)(6486002)(66556008)(2616005)(1076003)(82960400001)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?zr7Vb6yumyD+2uwcsQKYRdXMkBPa?= =?utf-8?q?mCTNgXftFRz0PgDxuWm9/gTr52NjguGQuDew+XjAjkOUdOtEFwvLREgwG5ZIGZZKv?= =?utf-8?q?UHmrVoPnRV/VDSF0QcGs605isdu85hPi8UmqW8WTcJ7dTSYjKp+Ey1+9dbW7BqRpF?= =?utf-8?q?zbkf3NE9NnbOf7TTCTy4bFctctoO9GNAQkKV40XRVOxuHInFDVnUMxIZ3/CqBLdhV?= =?utf-8?q?+/KGze/f8Y/ssqDvAc6a6y7sD2BqWvzVojgn9Ax0l/6lqiQ/ohvoD6jV5BULJIBE6?= =?utf-8?q?E7jZFvyk71gVgv4Vt/5hU8H6EQGx1UFHND7qKxPAaGXdq1Tx1KnSw6V0dtKjLP2Ep?= =?utf-8?q?e0DZ1HS7xH8XIQQ+BXFSoB2e/4MrbJsnWu8bykidehkfC6Z0AkgyEFfZ3TXhhWX2u?= =?utf-8?q?qCEhF+RxAfXAYWg7qwe0i1suGX6foD5MvSMLzBDqzf2LGFwMw87W90Hp5LtmpgQI3?= =?utf-8?q?fZfN1QfzTfGmTFXL4QT9PnU44GVTzMbQNe+hPGmzJj5e6AH/cC0AKZn4c9TOI4Xdx?= =?utf-8?q?QbtlOYZMZJQmb9VD1XNJYS8sgYURwvtqsRZcFYGqPm1Wjx/WsZTWFxl0Llej7YrMM?= =?utf-8?q?Be+FeEvfrDlE5fHFa9JvF0R3Clst0NsroFTn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pxzsrr1?= =?utf-8?q?8YAlwW2flNrFKBZZx+6AHlSX0HOrCSxV/2/Dsk6nXQQqXMQc/qQuC6MbqyQB0Mopu?= =?utf-8?q?tCSVqRp/wfxU36iGsysL4SFkGJNrN1Da6xWQoZkHwRAvChwkyjzeCw=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 33f0d468-c909-4cb8-66a4-08dbfbe92e76 X-MS-Exchange-CrossTenant-AuthSource: BEZP281MB2791.DEUP281.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 14:38:33.0294 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f930300c-c97d-4019-be03-add650a171c4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: v4uyDlg8Awo9ucSO4WSjBVaJXsKXtQzTgVATA6NiocLaiMyF5AINa11XfBZTTZoK/reAyhSwagNQuVJ6qe6RhHDVz07XYcI3KmXwShPQZMUZHZAggZ9UuX0H5hR15PSz X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR2P281MB0026 X-OriginatorOrg: aisec.fraunhofer.de This helper can be used to check if a cgroup-bpf specific program is active for the current task. Signed-off-by: Michael Weiß Reviewed-by: Alexander Mikhalitsyn --- include/linux/bpf-cgroup.h | 2 ++ kernel/bpf/cgroup.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index a789266feac3..7cb49bde09ff 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h @@ -191,6 +191,8 @@ static inline bool cgroup_bpf_sock_enabled(struct sock *sk, return array != &bpf_empty_prog_array.hdr; } +bool cgroup_bpf_current_enabled(enum cgroup_bpf_attach_type type); + /* Wrappers for __cgroup_bpf_run_filter_skb() guarded by cgroup_bpf_enabled. */ #define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk, skb) \ ({ \ diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c index 491d20038cbe..9007165abe8c 100644 --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -24,6 +24,20 @@ DEFINE_STATIC_KEY_ARRAY_FALSE(cgroup_bpf_enabled_key, MAX_CGROUP_BPF_ATTACH_TYPE); EXPORT_SYMBOL(cgroup_bpf_enabled_key); +bool cgroup_bpf_current_enabled(enum cgroup_bpf_attach_type type) +{ + struct cgroup *cgrp; + struct bpf_prog_array *array; + + rcu_read_lock(); + cgrp = task_dfl_cgroup(current); + rcu_read_unlock(); + + array = rcu_access_pointer(cgrp->bpf.effective[type]); + return array != &bpf_empty_prog_array.hdr; +} +EXPORT_SYMBOL(cgroup_bpf_current_enabled); + /* __always_inline is necessary to prevent indirect call through run_prog * function pointer. */