svn commit: r314851 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Tue Mar 7 13:38:27 UTC 2017
Author: kib
Date: Tue Mar 7 13:38:25 2017
New Revision: 314851
URL: https://svnweb.freebsd.org/changeset/base/314851
Log:
When selecting brand based on old Elf branding, prefer the brand which
interpreter exactly matches the one requested by the activated image.
This change applies r295277, which did the same for note branding, to
the old brand selection, with the same reasoning of fixing compat32
interpreter substitution.
PR: 211837
Reported by: kenji at kens.fm
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Modified:
head/sys/kern/imgact_elf.c
Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c Tue Mar 7 13:37:35 2017 (r314850)
+++ head/sys/kern/imgact_elf.c Tue Mar 7 13:38:25 2017 (r314851)
@@ -312,10 +312,23 @@ __elfN(get_brandinfo)(struct image_param
strcmp((const char *)&hdr->e_ident[OLD_EI_BRAND],
bi->compat_3_brand) == 0)) {
/* Looks good, but give brand a chance to veto */
- if (!bi->header_supported || bi->header_supported(imgp))
- return (bi);
+ if (!bi->header_supported ||
+ bi->header_supported(imgp)) {
+ /*
+ * Again, prefer strictly matching
+ * interpreter path.
+ */
+ if (strlen(bi->interp_path) + 1 ==
+ interp_name_len && strncmp(interp,
+ bi->interp_path, interp_name_len) == 0)
+ return (bi);
+ if (bi_m == NULL)
+ bi_m = bi;
+ }
}
}
+ if (bi_m != NULL)
+ return (bi_m);
/* No known brand, see if the header is recognized by any brand */
for (i = 0; i < MAX_BRANDS; i++) {
More information about the svn-src-head
mailing list