Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3276817imm; Fri, 25 May 2018 02:56:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoot+WMRCBvoWdxF7g/74RtHE3xlAI0zcY5dDKPwnvGOUhBoR3X175m8m5CJ5lQO1BXzvr5 X-Received: by 2002:a62:6642:: with SMTP id a63-v6mr1849556pfc.162.1527242193795; Fri, 25 May 2018 02:56:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527242193; cv=none; d=google.com; s=arc-20160816; b=Dkw/2Y6/9D3s1ybt6OWeIffkxWvMWpC8HeKBN6yCjt6nB82uMBKKk6FG9alPCGnIu1 MsitFsnD5NqsE8sNFDsR3BfhU/RhCRZdvQfbiaxYYLyz9YT/xUwCljBnGM05rd517dUH OQU4bFtiFN0E5V+6hsaOI2ltXxbrY0OwpgbmV3nt9mQUhCqytFn4tMP7Ig6rH9z/9RaK nBFWmFNLJU047NKas/tVaL7831vyWaJzRfTUlYH96fyhSzauyS5sDbhTCDps9YbF5JWm SYZLU1x6Kw6VN82cCXXDg+/w7AbSaUGLhV6tVq7zYR5KcTfqCaHOQR/vHCGBRHIkKZN7 z+vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=5p+a7Rlntoecc7A+PiRKnF3svOuuomTBdcm1Xcf2qNg=; b=SOVuWkk8jhEtCeq+prg0AdsnmkI+uoxO/FGavGnloPAaiww205gWg9/JPHDhTuXumr 5GepDOwlphQ/5+kTh95irbzE3KDqoSRAalhpcCmIN3VawRwDkyyNhmSZ26J3XDBVpD3/ gfHfAQBE3ir4TLqmPhhzfVW/rkmAYIue73/v+Nqd0Z1q7wvKFGp2Aq7b+/SWht1rscfG X2+EHMKWkJj+3hxQkm9p2/emOoBoRpjuMSEhNPO24A00f6BUVx2Saw0eA9A2MqUo8f5z lzt+bWTw8269hCEf7xeHooc7IY1/ZAaxoGM1HIftWw1LocAeWHqLmwh3neVLJ5LGIMEV BLSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b190-v6si18661511pgc.18.2018.05.25.02.56.18; Fri, 25 May 2018 02:56:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966018AbeEYJuW (ORCPT + 99 others); Fri, 25 May 2018 05:50:22 -0400 Received: from foss.arm.com ([217.140.101.70]:57502 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965485AbeEYJuU (ORCPT ); Fri, 25 May 2018 05:50:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2A417174E; Fri, 25 May 2018 02:50:20 -0700 (PDT) Received: from e112298-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 205C13F25D; Fri, 25 May 2018 02:50:17 -0700 (PDT) From: Julien Thierry To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, daniel.thompson@linaro.org, joel@joelfernandes.org, marc.zyngier@arm.com, mark.rutland@arm.com, christoffer.dall@arm.com, james.morse@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Julien Thierry Subject: [PATCH v4 10/26] arm64: Delay daif masking for user return Date: Fri, 25 May 2018 10:49:16 +0100 Message-Id: <1527241772-48007-11-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527241772-48007-1-git-send-email-julien.thierry@arm.com> References: <1527241772-48007-1-git-send-email-julien.thierry@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Masking daif flags is done very early before returning to EL0. Only toggle the interrupt masking while in the vector entry and mask daif once in kernel_exit. Signed-off-by: Julien Thierry Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: James Morse --- arch/arm64/kernel/entry.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index ec2ee72..20252d5 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -240,9 +240,9 @@ alternative_else_nop_endif .endm .macro kernel_exit, el - .if \el != 0 disable_daif + .if \el != 0 /* Restore the task's original addr_limit. */ ldr x20, [sp, #S_ORIG_ADDR_LIMIT] str x20, [tsk, #TSK_TI_ADDR_LIMIT] @@ -872,7 +872,7 @@ ENDPROC(el0_error) * and this includes saving x0 back into the kernel stack. */ ret_fast_syscall: - disable_daif + disable_irq // disable interrupts str x0, [sp, #S_X0] // returned x0 ldr x1, [tsk, #TSK_TI_FLAGS] // re-check for syscall tracing and x2, x1, #_TIF_SYSCALL_WORK @@ -882,7 +882,7 @@ ret_fast_syscall: enable_step_tsk x1, x2 kernel_exit 0 ret_fast_syscall_trace: - enable_daif + enable_irq // enable interrupts b __sys_trace_return_skipped // we already saved x0 /* @@ -900,7 +900,7 @@ work_pending: * "slow" syscall return path. */ ret_to_user: - disable_daif + disable_irq // disable interrupts ldr x1, [tsk, #TSK_TI_FLAGS] and x2, x1, #_TIF_WORK_MASK cbnz x2, work_pending -- 1.9.1