Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4255800imw; Thu, 7 Jul 2022 15:41:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uGDVawegN/pnsmL0gFPEk14FzIggqo7lhaMW1Bi6y325yKjKbzsr2Tj4lXZNvbsfTxggMw X-Received: by 2002:a05:6402:3486:b0:43a:9b82:6d8a with SMTP id v6-20020a056402348600b0043a9b826d8amr569345edc.23.1657233719402; Thu, 07 Jul 2022 15:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657233719; cv=none; d=google.com; s=arc-20160816; b=gaLnhiP77zZ9I165FuYXofo/Zkvbss5bGoA7BIQWmHNsyM2pSw1tzkIiaS7bN6juOt 33MQgtC5JNWC4nXgVBYCc11uoNuMRr5JR87RoJ/X9vdUDb2Fe6H9IK4o8LkDbNnbuGb2 89vWFRTQQSiGHeXDXAVIRacPwj4IFLs3miUOeDC6q97piMCQuvfBZezeoYazRJKAucBG LJioCEkzfVjWZhKN3GlIGG8A8fk1D00ABbfROHkr5gx+oqviZMUwtaP067D4HBrse3Tp wv3KRNhL242PeRpiSTTRlOYiJ+5PfMqXT7IJh9NWmaVGYXzHP0T8jTwTV+SMy+lS4Fyb Xfcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HPI3ojZnM++1c4f61ZRwt4MaisU1ny63+tYPCLxBNyU=; b=UCaP3oGOP1Kqv08KKs+hssbWlLDXOYoDg0xNU7oFxxABgN0poygfCrEvr9OiZwneLe kh4dkUJouwhmENfuxAwoOIaPIJajp815L9vrhIiiHC64AlrAIJCTcg8lorZc1MVugTEP An4V26zVt62pFB/3iE+0SaLnVUl3Xq0LqwAb9LbxhpE0rcV+yJOG2Ga9X5dxAMBhx+ot Otv4bUEb8Cr8b0gR3/vi947ImBM5E/t07jw8N/KkxBYiyTVYo1nK2RYCKjxWRp5LRqao eIdyj+uwhW+cSV5sKwJ05MmsO+vrmPPtmjoJi7fFzcmI0aicjVL5JUIuIa6ZVDqPETst 9YPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b="pPJLzKN/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a056402500b00b00437deb23714si2433396eda.511.2022.07.07.15.41.34; Thu, 07 Jul 2022 15:41:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b="pPJLzKN/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237027AbiGGWc4 (ORCPT + 99 others); Thu, 7 Jul 2022 18:32:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237026AbiGGWcv (ORCPT ); Thu, 7 Jul 2022 18:32:51 -0400 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22E026758C for ; Thu, 7 Jul 2022 15:32:41 -0700 (PDT) Received: by mail-oi1-x236.google.com with SMTP id s204so3581777oif.5 for ; Thu, 07 Jul 2022 15:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HPI3ojZnM++1c4f61ZRwt4MaisU1ny63+tYPCLxBNyU=; b=pPJLzKN/n3H53u85lbMzUgP5UsS4fil38YQ7/dfmeg3M8/AKwxVBk+o8JUNfyzo0BU Ma1+B6VEHpA2z1r2kpEhbf43UigQAbI7DljAQ2RMp1GasHdit7vE00Ayz/lHyMPIYe7S pfSyPARlPQPu+9DCiuXMHuQvu7ASo5GBxM43g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HPI3ojZnM++1c4f61ZRwt4MaisU1ny63+tYPCLxBNyU=; b=w21s77losl3R9wlXL3xDg680f1NAgWaLwl467P1QekcFssec4nZ1ZOW+2tnYUyV2vk 9n+t1/RQ8fvzMc46KakDTmMkhawx2HMuHS79J9f6l6IO1op9p/9a2lb97LaM5PQSgJTb y9W0YLnbhL82TYaGtfsLvN3Zhm1M/rzHVXgZjp/YOlMjBxejJOGCwoibKjxJboc2y97T IzZVOFTlPF+QszYtQ7cu4iwF/DPAS9LhEMKXAUMr19FxJIGhcIXSvMy8+TEQgAwjloXh 70XwIxYNxaUDPa+UOzLYszBbgmbIatSmBKO4GpYRo9zajEfNKMjOHGhEeWfzrcym/SfL OrGw== X-Gm-Message-State: AJIora/wQmWY0fcpgwBS2RaCTE5jpm+dFwGLig6oZ87KpDEPOpJxdyz4 vnyzSYnwVxgVrV0kbR2csLlXLg== X-Received: by 2002:a05:6808:11c4:b0:2d9:c395:f15e with SMTP id p4-20020a05680811c400b002d9c395f15emr3824812oiv.47.1657233160506; Thu, 07 Jul 2022 15:32:40 -0700 (PDT) Received: from localhost.localdomain ([184.4.90.121]) by smtp.gmail.com with ESMTPSA id i16-20020a05683033f000b00616b835f5e7sm16246222otu.43.2022.07.07.15.32.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 15:32:39 -0700 (PDT) From: Frederick Lawler To: kpsingh@kernel.org, revest@chromium.org, jackmanb@chromium.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, jmorris@namei.org, serge@hallyn.com, paul@paul-moore.com, stephen.smalley.work@gmail.com, eparis@parisplace.org, shuah@kernel.org, brauner@kernel.org, casey@schaufler-ca.com, ebiederm@xmission.com, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, kernel-team@cloudflare.com, Frederick Lawler Subject: [PATCH v2 2/4] bpf-lsm: Make bpf_lsm_create_user_ns() sleepable Date: Thu, 7 Jul 2022 17:32:26 -0500 Message-Id: <20220707223228.1940249-3-fred@cloudflare.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220707223228.1940249-1-fred@cloudflare.com> References: <20220707223228.1940249-1-fred@cloudflare.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Users may want to audit calls to security_create_user_ns() and access user space memory. Also create_user_ns() runs without pagefault_disabled(). Therefore, make bpf_lsm_create_user_ns() sleepable for mandatory access control policies. Signed-off-by: Frederick Lawler --- Changes since v1: - None --- kernel/bpf/bpf_lsm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c index c1351df9f7ee..75853965e7b0 100644 --- a/kernel/bpf/bpf_lsm.c +++ b/kernel/bpf/bpf_lsm.c @@ -250,6 +250,7 @@ BTF_ID(func, bpf_lsm_task_getsecid_obj) BTF_ID(func, bpf_lsm_task_prctl) BTF_ID(func, bpf_lsm_task_setscheduler) BTF_ID(func, bpf_lsm_task_to_inode) +BTF_ID(func, bpf_lsm_create_user_ns) BTF_SET_END(sleepable_lsm_hooks) bool bpf_lsm_is_sleepable_hook(u32 btf_id) -- 2.30.2