Re: [PATCH 1/3] kvm-s390: Fix printk on SIGP set arch

2009-01-22 Thread Carsten Otte
Am Thu, 22 Jan 2009 13:58:57 +0200
schrieb Avi Kivity :
> 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] kvm-s390: Fix printk on SIGP set arch

2009-01-22 Thread Avi Kivity

Heiko Carstens wrote:

On Thu, 22 Jan 2009 12:26:11 +0100
Carsten Otte  wrote:

  

Am Thu, 22 Jan 2009 12:17:07 +0100
schrieb heica...@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).


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] kvm-s390: Fix printk on SIGP set arch

2009-01-22 Thread Heiko Carstens
On Thu, 22 Jan 2009 12:26:11 +0100
Carsten Otte  wrote:

> Am Thu, 22 Jan 2009 12:17:07 +0100
> schrieb heica...@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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] kvm-s390: Fix printk on SIGP set arch

2009-01-22 Thread Amit Shah
On (Thu) Jan 22 2009 [10:27:38], Christian Borntraeger wrote:
> 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");

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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] kvm-s390: Fix printk on SIGP set arch

2009-01-22 Thread Carsten Otte
Am Thu, 22 Jan 2009 12:17:07 +0100
schrieb heica...@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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] kvm-s390: Fix printk on SIGP set arch

2009-01-22 Thread Heiko Carstens
On Thu, 22 Jan 2009 10:27:38 +0100
Christian Borntraeger  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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html