public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* Why 'fallocate' clear the file's SUID flag?
@ 2021-12-01 10:45 Kang Chen
  2022-01-11 20:06 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Kang Chen @ 2021-12-01 10:45 UTC (permalink / raw)
  To: linux-xfs

I found that the 'xfs_update_prealloc_flags' function is called
during the ‘fallocate’ syscall and the SUID flag is cleared
when the 'XFS_PREALLOC_INVISIBLE' flag is not set.
I am a beginner and have some questions about it.

1. What does XFS_PREALLOC_INVISIBLE mean and
why should the SUID flag be cleared
when XFS_PREALLOC_INVISIBLE is not set?

2. The behavior of XFS in handling the fallocate syscall is
a bit strange and not quite the same as other file systems,
such as ext4 and btrfs.

Here is an example:
foo is a normal file.
chmod set the SUID and SGID flag.
The last two parameters of fallocate are irrelevant to this problem.
After running, ext4 and btrfs set mode o6000, but xfs set mode o2000.
```
int fd = open("foo", 2, 0);
chmod("foo", o6000);
fallocate(fd, 3, 6549, 1334);
fsync(fd);
```

Can you give me some help?

Best wishes.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-11 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-01 10:45 Why 'fallocate' clear the file's SUID flag? Kang Chen
2022-01-11 20:06 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox