Date: Mon, 28 Aug 2017 00:05:24 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r322958 - in projects/runtime-coverage: . contrib/cortex-strings/src/aarch64 lib/libc/gen lib/libc/locale sbin/geom/class/eli sys/amd64/amd64 sys/boot/efi/boot1 sys/boot/efi/include sys... Message-ID: <201708280005.v7S05Ond027732@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Mon Aug 28 00:05:24 2017 New Revision: 322958 URL: https://svnweb.freebsd.org/changeset/base/322958 Log: MFhead@r322957 Added: projects/runtime-coverage/sys/boot/efi/loader/efi_main.c - copied unchanged from r322957, head/sys/boot/efi/loader/efi_main.c Modified: projects/runtime-coverage/Makefile.inc1 projects/runtime-coverage/UPDATING projects/runtime-coverage/contrib/cortex-strings/src/aarch64/memcpy.S projects/runtime-coverage/lib/libc/gen/fnmatch.c projects/runtime-coverage/lib/libc/locale/setlocale.c projects/runtime-coverage/lib/libc/locale/setrunelocale.c projects/runtime-coverage/sbin/geom/class/eli/geli.8 projects/runtime-coverage/sbin/geom/class/eli/geom_eli.c projects/runtime-coverage/sys/amd64/amd64/cpu_switch.S projects/runtime-coverage/sys/amd64/amd64/exception.S projects/runtime-coverage/sys/boot/efi/boot1/Makefile projects/runtime-coverage/sys/boot/efi/boot1/boot1.c projects/runtime-coverage/sys/boot/efi/boot1/boot_module.h projects/runtime-coverage/sys/boot/efi/boot1/ufs_module.c projects/runtime-coverage/sys/boot/efi/boot1/zfs_module.c projects/runtime-coverage/sys/boot/efi/include/efiapi.h projects/runtime-coverage/sys/boot/efi/include/efidevp.h projects/runtime-coverage/sys/boot/efi/include/efilib.h projects/runtime-coverage/sys/boot/efi/libefi/libefi.c projects/runtime-coverage/sys/boot/efi/loader/Makefile projects/runtime-coverage/sys/boot/geli/geliboot.c projects/runtime-coverage/sys/boot/geli/geliboot.h projects/runtime-coverage/sys/boot/geli/geliboot_crypto.c projects/runtime-coverage/sys/boot/geli/geliboot_internal.h projects/runtime-coverage/sys/boot/geli/pwgets.c projects/runtime-coverage/sys/boot/i386/libi386/biosdisk.c projects/runtime-coverage/sys/dev/mpr/mpr.c projects/runtime-coverage/sys/dev/mpr/mpr_mapping.c projects/runtime-coverage/sys/dev/mpr/mpr_sas.c projects/runtime-coverage/sys/dev/mpr/mpr_sas_lsi.c projects/runtime-coverage/sys/dev/mpr/mpr_user.c projects/runtime-coverage/sys/dev/mps/mps.c projects/runtime-coverage/sys/dev/mps/mps_mapping.c projects/runtime-coverage/sys/dev/mps/mps_sas.c projects/runtime-coverage/sys/dev/mps/mps_sas_lsi.c projects/runtime-coverage/sys/dev/mps/mps_user.c projects/runtime-coverage/sys/dev/ppc/ppc_pci.c projects/runtime-coverage/sys/dev/rtwn/rtl8188e/r88e.h projects/runtime-coverage/sys/dev/rtwn/rtl8188e/r88e_chan.c projects/runtime-coverage/sys/dev/rtwn/rtl8192c/r92c.h projects/runtime-coverage/sys/dev/rtwn/rtl8192c/r92c_chan.c projects/runtime-coverage/sys/dev/rtwn/rtl8192c/r92c_var.h projects/runtime-coverage/sys/dev/rtwn/rtl8192e/r92e_chan.c projects/runtime-coverage/sys/geom/eli/g_eli.c projects/runtime-coverage/sys/geom/eli/g_eli.h projects/runtime-coverage/sys/geom/eli/g_eli_ctl.c projects/runtime-coverage/sys/geom/geom_subr.c projects/runtime-coverage/sys/i386/i386/trap.c projects/runtime-coverage/sys/kern/kern_sysctl.c projects/runtime-coverage/sys/kern/subr_smp.c projects/runtime-coverage/sys/net80211/ieee80211_output.c Directory Properties: projects/runtime-coverage/ (props changed) Modified: projects/runtime-coverage/Makefile.inc1 ============================================================================== --- projects/runtime-coverage/Makefile.inc1 Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/Makefile.inc1 Mon Aug 28 00:05:24 2017 (r322958) @@ -1985,8 +1985,12 @@ _gcc_tools= gnu/usr.bin/cc/cc_tools _rescue=rescue/rescue .endif +.if ${MK_TCSH} != "no" +_tcsh=bin/csh +.endif + .for _tool in \ - bin/csh \ + ${_tcsh} \ bin/sh \ ${LOCAL_TOOL_DIRS} \ lib/ncurses/ncurses \ @@ -2151,7 +2155,7 @@ native-xtools: .PHONY bin/cat \ bin/chmod \ bin/cp \ - bin/csh \ + ${_tcsh} \ bin/echo \ bin/expr \ bin/hostname \ Modified: projects/runtime-coverage/UPDATING ============================================================================== --- projects/runtime-coverage/UPDATING Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/UPDATING Mon Aug 28 00:05:24 2017 (r322958) @@ -51,6 +51,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20170826: + During boot the geli passphrase will be hidden. To restore previous + behavior see geli(8) configuration options. + 20170825: Move PMTUD blackhole counters to TCPSTATS and remove them from bare sysctl values. Minor nit, but requires a rebuild of both world/kernel Modified: projects/runtime-coverage/contrib/cortex-strings/src/aarch64/memcpy.S ============================================================================== --- projects/runtime-coverage/contrib/cortex-strings/src/aarch64/memcpy.S Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/contrib/cortex-strings/src/aarch64/memcpy.S Mon Aug 28 00:05:24 2017 (r322958) @@ -77,8 +77,8 @@ #define D_h x13 #define E_l src #define E_h count -#define F_l srcend -#define F_h dst +#define F_l dst +#define F_h srcend #define tmp1 x9 #define L(l) .L ## l Modified: projects/runtime-coverage/lib/libc/gen/fnmatch.c ============================================================================== --- projects/runtime-coverage/lib/libc/gen/fnmatch.c Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/lib/libc/gen/fnmatch.c Mon Aug 28 00:05:24 2017 (r322958) @@ -249,7 +249,7 @@ rangematch(const char *pattern, wchar_t test, int flag * consistency with the regular expression syntax. * J.T. Conklin (conklin@ngai.kaleida.com) */ - if ( (negate = (*pattern == '!' || *pattern == '^')) ) + if ((negate = (*pattern == '!' || *pattern == '^'))) ++pattern; if (flags & FNM_CASEFOLD) Modified: projects/runtime-coverage/lib/libc/locale/setlocale.c ============================================================================== --- projects/runtime-coverage/lib/libc/locale/setlocale.c Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/lib/libc/locale/setlocale.c Mon Aug 28 00:05:24 2017 (r322958) @@ -42,48 +42,48 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <limits.h> #include <locale.h> -#include <paths.h> /* for _PATH_LOCALE */ +#include <paths.h> /* for _PATH_LOCALE */ #include <stdlib.h> #include <string.h> #include <unistd.h> #include "collate.h" -#include "lmonetary.h" /* for __monetary_load_locale() */ -#include "lnumeric.h" /* for __numeric_load_locale() */ -#include "lmessages.h" /* for __messages_load_locale() */ +#include "lmonetary.h" /* for __monetary_load_locale() */ +#include "lnumeric.h" /* for __numeric_load_locale() */ +#include "lmessages.h" /* for __messages_load_locale() */ #include "setlocale.h" #include "ldpart.h" -#include "../stdtime/timelocal.h" /* for __time_load_locale() */ +#include "../stdtime/timelocal.h" /* for __time_load_locale() */ /* * Category names for getenv() */ static const char categories[_LC_LAST][12] = { - "LC_ALL", - "LC_COLLATE", - "LC_CTYPE", - "LC_MONETARY", - "LC_NUMERIC", - "LC_TIME", - "LC_MESSAGES", + "LC_ALL", + "LC_COLLATE", + "LC_CTYPE", + "LC_MONETARY", + "LC_NUMERIC", + "LC_TIME", + "LC_MESSAGES", }; /* * Current locales for each category */ static char current_categories[_LC_LAST][ENCODING_LEN + 1] = { - "C", - "C", - "C", - "C", - "C", - "C", - "C", + "C", + "C", + "C", + "C", + "C", + "C", + "C", }; /* * Path to locale storage directory */ -char *_PathLocale; +char *_PathLocale; /* * The locales we are going to try and load @@ -93,21 +93,20 @@ static char saved_categories[_LC_LAST][ENCODING_LEN + static char current_locale_string[_LC_LAST * (ENCODING_LEN + 1/*"/"*/ + 1)]; -static char *currentlocale(void); -static char *loadlocale(int); +static char *currentlocale(void); +static char *loadlocale(int); const char *__get_locale_env(int); char * setlocale(int category, const char *locale) { int i, j, len, saverr; - const char *env, *r; + const char *env, *r; if (category < LC_ALL || category >= _LC_LAST) { errno = EINVAL; return (NULL); } - if (locale == NULL) return (category != LC_ALL ? current_categories[category] : currentlocale()); @@ -162,13 +161,13 @@ setlocale(int category, const char *locale) } do { if (i == _LC_LAST) - break; /* Too many slashes... */ + break; /* Too many slashes... */ if ((len = r - locale) > ENCODING_LEN) { errno = EINVAL; return (NULL); } (void)strlcpy(new_categories[i], locale, - len + 1); + len + 1); i++; while (*r == '/') r++; @@ -178,7 +177,7 @@ setlocale(int category, const char *locale) } while (*locale); while (i < _LC_LAST) { (void)strcpy(new_categories[i], - new_categories[i-1]); + new_categories[i - 1]); i++; } } @@ -193,7 +192,7 @@ setlocale(int category, const char *locale) saverr = errno; for (j = 1; j < i; j++) { (void)strcpy(new_categories[j], - saved_categories[j]); + saved_categories[j]); if (loadlocale(j) == NULL) { (void)strcpy(new_categories[j], "C"); (void)loadlocale(j); @@ -218,7 +217,7 @@ currentlocale(void) for (i = 2; i < _LC_LAST; ++i) { (void)strcat(current_locale_string, "/"); (void)strcat(current_locale_string, - current_categories[i]); + current_categories[i]); } break; } @@ -230,16 +229,15 @@ loadlocale(int category) { char *new = new_categories[category]; char *old = current_categories[category]; - int (*func)(const char *); + int (*func) (const char *); int saved_errno; if ((new[0] == '.' && - (new[1] == '\0' || (new[1] == '.' && new[2] == '\0'))) || + (new[1] == '\0' || (new[1] == '.' && new[2] == '\0'))) || strchr(new, '/') != NULL) { errno = EINVAL; return (NULL); } - saved_errno = errno; errno = __detect_path_locale(); if (errno != 0) @@ -285,22 +283,22 @@ loadlocale(int category) const char * __get_locale_env(int category) { - const char *env; + const char *env; - /* 1. check LC_ALL. */ - env = getenv(categories[0]); + /* 1. check LC_ALL. */ + env = getenv(categories[0]); - /* 2. check LC_* */ + /* 2. check LC_* */ if (env == NULL || !*env) - env = getenv(categories[category]); + env = getenv(categories[category]); - /* 3. check LANG */ + /* 3. check LANG */ if (env == NULL || !*env) - env = getenv("LANG"); + env = getenv("LANG"); - /* 4. if none is set, fall to "C" */ + /* 4. if none is set, fall to "C" */ if (env == NULL || !*env) - env = "C"; + env = "C"; return (env); } @@ -326,4 +324,3 @@ __detect_path_locale(void) } return (0); } - Modified: projects/runtime-coverage/lib/libc/locale/setrunelocale.c ============================================================================== --- projects/runtime-coverage/lib/libc/locale/setrunelocale.c Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/lib/libc/locale/setrunelocale.c Mon Aug 28 00:05:24 2017 (r322958) @@ -38,7 +38,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#define __RUNETYPE_INTERNAL 1 +#define __RUNETYPE_INTERNAL 1 #include <runetype.h> #include <errno.h> @@ -72,7 +72,7 @@ destruct_ctype(void *v) { struct xlocale_ctype *l = v; - if (&_DefaultRuneLocale != l->runes) + if (&_DefaultRuneLocale != l->runes) free(l->runes); free(l); } @@ -81,7 +81,7 @@ const _RuneLocale * __getCurrentRuneLocale(void) { - return XLOCALE_CTYPE(__get_locale())->runes; + return (XLOCALE_CTYPE(__get_locale())->runes); } static void @@ -144,7 +144,7 @@ __setrunelocale(struct xlocale_ctype *l, const char *e else if (strcmp(rl->__encoding, "EUC-TW") == 0) ret = _EUC_TW_init(l, rl); else if (strcmp(rl->__encoding, "GB18030") == 0) - ret = _GB18030_init(l, rl); + ret = _GB18030_init(l, rl); else if (strcmp(rl->__encoding, "GB2312") == 0) ret = _GB2312_init(l, rl); else if (strcmp(rl->__encoding, "GBK") == 0) @@ -204,10 +204,9 @@ __ctype_load(const char *locale, locale_t unused __unu struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1); l->header.header.destructor = destruct_ctype; - if (__setrunelocale(l, locale)) - { + if (__setrunelocale(l, locale)) { free(l); - return NULL; + return (NULL); } - return l; + return (l); } Modified: projects/runtime-coverage/sbin/geom/class/eli/geli.8 ============================================================================== --- projects/runtime-coverage/sbin/geom/class/eli/geli.8 Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/sbin/geom/class/eli/geli.8 Mon Aug 28 00:05:24 2017 (r322958) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 3, 2016 +.Dd August 26, 2017 .Dt GELI 8 .Os .Sh NAME @@ -51,7 +51,7 @@ utility: .Pp .Nm .Cm init -.Op Fl bgPTv +.Op Fl bdgPTv .Op Fl a Ar aalgo .Op Fl B Ar backupfile .Op Fl e Ar ealgo @@ -88,7 +88,7 @@ utility: .Ar prov .Nm .Cm configure -.Op Fl bBgGtT +.Op Fl bBdDgGtT .Ar prov ... .Nm .Cm setkey @@ -279,6 +279,9 @@ To inhibit backups, you can use .Pa none as the .Ar backupfile . +.It Fl d +While booting from this encrypted root filesystem enable visibility of +passphrase length. .It Fl e Ar ealgo Encryption algorithm to use. Currently supported algorithms are: @@ -490,6 +493,12 @@ For more information, see the description of the subcommand. .It Fl B Remove the BOOT flag from the given providers. +.It Fl d +While booting from this encrypted root filesystem enable visibility of +passphrase length. +.It Fl D +While booting from this encrypted root filesystem disable visibility of +passphrase length. .It Fl g Enable booting from this encrypted root filesystem. The boot loader prompts for the passphrase and loads Modified: projects/runtime-coverage/sbin/geom/class/eli/geom_eli.c ============================================================================== --- projects/runtime-coverage/sbin/geom/class/eli/geom_eli.c Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/sbin/geom/class/eli/geom_eli.c Mon Aug 28 00:05:24 2017 (r322958) @@ -82,7 +82,7 @@ static int eli_backup_create(struct gctl_req *req, con /* * Available commands: * - * init [-bgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov + * init [-bdgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov * label - alias for 'init' * attach [-dprv] [-j passfile] [-k keyfile] prov * detach [-fl] prov ... @@ -107,6 +107,7 @@ struct g_command class_commands[] = { { 'a', "aalgo", "", G_TYPE_STRING }, { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, + { 'd', "displaypass", NULL, G_TYPE_BOOL }, { 'e', "ealgo", "", G_TYPE_STRING }, { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, @@ -119,13 +120,14 @@ struct g_command class_commands[] = { { 'V', "mdversion", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - "[-bgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" + "[-bdgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" }, { "label", G_FLAG_VERBOSE, eli_main, { { 'a', "aalgo", "", G_TYPE_STRING }, { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, + { 'd', "displaypass", NULL, G_TYPE_BOOL }, { 'e', "ealgo", "", G_TYPE_STRING }, { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, @@ -182,13 +184,15 @@ struct g_command class_commands[] = { { { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "noboot", NULL, G_TYPE_BOOL }, + { 'd', "displaypass", NULL, G_TYPE_BOOL }, + { 'D', "nodisplaypass", NULL, G_TYPE_BOOL }, { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'G', "nogeliboot", NULL, G_TYPE_BOOL }, { 't', "trim", NULL, G_TYPE_BOOL }, { 'T', "notrim", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - "[-bBgGtT] prov ..." + "[-bBdDgGtT] prov ..." }, { "setkey", G_FLAG_VERBOSE, eli_main, { @@ -708,6 +712,8 @@ eli_init(struct gctl_req *req) md.md_flags |= G_ELI_FLAG_BOOT; if (gctl_get_int(req, "geliboot")) md.md_flags |= G_ELI_FLAG_GELIBOOT; + if (gctl_get_int(req, "displaypass")) + md.md_flags |= G_ELI_FLAG_GELIDISPLAYPASS; if (gctl_get_int(req, "notrim")) md.md_flags |= G_ELI_FLAG_NODELETE; md.md_ealgo = CRYPTO_ALGORITHM_MIN - 1; @@ -912,7 +918,7 @@ eli_attach(struct gctl_req *req) static void eli_configure_detached(struct gctl_req *req, const char *prov, int boot, - int geliboot, int trim) + int geliboot, int displaypass, int trim) { struct g_eli_metadata md; bool changed = 0; @@ -948,6 +954,21 @@ eli_configure_detached(struct gctl_req *req, const cha changed = 1; } + if (displaypass == 1 && (md.md_flags & G_ELI_FLAG_GELIDISPLAYPASS)) { + if (verbose) + printf("GELIDISPLAYPASS flag already configured for %s.\n", prov); + } else if (displaypass == 0 && + !(md.md_flags & G_ELI_FLAG_GELIDISPLAYPASS)) { + if (verbose) + printf("GELIDISPLAYPASS flag not configured for %s.\n", prov); + } else if (displaypass >= 0) { + if (displaypass) + md.md_flags |= G_ELI_FLAG_GELIDISPLAYPASS; + else + md.md_flags &= ~G_ELI_FLAG_GELIDISPLAYPASS; + changed = 1; + } + if (trim == 0 && (md.md_flags & G_ELI_FLAG_NODELETE)) { if (verbose) printf("TRIM disable flag already configured for %s.\n", prov); @@ -971,8 +992,9 @@ static void eli_configure(struct gctl_req *req) { const char *prov; - bool boot, noboot, geliboot, nogeliboot, trim, notrim; - int doboot, dogeliboot, dotrim; + bool boot, noboot, geliboot, nogeliboot, displaypass, nodisplaypass; + bool trim, notrim; + int doboot, dogeliboot, dodisplaypass, dotrim; int i, nargs; nargs = gctl_get_int(req, "nargs"); @@ -985,6 +1007,8 @@ eli_configure(struct gctl_req *req) noboot = gctl_get_int(req, "noboot"); geliboot = gctl_get_int(req, "geliboot"); nogeliboot = gctl_get_int(req, "nogeliboot"); + displaypass = gctl_get_int(req, "displaypass"); + nodisplaypass = gctl_get_int(req, "nodisplaypass"); trim = gctl_get_int(req, "trim"); notrim = gctl_get_int(req, "notrim"); @@ -1008,6 +1032,16 @@ eli_configure(struct gctl_req *req) else if (nogeliboot) dogeliboot = 0; + dodisplaypass = -1; + if (displaypass && nodisplaypass) { + gctl_error(req, "Options -d and -D are mutually exclusive."); + return; + } + if (displaypass) + dodisplaypass = 1; + else if (nodisplaypass) + dodisplaypass = 0; + dotrim = -1; if (trim && notrim) { gctl_error(req, "Options -t and -T are mutually exclusive."); @@ -1018,7 +1052,8 @@ eli_configure(struct gctl_req *req) else if (notrim) dotrim = 0; - if (doboot == -1 && dogeliboot == -1 && dotrim == -1) { + if (doboot == -1 && dogeliboot == -1 && dodisplaypass == -1 && + dotrim == -1) { gctl_error(req, "No option given."); return; } @@ -1028,8 +1063,10 @@ eli_configure(struct gctl_req *req) /* Now the rest. */ for (i = 0; i < nargs; i++) { prov = gctl_get_ascii(req, "arg%d", i); - if (!eli_is_attached(prov)) - eli_configure_detached(req, prov, doboot, dogeliboot, dotrim); + if (!eli_is_attached(prov)) { + eli_configure_detached(req, prov, doboot, dogeliboot, + dodisplaypass, dotrim); + } } } Modified: projects/runtime-coverage/sys/amd64/amd64/cpu_switch.S ============================================================================== --- projects/runtime-coverage/sys/amd64/amd64/cpu_switch.S Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/sys/amd64/amd64/cpu_switch.S Mon Aug 28 00:05:24 2017 (r322958) @@ -108,7 +108,7 @@ ENTRY(cpu_switch) movl %fs,%eax cmpl $KUF32SEL,%eax jne 1f - rdfsbaseq %rax + rdfsbase %rax movq %rax,PCB_FSBASE(%r8) 1: movl %gs,%eax cmpl $KUG32SEL,%eax Modified: projects/runtime-coverage/sys/amd64/amd64/exception.S ============================================================================== --- projects/runtime-coverage/sys/amd64/amd64/exception.S Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/sys/amd64/amd64/exception.S Mon Aug 28 00:05:24 2017 (r322958) @@ -340,10 +340,10 @@ prot_addrf: jz 2f cmpw $KUF32SEL,TF_FS(%rsp) jne 1f - rdfsbaseq %rax + rdfsbase %rax 1: cmpw $KUG32SEL,TF_GS(%rsp) jne 2f - rdgsbaseq %rdx + rdgsbase %rdx 2: swapgs movq PCPU(CURPCB),%rdi testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) @@ -533,7 +533,7 @@ nmi_fromuserspace: jz 2f cmpw $KUF32SEL,TF_FS(%rsp) jne 1f - rdfsbaseq %rax + rdfsbase %rax movq %rax,PCB_FSBASE(%rdi) 1: cmpw $KUG32SEL,TF_GS(%rsp) jne 2f Modified: projects/runtime-coverage/sys/boot/efi/boot1/Makefile ============================================================================== --- projects/runtime-coverage/sys/boot/efi/boot1/Makefile Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/sys/boot/efi/boot1/Makefile Mon Aug 28 00:05:24 2017 (r322958) @@ -11,7 +11,6 @@ PROG= boot1.sym INTERNALPROG= WARNS?= 6 -.if ${MK_ZFS} != "no" # Disable warnings that are currently incompatible with the zfs boot code CWARNFLAGS.zfs_module.c += -Wno-array-bounds CWARNFLAGS.zfs_module.c += -Wno-cast-align @@ -26,7 +25,6 @@ CWARNFLAGS.skein.c += -Wno-missing-variable-declaratio .else if ${COMPILER_TYPE} == "gcc" CWARNFLAGS.skein.c += -Wno-missing-declarations .endif -.endif # architecture-specific loader code SRCS= boot1.c self_reloc.c start.S ufs_module.c @@ -79,13 +77,15 @@ CFLAGS+= -fPIC LDFLAGS+= -Wl,-znocombreloc .endif +LIBEFI= ${.OBJDIR}/../libefi/libefi.a + # # Add libstand for the runtime functions used by the compiler - for example # __aeabi_* (arm) or __divdi3 (i386). # as well as required string and memory functions for all platforms. # -DPADD+= ${LIBSTAND} -LDADD+= -lstand +DPADD+= ${LIBEFI} ${LIBSTAND} +LDADD+= ${LIBEFI} -lstand DPADD+= ${LDSCRIPT} Modified: projects/runtime-coverage/sys/boot/efi/boot1/boot1.c ============================================================================== --- projects/runtime-coverage/sys/boot/efi/boot1/boot1.c Sun Aug 27 22:13:03 2017 (r322957) +++ projects/runtime-coverage/sys/boot/efi/boot1/boot1.c Mon Aug 28 00:05:24 2017 (r322958) @@ -47,12 +47,6 @@ static const boot_module_t *boot_modules[] = /* The initial number of handles used to query EFI for partitions. */ #define NUM_HANDLES_INIT 24 -EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab); - -EFI_SYSTEM_TABLE *systab; -EFI_BOOT_SERVICES *bs; -static EFI_HANDLE *image; - static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL; static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL; @@ -68,7 +62,7 @@ Malloc(size_t len, const char *file __unused, int line { void *out; - if (bs->AllocatePool(EfiLoaderData, len, &out) == EFI_SUCCESS) + if (BS->AllocatePool(EfiLoaderData, len, &out) == EFI_SUCCESS) return (out); return (NULL); @@ -78,57 +72,10 @@ void Free(void *buf, const char *file __unused, int line __unused) { if (buf != NULL) - (void)bs->FreePool(buf); + (void)BS->FreePool(buf); } /* - * nodes_match returns TRUE if the imgpath isn't NULL and the nodes match, - * FALSE otherwise. - */ -static BOOLEAN -nodes_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) -{ - int len; - - if (imgpath == NULL || imgpath->Type != devpath->Type || - imgpath->SubType != devpath->SubType) - return (FALSE); - - len = DevicePathNodeLength(imgpath); - if (len != DevicePathNodeLength(devpath)) - return (FALSE); - - return (memcmp(imgpath, devpath, (size_t)len) == 0); -} - -/* - * device_paths_match returns TRUE if the imgpath isn't NULL and all nodes - * in imgpath and devpath match up to their respective occurrences of a - * media node, FALSE otherwise. - */ -static BOOLEAN -device_paths_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) -{ - - if (imgpath == NULL) - return (FALSE); - - while (!IsDevicePathEnd(imgpath) && !IsDevicePathEnd(devpath)) { - if (IsDevicePathType(imgpath, MEDIA_DEVICE_PATH) && - IsDevicePathType(devpath, MEDIA_DEVICE_PATH)) - return (TRUE); - - if (!nodes_match(imgpath, devpath)) - return (FALSE); - - imgpath = NextDevicePathNode(imgpath); - devpath = NextDevicePathNode(devpath); - } - - return (FALSE); -} - -/* * devpath_last returns the last non-path end node in devpath. */ static EFI_DEVICE_PATH * @@ -142,178 +89,6 @@ devpath_last(EFI_DEVICE_PATH *devpath) } /* - * devpath_node_str is a basic output method for a devpath node which - * only understands a subset of the available sub types. - * - * If we switch to UEFI 2.x then we should update it to use: - * EFI_DEVICE_PATH_TO_TEXT_PROTOCOL. - */ -static int -devpath_node_str(char *buf, size_t size, EFI_DEVICE_PATH *devpath) -{ - - switch (devpath->Type) { - case MESSAGING_DEVICE_PATH: - switch (devpath->SubType) { - case MSG_ATAPI_DP: { - ATAPI_DEVICE_PATH *atapi; - - atapi = (ATAPI_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "ata(%s,%s,0x%x)", - (atapi->PrimarySecondary == 1) ? "Sec" : "Pri", - (atapi->SlaveMaster == 1) ? "Slave" : "Master", - atapi->Lun); - } - case MSG_USB_DP: { - USB_DEVICE_PATH *usb; - - usb = (USB_DEVICE_PATH *)devpath; - return snprintf(buf, size, "usb(0x%02x,0x%02x)", - usb->ParentPortNumber, usb->InterfaceNumber); - } - case MSG_SCSI_DP: { - SCSI_DEVICE_PATH *scsi; - - scsi = (SCSI_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "scsi(0x%02x,0x%02x)", - scsi->Pun, scsi->Lun); - } - case MSG_SATA_DP: { - SATA_DEVICE_PATH *sata; - - sata = (SATA_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "sata(0x%x,0x%x,0x%x)", - sata->HBAPortNumber, sata->PortMultiplierPortNumber, - sata->Lun); - } - default: - return snprintf(buf, size, "msg(0x%02x)", - devpath->SubType); - } - break; - case HARDWARE_DEVICE_PATH: - switch (devpath->SubType) { - case HW_PCI_DP: { - PCI_DEVICE_PATH *pci; - - pci = (PCI_DEVICE_PATH *)devpath; - return snprintf(buf, size, "pci(0x%02x,0x%02x)", - pci->Device, pci->Function); - } - default: - return snprintf(buf, size, "hw(0x%02x)", - devpath->SubType); - } - break; - case ACPI_DEVICE_PATH: { - ACPI_HID_DEVICE_PATH *acpi; - - acpi = (ACPI_HID_DEVICE_PATH *)(void *)devpath; - if ((acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { - switch (EISA_ID_TO_NUM(acpi->HID)) { - case 0x0a03: - return snprintf(buf, size, "pciroot(0x%x)", - acpi->UID); - case 0x0a08: - return snprintf(buf, size, "pcieroot(0x%x)", - acpi->UID); - case 0x0604: - return snprintf(buf, size, "floppy(0x%x)", - acpi->UID); - case 0x0301: - return snprintf(buf, size, "keyboard(0x%x)", - acpi->UID); - case 0x0501: - return snprintf(buf, size, "serial(0x%x)", - acpi->UID); - case 0x0401: - return snprintf(buf, size, "parallelport(0x%x)", - acpi->UID); - default: - return snprintf(buf, size, "acpi(pnp%04x,0x%x)", - EISA_ID_TO_NUM(acpi->HID), acpi->UID); - } - } - - return snprintf(buf, size, "acpi(0x%08x,0x%x)", acpi->HID, - acpi->UID); - } - case MEDIA_DEVICE_PATH: - switch (devpath->SubType) { - case MEDIA_CDROM_DP: { - CDROM_DEVICE_PATH *cdrom; - - cdrom = (CDROM_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "cdrom(%x)", - cdrom->BootEntry); - } - case MEDIA_HARDDRIVE_DP: { - HARDDRIVE_DEVICE_PATH *hd; - - hd = (HARDDRIVE_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "hd(%x)", - hd->PartitionNumber); - } - default: - return snprintf(buf, size, "media(0x%02x)", - devpath->SubType); - } - case BBS_DEVICE_PATH: - return snprintf(buf, size, "bbs(0x%02x)", devpath->SubType); - case END_DEVICE_PATH_TYPE: - return (0); - } - - return snprintf(buf, size, "type(0x%02x, 0x%02x)", devpath->Type, - devpath->SubType); -} - -/* - * devpath_strlcat appends a text description of devpath to buf but not more - * than size - 1 characters followed by NUL-terminator. - */ -int -devpath_strlcat(char *buf, size_t size, EFI_DEVICE_PATH *devpath) -{ - size_t len, used; - const char *sep; - - sep = ""; - used = 0; - while (!IsDevicePathEnd(devpath)) { - len = snprintf(buf, size - used, "%s", sep); - used += len; - if (used > size) - return (used); - buf += len; - - len = devpath_node_str(buf, size - used, devpath); - used += len; - if (used > size) - return (used); - buf += len; - devpath = NextDevicePathNode(devpath); - sep = ":"; - } - - return (used); -} - -/* - * devpath_str is convenience method which returns the text description of - * devpath using a static buffer, so it isn't thread safe! - */ -char * -devpath_str(EFI_DEVICE_PATH *devpath) -{ - static char buf[256]; - - devpath_strlcat(buf, sizeof(buf), devpath); - - return buf; -} - -/* * load_loader attempts to load the loader image data. * * It tries each module and its respective devices, identified by mod->probe, @@ -400,14 +175,14 @@ try_boot(void) buf = NULL; } - if ((status = bs->LoadImage(TRUE, image, devpath_last(dev->devpath), + if ((status = BS->LoadImage(TRUE, IH, devpath_last(dev->devpath), loaderbuf, loadersize, &loaderhandle)) != EFI_SUCCESS) { printf("Failed to load image provided by %s, size: %zu, (%lu)\n", mod->name, loadersize, EFI_ERROR_CODE(status)); goto errout; } - if ((status = bs->HandleProtocol(loaderhandle, &LoadedImageGUID, + if ((status = BS->HandleProtocol(loaderhandle, &LoadedImageGUID, (VOID**)&loaded_image)) != EFI_SUCCESS) { printf("Failed to query LoadedImage provided by %s (%lu)\n", mod->name, EFI_ERROR_CODE(status)); @@ -433,7 +208,7 @@ try_boot(void) DSTALL(1000000); DPRINTF(".\n"); - if ((status = bs->StartImage(loaderhandle, NULL, NULL)) != + if ((status = BS->StartImage(loaderhandle, NULL, NULL)) != EFI_SUCCESS) { printf("Failed to start image provided by %s (%lu)\n", mod->name, EFI_ERROR_CODE(status)); @@ -467,7 +242,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B UINTN i; /* Figure out if we're dealing with an actual partition. */ - status = bs->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); if (status == EFI_UNSUPPORTED) return (status); @@ -476,10 +251,14 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B EFI_ERROR_CODE(status)); return (status); } - - DPRINTF("probing: %s\n", devpath_str(devpath)); - - status = bs->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); +#ifdef EFI_DEBUG + { + CHAR16 *text = efi_devpath_name(devpath); + DPRINTF("probing: %S\n", text); + efi_free_devpath_name(text); + } +#endif + status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); if (status == EFI_UNSUPPORTED) return (status); @@ -492,11 +271,11 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B if (!blkio->Media->LogicalPartition) return (EFI_UNSUPPORTED); - *preferred = device_paths_match(imgpath, devpath); + *preferred = efi_devpath_match(imgpath, devpath); /* Run through each module, see if it can load this partition */ for (i = 0; i < NUM_BOOT_MODULES; i++) { - if ((status = bs->AllocatePool(EfiLoaderData, + if ((status = BS->AllocatePool(EfiLoaderData, sizeof(*devinfo), (void **)&devinfo)) != EFI_SUCCESS) { DPRINTF("\nFailed to allocate devinfo (%lu)\n", @@ -513,7 +292,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B status = boot_modules[i]->probe(devinfo); if (status == EFI_SUCCESS) return (EFI_SUCCESS); - (void)bs->FreePool(devinfo); + (void)BS->FreePool(devinfo); } return (EFI_UNSUPPORTED); @@ -567,12 +346,13 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) UINTN i, max_dim, best_mode, cols, rows, hsize, nhandles; /* Basic initialization*/ - systab = Xsystab; - image = Ximage; - bs = Xsystab->BootServices; + ST = Xsystab; + IH = Ximage; + BS = ST->BootServices; + RS = ST->RuntimeServices; /* Set up the console, so printf works. */ - status = bs->LocateProtocol(&ConsoleControlGUID, NULL, + status = BS->LocateProtocol(&ConsoleControlGUID, NULL, (VOID **)&ConsoleControl); if (status == EFI_SUCCESS) (void)ConsoleControl->SetMode(ConsoleControl, @@ -580,7 +360,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) /* * Reset the console and find the best text mode. */ - conout = systab->ConOut; + conout = ST->ConOut; conout->Reset(conout, TRUE); max_dim = best_mode = 0; for (i = 0; ; i++) { @@ -609,24 +389,24 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) /* Get all the device handles */ hsize = (UINTN)NUM_HANDLES_INIT * sizeof(EFI_HANDLE); - if ((status = bs->AllocatePool(EfiLoaderData, hsize, (void **)&handles)) + if ((status = BS->AllocatePool(EfiLoaderData, hsize, (void **)&handles)) != EFI_SUCCESS) panic("Failed to allocate %d handles (%lu)", NUM_HANDLES_INIT, EFI_ERROR_CODE(status)); - status = bs->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, + status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, &hsize, handles); switch (status) { case EFI_SUCCESS: break; case EFI_BUFFER_TOO_SMALL: - (void)bs->FreePool(handles); - if ((status = bs->AllocatePool(EfiLoaderData, hsize, + (void)BS->FreePool(handles); + if ((status = BS->AllocatePool(EfiLoaderData, hsize, (void **)&handles)) != EFI_SUCCESS) { panic("Failed to allocate %zu handles (%lu)", hsize / sizeof(*handles), EFI_ERROR_CODE(status)); } - status = bs->LocateHandle(ByProtocol, &BlockIoProtocolGUID, + status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, &hsize, handles); if (status != EFI_SUCCESS) panic("Failed to get device handles (%lu)\n", @@ -643,15 +423,21 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) DPRINTF("\n"); /* Determine the devpath of our image so we can prefer it. */ - status = bs->HandleProtocol(image, &LoadedImageGUID, (VOID**)&img); + status = BS->HandleProtocol(IH, &LoadedImageGUID, (VOID**)&img); imgpath = NULL; if (status == EFI_SUCCESS) { - status = bs->HandleProtocol(img->DeviceHandle, &DevicePathGUID, + status = BS->HandleProtocol(img->DeviceHandle, &DevicePathGUID, (void **)&imgpath); if (status != EFI_SUCCESS) DPRINTF("Failed to get image DevicePath (%lu)\n", EFI_ERROR_CODE(status)); - DPRINTF("boot1 imagepath: %s\n", devpath_str(imgpath)); +#ifdef EFI_DEBUG + { + CHAR16 *text = efi_devpath_name(imgpath); + DPRINTF("boot1 imagepath: %S\n", text); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708280005.v7S05Ond027732>