Date: Tue, 14 Mar 2017 10:09:50 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315241 - stable/11/sys/kern Message-ID: <201703141009.v2EA9oM8070990@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Mar 14 10:09:50 2017 New Revision: 315241 URL: https://svnweb.freebsd.org/changeset/base/315241 Log: MFC r314851: When selecting brand based on old Elf branding, prefer the brand which interpreter exactly matches the one requested by the activated image. Modified: stable/11/sys/kern/imgact_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Tue Mar 14 10:08:12 2017 (r315240) +++ stable/11/sys/kern/imgact_elf.c Tue Mar 14 10:09:50 2017 (r315241) @@ -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++) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703141009.v2EA9oM8070990>