Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1594085pxb; Mon, 12 Apr 2021 01:45:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfLxJG7v+DPYU2BxGw7oMydqsdDR08mSQLpUB4fIKFQxrMNlKIZXV7s+mOF/zQTSQyGWld X-Received: by 2002:a17:90b:1904:: with SMTP id mp4mr22578137pjb.193.1618217148113; Mon, 12 Apr 2021 01:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618217148; cv=none; d=google.com; s=arc-20160816; b=rrm7WulffLKkUOF25F3L/z9HjS3Za7TPh9hX+uW3ZFj1iJm5Xl5SiY9GPLRxsxYxF3 KCcxq2XYbUzhdpSULOSX7n/QBRcr0lgdLiFeH2H3B6e2z1j0LyjYk7HsoVMzvhpO9pcn 5PNtITQKP223eGQ4CRWWgZhz02/1j0kV4U3wXEffUAi58oqASvdiIdKLWFv03LMt14RO BPz/Mj+ZGdA0zegX1A6n2IKtF1zLJ9IW3zc8GqrkDm0TT/hLCdahJki35r64Y3QC8d/H IpUcCaqrfgEi2tE+awvVqI0jcZwjuALRdw4tmiHoxcFUiLPqleON21b3HjP0X1B6LEXS sA2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sZeQbJE8LC/gSjNC6WmXa5sWld86si4zvX5Nghs7+Q8=; b=xFFuIx9kqpPII/xASszyAOKI9PW5KTE5TU3AtQJOvCdMJNf91WuBEO14bdWrghjY++ +dyK+0URY6NiLOfxuCih3FJTSSaqNaWKYgHtpPED5Js0ybUXTMmYcGUhEnOF3f4FiOgO Xz93/s8xWef58jHvqnBvVMjg59Xqy2fynXGUr01XPJ941bCEeRYI0hsEAcWPqEYo6293 iQnqZhIotCPHytMgak1OwQNzLu75s9mEGFyGIZSWHWO8loxvim9sIdHGDsIpSnjMmvI7 VS+U6Y1k6sSY6t4iP0LcuqYdxIM+yXCmGbPxEVVtZiWdVttASERiJJYf69OiwppLXFtk IyRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UsRCCArY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si12682828pgf.341.2021.04.12.01.45.35; Mon, 12 Apr 2021 01:45:48 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UsRCCArY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237043AbhDLIo4 (ORCPT + 99 others); Mon, 12 Apr 2021 04:44:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:36274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237638AbhDLIoO (ORCPT ); Mon, 12 Apr 2021 04:44:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C5BCE60241; Mon, 12 Apr 2021 08:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217037; bh=jnUE0CaMOYiyxx0A85k2dEb6Q3912c1bB9IlNE7W4bU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UsRCCArY3WWNBNP6ESjNLVQSzKxu9rX7ut4/Bday5zGVXQAgkpd1nN7FJx2+1/K8C ciCFzfTXrJo0CoXnssbhyX2GtbUtAue69aSjJxMRCmb3iqdDpQb1KR+Crof681Ftdv xy1WrnRcMnkFJRRhoBtI8de9SRdCF4oq39SkDkX4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Gordeev , Ilya Leoshkevich , Heiko Carstens , Sasha Levin Subject: [PATCH 4.19 47/66] s390/cpcmd: fix inline assembly register clobbering Date: Mon, 12 Apr 2021 10:40:53 +0200 Message-Id: <20210412083959.634901673@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412083958.129944265@linuxfoundation.org> References: <20210412083958.129944265@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Gordeev [ Upstream commit 7a2f91441b2c1d81b77c1cd816a4659f4abc9cbe ] Register variables initialized using arithmetic. That leads to kasan instrumentaton code corrupting the registers contents. Follow GCC guidlines and use temporary variables for assigning init values to register variables. Fixes: 94c12cc7d196 ("[S390] Inline assembly cleanup.") Signed-off-by: Alexander Gordeev Acked-by: Ilya Leoshkevich Link: https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Local-Register-Variables.html Signed-off-by: Heiko Carstens Signed-off-by: Sasha Levin --- arch/s390/kernel/cpcmd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c index af013b4244d3..2da027359798 100644 --- a/arch/s390/kernel/cpcmd.c +++ b/arch/s390/kernel/cpcmd.c @@ -37,10 +37,12 @@ static int diag8_noresponse(int cmdlen) static int diag8_response(int cmdlen, char *response, int *rlen) { + unsigned long _cmdlen = cmdlen | 0x40000000L; + unsigned long _rlen = *rlen; register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf; register unsigned long reg3 asm ("3") = (addr_t) response; - register unsigned long reg4 asm ("4") = cmdlen | 0x40000000L; - register unsigned long reg5 asm ("5") = *rlen; + register unsigned long reg4 asm ("4") = _cmdlen; + register unsigned long reg5 asm ("5") = _rlen; asm volatile( " diag %2,%0,0x8\n" -- 2.30.2