Hide statfs/fstatfs' ST_VALID flag from userspace.

Spotted while debugging the strace 4.10 upgrade.

Change-Id: I1af1be9c9440151f55f74a835e1df71529b0e4fe
This commit is contained in:
Elliott Hughes
2015-03-18 15:46:48 -07:00
parent ab12dc70f3
commit fa495d51b0
11 changed files with 61 additions and 51 deletions

View File

@@ -31,6 +31,11 @@ template <typename StatFsT> void Check(StatFsT& sb) {
EXPECT_EQ(0, sb.f_fsid.__val[0]);
EXPECT_EQ(0, sb.f_fsid.__val[1]);
EXPECT_EQ(255, static_cast<int>(sb.f_namelen));
// The kernel sets a private bit to indicate that f_flags is valid.
// This flag is not supposed to be exposed to libc clients.
static const uint32_t ST_VALID = 0x0020;
EXPECT_TRUE((sb.f_flags & ST_VALID) == 0) << sb.f_flags;
}
TEST(sys_vfs, statfs) {
@@ -52,6 +57,7 @@ TEST(sys_vfs, fstatfs) {
close(fd);
Check(sb);
}
TEST(sys_vfs, fstatfs64) {
struct statfs64 sb;
int fd = open("/proc", O_RDONLY);