Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1428972pxy; Thu, 6 May 2021 07:50:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweBcnRE+7vo7kzVvU6vqFzXoVPhuP+2JeAsSMpgPCUkG1Oflh1EJmBp7SqATdifLEzuDmb X-Received: by 2002:a17:90b:19c9:: with SMTP id nm9mr4816513pjb.98.1620312637539; Thu, 06 May 2021 07:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620312637; cv=none; d=google.com; s=arc-20160816; b=f7Gp02+zlQYQbLiM/al1VjGDX++2j2G339D0vMLjDBiAy9ZN+Zkrm3kgeS0wMABNa+ 0bXV7gzDZBdj20DbdSrf00KLgwcCbsGCfSlDik/MjDQHVPYqRXagc4z4G1MWVkX+NSW/ wqXyZx4WVXJKPwWkpqrTEJ+ke3Jnkz3wrgmqW5VYw8d4YJ6c0DoN07qgG0+RA6r1/P+D HNQCSDzmWwGG1NJhSU4VR4Cb9hBiYX10Ra+P2NG2Xx+Pf+Sg/cQ1twu/G6agdN/wN2B7 DYlf5l1Co8QHujjAjOxen7X/gwEaK9YnKxZbNilBdGbdAXxo7uLL+kMKgkKVuc96/6pw GO5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:message-id; bh=IlkD4QG1WnEOQwNejxkLGD6wcEFFtc//ArQ9agRZ9t4=; b=dxwSzLfwhQr7qBmy32r7lNt1kz00LA1MzXPgMHdXqN7+0EH+SSgvod8ZGwosSAYWk8 zgO7GxpbKoLzT8LxY79gWQbBLtWQi0bqTAn0ffoXS2MXmaHcJeUkJv4iYOCZ31Bj6RvH rdbyH/ZZSH44ftuseztCcJdjlmrVr2lDDxhgRHql9Y97rRD+Mt+hGKD/kGCFvjFXyWR9 4NyOxcQFpx/k+8sR/27sLnvYo8Y1sBVGP+gY8cxZfgGIVWTAdQr8/9P3rTpyDh9mnahp aWeYN4iu61XekYOdDUAGtJghxs2gnOTTIYxUJ2QpnH9fL2/mkEcPXCGjtNVDlwkdZ0zU NZQA== ARC-Authentication-Results: i=1; mx.google.com; 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 k14si3270528pgc.557.2021.05.06.07.50.24; Thu, 06 May 2021 07:50:37 -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; 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 S234901AbhEFOur (ORCPT + 99 others); Thu, 6 May 2021 10:50:47 -0400 Received: from pegase2.c-s.fr ([93.17.235.10]:38523 "EHLO pegase2.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234759AbhEFOuq (ORCPT ); Thu, 6 May 2021 10:50:46 -0400 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4Fbc1Q1M4Hz9sYh; Thu, 6 May 2021 16:49:46 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L2QXxuYoNt71; Thu, 6 May 2021 16:49:46 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4Fbc1Q0Qq6z9sYZ; Thu, 6 May 2021 16:49:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id DEB468B802; Thu, 6 May 2021 16:49:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id rIf4-rmnMFKT; Thu, 6 May 2021 16:49:45 +0200 (CEST) Received: from po15610vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A4F328B800; Thu, 6 May 2021 16:49:45 +0200 (CEST) Received: by po15610vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 7B1D8648FD; Thu, 6 May 2021 14:49:45 +0000 (UTC) Message-Id: From: Christophe Leroy Subject: [PATCH] powerpc/interrupts: Fix kuep_unlock() call To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 6 May 2021 14:49:45 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Same as kuap_user_restore(), kuep_unlock() has to be called when really returning to user, that is in interrupt_exit_user_prepare(), not in interrupt_exit_prepare(). Fixes: b5efec00b671 ("powerpc/32s: Move KUEP locking/unlocking in C") Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/interrupt.h | 2 -- arch/powerpc/kernel/interrupt.c | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h index 44cde2e129b8..c77e8f57ff06 100644 --- a/arch/powerpc/include/asm/interrupt.h +++ b/arch/powerpc/include/asm/interrupt.h @@ -153,8 +153,6 @@ static inline void interrupt_enter_prepare(struct pt_regs *regs, struct interrup */ static inline void interrupt_exit_prepare(struct pt_regs *regs, struct interrupt_state *state) { - if (user_mode(regs)) - kuep_unlock(); } static inline void interrupt_async_enter_prepare(struct pt_regs *regs, struct interrupt_state *state) diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c index 30a596182baa..e0938ba298f2 100644 --- a/arch/powerpc/kernel/interrupt.c +++ b/arch/powerpc/kernel/interrupt.c @@ -424,6 +424,7 @@ notrace unsigned long interrupt_exit_user_prepare(struct pt_regs *regs, unsigned /* Restore user access locks last */ kuap_user_restore(regs); + kuep_unlock(); return ret; } -- 2.25.0