diff options
author | Yann Sionneau <ysionneau@kalray.eu> | 2020-09-15 14:45:24 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2020-09-15 15:26:34 +0200 |
commit | 50bd6d06e3f2cca57bd20cf4345993ceff8c97dd (patch) | |
tree | b886e12147ed545fe2c438a7124118c54bc744f0 /libm/k_standard.c | |
parent | 08d46f1ce21e4ec51b2b1626beeaea6cbe7fdc6b (diff) |
Fix memory corruption due to struct stat field
Kernel stat/stat64 structure and uClibc-ng ones were not
in sync regarding the timespec fields.
Kernel had them but uClibc did not expose it in some cases.
Man page says that stat struct should have timespec fields if:
* _POSIX_C_SOURCE is defined to 200809L or greater
or
* _XOPEN_SOURCE is defined to 700 or greater
or
* _BSD_SOURCE is defined
or
* _SVID_SOURCE is defined
In the case of buildroot vim build, neither _BSD_SOURCE nor _SVID_SOURCE were defined.
Only _POSIX_C_SOURCE and _XOPEN_SOURCE were defined.
uClibc-ng header only checked for _BSD_SOURCE and _SVID_SOURCE via __USE_MISC.
This patch adds a check to __USE_XOPEN2K8 which is defined
if _POSIX_C_SOURCE >= 200809L or _XOPEN_SOURCE >= 700
This for instance fixes a crash at startup of vim (not the busybox one) on aarch64 and all other
arch where in kernel STAT_HAVE_NSEC is set and where stat.h in uClibc-ng comes from libc/sysdeps/linux/common-generic/bits
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
Diffstat (limited to 'libm/k_standard.c')
0 files changed, 0 insertions, 0 deletions