Skip to content

Commit 88bf435

Browse files
committed
lkl: Fix up libhijack stat ABI
We are hijacking `stat`, where the size of the target struct is dependent on the wordsize. Delegating to `__xstat64` is incorrect, as it unconditionally uses the stat64 layout and will result in an out-of-bounds write on 32-bit architectures. Additionally, the specification claims that the version must be specified as 3 or the behavior is undefined (contradicting the existing version specified as 0). Fix the issue by delegating to the normal `stat` symbol instead, which (while not having the version number interface) should be compatible with whatever the underlying libc expects. This also fully sidesteps the issue of replicating the version number interface. Fixes: d4b9b65 ("lkl: update dpdk version to 17.02 from 2.2") Signed-off-by: Tim Schumacher <[email protected]>
1 parent 1219089 commit 88bf435

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/lkl/lib/hijack/hijack.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -587,11 +587,11 @@ void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)
587587
}
588588

589589
#ifndef __ANDROID__
590-
HOST_CALL(__xstat64)
590+
HOST_CALL(stat)
591591
int stat(const char *pathname, struct stat *buf)
592592
{
593-
CHECK_HOST_CALL(__xstat64);
594-
return host___xstat64(0, pathname, buf);
593+
CHECK_HOST_CALL(stat);
594+
return host_stat(pathname, buf);
595595
}
596596
#endif
597597

0 commit comments

Comments
 (0)