Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1424848pxb; Fri, 22 Jan 2021 15:55:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFosq/lwuItRZElMD1Dg+my2kZvc2Sb4QY91m9e5ycDTg0qfCPl8bft+QD0fOsoO6xGKoX X-Received: by 2002:aa7:c244:: with SMTP id y4mr4975799edo.239.1611359736777; Fri, 22 Jan 2021 15:55:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611359736; cv=none; d=google.com; s=arc-20160816; b=kKEG5mm4U7ePrOXOnMzoaBCi7Uxwl7aaWXgy8fV56CacLhlH0GgUqHQo8TtV5QdUO8 tYKfl/QiBe6N6EB3XnO2zqG4oTy2SWpmPt8idjlxDvwKhpdn5wdobcF0YB26yo+GZvkb HJokI3DQ990fUreFi1CXYToxZZNnhlXaEJcb8o5jEu6uUBpjQ4CECxEliKcn2HUxqcrF 2Mlx0Uvz4muxRtDdh8dccQPtDQoPYQtxWvEAPR8U9mEY5ExkHYxWruVejWQBnyrvWD1Q T7Axxk+hWqdESKahHLhk0Jmebk+yAosPxdmXABW2lNLGb4gU/CTMAqbzz0Axk38HT+La eqFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hPFe1tyHxzBPG+OLRHhpew786fU1KCgUjupga5m83yU=; b=nUfDq1X5SQ9UiUzFsrr7TZQYRZAmvZAbjYTgNnTo6d5OTvnJzvnlKWcgCZXV91dQEp t+xC+7rfFjcB5gsgKnYHHMZAO3AK4IygH/a1jXMGvzE2Z7sonVEd+KgOBhEOTQ874zU2 gHLEIkarqJLoN6dQs1vcZAV9rcR/K6FoRR/638xoCcVGaoEVbERWQJzwrLdA3UnkkJqw 3ukE4uqCF1cokII1iFdiOvBoeSsa5w+dOFo0vLP/QrtDfXaw7PWyQq0yc/8Pg8R7BN+d OsQ/9XPKlRbIJnUDb8WNlDYfv++sKYiFzGGoAjpEAkzFDQndfhyqNUqMCs1p+MFuhjvn 3PuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r9oitys+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm10si4134752edb.372.2021.01.22.15.55.13; Fri, 22 Jan 2021 15:55:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r9oitys+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726351AbhAVXvy (ORCPT + 99 others); Fri, 22 Jan 2021 18:51:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:48392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbhAVXvP (ORCPT ); Fri, 22 Jan 2021 18:51:15 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6DA7123B53 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-f51.google.com with SMTP id h7so9915983lfc.6 for ; Fri, 22 Jan 2021 15:50:34 -0800 (PST) X-Gm-Message-State: AOAM533VbUf7MLkMSLUVFrgBtuhFhlR9Vglc88DoXzEXZM6aGKf4yyrd NXEIOQBsn2FL5Zh9DAEzJ9lpPBrfOamUogCae/Z2hw== 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: linux-kernel@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.