Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3057197rwe; Mon, 29 Aug 2022 05:15:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR6DwI4WJ7hRY+qG23VR+T/4Re/ezWRRB8Ry/sMViOy2vF9m15oeBraUJiYk3UBAW8IxSx3A X-Received: by 2002:a17:902:e80c:b0:174:e386:c5b7 with SMTP id u12-20020a170902e80c00b00174e386c5b7mr2620467plg.84.1661775324166; Mon, 29 Aug 2022 05:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661775324; cv=none; d=google.com; s=arc-20160816; b=yzmQ8K5JklzmTeKVIdqM9j6XkHsKHLkIfg4k8nt1JyTxYeudIp87ZCzQmmzZargVUI Xa63BEV5o0z13MF1nTOn1o3ygIrcq7cg9/ie1uNP06gPt96b2x/WpsKB9r2rvLesN/r+ nAL3+bjh3Acj4cUGGEJBX1O0wPXXell56bZHvnOZ7YaWmvd4le0Pe0A7bHABKeJtVHMb JMv6GyOqx6AM8e3yadzpHaAcKP5v00mkQRnk8OVbjRYi3Q77939XxgAbpPx1bi9lVcyr DErtjN+/aK6irO5vdUV0ssDE5mAmISXhjgqjlMfDdEtFvZIEkF5MpgKljHZuziiWE2IN 2Fhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aYM9UA2vgMUdZ2Z01XjYrxMwAmp5PXMPvpO0CL8X0Lo=; b=1EOEd2scciN54xwKwb/RWhx0+rXZVcPxpRzDyO2SvgkhOFVgOmPiaV7aQU0XMyo8RU zy2vEn7jRYp643JIpMZsoGG+tsAjLfw2+HK7uJHW6wZ7gsKSe2mRknf2Q/ANr8z3WPvE N/pkXft7+ssRg+9WHxhHiicDOhZcfJh2NdXhksvZxs5hA6/VdTSnPnjDWAtlaOO0CWR7 Lxwl2IJFT9nTcuu3+0Gc8bFhVWZWjm3FtOdMBNUpmUzw+0guGwCUB53E/Kdac5lSxuCS QdBSAKGYynJyxSmu6xramxlhr6Aj3LTSKPvbyCikVyJe6VsY+3U4D+NXJkh0didqhnJm hdVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N+YdrDVJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l2-20020a17090aaa8200b001efc839b577si8278294pjq.45.2022.08.29.05.15.11; Mon, 29 Aug 2022 05:15:24 -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=@linuxfoundation.org header.s=korg header.b=N+YdrDVJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231580AbiH2Lqy (ORCPT + 99 others); Mon, 29 Aug 2022 07:46:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232803AbiH2Lqb (ORCPT ); Mon, 29 Aug 2022 07:46:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D3D255A7; Mon, 29 Aug 2022 04:29:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8747C6124C; Mon, 29 Aug 2022 11:17:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90ACBC433B5; Mon, 29 Aug 2022 11:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771836; bh=3ZJ55aFjljXhDNzP5PC35zGb7thw45TdC+48KtP1bZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+YdrDVJZ/FQL2QtGzZfMpTUPf2QQmhExb+LbU6s4GVTDIFnq60et9YFLo61WU8lv yi0CdqwTiGml7LSZCRtnnE1Zak6Nj0mGWnKm+PCX8hS5/xcDjq3+hSDhZSbX0+PuXF mtg5iQ5VdFAUyijoAI0oaOgw/c8KVEhdxGj/5LJk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Guy Briggs , Paul Moore Subject: [PATCH 5.19 112/158] audit: move audit_return_fixup before the filters Date: Mon, 29 Aug 2022 12:59:22 +0200 Message-Id: <20220829105813.797371125@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105808.828227973@linuxfoundation.org> References: <20220829105808.828227973@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Richard Guy Briggs commit d4fefa4801a1c2f9c0c7a48fbb0fdf384e89a4ab upstream. The success and return_code are needed by the filters. Move audit_return_fixup() before the filters. This was causing syscall auditing events to be missed. Link: https://github.com/linux-audit/audit-kernel/issues/138 Cc: stable@vger.kernel.org Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling contexts beyond syscalls") Signed-off-by: Richard Guy Briggs [PM: manual merge required] Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman --- kernel/auditsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -1965,6 +1965,7 @@ void __audit_uring_exit(int success, lon goto out; } + audit_return_fixup(ctx, success, code); if (ctx->context == AUDIT_CTX_SYSCALL) { /* * NOTE: See the note in __audit_uring_entry() about the case @@ -2006,7 +2007,6 @@ void __audit_uring_exit(int success, lon audit_filter_inodes(current, ctx); if (ctx->current_state != AUDIT_STATE_RECORD) goto out; - audit_return_fixup(ctx, success, code); audit_log_exit(); out: @@ -2090,13 +2090,13 @@ void __audit_syscall_exit(int success, l if (!list_empty(&context->killed_trees)) audit_kill_trees(context); + audit_return_fixup(context, success, return_code); /* run through both filters to ensure we set the filterkey properly */ audit_filter_syscall(current, context); audit_filter_inodes(current, context); if (context->current_state < AUDIT_STATE_RECORD) goto out; - audit_return_fixup(context, success, return_code); audit_log_exit(); out: