From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE111C433DB for ; Sat, 23 Jan 2021 00:18:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1D9423B6B for ; Sat, 23 Jan 2021 00:18:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726327AbhAWARe (ORCPT ); Fri, 22 Jan 2021 19:17:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:48388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbhAVXvP (ORCPT ); Fri, 22 Jan 2021 18:51:15 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6BAE323B52 for ; Fri, 22 Jan 2021 23:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611359434; bh=8/IhIqBBdElc0DnyifuFkLZwG8G+lgMV6K3iSE0gW/M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=r9oitys+pau43ikSMZFmGSf+hnCskZGl8dm+iPtD9zJB6PWJEr/tM5Ei+JFOsiMA3 d4Zm++eIUN6lS8/JMz8JBp4iWNO9Q+ZVWMDyoc5w0zvqq3FJqc+F75AYpXF9aiJ/XT urQAXCEhndOh8YzB2k3PDxl6eHT86oG8Q+W6MQqLSOtvbuUaziejT/ikBo5AJBixGR ijL0Ldqbjieib/hAsO53/k5Nw4BMPQ70xhxc2hepU44ruCPx2He7Tf1Vo/Tqcj1Xme fSj9iJMaKQYgeDWoi0m4YwuMnmU8zOxAZOynEUblmYPYiu1DvlJie9sbt1XFG7p7ZA oQgrcodD003rg== Received: by mail-lf1-f52.google.com with SMTP id f1so84208lfu.3 for ; Fri, 22 Jan 2021 15:50:34 -0800 (PST) X-Gm-Message-State: AOAM5333bsRomurir8rbVzBKOvz7EzzAj0ZyIwifmAIhBWkFwtYzts+l LAwL5xWLIM7IZdg6RHRUMUeyQg7OYZX9SwdIb5elaQ== X-Google-Smtp-Source: ABdhPJw0ARgET/QGQOkap3HBMXJgZVPOV3Jc59vN+bW1p5mla7p1MeiFViG0Z/5GfE9WZG3OSP6UDoHlVOpu/lIPnDs= X-Received: by 2002:a19:c7c2:: with SMTP id x185mr76315lff.162.1611359432739; Fri, 22 Jan 2021 15:50:32 -0800 (PST) MIME-Version: 1.0 References: <20210122123003.46125-1-mikko.ylinen@linux.intel.com> In-Reply-To: From: KP Singh Date: Sat, 23 Jan 2021 00:50:21 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] bpf: Drop disabled LSM hooks from the sleepable set To: Mikko Ylinen Cc: bpf , open list , KP Singh , Daniel Borkmann Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Fri, Jan 22, 2021 at 11:33 PM KP Singh wrote: > > On Fri, Jan 22, 2021 at 1:32 PM Mikko Ylinen > wrote: > > > > Networking LSM hooks are conditionally enabled and when building the new > > sleepable BPF LSM hooks with the networking LSM hooks disabled, the > > following build error occurs: > > > > BTFIDS vmlinux > > FAILED unresolved symbol bpf_lsm_socket_socketpair > > > > To fix the error, conditionally add the networking LSM hooks to the > > sleepable set. > > > > Fixes: 423f16108c9d8 ("bpf: Augment the set of sleepable LSM hooks") > > Signed-off-by: Mikko Ylinen > > Thanks! > > Acked-by: KP Singh Btw, I was noticing that there's another hook that is surrounded by ifdefs: diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c index 70e5e0b6d69d..f7f7754e938d 100644 --- a/kernel/bpf/bpf_lsm.c +++ b/kernel/bpf/bpf_lsm.c @@ -166,7 +166,11 @@ BTF_ID(func, bpf_lsm_inode_symlink) BTF_ID(func, bpf_lsm_inode_unlink) BTF_ID(func, bpf_lsm_kernel_module_request) BTF_ID(func, bpf_lsm_kernfs_init_security) + +#ifdef CONFIG_KEYS BTF_ID(func, bpf_lsm_key_free) +#endif + BTF_ID(func, bpf_lsm_mmap_file) BTF_ID(func, bpf_lsm_netlink_send) BTF_ID(func, bpf_lsm_path_notify) It would be great if you can also add this to your patch :) I guess the cleanest solution to never let this happen would be to incorporate this in lsm_hook_defs.h and mark hooks as SLEEPABLE and NON_SLEEPABLE with an extra parameter to the LSM_HOOK macro and then only generate the BTF IDs based on this macro parameter.