From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.6) Gecko/20040312 Epiphany/1.1.12 Description of problem: The rc.sysinit script contains the following: # Clean up SELinux labels if [ -n "$SELINUX" ]; then for file in /etc/mtab /etc/ld.so.cache ; do [ -r $file ] && restorecon -v $file done fi When this is executed upon booting my PowerPC-based system, restorecon hangs. At this point I have to press Ctrl-C to continue booting. When I run the same command manually, restorecon uses approximately 80-90% of my CPU but does not seem to do anything. Here is an strace up until the point that restorecon hangs: execve("/sbin/restorecon", ["restorecon", "-v", "/etc/mtab"], [/* 56 vars */]) = 0 uname({sys="Linux", node="imp.flyn.org", ...}) = 0 brk(0) = 0x10013000 open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=52321, ...}) = 0 mmap(NULL, 52321, PROT_READ, MAP_PRIVATE, 3, 0) = 0x30000000 close(3) = 0 open("/lib/libselinux.so.1", O_RDONLY) = 3 read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\17BM\314"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=82648, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x3000d000 mmap(0xf420000, 147428, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xf420000 mprotect(0xf432000, 73700, PROT_NONE) = 0 mmap(0xf440000, 16384, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0x10000) = 0xf440000 close(3) = 0 open("/lib/tls/libc.so.6", O_RDONLY) = 3 read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\17\352"..., 512) = 512fstat64(3, {st_mode=S_IFREG|0755, st_size=1554696, ...}) = 0 mmap(0xfe90000, 1275112, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xfe90000 mprotect(0xffb9000, 58600, PROT_NONE) = 0 mmap(0xffc0000, 24576, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0x130000) = 0xffc0000 mmap(0xffc6000, 5352, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffc6000 close(3) = 0 mprotect(0xffc0000, 8192, PROT_READ) = 0 mprotect(0xfff0000, 4096, PROT_READ) = 0 munmap(0x30000000, 52321) = 0 brk(0) = 0x10013000 brk(0x10034000) = 0x10034000 open("/proc/mounts", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x30000000 read(3, "rootfs / rootfs rw 0 0\n/dev/root"..., 1024) = 280 close(3) = 0 munmap(0x30000000, 4096) = 0 open("/proc/filesystems", O_RDONLY) = 3 read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 4095) = 204 open("/proc/self/attr/current", O_RDONLY) = 4 read(4, "root:sysadm_r:sysadm_t\0", 4095) = 23 close(4) = 0 close(3) = 0 Version-Release number of selected component (if applicable): policycoreutils-1.10-1 How reproducible: Always Steps to Reproduce: Boot system and notice rc.sysinit hangs on restorecon. Additional info:
Are you still seeing this on newer kernels and policy?
I still see this behavior with: selinux-policy-strict-sources-1.13.4-6 selinux-policy-strict-1.13.4-6 policycoreutils-1.13.1-2 checkpolicy-1.10-3 libselinux-devel-1.13.3-2 libselinux-1.13.3-2 Architecture is PowerPC.
Problem still exists with: selinux-policy-strict-sources-1.15.5-2 selinux-policy-strict-1.15.5-2 policycoreutils-1.15.1-1 checkpolicy-1.14.1-1 libselinux-devel-1.15.1-1 libselinux-1.15.1-1
The getopt() function returns an int, not a char. Here is a patch that fixes this problem: --- restorecon.c.orig 2004-07-19 21:19:18.725865576 -0500 +++ restorecon.c 2004-07-19 21:19:23.290171696 -0500 @@ -109,7 +109,7 @@ int change=1; int verbose=0; int file=0; - char opt; + int opt; FILE *outfile=NULL; char buf[PATH_MAX];
policycoreutils-1.15.2-3 contains the patch.