Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp669332ybg; Mon, 1 Jun 2020 11:14:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwy++QwsOoDAUr26Qx97jrp7Aw+/SxXQxPBUKXHCvBrhwZZlwuwEU4KO1XpwgvXx/Lch+X X-Received: by 2002:a17:906:1513:: with SMTP id b19mr18764757ejd.1.1591035240686; Mon, 01 Jun 2020 11:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591035240; cv=none; d=google.com; s=arc-20160816; b=tu3Owg3s5rltXEIsq2LdmyVOpV6Ttd9cUwpmFwcA5y9FUM+2mOvPaFo6z29ojHyxiw 7FIPvVvd4iAEjpVGn6qwIpSWmZ4hmUNHGYh4eFPseDqEIPMeTS+xCQ7z7Ua7xU258iOu lYrECG1LpZuiQNeiMiuhjqdxniY2DZiRhm6q/RXla2FEds1ogkUwB/uMog3EY2TQACVY Xn7OMbUI+3c3OQFZsOH+74lmh1KkO1Ghfx66l+xNlEw03ebkz3g0PFdP6PqQ0sfYKXgO aO+uhLvkcZ1yVSaX+CYPR+/vVJkd1FauKBouRlv6Gsk85h6wkDXIruOrrvJgIdZB7kZa QFyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PHgH+YegtSQXUwgHs7WhZEVrSs7psb0jF9WMXzAINhQ=; b=Db4hSzRqqgpp64Iq2UWPPYRx/zoZaKoJhV6BSo+hqbF6R2hsndr+YlWcK/8VFtg9a7 wS7XO6jNfUPapcQdm9KnCK6VQnXS3J16mSVFBWWCyoypwMor/PVhwTccCujcRwj1dNhc BiS+j6UDGl8R+eUIl+i3W+QrFKg1+eFJG2boUmdR82eHlOToSBsmsEeoy0Y+4jOvEI7f l1GhCohGmMkWrUg2uvFK+MxEMm+THKAFGCU+v/Sin4dbP2nrm8chWwpGX6smzRYI6Ta5 qUfVOzaDPvXCKkFykVf9EHf8azYKewQBkzjAPAHkWiXqpQ50O/0KEuSvt25cEf91F8XS fVDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BvT+uvH0; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rk18si111120ejb.715.2020.06.01.11.13.36; Mon, 01 Jun 2020 11:14:00 -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=@kernel.org header.s=default header.b=BvT+uvH0; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730763AbgFASIn (ORCPT + 99 others); Mon, 1 Jun 2020 14:08:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:54900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730023AbgFASIm (ORCPT ); Mon, 1 Jun 2020 14:08:42 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3CF582068D; Mon, 1 Jun 2020 18:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591034921; bh=4MGp3GhSPRW69gWgo1kGqYevai5ODOUvvSzkzf6cRa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BvT+uvH0sU7CP6T+oOTULhSDiHYk+AAEN5eHkPpb3cTyQU+KKUViMulVKqQjpgu+Z oa58k4tEuCC0wJqAE+pJW6xQQki5AjnOuAYx3gPA/GJNyrKDSZ0NEnnLHCwLJIHLzy MJi5oUpG18IX/dhEzc6oA4u0v7T4YCb1d+f9UIF8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Sasha Levin Subject: [PATCH 5.4 073/142] ARM: uaccess: integrate uaccess_save and uaccess_restore Date: Mon, 1 Jun 2020 19:53:51 +0200 Message-Id: <20200601174045.365951621@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174037.904070960@linuxfoundation.org> References: <20200601174037.904070960@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Russell King [ Upstream commit 8ede890b0bcebe8c760aacfe20e934d98c3dc6aa ] Integrate uaccess_save / uaccess_restore macros into the new uaccess_entry / uaccess_exit macros respectively. Signed-off-by: Russell King Signed-off-by: Sasha Levin --- arch/arm/include/asm/uaccess-asm.h | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/arch/arm/include/asm/uaccess-asm.h b/arch/arm/include/asm/uaccess-asm.h index d475e3e8145d..e46468b91eaa 100644 --- a/arch/arm/include/asm/uaccess-asm.h +++ b/arch/arm/include/asm/uaccess-asm.h @@ -67,30 +67,23 @@ #endif .endm - .macro uaccess_save, tmp #ifdef CONFIG_CPU_SW_DOMAIN_PAN - mrc p15, 0, \tmp, c3, c0, 0 - str \tmp, [sp, #SVC_DACR] -#endif - .endm - - .macro uaccess_restore -#ifdef CONFIG_CPU_SW_DOMAIN_PAN - ldr r0, [sp, #SVC_DACR] - mcr p15, 0, r0, c3, c0, 0 +#define DACR(x...) x +#else +#define DACR(x...) #endif - .endm /* * Save the address limit on entry to a privileged exception and * if using PAN, save and disable usermode access. */ .macro uaccess_entry, tsk, tmp0, tmp1, tmp2, disable - ldr \tmp0, [\tsk, #TI_ADDR_LIMIT] - mov \tmp1, #TASK_SIZE - str \tmp1, [\tsk, #TI_ADDR_LIMIT] - str \tmp0, [sp, #SVC_ADDR_LIMIT] - uaccess_save \tmp0 + ldr \tmp1, [\tsk, #TI_ADDR_LIMIT] + mov \tmp2, #TASK_SIZE + str \tmp2, [\tsk, #TI_ADDR_LIMIT] + DACR( mrc p15, 0, \tmp0, c3, c0, 0) + DACR( str \tmp0, [sp, #SVC_DACR]) + str \tmp1, [sp, #SVC_ADDR_LIMIT] .if \disable uaccess_disable \tmp0 .endif @@ -99,8 +92,11 @@ /* Restore the user access state previously saved by uaccess_entry */ .macro uaccess_exit, tsk, tmp0, tmp1 ldr \tmp1, [sp, #SVC_ADDR_LIMIT] - uaccess_restore + DACR( ldr \tmp0, [sp, #SVC_DACR]) str \tmp1, [\tsk, #TI_ADDR_LIMIT] + DACR( mcr p15, 0, \tmp0, c3, c0, 0) .endm +#undef DACR + #endif /* __ASM_UACCESS_ASM_H__ */ -- 2.25.1