Received: by 10.192.165.148 with SMTP id m20csp832658imm; Fri, 27 Apr 2018 08:12:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpPnn6YUWGD0jTF03hZb2Lo2x9JuVihsCXggeHVXgq1GFjLcNVlge5PPN7yZxAP8/hK8Rww X-Received: by 10.98.87.84 with SMTP id l81mr2591631pfb.56.1524841973707; Fri, 27 Apr 2018 08:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524841973; cv=none; d=google.com; s=arc-20160816; b=F5zHEvBPaSvcE4J9YBcvQjVROxO32n0b26kAHYhQVYFb9GbSp1TyN3/ZQe+N+ttbuN Q8yMHmdOK/p9e1hftVJ6Mf+sInuh0WcnxTAOzgyrDesTCNWw/9giHe1hRiBsvo8a3sVB U9//cl+zHEzFe7eNJM66atKSkwKSqdDcRExW/1saOrokDJtDMSywwA/LXTRJlqrs3GO2 IpkrH0t0Cn02oxNl9E048ruIkpm9jzDEDHuhkqiJhgV9INSF3koDtbcqGlJF1uFkHzPd 3P0cMn2hiyj9taRtVb+5/ohKVFZwwnYIkrmQN2nGCyTyH9cLCZrBoJT2qL2EE1e/b1Yi 4n4w== 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=4f42l7bBK+po4LLPHUrlWUxqOCAtpc0IdmICZUXDSJc=; b=oDocGfXfYQyaSX1N8FylbZUjjW2Z/qVdgxqBUcZhMvq8RBNeTL/pTTWA3ZpPW9aSvO g4xGyQZUYUajnj6JskHjeQeciuzGmleVUmeTf/PZe6/ND9b/TgQBYHL9Mtmxo3VEjw3a 1tUYdZ/+vQViUFt4UcrH6/MEDQ7tzoMafP9olSAncnmRZK+076PD5uHvCTxUDB9ymiNx Byn3IAwEPKvFkEHQfWdqwFLwiJxBEr2N85/r6tdrInbEddCO5lEbHJUbyBquWOa7il6t fj1mrKtKHVrOXCcFo7woXodEF4XMNlHXh8cQXWJeRXGP9DyKuH1oTH/m7Di+wdQMQHTl km7A== 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 g8-v6si1336316plt.254.2018.04.27.08.12.39; Fri, 27 Apr 2018 08:12:53 -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 S933672AbeD0OEN (ORCPT + 99 others); Fri, 27 Apr 2018 10:04:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:50548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933596AbeD0OEL (ORCPT ); Fri, 27 Apr 2018 10:04:11 -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 239D92189D; Fri, 27 Apr 2018 14:04:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 239D92189D 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.9 40/74] s390/entry.S: fix spurious zeroing of r0 Date: Fri, 27 Apr 2018 15:58:30 +0200 Message-Id: <20180427135711.583204394@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135709.899303463@linuxfoundation.org> References: <20180427135709.899303463@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.9-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: 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 @@ -434,13 +434,13 @@ ENTRY(system_call) UPDATE_VTIME %r10,%r13,__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 lg %r10,__TI_sysc_table(%r12) # address of system call table llgh %r8,__PT_INT_CODE+2(%r11) slag %r8,%r8,2 # shift and test for svc 0