-
Notifications
You must be signed in to change notification settings - Fork 126
Setting up the signal stack in the handle_segv.c. #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Setting up the signal stack in the handle_segv.c. #1
Conversation
Signed-off-by: Jagadeesh Pagadala <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Jagadeesh, thanks for your pull request..
I've made small comments in your function, pl address them first.
Also, you'd have to complete the patch by actually invoking this func in ch12/handle_segv.c.
Of course, first pl ensure you test it. Thanks.
Signed-off-by: Jagadeesh Pagadala <[email protected]>
Signed-off-by: Jagadeesh Pagadala <[email protected]>
Addressing the review comments. |
Signed-off-by: Jagadeesh Pagadala <[email protected]>
Signed-off-by: Jagadeesh Pagadala <[email protected]>
@@ -197,9 +200,17 @@ int main(int argc, char **argv) | |||
exit(1); | |||
} | |||
|
|||
/*Setting up the alternate stack to properly handle the SIGSEGV*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
just fix code style as per Linux kernel style guidelines
Tip- use 'indent -linux <fname.c>' to do so ..
Marking this PR as open again.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Jagadeesh,
It looks good as such, But...
When i run the original ver, the faulting addr dtl etc is all fine, but with the new ver using alt stack it's not:
Eg. run: w/ orig ver:
ch12 $ ./handle_segv u r
Attempting to read contents of arbitrary usermode va uptr = 0xdeadface:
handle_segv:
------------------- FATAL signal ---------------------------
myfault: received signal 11. errno=0
Cause/Origin: (si_code=1): SEGV_MAPERR: address not mapped to object
Faulting instr or address = 0xdeadface
--- Register Dump [x86_64] ---
RAX = 0x00000000deadface RBX = 0x0000000000000000 RCX = 0x0000000000000000
RDX = 0x0000000000000000 RSI = 0x000055bdcda50260 RDI = 0x0000000000000001
RBP = 0x00007ffc4093cdb0 R8 = 0x0000000000000000 R9 = 0x0000000000000000
R10 = 0x0000000000000000 R11 = 0x0000000000000246 R12 = 0x000055bdcd19fc50
R13 = 0x00007ffc4093ce90 R14 = 0x0000000000000000 R15 = 0x0000000000000000
RSP = 0x00007ffc4093cce0
RIP = 0x000055bdcd1a03cb EFLAGS = 0x0000000000010206
TRAP# = 14 ERROR = 04
CR2 = 0x00000000deadface
psiginfo helper: Segmentation fault (Address not mapped to object [0xdeadface])
With the new ver w/ alt stack:
ch12 $ ./handle_segv u r
Alt signal stack size = 8388608
Attempting to read contents of arbitrary usermode va uptr = 0xdeadface:
handle_segv:
------------------- FATAL signal ---------------------------
myfault: received signal 11. errno=4
Cause/Origin: (si_code=8): -none-
Faulting instr or address = 0x7ffe4eff0b30
--- Register Dump [x86_64] ---
RAX = 0x00000000deadface RBX = 0x0000000000000000 RCX = 0x0000000000000000
RDX = 0x0000000000000000 RSI = 0x000055a5d4e7a260 RDI = 0x0000000000000001
RBP = 0x00007ffe4eff0c40 R8 = 0x0000000000000000 R9 = 0x0000000000000000
R10 = 0x0000000000000000 R11 = 0x0000000000000246 R12 = 0x000055a5d2fe7ca0
R13 = 0x00007ffe4eff0d20 R14 = 0x0000000000000000 R15 = 0x0000000000000000
RSP = 0x00007ffe4eff0b70
RIP = 0x000055a5d2fe852e EFLAGS = 0x0000000000010202
TRAP# = 14 ERROR = 04
CR2 = 0x00000000deadface
psiginfo helper: Unknown signal 1685382480
? Unsure why... but we can't merge this until it's fixed and works correctly.
Pl ignore the extra bold fonts from "RIP" onward... |
Signed-off-by: Jagadeesh Pagadala <[email protected]>
It is working fine on my CentOS box, and even on seawolf.
commit 4af72d5 RIP = 0x0000561af22cd510 EFLAGS = 0x0000000000010206
|
Hi Kaiwan, I am your student from HPE Bangalore, thought of providing some improvement with your permission.
Signed-off-by: Jagadeesh Pagadala [email protected]