1
/* This demonstrates races: kernel may actually open other file then
2
* you read at strace output. Create /tmp/delme with 10K of zeros and
3
* 666 mode, then run this under strace. If you see open successfull
4
* open of /etc/shadow, you know you've seen a race.
11
#include <sys/types.h>
18
char *c = (char*)0x94000000;
20
open( "/tmp/delme", O_RDWR );
21
mmap( c, 4096, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, 3, 0 );
25
strcpy( c, "/etc/passwd" );
26
strcpy( c, "/etc/shadow" );
30
if ((fd=open( c, 0 ))!=-1)