Received: by 10.192.165.148 with SMTP id m20csp764646imm; Fri, 27 Apr 2018 07:10:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpQQgIILQwVCL1EwATbzrflT1079mgDlHF2wiIQEiSXxHennyeCqjH4K3JuPG3jX1fvK+Mv X-Received: by 10.167.128.141 with SMTP id v13mr2340631pff.147.1524838257475; Fri, 27 Apr 2018 07:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524838257; cv=none; d=google.com; s=arc-20160816; b=wXdWTW5j/yq3dFkQ+W3/IOnDpz//9dshAfs3aajLbZOz/KKxYvQpQwyCXLT2mS3NKP /13CbPxvOl2lDhgxcHJSFRUKiFjMcEHvXLgsc95m/vbCaE2s6BQCGbeFfyQNFpcTG+eh zZd+yMPHJBSFYmbgfpvtKUNWfWcweZ5sbnfvhEM0kNPREiOMcixnxdzUJOCNqit0Ji2+ 4tYubagkIPsvnMufOAPNXWeVnw0fl/dazzbGru5CMXKj1uFml7GHlGcJ+1ibkIRSgBwk NmsKii1iWp/upAFrOiSPnYpvQDsvij1WWR6rLfkmPMMNB9i5Djv08hoj3IH1Gy2bu+Qe iYnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=sqdPkHjq1KGTd79Uo1nTDYG4fB6tq5qPqfF/7PiNAeI=; b=YfNGwUOSV1721kjMxlJoK6iV6wZcsIVm0DpGF4HXTimeOG4ZtQPVROPETq8C+Oo1Ih U0e42Y+AEPq6HASNvC1v0JNk8PG+cv14bO3QMXbJA3t+y7Z38zLOrgGR8oqT9Oei05Nw S4SQItdrnn0K50pCKZCuCvXJ93UhMBhCnHG9arhiIqRaQaVWuTx+cZDhs+mywJ6uYllC LzEEpFlmcf19xc8bg8NLb12T4nMgzCSNf9Gc3PZ3x3bXAyclVHEpNAm1x39glbjaKC1f HHW0eHiSU+0e8L2+aSq4W4dgPPWQX17kfQ/NTtmXy5PCYxolZkxvWZdiE3gBynXzDSDt BInw== 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 m68si1344707pfm.0.2018.04.27.07.10.43; Fri, 27 Apr 2018 07:10:57 -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 S934437AbeD0OIK (ORCPT + 99 others); Fri, 27 Apr 2018 10:08:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:53740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934424AbeD0OIE (ORCPT ); Fri, 27 Apr 2018 10:08:04 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 CBD5D21864; Fri, 27 Apr 2018 14:08:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBD5D21864 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Schwidefsky , Farhan Ali , Christian Borntraeger Subject: [PATCH 4.14 54/80] s390/entry.S: fix spurious zeroing of r0 Date: Fri, 27 Apr 2018 15:58:47 +0200 Message-Id: <20180427135735.675188624@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135732.928644313@linuxfoundation.org> References: <20180427135732.928644313@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martin Schwidefsky From: Christian Borntraeger [ Upstream commit d3f468963cd6fd6d2aa5e26aed8b24232096d0e1 ] when a system call is interrupted we might call the critical section cleanup handler that re-does some of the operations. When we are between .Lsysc_vtime and .Lsysc_do_svc we might also redo the saving of the problem state registers r0-r7: .Lcleanup_system_call: [...] 0: # update accounting time stamp mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER # set up saved register r11 lg %r15,__LC_KERNEL_STACK la %r9,STACK_FRAME_OVERHEAD(%r15) stg %r9,24(%r11) # r11 pt_regs pointer # fill pt_regs mvc __PT_R8(64,%r9),__LC_SAVE_AREA_SYNC ---> stmg %r0,%r7,__PT_R0(%r9) The problem is now, that we might have already zeroed out r0. The fix is to move the zeroing of r0 after sysc_do_svc. Reported-by: Farhan Ali Fixes: 7041d28115e91 ("s390: scrub registers on kernel entry and KVM exit") Signed-off-by: Christian Borntraeger Signed-off-by: Martin Schwidefsky Signed-off-by: Martin Schwidefsky Signed-off-by: Martin Schwidefsky Signed-off-by: Greg Kroah-Hartman --- arch/s390/kernel/entry.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S @@ -426,13 +426,13 @@ ENTRY(system_call) UPDATE_VTIME %r8,%r9,__LC_SYNC_ENTER_TIMER BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP stmg %r0,%r7,__PT_R0(%r11) - # clear user controlled register to prevent speculative use - xgr %r0,%r0 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC mvc __PT_PSW(16,%r11),__LC_SVC_OLD_PSW mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC stg %r14,__PT_FLAGS(%r11) .Lsysc_do_svc: + # clear user controlled register to prevent speculative use + xgr %r0,%r0 # load address of system call table lg %r10,__THREAD_sysc_table(%r13,%r12) llgh %r8,__PT_INT_CODE+2(%r11)