Author: jhibbits
Date: Mon May 27 04:20:31 2019
New Revision: 348299
URL: https://svnweb.freebsd.org/changeset/base/348299

Log:
  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

Modified:
  head/sys/kern/kern_ctf.c

Modified: head/sys/kern/kern_ctf.c
==============================================================================
--- head/sys/kern/kern_ctf.c    Mon May 27 03:18:56 2019        (r348298)
+++ head/sys/kern/kern_ctf.c    Mon May 27 04:20:31 2019        (r348299)
@@ -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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to