aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_ctf.c
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2019-05-27 04:20:31 +0000
committerJustin Hibbits <jhibbits@FreeBSD.org>2019-05-27 04:20:31 +0000
commita5868885fa8c919edc2f01d1816ce6e08896b59e (patch)
tree8f8ad78a6bec25687fe8ad0b480ec8c3c3f25314 /sys/kern/kern_ctf.c
parentb2aea1ad8f670340d85b3813ab0b4a9a4b091668 (diff)
downloadsrc-a5868885fa8c919edc2f01d1816ce6e08896b59e.tar.gz
src-a5868885fa8c919edc2f01d1816ce6e08896b59e.zip
kern/CTF: link_elf_ctf_get() on big endian platforms
Check the CTF magic number in big endian platforms. This lets DTrace FBT handle types correctly on these platforms. Submitted by: Brandon Bergren MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20413
Notes
Notes: svn path=/head/; revision=348299
Diffstat (limited to 'sys/kern/kern_ctf.c')
-rw-r--r--sys/kern/kern_ctf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_ctf.c b/sys/kern/kern_ctf.c
index 1a63dc5ba31c..74ec15400cf3 100644
--- a/sys/kern/kern_ctf.c
+++ b/sys/kern/kern_ctf.c
@@ -193,8 +193,12 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc)
NOCRED, NULL, td)) != 0)
goto out;
- /* Check the CTF magic number. (XXX check for big endian!) */
+ /* Check the CTF magic number. */
+#ifdef __LITTLE_ENDIAN__
if (ctf_hdr[0] != 0xf1 || ctf_hdr[1] != 0xcf) {
+#else
+ if (ctf_hdr[0] != 0xcf || ctf_hdr[1] != 0xf1) {
+#endif
printf("%s(%d): module %s has invalid format\n",
__func__, __LINE__, lf->pathname);
error = EFTYPE;