gvisor/pkg/sentry/fs/gofer
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
..
BUILD Remove license comments 2019-01-31 11:12:53 -08:00
attr.go Use correct company name in copyright header 2018-10-19 16:35:11 -07:00
cache_policy.go Clean up gofer handle caching. 2019-03-28 11:43:51 -07:00
context_file.go Track paths and provide a rename hook. 2018-10-23 00:20:15 -07:00
device.go Use correct company name in copyright header 2018-10-19 16:35:11 -07:00
file.go Use open fids when fstat()ing gofer files. 2019-04-11 00:43:04 -07:00
file_state.go Clean up gofer handle caching. 2019-03-28 11:43:51 -07:00
fs.go Allow filesystem.Mount to take an optional interface argument. 2019-03-13 19:24:03 -07:00
gofer_test.go Deflake gofer_test. 2018-12-20 17:23:26 -08:00
handles.go Use correct company name in copyright header 2018-10-19 16:35:11 -07:00
inode.go Clean up gofer handle caching. 2019-03-28 11:43:51 -07:00
inode_state.go Use correct company name in copyright header 2018-10-19 16:35:11 -07:00
path.go Don't enforce NAME_MAX in fs.Dirent.walk(). 2019-04-25 16:05:13 -07:00
session.go Use FD limit and file size limit from host 2019-04-17 12:57:40 -07:00
session_state.go Allow filesystem.Mount to take an optional interface argument. 2019-03-13 19:24:03 -07:00
socket.go Convert Unix transport to syserr 2018-10-24 11:05:08 -07:00
util.go Use correct company name in copyright header 2018-10-19 16:35:11 -07:00