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=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 915A0C4361B for ; Thu, 17 Dec 2020 17:59:18 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 224B52376F for ; Thu, 17 Dec 2020 17:59:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 224B52376F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Xo2/8whWVV8bLtKGl2s+kTzoU05eWY8MdOgDfi8uDmM=; b=iGY45gzld8OJ8rE/Z4TRnHzkD hf2M/6UUBUzdpC4NBbhqFECSy59Db+yD+qxNxe9QkG+fQ40yrinsQBcMJlluH9IDl7vNMV8Gciv/J Mog+Y1f78NmI4RPPlQGlCDNL3H0cY25kA28vQJoK00FFOkTbZm7ox4fCEc1UDMiUtlJpilMqHPMMb uB1r1FIXW6t15l33yWo3c795xkVvUDwea9o42ECAYFEvy5BcXbl9NoKJGucTH/CKYZpD2XFJ5ScXP zUV4ArSo2RV2GHFYJ86PKwuz6DV8NIXEc9Jgaz090bM/fcX5UAYKucZ+tnz/7ObhBevfdWU7SjVo2 LjYdH4wAA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpxX9-0002t8-04; Thu, 17 Dec 2020 17:57:47 +0000 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpxX6-0002sK-FQ for linux-arm-kernel@lists.infradead.org; Thu, 17 Dec 2020 17:57:45 +0000 Received: by mail-oi1-x229.google.com with SMTP id x13so24158446oic.5 for ; Thu, 17 Dec 2020 09:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DjTuA632ofzNzo2pzfs4H3wnIy1xFkRiTbi6YNXD6h0=; b=UzUwbuCEcm00mgTU9bKSgnvadKieeeno8oVqNtXCRLiZUrqZZO+WYf9c/2+gdxaZ9P EudvLqZwl88kxn23klupTAMxWtQwwWFk9xm6E5PVPVmXuT6NBDSDxO42zH9TPSX38wJN +D324GPb5EFkeO4bZA5FDuSvIrUMR9rr9eojI+2Av0Mg7koyVGjclaqQuzM7pxV/w8MQ 9FiUfmsdcKsWkCHtrJ/XlFHejzXIHC92M8TEvy0nWRiqgr/db8bgWmXQABujHplSRrDn c8nuT2D0zdBC0556JHbE6QXPIvCOtoMQS5j9uQTCxs3ognHydnugW3vLiGT+w96ml/vZ /AXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=DjTuA632ofzNzo2pzfs4H3wnIy1xFkRiTbi6YNXD6h0=; b=Tx5bpQhErNu7x9BFDJOXc3pyp0WGv2wDH47tkHSFAHV3NUlcNoSM7MnpgxDj3JXofb 962ecS/g2QBPgAcjdNDUAQX9Xz7UrvrEc0sWpVR8Ylt1AvoSV4wh0fegwzdMyq47aGJo H4rQuSDBm10OTfl1vROdrsFq7ijMY/iz4Y+Gd4KlhLGJoTIuqtKsaH4M5ryfH7ua6Z3B MCfzH1WRK5MLx5TsRrx8FPWWg/tcEdH8hAEHbXQjxqVEO1wULrdRWz1t7G+mX2TClyOl Hsyhktig1yHkB9zPaqaI4xXTPh4ad8vUkp/hG3KNBez7QSc93mBhzE01A9pL+/wurDvc JCvw== X-Gm-Message-State: AOAM530Lz8gVro/GRzu91BIEwcHw0Rc8jydG2CUQCl8ejoR8ffZFo+Un 3cU6lCFMu5KhCMJytFPQYbY= X-Google-Smtp-Source: ABdhPJw9t8eka8faDVJY2AEfUqD9KGO1rJCUWZ5AV8/YFxReWfvFhYwEmKU4spdv0dBqnJLvxvV51Q== X-Received: by 2002:aca:44d:: with SMTP id 74mr242190oie.4.1608227862406; Thu, 17 Dec 2020 09:57:42 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id 65sm1341781otp.35.2020.12.17.09.57.41 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Dec 2020 09:57:41 -0800 (PST) Date: Thu, 17 Dec 2020 09:57:40 -0800 From: Guenter Roeck To: Mark Rutland Subject: Re: [PATCHv2 05/11] arm64: entry: prepare ret_to_user for function call Message-ID: <20201217175740.GA90220@roeck-us.net> References: <20201130115950.22492-1-mark.rutland@arm.com> <20201130115950.22492-6-mark.rutland@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201130115950.22492-6-mark.rutland@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201217_125744_524560_A59EC8BC X-CRM114-Status: GOOD ( 23.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: elver@google.com, paulmck@kernel.org, peterz@infradead.org, catalin.marinas@arm.com, james.morse@arm.com, dvyukov@google.com, will@kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On Mon, Nov 30, 2020 at 11:59:44AM +0000, Mark Rutland wrote: > In a subsequent patch ret_to_user will need to make a C function call > (in some configurations) which may clobber x0-x18 at the start of the > finish_ret_to_user block, before enable_step_tsk consumes the flags > loaded into x1. > > In preparation for this, let's load the flags into x19, which is > preserved across C function calls. This avoids a redundant reload of the > flags and ensures we operate on a consistent shapshot regardless. > > There should be no functional change as a result of this patch. At this > point of the entry/exit paths we only need to preserve x28 (tsk) and the > sp, and x19 is free for this use. > > Signed-off-by: Mark Rutland > Cc: Catalin Marinas > Cc: James Morse > Cc: Will Deacon This patch results in: arch/arm64/kernel/entry.S: Assembler messages: arch/arm64/kernel/entry.S:774: Error: immediate out of range at operand 3 -- `and x2,x19,#((1<<1)|(1<<0)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<7))' This is with gcc 9.3.0 and binutils 2.34. Do I need a special compiler and/or binutils version to make it compile ? Thanks, Guenter > --- > arch/arm64/kernel/entry.S | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > index b295fb912b12..84aec600eeed 100644 > --- a/arch/arm64/kernel/entry.S > +++ b/arch/arm64/kernel/entry.S > @@ -774,13 +774,13 @@ SYM_CODE_END(el0_error) > SYM_CODE_START_LOCAL(ret_to_user) > disable_daif > gic_prio_kentry_setup tmp=x3 > - ldr x1, [tsk, #TSK_TI_FLAGS] > - and x2, x1, #_TIF_WORK_MASK > + ldr x19, [tsk, #TSK_TI_FLAGS] > + and x2, x19, #_TIF_WORK_MASK > cbnz x2, work_pending > finish_ret_to_user: > /* Ignore asynchronous tag check faults in the uaccess routines */ > clear_mte_async_tcf > - enable_step_tsk x1, x2 > + enable_step_tsk x19, x2 > #ifdef CONFIG_GCC_PLUGIN_STACKLEAK > bl stackleak_erase > #endif > @@ -791,11 +791,12 @@ finish_ret_to_user: > */ > work_pending: > mov x0, sp // 'regs' > + mov x1, x19 > bl do_notify_resume > #ifdef CONFIG_TRACE_IRQFLAGS > bl trace_hardirqs_on // enabled while in userspace > #endif > - ldr x1, [tsk, #TSK_TI_FLAGS] // re-check for single-step > + ldr x19, [tsk, #TSK_TI_FLAGS] // re-check for single-step > b finish_ret_to_user > SYM_CODE_END(ret_to_user) > > -- > 2.11.0 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel