Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1789437pxb; Mon, 11 Oct 2021 13:11:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiGQcp7zL0VjZkbAgl2Cs3hiV2q8BDkk8wqt1SXJQl/rAYuEYWuHE4Enhm79fWh5IBe3AS X-Received: by 2002:a17:906:eb86:: with SMTP id mh6mr28175942ejb.141.1633983072062; Mon, 11 Oct 2021 13:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633983072; cv=none; d=google.com; s=arc-20160816; b=csx4maWNt6JTgjhio+3gvpSBK/VCAwnKg6IeYYbaEGvnND5NZyo4Sisin/RPjOEkP7 8Z+N6bBAIz79FVxtSeBSj77a1MayKKGHobEOF9t7NRjq6EZVlWZKDg6dUoZLutasKpVf lBVcz/vREQXrVpJiHI78I8IfR56JRi86e48CzHJupsbBX6BzJvF5rNzS4kYvQPPtJU/+ lFwHAqECWlJRJYvg+upTzfjepfaOT4H73+X2VwbmGGgAFb8Y21aGzwct6r6c0vUamGl3 Lj9YvtiWPa3w6mgHzTulas4FBiWTUASaOQCeIR9jv9QIE0WcJsXU3vnpFmS2SLf/NaoE VMFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=SEaW42FNwqHrybaZu8YR5PlFOWD9d0pB1ICb+AkS0IE=; b=yMIUJqBOmmOrKFrEwv/1evchmUYafSV4oieyIC4yLbPlnBc9AJL7OeQ3fwot0ucgI0 IaCKy/Hfih6igdBV1lXsL7lDTNfVWz+4ZA7kxpLk10VlcWEkVEH9DROI/es4malP1c9+ 5EnyV5qYZI+gV0FzeZwY1co2Op49Qbe5kFfxNfPVabwhxkypygAE68VzwbNHgZe43rPF Ajl0doCIQvU8hPxVDlhI+DTSQ2C+gsGzeiTY//hS2xvf/45Mr9nuVni5yIoF0ox/sR9o sn4clBh7XR7FbmLFxrDM3NruHSqqAKJgeMc5+UXgSpWpCPNQTi7DMFCU105O8LN60+Ta QrbQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o11si11238468edc.51.2021.10.11.13.10.47; Mon, 11 Oct 2021 13:11:12 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234852AbhJKUIW convert rfc822-to-8bit (ORCPT + 99 others); Mon, 11 Oct 2021 16:08:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234835AbhJKUIW (ORCPT ); Mon, 11 Oct 2021 16:08:22 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C83F4C061570; Mon, 11 Oct 2021 13:06:21 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1ma1Yv-00033F-K4; Mon, 11 Oct 2021 22:06:17 +0200 Date: Mon, 11 Oct 2021 22:06:17 +0200 From: Florian Westphal To: Paul Moore Cc: Ondrej Mosnacek , Florian Westphal , SElinux list , Stephen Smalley , Eric Paris , Linux kernel mailing list Subject: Re: [PATCH v2 selinux] selinux: remove unneeded ipv6 hook wrappers Message-ID: <20211011200617.GA2942@breakpoint.cc> References: <20211011142416.26798-1-fw@strlen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Paul Moore wrote: > On Mon, Oct 11, 2021 at 2:21 PM Ondrej Mosnacek wrote: > > On Mon, Oct 11, 2021 at 7:10 PM Paul Moore wrote: > > > On Mon, Oct 11, 2021 at 10:25 AM Florian Westphal wrote: > > > > Netfilter places the protocol number the hook function is getting called > > > > from in state->pf, so we can use that instead of an extra wrapper. > > > > > > > > Signed-off-by: Florian Westphal > > > > --- > > > > v2: add back '#endif /* CONFIG_NETFILTER */' erronously axed in v1. > > > > Applies to 'next' branch of > > > > https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git/ > > > > > > > > security/selinux/hooks.c | 52 ++++++++++------------------------------ > > > > 1 file changed, 12 insertions(+), 40 deletions(-) > > > > > > ... > > > > > > > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c > > > > index e7ebd45ca345..831b857d5dd7 100644 > > > > --- a/security/selinux/hooks.c > > > > +++ b/security/selinux/hooks.c > > > > @@ -7470,38 +7442,38 @@ DEFINE_LSM(selinux) = { > > > > > > > > static const struct nf_hook_ops selinux_nf_ops[] = { > > > > { > > > > - .hook = selinux_ipv4_postroute, > > > > + .hook = selinux_hook_postroute, > > > > .pf = NFPROTO_IPV4, > > > > .hooknum = NF_INET_POST_ROUTING, > > > > .priority = NF_IP_PRI_SELINUX_LAST, > > > > }, > > > > > > Thanks for the patch Florian, although the name "selinux_hook_*" seems > > > a bit ambiguous to me, after all we have a little more than 200 > > > "hooks" in the SELinux LSM implementation. Would you be okay with > > > calling the netfilter hook functions "selinux_nf_*" or something > > > similar? Absolutely. > > > If you don't have time I can do the rename during the merge > > > assuming we can all agree on a name. I'll submit a v3. > > Since selinux_ip_forward() and selinux_ip_postroute() are used only in > > the hook functions, how about changing their signature and using them > > as hooks directly? That would solve the naming and also remove a few > > extra lines of boilerplate. > > No argument against that from me, although you should be able to do > the same for selinux_ip_output() as well unless I missed a caller. I'll have a look, thanks for the pointers.