svn commit: r349712 - stable/12/sys/kern

Justin Hibbits jhibbits at FreeBSD.org
Wed Jul 3 21:30:19 UTC 2019


Author: jhibbits
Date: Wed Jul  3 21:30:18 2019
New Revision: 349712
URL: https://svnweb.freebsd.org/changeset/base/349712

Log:
  MFC r348299
  
  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.

Modified:
  stable/12/sys/kern/kern_ctf.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_ctf.c
==============================================================================
--- stable/12/sys/kern/kern_ctf.c	Wed Jul  3 21:05:40 2019	(r349711)
+++ stable/12/sys/kern/kern_ctf.c	Wed Jul  3 21:30:18 2019	(r349712)
@@ -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;


More information about the svn-src-stable-12 mailing list