about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2019-12-22 11:20:44 -0500
committerRich Felker <dalias@aerifal.cx>2019-12-22 11:20:44 -0500
commit3f959f6f76f16b7d954a6d8a134f3c30228d3be0 (patch)
treef8801aace9ef433e36729ab4c76300f58f767e52 /include
parent4d706410779f399e5969439f6005abcee553b01d (diff)
downloadmusl-3f959f6f76f16b7d954a6d8a134f3c30228d3be0.tar.gz
musl-3f959f6f76f16b7d954a6d8a134f3c30228d3be0.tar.xz
musl-3f959f6f76f16b7d954a6d8a134f3c30228d3be0.zip
fix elf_prstatus regression on time64, existing wrong definition on x32
the elf_prstatus structure is used in core dumps, and the timeval
structures in it are longs matching the elf class, *not* the kernel
"old timeval" for the arch. this means using timeval here for x32 was
always wrong, despite kernel uapi headers and glibc also exposing it
this way, and of course it's wrong for any arch with 64-bit time_t.

rather than just changing the type on affected archs, use a tagless
struct containing long tv_sec and tv_usec members in place of the
timevals. this intentionally breaks use of them as timevals (e.g.
assignment, passing address, etc.) on 64-bit archs as well so that any
usage unsafe for 32-bit archs is caught even in software that only
gets tested on 64-bit archs. from what I could gather, there is not
any software using these members anyway. the only reason they need to
be fixed to begin with is that the only members which are commonly
used, the saved registers, follow the time members and have the wrong
offset if the time members are sized incorrectly.
Diffstat (limited to 'include')
-rw-r--r--include/sys/procfs.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/sys/procfs.h b/include/sys/procfs.h
index e23bf1ad..38e58c16 100644
--- a/include/sys/procfs.h
+++ b/include/sys/procfs.h
@@ -23,10 +23,9 @@ struct elf_prstatus {
 	pid_t pr_ppid;
 	pid_t pr_pgrp;
 	pid_t pr_sid;
-	struct timeval pr_utime;
-	struct timeval pr_stime;
-	struct timeval pr_cutime;
-	struct timeval pr_cstime;
+	struct {
+		long tv_sec, tv_usec;
+	} pr_utime, pr_stime, pr_cutime, pr_cstime;
 	elf_gregset_t pr_reg;
 	int pr_fpvalid;
 };