<div dir="ltr"><div><div>Don't new security features like memory location randomization etc. kind of get in the way of what you want to do on any modern OS?<br><br></div>(The way I understand it you are trying to copy the stack from outside the running/frozen OS).<br><br></div>Regards,<br>Eliyahu - אליהו<br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-12-21 21:22 GMT+02:00 Elazar Leibovich <span dir="ltr"><<a href="mailto:elazarl@gmail.com" target="_blank">elazarl@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It could very well be the case,<br>
I just want to clarify, the reason I need the stack, is for<br>
analyzing/debugging/profiling later by OS specific tools. So it is OK<br>
to err on some pathological cases.<br>
<br>
If you have a concrete idea that would fit many Linux versions - I'll<br>
be happy to hear about it.<br>
<div class="HOEnZb"><div class="h5"><br>
On Sun, Dec 21, 2014 at 12:19 PM, Omer Zak <<a href="mailto:w1@zak.co.il">w1@zak.co.il</a>> wrote:<br>
> I think that any serious approach would include code for identifying the<br>
> OS and OS version in question, and using this information to find the<br>
> kernel stack.<br>
><br>
> Any generalized heuristic would risk missing pathological OS<br>
> configurations and new versions.<br>
><br>
> On the other hand, reliance upon OS identification would at least enable<br>
> the user to call Support when he runs your code on an OS not identified<br>
> as a supported OS.<br>
><br>
> --- Omer<br>
><br>
><br>
> On Sun, 2014-12-21 at 11:08 +0200, Elazar Leibovich wrote:<br>
>> Thanks,<br>
>><br>
>> On Sun, Dec 21, 2014 at 9:27 AM, Muli Ben-Yehuda <<a href="mailto:mulix@mulix.org">mulix@mulix.org</a>> wrote:<br>
>> > On Fri, Dec 19, 2014 at 02:19:07PM +0000, Elazar Leibovich wrote:<br>
>> ><br>
>> >> I know where the stack ends, but how can I know where it begins?<br>
>> ><br>
>> > What assumptions can you make? Can you run kernel code in the VM<br>
>> > (e.g., by cloning and restarting it)? Can you assume it's running<br>
>> > Linux and/or Windows? Can you assume the kernel was compiled with<br>
>> > frame pointers? Or is it a completely black box VM and you can't make<br>
>> > any assumptions about what's running inside?<br>
>><br>
>> This is a very practical question.<br>
>><br>
>> Yes, I can run a forth-based OS, which isn't even using C-like stack.<br>
>> But I need to solve a problem for most of the user, and I want to<br>
>> support any reasonable OS.<br>
>><br>
>> So Windows and Linux is a must, freeBSD/Solaris is nice-to-have, and<br>
>> anything else is probably optional.<br>
>><br>
>> I want to assume anything which would be reasonably portable across<br>
>> popular OSes.<br>
>><br>
>> For example, you asked about frame pointers, assuming you meant I can<br>
>> follow ebps back, until I get invalid ebp address, assuming this is<br>
>> the head of the stack. I'm not sure if it's reasonable to assume most<br>
>> kernel would be compiled with frame pointers, so I'm not sure how<br>
>> valid would this heuristic be.<br>
>><br>
>> I can run code in the guest context, and actually to fetch the stack<br>
>> I'll probably run code that would copy it from the host context, but I<br>
>> couldn't think of a way to fetch the stack, that wouldn't be too<br>
>> implementation-specific.<br>
>><br>
>><br>
>> > By the way, some OS's have separate interrupt stacks, so you may be on<br>
>> > an interrupt stack or on a regular stack.<br>
>> ><br>
>><br>
>> Good point, but I think the heuristic should catch it as well.<br>
> --<br>
> If verbal consent is not obtained in triplicate, it is a date rape.<br>
> Asking permission constitutes harassment.<br>
><br>
> My opinions, as expressed in this E-mail message, are mine alone.<br>
> They do not represent the official policy of any organization with which<br>
> I may be affiliated in any way.<br>
> WARNING TO SPAMMERS: at <a href="http://www.zak.co.il/spamwarning.htmlDelay" target="_blank">http://www.zak.co.il/spamwarning.htmlDelay</a> is the deadliest form of denial. C. Northcote Parkinson<br>
> My own blog is at <a href="http://www.zak.co.il/tddpirate/" target="_blank">http://www.zak.co.il/tddpirate/</a><br>
><br>
> My opinions, as expressed in this E-mail message, are mine alone.<br>
> They do not represent the official policy of any organization with which<br>
> I may be affiliated in any way.<br>
> WARNING TO SPAMMERS: at <a href="http://www.zak.co.il/spamwarning.html" target="_blank">http://www.zak.co.il/spamwarning.html</a><br>
><br>
<br>
_______________________________________________<br>
Linux-il mailing list<br>
<a href="mailto:Linux-il@cs.huji.ac.il">Linux-il@cs.huji.ac.il</a><br>
<a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" target="_blank">http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il</a><br>
</div></div></blockquote></div><br></div>