Received: by 10.223.176.46 with SMTP id f43csp586819wra; Thu, 18 Jan 2018 22:32:04 -0800 (PST) X-Google-Smtp-Source: ACJfBosLlJlcnaGM6YOwSNh/T0Q0i4IZQACT3hR20eHbK0twReEFdB9irPjABhvADZ3SSjkQCetF X-Received: by 2002:a17:902:8ec4:: with SMTP id x4-v6mr1037365plo.271.1516343524161; Thu, 18 Jan 2018 22:32:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516343524; cv=none; d=google.com; s=arc-20160816; b=PM3DE6BpWX8+mBdcI7QH+d+a4Ig7gQD28M7qPg2puvTr5J8JlhYKQ7LIJw6wRs+Yx7 mrLDUVF4yywcAGyUhBaI5obL3ykUbCupE9VjIJWrzaSxYCm45lGXsJPduM4IRN2kc4KX 6v1jR2+gl6IWyGNGogtrQ3GlMuXKxwAP9QMeAc9yZw1ULUEo3O8MPqoqMEbGEsb831V5 tKRiXkRUA5YV3LJhdk8yrKoRi3geEBgz/asz8XMHC/+GS+NcTLR9UWAmOawA1OHqPb79 qaPdEROdmEqUcKFY1bzMryNPnJMpWIBEcLElwz9LkD5omM9mCfajbb3TEF2FcvnNHpgr yxeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:from:references:cc:to :subject:arc-authentication-results; bh=sQQnVa3alaOVdhzzK7p62/gecrS0vLh6gbeyH6X+7hs=; b=Ez3cuNoliS1sy6TcKwJb45qaep0bxKyPQtsunXl7pJdjoXl8liVhiK2JsGuh3NlTbq RI7Z3mfpvjCdo1T+OTSKzyMUvIWHqKCuxjH2jjUfBIFaHJoIs9KXonxHyhoL2zq1SXtz ZfYXVLRRjOK37MwgggV7uJZYz3jGzf1HlKaCXFON7f5pJ6CkNiDNEqNi2HTamDUrIUMu URIm0w+NknNCDbq+9yz6aWSL55yOqPUBfzCaQMpWgowIKIuSWf5+hP8n7FuOYAIVPjVL 1H7kEOwDbsHLVGCFK6zGP721kd6Xx8teEht6mDQQHq7HvMgli+xL8trhkXFWtMivM32R 0+uw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h187si7610715pgc.531.2018.01.18.22.31.50; Thu, 18 Jan 2018 22:32:04 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753390AbeASG34 (ORCPT + 99 others); Fri, 19 Jan 2018 01:29:56 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47624 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750757AbeASG3s (ORCPT ); Fri, 19 Jan 2018 01:29:48 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0J6SqwI052942 for ; Fri, 19 Jan 2018 01:29:48 -0500 Received: from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206]) by mx0b-001b2d01.pphosted.com with ESMTP id 2fk8y15g85-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 19 Jan 2018 01:29:47 -0500 Received: from localhost by e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 19 Jan 2018 01:29:47 -0500 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e16.ny.us.ibm.com (146.89.104.203) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 19 Jan 2018 01:29:42 -0500 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0J6Tfrx45219878; Fri, 19 Jan 2018 06:29:41 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E48CAE03C; Fri, 19 Jan 2018 01:30:55 -0500 (EST) Received: from [9.125.65.177] (unknown [9.125.65.177]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTPS id 7A02DAE04B; Fri, 19 Jan 2018 01:30:51 -0500 (EST) Subject: Re: [PATCH 6/6] s390: scrub registers on kernel entry and KVM exit To: Martin Schwidefsky , linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org Cc: Heiko Carstens , Paolo Bonzini , Cornelia Huck , Greg Kroah-Hartman , Jon Masters , Marcus Meissner , Jiri Kosina References: <1516182519-10623-1-git-send-email-schwidefsky@de.ibm.com> <1516182519-10623-7-git-send-email-schwidefsky@de.ibm.com> From: QingFeng Hao Date: Fri, 19 Jan 2018 14:29:20 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1516182519-10623-7-git-send-email-schwidefsky@de.ibm.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18011906-0024-0000-0000-00000314C9C0 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008405; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000247; SDB=6.00977152; UDB=6.00495409; IPR=6.00757074; BA=6.00005782; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00019122; XFM=3.00000015; UTC=2018-01-19 06:29:45 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011906-0025-0000-0000-000046B078AA Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-19_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801190081 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2018/1/17 17:48, Martin Schwidefsky ะด??: > Clear all user space registers on entry to the kernel and all KVM guest > registers on KVM guest exit if the register does not contain either a > parameter or a result value. I am not sure if I understand this but it will be safer? And can we abstract the operations to be a macro like CLEAR_REG_7? Thanks > > Suggested-by: Christian Borntraeger > Reviewed-by: Christian Borntraeger > Signed-off-by: Martin Schwidefsky > --- > arch/s390/kernel/entry.S | 41 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > > diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S > index 2a22c03..47227d3 100644 > --- a/arch/s390/kernel/entry.S > +++ b/arch/s390/kernel/entry.S > @@ -322,6 +322,12 @@ ENTRY(sie64a) > sie_exit: > lg %r14,__SF_EMPTY+8(%r15) # load guest register save area > stmg %r0,%r13,0(%r14) # save guest gprs 0-13 > + xgr %r0,%r0 # clear guest registers > + xgr %r1,%r1 > + xgr %r2,%r2 > + xgr %r3,%r3 > + xgr %r4,%r4 > + xgr %r5,%r5 > lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers > lg %r2,__SF_EMPTY+16(%r15) # return exit reason code > br %r14 > @@ -358,6 +364,7 @@ ENTRY(system_call) > UPDATE_VTIME %r8,%r9,__LC_SYNC_ENTER_TIMER > BPENTER __TI_flags(%r12),_TIF_NOBP > stmg %r0,%r7,__PT_R0(%r11) > + 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 > @@ -640,6 +647,14 @@ ENTRY(pgm_check_handler) > 4: lgr %r13,%r11 > la %r11,STACK_FRAME_OVERHEAD(%r15) > stmg %r0,%r7,__PT_R0(%r11) > + xgr %r0,%r0 # clear user space registers > + xgr %r1,%r1 > + xgr %r2,%r2 > + xgr %r3,%r3 > + xgr %r4,%r4 > + xgr %r5,%r5 > + xgr %r6,%r6 > + xgr %r7,%r7 > mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC > stmg %r8,%r9,__PT_PSW(%r11) > mvc __PT_INT_CODE(4,%r11),__LC_PGM_ILC > @@ -706,6 +721,15 @@ ENTRY(io_int_handler) > lmg %r8,%r9,__LC_IO_OLD_PSW > SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER > stmg %r0,%r7,__PT_R0(%r11) > + xgr %r0,%r0 # clear user space registers > + xgr %r1,%r1 > + xgr %r2,%r2 > + xgr %r3,%r3 > + xgr %r4,%r4 > + xgr %r5,%r5 > + xgr %r6,%r6 > + xgr %r7,%r7 > + xgr %r10,%r10 > mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC > stmg %r8,%r9,__PT_PSW(%r11) > mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID > @@ -924,6 +948,15 @@ ENTRY(ext_int_handler) > lmg %r8,%r9,__LC_EXT_OLD_PSW > SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER > stmg %r0,%r7,__PT_R0(%r11) > + xgr %r0,%r0 # clear user space registers > + xgr %r1,%r1 > + xgr %r2,%r2 > + xgr %r3,%r3 > + xgr %r4,%r4 > + xgr %r5,%r5 > + xgr %r6,%r6 > + xgr %r7,%r7 > + xgr %r10,%r10 > mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC > stmg %r8,%r9,__PT_PSW(%r11) > lghi %r1,__LC_EXT_PARAMS2 > @@ -1133,6 +1166,14 @@ ENTRY(mcck_int_handler) > .Lmcck_skip: > lghi %r14,__LC_GPREGS_SAVE_AREA+64 > stmg %r0,%r7,__PT_R0(%r11) > + xgr %r0,%r0 # clear user space registers > + xgr %r2,%r2 > + xgr %r3,%r3 > + xgr %r4,%r4 > + xgr %r5,%r5 > + xgr %r6,%r6 > + xgr %r7,%r7 > + xgr %r10,%r10 > mvc __PT_R8(64,%r11),0(%r14) > stmg %r8,%r9,__PT_PSW(%r11) > xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11) -- Regards QingFeng Hao