Re:Why is there a “V” in SIGSEGV Segmentation Fault?
by loeg on Thursday June 18, 2020 @09:30AM
(#23562903)
Or decode the x86 stream to find the next instruction. :-)
Next C statement is pretty cute, though.
Re:Why is there a “V” in SIGSEGV Segmentation Fault?
by vsareto on Thursday June 18, 2020 @11:14AM
(#23563822)
That reminds me of the time I saw a C# database save function looking at the stack trace to figure out if it had already been called, exiting if it saw itself on the stack.
I mean, it's not wrong, but it is crazy.
Re:Why is there a “V” in SIGSEGV Segmentation Fault?
by tonyarkles on Thursday June 18, 2020 @04:55PM
(#23567924)
If I recall, I once did something like this in Python that modified variables in its caller. Not for production, just for shits and giggles :D
Re:Why is there a “V” in SIGSEGV Segmentation Fault?
by matja on Thursday June 18, 2020 @10:24AM
(#23563369)
Interesting problem - what's the shortest C function that takes a pointer to bytes and returns the length of the x86-64 instruction there? (and how many hours would it take to code it)
Re:Why is there a “V” in SIGSEGV Segmentation Fault?
by loeg on Thursday June 18, 2020 @11:17AM
(#23563848)
Start here and minimize as you see fit: https://intelxed.github.io/ref-manual/group__DEC.html#ga4bef...
Re:Why is there a “V” in SIGSEGV Segmentation Fault?
by mhh__ on Thursday June 18, 2020 @08:47PM
(#23569833)
The cheating way is probably to do this
https://www.blackhat.com/docs/us-17/thursday/us-17-Domas-Bre... (page ~71) i.e. shift across an instruction boundary.
Re:Why is there a “V” in SIGSEGV Segmentation Fault?
by kccqzy on Thursday June 18, 2020 @11:01PM
(#23570538)
Put it on a page boundary. Make sure the next page isn't accessible. Analyze the resulting page fault.
Re:Why is there a “V” in SIGSEGV Segmentation Fault?
by nilsb on Thursday June 18, 2020 @10:42AM
(#23563522)
On Error Resume Next
Re:Why is there a “V” in SIGSEGV Segmentation Fault?
by aaron_m04 on Thursday June 18, 2020 @04:52PM
(#23567879)
Is a larger slide and RIP increment needed then? Or can these never be made large enough?
Re:Why is there a “V” in SIGSEGV Segmentation Fault?
by tonyarkles on Thursday June 18, 2020 @04:55PM
(#23567916)
The reason this worked in this example is because they knew which line would cause the SEGV. In the general case where you're trying to catch arbitrary segfaults, you'd need a slide in between every instruction if you wanted to do a fixed RIP increment.
What you really need to do is figure out which instruction was executing and increment RIP appropriately.
Terrifying but fun!
[1] https://en.wikipedia.org/wiki/NOP_slide