Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1710991pxb; Mon, 11 Oct 2021 11:23:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoU+PNu7howSIkD+5IQPKF3zJF+HRA2GRh08Wqs68z9WDlHHr9qzuz/QZ9vnqq3sNJ8wCr X-Received: by 2002:a05:6402:2709:: with SMTP id y9mr44356378edd.131.1633976612761; Mon, 11 Oct 2021 11:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633976612; cv=none; d=google.com; s=arc-20160816; b=JeFeNVC6NL5CZheOBWqwwlfHJQeVEAlgiR5XQTpPtu8RT++KeDlu1uUnLXeaYVjFwo tbcqiPfoh2Uuj28/OxoZ5FPcEEj5G1tc66KH++84/YfLwsav648by+aQ+GHB47ZI3V6f MflfqOMHESg49lgLXVldFIZC7jAVpmfx7/rF6K/8QTN9T+2a618ubM2Ui2XvtyFLzObi NPzj1JaBbnIfzUqUop4U1Czy+sQh6J5ZJJVWC6SRjxj5m+8WQ1ntzE22ECYWnoobAXOF 9f+/QtsMWUU49zrSvXKAAX9N+d0wlRXESkbCwEKMK/6ah76BOvNJpB+5Slat3QbMIeVX nYMw== 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=ohyIViGl1QdCfoc0LpU/AMXi6YFfnwDVF+4zmqvqVyg=; b=qROzUvZioFEwJ4+rk+gh5HF8yE8ERQmS61XBRQq2JIE2esPrveLmqIVfuWOuEJNo34 bGL644BfKcJnBE1sDP6Ds6CgaAimlPS6tzUr7a52cCIDQ+Yu7f3Y12NO5/AmyM0x0jzH ZMfVf0F0VxYHjFIiAuwLPp3MtctYDtO8GpS0plI8VG2E/m7CLcCOouEcaRlVofJjCIH1 oratlN3hvLg6xPaPNg0JzO4r5cB7oUGOh8TdL1AQsMFq/hw/ez/GklJM4C/MgSFEDOrZ 233PaEmDPru+IMEtb+4W/fYG6mlBCH7O+s9nzTIf0SVns0a9MBXdPkZH/RmNkqOOOJmI w85A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T0vfigrL; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v15si8068577eds.573.2021.10.11.11.23.08; Mon, 11 Oct 2021 11:23:32 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T0vfigrL; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233821AbhJKSXH (ORCPT + 99 others); Mon, 11 Oct 2021 14:23:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27070 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231756AbhJKSXG (ORCPT ); Mon, 11 Oct 2021 14:23:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633976465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ohyIViGl1QdCfoc0LpU/AMXi6YFfnwDVF+4zmqvqVyg=; b=T0vfigrLyLJLfIi65TSqS/GvUJxNIktuo+xjT5PdjHmTg3hDs6Dk4HqRB2p2SxC/94L2x0 tQKVk5bC06wm5ZoBqHEfSM8vc7SK5xUm96uPzDge0HohsyU1e5lrTftnAJYIJ064uXcncJ vEX2OoNU+WufrkYjPnqCcFUAf0SVX78= Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-417-0T7ZFfT2OkiRnGYkF5Bqlg-1; Mon, 11 Oct 2021 14:21:04 -0400 X-MC-Unique: 0T7ZFfT2OkiRnGYkF5Bqlg-1 Received: by mail-yb1-f198.google.com with SMTP id y16-20020a2586d0000000b005b752db8f97so24064810ybm.18 for ; Mon, 11 Oct 2021 11:21:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ohyIViGl1QdCfoc0LpU/AMXi6YFfnwDVF+4zmqvqVyg=; b=SftZGTqPtQCf9aH9yjkMvkK3PlmlkxUxNW01h0aeqbC7pHmIw7I9RAbeooX4nt10Gp 4/vmScY4D+KQBhQESrteoDoNDa7TNdjsEoB9cFFY/Wy0JUCMxCZjXQIqgFU+YCMPi00q AQ3vLF7KHh0JlEymlUtV4sVlrccpcjaXA9PRSHbWa8In6FOIDizppO8z8JNWeIaz+dmF XE/3cAnYviIPSo3g01ByjUGFOCclcGtpqdBlrOLy7jwtB62ujFm/iPDVNH73eoQHt7x0 q72OxDXUfI2ZAPmY7OqHk8dJE1H6BM+YRItkz2F6Y7Vds0VcTih8JMBSmsCQYS7PghtD ijbw== X-Gm-Message-State: AOAM531MO25wH1JRPy+P7tge5ofgFGa9dbIzj+Y2XTiDLcX3XRiFZ5lR lEPdh9+NNEVTw3VSMFP7zqduhTa4bbxpPDIQ5aPpfVewMWywBHvi3b4bNR+1AthoSZ84VkXrC04 QNUIPAUeX02j/+CNlzk8A94nuRMea2fPQIOKox/B1 X-Received: by 2002:a25:2e01:: with SMTP id u1mr15371699ybu.363.1633976464003; Mon, 11 Oct 2021 11:21:04 -0700 (PDT) X-Received: by 2002:a25:2e01:: with SMTP id u1mr15371670ybu.363.1633976463738; Mon, 11 Oct 2021 11:21:03 -0700 (PDT) MIME-Version: 1.0 References: <20211011142416.26798-1-fw@strlen.de> In-Reply-To: From: Ondrej Mosnacek Date: Mon, 11 Oct 2021 20:20:51 +0200 Message-ID: Subject: Re: [PATCH v2 selinux] selinux: remove unneeded ipv6 hook wrappers To: Paul Moore Cc: Florian Westphal , SElinux list , Stephen Smalley , Eric Paris , Linux kernel mailing list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? If you don't have time I can do the rename during the merge > assuming we can all agree on a name. 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. -- Ondrej Mosnacek Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.