00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <stdio.h>
00017 #include <stdlib.h>
00018
00019 #define INVAL_INSN 0x0000003f
00020
00021 int
00022 main()
00023 {
00024 unsigned int *x = (unsigned int *) main;
00025
00026 printf("Trying to write to the text segment\n");
00027 printf("This program should fail if the text segment is read-only.\n");
00028 printf("However, the kernel should not crash...\n");
00029
00030 *x = INVAL_INSN;
00031
00032 printf("IF THIS PRINTS, THE TEST FAILED\n");
00033 exit(1);
00034 }