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,URIBL_BLOCKED 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 84D02C433ED for ; Fri, 16 Apr 2021 12:09:27 +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 C3B85611AB for ; Fri, 16 Apr 2021 12:09:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3B85611AB 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-291-HwapXWqCMqefBNFfpPfUrA-1; Fri, 16 Apr 2021 08:09:08 -0400 X-MC-Unique: HwapXWqCMqefBNFfpPfUrA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E27CC189C451; Fri, 16 Apr 2021 12:09:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB2CB5C3DF; Fri, 16 Apr 2021 12:09:04 +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 4204A1806D0F; Fri, 16 Apr 2021 12:09:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13G7u3xK025141 for ; Fri, 16 Apr 2021 03:56:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5E84921111CD; Fri, 16 Apr 2021 07:56:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5891121111CA for ; Fri, 16 Apr 2021 07:56:03 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 4155A801E8D for ; Fri, 16 Apr 2021 07:56:03 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2070.outbound.protection.outlook.com [40.107.243.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-594-C4O0GBBaPYSIJLEf2s8vOQ-2; Fri, 16 Apr 2021 03:55:58 -0400 X-MC-Unique: C4O0GBBaPYSIJLEf2s8vOQ-2 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:55:57 +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:55:57 +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 2/3] arm64: syscall.h: Add sign extension handling in syscall_get_return_value for compat Date: Fri, 16 Apr 2021 15:55:32 +0800 Message-Id: <20210416075533.7720-2-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:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a9c2a640-e921-414a-7bf5-08d900ad1128 X-MS-TrafficTypeDiagnostic: MW3PR11MB4763: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: AG/CnU3+8juEWV6lQCKsNEnlDrVBNTjFXB+6rhN1EkJqgRWXTncGGAEPBbEfhe7Z5AX9CQCU8cyScESAzt0eqFogFiAGj1qxypXUGQl5+Z9iW2Q13Bm1dXGnR4YQkkVTvchPndKW+5gFy26LIDI88w+EprjIyDi/K1Dxp93VpJUpsGE/+i8lPvaZbmYMIGBeysYlK+9FdBXGDUFXr3EBRp6lZ5dPVijlEZP6hKDi/49ckSnfn4WyhuFd9Ken6WgUadwyKla1dpJrEx1CRPN9VM+lpuQFwRdpt3zCY2gxH/o+usqBeim7inhag2irqJVEYIPlJc8YxHVNrp1vZlA0kHQwJnQPvTXpTLh4m13CKL8kLvqOtOYlp8FjQCwYYmTnJhPhBWXGlGLYstfnqdmK7PpolVHYbkV4JYX62khTWBV4SwDHDxX3Oj2vYXRZ/TWKtKYBiRpJmZHUluioR5U+fy0tUB8bchP1VVFemyGdf9LhvY+OBeWULStw1JVmVW0PBYRhXJXsyN9Pq8rfFApRl6SiJbqzkjomu4W1/myfn514KsJ11xpL/M2oB2IGoAZ8pvl2YhfIJaAOQaaTrNWwfVNtJAtSieu92znuwOK77tRLhhic5VK2XGXMpdP3+XFu8jFk63U3QGNYk7STkv9xyg== 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)(4744005)(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?tOiPgk4zDxCwDQKgdtw+xrZ5TaGWRro1ojrXqpcnXdx7R5M9JWmMdfr4d++T?= =?us-ascii?Q?BrI7OjKvbyuSdL364moc9CQ58wYeF0uyEVZRChgecXSHHzDbQyVUFzSqM74l?= =?us-ascii?Q?+xSarRE+ygMlUA/VntWYAVRnEhhFU7pG9qWoLYknUE8N9bv+PX9quWrLxp65?= =?us-ascii?Q?kWVeDOVUDMpRBKHA2ITRJnsCYudJPQ2T6V323S5zlSBRyULGd9j7+M4mC1Q6?= =?us-ascii?Q?kpciISviiiF7Trdu89V+Nt7/6TA80pKeOEi83JxqIqpVmAavyhkzOggKdkfz?= =?us-ascii?Q?tY2Lc3amgSW+4yRzzkTwGRd0iXnK+s55L8jCc15NsocSaGpM7o++n/Ea33o4?= =?us-ascii?Q?8tf2N4e7qT7ZW+NBSGzXjcupyNbzyQ4G/kOUN/Wgj1+L76xkioHM3zvPOmyC?= =?us-ascii?Q?XbRQcpwbjogjKQdSDVE+zg/OaZsengQPWz5u+bAJv91ObjCrdSitrVxAlBDV?= =?us-ascii?Q?cgjRr29v7No4aFLQoYEp3V50smJN7uoZRZC184KglzRQNasiSbZD4tmpHo2g?= =?us-ascii?Q?0eapXywctb97k7qn/p0alDF574xoVN6sWBKwiu7MmjNHyjfokGts02IVJsfb?= =?us-ascii?Q?cv4FWD80UWHuK40KMfGuV2uYF/hGPMOMcytjPte0O20cdKvc0TRuJ6eALI+c?= =?us-ascii?Q?L+DUDyO0Nkl+mYTuL3VMiH95cNY/VjAQNtYzR63s73Jm2YEtsdCUsAFShFhH?= =?us-ascii?Q?OPFNrd2e9xLf3tFXhmxp8dM+JamNC2H0cAGPV/xocncSWkaZCwkC+s8mn2Zw?= =?us-ascii?Q?6Ue6H71WeM8D3jMht3mwwA1ubZ9qq/VRlvTfePQrQ38TZskjEl4lnNC9OYwM?= =?us-ascii?Q?aadr5lg2MBL987eghWaJP4dG/nn7InrdjGfT6TNC9qtcz2zDjAGCUAmRpE5C?= =?us-ascii?Q?+wYJxo/4bwJjBnzX2jpiYogNbDR7tqY+VClutKzeCpExAKw9fgaOK7MI0fiM?= =?us-ascii?Q?srbYhvPwGz9QBiJc9iEEPvMAEFQf1l6Znvee+xDEo7ZuGuuUQOgpYwtPk5dO?= =?us-ascii?Q?aT8yGfGcsZFFBN7MrWKTfmvR73d/iXYkKY0jfa4sk+PxkmLniKmYQGPMpLbH?= =?us-ascii?Q?p386vfMajoAkYvZA9h8hI+OUmtq8NMCpLDjccZS8Nwj920xu21mMRXHCs8h+?= =?us-ascii?Q?uaSOSQlDct4KhGT9vhKoP9V7qocvOmIqe569iCZ6TUwQ4h7egDaQT3Pr5ozQ?= =?us-ascii?Q?RfqYwRg1fY9pSLh8bQ/46Gukrbnt7XbG6zqr9LE1bRamzT4T9acWsC/59PKj?= =?us-ascii?Q?BTeJpAHhVCsomOML2UzbwQRZ9rGKx00Pby4hlJBBV3+ySWkV0LfiO4WVWNnM?= =?us-ascii?Q?Xmn+TVVQuooFLDYFdLbnINmA?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9c2a640-e921-414a-7bf5-08d900ad1128 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:55:57.2421 (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: Dupci3xkHR8tZtYMnVoIZLDgQxZT9rbLhz3bkYxXxMndrgEewpdqbIis5c7a0nMDquTF6ogaNPZtUTMowl+JCA== 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.4 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.16 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 Add sign extension handling in syscall_get_return_value so that it can handle 32-bit compatible case and can be used by for example audit, just like what syscall_get_error does. Signed-off-by: He Zhe --- arch/arm64/include/asm/syscall.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index cfc0672013f6..cd7a22787aeb 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -44,7 +44,12 @@ static inline long syscall_get_error(struct task_struct *task, static inline long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs) { - return regs->regs[0]; + long val = regs->regs[0]; + + if (is_compat_thread(task_thread_info(task))) + val = sign_extend64(val, 31); + + return val; } static inline void syscall_set_return_value(struct task_struct *task, -- 2.17.1 -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit