From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: [PATCH 1/3] kvm-s390: Fix printk on SIGP set arch Date: Thu, 22 Jan 2009 10:27:38 +0100 Message-ID: <200901221027.38992.borntraeger@de.ibm.com> References: <200901221026.13261.borntraeger@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: Christian Ehrhardt , Carsten Otte , Olaf Schnapper To: Avi Kivity , kvm@vger.kernel.org Return-path: Received: from mtagate8.uk.ibm.com ([195.212.29.141]:65252 "EHLO mtagate8.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756644AbZAVJa2 (ORCPT ); Thu, 22 Jan 2009 04:30:28 -0500 Received: from d06nrmr1407.portsmouth.uk.ibm.com (d06nrmr1407.portsmouth.uk.ibm.com [9.149.38.185]) by mtagate8.uk.ibm.com (8.13.8/8.13.8) with ESMTP id n0M9Rhac572256 for ; Thu, 22 Jan 2009 09:27:43 GMT Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id n0M9RgdU1609970 for ; Thu, 22 Jan 2009 09:27:42 GMT Received: from d06av03.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n0M9RftV005475 for ; Thu, 22 Jan 2009 09:27:42 GMT In-Reply-To: <200901221026.13261.borntraeger@de.ibm.com> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: From: Christian Borntraeger KVM on s390 does not support the ESA/390 architecture. We refuse to change the architecture mode and print a warning. While testing a crashme for kvm, I spotted two problems with the printk: o A malicious can flood host dmesg o There was no newline at the end of the printk This patch fixes both problems. Signed-off-by: Christian Borntraeger --- arch/s390/kvm/sigp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Index: kvm/arch/s390/kvm/sigp.c =================================================================== --- kvm.orig/arch/s390/kvm/sigp.c +++ kvm/arch/s390/kvm/sigp.c @@ -153,8 +153,9 @@ static int __sigp_set_arch(struct kvm_vc switch (parameter & 0xff) { case 0: - printk(KERN_WARNING "kvm: request to switch to ESA/390 mode" - " not supported"); + if (printk_ratelimit()) + printk(KERN_WARNING "kvm: request to switch to ESA/390" + " mode not supported\n"); rc = 3; /* not operational */ break; case 1: