Message ID | 200901221027.38992.borntraeger@de.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, 22 Jan 2009 10:27:38 +0100 Christian Borntraeger <borntraeger@de.ibm.com> wrote: > 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. [...] > - 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"); Why don't you just remove the printk? IMHO it's rather pointless. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Am Thu, 22 Jan 2009 12:17:07 +0100
schrieb heicars2@linux.vnet.ibm.com:
> Why don't you just remove the printk? IMHO it's rather pointless.
It is'nt: It infoms the user why his guest is going to crash
even though it has performed an operation that is perfectly
legal according to the spec.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On (Thu) Jan 22 2009 [10:27:38], Christian Borntraeger wrote: > From: Christian Borntraeger <borntraeger@de.ibm.com> > > 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 <borntraeger@de.ibm.com> > --- > 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"); Breaking printk lines isn't encouraged just to keep the column width at 80. It makes grepping the sources for the source of the message difficult to find. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 22 Jan 2009 12:26:11 +0100 Carsten Otte <cotte@de.ibm.com> wrote: > Am Thu, 22 Jan 2009 12:17:07 +0100 > schrieb heicars2@linux.vnet.ibm.com: > > Why don't you just remove the printk? IMHO it's rather pointless. > It is'nt: It infoms the user why his guest is going to crash > even though it has performed an operation that is perfectly > legal according to the spec. If you have hundreds of guests running, how do you get the connection from this message to a specific user process? Informing a user process that it did something that isn't allowed or supported is usually done by returning an appropriate return code. Also, if you have one "evil" process and hit the prink_limit the messages for all other processes will likely be lost anyway. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Heiko Carstens wrote: > On Thu, 22 Jan 2009 12:26:11 +0100 > Carsten Otte <cotte@de.ibm.com> wrote: > > >> Am Thu, 22 Jan 2009 12:17:07 +0100 >> schrieb heicars2@linux.vnet.ibm.com: >> >>> Why don't you just remove the printk? IMHO it's rather pointless. >>> >> It is'nt: It infoms the user why his guest is going to crash >> even though it has performed an operation that is perfectly >> legal according to the spec. >> > > If you have hundreds of guests running, how do you get the connection > from this message to a specific user process? > > Informing a user process that it did something that isn't allowed or > supported is usually done by returning an appropriate return code. > Right, either inject an exception to the guest (if appropriate for the arch), or return -ESOMETHING from ioctl(KVM_RUN).
Am Thu, 22 Jan 2009 13:58:57 +0200 schrieb Avi Kivity <avi@redhat.com>: > Right, either inject an exception to the guest (if appropriate for the > arch), or return -ESOMETHING from ioctl(KVM_RUN). Yea that's what we do. We let userland handle the intercept, and there we let the guest die gracefully with a message. so long, Carsten -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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: