Unsynchronized read-modify-write race on global PRNG state randseed (SMP)
Summary
Sole kernel PRNG state randseed (random.c:36) is plain static u_long protected by NO lock NO crit section NO atomic operation. krandom() performs non-atomic read-modify-write: reads randseed into x (random.c:60) computes next state writes back (random.c:66). On SMP/LWKT kernel concurrent callers on different CPUs (two filesystems allocating inodes via ffs_alloc.c:642/ext2_vfsops.c:1421 or concurrent network-stack paths) interleave and (a) return identical values (b) can lose state updates. Result: duplicate/correlated random values to security-sensitive consumers. Sibling arc4random.c:149 wraps state in crit_enter/crit_exit. krandom callable from any CPU anytime callers span kern_synch.c scheduler ffs_alloc.c VFS if_spppsubr.c network dummynet ipfw3_nat. Impact 1: duplicate inode generation numbers i_gen collision means stale NFS client filehandle for deleted file can validate against freshly-created unrelated inode (NFS filehandle confusion potential unauthorized access). Impact 2: correlated CHAP challenge words race can duplicate/skip values weakening already-weak challenge. Impact 3: duplicate NAT alias ports duplicate IPv6 fragment IDs. No privilege required beyond local execution.
No comments yet.