Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1235721rwb; Wed, 28 Sep 2022 15:28:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Rt5UzIlHH/TTM27y7TVF4w8VjpXJ1Lp1idaZY2+3PH8Y1lP+w3WvQ+ga8ATusNdhbSWg9 X-Received: by 2002:a17:906:c153:b0:787:abca:d9fa with SMTP id dp19-20020a170906c15300b00787abcad9famr107202ejc.768.1664404129813; Wed, 28 Sep 2022 15:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664404129; cv=none; d=google.com; s=arc-20160816; b=k8HNOKplLKAJTcSJkHV8CRrH7dfJvzevRD8z0An7ryQMJJiNvmgXHR7XdNXwk4SLPf 4Wn5Iz1ZuAs1NQJyBmGg7prwu2k3N+MB5vedykD5ZlGNa6RV1oycjfBdaT/JA5T+0Ylo yS+aATiA0Xfe/qOoC02uUaVbWpjaAe7UudTBR4V1ttx5Xjn2lWMtWV8PwbLDoqDZ1rHj y7CYN/YRFLIFsJxEeviGFLL1feSkar31cpwzJHOxGWLLjqSeSHLztlxjIhR3bXsjUV3+ uu7g9OR3mhRu4wmC1Z18NlM9TIZn23muYd7e+irQMTiqu8rXXKAHMnYsFPaRMq4FvTHB 81jA== 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=tmCcbs8t+TQBW8BCIw+S4lYW0IEH6zSrzGu/chcwJpI=; b=upPGUNBTRenQRH3QRTsv9AYjEC35fQqSHq9aiZCK4yJI+Jsn3oxln/E6yV3ijRZBiQ wjs2uJoK6odr8GoKmeYcFB+Fx/znem3R5WYI07MioNkY3+ZvtLnsSsHTPkR5kc8yiWs4 woVvhFAYlVQzKuyVEfjshcYO6JkZmrtvIHGV8KYsidGj6zVs2BimfQFlcp29YsurN/QX eeUXC1k9fjsNkefSGnBd4sTxBybUMy3FGNoAOMzx7sRKtzPtCa/w7ofj/sZcR8xj52fK MmeMsbCTZagEb/OEEOUMT+drgVR8fN48IGP/LVgxg+H6vAnZtM0WHeIq85gCYxWsS+ex LUWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=ViN6DS2P; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g1-20020a1709061c8100b0078265af9468si5710693ejh.893.2022.09.28.15.28.24; Wed, 28 Sep 2022 15:28:49 -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=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=ViN6DS2P; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231846AbiI1WDY (ORCPT + 99 others); Wed, 28 Sep 2022 18:03:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbiI1WDV (ORCPT ); Wed, 28 Sep 2022 18:03:21 -0400 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B37917583 for ; Wed, 28 Sep 2022 15:03:20 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id s125so16938566oie.4 for ; Wed, 28 Sep 2022 15:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=tmCcbs8t+TQBW8BCIw+S4lYW0IEH6zSrzGu/chcwJpI=; b=ViN6DS2PE0rE7/ZFHW24Z2RMpqYNwXkvYbP6FGXPP1wK1uVPUX/gKiyHqt5uPEEeww rp6D8aLHWrI9CIuhmvFjwWlTzEgEQpFjrGULuOgMxe1w65ipmL1QgMSMi5vYUW5BM9ck rpl/6X42uGtBQpd4mWPjuMeuJ0Sgmk+PzVf2B1M57OqMHIuOyN94ZmMstzKlEpfFA+mX eWTQpWedYYdwJ3k31fMuSVAFmtnNJO7oZDguoqYkg7ea6zt2ug6SE1p5lBPfC/BvUo0c TJKcPzLRVjTnN1RW3mvZBOg2Sn5pP5nZe/vLNeLvQRmUHdqRgvhRgDA8nqzW5Mg9cT0Z 3tRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=tmCcbs8t+TQBW8BCIw+S4lYW0IEH6zSrzGu/chcwJpI=; b=0u1o47GOKUF1SVKuHAkkXoI/pC1gQV0zavjqpa+4Y3sorRrID2OceHZLtjEii3PGf9 frRAfCDL6dAdjdcGzN572UbyVFMT+FtmAGgEOqQl9oQ2hLdS3OrcFcZEP8pp5ESMSpVk pPYPwWHo2YAFsNUOic3xV4XrFCbo84QUhGInsdbMnqStuoqnyte3Br6tFLYv1C/EOWAG PKZ0XsrNhJWyNODhzL3h1Kao8QKlCFpkDbu4aNxFeBOWaPQRzho0DvkaFdWbAkPuiiQr a7hZ8gP9UXPixnLv9MWOOovsybFIuI62XeG+Bv909D3xuX+hzK0dE0YoboOR7OFrWbNZ /GJQ== X-Gm-Message-State: ACrzQf0d9E1UOORkXs1OBu+b/bi7GCfKhFqclDt2t5kchDJBF7Xg+yse C9bQUALLC0czJ1HXPg/Zp+nOkNicA8jAS9WL1kK1 X-Received: by 2002:a05:6808:144b:b0:350:a06a:f8cb with SMTP id x11-20020a056808144b00b00350a06af8cbmr5507250oiv.51.1664402599405; Wed, 28 Sep 2022 15:03:19 -0700 (PDT) MIME-Version: 1.0 References: <20220927225944.2254360-1-ankur.a.arora@oracle.com> <20220927225944.2254360-2-ankur.a.arora@oracle.com> In-Reply-To: <20220927225944.2254360-2-ankur.a.arora@oracle.com> From: Paul Moore Date: Wed, 28 Sep 2022 18:03:08 -0400 Message-ID: Subject: Re: [PATCH 1/3] audit: cache ctx->major in audit_filter_syscall() To: Ankur Arora Cc: linux-audit@redhat.com, eparis@redhat.com, linux-kernel@vger.kernel.org, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 On Tue, Sep 27, 2022 at 6:59 PM Ankur Arora wrote: > > ctx->major contains the current syscall number. This is, of course, a > constant for the duration of the syscall. Unfortunately, GCC's alias > analysis cannot prove that it is not modified via a pointer in the > audit_filter_syscall() loop, and so always loads it from memory. > > ... > > Signed-off-by: Ankur Arora > --- > kernel/auditsc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) This looks pretty trivial to me, but it's too late in the current -rc cycle for this to be merged, I'll queue it up for after the upcoming merge window closes. Thanks. > diff --git a/kernel/auditsc.c b/kernel/auditsc.c > index 79a5da1bc5bb..533b087c3c02 100644 > --- a/kernel/auditsc.c > +++ b/kernel/auditsc.c > @@ -843,13 +843,14 @@ static void audit_filter_syscall(struct task_struct *tsk, > { > struct audit_entry *e; > enum audit_state state; > + unsigned long major = ctx->major; > > if (auditd_test_task(tsk)) > return; > > rcu_read_lock(); > list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_EXIT], list) { > - if (audit_in_mask(&e->rule, ctx->major) && > + if (audit_in_mask(&e->rule, major) && > audit_filter_rules(tsk, &e->rule, ctx, NULL, > &state, false)) { > rcu_read_unlock(); > -- > 2.31.1 -- paul-moore.com