aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2013-04-22 04:41:27 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-04-23 04:18:18 -0400
commitb8668fd0a7e1b59ff4fd33b65e7f6d46b2d3cf1c (patch)
tree4b8f9fefa6decf7a852a03d29c4da59163c3556b /arch/s390/include/asm
parent186f50fa568a221fdabd6753341c2de4abd24b78 (diff)
s390/uapi: change struct statfs[64] member types to unsigned values
Kay Sievers reported that coreutils' stat tool has a problem with s390's statfs[64] definition: > The definition of struct statfs::f_type needs a fix. s390 is the only > architecture in the kernel that uses an int and expects magic > constants lager than INT_MAX to fit into. > > A fix is needed to make Fedora boot on s390, it currently fails to do > so. Userspace does not want to add code to paper-over this issue. [...] > Even coreutils cannot handle it: > #define RAMFS_MAGIC 0x858458f6 > # stat -f -c%t / > ffffffff858458f6 > > #define BTRFS_SUPER_MAGIC 0x9123683E > # stat -f -c%t /mnt > ffffffff9123683e The bug is caused by an implicit sign extension within the stat tool: out_uint_x (pformat, prefix_len, statfsbuf->f_type); where the format finally will be "%lx". A similar problem can be found in the 'tail' tool. s390 is the only architecture which has an int type f_type member in struct statfs[64]. Other architectures have either unsigned ints or long values, so that the problem doesn't occur there. Therefore change the type of the f_type member to unsigned int, so that we get zero extension instead of sign extension when assignment to a long value happens. This patch changes the s390 uapi struct stafs[64] definition in the kernel to contain only unsigned values. This was true for 32 bit builds anyway, since we use the generic uapi header file in that case. So lets not include conditionally the generic uapi header file but have the s390 implementation completely independent. Also fix the types of struct compat_stafs to match reality and move the definition of struct compat_statfs64 to asm/compat.h since it is not part of the api. Reported-by: Kay Sievers <kay@vrfy.org> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include/asm')
-rw-r--r--arch/s390/include/asm/compat.h37
1 files changed, 26 insertions, 11 deletions
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index da3df9f6eded..c1e7c646727c 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -140,18 +140,33 @@ struct compat_flock64 {
140}; 140};
141 141
142struct compat_statfs { 142struct compat_statfs {
143 s32 f_type; 143 u32 f_type;
144 s32 f_bsize; 144 u32 f_bsize;
145 s32 f_blocks; 145 u32 f_blocks;
146 s32 f_bfree; 146 u32 f_bfree;
147 s32 f_bavail; 147 u32 f_bavail;
148 s32 f_files; 148 u32 f_files;
149 s32 f_ffree; 149 u32 f_ffree;
150 compat_fsid_t f_fsid; 150 compat_fsid_t f_fsid;
151 s32 f_namelen; 151 u32 f_namelen;
152 s32 f_frsize; 152 u32 f_frsize;
153 s32 f_flags; 153 u32 f_flags;
154 s32 f_spare[4]; 154 u32 f_spare[4];
155};
156
157struct compat_statfs64 {
158 u32 f_type;
159 u32 f_bsize;
160 u64 f_blocks;
161 u64 f_bfree;
162 u64 f_bavail;
163 u64 f_files;
164 u64 f_ffree;
165 compat_fsid_t f_fsid;
166 u32 f_namelen;
167 u32 f_frsize;
168 u32 f_flags;
169 u32 f_spare[4];
155}; 170};
156 171
157#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff 172#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff