In the book The Linux Programming Interface, it says
The kernel imposes limits on the number of dereferences to handle the possibility of circular chains of symbolic links.
Where can I find this limit?
In the book The Linux Programming Interface, it says
The kernel imposes limits on the number of dereferences to handle the possibility of circular chains of symbolic links.
Where can I find this limit?
Looking at the 4.18 kernel sources, I see a constant named MAXSYMLINKS
in include/linux/namei.h
whose value is 40
.
Reference: https://elixir.bootlin.com/linux/latest/source/include/linux/namei.h#L12
#include <linux/kernel.h>
#include <linux/path.h>
#include <linux/fcntl.h>
#include <linux/errno.h>
enum { MAX_NESTED_LINKS = 8 };
#define MAXSYMLINKS 40
SYMLOOP_MAX
defined in POSIX<limits.h>
and more dynamically,sysconf(_SC_SYMLOOP_MAX)
) but it seems to be unimplemented in Linux. – Aug 12 '18 at 23:51