tmpfs: ensure O_LARGEFILE with generic_file_open()
Subsystems (2)
PATCH 1/1 tmpfs: ensure O_LARGEFILE with generic_file_open()
From: Thomas Weißschuh <[email protected]>
Without this check open() will open large files on tmpfs although O_LARGEFILE was not specified. This is inconsistent with other filesystems.
Also it will later result in EOVERFLOW on stat() or EFBIG on write().
--- mm/shmem.c | 1 + 1 file changed, 1 insertion(+)
mm/shmem.c +1 -0
@@ -3876,6 +3876,7 @@ EXPORT_SYMBOL(shmem_aops);static const struct file_operations shmem_file_operations = { .mmap = shmem_mmap, + .open = generic_file_open, .get_unmapped_area = shmem_get_unmapped_area, #ifdef CONFIG_TMPFS .llseek = shmem_file_llseek,
base-commit: f76349cf41451c5c42a99f18a9163377e4b364ff
Signature · 1 line
2.37.3
Quoted 9 lines · Thomas Weißschuh
From: Thomas Weißschuh <[email protected]>
Without this check
open()will open large files on tmpfs althoughO_LARGEFILEwas not specified. This is inconsistent with other filesystems.
Also it will later result in EOVERFLOW onstat()or EFBIG onwrite().
Thanks! I think you deserve some special award for finding and fixing such an ancient bug/inconsistency - dating back to early v2.4 it seems.
But only affecting 32-bit; and since we've happily lived with it so long, and the fix does change behaviour for userspace, better not to Cc stable.
There are some other filesystems still behaving as tmpfs was (ramfs, hugetlbfsi, and I didn't look further); but we do make more of an effort to keep tmpfs in line with the major filesystems - thank you.
Quoted 20 lines
--- mm/shmem.c | 1 + 1 file changed, 1 insertion(+)mm/shmem.c +1
-0@@ -3876,6 +3876,7 @@ EXPORT_SYMBOL(shmem_aops);static const struct file_operations shmem_file_operations = { .mmap = shmem_mmap, + .open = generic_file_open, .get_unmapped_area = shmem_get_unmapped_area, #ifdef CONFIG_TMPFS .llseek = shmem_file_llseek,base-commit:
f76349cf41451c5c42a99f18a9163377e4b364ffSignature · 1 line
2.37.3
Quoted 10 lines · Hugh Dickins
From: Hugh Dickins <[email protected]>
Quoted 7 lines · Thomas Weißschuh
From: Thomas Weißschuh <[email protected]>
Without this check
open()will open large files on tmpfs althoughO_LARGEFILEwas not specified. This is inconsistent with other filesystems.
Also it will later result in EOVERFLOW onstat()or EFBIG onwrite().
Quoted 7 lines
Quoted 2 lines
Acked-by Hugh Dickins <[email protected]>Thanks! I think you deserve some special award for finding and fixing such an ancient bug/inconsistency - dating back to early v2.4 it seems.
Seems to be my special talent.
Quoted 2 lines
But only affecting 32-bit; and since we've happily lived with it so long, and the fix does change behaviour for userspace, better not to Cc stable.
That was my feeling, too.
Quoted 3 lines
There are some other filesystems still behaving as tmpfs was (ramfs, hugetlbfsi, and I didn't look further); but we do make more of an effort to keep tmpfs in line with the major filesystems - thank you.
NFS seems also to be affected, which I think warrants a fix.
My plan was to wait for the feedback to this patch and if it works out to then submit patches for NFS as validating that will be a bit more involved.
Quoted 20 lines
Quoted 20 lines
--- mm/shmem.c | 1 + 1 file changed, 1 insertion(+)mm/shmem.c +1
-0@@ -3876,6 +3876,7 @@ EXPORT_SYMBOL(shmem_aops);static const struct file_operations shmem_file_operations = { .mmap = shmem_mmap, + .open = generic_file_open, .get_unmapped_area = shmem_get_unmapped_area, #ifdef CONFIG_TMPFS .llseek = shmem_file_llseek,base-commit:
f76349cf41451c5c42a99f18a9163377e4b364ffSignature · 1 line
2.37.3