From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99BF3C433ED for ; Fri, 16 Apr 2021 12:09:20 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E3482610FA for ; Fri, 16 Apr 2021 12:09:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3482610FA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=windriver.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=linux-audit-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-37-oWhfeFyDPiiKwGGt8eYnRw-1; Fri, 16 Apr 2021 08:09:17 -0400 X-MC-Unique: oWhfeFyDPiiKwGGt8eYnRw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 61179189C446; Fri, 16 Apr 2021 12:09:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A7D35D9E3; Fri, 16 Apr 2021 12:09:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2904A65D09; Fri, 16 Apr 2021 12:09:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13G7u7cl025148 for ; Fri, 16 Apr 2021 03:56:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id CDFA6112D43B; Fri, 16 Apr 2021 07:56:07 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C76C9112D436 for ; Fri, 16 Apr 2021 07:56:04 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AB51B185A79C for ; Fri, 16 Apr 2021 07:56:04 +0000 (UTC) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2067.outbound.protection.outlook.com [40.107.100.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-446-BFPzz-eEOO2Xr6dtXAwVsg-1; Fri, 16 Apr 2021 03:56:02 -0400 X-MC-Unique: BFPzz-eEOO2Xr6dtXAwVsg-1 Received: from MWHPR1101MB2351.namprd11.prod.outlook.com (2603:10b6:300:74::18) by MW3PR11MB4763.namprd11.prod.outlook.com (2603:10b6:303:2c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.18; Fri, 16 Apr 2021 07:56:01 +0000 Received: from MWHPR1101MB2351.namprd11.prod.outlook.com ([fe80::c156:455d:860e:ba87]) by MWHPR1101MB2351.namprd11.prod.outlook.com ([fe80::c156:455d:860e:ba87%4]) with mapi id 15.20.4042.018; Fri, 16 Apr 2021 07:56:01 +0000 From: He Zhe To: oleg@redhat.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, paul@paul-moore.com, eparis@redhat.com, linux-audit@redhat.com, linux-kernel@vger.kernel.org, zhe.he@windriver.com Subject: [PATCH 3/3] audit: Use syscall_get_return_value to get syscall return code in audit_syscall_exit Date: Fri, 16 Apr 2021 15:55:33 +0800 Message-Id: <20210416075533.7720-3-zhe.he@windriver.com> In-Reply-To: <20210416075533.7720-1-zhe.he@windriver.com> References: <20210416075533.7720-1-zhe.he@windriver.com> X-Originating-IP: [60.247.85.82] X-ClientProxiedBy: HK2PR04CA0064.apcprd04.prod.outlook.com (2603:1096:202:14::32) To MWHPR1101MB2351.namprd11.prod.outlook.com (2603:10b6:300:74::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pek-lpg-core2.corp.ad.wrs.com (60.247.85.82) by HK2PR04CA0064.apcprd04.prod.outlook.com (2603:1096:202:14::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Fri, 16 Apr 2021 07:55:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: edb0476c-83c6-4d1a-0610-08d900ad1382 X-MS-TrafficTypeDiagnostic: MW3PR11MB4763: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: sV5crO9FTR06zECdFeRSLT4aHABBssOEiAuVNxHLc7WX8lGX7rJAog+nrIXPncrmf8ZosxUJ0LoAsTvFnfGb57JGb1jbHbkehDt0izkCrXRrhMKdPibZygGMegmATGJsHfQ/IWU9qb2d+oHrk38FoRHz7XAAJRmdZQFg82tER06F4zl4mKgeiPLR8WkyU7jM9+H5Nq/qdoI/VVxjkRqldDZu/yxpZOixiP5giAQBNlAMWtzjXfpx9qlhEdC139+HQxnxpeH5xYisMAJK7AmhpMWNJq/A8HzY76RYUz67SwKv+W6JOn1CCIywZqHAiy9Q/x80M+Sw9q9jmt1cpHxsOJGHTsLcAJpYaNWZVqGFa8cRAIug+yREMW1JGevjFDm/r8z/DzKH5Y1zqbGDBsv9K7qyP8jDLXEQ4yfMtaf9ZtABmm/4Zgf9V9V5oh3PTzuZMyFVOBHKmtLl4RGpIUf1Q1b7LWYfidBnJa833Vw6oWnmK4ZZPmQ0+qIG6n902RoBABv3/zT5cmdzagraz5sAURNs7R8EvpYuMcj4MlPUtvvsN2qeYF/1INAo9Bu5bb8yTiP3nKeIdLqETja+ucGn3nx3f4NhRBC7onkaoeMknSL+9S8y/wkpnL85VT9VsgLLk/ns/3G2VI/OySOacPnoLg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1101MB2351.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(366004)(346002)(396003)(39850400004)(376002)(16526019)(8936002)(38100700002)(316002)(186003)(6512007)(6486002)(8676002)(66556008)(38350700002)(5660300002)(956004)(2616005)(26005)(1076003)(2906002)(6506007)(66946007)(66476007)(36756003)(478600001)(83380400001)(52116002)(86362001)(6666004); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?N02V4nSZszpMWwEcVGeiCzHvo/IOI1RQHBUo5NZ3UAiDCpNMzIq73Oi83eje?= =?us-ascii?Q?arE8OyYufe01xCW3/WEhKF5lM1+RGRpG+/Sa+fX/tmNazyilrynN2nDJfqC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HRfPm8hdoX/w/Zryon0VattWEg?= =?us-ascii?Q?3KmGNv5rzauugSphJlQPg8fFOP5KyktGtq5tZTffPVnf8TYWDZXvrsAosRDP?= =?us-ascii?Q?+sbLbGZtQG9wPQ3usEQYpEd/2KJ77jOOWaAK7dggIMN//RxLcIdS1d003WPx?= =?us-ascii?Q?GVtokrcEcova/YYkoKVWmxFTj1Q/LgZd1YubVLlU47/gWe5WV5ex+nN4mal5?= =?us-ascii?Q?zlMkpuWy7NxY9CDNxtrO3dglXR03hSbc7otKzlhPpqD53fRJj3bHHSZClUXJ?= =?us-ascii?Q?KIqwqV0DUOL1amXdRdFxwJW4LEHY7Y4CcdICKulNplSIQzn4hawXMD/oxIlW?= =?us-ascii?Q?q3EdQGB+TXR8y2i+9jOQNIIw?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: edb0476c-83c6-4d1a-0610-08d900ad1382 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1101MB2351.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Apr 2021 07:56:00.9285 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Y0WOdpcGQCz2rL3kor2VcmxYLODquTr7rzr2bftT5HO7GuTxNFM9oZO6H23hEcgziW4IrDU6II6v0JEXnb8H3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4763 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: linux-audit@redhat.com X-Mailman-Approved-At: Fri, 16 Apr 2021 08:09:01 -0400 X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=linux-audit-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit regs_return_value for some architectures like arm64 simply retrieve register value from pt_regs without sign extension in 32-bit compatible case and cause audit to have false syscall return code. For example, 32-bit -13 would be treated as 4294967283 below. type=SYSCALL msg=audit(1611110715.887:582): arch=40000028 syscall=322 success=yes exit=4294967283 We just added proper sign extension in syscall_get_return_value which should be used instead. Signed-off-by: He Zhe --- include/linux/audit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/audit.h b/include/linux/audit.h index 82b7c1116a85..135adbe22c19 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h @@ -334,7 +334,7 @@ static inline void audit_syscall_exit(void *pt_regs) { if (unlikely(audit_context())) { int success = is_syscall_success(pt_regs); - long return_code = regs_return_value(pt_regs); + long return_code = syscall_get_return_value(current, pt_regs); __audit_syscall_exit(success, return_code); } -- 2.17.1 -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit