[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ada4p6p9h6m.fsf@cisco.com>
Date: Wed, 16 Jul 2008 23:08:01 -0700
From: Roland Dreier <rdreier@...co.com>
To: Avi Kivity <avi@...ranet.com>
Cc: Dave Hansen <dave@...ux.vnet.ibm.com>,
"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
kvm-devel <kvm@...r.kernel.org>,
"Anthony N. Liguori \[imap\]" <aliguori@...ibm.com>
Subject: Re: KVM overflows the stack
> Yes, things like kvm_lapic_state are way too big to be on the stack.
I had a quick look at the code, and my worry about dynamic allocation
would be that handling allocation failure seems like it might get
tricky. Eg for handling struct kvm_pv_mmu_op_buffer (which is 528 bytes
on the stack in kvm_pv_mmu_op()) can you deal with an mmu op failing?
(maybe in that case you can easily by just setting *ret to 0?)
> There's an additional problem here, that apparently your gcc (which
> version?) doesn't fold objects in a switch statement into the same
> stack slot:
>
> switch (...) {
> case x: {
> struct medium a;
> ...
> }
> case y:
> struct medium b;
> ...
> }
> };
A trick for this is to do:
union {
struct medium1 a;
struct medium2 b;
} u;
switch (...) {
case x:
use u.a;
...
case y:
use u.b;
...
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists