Created
February 23, 2013 15:31
-
-
Save hj91/5020146 to your computer and use it in GitHub Desktop.
generating segfault and logging it in kern.log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* this code is meant to run on MS DOS machines and uses bios bit setting to turn CAPS LOCK on or off */ | |
/* it contains far keyword, which is not used in gcc */ | |
#include <stdio.h> | |
void main() | |
{ | |
char *kb; | |
kb = (char *)0x417; | |
*kb = 64; | |
} | |
/* use gcc lockcap.c -o lockcap.c; ./lockcap */ | |
/* | |
output of dmesg after segmentation fault | |
[14938.955220] lockcap[8323]: segfault at 417 ip 080483d4 sp bfd6b2f8 error 6 in lockcap[8048000+1000] | |
[14973.194071] lockcap[8336]: segfault at 417 ip 080483a4 sp bfd6ba68 error 6 in lockcap[8048000+1000] | |
[14994.645856] lockcap[8339]: segfault at 417 ip 080483a4 sp bfc076a8 error 6 in lockcap[8048000+1000] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment