Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7260015imm; Tue, 28 Aug 2018 08:56:24 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYbTlnthEOwJJ4cbyzRYVXeZtcb7Z7YjevVCRuFq0D9NobU8dGripg+AXiNIhM2QTSUx8uB X-Received: by 2002:a63:2106:: with SMTP id h6-v6mr2090683pgh.161.1535471784418; Tue, 28 Aug 2018 08:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471784; cv=none; d=google.com; s=arc-20160816; b=LjMsazWSLj1fFQe7UEAA4heaAM+uF9wwXrbpblP/Wq3vVL+rAG1kSbELY/QsfIJUcM P4wsuk/ged5oIxuMozWcWhOzY1MwbPgD2CDLaHeef+mkpRvvnRD5NDQoaF0kQPfXjWFK TehOZLxdZheqAeCrobr+Uk5/Ui4OB+mTGpB0gAs+U9g+P8uaWFlYK//2XWBVIitT88Jp wnMpsAOvdvcbmTyYzDymGDqqweTaVhys43khEx2lDq9HMJunQSIKn34UDqUV0uqruYqx cer/SnQxeSpoUrFpBf9WCijkvo1qQQxNJGT9Cl0jkmEPlGE/x+h0mko5ASk6VdyCxUR/ dAlg== 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=WpFLbWIxfVa6Z5HIGshLf540b6u3JaBCURsmaW54RbQ=; b=TBfBYyu+QTvZ2f7X09M3bBz2oJdVWJwmOujjbEsHh5gwM9I9ESlx/LGINUE7C22KC8 47aW3pnd7h0Zw0QqYWcunib0RX3/6VMLVaDEiWMsfvvDqantQHzHFZ9lekD0jSX9bGD9 8Sh6DtUq39ZyZFaZ14lDAAIGs749FB2lWmkoyTtgpNWnLKFBUjTnc7W8eAdTwQnBwvfR fHd156Mu6w7hND1Yf0lE6U81BF2k0UZhT60Aaj29hoLv5SJlIj1RcVCAPhVsQkuT+CxT fSO5EYlM1pjSarApJt0fiIrinMuLlY20R4VkwZTdZaU9isKMT9z+LiSQ5INoYywZUO05 qUag== 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 u12-v6si1517288pgm.209.2018.08.28.08.56.09; Tue, 28 Aug 2018 08:56:24 -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 S1727466AbeH1ToU (ORCPT + 99 others); Tue, 28 Aug 2018 15:44:20 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40960 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1ToT (ORCPT ); Tue, 28 Aug 2018 15:44:19 -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 A6FDCED1; Tue, 28 Aug 2018 08:52:02 -0700 (PDT) Received: from e112298-lin.Emea.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 B01533F557; Tue, 28 Aug 2018 08:52:00 -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 v5 06/27] arm64: Delay daif masking for user return Date: Tue, 28 Aug 2018 16:51:16 +0100 Message-Id: <1535471497-38854-7-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1535471497-38854-1-git-send-email-julien.thierry@arm.com> References: <1535471497-38854-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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 09dbea22..85ce06ac 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -259,9 +259,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] @@ -896,7 +896,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