Skip to contentSkip to conversation

elf interpreter prefix scanning can get stuck in a loop

Qemu-devel Lennert Buytenhek 2 participants 2 messages Dec 18, 2004 – Dec 20, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

init_paths() seems to be able to get stuck in an 'infinite' loop. For example when encountering a '.' symlink:

open("/data/fc2/arm/root/usr/include/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/asm-generic", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 27

I'd suggest to always skip symlinks but that doesn't seem like the right thing to do..

--L

#1 lore raw

Under Linux (or maybe it's inside bash), there is a hard-coded limit to the maximum number of symlinks to be followed in any path. I've hit this limit before, but I'm not sure what it is. A maximum symlink count sounds like a quick-and dirty way to prevent infinite recursion.
The limit I hit seemed too restrictive, but something around 256
symlink traversals seems reasonable. Once you've followed 256 symlinks, it's a fair bet that something is wrong. The limit I hit seemed to be in the neighborhood of 10.

-Karl

Quoted 17 lines · Lennert Buytenhek

Hi,

init_paths() seems to be able to get stuck in an 'infinite' loop. For example when encountering a '.' symlink:

open("/data/fc2/arm/root/usr/include/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/beecrypt/asm-generic", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 27

I'd suggest to always skip symlinks but that doesn't seem like the right thing to do..

--L

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel