[Bug server/34567] New: remote fileio: st_ino truncated to 32 bits in vFile:stat/lstat reply
abhay at sourceware dot org via Gdb-prs <[email protected]>
| Newsgroups | gmane.comp.gdb.bugs.discuss |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://sourceware.org/bugzilla/show_bug.cgi?id=34567
Bug ID: 34567
Summary: remote fileio: st_ino truncated to 32 bits in
vFile:stat/lstat reply
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: server
Assignee: unassigned at sourceware dot org
Reporter: abhay at sourceware dot org
Target Milestone: ---
gdb.server/fileio-packets.exp fails on filesystems whose inode numbers
exceed 2^32. The st_ino value returned by vFile:stat and vFile:lstat is
truncated to 32 bits and no longer matches the value the same file
reports locally.
FAIL: gdb.server/fileio-packets.exp: check remote lstat works on a normal
file
FAIL: gdb.server/fileio-packets.exp: check remote lstat works on a symbolic
link
FAIL: gdb.server/fileio-packets.exp: check remote stat works on a normal file
FAIL: gdb.server/fileio-packets.exp: check remote stat works on a symbolic
link
Every field matches except st_ino:
remote = {'st_dev': 2304, 'st_ino': 2161233200, 'st_mode': 33188, 'st_nlink':
1, 'st_uid': 1023, 'st_gid': 1023, 'st_rdev': 0, 'st_size': 0, 'st_blksize':
65536, 'st_blocks': 0, 'st_atime': 1787650798, 'st_mtime': 1787650798,
'st_ctime': 1787650798}
local = {'st_dev': 2304, 'st_ino': 122420317488, 'st_mode': 33188,
'st_nlink': 1, 'st_uid': 1023, 'st_gid': 1023, 'st_rdev': 0, 'st_size': 0,
'st_blksize': 65536, 'st_blocks': 0, 'st_atime': 1787650798, 'st_mtime':
1787650798, 'st_ctime': 1787650798}
122420317488 = 0x1C80CE9BB0
2161233200 = 0x80CE9BB0
The low 32 bits are identical; the high bits are dropped.
The protocol struct declares the field as 4 bytes, while st_ino is 64-bit
on Linux:
gdbsupport/fileio.h:130 fio_uint_t fst_ino;
gdbsupport/fileio.cc:281 host_to_fileio_uint ((long) st->st_ino,
fst->fst_ino);
gdb/remote-fileio.c:1206 st->st_ino = remote_fileio_to_host_uint
(fst->fst_ino);
fst_size, fst_blksize and fst_blocks in the same struct already use the
8-byte fio_ulong_t, so the wide type exists; fst_ino simply does not use
it.
Whether the truncation is visible depends on the filesystem:
ext4 on 2 TB largest inode under /home: 132907009 PASS
xfs on 86 TB largest inode under /home: 171801755018 FAIL
On the xfs volume essentially every file exceeds 2^32, so the failure is
not intermittent. Both hosts are powerpc64le-unknown-linux-gnu running
GDB 19.0.50.20260825-git against a local gdbserver; the failing host is
the xfs one.
Note that struct fio_stat is shared between the vFile packets and the
older F-packet file-I/O protocol, so widening fst_ino changes the wire
layout for both. Possible approaches: widen the shared field; add a
separate wider struct used only by the vFile packets (which were added
in GDB 16); or negotiate the wider format via qSupported.
Related, not covered by this report: fst_dev and fst_rdev are also
fio_uint_t although dev_t is 64-bit, and fst_atime/fst_mtime/fst_ctime
are 4 bytes, which is a year-2038 problem.
--
You are receiving this mail because:
You are on the CC list for the bug.