gvisor/pkg/sentry
Jamie Liu 6b76c172b4 Don't enforce NAME_MAX in fs.Dirent.walk().
Maximum filename length is filesystem-dependent, and obtained via
statfs::f_namelen. This limit is usually 255 bytes (NAME_MAX), but not
always. For example, VFAT supports filenames of up to 255... UCS-2
characters, which Linux conservatively takes to mean UTF-8-encoded
bytes: fs/fat/inode.c:fat_statfs(), FAT_LFN_LEN * NLS_MAX_CHARSET_SIZE.
As a result, Linux's VFS does not enforce NAME_MAX:

$ rg --maxdepth=1 '\WNAME_MAX\W' fs/ include/linux/
fs/libfs.c
38:     buf->f_namelen = NAME_MAX;
64:     if (dentry->d_name.len > NAME_MAX)

include/linux/relay.h
74:     char base_filename[NAME_MAX];   /* saved base filename */

include/linux/fscrypt.h
149: * filenames up to NAME_MAX bytes, since base64 encoding expands the length.

include/linux/exportfs.h
176: *    understanding that it is already pointing to a a %NAME_MAX+1 sized

Remove this check from core VFS, and add it to ramfs (and by extension
tmpfs), where it is actually applicable:
mm/shmem.c:shmem_dir_inode_operations.lookup == simple_lookup *does*
enforce NAME_MAX.

PiperOrigin-RevId: 245324748
Change-Id: I17567c4324bfd60e31746a5270096e75db963fac
2019-04-25 16:05:13 -07:00
..
arch Internal change 2019-04-10 18:00:18 -07:00
context Decouple filemem from platform and move it to pgalloc.MemoryFile. 2019-03-14 08:12:48 -07:00
control Clean up state error handling 2019-04-22 18:20:51 -07:00
device Save/restore simple devices. 2019-04-01 15:39:16 -07:00
fs Don't enforce NAME_MAX in fs.Dirent.walk(). 2019-04-25 16:05:13 -07:00
hostcpu Remove license comments 2019-01-31 11:12:53 -08:00
inet Remove license comments 2019-01-31 11:12:53 -08:00
kernel Clean up state error handling 2019-04-22 18:20:51 -07:00
limits Allow threads with CAP_SYS_RESOURCE to raise hard rlimits. 2019-04-10 12:36:45 -07:00
loader Use open fids when fstat()ing gofer files. 2019-04-11 00:43:04 -07:00
memmap Call memmap.Mappable.Translate with more conservative usermem.AccessType. 2019-03-25 12:42:43 -07:00
memutil Decouple filemem from platform and move it to pgalloc.MemoryFile. 2019-03-14 08:12:48 -07:00
mm Internal change 2019-04-10 18:00:18 -07:00
pgalloc Decouple filemem from platform and move it to pgalloc.MemoryFile. 2019-03-14 08:12:48 -07:00
platform Allow BP and OF can be called from user space 2019-03-21 22:04:50 -07:00
safemem Priority-inheritance futex implementation 2019-03-05 23:40:18 -08:00
sighandling Remove license comments 2019-01-31 11:12:53 -08:00
socket Add support for the MSG_TRUNC msghdr flag. 2019-04-19 16:17:01 -07:00
state Treat ENOSPC as a state-file error during save. 2019-03-29 12:26:25 -07:00
strace Format struct pollfd in poll(2)/ppoll(2) 2019-04-18 15:24:07 -07:00
syscalls Bugfix: fix fstatat symbol link to dir 2019-04-22 20:07:06 -07:00
time Move package sync to third_party 2019-01-31 17:49:14 -08:00
unimpl Remove license comments 2019-01-31 11:12:53 -08:00
uniqueid Remove license comments 2019-01-31 11:12:53 -08:00
usage Decouple filemem from platform and move it to pgalloc.MemoryFile. 2019-03-14 08:12:48 -07:00
usermem Convert []byte to string without copying in usermem.CopyStringIn. 2019-03-27 10:46:28 -07:00
watchdog Remove license comments 2019-01-31 11:12:53 -08:00
BUILD Remove license comments 2019-01-31 11:12:53 -08:00