From owner-svn-src-stable-11@freebsd.org Sun Feb 17 02:39:29 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD71014DE7EB; Sun, 17 Feb 2019 02:39:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B70A80F3D; Sun, 17 Feb 2019 02:39:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EE4EFF69; Sun, 17 Feb 2019 02:39:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1H2dRMb098752; Sun, 17 Feb 2019 02:39:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1H2dHEq098698; Sun, 17 Feb 2019 02:39:17 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902170239.x1H2dHEq098698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 17 Feb 2019 02:39:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344220 - in stable/11: . contrib/lua contrib/lua/doc contrib/lua/src share/man/man9 share/mk stand stand/common stand/defaults stand/liblua stand/liblua32 stand/libsa stand/lua sys/sys... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: . contrib/lua contrib/lua/doc contrib/lua/src share/man/man9 share/mk stand stand/common stand/defaults stand/liblua stand/liblua32 stand/libsa stand/lua sys/sys tools/build/options X-SVN-Commit-Revision: 344220 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4B70A80F3D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2019 02:39:29 -0000 Author: kevans Date: Sun Feb 17 02:39:17 2019 New Revision: 344220 URL: https://svnweb.freebsd.org/changeset/base/344220 Log: MFC lualoader: r326353, r328440, r328443, r329166-r329167, r329274, r329329, r329349-r329352, r329355-r329359, r329366-r329369, r329386-r329387, r329393, r329413-r329415, r329417, r329424-r329436, r329457, r329473-r329474, r329496-r329501, r329503-r329504, r329543, r329547-r329551, r329576-r329578, r329580, r329583, r329585-r329590, r329592-r329596, r329609-r329611, r329614, r329619, r329621-r329622, r329624, r329626-r329627, r329629-r329632, r329640-r329641, r329643-r329646, r329649-r329650, r329654, r329656, r329662, r329669-r329671, r329673-r329674, r329680, r329684-r329689, r329692-r329693, r329696-r329700, r329709, r329716, r329731, r329733-r329734, r329747-r329748, r329756, r329779, r329782, r329784, r329786, r329804, r329806, r329809, r329811, r329836, r329850-r329852, r329854, r329856-r329858, r329861, r329895, r329897-r329899, r329901-r329903, r329922-r329924, r329927-r329928, r329944-r329949, r329986-r329987, r330008-r330010, r330012, r330020, r330082-r330084, r330087-r330088, r330098-r330101, r330138-r330139, r330261-r330263, r330267-r330269, r330281-r330284, r330287, r330339-r330342, r330345-r330346, r330369-r330370, r330434-r330435, r330564, r330616-r330618, r330620, r330625, r330690, r330701, r330703, r330825, r331211, r331257, r331259, r331281-r331282, r331304, r331314, r331476-r331477, r331563-r331564, r331854-r331857, r331859-r331860, r332106, r334723, r334879, r334891, r334907, r334912, r334939, r334986, r335009, r335371, r336759, r337711, r337807-r337810, r338054, r338063, r338065-r338067, r338083, r338085-r338086, r338108, r338167-r338168, r338173, r338203, r338255, r338259, r338309, r338394, r338438, r338886, r338893, r339173, r339200, r339218, r339222, r339301, r339307, r339677-r339678, r339702, r339805, r339831, r339849, r340040, r340152 Some notes for this MFC: - This is still pre-forth/lua coexistance; that will come shortly-ish so that forth/lua may be installed together (with forth remaining the default) - module_blacklist support for lualoader has been MFC'd, but the drm modules are not blacklisted in this stable branch. r326353: Import lua 5.3.4 to contrib r328440: Preserve the original luaconf.h in a convenient place. Clients will r328443: Gross hack to omit printing hex floating point when the lua number r329166: Add Lua as a scripting langauge to /boot/loader r329167: Add the lua scripts from the lua-bootloader SoC r329274: stand/lua: Exit sub-menus on backspace r329329: stand/lua: Always boot on 'enter' keypress in menus r329349: stand/lua: Reduce magic numbers r329350: stand/lua: Don't descend into an empty kernels submenu r329351: stand/lua: Set reasonable ACPI default based on presence r329352: stand/lua: Consistently use semicolons for line endings r329355: stand/lua: Move kernel selection into main menu r329356: stand/lua: Allow menu items to not have explicit aliases r329357: stand/lua: Remove explicit alias from "Back to main menu" r329358: stand/lua: Say "loader prompt" instead of "lua interpreter" r329359: stand/lua: Remove a magic number/string (not a trivial literal) r329366: stand/lua: Set ACPI's default the proper way (setACPI) r329367: stand/lua: Create a "carousel" menu entry type r329368: stand/lua: Create/use some MENU_ constants where applicable r329369: stand/lua: Remove sneaky kernel assignment r329386: stand/lua: Correct usage and acceptance of BACKSPACE/DELETE keys r329387: stand/lua: Chop off the decimal for numbers passed to setcursor r329393: stand/lua: Use escaped dot instead of single character class r329413: stand/lua: Allow MENU_RETURN items to have func, fix esc. to prompt r329414: stand/lua: Don't try to divide by 0; do nothing r329415: stand/lua: Don't reload kernel config if we only have one kernel r329417: stand/lua: Make CAROUSEL_ENTRY func parameters consistent with name r329424: stand/lua: Don't set autoboot_delay=NO in menu autoboot sequence r329425: stand/lua: Enable menu autoboot; it seems to work r329426: stand/lua: Correct interpretation of autoboot_delay r329427: stand/lua: Color non-default kernels blue r329428: stand/lua: Correct some trivial errors in config r329429: stand/lua: Add debug method to dump modules r329430: stand/lua: Address some nits r329431: stand/lua: Correct test sense, this should have been 'not nil' r329432: stand/lua: Try to load alternate kernels as directories first r329433: stand/lua: Add optional GELI passphrase prompt r329434: stand/lua: Check for nil (GELI prompt) r329435: stand/lua: Style pass r329436: stand/lua: Debugging string snuck in... r329457: stand/lua: dumpModules => lsModules r329473: liblua: Clean up io/loader C module registration r329474: liblua: Emulate DIR, opendir, fdopendir, closedir r329496: stand/lua: Fix verbiage and some typos r329497: stand/lua: Fix module_path handling with multiple kernels r329498: stand/lua: Remove some debugging bits that snuck in... gr... r329499: interp_lua: Register io/loader with regular Lua module system r329500: Lua loader: Add barebones "lfs" module r329501: lua loader: Auto detect eligible list of kernels to boot r329503: liblua: Fix missing '}' in lutil.c after r329499 r329504: stand/lua: More style nits, config.lua r329543: Create style.lua(9) r329547: stand/lua: Allow menu items to be conditionally (in)visible r329548: stand/lua: Addres style.lua(9) concern r329549: stand/lua: Clear the screen before prompting for passwords r329550: stand/lua: Store the loaded kernel as config.kernel_loaded r329551: stand/lua: reload previously loaded kernel at config-load/reload r329576: stand/lua: Defer kernel/module loading until boot or menu escape r329577: stand/lua: Rename bootserial for clarity r329578: stand/lua: Menu style.lua(9) nits r329580: stand/lua: Remove some unused local declarations r329583: stand/lua: Store menu entries in an "entries" table r329585: stand/lua: Add core.isSingleUserBoot r329586: stand/lua: Call menu_entries if it's a function r329587: stand/lua: Swap single-/multi- user boot entries as needed r329588: stand/lua: Re-wrap menu.lua now that I've added indentation... r329589: stand/lua: Track env changes that come in via loader.conf(5) r329590: stand/lua: Restore environment upon config reload r329592: stand/lua: Remove inaccurate comment after r329590 r329593: stand/lua: Change boot menu items' names when swapped r329594: stand/lua: Round up some more style.lua(9) concerns r329595: stand/lua: Re-order locals after copyright notice; require first r329596: stand/lua: Add copyright notice in places r329609: stand/lua: Cache swapped menu, and don't create locals for swapping r329610: style.lua(9): Note that wrapping at 80-columns is not rigid r329611: stand/lua: Wrap tuple assignment earlier for readability r329614: stand/lua: Don't set ACPI off just because we can't detect it. r329619: stand/lua: Extract menu handlers out into menu.handlers table r329621: stand/lua: Add and use drawer.menu_name_handlers r329622: stand/lua: Move drawer.menu_name_handlers further up r329624: stand/lua: Reduce exposure of the drawer module r329626: stand/lua: Refactor logos into drawer.logodefs table r329627: stand/lua: Refactor brands into drawer.branddefs r329629: stand/lua: Use 'graphic' instead of 'logo' for depicting graphics r329630: stand/lua: Stick a copyright notice on drawer.lua r329631: stand/lua: Insert helpful comment for drawer.branddefs r329632: style.lua(9): Clarify local variable guideline r329640: stand/lua: Consistently declare local functions at module scope r329641: stand/lua: Consistently organize modules r329643: Implement loader.command r329644: lualoader: Add ability to intercept cli commands r329645: lualoader: Move carousel storage out into config r329646: lualoader: Eliminate global namespace pollution in loader.lua r329649: Lua lfs.attributes: Provide a more consistent error return r329650: liblua: Add loader.machine and loader.machine_arch properties r329654: lualoader: Ignore ACPI bits on !i386 r329656: loader.lua: Expose errno table to lua r329662: lualoader: Replace invalid construct with valid construct r329669: lualoader: Prefer selected kernel to currently loaded r329670: lualoader: Don't try so hard to load a kernel r329671: lualoader: Prepare for interception of "boot" CLI cmd r329673: lualoader: Intercept boot cli command r329674: lualoader: Intercept the 'autoboot' cli command r329680: lualoader: When restoring environment, only restore unchanged vars r329684: lualoader: Drop terminating semicolons r329685: lualoader: Drop excessive parenthesizing r329686: style.lua(9): Drop notes about semicolons r329687: lualoader: Drop explicit boolean tests; b or not b r329688: lualoader: Don't return false for failure to open config on silent r329689: lualoader: Output "Failed to parse" messages r329692: lualoader: Bring in local.lua module if it exists r329693: lualoader: Return only argstr if with_kernel not requested r329696: lualoader: Add "menu.default", initialized to menu.welcome r329697: lualoader: Drop name requirement for menu separators r329698: lualoader: Directly reference submenu definition with submenu key r329699: lualoader: Simplify menu definitions a little further r329700: lualoader: Allow carousel 'items' to be a table as well r329709: lualoader: Don't autodetect kernels if 'kernels' is explicitly set r329716: lualoader: Use the key that interrupts autoboot as a menu choice r329731: lualoader: Add boot environment support r329733: lualoader: Make kernel autodetect. contingent on loader.conf(5) var r329734: lualoader: Don't execute menu.autoboot() for every opened menu r329747: lualoader: Replace 8-space indentation with a single tab r329748: lualoader: Drop password length restrictions r329756: lualoader: Remove nasty hack for not printing out ".0" r329779: lualoader: Split cli bits out into a cli module r329782: lualoader: Unbreak 'boot [kernel]' by including config r329784: lualoader: Pull argument extraction for cli funcs to cli.arguments r329786: lualoader: Attach cli command functions to cli module r329804: lualoader: Eliminate some unused locals r329806: lualoader: Consistently use double quotes r329809: lualoader: Address some 'luacheck' concerns r329811: lualoader: Clear up an empty conditional branch r329836: lualoader: Attend to some 80-col issues, pointed out by luacheck r329850: lualoader: Drop unused return values; we'll only use the first r329851: Add SPDX tags to lua files r329852: Add copyright notice to core.lua r329854: lualoader: shallowCopyTable => deepCopyTable r329856: lualoader: Use "local function x()" instead "local x = function()" r329857: Centralize lua defines r329858: When the LUA_FLOAT_TYPE != LUA_FLOAT_INT64, we can't ref. float r329861: lualoader: Track effective line number, use it for drawing r329895: liblua: Implement write support r329897: lualoader: Add nextboot support r329898: lualoader: Plug file handle not properly closed r329899: lualoader: Correct test and name r329901: lualoader: Add comment on trailing space, don't operate on nil r329902: lualoader: Remove unused variable; we now use effective line number r329903: lualoader: Explain nextboot stuff a little bit more r329922: lualoader: Split config file I/O out into a separate function r329923: lualoader: Strip config.parse of its I/O privileges r329924: lualoader: throw out nextboot's usage of standard config processing r329927: lualoader: Clean up naming conventions a little bit r329928: lualoader: Remove inaccurate part of comment r329944: lualoader: Don't explicitly index tables without reason r329945: lualoader: menu: Terminate final values in tables with a comma r329946: lualoader: Clean up menu handling a little bit r329947: lualoader: Pull menu redrawing specifics out of menu.process r329948: lualoader: Pull autoboot handling out into menu.run() r329949: lualoader: Explain deviation from naming guidelines r329986: lualoader: Invalidate the screen from menu perspective mnu exit r329987: lualoader: Track the menu currently drawn, instead of validity r330008: lualoader: A little more general menu cleanup r330009: lualoader: More argument name expansion, part 2 r330010: lualoader: screen argument fixes r330012: style.lua(9): Add some additional notes about naming and commas r330020: lualoader: Re-work menu skipping bits r330082: lualoader: Add a twiddle at password prompt r330083: lualoader: Remove remnants of testing... r330084: lualoader: Replace instances of \027 with KEYSTR_ESCAPE r330087: lualoader: Convert instances of KEYSTR_ESCAPE .. "[" -> KEYSTR_CSI r330088: lualoader: Correct test sense, comments, and add some more comments r330098: lualoader: Re-do twiddle r330099: lualoader: Further screen cleanup r330100: lualoader: Remove debug function r330101: lualoader: Add note that \027 is a decimal representation r330138: lualoader: Dedup these "Return to main menu" entries r330139: lualoader: config: Pull some messages out into constants r330261: lualoader: Fix some lint-mentioned errors r330262: lualoader: Use #str instead of tracking length with 'n' r330263: lualoader: Use string literal \xNN instead of string.char() r330267: Add core.lua(8), but do not add to distribution r330268: Add menu.lua(8), but do not add to distribution r330269: core.lua(8): Add missing note about core.KEYSTR_CSI r330281: lualoader: Steamroll the box-drawing r330282: lualoader: Register loader.printc as global printc r330283: lualoader: Use global printc instead of loader.printc r330284: liblua: Use putc instead of printf for printc r330287: lualoader: Reset the cursor position after the menu is drawn r330339: liblua: Add loader.interpret r330340: lualoader: Execute menu_timeout_command at the end of menu autoboot r330341: lualoader: Respect loader_menu_title, prepare for align r330342: lualoader: Respect loader_menu_title_align r330345: lualoader: Tweak positioning and fix an off-by-one r330346: lualoader: Shift menu+brand even for logo=none with customized pos r330369: lualoader: Return meaningful value in cli_execute r330370: lualoader: logdef -> logodef typo r330434: lualoader: Add note about importance of including cli module early r330435: lualoader: Use FILESDIR instead of BINDIR r330564: lualoader: Only loadelf before boot/autoboot if no kernel loaded r330616: lualoader: Expose loader.parse and add cli_execute_unparsed r330617: lualoader: Fix name, cli.execute_unparsed -> cli_execute_unparsed r330618: lualoader: Use cli_execute_unparsed instead of loader.interpret r330620: lualoader: Use cli_execute_unparsed for commands via loader.conf r330625: lualoader: Return status in cli_execute_unparsed properly r330690: stand: Fix copy-paste-o, unbreaks libi386 lualoader build r330701: lualoader: Don't redraw the autoboot message every .05s r330703: lualoader: Cache kernel list r330825: lualoader: Sprinkle some verbose_loading salt r331211: lualoader: Setup default color scheme if we're using colors r331257: lualoader: Reset attributes and color scheme with color.highlight() r331259: lualoader: Use less atomic options for resetting colors/attributes r331281: lualoader: Add primitive hook module to untangle bogus reference r331282: core.lua(8): Update to reflect recently added function r331304: lualoader: Clear up some possible naming confusion r331314: lualoader: Use printc when we expect ANSI escape sequences r331476: lualoader: Make config env-related bits private API r331477: lualoader: Privatize some more config.lua bits r331563: lualoader: Implement try_include and use it for including local r331564: lualoader: Actually re-raise error in try_include r331854: lualoader: Do case-insensitive comparison of "yes" r331855: lualoader: Don't assume that {module}_load is set r331856: lualoader: revert whitespace change that snuck in r331857: lualoader: Simplify some expressions r331859: lualoader: Split logodefs out into logo-* files r331860: lualoader: Don't try to lookup a nil logo r332106: lualoader: Fix menu skipping with loader.conf(5) vars r334723: lualoader: Add a loaded hook for others to execute upon config load r334879: lualoader: Add hook.lua(8) to tree r334891: lualoader: Add cli.lua(8) to the tree r334907: lualoader: Process loader_conf_files properly r334912: lualoader: Support variable substitution in env var settings r334939: lualoader: Allow brand-*.lua for adding new brands r334986: lualoader: More black-on-white fixes r335009: lualoader: Match Forth module-loading behavior w.r.t flags r335371: lualoader: Correct kernel_options handling r336759: lualoader: "nextboot_file" should be spelled "nextboot_conf" r337711: lualoader: Fix parsing of negative number loader.conf(5) variables r337807: Prevent a wanring about checkdp being unused. r337808: When the LUA floating point model is INT64, we don't need to do the r337809: For our INT64 implementation, we can compare integers and numbers r337810: MFV r337586: lua: Update to 5.3.5 r338054: Add config.lua(8) to the tree r338063: lualoader: Stop exporting drawer.draw r338065: lualoader: Hide most of the internal drawing functions r338066: lualoader: Hide the rest of the private interfaces r338067: lualoader: Add drawer-exported variables for default logodefs r338083: Add drawer.lua(8) r338085: Add color.lua(8), password.lua(8), and screen.lua(8) r338086: lualoader: Install all manpages r338108: Serial console menus for lua. r338167: lualoader: Just compare expression directly r338168: lualoader: Refactor config line expressions r338173: lualoader: Fix loader.conf(5) EOL validation for 'exec' lines r338203: Turn off LOADER_GELI and LOADER_LUA for sparc64, until functional r338255: lualoader: Fix (add) Xen support r338259: lualoader: Accept that people use unquoted values in loader.conf r338309: lualoader: Fix override of module_path on loader prompt r338394: lualoader: fix color usage r338438: lualoader: Handle comma-separated kernels as well r338886: Improve loader passwords: r338893: Set the default loader for powerpc(32- and 64-bit) back to to forth r339173: Set the default loader for powerpc64 back to to forth too. r339200: lualoader: Don't draw loader menu with autoboot_delay=-1 r339218: lualoader: Create a module blacklist, add DRM modules to it r339222: lualoader: Honor boot_* variables at lua init r339301: Loader GELI support, like lua loader, seems to be broken on PowerPC r339307: lualoader: Provide a 'menu' command to redraw the menu at prompt r339677: lualoader: unload upon kernel change if a kernel was loaded r339678: menu.lua: Abort autoboot sequence on failed command r339702: lualoader: Improve module loading diagnostics r339805: lualoader: Always return a proper dictionary for blacklist r339831: Move LUA_ROOT to /boot/lua r339849: lualoader: Fix try_include error handling r340040: lualoader: Implement boot-conf r340152: lualoader: Add chainload menu entry Relnotes: yes ("lualoader has been merged to stable/11, off by default, to facilitate testing") Added: stable/11/contrib/lua/ - copied from r326353, head/contrib/lua/ stable/11/contrib/lua/src/luaconf.h.dist - copied unchanged from r328440, head/contrib/lua/src/luaconf.h.dist stable/11/share/man/man9/style.lua.9 - copied, changed from r329543, head/share/man/man9/style.lua.9 stable/11/stand/common/interp_lua.c - copied, changed from r329167, head/stand/common/interp_lua.c stable/11/stand/liblua/ - copied from r329167, head/stand/liblua/ stable/11/stand/liblua/lerrno.c - copied unchanged from r329656, head/stand/liblua/lerrno.c stable/11/stand/liblua/lerrno.h - copied unchanged from r329656, head/stand/liblua/lerrno.h stable/11/stand/liblua/lfs.c - copied, changed from r329501, head/stand/liblua/lfs.c stable/11/stand/liblua/lfs.h - copied unchanged from r329501, head/stand/liblua/lfs.h stable/11/stand/liblua32/ - copied from r329167, head/stand/liblua32/ stable/11/stand/lua/ - copied from r329167, head/stand/lua/ stable/11/stand/lua.mk - copied, changed from r329167, head/stand/lua.mk stable/11/stand/lua/cli.lua - copied, changed from r329779, head/stand/lua/cli.lua stable/11/stand/lua/cli.lua.8 - copied, changed from r334891, head/stand/lua/cli.lua.8 stable/11/stand/lua/color.lua.8 - copied unchanged from r338086, head/stand/lua/color.lua.8 stable/11/stand/lua/config.lua.8 - copied unchanged from r338054, head/stand/lua/config.lua.8 stable/11/stand/lua/core.lua.8 - copied, changed from r330269, head/stand/lua/core.lua.8 stable/11/stand/lua/drawer.lua.8 - copied unchanged from r338083, head/stand/lua/drawer.lua.8 stable/11/stand/lua/hook.lua - copied unchanged from r331282, head/stand/lua/hook.lua stable/11/stand/lua/hook.lua.8 - copied unchanged from r334879, head/stand/lua/hook.lua.8 stable/11/stand/lua/logo-beastie.lua - copied unchanged from r331860, head/stand/lua/logo-beastie.lua stable/11/stand/lua/logo-beastiebw.lua - copied unchanged from r331860, head/stand/lua/logo-beastiebw.lua stable/11/stand/lua/logo-fbsdbw.lua - copied unchanged from r331860, head/stand/lua/logo-fbsdbw.lua stable/11/stand/lua/logo-orb.lua - copied unchanged from r331860, head/stand/lua/logo-orb.lua stable/11/stand/lua/logo-orbbw.lua - copied unchanged from r331860, head/stand/lua/logo-orbbw.lua stable/11/stand/lua/menu.lua.8 - copied unchanged from r330269, head/stand/lua/menu.lua.8 stable/11/stand/lua/password.lua.8 - copied unchanged from r338086, head/stand/lua/password.lua.8 stable/11/stand/lua/screen.lua.8 - copied unchanged from r338086, head/stand/lua/screen.lua.8 stable/11/tools/build/options/WITH_LOADER_LUA - copied unchanged from r329167, head/tools/build/options/WITH_LOADER_LUA Deleted: stable/11/contrib/lua/src/luaconf.h Modified: stable/11/UPDATING stable/11/contrib/lua/README stable/11/contrib/lua/doc/contents.html stable/11/contrib/lua/doc/lua.css stable/11/contrib/lua/doc/manual.html stable/11/contrib/lua/doc/readme.html stable/11/contrib/lua/src/Makefile stable/11/contrib/lua/src/lapi.c stable/11/contrib/lua/src/lapi.h stable/11/contrib/lua/src/lauxlib.c stable/11/contrib/lua/src/lauxlib.h stable/11/contrib/lua/src/lbaselib.c stable/11/contrib/lua/src/lbitlib.c stable/11/contrib/lua/src/lcode.c stable/11/contrib/lua/src/lcode.h stable/11/contrib/lua/src/lcorolib.c stable/11/contrib/lua/src/lctype.c stable/11/contrib/lua/src/lctype.h stable/11/contrib/lua/src/ldblib.c stable/11/contrib/lua/src/ldebug.c stable/11/contrib/lua/src/ldebug.h stable/11/contrib/lua/src/ldo.c stable/11/contrib/lua/src/ldo.h stable/11/contrib/lua/src/ldump.c stable/11/contrib/lua/src/lfunc.c stable/11/contrib/lua/src/lfunc.h stable/11/contrib/lua/src/lgc.c stable/11/contrib/lua/src/lgc.h stable/11/contrib/lua/src/linit.c stable/11/contrib/lua/src/liolib.c stable/11/contrib/lua/src/llex.c stable/11/contrib/lua/src/llex.h stable/11/contrib/lua/src/llimits.h stable/11/contrib/lua/src/lmathlib.c stable/11/contrib/lua/src/lmem.c stable/11/contrib/lua/src/lmem.h stable/11/contrib/lua/src/loadlib.c stable/11/contrib/lua/src/lobject.c stable/11/contrib/lua/src/lobject.h stable/11/contrib/lua/src/lopcodes.c stable/11/contrib/lua/src/lopcodes.h stable/11/contrib/lua/src/loslib.c stable/11/contrib/lua/src/lparser.c stable/11/contrib/lua/src/lparser.h stable/11/contrib/lua/src/lprefix.h stable/11/contrib/lua/src/lstate.c stable/11/contrib/lua/src/lstate.h stable/11/contrib/lua/src/lstring.c stable/11/contrib/lua/src/lstring.h stable/11/contrib/lua/src/lstrlib.c stable/11/contrib/lua/src/ltable.c stable/11/contrib/lua/src/ltable.h stable/11/contrib/lua/src/ltablib.c stable/11/contrib/lua/src/ltm.c stable/11/contrib/lua/src/ltm.h stable/11/contrib/lua/src/lua.c stable/11/contrib/lua/src/lua.h stable/11/contrib/lua/src/luac.c stable/11/contrib/lua/src/lualib.h stable/11/contrib/lua/src/lundump.c stable/11/contrib/lua/src/lundump.h stable/11/contrib/lua/src/lutf8lib.c stable/11/contrib/lua/src/lvm.c stable/11/contrib/lua/src/lvm.h stable/11/contrib/lua/src/lzio.c stable/11/contrib/lua/src/lzio.h stable/11/share/man/man9/Makefile stable/11/share/mk/src.opts.mk stable/11/stand/Makefile stable/11/stand/defaults/loader.conf stable/11/stand/defaults/loader.conf.5 stable/11/stand/defs.mk stable/11/stand/liblua/Makefile stable/11/stand/liblua/lstd.c stable/11/stand/liblua/lstd.h stable/11/stand/liblua/luaconf.h stable/11/stand/liblua/lutils.c stable/11/stand/liblua/lutils.h stable/11/stand/libsa/stand.h stable/11/stand/loader.mk stable/11/stand/lua/Makefile stable/11/stand/lua/color.lua stable/11/stand/lua/config.lua stable/11/stand/lua/core.lua stable/11/stand/lua/drawer.lua stable/11/stand/lua/loader.lua stable/11/stand/lua/menu.lua stable/11/stand/lua/password.lua stable/11/stand/lua/screen.lua stable/11/sys/sys/param.h Directory Properties: stable/11/ (props changed) Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Sun Feb 17 01:16:27 2019 (r344219) +++ stable/11/UPDATING Sun Feb 17 02:39:17 2019 (r344220) @@ -17,6 +17,14 @@ the tip of head, and then rebuild without this option. from older version of current across the gcc/clang cutover is a bit fragile. 20190216: + Lualoader has been merged to facilitate testing on this branch. It's + purely opt-in for now by building WITH_LOADER_LUA and WITHOUT_FORTH in + /etc/src.conf, but co-existance will come shortly. Booting is a complex + environment and test coverage for Lua-enabled loaders has been thin, so + it would be prudent to assume it might not work and make provisions for + backup boot methods. + +20190216: Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to 7.0.1. Please see the 20141231 entry below for information about prerequisites and upgrading, if you are not already using clang 3.5.0 Modified: stable/11/contrib/lua/README ============================================================================== --- head/contrib/lua/README Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/README Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ -This is Lua 5.3.4, released on 12 Jan 2017. +This is Lua 5.3.5, released on 26 Jun 2018. For installation instructions, license details, and further information about Lua, see doc/readme.html. Modified: stable/11/contrib/lua/doc/contents.html ============================================================================== --- head/contrib/lua/doc/contents.html Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/doc/contents.html Sun Feb 17 02:39:17 2019 (r344220) @@ -32,7 +32,7 @@ For a complete introduction to Lua programming, see th

-Copyright © 2015–2017 Lua.org, PUC-Rio. +Copyright © 2015–2018 Lua.org, PUC-Rio. Freely available under the terms of the Lua license. @@ -609,10 +609,10 @@ Freely available under the terms of the

Modified: stable/11/contrib/lua/doc/lua.css ============================================================================== --- head/contrib/lua/doc/lua.css Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/doc/lua.css Sun Feb 17 02:39:17 2019 (r344220) @@ -10,7 +10,7 @@ body { line-height: 1.25 ; margin: 16px auto ; padding: 32px ; - border: solid #a0a0a0 1px ; + border: solid #ccc 1px ; border-radius: 20px ; max-width: 70em ; width: 90% ; @@ -111,36 +111,29 @@ pre.session { border-radius: 8px ; } -td.gutter { - width: 4% ; -} - -table.columns { +table { border: none ; border-spacing: 0 ; border-collapse: collapse ; } +td { + padding: 0 ; + margin: 0 ; +} + +td.gutter { + width: 4% ; +} + table.columns td { vertical-align: top ; - padding: 0 ; padding-bottom: 1em ; text-align: justify ; line-height: 1.25 ; } -p.logos a:link:hover, p.logos a:visited:hover { - background-color: inherit ; -} - -table.book { - border: none ; - border-spacing: 0 ; - border-collapse: collapse ; -} - table.book td { - padding: 0 ; vertical-align: top ; } @@ -157,6 +150,10 @@ table.book span { text-align: left ; display: block ; margin-top: 0.25em ; +} + +p.logos a:link:hover, p.logos a:visited:hover { + background-color: inherit ; } img { Modified: stable/11/contrib/lua/doc/manual.html ============================================================================== --- head/contrib/lua/doc/manual.html Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/doc/manual.html Sun Feb 17 02:39:17 2019 (r344220) @@ -19,7 +19,7 @@ by Roberto Ierusalimschy, Luiz Henrique de Figueiredo,

-Copyright © 2015–2017 Lua.org, PUC-Rio. +Copyright © 2015–2018 Lua.org, PUC-Rio. Freely available under the terms of the Lua license. @@ -35,7 +35,7 @@ Freely available under the terms of the

- + @@ -203,8 +203,8 @@ even those that do not support threads natively.

The type table implements associative arrays, -that is, arrays that can be indexed not only with numbers, -but with any Lua value except nil and NaN. +that is, arrays that can have as indices not only numbers, +but any Lua value except nil and NaN. (Not a Number is a special value used to represent undefined or unrepresentable numerical results, such as 0/0.) Tables can be heterogeneous; @@ -400,6 +400,8 @@ with the event name prefixed by two underscores; the corresponding values are called metamethods. In the previous example, the key is "__add" and the metamethod is the function that performs the addition. +Unless stated otherwise, +metamethods should be function values.

@@ -597,7 +599,7 @@ it is also slower than a real __le metame

  • __index: -The indexing access table[key]. +The indexing access operation table[key]. This event happens when table is not a table or when key is not present in table. The metamethod is looked up in table. @@ -1276,13 +1278,8 @@ Square brackets are used to index a table:
     	var ::= prefixexp ‘[’ exp ‘]

    -The meaning of accesses to table fields can be changed via metatables. -An access to an indexed variable t[i] is equivalent to -a call gettable_event(t,i). -(See §2.4 for a complete description of the -gettable_event function. -This function is not defined or callable in Lua. -We use it here only for explanatory purposes.) +The meaning of accesses to table fields can be changed via metatables +(see §2.4).

    @@ -1477,25 +1474,20 @@ cyclically permutes the values of x, -The meaning of assignments to global variables -and table fields can be changed via metatables. -An assignment to an indexed variable t[i] = val is equivalent to -settable_event(t,i,val). -(See §2.4 for a complete description of the -settable_event function. -This function is not defined or callable in Lua. -We use it here only for explanatory purposes.) - - -

    An assignment to a global name x = val is equivalent to the assignment _ENV.x = val (see §2.2). +

    +The meaning of assignments to table fields and +global variables (which are actually table fields, too) +can be changed via metatables (see §2.4). + +

    3.3.4 – Control Structures

    The control structures if, while, and repeat have the usual meaning and @@ -1831,17 +1823,17 @@ Here are some examples: g(f(), x) -- f() is adjusted to 1 result g(x, f()) -- g gets x plus all results from f() a,b,c = f(), x -- f() is adjusted to 1 result (c gets nil) - a,b = ... -- a gets the first vararg parameter, b gets + a,b = ... -- a gets the first vararg argument, b gets -- the second (both a and b can get nil if there - -- is no corresponding vararg parameter) + -- is no corresponding vararg argument) a,b,c = x, f() -- f() is adjusted to 2 results a,b,c = f() -- f() is adjusted to 3 results return f() -- returns all results from f() - return ... -- returns all received vararg parameters + return ... -- returns all received vararg arguments return x,y,f() -- returns x, y, and all results from f() {f()} -- creates a list with all results from f() - {...} -- creates a list with all vararg parameters + {...} -- creates a list with all vararg arguments {f(), nil} -- f() is adjusted to 1 result @@ -2039,9 +2031,12 @@ two objects are considered equal only if they are the Every time you create a new object (a table, userdata, or thread), this new object is different from any previously existing object. -Closures with the same reference are always equal. +A closure is always equal to itself. Closures with any detectable difference (different behavior, different definition) are always different. +Closures created at different times but with no detectable differences +may be classified as equal or not +(depending on internal caching details).

    @@ -2303,7 +2298,7 @@ If the value of prefixexp has type function, then this function is called with the given arguments. Otherwise, the prefixexp "call" metamethod is called, -having as first parameter the value of prefixexp, +having as first argument the value of prefixexp, followed by the original call arguments (see §2.4). @@ -2881,7 +2876,7 @@ it can do whatever it wants on that Lua state, as it should be already protected. However, when C code operates on other Lua states -(e.g., a Lua parameter to the function, +(e.g., a Lua argument to the function, a Lua state stored in the registry, or the result of lua_newthread), it should use them only in API calls that cannot raise errors. @@ -3370,7 +3365,7 @@ it is left unchanged. Destroys all objects in the given Lua state (calling the corresponding garbage-collection metamethods, if any) and frees all dynamic memory used by this state. -On several platforms, you may not need to call this function, +In several platforms, you may not need to call this function, because all resources are naturally released when the host program ends. On the other hand, long-running programs that create multiple states, such as daemons or web servers, @@ -5584,7 +5579,7 @@ given as argument to a hook (see <

    -To get information about a function you push it onto the stack +To get information about a function, you push it onto the stack and start the what string with the character '>'. (In that case, lua_getinfo pops the function from the top of the stack.) @@ -6462,7 +6457,7 @@ file-related functions in the standard library

    Pushes onto the stack the field e from the metatable -of the object at index obj and returns the type of pushed value. +of the object at index obj and returns the type of the pushed value. If the object does not have a metatable, or if the metatable does not have this field, pushes nothing and returns LUA_TNIL. @@ -6749,7 +6744,7 @@ In words, if the argument arg is nil or a the macro results in the default dflt. Otherwise, it results in the result of calling func with the state L and the argument index arg as -parameters. +arguments. Note that it evaluates the expression dflt only if needed. @@ -8680,7 +8675,7 @@ the lowercase letters plus the '-' charac

    You can put a closing square bracket in a set by positioning it as the first character in the set. -You can put an hyphen in a set +You can put a hyphen in a set by positioning it as the first or the last character in the set. (You can also use an escape for both cases.) @@ -9082,8 +9077,8 @@ Returns the destination table a2.

    -Returns a new table with all parameters stored into keys 1, 2, etc. -and with a field "n" with the total number of parameters. +Returns a new table with all arguments stored into keys 1, 2, etc. +and with a field "n" with the total number of arguments. Note that the resulting table may not be a sequence. @@ -9215,7 +9210,7 @@ Returns the arc sine of x (in radians).

    Returns the arc tangent of y/x (in radians), -but uses the signs of both parameters to find the +but uses the signs of both arguments to find the quadrant of the result. (It also handles correctly the case of x being zero.) @@ -9516,7 +9511,7 @@ all I/O functions return nil on failure (plus an error message as a second result and a system-dependent error code as a third result) and some value different from nil on success. -On non-POSIX systems, +In non-POSIX systems, the computation of the error message and error code in case of errors may be not thread safe, @@ -9553,7 +9548,7 @@ When called with a file name, it opens the named file and sets its handle as the default input file. When called with a file handle, it simply sets this file handle as the default input file. -When called without parameters, +When called without arguments, it returns the current default input file. @@ -9580,7 +9575,7 @@ it returns no values (to finish the loop) and automati The call io.lines() (with no file name) is equivalent to io.input():lines("*l"); that is, it iterates over the lines of the default input file. -In this case it does not close the file when the loop ends. +In this case, the iterator does not close the file when the loop ends.

    @@ -9963,7 +9958,7 @@ the host system and on the current locale.

    -On non-POSIX systems, +In non-POSIX systems, this function may be not thread safe because of its reliance on C function gmtime and C function localtime. @@ -10163,7 +10158,7 @@ and explicitly removed when no longer needed.

    -On POSIX systems, +In POSIX systems, this function also creates a file with that name, to avoid security risks. (Someone else might create the file with wrong permissions @@ -10301,8 +10296,8 @@ The first parameter or local variable has index 1 following the order that they are declared in the code, counting only the variables that are active in the current scope of the function. -Negative indices refer to vararg parameters; --1 is the first vararg parameter. +Negative indices refer to vararg arguments; +-1 is the first vararg argument. The function returns nil if there is no variable with the given index, and raises an error when called with a level out of range. (You can call debug.getinfo to check whether the level is valid.) @@ -10400,7 +10395,7 @@ When called without arguments,

    -When the hook is called, its first parameter is a string +When the hook is called, its first argument is a string describing the event that has triggered its call: "call" (or "tail call"), "return", @@ -10551,7 +10546,8 @@ The options are:

    • -e stat: executes string stat;
    • -
    • -l mod: "requires" mod;
    • +
    • -l mod: "requires" mod and assigns the + result to global @mod;
    • -i: enters interactive mode after running script;
    • -v: prints version information;
    • -E: ignores environment variables;
    • @@ -10629,7 +10625,7 @@ For instance, the call

      will print "-e". If there is a script, -the script is called with parameters +the script is called with arguments arg[1], ···, arg[#arg]. (Like all chunks in Lua, the script is compiled as a vararg function.) @@ -10815,7 +10811,7 @@ The following functions were deprecated in the mathema frexp, and ldexp. You can replace math.pow(x,y) with x^y; you can replace math.atan2 with math.atan, -which now accepts one or two parameters; +which now accepts one or two arguments; you can replace math.ldexp(x,exp) with x * 2.0^exp. For the other operations, you can either use an external library or @@ -10850,7 +10846,7 @@ of the first result.)

      • -Continuation functions now receive as parameters what they needed +Continuation functions now receive as arguments what they needed to get through lua_getctx, so lua_getctx has been removed. Adapt your code accordingly. @@ -10973,12 +10969,13 @@ and LiteralString, see §3.1.) + Modified: stable/11/contrib/lua/doc/readme.html ============================================================================== --- head/contrib/lua/doc/readme.html Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/doc/readme.html Sun Feb 17 02:39:17 2019 (r344220) @@ -107,7 +107,7 @@ Here are the details.
        1. Open a terminal window and move to -the top-level directory, which is named lua-5.3.x. +the top-level directory, which is named lua-5.3.5. The Makefile there controls both the build process and the installation process.

        2. @@ -355,10 +355,10 @@ THE SOFTWARE. Modified: stable/11/contrib/lua/src/Makefile ============================================================================== --- head/contrib/lua/src/Makefile Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/Makefile Sun Feb 17 02:39:17 2019 (r344220) @@ -102,7 +102,7 @@ c89: freebsd: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline" + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc" generic: $(ALL) @@ -110,7 +110,7 @@ linux: $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" macosx: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" CC=cc + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" mingw: $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \ Modified: stable/11/contrib/lua/src/lapi.c ============================================================================== --- head/contrib/lua/src/lapi.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lapi.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp $ +** $Id: lapi.c,v 2.259.1.2 2017/12/06 18:35:12 roberto Exp $ ** Lua API ** See Copyright Notice in lua.h */ @@ -533,6 +533,7 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunc lua_lock(L); if (n == 0) { setfvalue(L->top, fn); + api_incr_top(L); } else { CClosure *cl; @@ -546,9 +547,9 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunc /* does not need barrier because closure is white */ } setclCvalue(L, L->top, cl); + api_incr_top(L); + luaC_checkGC(L); } - api_incr_top(L); - luaC_checkGC(L); lua_unlock(L); } Modified: stable/11/contrib/lua/src/lapi.h ============================================================================== --- head/contrib/lua/src/lapi.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lapi.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lapi.h,v 2.9 2015/03/06 19:49:50 roberto Exp $ +** $Id: lapi.h,v 2.9.1.1 2017/04/19 17:20:42 roberto Exp $ ** Auxiliary functions from Lua API ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lauxlib.c ============================================================================== --- head/contrib/lua/src/lauxlib.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lauxlib.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp $ +** $Id: lauxlib.c,v 1.289.1.1 2017/04/19 17:20:42 roberto Exp $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lauxlib.h ============================================================================== --- head/contrib/lua/src/lauxlib.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lauxlib.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp $ +** $Id: lauxlib.h,v 1.131.1.1 2017/04/19 17:20:42 roberto Exp $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lbaselib.c ============================================================================== --- head/contrib/lua/src/lbaselib.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lbaselib.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.314 2016/09/05 19:06:34 roberto Exp $ +** $Id: lbaselib.c,v 1.314.1.1 2017/04/19 17:39:34 roberto Exp $ ** Basic library ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lbitlib.c ============================================================================== --- head/contrib/lua/src/lbitlib.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lbitlib.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lbitlib.c,v 1.30 2015/11/11 19:08:09 roberto Exp $ +** $Id: lbitlib.c,v 1.30.1.1 2017/04/19 17:20:42 roberto Exp $ ** Standard library for bitwise operations ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lcode.c ============================================================================== --- head/contrib/lua/src/lcode.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lcode.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 2.112 2016/12/22 13:08:50 roberto Exp $ +** $Id: lcode.c,v 2.112.1.1 2017/04/19 17:20:42 roberto Exp $ ** Code generator for Lua ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lcode.h ============================================================================== --- head/contrib/lua/src/lcode.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lcode.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lcode.h,v 1.64 2016/01/05 16:22:37 roberto Exp $ +** $Id: lcode.h,v 1.64.1.1 2017/04/19 17:20:42 roberto Exp $ ** Code generator for Lua ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lcorolib.c ============================================================================== --- head/contrib/lua/src/lcorolib.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lcorolib.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lcorolib.c,v 1.10 2016/04/11 19:19:55 roberto Exp $ +** $Id: lcorolib.c,v 1.10.1.1 2017/04/19 17:20:42 roberto Exp $ ** Coroutine Library ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lctype.c ============================================================================== --- head/contrib/lua/src/lctype.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lctype.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lctype.c,v 1.12 2014/11/02 19:19:04 roberto Exp $ +** $Id: lctype.c,v 1.12.1.1 2017/04/19 17:20:42 roberto Exp $ ** 'ctype' functions for Lua ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lctype.h ============================================================================== --- head/contrib/lua/src/lctype.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lctype.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $ +** $Id: lctype.h,v 1.12.1.1 2013/04/12 18:48:47 roberto Exp $ ** 'ctype' functions for Lua ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/ldblib.c ============================================================================== --- head/contrib/lua/src/ldblib.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/ldblib.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: ldblib.c,v 1.151 2015/11/23 11:29:43 roberto Exp $ +** $Id: ldblib.c,v 1.151.1.1 2017/04/19 17:20:42 roberto Exp $ ** Interface from Lua to its debug API ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/ldebug.c ============================================================================== --- head/contrib/lua/src/ldebug.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/ldebug.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: ldebug.c,v 2.121 2016/10/19 12:32:10 roberto Exp $ +** $Id: ldebug.c,v 2.121.1.2 2017/07/10 17:21:50 roberto Exp $ ** Debug Interface ** See Copyright Notice in lua.h */ @@ -653,6 +653,7 @@ l_noret luaG_runerror (lua_State *L, const char *fmt, CallInfo *ci = L->ci; const char *msg; va_list argp; + luaC_checkGC(L); /* error message uses memory */ va_start(argp, fmt); msg = luaO_pushvfstring(L, fmt, argp); /* format message */ va_end(argp); Modified: stable/11/contrib/lua/src/ldebug.h ============================================================================== --- head/contrib/lua/src/ldebug.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/ldebug.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: ldebug.h,v 2.14 2015/05/22 17:45:56 roberto Exp $ +** $Id: ldebug.h,v 2.14.1.1 2017/04/19 17:20:42 roberto Exp $ ** Auxiliary functions from Debug Interface module ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/ldo.c ============================================================================== --- head/contrib/lua/src/ldo.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/ldo.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 2.157 2016/12/13 15:52:21 roberto Exp $ +** $Id: ldo.c,v 2.157.1.1 2017/04/19 17:20:42 roberto Exp $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/ldo.h ============================================================================== --- head/contrib/lua/src/ldo.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/ldo.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: ldo.h,v 2.29 2015/12/21 13:02:14 roberto Exp $ +** $Id: ldo.h,v 2.29.1.1 2017/04/19 17:20:42 roberto Exp $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/ldump.c ============================================================================== --- head/contrib/lua/src/ldump.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/ldump.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: ldump.c,v 2.37 2015/10/08 15:53:49 roberto Exp $ +** $Id: ldump.c,v 2.37.1.1 2017/04/19 17:20:42 roberto Exp $ ** save precompiled Lua chunks ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lfunc.c ============================================================================== --- head/contrib/lua/src/lfunc.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lfunc.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lfunc.c,v 2.45 2014/11/02 19:19:04 roberto Exp $ +** $Id: lfunc.c,v 2.45.1.1 2017/04/19 17:39:34 roberto Exp $ ** Auxiliary functions to manipulate prototypes and closures ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lfunc.h ============================================================================== --- head/contrib/lua/src/lfunc.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lfunc.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lfunc.h,v 2.15 2015/01/13 15:49:11 roberto Exp $ +** $Id: lfunc.h,v 2.15.1.1 2017/04/19 17:39:34 roberto Exp $ ** Auxiliary functions to manipulate prototypes and closures ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lgc.c ============================================================================== --- head/contrib/lua/src/lgc.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lgc.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 2.215 2016/12/22 13:08:50 roberto Exp $ +** $Id: lgc.c,v 2.215.1.2 2017/08/31 16:15:27 roberto Exp $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -643,8 +643,9 @@ static void clearkeys (global_State *g, GCObject *l, G for (n = gnode(h, 0); n < limit; n++) { if (!ttisnil(gval(n)) && (iscleared(g, gkey(n)))) { setnilvalue(gval(n)); /* remove value ... */ - removeentry(n); /* and remove entry from table */ } + if (ttisnil(gval(n))) /* is entry empty? */ + removeentry(n); /* remove entry from table */ } } } Modified: stable/11/contrib/lua/src/lgc.h ============================================================================== --- head/contrib/lua/src/lgc.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lgc.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lgc.h,v 2.91 2015/12/21 13:02:14 roberto Exp $ +** $Id: lgc.h,v 2.91.1.1 2017/04/19 17:39:34 roberto Exp $ ** Garbage Collector ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/linit.c ============================================================================== --- head/contrib/lua/src/linit.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/linit.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: linit.c,v 1.39 2016/12/04 20:17:24 roberto Exp $ +** $Id: linit.c,v 1.39.1.1 2017/04/19 17:20:42 roberto Exp $ ** Initialization of libraries for lua.c and other clients ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/liolib.c ============================================================================== --- head/contrib/lua/src/liolib.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/liolib.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.151 2016/12/20 18:37:00 roberto Exp $ +** $Id: liolib.c,v 2.151.1.1 2017/04/19 17:29:57 roberto Exp $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -206,11 +206,16 @@ static int aux_close (lua_State *L) { } +static int f_close (lua_State *L) { + tofile(L); /* make sure argument is an open stream */ + return aux_close(L); +} + + static int io_close (lua_State *L) { if (lua_isnone(L, 1)) /* no argument? */ lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT); /* use standard output */ - tofile(L); /* make sure argument is an open stream */ - return aux_close(L); + return f_close(L); } @@ -712,7 +717,7 @@ static const luaL_Reg iolib[] = { ** methods for file handles */ static const luaL_Reg flib[] = { - {"close", io_close}, + {"close", f_close}, {"flush", f_flush}, {"lines", f_lines}, {"read", f_read}, Modified: stable/11/contrib/lua/src/llex.c ============================================================================== --- head/contrib/lua/src/llex.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/llex.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 2.96 2016/05/02 14:02:12 roberto Exp $ +** $Id: llex.c,v 2.96.1.1 2017/04/19 17:20:42 roberto Exp $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/llex.h ============================================================================== --- head/contrib/lua/src/llex.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/llex.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: llex.h,v 1.79 2016/05/02 14:02:12 roberto Exp $ +** $Id: llex.h,v 1.79.1.1 2017/04/19 17:20:42 roberto Exp $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/llimits.h ============================================================================== --- head/contrib/lua/src/llimits.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/llimits.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: llimits.h,v 1.141 2015/11/19 19:16:22 roberto Exp $ +** $Id: llimits.h,v 1.141.1.1 2017/04/19 17:20:42 roberto Exp $ ** Limits, basic types, and some other 'installation-dependent' definitions ** See Copyright Notice in lua.h */ @@ -66,7 +66,9 @@ typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; #else typedef union { lua_Number n; +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 double u; +#endif void *s; lua_Integer i; long l; Modified: stable/11/contrib/lua/src/lmathlib.c ============================================================================== --- head/contrib/lua/src/lmathlib.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lmathlib.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lmathlib.c,v 1.119 2016/12/22 13:08:50 roberto Exp $ +** $Id: lmathlib.c,v 1.119.1.1 2017/04/19 17:20:42 roberto Exp $ ** Standard mathematical library ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lmem.c ============================================================================== --- head/contrib/lua/src/lmem.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lmem.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lmem.c,v 1.91 2015/03/06 19:45:54 roberto Exp $ +** $Id: lmem.c,v 1.91.1.1 2017/04/19 17:20:42 roberto Exp $ ** Interface to Memory Manager ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lmem.h ============================================================================== --- head/contrib/lua/src/lmem.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lmem.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lmem.h,v 1.43 2014/12/19 17:26:14 roberto Exp $ +** $Id: lmem.h,v 1.43.1.1 2017/04/19 17:20:42 roberto Exp $ ** Interface to Memory Manager ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/loadlib.c ============================================================================== --- head/contrib/lua/src/loadlib.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/loadlib.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: loadlib.c,v 1.130 2017/01/12 17:14:26 roberto Exp $ +** $Id: loadlib.c,v 1.130.1.1 2017/04/19 17:20:42 roberto Exp $ ** Dynamic library loader for Lua ** See Copyright Notice in lua.h ** Modified: stable/11/contrib/lua/src/lobject.c ============================================================================== --- head/contrib/lua/src/lobject.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lobject.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 2.113 2016/12/22 13:08:50 roberto Exp $ +** $Id: lobject.c,v 2.113.1.1 2017/04/19 17:29:57 roberto Exp $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -435,7 +435,8 @@ const char *luaO_pushvfstring (lua_State *L, const cha } case 'p': { /* a pointer */ char buff[4*sizeof(void *) + 8]; /* should be enough space for a '%p' */ - int l = l_sprintf(buff, sizeof(buff), "%p", va_arg(argp, void *)); + void *p = va_arg(argp, void *); + int l = lua_pointer2str(buff, sizeof(buff), p); pushstr(L, buff, l); break; } Modified: stable/11/contrib/lua/src/lobject.h ============================================================================== --- head/contrib/lua/src/lobject.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lobject.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 2.117 2016/08/01 19:51:24 roberto Exp $ +** $Id: lobject.h,v 2.117.1.1 2017/04/19 17:39:34 roberto Exp $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lopcodes.c ============================================================================== --- head/contrib/lua/src/lopcodes.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lopcodes.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.c,v 1.55 2015/01/05 13:48:33 roberto Exp $ +** $Id: lopcodes.c,v 1.55.1.1 2017/04/19 17:20:42 roberto Exp $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lopcodes.h ============================================================================== --- head/contrib/lua/src/lopcodes.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lopcodes.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.h,v 1.149 2016/07/19 17:12:21 roberto Exp $ +** $Id: lopcodes.h,v 1.149.1.1 2017/04/19 17:20:42 roberto Exp $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/loslib.c ============================================================================== --- head/contrib/lua/src/loslib.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/loslib.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: loslib.c,v 1.65 2016/07/18 17:58:58 roberto Exp $ +** $Id: loslib.c,v 1.65.1.1 2017/04/19 17:29:57 roberto Exp $ ** Standard Operating System library ** See Copyright Notice in lua.h */ @@ -293,7 +293,8 @@ static int os_date (lua_State *L) { else stm = l_localtime(&t, &tmr); if (stm == NULL) /* invalid date? */ - luaL_error(L, "time result cannot be represented in this installation"); + return luaL_error(L, + "time result cannot be represented in this installation"); if (strcmp(s, "*t") == 0) { lua_createtable(L, 0, 9); /* 9 = number of fields */ setallfields(L, stm); @@ -340,7 +341,8 @@ static int os_time (lua_State *L) { setallfields(L, &ts); /* update fields with normalized values */ } if (t != (time_t)(l_timet)t || t == (time_t)(-1)) - luaL_error(L, "time result cannot be represented in this installation"); + return luaL_error(L, + "time result cannot be represented in this installation"); l_pushtime(L, t); return 1; } Modified: stable/11/contrib/lua/src/lparser.c ============================================================================== --- head/contrib/lua/src/lparser.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lparser.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.155 2016/08/01 19:51:24 roberto Exp $ +** $Id: lparser.c,v 2.155.1.2 2017/04/29 18:11:40 roberto Exp $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -1392,7 +1392,7 @@ static void test_then_block (LexState *ls, int *escape luaK_goiffalse(ls->fs, &v); /* will jump to label if condition is true */ enterblock(fs, &bl, 0); /* must enter block before 'goto' */ gotostat(ls, v.t); /* handle goto/break */ - skipnoopstat(ls); /* skip other no-op statements */ + while (testnext(ls, ';')) {} /* skip colons */ if (block_follow(ls, 0)) { /* 'goto' is the entire block? */ leaveblock(fs); return; /* and that is it */ Modified: stable/11/contrib/lua/src/lparser.h ============================================================================== --- head/contrib/lua/src/lparser.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lparser.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lparser.h,v 1.76 2015/12/30 18:16:13 roberto Exp $ +** $Id: lparser.h,v 1.76.1.1 2017/04/19 17:20:42 roberto Exp $ ** Lua Parser ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lprefix.h ============================================================================== --- head/contrib/lua/src/lprefix.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lprefix.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ +** $Id: lprefix.h,v 1.2.1.1 2017/04/19 17:20:42 roberto Exp $ ** Definitions for Lua code that must come before any other header file ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lstate.c ============================================================================== --- head/contrib/lua/src/lstate.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lstate.c Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lstate.c,v 2.133 2015/11/13 12:16:51 roberto Exp $ +** $Id: lstate.c,v 2.133.1.1 2017/04/19 17:39:34 roberto Exp $ ** Global State ** See Copyright Notice in lua.h */ Modified: stable/11/contrib/lua/src/lstate.h ============================================================================== --- head/contrib/lua/src/lstate.h Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lstate.h Sun Feb 17 02:39:17 2019 (r344220) @@ -1,5 +1,5 @@ /* -** $Id: lstate.h,v 2.133 2016/12/22 13:08:50 roberto Exp $ +** $Id: lstate.h,v 2.133.1.1 2017/04/19 17:39:34 roberto Exp $ ** Global State ** See Copyright Notice in lua.h */ @@ -26,6 +26,24 @@ ** 'tobefnz': all objects ready to be finalized; ** 'fixedgc': all objects that are not to be collected (currently ** only small strings, such as reserved words). +** +** Moreover, there is another set of lists that control gray objects. +** These lists are linked by fields 'gclist'. (All objects that +** can become gray have such a field. The field is not the same +** in all objects, but it always has this name.) Any gray object +** must belong to one of these lists, and all objects in these lists +** must be gray: +** +** 'gray': regular gray objects, still waiting to be visited. +** 'grayagain': objects that must be revisited at the atomic phase. +** That includes +** - black objects got in a write barrier; +** - all kinds of weak tables during propagation phase; +** - all threads. +** 'weak': tables with weak values to be cleared; +** 'ephemeron': ephemeron tables with white->white entries; +** 'allweak': tables with weak keys and/or weak values to be cleared. +** The last three lists are used only during the atomic phase. */ Modified: stable/11/contrib/lua/src/lstring.c ============================================================================== --- head/contrib/lua/src/lstring.c Wed Nov 29 00:46:36 2017 (r326353) +++ stable/11/contrib/lua/src/lstring.c Sun Feb 17 02:39:17 2019 (r344220) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sun Feb 17 02:58:45 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0786514DEEA9; Sun, 17 Feb 2019 02:58:45 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E56681659; Sun, 17 Feb 2019 02:58:44 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91DF1182E3; Sun, 17 Feb 2019 02:58:44 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1H2wi9c009331; Sun, 17 Feb 2019 02:58:44 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1H2wiV4009330; Sun, 17 Feb 2019 02:58:44 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902170258.x1H2wiV4009330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 17 Feb 2019 02:58:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344221 - in stable: 10/sys/cam/scsi 11/sys/cam/scsi 12/sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 10/sys/cam/scsi 11/sys/cam/scsi 12/sys/cam/scsi X-SVN-Commit-Revision: 344221 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9E56681659 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2019 02:58:45 -0000 Author: avos Date: Sun Feb 17 02:58:44 2019 New Revision: 344221 URL: https://svnweb.freebsd.org/changeset/base/344221 Log: MFC r343501: Add NO_6_BYTE / NO_SYNC_CACHE quirks for (C|D|E).* Olympus digital cameras PR: 97472 Submitted by: Fabio Luis Girardi Reviewed by: imp Modified: stable/11/sys/cam/scsi/scsi_da.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/cam/scsi/scsi_da.c stable/12/sys/cam/scsi/scsi_da.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_da.c Sun Feb 17 02:39:17 2019 (r344220) +++ stable/11/sys/cam/scsi/scsi_da.c Sun Feb 17 02:58:44 2019 (r344221) @@ -1059,6 +1059,30 @@ static struct da_quirk_entry da_quirk_table[] = }, { /* + * Olympus digital cameras (C-3040ZOOM, C-2040ZOOM, C-1) + * PR: usb/97472 + */ + { T_DIRECT, SIP_MEDIA_REMOVABLE, "OLYMPUS", "C*", "*"}, + /*quirks*/ DA_Q_NO_6_BYTE | DA_Q_NO_SYNC_CACHE + }, + { + /* + * Olympus digital cameras (D-370) + * PR: usb/97472 + */ + { T_DIRECT, SIP_MEDIA_REMOVABLE, "OLYMPUS", "D*", "*"}, + /*quirks*/ DA_Q_NO_6_BYTE + }, + { + /* + * Olympus digital cameras (E-100RS, E-10). + * PR: usb/97472 + */ + { T_DIRECT, SIP_MEDIA_REMOVABLE, "OLYMPUS", "E*", "*"}, + /*quirks*/ DA_Q_NO_6_BYTE | DA_Q_NO_SYNC_CACHE + }, + { + /* * Olympus FE-210 camera */ {T_DIRECT, SIP_MEDIA_REMOVABLE, "OLYMPUS", "FE210*", From owner-svn-src-stable-11@freebsd.org Sun Feb 17 03:14:42 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B29914E00F7; Sun, 17 Feb 2019 03:14:42 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B84E82F21; Sun, 17 Feb 2019 03:14:41 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: by mail-lj1-f176.google.com with SMTP id z20so10494071ljj.10; Sat, 16 Feb 2019 19:14:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=+IEa2Q8JoUp67GeDjbQTz7LCkQV4Aik3Ytv6FJZx76c=; b=uDkngcuDwP0PXzDQuc6kC9ZeWUwGCag4E7kni6pm/sKjNhH88YjLnICyelXQZGQStE w5scsuxpzhzsfLOGKxNJJMo7LLEd+e+BKsSy/SyWkuQ92FRp/ftIWncxgD7bNTgQ3Xck dXyBnA/lPbrar2Nn6XGwUOTd/P3RrZHQiU1WVcWu7Fci7ewWTHAHaUv3E2vOWZFj0Fwc tFkbUMfvOPzCf0oGk7bBpeVBDUmn4IT2qoWHoBMHxN4x45sdQBKo9Aoke284j/e2rUDY K37y4E++QfZ9H6/c41yp4NL++yAto58EkqctuBT0uH0pN0eb5A0x5FBZaxV2Lqmi+ayI yt4w== X-Gm-Message-State: AHQUAuZFuIVpdGsgQjzro9TXz3WA2mg9250ww2DdZ1kJkSkhm9hkpG2B WSPf/RF0P9JQxucY9RgPOpgSSe7xXHw= X-Google-Smtp-Source: AHgI3IZe9l5gowbgldgON9rsH80Yooi4U6GmByyPdrOE+rBNQG6H6BPOtXVI1j+ASNicOdu/3NnH5Q== X-Received: by 2002:a2e:90cd:: with SMTP id o13mr665376ljg.153.1550373273397; Sat, 16 Feb 2019 19:14:33 -0800 (PST) Received: from localhost ([37.73.200.183]) by smtp.gmail.com with ESMTPSA id z17sm2763558lfh.9.2019.02.16.19.14.32 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 16 Feb 2019 19:14:32 -0800 (PST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r344223 - stable/11/sys/net80211 References: <201902170312.x1H3CRHx020898@repo.freebsd.org> Date: Sun, 17 Feb 2019 05:13:27 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable From: "Andriy Voskoboinyk" Message-ID: In-Reply-To: <201902170312.x1H3CRHx020898@repo.freebsd.org> User-Agent: Opera Mail/12.15 (FreeBSD) X-Rspamd-Queue-Id: 4B84E82F21 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of andriyvos@gmail.com designates 209.85.208.176 as permitted sender) smtp.mailfrom=andriyvos@gmail.com X-Spamd-Result: default: False [-3.49 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; RCVD_TLS_LAST(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.72)[-0.720,0]; RCVD_IN_DNSWL_NONE(0.00)[176.208.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; IP_SCORE(-1.26)[ip: (-0.43), ipnet: 209.85.128.0/17(-3.79), asn: 15169(-1.99), country: US(-0.07)]; FORGED_SENDER(0.30)[avos@freebsd.org,andriyvos@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[183.200.73.37.zen.spamhaus.org : 127.0.0.11]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MID_RHS_NOT_FQDN(0.50)[]; FROM_NEQ_ENVFROM(0.00)[avos@freebsd.org,andriyvos@gmail.com] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2019 03:14:42 -0000 Sun, 17 Feb 2019 05:12:27 +0200 =D0=B1=D1=83=D0=BB=D0=BE =D0=BD=D0=B0=D0= =BF=D0=B8=D1=81=D0=B0=D0=BD=D0=BE Andriy Voskoboinyk = : > Author: avos > Date: Sun Feb 17 03:12:27 2019 > New Revision: 344223 > URL: https://svnweb.freebsd.org/changeset/base/344223 > > Log: > MFC r343696: > net80211: do not setup roaming parameters for unsupported modes. > ifconfig(8) prints per-mode parameters if they are non-zero; since > we have 13 possible modes with 3...5 typically supported this change= > should greatly reduce amount of information for 'ifconfig lis= t = > roam' > command. Note for 11-STABLE: here we have only 11 modes (no VHT 2GHz / 5GHz). From owner-svn-src-stable-11@freebsd.org Sun Feb 17 03:21:44 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0026514E0244; Sun, 17 Feb 2019 03:21:43 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 98C108332B; Sun, 17 Feb 2019 03:21:43 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8470E1875A; Sun, 17 Feb 2019 03:21:43 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1H3Lh8I024460; Sun, 17 Feb 2019 03:21:43 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1H3LhiH024458; Sun, 17 Feb 2019 03:21:43 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902170321.x1H3LhiH024458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 17 Feb 2019 03:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344225 - stable/11/sys/net80211 X-SVN-Group: stable-11 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/11/sys/net80211 X-SVN-Commit-Revision: 344225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 98C108332B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2019 03:21:44 -0000 Author: avos Date: Sun Feb 17 03:21:42 2019 New Revision: 344225 URL: https://svnweb.freebsd.org/changeset/base/344225 Log: MFC r343699: net80211: do not setup Tx parameters for unsupported modes. That should shorten 'ifconfig list txparam' output since unsupported modes will not be shown. Modified: stable/11/sys/net80211/ieee80211_proto.c stable/11/sys/net80211/ieee80211_tdma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net80211/ieee80211_proto.c ============================================================================== --- stable/11/sys/net80211/ieee80211_proto.c Sun Feb 17 03:21:18 2019 (r344224) +++ stable/11/sys/net80211/ieee80211_proto.c Sun Feb 17 03:21:42 2019 (r344225) @@ -345,6 +345,9 @@ ieee80211_proto_vattach(struct ieee80211vap *vap) * driver and/or user applications. */ for (i = IEEE80211_MODE_11A; i < IEEE80211_MODE_MAX; i++) { + if (isclr(ic->ic_modecaps, i)) + continue; + const struct ieee80211_rateset *rs = &ic->ic_sup_rates[i]; vap->iv_txparms[i].ucastrate = IEEE80211_FIXED_RATE_NONE; Modified: stable/11/sys/net80211/ieee80211_tdma.c ============================================================================== --- stable/11/sys/net80211/ieee80211_tdma.c Sun Feb 17 03:21:18 2019 (r344224) +++ stable/11/sys/net80211/ieee80211_tdma.c Sun Feb 17 03:21:42 2019 (r344225) @@ -125,6 +125,9 @@ static int tdma_process_params(struct ieee80211_node * static void settxparms(struct ieee80211vap *vap, enum ieee80211_phymode mode, int rate) { + if (isclr(vap->iv_ic->ic_modecaps, mode)) + return; + vap->iv_txparms[mode].ucastrate = rate; vap->iv_txparms[mode].mcastrate = rate; } From owner-svn-src-stable-11@freebsd.org Sun Feb 17 03:12:28 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 500FD14E0073; Sun, 17 Feb 2019 03:12:28 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E810082DE8; Sun, 17 Feb 2019 03:12:27 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0157186E4; Sun, 17 Feb 2019 03:12:27 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1H3CRT0020899; Sun, 17 Feb 2019 03:12:27 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1H3CRHx020898; Sun, 17 Feb 2019 03:12:27 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902170312.x1H3CRHx020898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 17 Feb 2019 03:12:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344223 - stable/11/sys/net80211 X-SVN-Group: stable-11 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/11/sys/net80211 X-SVN-Commit-Revision: 344223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E810082DE8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2019 03:12:28 -0000 Author: avos Date: Sun Feb 17 03:12:27 2019 New Revision: 344223 URL: https://svnweb.freebsd.org/changeset/base/344223 Log: MFC r343696: net80211: do not setup roaming parameters for unsupported modes. ifconfig(8) prints per-mode parameters if they are non-zero; since we have 13 possible modes with 3...5 typically supported this change should greatly reduce amount of information for 'ifconfig list roam' command. While here ensure that sta_roam_check() will not use roaming parameters for unsupported modes (it should not). This change effectively reverts r188776. Modified: stable/11/sys/net80211/ieee80211_scan.c stable/11/sys/net80211/ieee80211_scan_sta.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net80211/ieee80211_scan.c ============================================================================== --- stable/11/sys/net80211/ieee80211_scan.c Sun Feb 17 03:11:42 2019 (r344222) +++ stable/11/sys/net80211/ieee80211_scan.c Sun Feb 17 03:12:27 2019 (r344223) @@ -122,13 +122,21 @@ void ieee80211_scan_vattach(struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; + int m; vap->iv_bgscanidle = (IEEE80211_BGSCAN_IDLE_DEFAULT*1000)/hz; vap->iv_bgscanintvl = IEEE80211_BGSCAN_INTVAL_DEFAULT*hz; vap->iv_scanvalid = IEEE80211_SCAN_VALID_DEFAULT*hz; vap->iv_roaming = IEEE80211_ROAMING_AUTO; - memcpy(vap->iv_roamparms, defroam, sizeof(defroam)); + + memset(vap->iv_roamparms, 0, sizeof(vap->iv_roamparms)); + for (m = IEEE80211_MODE_AUTO + 1; m < IEEE80211_MODE_MAX; m++) { + if (isclr(ic->ic_modecaps, m)) + continue; + + memcpy(&vap->iv_roamparms[m], &defroam[m], sizeof(defroam[m])); + } ic->ic_scan_methods->sc_vattach(vap); } Modified: stable/11/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- stable/11/sys/net80211/ieee80211_scan_sta.c Sun Feb 17 03:11:42 2019 (r344222) +++ stable/11/sys/net80211/ieee80211_scan_sta.c Sun Feb 17 03:12:27 2019 (r344223) @@ -1324,6 +1324,9 @@ sta_roam_check(struct ieee80211_scan_state *ss, struct mode = ieee80211_chan2mode(ic->ic_bsschan); roamRate = vap->iv_roamparms[mode].rate; roamRssi = vap->iv_roamparms[mode].rssi; + KASSERT(roamRate != 0 && roamRssi != 0, ("iv_roamparms are not" + "initialized for %s mode!", ieee80211_phymode_name[mode])); + ucastRate = vap->iv_txparms[mode].ucastrate; /* NB: the most up to date rssi is in the node, not the scan cache */ curRssi = ic->ic_node_getrssi(ni); From owner-svn-src-stable-11@freebsd.org Sun Feb 17 10:01:42 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC25D14EC34C; Sun, 17 Feb 2019 10:01:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B2E48EC00; Sun, 17 Feb 2019 10:01:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7013D1CCFD; Sun, 17 Feb 2019 10:01:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1HA1gSq033430; Sun, 17 Feb 2019 10:01:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1HA1gYa033429; Sun, 17 Feb 2019 10:01:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201902171001.x1HA1gYa033429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 17 Feb 2019 10:01:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344230 - stable/11/sys/i386/include X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/i386/include X-SVN-Commit-Revision: 344230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7B2E48EC00 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.95)[-0.945,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2019 10:01:43 -0000 Author: kib Date: Sun Feb 17 10:01:42 2019 New Revision: 344230 URL: https://svnweb.freebsd.org/changeset/base/344230 Log: MFC r343723: i386: Do not ever store to other-CPU counter64 slot. Modified: stable/11/sys/i386/include/counter.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/include/counter.h ============================================================================== --- stable/11/sys/i386/include/counter.h Sun Feb 17 09:57:43 2019 (r344229) +++ stable/11/sys/i386/include/counter.h Sun Feb 17 10:01:42 2019 (r344230) @@ -68,7 +68,12 @@ counter_64_inc_8b(uint64_t *p, int64_t inc) } #ifdef IN_SUBR_COUNTER_C -static inline uint64_t +struct counter_u64_fetch_cx8_arg { + uint64_t res; + uint64_t *p; +}; + +static uint64_t counter_u64_read_one_8b(uint64_t *p) { uint32_t res_lo, res_high; @@ -83,9 +88,22 @@ counter_u64_read_one_8b(uint64_t *p) return (res_lo + ((uint64_t)res_high << 32)); } +static void +counter_u64_fetch_cx8_one(void *arg1) +{ + struct counter_u64_fetch_cx8_arg *arg; + uint64_t val; + + arg = arg1; + val = counter_u64_read_one_8b((uint64_t *)((char *)arg->p + + sizeof(struct pcpu) * PCPU_GET(cpuid))); + atomic_add_64(&arg->res, val); +} + static inline uint64_t counter_u64_fetch_inline(uint64_t *p) { + struct counter_u64_fetch_cx8_arg arg; uint64_t res; int i; @@ -104,9 +122,10 @@ counter_u64_fetch_inline(uint64_t *p) } critical_exit(); } else { - CPU_FOREACH(i) - res += counter_u64_read_one_8b((uint64_t *)((char *)p + - sizeof(struct pcpu) * i)); + arg.p = p; + arg.res = 0; + smp_rendezvous(NULL, counter_u64_fetch_cx8_one, NULL, &arg); + res = arg.res; } return (res); } From owner-svn-src-stable-11@freebsd.org Mon Feb 18 10:13:53 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CCC914D28A1; Mon, 18 Feb 2019 10:13:53 +0000 (UTC) (envelope-from marck@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 108CF87A80; Mon, 18 Feb 2019 10:13:53 +0000 (UTC) (envelope-from marck@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F30AC4780; Mon, 18 Feb 2019 10:13:52 +0000 (UTC) (envelope-from marck@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1IADqh4097953; Mon, 18 Feb 2019 10:13:52 GMT (envelope-from marck@FreeBSD.org) Received: (from marck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1IADq7J097952; Mon, 18 Feb 2019 10:13:52 GMT (envelope-from marck@FreeBSD.org) Message-Id: <201902181013.x1IADq7J097952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marck set sender to marck@FreeBSD.org using -f From: Dmitry Morozovsky Date: Mon, 18 Feb 2019 10:13:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344250 - stable/11/usr.sbin/jail X-SVN-Group: stable-11 X-SVN-Commit-Author: marck X-SVN-Commit-Paths: stable/11/usr.sbin/jail X-SVN-Commit-Revision: 344250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 108CF87A80 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2019 10:13:53 -0000 Author: marck (doc committer) Date: Mon Feb 18 10:13:52 2019 New Revision: 344250 URL: https://svnweb.freebsd.org/changeset/base/344250 Log: MFC: r343164 Clarify error messages a bit. X-Found-With: r343112 Reviewed by: eugen (implicitly, when r343112 analysis) Modified: stable/11/usr.sbin/jail/command.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/jail/command.c ============================================================================== --- stable/11/usr.sbin/jail/command.c Mon Feb 18 10:11:26 2019 (r344249) +++ stable/11/usr.sbin/jail/command.c Mon Feb 18 10:13:52 2019 (r344250) @@ -497,7 +497,7 @@ run_command(struct cfjail *j) argv = alloca(7 * sizeof(char *)); path = string_param(j->intparams[KP_PATH]); if (path == NULL) { - jail_warnx(j, "mount.devfs: no path"); + jail_warnx(j, "mount.devfs: no jail root path defined"); return -1; } devpath = alloca(strlen(path) + 5); @@ -528,7 +528,7 @@ run_command(struct cfjail *j) argv = alloca(7 * sizeof(char *)); path = string_param(j->intparams[KP_PATH]); if (path == NULL) { - jail_warnx(j, "mount.fdescfs: no path"); + jail_warnx(j, "mount.fdescfs: no jail root path defined"); return -1; } devpath = alloca(strlen(path) + 8); @@ -554,7 +554,7 @@ run_command(struct cfjail *j) argv = alloca(7 * sizeof(char *)); path = string_param(j->intparams[KP_PATH]); if (path == NULL) { - jail_warnx(j, "mount.procfs: no path"); + jail_warnx(j, "mount.procfs: no jail root path defined"); return -1; } devpath = alloca(strlen(path) + 6); From owner-svn-src-stable-11@freebsd.org Mon Feb 18 16:02:51 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56F2114E0634; Mon, 18 Feb 2019 16:02:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6A5B6E0B9; Mon, 18 Feb 2019 16:02:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB1F58260; Mon, 18 Feb 2019 16:02:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1IG2oh7081327; Mon, 18 Feb 2019 16:02:50 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1IG2oGg081326; Mon, 18 Feb 2019 16:02:50 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201902181602.x1IG2oGg081326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 18 Feb 2019 16:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344257 - stable/11/usr.sbin/nscd X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/usr.sbin/nscd X-SVN-Commit-Revision: 344257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E6A5B6E0B9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2019 16:02:51 -0000 Author: trasz Date: Mon Feb 18 16:02:50 2019 New Revision: 344257 URL: https://svnweb.freebsd.org/changeset/base/344257 Log: MFC r339194: Remove the BUGS section of nscd(8) man page. According to bushman@'s reponse quoted in PR, he no longer maintains it. PR: 210590 Sponsored by: DARPA, AFRL Modified: stable/11/usr.sbin/nscd/nscd.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/nscd/nscd.8 ============================================================================== --- stable/11/usr.sbin/nscd/nscd.8 Mon Feb 18 16:02:00 2019 (r344256) +++ stable/11/usr.sbin/nscd/nscd.8 Mon Feb 18 16:02:50 2019 (r344257) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 20, 2005 +.Dd October 5, 2018 .Dt NSCD 8 .Os .Sh NAME @@ -160,6 +160,3 @@ The default configuration file. .Xr nsswitch.conf 5 .Sh AUTHORS .An Michael Bushkov Aq Mt bushman@FreeBSD.org -.Sh BUGS -Please send bug reports and suggestions to -.Aq Mt bushman@FreeBSD.org . From owner-svn-src-stable-11@freebsd.org Mon Feb 18 16:03:49 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 291DD14E070D; Mon, 18 Feb 2019 16:03:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD5206E284; Mon, 18 Feb 2019 16:03:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99C308269; Mon, 18 Feb 2019 16:03:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1IG3mlZ081435; Mon, 18 Feb 2019 16:03:48 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1IG3mrG081434; Mon, 18 Feb 2019 16:03:48 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201902181603.x1IG3mrG081434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 18 Feb 2019 16:03:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344258 - stable/11/usr.sbin/nscd X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/usr.sbin/nscd X-SVN-Commit-Revision: 344258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BD5206E284 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2019 16:03:49 -0000 Author: trasz Date: Mon Feb 18 16:03:48 2019 New Revision: 344258 URL: https://svnweb.freebsd.org/changeset/base/344258 Log: MFC r339214: Remove BUGS section from nscd.conf(5) man page. This was missed in r339194. Sponsored by: DARPA, AFRL Modified: stable/11/usr.sbin/nscd/nscd.conf.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/nscd/nscd.conf.5 ============================================================================== --- stable/11/usr.sbin/nscd/nscd.conf.5 Mon Feb 18 16:02:50 2019 (r344257) +++ stable/11/usr.sbin/nscd/nscd.conf.5 Mon Feb 18 16:03:48 2019 (r344258) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2006 +.Dd October 6, 2018 .Dt NSCD.CONF 5 .Os .Sh NAME @@ -153,6 +153,3 @@ symbol at the beginning of the line for comments. .Xr nscd 8 .Sh AUTHORS .An Michael Bushkov Aq Mt bushman@FreeBSD.org -.Sh BUGS -Please send bug reports and suggestions to -.Aq Mt bushman@FreeBSD.org . From owner-svn-src-stable-11@freebsd.org Mon Feb 18 18:57:53 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1258B14E83FC; Mon, 18 Feb 2019 18:57:53 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A760680DCE; Mon, 18 Feb 2019 18:57:52 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93F2B9FA4; Mon, 18 Feb 2019 18:57:52 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1IIvq41075213; Mon, 18 Feb 2019 18:57:52 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1IIvqC1075212; Mon, 18 Feb 2019 18:57:52 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201902181857.x1IIvqC1075212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 18 Feb 2019 18:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344263 - stable/11/sbin/mdmfs X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/sbin/mdmfs X-SVN-Commit-Revision: 344263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A760680DCE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2019 18:57:53 -0000 Author: brooks Date: Mon Feb 18 18:57:52 2019 New Revision: 344263 URL: https://svnweb.freebsd.org/changeset/base/344263 Log: MFC r344023: mdmfs: Fix many bugs in automatic md(4) creation. This code allocated a correctly sized buffer, read past the end of the source buffer, writing off the end of the target buffer, and then writing a '\0' terminator past the end of the target buffer (in the wrong place). It then leaked the buffer. Switch to a statically sized buffer on the stack and update the source pointer and length before use so the correct things are copied. Fix a logic error in the checks that the format of the line is as expected and move on out of an assert. Remove an unneeded close(). fclose() closes the descriptor. Found with: CheriABI Obtained from: CheriBSD Reviewed by: kib, jhb, markj Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D19122 Modified: stable/11/sbin/mdmfs/mdmfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mdmfs/mdmfs.c ============================================================================== --- stable/11/sbin/mdmfs/mdmfs.c Mon Feb 18 18:44:20 2019 (r344262) +++ stable/11/sbin/mdmfs/mdmfs.c Mon Feb 18 18:57:52 2019 (r344263) @@ -441,7 +441,8 @@ static void do_mdconfig_attach_au(const char *args, const enum md_types mdtype) { const char *ta; /* Type arg. */ - char *linep, *linebuf; /* Line pointer, line buffer. */ + char *linep; + char linebuf[12]; /* 32-bit unit (10) + '\n' (1) + '\0' (1) */ int fd; /* Standard output of mdconfig invocation. */ FILE *sfd; int rv; @@ -475,14 +476,15 @@ do_mdconfig_attach_au(const char *args, const enum md_ if (sfd == NULL) err(1, "fdopen"); linep = fgetln(sfd, &linelen); - if (linep == NULL && linelen < mdnamelen + 1) - errx(1, "unexpected output from mdconfig (attach)"); /* If the output format changes, we want to know about it. */ - assert(strncmp(linep, mdname, mdnamelen) == 0); - linebuf = malloc(linelen - mdnamelen + 1); - assert(linebuf != NULL); + if (linep == NULL || linelen <= mdnamelen + 1 || + linelen - mdnamelen >= sizeof(linebuf) || + strncmp(linep, mdname, mdnamelen) != 0) + errx(1, "unexpected output from mdconfig (attach)"); + linep += mdnamelen; + linelen -= mdnamelen; /* Can't use strlcpy because linep is not NULL-terminated. */ - strncpy(linebuf, linep + mdnamelen, linelen); + strncpy(linebuf, linep, linelen); linebuf[linelen] = '\0'; ul = strtoul(linebuf, &p, 10); if (ul == ULONG_MAX || *p != '\n') @@ -490,7 +492,6 @@ do_mdconfig_attach_au(const char *args, const enum md_ unit = ul; fclose(sfd); - close(fd); } /* From owner-svn-src-stable-11@freebsd.org Mon Feb 18 19:13:30 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35AED14E8BE9; Mon, 18 Feb 2019 19:13:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CAE8C819B2; Mon, 18 Feb 2019 19:13:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2764A2F0; Mon, 18 Feb 2019 19:13:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1IJDTdi085907; Mon, 18 Feb 2019 19:13:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1IJDT4f085906; Mon, 18 Feb 2019 19:13:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902181913.x1IJDT4f085906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 18 Feb 2019 19:13:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344265 - stable/11/stand/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/zfs X-SVN-Commit-Revision: 344265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CAE8C819B2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2019 19:13:30 -0000 Author: kevans Date: Mon Feb 18 19:13:28 2019 New Revision: 344265 URL: https://svnweb.freebsd.org/changeset/base/344265 Log: MFC r329727-r329728: lualoader ZFS BE Support r329727: stand/zfs: Add all bootenvs to environment For the benefit of lualoader, add all bootenvs to environment when init_zfs_bootenv is invoked. All of the boot environment logic can then be implemented in pure lua, rather than going back and forth with C to implement paging. This stores all boot environments in bootenvs[idx] and the final count of bootenvs in bootenvs_count. While here, make a copy of currdev for init_zfs_bootenv since it will be modifying it and the caller may not necessarily want that. Some of the logic was shifted around so that the 'currdev' pointer remains at the beginning of the string and 'beroot' is moved around as needed to modify it or ultimately store it in zfs_be_root. The original zfs_bootenv that this was copied from will be able to go away only if/when forth eventually goes away. r329728: stand/zfs: Unbreak build, 'truct' ~= 'struct' Modified: stable/11/stand/zfs/libzfs.h stable/11/stand/zfs/zfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/zfs/libzfs.h ============================================================================== --- stable/11/stand/zfs/libzfs.h Mon Feb 18 19:07:15 2019 (r344264) +++ stable/11/stand/zfs/libzfs.h Mon Feb 18 19:13:28 2019 (r344265) @@ -75,7 +75,7 @@ char *zfs_fmtdev(void *vdev); int zfs_probe_dev(const char *devname, uint64_t *pool_guid); int zfs_list(const char *name); uint64_t ldi_get_size(void *); -void init_zfs_bootenv(char *currdev); +void init_zfs_bootenv(const char *currdev); int zfs_bootenv(const char *name); int zfs_belist_add(const char *name, uint64_t __unused); int zfs_set_env(void); Modified: stable/11/stand/zfs/zfs.c ============================================================================== --- stable/11/stand/zfs/zfs.c Mon Feb 18 19:07:15 2019 (r344264) +++ stable/11/stand/zfs/zfs.c Mon Feb 18 19:13:28 2019 (r344265) @@ -59,6 +59,8 @@ static off_t zfs_seek(struct open_file *f, off_t offse static int zfs_stat(struct open_file *f, struct stat *sb); static int zfs_readdir(struct open_file *f, struct dirent *d); +static void zfs_bootenv_initial(const char *); + struct devsw zfs_dev; struct fs_ops zfs_fsops = { @@ -758,27 +760,83 @@ zfs_list(const char *name) } void -init_zfs_bootenv(char *currdev) +init_zfs_bootenv(const char *currdev_in) { - char *beroot; + char *beroot, *currdev; + int currdev_len; - if (strlen(currdev) == 0) + currdev = NULL; + currdev_len = strlen(currdev_in); + if (currdev_len == 0) return; - if(strncmp(currdev, "zfs:", 4) != 0) + if (strncmp(currdev_in, "zfs:", 4) != 0) return; + currdev = strdup(currdev_in); + if (currdev == NULL) + return; /* Remove the trailing : */ - currdev[strlen(currdev) - 1] = '\0'; + currdev[currdev_len - 1] = '\0'; setenv("zfs_be_active", currdev, 1); setenv("zfs_be_currpage", "1", 1); - /* Forward past zfs: */ - currdev = strchr(currdev, ':'); - currdev++; /* Remove the last element (current bootenv) */ beroot = strrchr(currdev, '/'); if (beroot != NULL) beroot[0] = '\0'; - beroot = currdev; + beroot = strchr(currdev, ':') + 1; setenv("zfs_be_root", beroot, 1); + zfs_bootenv_initial(beroot); + free(currdev); +} + +static void +zfs_bootenv_initial(const char *name) +{ + char poolname[ZFS_MAXNAMELEN], *dsname; + char envname[32], envval[256]; + uint64_t objid; + spa_t *spa; + int bootenvs_idx, len, rv; + + SLIST_INIT(&zfs_be_head); + zfs_env_count = 0; + len = strlen(name); + dsname = strchr(name, '/'); + if (dsname != NULL) { + len = dsname - name; + dsname++; + } else + dsname = ""; + strlcpy(poolname, name, len + 1); + spa = spa_find_by_name(poolname); + if (spa == NULL) + return; + rv = zfs_lookup_dataset(spa, dsname, &objid); + if (rv != 0) + return; + rv = zfs_callback_dataset(spa, objid, zfs_belist_add); + bootenvs_idx = 0; + /* Populate the initial environment variables */ + SLIST_FOREACH_SAFE(zfs_be, &zfs_be_head, entries, zfs_be_tmp) { + /* Enumerate all bootenvs for general usage */ + snprintf(envname, sizeof(envname), "bootenvs[%d]", bootenvs_idx); + snprintf(envval, sizeof(envval), "zfs:%s/%s", name, zfs_be->name); + rv = setenv(envname, envval, 1); + if (rv != 0) + break; + bootenvs_idx++; + } + snprintf(envval, sizeof(envval), "%d", bootenvs_idx); + setenv("bootenvs_count", envval, 1); + + /* Clean up the SLIST of ZFS BEs */ + while (!SLIST_EMPTY(&zfs_be_head)) { + zfs_be = SLIST_FIRST(&zfs_be_head); + SLIST_REMOVE_HEAD(&zfs_be_head, entries); + free(zfs_be); + } + + return; + } int From owner-svn-src-stable-11@freebsd.org Mon Feb 18 19:16:16 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C43814E8C8F; Mon, 18 Feb 2019 19:16:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D07B081BC8; Mon, 18 Feb 2019 19:16:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4D38A2F1; Mon, 18 Feb 2019 19:16:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1IJGFZs086095; Mon, 18 Feb 2019 19:16:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1IJGFBj086093; Mon, 18 Feb 2019 19:16:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902181916.x1IJGFBj086093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 18 Feb 2019 19:16:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344266 - stable/11/stand/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/libsa X-SVN-Commit-Revision: 344266 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D07B081BC8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2019 19:16:16 -0000 Author: kevans Date: Mon Feb 18 19:16:14 2019 New Revision: 344266 URL: https://svnweb.freebsd.org/changeset/base/344266 Log: MFC r332170, r332173: light cd9660 cleanup r332170: libsa: cd9660: warning: 'lenskip' may be used uninitialized in this function We better provide value for lenskip in both instances. r332173: libsa: name is not used in dirmatch() Seems like variable 'name' is leftover. Modified: stable/11/stand/libsa/cd9660.c stable/11/stand/libsa/cd9660read.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/cd9660.c ============================================================================== --- stable/11/stand/libsa/cd9660.c Mon Feb 18 19:13:28 2019 (r344265) +++ stable/11/stand/libsa/cd9660.c Mon Feb 18 19:16:14 2019 (r344266) @@ -309,6 +309,7 @@ cd9660_open(const char *path, struct open_file *f) first = 1; use_rrip = 0; + lenskip = 0; while (*path) { bno = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length); dsize = isonum_733(rec.size); @@ -343,7 +344,7 @@ cd9660_open(const char *path, struct open_file *f) use_rrip = rrip_check(f, dp, &lenskip); if (dirmatch(f, path, dp, use_rrip, - first ? 0 : lenskip)) { + first ? 0 : lenskip)) { first = 0; break; } else Modified: stable/11/stand/libsa/cd9660read.c ============================================================================== --- stable/11/stand/libsa/cd9660read.c Mon Feb 18 19:13:28 2019 (r344265) +++ stable/11/stand/libsa/cd9660read.c Mon Feb 18 19:16:14 2019 (r344266) @@ -174,7 +174,7 @@ dirmatch(const char *path, struct iso_directory_record int lenskip) { size_t len; - const char *cp = NULL, *name = NULL; + const char *cp = NULL; int i, icase; if (use_rrip) @@ -187,7 +187,6 @@ dirmatch(const char *path, struct iso_directory_record icase = 1; } else icase = 0; - name = cp; for (i = len; --i >= 0; path++, cp++) { if (!*path || *path == '/') break; @@ -247,6 +246,7 @@ cd9660_lookup(const char *path) first = 1; use_rrip = 0; + lenskip = 0; while (*path) { bno = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length); dsize = isonum_733(rec.size); From owner-svn-src-stable-11@freebsd.org Tue Feb 19 10:07:49 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34AF214EA1FF; Tue, 19 Feb 2019 10:07:49 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB7F977879; Tue, 19 Feb 2019 10:07:48 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEAB81C3B7; Tue, 19 Feb 2019 10:07:48 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JA7m6c052445; Tue, 19 Feb 2019 10:07:48 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JA7mSq052443; Tue, 19 Feb 2019 10:07:48 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201902191007.x1JA7mSq052443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 19 Feb 2019 10:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344272 - stable/11/sys/dev/vmware/vmxnet3 X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/11/sys/dev/vmware/vmxnet3 X-SVN-Commit-Revision: 344272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DB7F977879 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 10:07:49 -0000 Author: vmaffione Date: Tue Feb 19 10:07:48 2019 New Revision: 344272 URL: https://svnweb.freebsd.org/changeset/base/344272 Log: vmx(4): add native netmap support This change adds native netmap support for the vmx(4) adapter (vmxnet3). Native support comes for free in 12, since the driver has been ported to iflib. To make it minimally intrusive, the native support is only enabled if vmxnet3.netmap_native is set at boot (e.g., in loader.conf). Tested on stable/11 running inside vmplayer. Submitted by: Giuseppe Lettieri Reviewed by: vmaffione, bryanv Sponsored by: Sunny Valley Networks Differential Revision: https://reviews.freebsd.org/D19104 Added: stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h (contents, props changed) Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 03:46:32 2019 (r344271) +++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 10:07:48 2019 (r344272) @@ -239,6 +239,10 @@ typedef enum { static void vmxnet3_barrier(struct vmxnet3_softc *, vmxnet3_barrier_t); +#ifdef DEV_NETMAP +#include "vmx_netmap.h" +#endif + /* Tunables. */ static int vmxnet3_mq_disable = 0; TUNABLE_INT("hw.vmx.mq_disable", &vmxnet3_mq_disable); @@ -270,6 +274,9 @@ DRIVER_MODULE(vmx, pci, vmxnet3_driver, vmxnet3_devcla MODULE_DEPEND(vmx, pci, 1, 1, 1); MODULE_DEPEND(vmx, ether, 1, 1, 1); +#ifdef DEV_NETMAP +MODULE_DEPEND(vmx, netmap, 1, 1, 1); +#endif #define VMXNET3_VMWARE_VENDOR_ID 0x15AD #define VMXNET3_VMWARE_DEVICE_ID 0x07B0 @@ -347,6 +354,10 @@ vmxnet3_attach(device_t dev) vmxnet3_start_taskqueue(sc); #endif +#ifdef DEV_NETMAP + vmxnet3_netmap_attach(sc); +#endif + fail: if (error) vmxnet3_detach(dev); @@ -390,6 +401,10 @@ vmxnet3_detach(device_t dev) #endif vmxnet3_free_interrupts(sc); +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif + if (ifp != NULL) { if_free(ifp); sc->vmx_ifp = NULL; @@ -1846,6 +1861,11 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *txq) txr = &txq->vxtxq_cmd_ring; txc = &txq->vxtxq_comp_ring; +#ifdef DEV_NETMAP + if (netmap_tx_irq(sc->vmx_ifp, txq - sc->vmx_txq) != NM_IRQ_PASS) + return; +#endif + VMXNET3_TXQ_LOCK_ASSERT(txq); for (;;) { @@ -2111,6 +2131,15 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *rxq) ifp = sc->vmx_ifp; rxc = &rxq->vxrxq_comp_ring; +#ifdef DEV_NETMAP + { + int dummy; + if (netmap_rx_irq(ifp, rxq - sc->vmx_rxq, &dummy) != + NM_IRQ_PASS) + return; + } +#endif + VMXNET3_RXQ_LOCK_ASSERT(rxq); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -2401,6 +2430,10 @@ vmxnet3_stop_rendezvous(struct vmxnet3_softc *sc) struct vmxnet3_txqueue *txq; int i; +#ifdef DEV_NETMAP + netmap_disable_all_rings(sc->vmx_ifp); +#endif + for (i = 0; i < sc->vmx_nrxqueues; i++) { rxq = &sc->vmx_rxq[i]; VMXNET3_RXQ_LOCK(rxq); @@ -2454,6 +2487,10 @@ vmxnet3_txinit(struct vmxnet3_softc *sc, struct vmxnet bzero(txr->vxtxr_txd, txr->vxtxr_ndesc * sizeof(struct vmxnet3_txdesc)); +#ifdef DEV_NETMAP + vmxnet3_netmap_txq_init(sc, txq); +#endif + txc = &txq->vxtxq_comp_ring; txc->vxcr_next = 0; txc->vxcr_gen = VMXNET3_INIT_GEN; @@ -2468,6 +2505,10 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct vmxnet struct vmxnet3_rxring *rxr; struct vmxnet3_comp_ring *rxc; int i, populate, idx, frame_size, error; +#ifdef DEV_NETMAP + struct netmap_adapter *na; + struct netmap_slot *slot; +#endif ifp = sc->vmx_ifp; frame_size = ETHER_ALIGN + sizeof(struct ether_vlan_header) + @@ -2498,12 +2539,24 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct vmxnet else populate = VMXNET3_RXRINGS_PERQ; +#ifdef DEV_NETMAP + na = NA(ifp); + slot = netmap_reset(na, NR_RX, rxq - sc->vmx_rxq, 0); +#endif + for (i = 0; i < populate; i++) { rxr = &rxq->vxrxq_cmd_ring[i]; rxr->vxrxr_fill = 0; rxr->vxrxr_gen = VMXNET3_INIT_GEN; bzero(rxr->vxrxr_rxd, rxr->vxrxr_ndesc * sizeof(struct vmxnet3_rxdesc)); +#ifdef DEV_NETMAP + if (slot != NULL) { + vmxnet3_netmap_rxq_init(sc, rxq, rxr, slot); + i = populate; + break; + } +#endif for (idx = 0; idx < rxr->vxrxr_ndesc; idx++) { error = vmxnet3_newbuf(sc, rxr); @@ -2625,6 +2678,10 @@ vmxnet3_init_locked(struct vmxnet3_softc *sc) ifp->if_drv_flags |= IFF_DRV_RUNNING; vmxnet3_link_status(sc); + +#ifdef DEV_NETMAP + netmap_enable_all_rings(ifp); +#endif vmxnet3_enable_all_intrs(sc); callout_reset(&sc->vmx_tick, hz, vmxnet3_tick, sc); Added: stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h Tue Feb 19 10:07:48 2019 (r344272) @@ -0,0 +1,376 @@ +/* + * Copyright (C) 2019 Universita` di Pisa. + * Sponsored by Sunny Valley Networks. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $FreeBSD$ */ + +#include +#include + +static int +vmxnet3_netmap_reg(struct netmap_adapter *na, int onoff) +{ + struct ifnet *ifp = na->ifp; + struct vmxnet3_softc *sc = ifp->if_softc; + + VMXNET3_CORE_LOCK(sc); + vmxnet3_stop(sc); + if (onoff) { + nm_set_native_flags(na); + } else { + nm_clear_native_flags(na); + } + vmxnet3_init_locked(sc); + VMXNET3_CORE_UNLOCK(sc); + return 0; +} + +static void +vmxnet3_netmap_rxq_init(struct vmxnet3_softc *sc, struct vmxnet3_rxqueue *rxq, + struct vmxnet3_rxring *rxr, struct netmap_slot *slot) +{ + struct ifnet *ifp = sc->vmx_ifp; + struct netmap_adapter *na = NA(ifp); + struct vmxnet3_rxdesc *rxd; + int q, i; + + q = rxq - sc->vmx_rxq; + + for (i = 0; ; i++) { + int idx = rxr->vxrxr_fill; + int si = netmap_idx_n2k(na->rx_rings[q], idx); + struct vmxnet3_rxbuf *rxb = &rxr->vxrxr_rxbuf[idx]; + uint64_t paddr; + void *addr; + + addr = PNMB(na, slot + si, &paddr); + netmap_load_map(na, rxr->vxrxr_rxtag, rxb->vrxb_dmamap, addr); + + rxd = &rxr->vxrxr_rxd[idx]; + rxd->addr = paddr; + rxd->len = NETMAP_BUF_SIZE(na); + rxd->gen = rxr->vxrxr_gen ^ 1; + rxd->btype = VMXNET3_BTYPE_HEAD; + nm_prdis("%d: addr %lx len %u btype %u gen %u", + idx, rxd->addr, rxd->len, rxd->btype, rxd->gen); + + if (i == rxr->vxrxr_ndesc -1) + break; + + rxd->gen ^= 1; + vmxnet3_rxr_increment_fill(rxr); + } +} + +static void +vmxnet3_netmap_txq_init(struct vmxnet3_softc *sc, struct vmxnet3_txqueue *txq) +{ + struct ifnet *ifp = sc->vmx_ifp; + struct netmap_adapter *na; + struct netmap_slot *slot; + struct vmxnet3_txring *txr; + int i, gen, q; + + q = txq - sc->vmx_txq; + + na = NA(ifp); + + slot = netmap_reset(na, NR_TX, q, 0); + if (slot == NULL) + return; + + txr = &txq->vxtxq_cmd_ring; + gen = txr->vxtxr_gen ^ 1; + + for (i = 0; i < txr->vxtxr_ndesc; i++) { + int si = netmap_idx_n2k(na->tx_rings[q], i); + struct vmxnet3_txdesc *txd = &txr->vxtxr_txd[i]; + uint64_t paddr; + void *addr; + + addr = PNMB(na, slot + si, &paddr); + + txd->addr = paddr; + txd->len = 0; + txd->gen = gen; + txd->dtype = 0; + txd->offload_mode = VMXNET3_OM_NONE; + txd->offload_pos = 0; + txd->hlen = 0; + txd->eop = 0; + txd->compreq = 0; + txd->vtag_mode = 0; + txd->vtag = 0; + + netmap_load_map(na, txr->vxtxr_txtag, + txr->vxtxr_txbuf[i].vtxb_dmamap, addr); + } +} + +static int +vmxnet3_netmap_txsync(struct netmap_kring *kring, int flags) +{ + struct netmap_adapter *na = kring->na; + struct ifnet *ifp = na->ifp; + struct netmap_ring *ring = kring->ring; + u_int nm_i; + u_int nic_i; + u_int n; + u_int const lim = kring->nkr_num_slots - 1; + u_int const head = kring->rhead; + + /* + * interrupts on every tx packet are expensive so request + * them every half ring, or where NS_REPORT is set + */ + u_int report_frequency = kring->nkr_num_slots >> 1; + /* device specific */ + struct vmxnet3_softc *sc = ifp->if_softc; + struct vmxnet3_txqueue *txq = &sc->vmx_txq[kring->ring_id]; + struct vmxnet3_txring *txr = &txq->vxtxq_cmd_ring; + struct vmxnet3_comp_ring *txc = &txq->vxtxq_comp_ring; + struct vmxnet3_txcompdesc *txcd = txc->vxcr_u.txcd; + int gen = txr->vxtxr_gen; + + /* no need to dma-sync the ring; memory barriers are sufficient */ + + nm_i = kring->nr_hwcur; + if (nm_i != head) { + nic_i = netmap_idx_k2n(kring, nm_i); + for (n = 0; nm_i != head; n++) { + struct netmap_slot *slot = &ring->slot[nm_i]; + u_int len = slot->len; + uint64_t paddr; + void *addr = PNMB(na, slot, &paddr); + int compreq = !!(slot->flags & NS_REPORT || + nic_i == 0 || nic_i == report_frequency); + + /* device specific */ + struct vmxnet3_txdesc *curr = &txr->vxtxr_txd[nic_i]; + struct vmxnet3_txbuf *txbuf = &txr->vxtxr_txbuf[nic_i]; + + NM_CHECK_ADDR_LEN(na, addr, len); + + /* fill the slot in the NIC ring */ + curr->len = len; + curr->eop = 1; /* NS_MOREFRAG not supported */ + curr->compreq = compreq; + + if (slot->flags & NS_BUF_CHANGED) { + curr->addr = paddr; + netmap_reload_map(na, txr->vxtxr_txtag, + txbuf->vtxb_dmamap, addr); + } + slot->flags &= ~(NS_REPORT | NS_BUF_CHANGED); + + /* make sure changes to the buffer are synced */ + bus_dmamap_sync(txr->vxtxr_txtag, txbuf->vtxb_dmamap, + BUS_DMASYNC_PREWRITE); + + /* pass ownership */ + vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); + curr->gen = gen; + + nm_i = nm_next(nm_i, lim); + nic_i++; + if (unlikely(nic_i == lim + 1)) { + nic_i = 0; + gen = txr->vxtxr_gen ^= 1; + } + } + + vmxnet3_write_bar0(sc, VMXNET3_BAR0_TXH(txq->vxtxq_id), nic_i); + } + kring->nr_hwcur = nm_i; + + /* reclaim completed packets */ + for (;;) { + u_int sop; + struct vmxnet3_txbuf *txb; + + txcd = &txc->vxcr_u.txcd[txc->vxcr_next]; + if (txcd->gen != txc->vxcr_gen) + break; + + vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); + + if (++txc->vxcr_next == txc->vxcr_ndesc) { + txc->vxcr_next = 0; + txc->vxcr_gen ^= 1; + } + + sop = txr->vxtxr_next; + txb = &txr->vxtxr_txbuf[sop]; + + bus_dmamap_sync(txr->vxtxr_txtag, txb->vtxb_dmamap, + BUS_DMASYNC_POSTWRITE); + + txr->vxtxr_next = (txcd->eop_idx + 1) % txr->vxtxr_ndesc; + } + kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, txr->vxtxr_next), lim); + + return 0; +} + +static int +vmxnet3_netmap_rxsync(struct netmap_kring *kring, int flags) +{ + struct netmap_adapter *na = kring->na; + struct netmap_ring *ring = kring->ring; + u_int nm_i; + u_int nic_i; + u_int const lim = kring->nkr_num_slots - 1; + u_int const head = kring->rhead; + int force_update = (flags & NAF_FORCE_READ); + + struct ifnet *ifp = na->ifp; + struct vmxnet3_softc *sc = ifp->if_softc; + struct vmxnet3_rxqueue *rxq = &sc->vmx_rxq[kring->ring_id]; + struct vmxnet3_rxring *rxr; + struct vmxnet3_comp_ring *rxc; + + if (head > lim) + return netmap_ring_reinit(kring); + + rxr = &rxq->vxrxq_cmd_ring[0]; + + /* no need to dma-sync the ring; memory barriers are sufficient */ + + /* first part: import newly received packets */ + if (netmap_no_pendintr || force_update) { + rxc = &rxq->vxrxq_comp_ring; + nm_i = kring->nr_hwtail; + nic_i = netmap_idx_k2n(kring, nm_i); + for (;;) { + struct vmxnet3_rxcompdesc *rxcd; + struct vmxnet3_rxbuf *rxb; + + rxcd = &rxc->vxcr_u.rxcd[rxc->vxcr_next]; + + if (rxcd->gen != rxc->vxcr_gen) + break; + vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); + + while (__predict_false(rxcd->rxd_idx != nic_i)) { + nm_prlim(1, "%u skipped! idx %u", nic_i, rxcd->rxd_idx); + /* to shelter the application from this we + * would need to rotate the kernel-owned + * portion of the netmap and nic rings. We + * return len=0 for now and hope for the best. + */ + ring->slot[nm_i].len = 0; + nic_i = nm_next(nm_i, lim); + nm_i = nm_next(nm_i, lim); + } + + rxb = &rxr->vxrxr_rxbuf[nic_i]; + + ring->slot[nm_i].len = rxcd->len; + ring->slot[nm_i].flags = 0; + + bus_dmamap_sync(rxr->vxrxr_rxtag, rxb->vrxb_dmamap, + BUS_DMASYNC_POSTREAD); + + nic_i = nm_next(nm_i, lim); + nm_i = nm_next(nm_i, lim); + + rxc->vxcr_next++; + if (__predict_false(rxc->vxcr_next == rxc->vxcr_ndesc)) { + rxc->vxcr_next = 0; + rxc->vxcr_gen ^= 1; + } + } + kring->nr_hwtail = nm_i; + } + /* second part: skip past packets that userspace has released */ + nm_i = kring->nr_hwcur; + if (nm_i != head) { + nic_i = netmap_idx_k2n(kring, nm_i); + while (nm_i != head) { + struct netmap_slot *slot = &ring->slot[nm_i]; + struct vmxnet3_rxdesc *rxd_fill; + struct vmxnet3_rxbuf *rxbuf; + + if (slot->flags & NS_BUF_CHANGED) { + uint64_t paddr; + void *addr = PNMB(na, slot, &paddr); + struct vmxnet3_rxdesc *rxd = &rxr->vxrxr_rxd[nic_i]; + + + if (addr == NETMAP_BUF_BASE(na)) + return netmap_ring_reinit(kring); + + rxd->addr = paddr; + rxbuf = &rxr->vxrxr_rxbuf[nic_i]; + netmap_reload_map(na, rxr->vxrxr_rxtag, + rxbuf->vrxb_dmamap, addr); + slot->flags &= ~NS_BUF_CHANGED; + vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); + } + + rxd_fill = &rxr->vxrxr_rxd[rxr->vxrxr_fill]; + rxbuf = &rxr->vxrxr_rxbuf[rxr->vxrxr_fill]; + + bus_dmamap_sync(rxr->vxrxr_rxtag, rxbuf->vrxb_dmamap, + BUS_DMASYNC_PREREAD); + + rxd_fill->gen = rxr->vxrxr_gen; + vmxnet3_rxr_increment_fill(rxr); + + nm_i = nm_next(nm_i, lim); + nic_i = nm_next(nic_i, lim); + } + kring->nr_hwcur = head; + if (__predict_false(rxq->vxrxq_rs->update_rxhead)) { + vmxnet3_write_bar0(sc, + VMXNET3_BAR0_RXH1(kring->ring_id), rxr->vxrxr_fill); + } + } + return 0; +} + +static void +vmxnet3_netmap_attach(struct vmxnet3_softc *sc) +{ + struct netmap_adapter na; + int enable = 0; + + if (getenv_int("vmxnet3.netmap_native", &enable) < 0 || !enable) { + return; + } + + bzero(&na, sizeof(na)); + + na.ifp = sc->vmx_ifp; + na.na_flags = NAF_BDG_MAYSLEEP; + na.num_tx_desc = sc->vmx_ntxdescs; + na.num_rx_desc = sc->vmx_nrxdescs; + na.num_tx_rings = sc->vmx_ntxqueues; + na.num_rx_rings = sc->vmx_nrxqueues; + na.nm_register = vmxnet3_netmap_reg; + na.nm_txsync = vmxnet3_netmap_txsync; + na.nm_rxsync = vmxnet3_netmap_rxsync; + netmap_attach(&na); +} From owner-svn-src-stable-11@freebsd.org Tue Feb 19 10:40:36 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D6C714EC024; Tue, 19 Feb 2019 10:40:36 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ABB2C8157C; Tue, 19 Feb 2019 10:40:35 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D6DC1C90F; Tue, 19 Feb 2019 10:40:35 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JAeZEQ068203; Tue, 19 Feb 2019 10:40:35 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JAeZ3E068202; Tue, 19 Feb 2019 10:40:35 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201902191040.x1JAeZ3E068202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 19 Feb 2019 10:40:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344275 - stable/11/sys/rpc/rpcsec_gss X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/sys/rpc/rpcsec_gss X-SVN-Commit-Revision: 344275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ABB2C8157C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 10:40:36 -0000 Author: trasz Date: Tue Feb 19 10:40:35 2019 New Revision: 344275 URL: https://svnweb.freebsd.org/changeset/base/344275 Log: MFC r342114: Add kern.rpc.gss.client_max, to make it possible to bump it easily. This can drastically lower the load on gssd(8) on large NFS servers. Modified: stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c ============================================================================== --- stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Tue Feb 19 10:28:59 2019 (r344274) +++ stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Tue Feb 19 10:40:35 2019 (r344275) @@ -168,9 +168,22 @@ struct svc_rpc_gss_cookedcred { #define CLIENT_HASH_SIZE 256 #define CLIENT_MAX 128 +u_int svc_rpc_gss_client_max = CLIENT_MAX; + +SYSCTL_NODE(_kern, OID_AUTO, rpc, CTLFLAG_RW, 0, "RPC"); +SYSCTL_NODE(_kern_rpc, OID_AUTO, gss, CTLFLAG_RW, 0, "GSS"); + +SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_max, CTLFLAG_RW, + &svc_rpc_gss_client_max, 0, + "Max number of rpc-gss clients"); + +static u_int svc_rpc_gss_client_count; +SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_count, CTLFLAG_RD, + &svc_rpc_gss_client_count, 0, + "Number of rpc-gss clients"); + struct svc_rpc_gss_client_list svc_rpc_gss_client_hash[CLIENT_HASH_SIZE]; struct svc_rpc_gss_client_list svc_rpc_gss_clients; -static size_t svc_rpc_gss_client_count; static uint32_t svc_rpc_gss_next_clientid = 1; static void @@ -666,7 +679,7 @@ svc_rpc_gss_timeout_clients(void) */ sx_xlock(&svc_rpc_gss_lock); client = TAILQ_LAST(&svc_rpc_gss_clients, svc_rpc_gss_client_list); - while (svc_rpc_gss_client_count > CLIENT_MAX && client != NULL) { + while (svc_rpc_gss_client_count > svc_rpc_gss_client_max && client != NULL) { svc_rpc_gss_forget_client_locked(client); sx_xunlock(&svc_rpc_gss_lock); svc_rpc_gss_release_client(client); From owner-svn-src-stable-11@freebsd.org Tue Feb 19 14:36:20 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB86514F283E; Tue, 19 Feb 2019 14:36:19 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E959897C6; Tue, 19 Feb 2019 14:36:18 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x1JEaHpV010800; Tue, 19 Feb 2019 06:36:17 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id x1JEaHqr010799; Tue, 19 Feb 2019 06:36:17 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201902191436.x1JEaHqr010799@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r344272 - stable/11/sys/dev/vmware/vmxnet3 In-Reply-To: <201902191007.x1JA7mSq052443@repo.freebsd.org> To: Vincenzo Maffione Date: Tue, 19 Feb 2019 06:36:16 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 1E959897C6 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.92)[-0.918,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 14:36:20 -0000 > Author: vmaffione > Date: Tue Feb 19 10:07:48 2019 > New Revision: 344272 > URL: https://svnweb.freebsd.org/changeset/base/344272 > > Log: > vmx(4): add native netmap support > > This change adds native netmap support for the vmx(4) adapter > (vmxnet3). Native support comes for free in 12, since the driver has been ^^^ This commit is to stable/11 > ported to iflib. To make it minimally intrusive, the native support is > only enabled if vmxnet3.netmap_native is set at boot (e.g., in loader.conf). > > Tested on stable/11 running inside vmplayer. > > Submitted by: Giuseppe Lettieri > Reviewed by: vmaffione, bryanv > Sponsored by: Sunny Valley Networks > Differential Revision: https://reviews.freebsd.org/D19104 Huh? When did the vmx driver in stable/11 become iflib'ed? > > Added: > stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h (contents, props changed) > Modified: > stable/11/sys/dev/vmware/vmxnet3/if_vmx.c > > Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c > ============================================================================== > --- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 03:46:32 2019 (r344271) > +++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 10:07:48 2019 (r344272) > @@ -239,6 +239,10 @@ typedef enum { > > static void vmxnet3_barrier(struct vmxnet3_softc *, vmxnet3_barrier_t); > > +#ifdef DEV_NETMAP > +#include "vmx_netmap.h" > +#endif > + > /* Tunables. */ > static int vmxnet3_mq_disable = 0; > TUNABLE_INT("hw.vmx.mq_disable", &vmxnet3_mq_disable); > @@ -270,6 +274,9 @@ DRIVER_MODULE(vmx, pci, vmxnet3_driver, vmxnet3_devcla > > MODULE_DEPEND(vmx, pci, 1, 1, 1); > MODULE_DEPEND(vmx, ether, 1, 1, 1); > +#ifdef DEV_NETMAP > +MODULE_DEPEND(vmx, netmap, 1, 1, 1); > +#endif > > #define VMXNET3_VMWARE_VENDOR_ID 0x15AD > #define VMXNET3_VMWARE_DEVICE_ID 0x07B0 > @@ -347,6 +354,10 @@ vmxnet3_attach(device_t dev) > vmxnet3_start_taskqueue(sc); > #endif > > +#ifdef DEV_NETMAP > + vmxnet3_netmap_attach(sc); > +#endif > + > fail: > if (error) > vmxnet3_detach(dev); > @@ -390,6 +401,10 @@ vmxnet3_detach(device_t dev) > #endif > vmxnet3_free_interrupts(sc); > > +#ifdef DEV_NETMAP > + netmap_detach(ifp); > +#endif > + > if (ifp != NULL) { > if_free(ifp); > sc->vmx_ifp = NULL; > @@ -1846,6 +1861,11 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *txq) > txr = &txq->vxtxq_cmd_ring; > txc = &txq->vxtxq_comp_ring; > > +#ifdef DEV_NETMAP > + if (netmap_tx_irq(sc->vmx_ifp, txq - sc->vmx_txq) != NM_IRQ_PASS) > + return; > +#endif > + > VMXNET3_TXQ_LOCK_ASSERT(txq); > > for (;;) { > @@ -2111,6 +2131,15 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *rxq) > ifp = sc->vmx_ifp; > rxc = &rxq->vxrxq_comp_ring; > > +#ifdef DEV_NETMAP > + { > + int dummy; > + if (netmap_rx_irq(ifp, rxq - sc->vmx_rxq, &dummy) != > + NM_IRQ_PASS) > + return; > + } > +#endif > + > VMXNET3_RXQ_LOCK_ASSERT(rxq); > > if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) > @@ -2401,6 +2430,10 @@ vmxnet3_stop_rendezvous(struct vmxnet3_softc *sc) > struct vmxnet3_txqueue *txq; > int i; > > +#ifdef DEV_NETMAP > + netmap_disable_all_rings(sc->vmx_ifp); > +#endif > + > for (i = 0; i < sc->vmx_nrxqueues; i++) { > rxq = &sc->vmx_rxq[i]; > VMXNET3_RXQ_LOCK(rxq); > @@ -2454,6 +2487,10 @@ vmxnet3_txinit(struct vmxnet3_softc *sc, struct vmxnet > bzero(txr->vxtxr_txd, > txr->vxtxr_ndesc * sizeof(struct vmxnet3_txdesc)); > > +#ifdef DEV_NETMAP > + vmxnet3_netmap_txq_init(sc, txq); > +#endif > + > txc = &txq->vxtxq_comp_ring; > txc->vxcr_next = 0; > txc->vxcr_gen = VMXNET3_INIT_GEN; > @@ -2468,6 +2505,10 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct vmxnet > struct vmxnet3_rxring *rxr; > struct vmxnet3_comp_ring *rxc; > int i, populate, idx, frame_size, error; > +#ifdef DEV_NETMAP > + struct netmap_adapter *na; > + struct netmap_slot *slot; > +#endif > > ifp = sc->vmx_ifp; > frame_size = ETHER_ALIGN + sizeof(struct ether_vlan_header) + > @@ -2498,12 +2539,24 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct vmxnet > else > populate = VMXNET3_RXRINGS_PERQ; > > +#ifdef DEV_NETMAP > + na = NA(ifp); > + slot = netmap_reset(na, NR_RX, rxq - sc->vmx_rxq, 0); > +#endif > + > for (i = 0; i < populate; i++) { > rxr = &rxq->vxrxq_cmd_ring[i]; > rxr->vxrxr_fill = 0; > rxr->vxrxr_gen = VMXNET3_INIT_GEN; > bzero(rxr->vxrxr_rxd, > rxr->vxrxr_ndesc * sizeof(struct vmxnet3_rxdesc)); > +#ifdef DEV_NETMAP > + if (slot != NULL) { > + vmxnet3_netmap_rxq_init(sc, rxq, rxr, slot); > + i = populate; > + break; > + } > +#endif > > for (idx = 0; idx < rxr->vxrxr_ndesc; idx++) { > error = vmxnet3_newbuf(sc, rxr); > @@ -2625,6 +2678,10 @@ vmxnet3_init_locked(struct vmxnet3_softc *sc) > > ifp->if_drv_flags |= IFF_DRV_RUNNING; > vmxnet3_link_status(sc); > + > +#ifdef DEV_NETMAP > + netmap_enable_all_rings(ifp); > +#endif > > vmxnet3_enable_all_intrs(sc); > callout_reset(&sc->vmx_tick, hz, vmxnet3_tick, sc); > > Added: stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h Tue Feb 19 10:07:48 2019 (r344272) > @@ -0,0 +1,376 @@ > +/* > + * Copyright (C) 2019 Universita` di Pisa. > + * Sponsored by Sunny Valley Networks. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +/* $FreeBSD$ */ > + > +#include > +#include > + > +static int > +vmxnet3_netmap_reg(struct netmap_adapter *na, int onoff) > +{ > + struct ifnet *ifp = na->ifp; > + struct vmxnet3_softc *sc = ifp->if_softc; > + > + VMXNET3_CORE_LOCK(sc); > + vmxnet3_stop(sc); > + if (onoff) { > + nm_set_native_flags(na); > + } else { > + nm_clear_native_flags(na); > + } > + vmxnet3_init_locked(sc); > + VMXNET3_CORE_UNLOCK(sc); > + return 0; > +} > + > +static void > +vmxnet3_netmap_rxq_init(struct vmxnet3_softc *sc, struct vmxnet3_rxqueue *rxq, > + struct vmxnet3_rxring *rxr, struct netmap_slot *slot) > +{ > + struct ifnet *ifp = sc->vmx_ifp; > + struct netmap_adapter *na = NA(ifp); > + struct vmxnet3_rxdesc *rxd; > + int q, i; > + > + q = rxq - sc->vmx_rxq; > + > + for (i = 0; ; i++) { > + int idx = rxr->vxrxr_fill; > + int si = netmap_idx_n2k(na->rx_rings[q], idx); > + struct vmxnet3_rxbuf *rxb = &rxr->vxrxr_rxbuf[idx]; > + uint64_t paddr; > + void *addr; > + > + addr = PNMB(na, slot + si, &paddr); > + netmap_load_map(na, rxr->vxrxr_rxtag, rxb->vrxb_dmamap, addr); > + > + rxd = &rxr->vxrxr_rxd[idx]; > + rxd->addr = paddr; > + rxd->len = NETMAP_BUF_SIZE(na); > + rxd->gen = rxr->vxrxr_gen ^ 1; > + rxd->btype = VMXNET3_BTYPE_HEAD; > + nm_prdis("%d: addr %lx len %u btype %u gen %u", > + idx, rxd->addr, rxd->len, rxd->btype, rxd->gen); > + > + if (i == rxr->vxrxr_ndesc -1) > + break; > + > + rxd->gen ^= 1; > + vmxnet3_rxr_increment_fill(rxr); > + } > +} > + > +static void > +vmxnet3_netmap_txq_init(struct vmxnet3_softc *sc, struct vmxnet3_txqueue *txq) > +{ > + struct ifnet *ifp = sc->vmx_ifp; > + struct netmap_adapter *na; > + struct netmap_slot *slot; > + struct vmxnet3_txring *txr; > + int i, gen, q; > + > + q = txq - sc->vmx_txq; > + > + na = NA(ifp); > + > + slot = netmap_reset(na, NR_TX, q, 0); > + if (slot == NULL) > + return; > + > + txr = &txq->vxtxq_cmd_ring; > + gen = txr->vxtxr_gen ^ 1; > + > + for (i = 0; i < txr->vxtxr_ndesc; i++) { > + int si = netmap_idx_n2k(na->tx_rings[q], i); > + struct vmxnet3_txdesc *txd = &txr->vxtxr_txd[i]; > + uint64_t paddr; > + void *addr; > + > + addr = PNMB(na, slot + si, &paddr); > + > + txd->addr = paddr; > + txd->len = 0; > + txd->gen = gen; > + txd->dtype = 0; > + txd->offload_mode = VMXNET3_OM_NONE; > + txd->offload_pos = 0; > + txd->hlen = 0; > + txd->eop = 0; > + txd->compreq = 0; > + txd->vtag_mode = 0; > + txd->vtag = 0; > + > + netmap_load_map(na, txr->vxtxr_txtag, > + txr->vxtxr_txbuf[i].vtxb_dmamap, addr); > + } > +} > + > +static int > +vmxnet3_netmap_txsync(struct netmap_kring *kring, int flags) > +{ > + struct netmap_adapter *na = kring->na; > + struct ifnet *ifp = na->ifp; > + struct netmap_ring *ring = kring->ring; > + u_int nm_i; > + u_int nic_i; > + u_int n; > + u_int const lim = kring->nkr_num_slots - 1; > + u_int const head = kring->rhead; > + > + /* > + * interrupts on every tx packet are expensive so request > + * them every half ring, or where NS_REPORT is set > + */ > + u_int report_frequency = kring->nkr_num_slots >> 1; > + /* device specific */ > + struct vmxnet3_softc *sc = ifp->if_softc; > + struct vmxnet3_txqueue *txq = &sc->vmx_txq[kring->ring_id]; > + struct vmxnet3_txring *txr = &txq->vxtxq_cmd_ring; > + struct vmxnet3_comp_ring *txc = &txq->vxtxq_comp_ring; > + struct vmxnet3_txcompdesc *txcd = txc->vxcr_u.txcd; > + int gen = txr->vxtxr_gen; > + > + /* no need to dma-sync the ring; memory barriers are sufficient */ > + > + nm_i = kring->nr_hwcur; > + if (nm_i != head) { > + nic_i = netmap_idx_k2n(kring, nm_i); > + for (n = 0; nm_i != head; n++) { > + struct netmap_slot *slot = &ring->slot[nm_i]; > + u_int len = slot->len; > + uint64_t paddr; > + void *addr = PNMB(na, slot, &paddr); > + int compreq = !!(slot->flags & NS_REPORT || > + nic_i == 0 || nic_i == report_frequency); > + > + /* device specific */ > + struct vmxnet3_txdesc *curr = &txr->vxtxr_txd[nic_i]; > + struct vmxnet3_txbuf *txbuf = &txr->vxtxr_txbuf[nic_i]; > + > + NM_CHECK_ADDR_LEN(na, addr, len); > + > + /* fill the slot in the NIC ring */ > + curr->len = len; > + curr->eop = 1; /* NS_MOREFRAG not supported */ > + curr->compreq = compreq; > + > + if (slot->flags & NS_BUF_CHANGED) { > + curr->addr = paddr; > + netmap_reload_map(na, txr->vxtxr_txtag, > + txbuf->vtxb_dmamap, addr); > + } > + slot->flags &= ~(NS_REPORT | NS_BUF_CHANGED); > + > + /* make sure changes to the buffer are synced */ > + bus_dmamap_sync(txr->vxtxr_txtag, txbuf->vtxb_dmamap, > + BUS_DMASYNC_PREWRITE); > + > + /* pass ownership */ > + vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); > + curr->gen = gen; > + > + nm_i = nm_next(nm_i, lim); > + nic_i++; > + if (unlikely(nic_i == lim + 1)) { > + nic_i = 0; > + gen = txr->vxtxr_gen ^= 1; > + } > + } > + > + vmxnet3_write_bar0(sc, VMXNET3_BAR0_TXH(txq->vxtxq_id), nic_i); > + } > + kring->nr_hwcur = nm_i; > + > + /* reclaim completed packets */ > + for (;;) { > + u_int sop; > + struct vmxnet3_txbuf *txb; > + > + txcd = &txc->vxcr_u.txcd[txc->vxcr_next]; > + if (txcd->gen != txc->vxcr_gen) > + break; > + > + vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); > + > + if (++txc->vxcr_next == txc->vxcr_ndesc) { > + txc->vxcr_next = 0; > + txc->vxcr_gen ^= 1; > + } > + > + sop = txr->vxtxr_next; > + txb = &txr->vxtxr_txbuf[sop]; > + > + bus_dmamap_sync(txr->vxtxr_txtag, txb->vtxb_dmamap, > + BUS_DMASYNC_POSTWRITE); > + > + txr->vxtxr_next = (txcd->eop_idx + 1) % txr->vxtxr_ndesc; > + } > + kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, txr->vxtxr_next), lim); > + > + return 0; > +} > + > +static int > +vmxnet3_netmap_rxsync(struct netmap_kring *kring, int flags) > +{ > + struct netmap_adapter *na = kring->na; > + struct netmap_ring *ring = kring->ring; > + u_int nm_i; > + u_int nic_i; > + u_int const lim = kring->nkr_num_slots - 1; > + u_int const head = kring->rhead; > + int force_update = (flags & NAF_FORCE_READ); > + > + struct ifnet *ifp = na->ifp; > + struct vmxnet3_softc *sc = ifp->if_softc; > + struct vmxnet3_rxqueue *rxq = &sc->vmx_rxq[kring->ring_id]; > + struct vmxnet3_rxring *rxr; > + struct vmxnet3_comp_ring *rxc; > + > + if (head > lim) > + return netmap_ring_reinit(kring); > + > + rxr = &rxq->vxrxq_cmd_ring[0]; > + > + /* no need to dma-sync the ring; memory barriers are sufficient */ > + > + /* first part: import newly received packets */ > + if (netmap_no_pendintr || force_update) { > + rxc = &rxq->vxrxq_comp_ring; > + nm_i = kring->nr_hwtail; > + nic_i = netmap_idx_k2n(kring, nm_i); > + for (;;) { > + struct vmxnet3_rxcompdesc *rxcd; > + struct vmxnet3_rxbuf *rxb; > + > + rxcd = &rxc->vxcr_u.rxcd[rxc->vxcr_next]; > + > + if (rxcd->gen != rxc->vxcr_gen) > + break; > + vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); > + > + while (__predict_false(rxcd->rxd_idx != nic_i)) { > + nm_prlim(1, "%u skipped! idx %u", nic_i, rxcd->rxd_idx); > + /* to shelter the application from this we > + * would need to rotate the kernel-owned > + * portion of the netmap and nic rings. We > + * return len=0 for now and hope for the best. > + */ > + ring->slot[nm_i].len = 0; > + nic_i = nm_next(nm_i, lim); > + nm_i = nm_next(nm_i, lim); > + } > + > + rxb = &rxr->vxrxr_rxbuf[nic_i]; > + > + ring->slot[nm_i].len = rxcd->len; > + ring->slot[nm_i].flags = 0; > + > + bus_dmamap_sync(rxr->vxrxr_rxtag, rxb->vrxb_dmamap, > + BUS_DMASYNC_POSTREAD); > + > + nic_i = nm_next(nm_i, lim); > + nm_i = nm_next(nm_i, lim); > + > + rxc->vxcr_next++; > + if (__predict_false(rxc->vxcr_next == rxc->vxcr_ndesc)) { > + rxc->vxcr_next = 0; > + rxc->vxcr_gen ^= 1; > + } > + } > + kring->nr_hwtail = nm_i; > + } > + /* second part: skip past packets that userspace has released */ > + nm_i = kring->nr_hwcur; > + if (nm_i != head) { > + nic_i = netmap_idx_k2n(kring, nm_i); > + while (nm_i != head) { > + struct netmap_slot *slot = &ring->slot[nm_i]; > + struct vmxnet3_rxdesc *rxd_fill; > + struct vmxnet3_rxbuf *rxbuf; > + > + if (slot->flags & NS_BUF_CHANGED) { > + uint64_t paddr; > + void *addr = PNMB(na, slot, &paddr); > + struct vmxnet3_rxdesc *rxd = &rxr->vxrxr_rxd[nic_i]; > + > + > + if (addr == NETMAP_BUF_BASE(na)) > + return netmap_ring_reinit(kring); > + > + rxd->addr = paddr; > + rxbuf = &rxr->vxrxr_rxbuf[nic_i]; > + netmap_reload_map(na, rxr->vxrxr_rxtag, > + rxbuf->vrxb_dmamap, addr); > + slot->flags &= ~NS_BUF_CHANGED; > + vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); > + } > + > + rxd_fill = &rxr->vxrxr_rxd[rxr->vxrxr_fill]; > + rxbuf = &rxr->vxrxr_rxbuf[rxr->vxrxr_fill]; > + > + bus_dmamap_sync(rxr->vxrxr_rxtag, rxbuf->vrxb_dmamap, > + BUS_DMASYNC_PREREAD); > + > + rxd_fill->gen = rxr->vxrxr_gen; > + vmxnet3_rxr_increment_fill(rxr); > + > + nm_i = nm_next(nm_i, lim); > + nic_i = nm_next(nic_i, lim); > + } > + kring->nr_hwcur = head; > + if (__predict_false(rxq->vxrxq_rs->update_rxhead)) { > + vmxnet3_write_bar0(sc, > + VMXNET3_BAR0_RXH1(kring->ring_id), rxr->vxrxr_fill); > + } > + } > + return 0; > +} > + > +static void > +vmxnet3_netmap_attach(struct vmxnet3_softc *sc) > +{ > + struct netmap_adapter na; > + int enable = 0; > + > + if (getenv_int("vmxnet3.netmap_native", &enable) < 0 || !enable) { > + return; > + } > + > + bzero(&na, sizeof(na)); > + > + na.ifp = sc->vmx_ifp; > + na.na_flags = NAF_BDG_MAYSLEEP; > + na.num_tx_desc = sc->vmx_ntxdescs; > + na.num_rx_desc = sc->vmx_nrxdescs; > + na.num_tx_rings = sc->vmx_ntxqueues; > + na.num_rx_rings = sc->vmx_nrxqueues; > + na.nm_register = vmxnet3_netmap_reg; > + na.nm_txsync = vmxnet3_netmap_txsync; > + na.nm_rxsync = vmxnet3_netmap_rxsync; > + netmap_attach(&na); > +} > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Tue Feb 19 14:40:10 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC2AF14F2926; Tue, 19 Feb 2019 14:40:09 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85BB989981; Tue, 19 Feb 2019 14:40:09 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: by mail-qt1-x841.google.com with SMTP id a48so23339699qtb.4; Tue, 19 Feb 2019 06:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=t/rN/jnkVznLQKcRRo+3GAvhasilN7bKNvRwCLOLUDo=; b=u+T24JKP4ojzGRpdZMTbHFt9j5YY4SXSD5+T2NePtmWLUB0jtoTPQXnl7BTYrU/qxy xqImDLCP9o5GZSX60sa2FotjL2kkF7CGNqORz3+WXJ8Pz0dUWxkmApJnFszeHrM+WbpB q363Fj5vjCDTQHQIRPkXvrCLyM5Yy+R6xphhD6bZGxL3DBk+wdeRqz5w/KOSUQQc5SVs pbj8j3W30PbXSlO34sAXA9hpxQ7lW2deGhq93rygsKenhlfIHtrk9Ml91uVqW2QqUjLJ bXittVLSqF3USAR6ALysCKFwwczFtcyK+SOrE3x1ZiJ1/HkkuKP6Pcgbuay4SZh56lZd cJyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=t/rN/jnkVznLQKcRRo+3GAvhasilN7bKNvRwCLOLUDo=; b=pKtyHjK4q1D63/i4do0ft/Jc59Dz+BoqOS9AH08pZA8K6BQjiMXnTghdSluEYrQBPU bqvw4Mm0X0fVLQO9VVnpEj/sWpK1vhmpXZrKNa8WiTtsaAutHtztxcz4qDgS5RImcGK6 RFaYAMT6OXx49y1BCyNm+nkOGYXJOkE634UQv9Bh/udu6kISiL9PupNnyyqM5J4dpN40 AYHO4EJ7ojEMvjxXBu2H8CeQ+a4KLMWlNlNtC86SPCCGmDq1fg1cI7EgoBNzjthPJhpI OHepDsH6mhtzQBc6s63vYgCUxgv1nEZDOwDQQr/qcPBopBk4p5OAc1E3UvUMVGHA5nQm 0rog== X-Gm-Message-State: AHQUAuaXe8NL4S1RXnY8xStsF/6VWrAYY3XNGGSrwMd06jNvvs/e21rI qZ6XHnGZ2N77VgxCLoDpfhT/DruvfvVx+lbz5T1vGA== X-Google-Smtp-Source: AHgI3IbLV5PI6vBzVRGyrbFGZe0HdfQz3JypRDaHWcGK+l37xNaAG8GoKFNaejpbL5wF5kNt9qtpscVIzQ7WlTKnZGU= X-Received: by 2002:ac8:25d9:: with SMTP id f25mr23268637qtf.156.1550587208543; Tue, 19 Feb 2019 06:40:08 -0800 (PST) MIME-Version: 1.0 References: <201902191007.x1JA7mSq052443@repo.freebsd.org> <201902191436.x1JEaHqr010799@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201902191436.x1JEaHqr010799@pdx.rh.CN85.dnsmgr.net> From: Vincenzo Maffione Date: Tue, 19 Feb 2019 15:39:55 +0100 Message-ID: Subject: Re: svn commit: r344272 - stable/11/sys/dev/vmware/vmxnet3 To: rgrimes@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org X-Rspamd-Queue-Id: 85BB989981 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.84 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.84)[-0.841,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 14:40:10 -0000 Hi Rodney, Il giorno mar 19 feb 2019 alle ore 15:36 Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> ha scritto: > > Author: vmaffione > > Date: Tue Feb 19 10:07:48 2019 > > New Revision: 344272 > > URL: https://svnweb.freebsd.org/changeset/base/344272 > > > > Log: > > vmx(4): add native netmap support > > > > This change adds native netmap support for the vmx(4) adapter > > (vmxnet3). Native support comes for free in 12, since the driver has > been > ^^^ > This commit is to stable/11 > Yes, this commit is meant for stable/11. Since in head vmx(4) has been ported to iflib, netmap support form vmx(4) is already available there through iflib. In stable/11, on the other hand, vmx(4) is not using iflib, thus explicit netmap support is needed (hence this commit). > > > ported to iflib. To make it minimally intrusive, the native support is > > only enabled if vmxnet3.netmap_native is set at boot (e.g., in > loader.conf). > > > > Tested on stable/11 running inside vmplayer. > > > > Submitted by: Giuseppe Lettieri > > Reviewed by: vmaffione, bryanv > > Sponsored by: Sunny Valley Networks > > Differential Revision: https://reviews.freebsd.org/D19104 > > Huh? When did the vmx driver in stable/11 become iflib'ed? > It didn't. The vmx driver has been ported to iflib in head. Cheers, Vincenzo > > > > > Added: > > stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h (contents, props > changed) > > Modified: > > stable/11/sys/dev/vmware/vmxnet3/if_vmx.c > > > > Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c > > > ============================================================================== > > --- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 03:46:32 2019 > (r344271) > > +++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 10:07:48 2019 > (r344272) > > @@ -239,6 +239,10 @@ typedef enum { > > > > static void vmxnet3_barrier(struct vmxnet3_softc *, vmxnet3_barrier_t); > > > > +#ifdef DEV_NETMAP > > +#include "vmx_netmap.h" > > +#endif > > + > > /* Tunables. */ > > static int vmxnet3_mq_disable = 0; > > TUNABLE_INT("hw.vmx.mq_disable", &vmxnet3_mq_disable); > > @@ -270,6 +274,9 @@ DRIVER_MODULE(vmx, pci, vmxnet3_driver, > vmxnet3_devcla > > > > MODULE_DEPEND(vmx, pci, 1, 1, 1); > > MODULE_DEPEND(vmx, ether, 1, 1, 1); > > +#ifdef DEV_NETMAP > > +MODULE_DEPEND(vmx, netmap, 1, 1, 1); > > +#endif > > > > #define VMXNET3_VMWARE_VENDOR_ID 0x15AD > > #define VMXNET3_VMWARE_DEVICE_ID 0x07B0 > > @@ -347,6 +354,10 @@ vmxnet3_attach(device_t dev) > > vmxnet3_start_taskqueue(sc); > > #endif > > > > +#ifdef DEV_NETMAP > > + vmxnet3_netmap_attach(sc); > > +#endif > > + > > fail: > > if (error) > > vmxnet3_detach(dev); > > @@ -390,6 +401,10 @@ vmxnet3_detach(device_t dev) > > #endif > > vmxnet3_free_interrupts(sc); > > > > +#ifdef DEV_NETMAP > > + netmap_detach(ifp); > > +#endif > > + > > if (ifp != NULL) { > > if_free(ifp); > > sc->vmx_ifp = NULL; > > @@ -1846,6 +1861,11 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *txq) > > txr = &txq->vxtxq_cmd_ring; > > txc = &txq->vxtxq_comp_ring; > > > > +#ifdef DEV_NETMAP > > + if (netmap_tx_irq(sc->vmx_ifp, txq - sc->vmx_txq) != NM_IRQ_PASS) > > + return; > > +#endif > > + > > VMXNET3_TXQ_LOCK_ASSERT(txq); > > > > for (;;) { > > @@ -2111,6 +2131,15 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *rxq) > > ifp = sc->vmx_ifp; > > rxc = &rxq->vxrxq_comp_ring; > > > > +#ifdef DEV_NETMAP > > + { > > + int dummy; > > + if (netmap_rx_irq(ifp, rxq - sc->vmx_rxq, &dummy) != > > + NM_IRQ_PASS) > > + return; > > + } > > +#endif > > + > > VMXNET3_RXQ_LOCK_ASSERT(rxq); > > > > if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) > > @@ -2401,6 +2430,10 @@ vmxnet3_stop_rendezvous(struct vmxnet3_softc *sc) > > struct vmxnet3_txqueue *txq; > > int i; > > > > +#ifdef DEV_NETMAP > > + netmap_disable_all_rings(sc->vmx_ifp); > > +#endif > > + > > for (i = 0; i < sc->vmx_nrxqueues; i++) { > > rxq = &sc->vmx_rxq[i]; > > VMXNET3_RXQ_LOCK(rxq); > > @@ -2454,6 +2487,10 @@ vmxnet3_txinit(struct vmxnet3_softc *sc, struct > vmxnet > > bzero(txr->vxtxr_txd, > > txr->vxtxr_ndesc * sizeof(struct vmxnet3_txdesc)); > > > > +#ifdef DEV_NETMAP > > + vmxnet3_netmap_txq_init(sc, txq); > > +#endif > > + > > txc = &txq->vxtxq_comp_ring; > > txc->vxcr_next = 0; > > txc->vxcr_gen = VMXNET3_INIT_GEN; > > @@ -2468,6 +2505,10 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct > vmxnet > > struct vmxnet3_rxring *rxr; > > struct vmxnet3_comp_ring *rxc; > > int i, populate, idx, frame_size, error; > > +#ifdef DEV_NETMAP > > + struct netmap_adapter *na; > > + struct netmap_slot *slot; > > +#endif > > > > ifp = sc->vmx_ifp; > > frame_size = ETHER_ALIGN + sizeof(struct ether_vlan_header) + > > @@ -2498,12 +2539,24 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct > vmxnet > > else > > populate = VMXNET3_RXRINGS_PERQ; > > > > +#ifdef DEV_NETMAP > > + na = NA(ifp); > > + slot = netmap_reset(na, NR_RX, rxq - sc->vmx_rxq, 0); > > +#endif > > + > > for (i = 0; i < populate; i++) { > > rxr = &rxq->vxrxq_cmd_ring[i]; > > rxr->vxrxr_fill = 0; > > rxr->vxrxr_gen = VMXNET3_INIT_GEN; > > bzero(rxr->vxrxr_rxd, > > rxr->vxrxr_ndesc * sizeof(struct vmxnet3_rxdesc)); > > +#ifdef DEV_NETMAP > > + if (slot != NULL) { > > + vmxnet3_netmap_rxq_init(sc, rxq, rxr, slot); > > + i = populate; > > + break; > > + } > > +#endif > > > > for (idx = 0; idx < rxr->vxrxr_ndesc; idx++) { > > error = vmxnet3_newbuf(sc, rxr); > > @@ -2625,6 +2678,10 @@ vmxnet3_init_locked(struct vmxnet3_softc *sc) > > > > ifp->if_drv_flags |= IFF_DRV_RUNNING; > > vmxnet3_link_status(sc); > > + > > +#ifdef DEV_NETMAP > > + netmap_enable_all_rings(ifp); > > +#endif > > > > vmxnet3_enable_all_intrs(sc); > > callout_reset(&sc->vmx_tick, hz, vmxnet3_tick, sc); > > > > Added: stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h > > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h Tue Feb 19 > 10:07:48 2019 (r344272) > > @@ -0,0 +1,376 @@ > > +/* > > + * Copyright (C) 2019 Universita` di Pisa. > > + * Sponsored by Sunny Valley Networks. > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions > > + * are met: > > + * 1. Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * 2. Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in > the > > + * documentation and/or other materials provided with the > distribution. > > + * > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' > AND > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > PURPOSE > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE > LIABLE > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE > GOODS > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, > STRICT > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN > ANY WAY > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY > OF > > + * SUCH DAMAGE. > > + */ > > + > > +/* $FreeBSD$ */ > > + > > +#include > > +#include > > + > > +static int > > +vmxnet3_netmap_reg(struct netmap_adapter *na, int onoff) > > +{ > > + struct ifnet *ifp = na->ifp; > > + struct vmxnet3_softc *sc = ifp->if_softc; > > + > > + VMXNET3_CORE_LOCK(sc); > > + vmxnet3_stop(sc); > > + if (onoff) { > > + nm_set_native_flags(na); > > + } else { > > + nm_clear_native_flags(na); > > + } > > + vmxnet3_init_locked(sc); > > + VMXNET3_CORE_UNLOCK(sc); > > + return 0; > > +} > > + > > +static void > > +vmxnet3_netmap_rxq_init(struct vmxnet3_softc *sc, struct > vmxnet3_rxqueue *rxq, > > + struct vmxnet3_rxring *rxr, struct netmap_slot *slot) > > +{ > > + struct ifnet *ifp = sc->vmx_ifp; > > + struct netmap_adapter *na = NA(ifp); > > + struct vmxnet3_rxdesc *rxd; > > + int q, i; > > + > > + q = rxq - sc->vmx_rxq; > > + > > + for (i = 0; ; i++) { > > + int idx = rxr->vxrxr_fill; > > + int si = netmap_idx_n2k(na->rx_rings[q], idx); > > + struct vmxnet3_rxbuf *rxb = &rxr->vxrxr_rxbuf[idx]; > > + uint64_t paddr; > > + void *addr; > > + > > + addr = PNMB(na, slot + si, &paddr); > > + netmap_load_map(na, rxr->vxrxr_rxtag, rxb->vrxb_dmamap, > addr); > > + > > + rxd = &rxr->vxrxr_rxd[idx]; > > + rxd->addr = paddr; > > + rxd->len = NETMAP_BUF_SIZE(na); > > + rxd->gen = rxr->vxrxr_gen ^ 1; > > + rxd->btype = VMXNET3_BTYPE_HEAD; > > + nm_prdis("%d: addr %lx len %u btype %u gen %u", > > + idx, rxd->addr, rxd->len, rxd->btype, rxd->gen); > > + > > + if (i == rxr->vxrxr_ndesc -1) > > + break; > > + > > + rxd->gen ^= 1; > > + vmxnet3_rxr_increment_fill(rxr); > > + } > > +} > > + > > +static void > > +vmxnet3_netmap_txq_init(struct vmxnet3_softc *sc, struct > vmxnet3_txqueue *txq) > > +{ > > + struct ifnet *ifp = sc->vmx_ifp; > > + struct netmap_adapter *na; > > + struct netmap_slot *slot; > > + struct vmxnet3_txring *txr; > > + int i, gen, q; > > + > > + q = txq - sc->vmx_txq; > > + > > + na = NA(ifp); > > + > > + slot = netmap_reset(na, NR_TX, q, 0); > > + if (slot == NULL) > > + return; > > + > > + txr = &txq->vxtxq_cmd_ring; > > + gen = txr->vxtxr_gen ^ 1; > > + > > + for (i = 0; i < txr->vxtxr_ndesc; i++) { > > + int si = netmap_idx_n2k(na->tx_rings[q], i); > > + struct vmxnet3_txdesc *txd = &txr->vxtxr_txd[i]; > > + uint64_t paddr; > > + void *addr; > > + > > + addr = PNMB(na, slot + si, &paddr); > > + > > + txd->addr = paddr; > > + txd->len = 0; > > + txd->gen = gen; > > + txd->dtype = 0; > > + txd->offload_mode = VMXNET3_OM_NONE; > > + txd->offload_pos = 0; > > + txd->hlen = 0; > > + txd->eop = 0; > > + txd->compreq = 0; > > + txd->vtag_mode = 0; > > + txd->vtag = 0; > > + > > + netmap_load_map(na, txr->vxtxr_txtag, > > + txr->vxtxr_txbuf[i].vtxb_dmamap, addr); > > + } > > +} > > + > > +static int > > +vmxnet3_netmap_txsync(struct netmap_kring *kring, int flags) > > +{ > > + struct netmap_adapter *na = kring->na; > > + struct ifnet *ifp = na->ifp; > > + struct netmap_ring *ring = kring->ring; > > + u_int nm_i; > > + u_int nic_i; > > + u_int n; > > + u_int const lim = kring->nkr_num_slots - 1; > > + u_int const head = kring->rhead; > > + > > + /* > > + * interrupts on every tx packet are expensive so request > > + * them every half ring, or where NS_REPORT is set > > + */ > > + u_int report_frequency = kring->nkr_num_slots >> 1; > > + /* device specific */ > > + struct vmxnet3_softc *sc = ifp->if_softc; > > + struct vmxnet3_txqueue *txq = &sc->vmx_txq[kring->ring_id]; > > + struct vmxnet3_txring *txr = &txq->vxtxq_cmd_ring; > > + struct vmxnet3_comp_ring *txc = &txq->vxtxq_comp_ring; > > + struct vmxnet3_txcompdesc *txcd = txc->vxcr_u.txcd; > > + int gen = txr->vxtxr_gen; > > + > > + /* no need to dma-sync the ring; memory barriers are sufficient */ > > + > > + nm_i = kring->nr_hwcur; > > + if (nm_i != head) { > > + nic_i = netmap_idx_k2n(kring, nm_i); > > + for (n = 0; nm_i != head; n++) { > > + struct netmap_slot *slot = &ring->slot[nm_i]; > > + u_int len = slot->len; > > + uint64_t paddr; > > + void *addr = PNMB(na, slot, &paddr); > > + int compreq = !!(slot->flags & NS_REPORT || > > + nic_i == 0 || nic_i == report_frequency); > > + > > + /* device specific */ > > + struct vmxnet3_txdesc *curr = > &txr->vxtxr_txd[nic_i]; > > + struct vmxnet3_txbuf *txbuf = > &txr->vxtxr_txbuf[nic_i]; > > + > > + NM_CHECK_ADDR_LEN(na, addr, len); > > + > > + /* fill the slot in the NIC ring */ > > + curr->len = len; > > + curr->eop = 1; /* NS_MOREFRAG not supported */ > > + curr->compreq = compreq; > > + > > + if (slot->flags & NS_BUF_CHANGED) { > > + curr->addr = paddr; > > + netmap_reload_map(na, txr->vxtxr_txtag, > > + txbuf->vtxb_dmamap, addr); > > + } > > + slot->flags &= ~(NS_REPORT | NS_BUF_CHANGED); > > + > > + /* make sure changes to the buffer are synced */ > > + bus_dmamap_sync(txr->vxtxr_txtag, > txbuf->vtxb_dmamap, > > + BUS_DMASYNC_PREWRITE); > > + > > + /* pass ownership */ > > + vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); > > + curr->gen = gen; > > + > > + nm_i = nm_next(nm_i, lim); > > + nic_i++; > > + if (unlikely(nic_i == lim + 1)) { > > + nic_i = 0; > > + gen = txr->vxtxr_gen ^= 1; > > + } > > + } > > + > > + vmxnet3_write_bar0(sc, VMXNET3_BAR0_TXH(txq->vxtxq_id), > nic_i); > > + } > > + kring->nr_hwcur = nm_i; > > + > > + /* reclaim completed packets */ > > + for (;;) { > > + u_int sop; > > + struct vmxnet3_txbuf *txb; > > + > > + txcd = &txc->vxcr_u.txcd[txc->vxcr_next]; > > + if (txcd->gen != txc->vxcr_gen) > > + break; > > + > > + vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); > > + > > + if (++txc->vxcr_next == txc->vxcr_ndesc) { > > + txc->vxcr_next = 0; > > + txc->vxcr_gen ^= 1; > > + } > > + > > + sop = txr->vxtxr_next; > > + txb = &txr->vxtxr_txbuf[sop]; > > + > > + bus_dmamap_sync(txr->vxtxr_txtag, txb->vtxb_dmamap, > > + BUS_DMASYNC_POSTWRITE); > > + > > + txr->vxtxr_next = (txcd->eop_idx + 1) % txr->vxtxr_ndesc; > > + } > > + kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, txr->vxtxr_next), > lim); > > + > > + return 0; > > +} > > + > > +static int > > +vmxnet3_netmap_rxsync(struct netmap_kring *kring, int flags) > > +{ > > + struct netmap_adapter *na = kring->na; > > + struct netmap_ring *ring = kring->ring; > > + u_int nm_i; > > + u_int nic_i; > > + u_int const lim = kring->nkr_num_slots - 1; > > + u_int const head = kring->rhead; > > + int force_update = (flags & NAF_FORCE_READ); > > + > > + struct ifnet *ifp = na->ifp; > > + struct vmxnet3_softc *sc = ifp->if_softc; > > + struct vmxnet3_rxqueue *rxq = &sc->vmx_rxq[kring->ring_id]; > > + struct vmxnet3_rxring *rxr; > > + struct vmxnet3_comp_ring *rxc; > > + > > + if (head > lim) > > + return netmap_ring_reinit(kring); > > + > > + rxr = &rxq->vxrxq_cmd_ring[0]; > > + > > + /* no need to dma-sync the ring; memory barriers are sufficient */ > > + > > + /* first part: import newly received packets */ > > + if (netmap_no_pendintr || force_update) { > > + rxc = &rxq->vxrxq_comp_ring; > > + nm_i = kring->nr_hwtail; > > + nic_i = netmap_idx_k2n(kring, nm_i); > > + for (;;) { > > + struct vmxnet3_rxcompdesc *rxcd; > > + struct vmxnet3_rxbuf *rxb; > > + > > + rxcd = &rxc->vxcr_u.rxcd[rxc->vxcr_next]; > > + > > + if (rxcd->gen != rxc->vxcr_gen) > > + break; > > + vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); > > + > > + while (__predict_false(rxcd->rxd_idx != nic_i)) { > > + nm_prlim(1, "%u skipped! idx %u", nic_i, > rxcd->rxd_idx); > > + /* to shelter the application from this we > > + * would need to rotate the kernel-owned > > + * portion of the netmap and nic rings. We > > + * return len=0 for now and hope for the > best. > > + */ > > + ring->slot[nm_i].len = 0; > > + nic_i = nm_next(nm_i, lim); > > + nm_i = nm_next(nm_i, lim); > > + } > > + > > + rxb = &rxr->vxrxr_rxbuf[nic_i]; > > + > > + ring->slot[nm_i].len = rxcd->len; > > + ring->slot[nm_i].flags = 0; > > + > > + bus_dmamap_sync(rxr->vxrxr_rxtag, rxb->vrxb_dmamap, > > + BUS_DMASYNC_POSTREAD); > > + > > + nic_i = nm_next(nm_i, lim); > > + nm_i = nm_next(nm_i, lim); > > + > > + rxc->vxcr_next++; > > + if (__predict_false(rxc->vxcr_next == > rxc->vxcr_ndesc)) { > > + rxc->vxcr_next = 0; > > + rxc->vxcr_gen ^= 1; > > + } > > + } > > + kring->nr_hwtail = nm_i; > > + } > > + /* second part: skip past packets that userspace has released */ > > + nm_i = kring->nr_hwcur; > > + if (nm_i != head) { > > + nic_i = netmap_idx_k2n(kring, nm_i); > > + while (nm_i != head) { > > + struct netmap_slot *slot = &ring->slot[nm_i]; > > + struct vmxnet3_rxdesc *rxd_fill; > > + struct vmxnet3_rxbuf *rxbuf; > > + > > + if (slot->flags & NS_BUF_CHANGED) { > > + uint64_t paddr; > > + void *addr = PNMB(na, slot, &paddr); > > + struct vmxnet3_rxdesc *rxd = > &rxr->vxrxr_rxd[nic_i]; > > + > > + > > + if (addr == NETMAP_BUF_BASE(na)) > > + return netmap_ring_reinit(kring); > > + > > + rxd->addr = paddr; > > + rxbuf = &rxr->vxrxr_rxbuf[nic_i]; > > + netmap_reload_map(na, rxr->vxrxr_rxtag, > > + rxbuf->vrxb_dmamap, addr); > > + slot->flags &= ~NS_BUF_CHANGED; > > + vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); > > + } > > + > > + rxd_fill = &rxr->vxrxr_rxd[rxr->vxrxr_fill]; > > + rxbuf = &rxr->vxrxr_rxbuf[rxr->vxrxr_fill]; > > + > > + bus_dmamap_sync(rxr->vxrxr_rxtag, > rxbuf->vrxb_dmamap, > > + BUS_DMASYNC_PREREAD); > > + > > + rxd_fill->gen = rxr->vxrxr_gen; > > + vmxnet3_rxr_increment_fill(rxr); > > + > > + nm_i = nm_next(nm_i, lim); > > + nic_i = nm_next(nic_i, lim); > > + } > > + kring->nr_hwcur = head; > > + if (__predict_false(rxq->vxrxq_rs->update_rxhead)) { > > + vmxnet3_write_bar0(sc, > > + VMXNET3_BAR0_RXH1(kring->ring_id), > rxr->vxrxr_fill); > > + } > > + } > > + return 0; > > +} > > + > > +static void > > +vmxnet3_netmap_attach(struct vmxnet3_softc *sc) > > +{ > > + struct netmap_adapter na; > > + int enable = 0; > > + > > + if (getenv_int("vmxnet3.netmap_native", &enable) < 0 || !enable) { > > + return; > > + } > > + > > + bzero(&na, sizeof(na)); > > + > > + na.ifp = sc->vmx_ifp; > > + na.na_flags = NAF_BDG_MAYSLEEP; > > + na.num_tx_desc = sc->vmx_ntxdescs; > > + na.num_rx_desc = sc->vmx_nrxdescs; > > + na.num_tx_rings = sc->vmx_ntxqueues; > > + na.num_rx_rings = sc->vmx_nrxqueues; > > + na.nm_register = vmxnet3_netmap_reg; > > + na.nm_txsync = vmxnet3_netmap_txsync; > > + na.nm_rxsync = vmxnet3_netmap_rxsync; > > + netmap_attach(&na); > > +} > > > > > > -- > Rod Grimes > rgrimes@freebsd.org > -- Vincenzo From owner-svn-src-stable-11@freebsd.org Tue Feb 19 14:47:14 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4326A14F2B76; Tue, 19 Feb 2019 14:47:14 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58F0B89DED; Tue, 19 Feb 2019 14:47:13 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x1JElBBA010844; Tue, 19 Feb 2019 06:47:11 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id x1JElBXa010843; Tue, 19 Feb 2019 06:47:11 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201902191447.x1JElBXa010843@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r344272 - stable/11/sys/dev/vmware/vmxnet3 In-Reply-To: To: Vincenzo Maffione Date: Tue, 19 Feb 2019 06:47:11 -0800 (PST) CC: rgrimes@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 58F0B89DED X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.92)[-0.922,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 14:47:14 -0000 > Hi Rodney, > > > Il giorno mar 19 feb 2019 alle ore 15:36 Rodney W. Grimes < > freebsd@pdx.rh.cn85.dnsmgr.net> ha scritto: > > > > Author: vmaffione > > > Date: Tue Feb 19 10:07:48 2019 > > > New Revision: 344272 > > > URL: https://svnweb.freebsd.org/changeset/base/344272 > > > > > > Log: > > > vmx(4): add native netmap support > > > > > > This change adds native netmap support for the vmx(4) adapter > > > (vmxnet3). Native support comes for free in 12, since the driver has > > been > > ^^^ > > This commit is to stable/11 > > > > Yes, this commit is meant for stable/11. Since in head vmx(4) has been > ported to iflib, netmap support form vmx(4) > is already available there through iflib. > In stable/11, on the other hand, vmx(4) is not using iflib, thus explicit > netmap support is needed (hence this commit). > > > > > > > ported to iflib. To make it minimally intrusive, the native support is > > > only enabled if vmxnet3.netmap_native is set at boot (e.g., in > > loader.conf). > > > > > > Tested on stable/11 running inside vmplayer. > > > > > > Submitted by: Giuseppe Lettieri > > > Reviewed by: vmaffione, bryanv > > > Sponsored by: Sunny Valley Networks > > > Differential Revision: https://reviews.freebsd.org/D19104 > > > > Huh? When did the vmx driver in stable/11 become iflib'ed? > > > > It didn't. The vmx driver has been ported to iflib in head. Ok, the wording of this commit message was very confusing, first it should of had a line: Direct commit to stable/11 as this code no longer exists in head. Second, It would of been much clearer to not even mention the iflib in head and stable/12. Your first line and the one following sentance with out any additional details other than the fact this is a direct commit would of been clearer. Log: vmx(4): add native netmap support This change adds native netmap support for the vmx(4) adapter (vmxnet3). This is a direct commit to stable/11, this code does not exist in ^/head due to iflib converstion of vmx(4). > > Cheers, > Vincenzo > > > > > > > > > > Added: > > > stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h (contents, props > > changed) > > > Modified: > > > stable/11/sys/dev/vmware/vmxnet3/if_vmx.c > > > > > > Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c > > > > > ============================================================================== > > > --- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 03:46:32 2019 > > (r344271) > > > +++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 10:07:48 2019 > > (r344272) > > > @@ -239,6 +239,10 @@ typedef enum { > > > > > > static void vmxnet3_barrier(struct vmxnet3_softc *, vmxnet3_barrier_t); > > > > > > +#ifdef DEV_NETMAP > > > +#include "vmx_netmap.h" > > > +#endif > > > + > > > /* Tunables. */ > > > static int vmxnet3_mq_disable = 0; > > > TUNABLE_INT("hw.vmx.mq_disable", &vmxnet3_mq_disable); > > > @@ -270,6 +274,9 @@ DRIVER_MODULE(vmx, pci, vmxnet3_driver, > > vmxnet3_devcla > > > > > > MODULE_DEPEND(vmx, pci, 1, 1, 1); > > > MODULE_DEPEND(vmx, ether, 1, 1, 1); > > > +#ifdef DEV_NETMAP > > > +MODULE_DEPEND(vmx, netmap, 1, 1, 1); > > > +#endif > > > > > > #define VMXNET3_VMWARE_VENDOR_ID 0x15AD > > > #define VMXNET3_VMWARE_DEVICE_ID 0x07B0 > > > @@ -347,6 +354,10 @@ vmxnet3_attach(device_t dev) > > > vmxnet3_start_taskqueue(sc); > > > #endif > > > > > > +#ifdef DEV_NETMAP > > > + vmxnet3_netmap_attach(sc); > > > +#endif > > > + > > > fail: > > > if (error) > > > vmxnet3_detach(dev); > > > @@ -390,6 +401,10 @@ vmxnet3_detach(device_t dev) > > > #endif > > > vmxnet3_free_interrupts(sc); > > > > > > +#ifdef DEV_NETMAP > > > + netmap_detach(ifp); > > > +#endif > > > + > > > if (ifp != NULL) { > > > if_free(ifp); > > > sc->vmx_ifp = NULL; > > > @@ -1846,6 +1861,11 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *txq) > > > txr = &txq->vxtxq_cmd_ring; > > > txc = &txq->vxtxq_comp_ring; > > > > > > +#ifdef DEV_NETMAP > > > + if (netmap_tx_irq(sc->vmx_ifp, txq - sc->vmx_txq) != NM_IRQ_PASS) > > > + return; > > > +#endif > > > + > > > VMXNET3_TXQ_LOCK_ASSERT(txq); > > > > > > for (;;) { > > > @@ -2111,6 +2131,15 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *rxq) > > > ifp = sc->vmx_ifp; > > > rxc = &rxq->vxrxq_comp_ring; > > > > > > +#ifdef DEV_NETMAP > > > + { > > > + int dummy; > > > + if (netmap_rx_irq(ifp, rxq - sc->vmx_rxq, &dummy) != > > > + NM_IRQ_PASS) > > > + return; > > > + } > > > +#endif > > > + > > > VMXNET3_RXQ_LOCK_ASSERT(rxq); > > > > > > if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) > > > @@ -2401,6 +2430,10 @@ vmxnet3_stop_rendezvous(struct vmxnet3_softc *sc) > > > struct vmxnet3_txqueue *txq; > > > int i; > > > > > > +#ifdef DEV_NETMAP > > > + netmap_disable_all_rings(sc->vmx_ifp); > > > +#endif > > > + > > > for (i = 0; i < sc->vmx_nrxqueues; i++) { > > > rxq = &sc->vmx_rxq[i]; > > > VMXNET3_RXQ_LOCK(rxq); > > > @@ -2454,6 +2487,10 @@ vmxnet3_txinit(struct vmxnet3_softc *sc, struct > > vmxnet > > > bzero(txr->vxtxr_txd, > > > txr->vxtxr_ndesc * sizeof(struct vmxnet3_txdesc)); > > > > > > +#ifdef DEV_NETMAP > > > + vmxnet3_netmap_txq_init(sc, txq); > > > +#endif > > > + > > > txc = &txq->vxtxq_comp_ring; > > > txc->vxcr_next = 0; > > > txc->vxcr_gen = VMXNET3_INIT_GEN; > > > @@ -2468,6 +2505,10 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct > > vmxnet > > > struct vmxnet3_rxring *rxr; > > > struct vmxnet3_comp_ring *rxc; > > > int i, populate, idx, frame_size, error; > > > +#ifdef DEV_NETMAP > > > + struct netmap_adapter *na; > > > + struct netmap_slot *slot; > > > +#endif > > > > > > ifp = sc->vmx_ifp; > > > frame_size = ETHER_ALIGN + sizeof(struct ether_vlan_header) + > > > @@ -2498,12 +2539,24 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct > > vmxnet > > > else > > > populate = VMXNET3_RXRINGS_PERQ; > > > > > > +#ifdef DEV_NETMAP > > > + na = NA(ifp); > > > + slot = netmap_reset(na, NR_RX, rxq - sc->vmx_rxq, 0); > > > +#endif > > > + > > > for (i = 0; i < populate; i++) { > > > rxr = &rxq->vxrxq_cmd_ring[i]; > > > rxr->vxrxr_fill = 0; > > > rxr->vxrxr_gen = VMXNET3_INIT_GEN; > > > bzero(rxr->vxrxr_rxd, > > > rxr->vxrxr_ndesc * sizeof(struct vmxnet3_rxdesc)); > > > +#ifdef DEV_NETMAP > > > + if (slot != NULL) { > > > + vmxnet3_netmap_rxq_init(sc, rxq, rxr, slot); > > > + i = populate; > > > + break; > > > + } > > > +#endif > > > > > > for (idx = 0; idx < rxr->vxrxr_ndesc; idx++) { > > > error = vmxnet3_newbuf(sc, rxr); > > > @@ -2625,6 +2678,10 @@ vmxnet3_init_locked(struct vmxnet3_softc *sc) > > > > > > ifp->if_drv_flags |= IFF_DRV_RUNNING; > > > vmxnet3_link_status(sc); > > > + > > > +#ifdef DEV_NETMAP > > > + netmap_enable_all_rings(ifp); > > > +#endif > > > > > > vmxnet3_enable_all_intrs(sc); > > > callout_reset(&sc->vmx_tick, hz, vmxnet3_tick, sc); > > > > > > Added: stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h > > > > > ============================================================================== > > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > > +++ stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h Tue Feb 19 > > 10:07:48 2019 (r344272) > > > @@ -0,0 +1,376 @@ > > > +/* > > > + * Copyright (C) 2019 Universita` di Pisa. > > > + * Sponsored by Sunny Valley Networks. > > > + * > > > + * Redistribution and use in source and binary forms, with or without > > > + * modification, are permitted provided that the following conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above copyright > > > + * notice, this list of conditions and the following disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above copyright > > > + * notice, this list of conditions and the following disclaimer in > > the > > > + * documentation and/or other materials provided with the > > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' > > AND > > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > > PURPOSE > > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE > > LIABLE > > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > > CONSEQUENTIAL > > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE > > GOODS > > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, > > STRICT > > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN > > ANY WAY > > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY > > OF > > > + * SUCH DAMAGE. > > > + */ > > > + > > > +/* $FreeBSD$ */ > > > + > > > +#include > > > +#include > > > + > > > +static int > > > +vmxnet3_netmap_reg(struct netmap_adapter *na, int onoff) > > > +{ > > > + struct ifnet *ifp = na->ifp; > > > + struct vmxnet3_softc *sc = ifp->if_softc; > > > + > > > + VMXNET3_CORE_LOCK(sc); > > > + vmxnet3_stop(sc); > > > + if (onoff) { > > > + nm_set_native_flags(na); > > > + } else { > > > + nm_clear_native_flags(na); > > > + } > > > + vmxnet3_init_locked(sc); > > > + VMXNET3_CORE_UNLOCK(sc); > > > + return 0; > > > +} > > > + > > > +static void > > > +vmxnet3_netmap_rxq_init(struct vmxnet3_softc *sc, struct > > vmxnet3_rxqueue *rxq, > > > + struct vmxnet3_rxring *rxr, struct netmap_slot *slot) > > > +{ > > > + struct ifnet *ifp = sc->vmx_ifp; > > > + struct netmap_adapter *na = NA(ifp); > > > + struct vmxnet3_rxdesc *rxd; > > > + int q, i; > > > + > > > + q = rxq - sc->vmx_rxq; > > > + > > > + for (i = 0; ; i++) { > > > + int idx = rxr->vxrxr_fill; > > > + int si = netmap_idx_n2k(na->rx_rings[q], idx); > > > + struct vmxnet3_rxbuf *rxb = &rxr->vxrxr_rxbuf[idx]; > > > + uint64_t paddr; > > > + void *addr; > > > + > > > + addr = PNMB(na, slot + si, &paddr); > > > + netmap_load_map(na, rxr->vxrxr_rxtag, rxb->vrxb_dmamap, > > addr); > > > + > > > + rxd = &rxr->vxrxr_rxd[idx]; > > > + rxd->addr = paddr; > > > + rxd->len = NETMAP_BUF_SIZE(na); > > > + rxd->gen = rxr->vxrxr_gen ^ 1; > > > + rxd->btype = VMXNET3_BTYPE_HEAD; > > > + nm_prdis("%d: addr %lx len %u btype %u gen %u", > > > + idx, rxd->addr, rxd->len, rxd->btype, rxd->gen); > > > + > > > + if (i == rxr->vxrxr_ndesc -1) > > > + break; > > > + > > > + rxd->gen ^= 1; > > > + vmxnet3_rxr_increment_fill(rxr); > > > + } > > > +} > > > + > > > +static void > > > +vmxnet3_netmap_txq_init(struct vmxnet3_softc *sc, struct > > vmxnet3_txqueue *txq) > > > +{ > > > + struct ifnet *ifp = sc->vmx_ifp; > > > + struct netmap_adapter *na; > > > + struct netmap_slot *slot; > > > + struct vmxnet3_txring *txr; > > > + int i, gen, q; > > > + > > > + q = txq - sc->vmx_txq; > > > + > > > + na = NA(ifp); > > > + > > > + slot = netmap_reset(na, NR_TX, q, 0); > > > + if (slot == NULL) > > > + return; > > > + > > > + txr = &txq->vxtxq_cmd_ring; > > > + gen = txr->vxtxr_gen ^ 1; > > > + > > > + for (i = 0; i < txr->vxtxr_ndesc; i++) { > > > + int si = netmap_idx_n2k(na->tx_rings[q], i); > > > + struct vmxnet3_txdesc *txd = &txr->vxtxr_txd[i]; > > > + uint64_t paddr; > > > + void *addr; > > > + > > > + addr = PNMB(na, slot + si, &paddr); > > > + > > > + txd->addr = paddr; > > > + txd->len = 0; > > > + txd->gen = gen; > > > + txd->dtype = 0; > > > + txd->offload_mode = VMXNET3_OM_NONE; > > > + txd->offload_pos = 0; > > > + txd->hlen = 0; > > > + txd->eop = 0; > > > + txd->compreq = 0; > > > + txd->vtag_mode = 0; > > > + txd->vtag = 0; > > > + > > > + netmap_load_map(na, txr->vxtxr_txtag, > > > + txr->vxtxr_txbuf[i].vtxb_dmamap, addr); > > > + } > > > +} > > > + > > > +static int > > > +vmxnet3_netmap_txsync(struct netmap_kring *kring, int flags) > > > +{ > > > + struct netmap_adapter *na = kring->na; > > > + struct ifnet *ifp = na->ifp; > > > + struct netmap_ring *ring = kring->ring; > > > + u_int nm_i; > > > + u_int nic_i; > > > + u_int n; > > > + u_int const lim = kring->nkr_num_slots - 1; > > > + u_int const head = kring->rhead; > > > + > > > + /* > > > + * interrupts on every tx packet are expensive so request > > > + * them every half ring, or where NS_REPORT is set > > > + */ > > > + u_int report_frequency = kring->nkr_num_slots >> 1; > > > + /* device specific */ > > > + struct vmxnet3_softc *sc = ifp->if_softc; > > > + struct vmxnet3_txqueue *txq = &sc->vmx_txq[kring->ring_id]; > > > + struct vmxnet3_txring *txr = &txq->vxtxq_cmd_ring; > > > + struct vmxnet3_comp_ring *txc = &txq->vxtxq_comp_ring; > > > + struct vmxnet3_txcompdesc *txcd = txc->vxcr_u.txcd; > > > + int gen = txr->vxtxr_gen; > > > + > > > + /* no need to dma-sync the ring; memory barriers are sufficient */ > > > + > > > + nm_i = kring->nr_hwcur; > > > + if (nm_i != head) { > > > + nic_i = netmap_idx_k2n(kring, nm_i); > > > + for (n = 0; nm_i != head; n++) { > > > + struct netmap_slot *slot = &ring->slot[nm_i]; > > > + u_int len = slot->len; > > > + uint64_t paddr; > > > + void *addr = PNMB(na, slot, &paddr); > > > + int compreq = !!(slot->flags & NS_REPORT || > > > + nic_i == 0 || nic_i == report_frequency); > > > + > > > + /* device specific */ > > > + struct vmxnet3_txdesc *curr = > > &txr->vxtxr_txd[nic_i]; > > > + struct vmxnet3_txbuf *txbuf = > > &txr->vxtxr_txbuf[nic_i]; > > > + > > > + NM_CHECK_ADDR_LEN(na, addr, len); > > > + > > > + /* fill the slot in the NIC ring */ > > > + curr->len = len; > > > + curr->eop = 1; /* NS_MOREFRAG not supported */ > > > + curr->compreq = compreq; > > > + > > > + if (slot->flags & NS_BUF_CHANGED) { > > > + curr->addr = paddr; > > > + netmap_reload_map(na, txr->vxtxr_txtag, > > > + txbuf->vtxb_dmamap, addr); > > > + } > > > + slot->flags &= ~(NS_REPORT | NS_BUF_CHANGED); > > > + > > > + /* make sure changes to the buffer are synced */ > > > + bus_dmamap_sync(txr->vxtxr_txtag, > > txbuf->vtxb_dmamap, > > > + BUS_DMASYNC_PREWRITE); > > > + > > > + /* pass ownership */ > > > + vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); > > > + curr->gen = gen; > > > + > > > + nm_i = nm_next(nm_i, lim); > > > + nic_i++; > > > + if (unlikely(nic_i == lim + 1)) { > > > + nic_i = 0; > > > + gen = txr->vxtxr_gen ^= 1; > > > + } > > > + } > > > + > > > + vmxnet3_write_bar0(sc, VMXNET3_BAR0_TXH(txq->vxtxq_id), > > nic_i); > > > + } > > > + kring->nr_hwcur = nm_i; > > > + > > > + /* reclaim completed packets */ > > > + for (;;) { > > > + u_int sop; > > > + struct vmxnet3_txbuf *txb; > > > + > > > + txcd = &txc->vxcr_u.txcd[txc->vxcr_next]; > > > + if (txcd->gen != txc->vxcr_gen) > > > + break; > > > + > > > + vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); > > > + > > > + if (++txc->vxcr_next == txc->vxcr_ndesc) { > > > + txc->vxcr_next = 0; > > > + txc->vxcr_gen ^= 1; > > > + } > > > + > > > + sop = txr->vxtxr_next; > > > + txb = &txr->vxtxr_txbuf[sop]; > > > + > > > + bus_dmamap_sync(txr->vxtxr_txtag, txb->vtxb_dmamap, > > > + BUS_DMASYNC_POSTWRITE); > > > + > > > + txr->vxtxr_next = (txcd->eop_idx + 1) % txr->vxtxr_ndesc; > > > + } > > > + kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, txr->vxtxr_next), > > lim); > > > + > > > + return 0; > > > +} > > > + > > > +static int > > > +vmxnet3_netmap_rxsync(struct netmap_kring *kring, int flags) > > > +{ > > > + struct netmap_adapter *na = kring->na; > > > + struct netmap_ring *ring = kring->ring; > > > + u_int nm_i; > > > + u_int nic_i; > > > + u_int const lim = kring->nkr_num_slots - 1; > > > + u_int const head = kring->rhead; > > > + int force_update = (flags & NAF_FORCE_READ); > > > + > > > + struct ifnet *ifp = na->ifp; > > > + struct vmxnet3_softc *sc = ifp->if_softc; > > > + struct vmxnet3_rxqueue *rxq = &sc->vmx_rxq[kring->ring_id]; > > > + struct vmxnet3_rxring *rxr; > > > + struct vmxnet3_comp_ring *rxc; > > > + > > > + if (head > lim) > > > + return netmap_ring_reinit(kring); > > > + > > > + rxr = &rxq->vxrxq_cmd_ring[0]; > > > + > > > + /* no need to dma-sync the ring; memory barriers are sufficient */ > > > + > > > + /* first part: import newly received packets */ > > > + if (netmap_no_pendintr || force_update) { > > > + rxc = &rxq->vxrxq_comp_ring; > > > + nm_i = kring->nr_hwtail; > > > + nic_i = netmap_idx_k2n(kring, nm_i); > > > + for (;;) { > > > + struct vmxnet3_rxcompdesc *rxcd; > > > + struct vmxnet3_rxbuf *rxb; > > > + > > > + rxcd = &rxc->vxcr_u.rxcd[rxc->vxcr_next]; > > > + > > > + if (rxcd->gen != rxc->vxcr_gen) > > > + break; > > > + vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); > > > + > > > + while (__predict_false(rxcd->rxd_idx != nic_i)) { > > > + nm_prlim(1, "%u skipped! idx %u", nic_i, > > rxcd->rxd_idx); > > > + /* to shelter the application from this we > > > + * would need to rotate the kernel-owned > > > + * portion of the netmap and nic rings. We > > > + * return len=0 for now and hope for the > > best. > > > + */ > > > + ring->slot[nm_i].len = 0; > > > + nic_i = nm_next(nm_i, lim); > > > + nm_i = nm_next(nm_i, lim); > > > + } > > > + > > > + rxb = &rxr->vxrxr_rxbuf[nic_i]; > > > + > > > + ring->slot[nm_i].len = rxcd->len; > > > + ring->slot[nm_i].flags = 0; > > > + > > > + bus_dmamap_sync(rxr->vxrxr_rxtag, rxb->vrxb_dmamap, > > > + BUS_DMASYNC_POSTREAD); > > > + > > > + nic_i = nm_next(nm_i, lim); > > > + nm_i = nm_next(nm_i, lim); > > > + > > > + rxc->vxcr_next++; > > > + if (__predict_false(rxc->vxcr_next == > > rxc->vxcr_ndesc)) { > > > + rxc->vxcr_next = 0; > > > + rxc->vxcr_gen ^= 1; > > > + } > > > + } > > > + kring->nr_hwtail = nm_i; > > > + } > > > + /* second part: skip past packets that userspace has released */ > > > + nm_i = kring->nr_hwcur; > > > + if (nm_i != head) { > > > + nic_i = netmap_idx_k2n(kring, nm_i); > > > + while (nm_i != head) { > > > + struct netmap_slot *slot = &ring->slot[nm_i]; > > > + struct vmxnet3_rxdesc *rxd_fill; > > > + struct vmxnet3_rxbuf *rxbuf; > > > + > > > + if (slot->flags & NS_BUF_CHANGED) { > > > + uint64_t paddr; > > > + void *addr = PNMB(na, slot, &paddr); > > > + struct vmxnet3_rxdesc *rxd = > > &rxr->vxrxr_rxd[nic_i]; > > > + > > > + > > > + if (addr == NETMAP_BUF_BASE(na)) > > > + return netmap_ring_reinit(kring); > > > + > > > + rxd->addr = paddr; > > > + rxbuf = &rxr->vxrxr_rxbuf[nic_i]; > > > + netmap_reload_map(na, rxr->vxrxr_rxtag, > > > + rxbuf->vrxb_dmamap, addr); > > > + slot->flags &= ~NS_BUF_CHANGED; > > > + vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); > > > + } > > > + > > > + rxd_fill = &rxr->vxrxr_rxd[rxr->vxrxr_fill]; > > > + rxbuf = &rxr->vxrxr_rxbuf[rxr->vxrxr_fill]; > > > + > > > + bus_dmamap_sync(rxr->vxrxr_rxtag, > > rxbuf->vrxb_dmamap, > > > + BUS_DMASYNC_PREREAD); > > > + > > > + rxd_fill->gen = rxr->vxrxr_gen; > > > + vmxnet3_rxr_increment_fill(rxr); > > > + > > > + nm_i = nm_next(nm_i, lim); > > > + nic_i = nm_next(nic_i, lim); > > > + } > > > + kring->nr_hwcur = head; > > > + if (__predict_false(rxq->vxrxq_rs->update_rxhead)) { > > > + vmxnet3_write_bar0(sc, > > > + VMXNET3_BAR0_RXH1(kring->ring_id), > > rxr->vxrxr_fill); > > > + } > > > + } > > > + return 0; > > > +} > > > + > > > +static void > > > +vmxnet3_netmap_attach(struct vmxnet3_softc *sc) > > > +{ > > > + struct netmap_adapter na; > > > + int enable = 0; > > > + > > > + if (getenv_int("vmxnet3.netmap_native", &enable) < 0 || !enable) { > > > + return; > > > + } > > > + > > > + bzero(&na, sizeof(na)); > > > + > > > + na.ifp = sc->vmx_ifp; > > > + na.na_flags = NAF_BDG_MAYSLEEP; > > > + na.num_tx_desc = sc->vmx_ntxdescs; > > > + na.num_rx_desc = sc->vmx_nrxdescs; > > > + na.num_tx_rings = sc->vmx_ntxqueues; > > > + na.num_rx_rings = sc->vmx_nrxqueues; > > > + na.nm_register = vmxnet3_netmap_reg; > > > + na.nm_txsync = vmxnet3_netmap_txsync; > > > + na.nm_rxsync = vmxnet3_netmap_rxsync; > > > + netmap_attach(&na); > > > +} > > > > > > > > > > -- > > Rod Grimes > > rgrimes@freebsd.org > > > > > -- > Vincenzo -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Tue Feb 19 14:49:46 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E0B214F2C2E; Tue, 19 Feb 2019 14:49:46 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A27C989F63; Tue, 19 Feb 2019 14:49:45 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: by mail-qk1-x743.google.com with SMTP id a15so12192655qkc.1; Tue, 19 Feb 2019 06:49:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VT8EqFX07PERfpLNJpIUIKzFwSP5cV0a5gkJUvrUFYg=; b=BOVE4mebe9ADLHliCNAdlug3mVeW5f3gtPRI3d1i+jsmrE6HAf1lZoN1UPXwTt+d6B sZcD551wlFECMSX6J0AM/MYa8L9WqEGMbkHWiYzVj3uWk/5mFZYt8Y8cCLW5t2bXujvJ La6cZsTDWCmwlKoT+mYoaQwZ7VPoYp/WxAgznco/ltNaUVPi+nevvugjo4nphjfDunZf 0FN73AOgNS4s//k6pKsVGDsNDMLBkhWinCIkCzJxNoqAeJvhnyu9tniYhuWND2Km2KNf Ta7W6LITLGZKzXDoIQj5Udg6TDtPQseTNMhC0veCBHHgE90/1DLuq6+o02jD7jF9CbrD f5vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VT8EqFX07PERfpLNJpIUIKzFwSP5cV0a5gkJUvrUFYg=; b=txYx0QBH4LuGfsLGe45W/J+8OYGe40YIWTjpCoXFG3wNC1AiB0+fd1ASuVwQKDpdwU 0GwU5WzZP5CEgG/9Fh6eyYGm7RrzuIWf/uLXypMaP3eXv/oRG7fG5ROB2bkq7z5k0sat TOXwSGg+EGg7vK6oSxnmZXYbAs6+cSh+JfhpkgWLnvFsxog/JTwWhf9fTWgr8lsmUpgO WVpi5viKMbrBj3jTy3TWBoMJqOB/nWEJv0CUINDLqA7x6Sog7w/qDyCCpCnzPkOWLnJp /BvbjXM0lUKAZde9SugYrtgrfClyHOzTIwHrETmBHLGH/d8W1HROPk31flIKkl9pQedn eK/g== X-Gm-Message-State: AHQUAuZLNwu5sCjuWVYGUGUOJb7iOMAgRiJ6gqWhzwylecTk0Bg10nAi rCrRf2PLQxBFYzeBqdF3/8wfboLb+oLrgAmw5e1l7btJ X-Google-Smtp-Source: AHgI3IZKZjBt50D6zqKCf2mlToPINkyH3A6AuALEY+o77qsEVktIZUeZyVgM93j6QoXgvgznOca2NDpVBX2etnA9kX4= X-Received: by 2002:a37:7d82:: with SMTP id y124mr7208466qkc.127.1550587784628; Tue, 19 Feb 2019 06:49:44 -0800 (PST) MIME-Version: 1.0 References: <201902191447.x1JElBXa010843@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201902191447.x1JElBXa010843@pdx.rh.CN85.dnsmgr.net> From: Vincenzo Maffione Date: Tue, 19 Feb 2019 15:49:32 +0100 Message-ID: Subject: Re: svn commit: r344272 - stable/11/sys/dev/vmware/vmxnet3 To: rgrimes@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org X-Rspamd-Queue-Id: A27C989F63 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.84 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.84)[-0.841,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 14:49:46 -0000 Il giorno mar 19 feb 2019 alle ore 15:47 Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> ha scritto: > > Hi Rodney, > > > > > > Il giorno mar 19 feb 2019 alle ore 15:36 Rodney W. Grimes < > > freebsd@pdx.rh.cn85.dnsmgr.net> ha scritto: > > > > > > Author: vmaffione > > > > Date: Tue Feb 19 10:07:48 2019 > > > > New Revision: 344272 > > > > URL: https://svnweb.freebsd.org/changeset/base/344272 > > > > > > > > Log: > > > > vmx(4): add native netmap support > > > > > > > > This change adds native netmap support for the vmx(4) adapter > > > > (vmxnet3). Native support comes for free in 12, since the driver > has > > > been > > > ^^^ > > > This commit is to stable/11 > > > > > > > Yes, this commit is meant for stable/11. Since in head vmx(4) has been > > ported to iflib, netmap support form vmx(4) > > is already available there through iflib. > > In stable/11, on the other hand, vmx(4) is not using iflib, thus explicit > > netmap support is needed (hence this commit). > > > > > > > > > > > ported to iflib. To make it minimally intrusive, the native > support is > > > > only enabled if vmxnet3.netmap_native is set at boot (e.g., in > > > loader.conf). > > > > > > > > Tested on stable/11 running inside vmplayer. > > > > > > > > Submitted by: Giuseppe Lettieri > > > > Reviewed by: vmaffione, bryanv > > > > Sponsored by: Sunny Valley Networks > > > > Differential Revision: https://reviews.freebsd.org/D19104 > > > > > > Huh? When did the vmx driver in stable/11 become iflib'ed? > > > > > > > It didn't. The vmx driver has been ported to iflib in head. > > Ok, the wording of this commit message was very confusing, > first it should of had a line: > Direct commit to stable/11 as this code no longer exists in head. > Sorry, I did not know about this. > > Second, > It would of been much clearer to not even mention the iflib > in head and stable/12. > > Your first line and the one following sentance with out > any additional details other than the fact this is a direct > commit would of been clearer. > > Log: > vmx(4): add native netmap support > > This change adds native netmap support for the vmx(4) > adapter > (vmxnet3). > > This is a direct commit to stable/11, > this code does not exist in ^/head due to iflib > converstion of vmx(4). > > Sounds reasonable, thanks for the feedback! Cheers, Vincenzo > > > > Cheers, > > Vincenzo > > > > > > > > > > > > > > > Added: > > > > stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h (contents, props > > > changed) > > > > Modified: > > > > stable/11/sys/dev/vmware/vmxnet3/if_vmx.c > > > > > > > > Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c > > > > > > > > ============================================================================== > > > > --- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 03:46:32 > 2019 > > > (r344271) > > > > +++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 10:07:48 > 2019 > > > (r344272) > > > > @@ -239,6 +239,10 @@ typedef enum { > > > > > > > > static void vmxnet3_barrier(struct vmxnet3_softc *, > vmxnet3_barrier_t); > > > > > > > > +#ifdef DEV_NETMAP > > > > +#include "vmx_netmap.h" > > > > +#endif > > > > + > > > > /* Tunables. */ > > > > static int vmxnet3_mq_disable = 0; > > > > TUNABLE_INT("hw.vmx.mq_disable", &vmxnet3_mq_disable); > > > > @@ -270,6 +274,9 @@ DRIVER_MODULE(vmx, pci, vmxnet3_driver, > > > vmxnet3_devcla > > > > > > > > MODULE_DEPEND(vmx, pci, 1, 1, 1); > > > > MODULE_DEPEND(vmx, ether, 1, 1, 1); > > > > +#ifdef DEV_NETMAP > > > > +MODULE_DEPEND(vmx, netmap, 1, 1, 1); > > > > +#endif > > > > > > > > #define VMXNET3_VMWARE_VENDOR_ID 0x15AD > > > > #define VMXNET3_VMWARE_DEVICE_ID 0x07B0 > > > > @@ -347,6 +354,10 @@ vmxnet3_attach(device_t dev) > > > > vmxnet3_start_taskqueue(sc); > > > > #endif > > > > > > > > +#ifdef DEV_NETMAP > > > > + vmxnet3_netmap_attach(sc); > > > > +#endif > > > > + > > > > fail: > > > > if (error) > > > > vmxnet3_detach(dev); > > > > @@ -390,6 +401,10 @@ vmxnet3_detach(device_t dev) > > > > #endif > > > > vmxnet3_free_interrupts(sc); > > > > > > > > +#ifdef DEV_NETMAP > > > > + netmap_detach(ifp); > > > > +#endif > > > > + > > > > if (ifp != NULL) { > > > > if_free(ifp); > > > > sc->vmx_ifp = NULL; > > > > @@ -1846,6 +1861,11 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *txq) > > > > txr = &txq->vxtxq_cmd_ring; > > > > txc = &txq->vxtxq_comp_ring; > > > > > > > > +#ifdef DEV_NETMAP > > > > + if (netmap_tx_irq(sc->vmx_ifp, txq - sc->vmx_txq) != > NM_IRQ_PASS) > > > > + return; > > > > +#endif > > > > + > > > > VMXNET3_TXQ_LOCK_ASSERT(txq); > > > > > > > > for (;;) { > > > > @@ -2111,6 +2131,15 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *rxq) > > > > ifp = sc->vmx_ifp; > > > > rxc = &rxq->vxrxq_comp_ring; > > > > > > > > +#ifdef DEV_NETMAP > > > > + { > > > > + int dummy; > > > > + if (netmap_rx_irq(ifp, rxq - sc->vmx_rxq, &dummy) != > > > > + NM_IRQ_PASS) > > > > + return; > > > > + } > > > > +#endif > > > > + > > > > VMXNET3_RXQ_LOCK_ASSERT(rxq); > > > > > > > > if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) > > > > @@ -2401,6 +2430,10 @@ vmxnet3_stop_rendezvous(struct vmxnet3_softc > *sc) > > > > struct vmxnet3_txqueue *txq; > > > > int i; > > > > > > > > +#ifdef DEV_NETMAP > > > > + netmap_disable_all_rings(sc->vmx_ifp); > > > > +#endif > > > > + > > > > for (i = 0; i < sc->vmx_nrxqueues; i++) { > > > > rxq = &sc->vmx_rxq[i]; > > > > VMXNET3_RXQ_LOCK(rxq); > > > > @@ -2454,6 +2487,10 @@ vmxnet3_txinit(struct vmxnet3_softc *sc, > struct > > > vmxnet > > > > bzero(txr->vxtxr_txd, > > > > txr->vxtxr_ndesc * sizeof(struct vmxnet3_txdesc)); > > > > > > > > +#ifdef DEV_NETMAP > > > > + vmxnet3_netmap_txq_init(sc, txq); > > > > +#endif > > > > + > > > > txc = &txq->vxtxq_comp_ring; > > > > txc->vxcr_next = 0; > > > > txc->vxcr_gen = VMXNET3_INIT_GEN; > > > > @@ -2468,6 +2505,10 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, > struct > > > vmxnet > > > > struct vmxnet3_rxring *rxr; > > > > struct vmxnet3_comp_ring *rxc; > > > > int i, populate, idx, frame_size, error; > > > > +#ifdef DEV_NETMAP > > > > + struct netmap_adapter *na; > > > > + struct netmap_slot *slot; > > > > +#endif > > > > > > > > ifp = sc->vmx_ifp; > > > > frame_size = ETHER_ALIGN + sizeof(struct ether_vlan_header) + > > > > @@ -2498,12 +2539,24 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, > struct > > > vmxnet > > > > else > > > > populate = VMXNET3_RXRINGS_PERQ; > > > > > > > > +#ifdef DEV_NETMAP > > > > + na = NA(ifp); > > > > + slot = netmap_reset(na, NR_RX, rxq - sc->vmx_rxq, 0); > > > > +#endif > > > > + > > > > for (i = 0; i < populate; i++) { > > > > rxr = &rxq->vxrxq_cmd_ring[i]; > > > > rxr->vxrxr_fill = 0; > > > > rxr->vxrxr_gen = VMXNET3_INIT_GEN; > > > > bzero(rxr->vxrxr_rxd, > > > > rxr->vxrxr_ndesc * sizeof(struct vmxnet3_rxdesc)); > > > > +#ifdef DEV_NETMAP > > > > + if (slot != NULL) { > > > > + vmxnet3_netmap_rxq_init(sc, rxq, rxr, slot); > > > > + i = populate; > > > > + break; > > > > + } > > > > +#endif > > > > > > > > for (idx = 0; idx < rxr->vxrxr_ndesc; idx++) { > > > > error = vmxnet3_newbuf(sc, rxr); > > > > @@ -2625,6 +2678,10 @@ vmxnet3_init_locked(struct vmxnet3_softc *sc) > > > > > > > > ifp->if_drv_flags |= IFF_DRV_RUNNING; > > > > vmxnet3_link_status(sc); > > > > + > > > > +#ifdef DEV_NETMAP > > > > + netmap_enable_all_rings(ifp); > > > > +#endif > > > > > > > > vmxnet3_enable_all_intrs(sc); > > > > callout_reset(&sc->vmx_tick, hz, vmxnet3_tick, sc); > > > > > > > > Added: stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h > > > > > > > > ============================================================================== > > > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > > > +++ stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h Tue Feb 19 > > > 10:07:48 2019 (r344272) > > > > @@ -0,0 +1,376 @@ > > > > +/* > > > > + * Copyright (C) 2019 Universita` di Pisa. > > > > + * Sponsored by Sunny Valley Networks. > > > > + * > > > > + * Redistribution and use in source and binary forms, with or > without > > > > + * modification, are permitted provided that the following > conditions > > > > + * are met: > > > > + * 1. Redistributions of source code must retain the above copyright > > > > + * notice, this list of conditions and the following disclaimer. > > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > > + * notice, this list of conditions and the following disclaimer > in > > > the > > > > + * documentation and/or other materials provided with the > > > distribution. > > > > + * > > > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS > IS'' > > > AND > > > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED > TO, THE > > > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR > > > PURPOSE > > > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE > > > LIABLE > > > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > > > CONSEQUENTIAL > > > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE > > > GOODS > > > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) > > > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, > > > STRICT > > > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN > > > ANY WAY > > > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY > > > OF > > > > + * SUCH DAMAGE. > > > > + */ > > > > + > > > > +/* $FreeBSD$ */ > > > > + > > > > +#include > > > > +#include > > > > + > > > > +static int > > > > +vmxnet3_netmap_reg(struct netmap_adapter *na, int onoff) > > > > +{ > > > > + struct ifnet *ifp = na->ifp; > > > > + struct vmxnet3_softc *sc = ifp->if_softc; > > > > + > > > > + VMXNET3_CORE_LOCK(sc); > > > > + vmxnet3_stop(sc); > > > > + if (onoff) { > > > > + nm_set_native_flags(na); > > > > + } else { > > > > + nm_clear_native_flags(na); > > > > + } > > > > + vmxnet3_init_locked(sc); > > > > + VMXNET3_CORE_UNLOCK(sc); > > > > + return 0; > > > > +} > > > > + > > > > +static void > > > > +vmxnet3_netmap_rxq_init(struct vmxnet3_softc *sc, struct > > > vmxnet3_rxqueue *rxq, > > > > + struct vmxnet3_rxring *rxr, struct netmap_slot *slot) > > > > +{ > > > > + struct ifnet *ifp = sc->vmx_ifp; > > > > + struct netmap_adapter *na = NA(ifp); > > > > + struct vmxnet3_rxdesc *rxd; > > > > + int q, i; > > > > + > > > > + q = rxq - sc->vmx_rxq; > > > > + > > > > + for (i = 0; ; i++) { > > > > + int idx = rxr->vxrxr_fill; > > > > + int si = netmap_idx_n2k(na->rx_rings[q], idx); > > > > + struct vmxnet3_rxbuf *rxb = &rxr->vxrxr_rxbuf[idx]; > > > > + uint64_t paddr; > > > > + void *addr; > > > > + > > > > + addr = PNMB(na, slot + si, &paddr); > > > > + netmap_load_map(na, rxr->vxrxr_rxtag, rxb->vrxb_dmamap, > > > addr); > > > > + > > > > + rxd = &rxr->vxrxr_rxd[idx]; > > > > + rxd->addr = paddr; > > > > + rxd->len = NETMAP_BUF_SIZE(na); > > > > + rxd->gen = rxr->vxrxr_gen ^ 1; > > > > + rxd->btype = VMXNET3_BTYPE_HEAD; > > > > + nm_prdis("%d: addr %lx len %u btype %u gen %u", > > > > + idx, rxd->addr, rxd->len, rxd->btype, > rxd->gen); > > > > + > > > > + if (i == rxr->vxrxr_ndesc -1) > > > > + break; > > > > + > > > > + rxd->gen ^= 1; > > > > + vmxnet3_rxr_increment_fill(rxr); > > > > + } > > > > +} > > > > + > > > > +static void > > > > +vmxnet3_netmap_txq_init(struct vmxnet3_softc *sc, struct > > > vmxnet3_txqueue *txq) > > > > +{ > > > > + struct ifnet *ifp = sc->vmx_ifp; > > > > + struct netmap_adapter *na; > > > > + struct netmap_slot *slot; > > > > + struct vmxnet3_txring *txr; > > > > + int i, gen, q; > > > > + > > > > + q = txq - sc->vmx_txq; > > > > + > > > > + na = NA(ifp); > > > > + > > > > + slot = netmap_reset(na, NR_TX, q, 0); > > > > + if (slot == NULL) > > > > + return; > > > > + > > > > + txr = &txq->vxtxq_cmd_ring; > > > > + gen = txr->vxtxr_gen ^ 1; > > > > + > > > > + for (i = 0; i < txr->vxtxr_ndesc; i++) { > > > > + int si = netmap_idx_n2k(na->tx_rings[q], i); > > > > + struct vmxnet3_txdesc *txd = &txr->vxtxr_txd[i]; > > > > + uint64_t paddr; > > > > + void *addr; > > > > + > > > > + addr = PNMB(na, slot + si, &paddr); > > > > + > > > > + txd->addr = paddr; > > > > + txd->len = 0; > > > > + txd->gen = gen; > > > > + txd->dtype = 0; > > > > + txd->offload_mode = VMXNET3_OM_NONE; > > > > + txd->offload_pos = 0; > > > > + txd->hlen = 0; > > > > + txd->eop = 0; > > > > + txd->compreq = 0; > > > > + txd->vtag_mode = 0; > > > > + txd->vtag = 0; > > > > + > > > > + netmap_load_map(na, txr->vxtxr_txtag, > > > > + txr->vxtxr_txbuf[i].vtxb_dmamap, addr); > > > > + } > > > > +} > > > > + > > > > +static int > > > > +vmxnet3_netmap_txsync(struct netmap_kring *kring, int flags) > > > > +{ > > > > + struct netmap_adapter *na = kring->na; > > > > + struct ifnet *ifp = na->ifp; > > > > + struct netmap_ring *ring = kring->ring; > > > > + u_int nm_i; > > > > + u_int nic_i; > > > > + u_int n; > > > > + u_int const lim = kring->nkr_num_slots - 1; > > > > + u_int const head = kring->rhead; > > > > + > > > > + /* > > > > + * interrupts on every tx packet are expensive so request > > > > + * them every half ring, or where NS_REPORT is set > > > > + */ > > > > + u_int report_frequency = kring->nkr_num_slots >> 1; > > > > + /* device specific */ > > > > + struct vmxnet3_softc *sc = ifp->if_softc; > > > > + struct vmxnet3_txqueue *txq = &sc->vmx_txq[kring->ring_id]; > > > > + struct vmxnet3_txring *txr = &txq->vxtxq_cmd_ring; > > > > + struct vmxnet3_comp_ring *txc = &txq->vxtxq_comp_ring; > > > > + struct vmxnet3_txcompdesc *txcd = txc->vxcr_u.txcd; > > > > + int gen = txr->vxtxr_gen; > > > > + > > > > + /* no need to dma-sync the ring; memory barriers are > sufficient */ > > > > + > > > > + nm_i = kring->nr_hwcur; > > > > + if (nm_i != head) { > > > > + nic_i = netmap_idx_k2n(kring, nm_i); > > > > + for (n = 0; nm_i != head; n++) { > > > > + struct netmap_slot *slot = &ring->slot[nm_i]; > > > > + u_int len = slot->len; > > > > + uint64_t paddr; > > > > + void *addr = PNMB(na, slot, &paddr); > > > > + int compreq = !!(slot->flags & NS_REPORT || > > > > + nic_i == 0 || nic_i == > report_frequency); > > > > + > > > > + /* device specific */ > > > > + struct vmxnet3_txdesc *curr = > > > &txr->vxtxr_txd[nic_i]; > > > > + struct vmxnet3_txbuf *txbuf = > > > &txr->vxtxr_txbuf[nic_i]; > > > > + > > > > + NM_CHECK_ADDR_LEN(na, addr, len); > > > > + > > > > + /* fill the slot in the NIC ring */ > > > > + curr->len = len; > > > > + curr->eop = 1; /* NS_MOREFRAG not supported */ > > > > + curr->compreq = compreq; > > > > + > > > > + if (slot->flags & NS_BUF_CHANGED) { > > > > + curr->addr = paddr; > > > > + netmap_reload_map(na, txr->vxtxr_txtag, > > > > + txbuf->vtxb_dmamap, > addr); > > > > + } > > > > + slot->flags &= ~(NS_REPORT | NS_BUF_CHANGED); > > > > + > > > > + /* make sure changes to the buffer are synced > */ > > > > + bus_dmamap_sync(txr->vxtxr_txtag, > > > txbuf->vtxb_dmamap, > > > > + BUS_DMASYNC_PREWRITE); > > > > + > > > > + /* pass ownership */ > > > > + vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); > > > > + curr->gen = gen; > > > > + > > > > + nm_i = nm_next(nm_i, lim); > > > > + nic_i++; > > > > + if (unlikely(nic_i == lim + 1)) { > > > > + nic_i = 0; > > > > + gen = txr->vxtxr_gen ^= 1; > > > > + } > > > > + } > > > > + > > > > + vmxnet3_write_bar0(sc, VMXNET3_BAR0_TXH(txq->vxtxq_id), > > > nic_i); > > > > + } > > > > + kring->nr_hwcur = nm_i; > > > > + > > > > + /* reclaim completed packets */ > > > > + for (;;) { > > > > + u_int sop; > > > > + struct vmxnet3_txbuf *txb; > > > > + > > > > + txcd = &txc->vxcr_u.txcd[txc->vxcr_next]; > > > > + if (txcd->gen != txc->vxcr_gen) > > > > + break; > > > > + > > > > + vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); > > > > + > > > > + if (++txc->vxcr_next == txc->vxcr_ndesc) { > > > > + txc->vxcr_next = 0; > > > > + txc->vxcr_gen ^= 1; > > > > + } > > > > + > > > > + sop = txr->vxtxr_next; > > > > + txb = &txr->vxtxr_txbuf[sop]; > > > > + > > > > + bus_dmamap_sync(txr->vxtxr_txtag, txb->vtxb_dmamap, > > > > + BUS_DMASYNC_POSTWRITE); > > > > + > > > > + txr->vxtxr_next = (txcd->eop_idx + 1) % > txr->vxtxr_ndesc; > > > > + } > > > > + kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, > txr->vxtxr_next), > > > lim); > > > > + > > > > + return 0; > > > > +} > > > > + > > > > +static int > > > > +vmxnet3_netmap_rxsync(struct netmap_kring *kring, int flags) > > > > +{ > > > > + struct netmap_adapter *na = kring->na; > > > > + struct netmap_ring *ring = kring->ring; > > > > + u_int nm_i; > > > > + u_int nic_i; > > > > + u_int const lim = kring->nkr_num_slots - 1; > > > > + u_int const head = kring->rhead; > > > > + int force_update = (flags & NAF_FORCE_READ); > > > > + > > > > + struct ifnet *ifp = na->ifp; > > > > + struct vmxnet3_softc *sc = ifp->if_softc; > > > > + struct vmxnet3_rxqueue *rxq = &sc->vmx_rxq[kring->ring_id]; > > > > + struct vmxnet3_rxring *rxr; > > > > + struct vmxnet3_comp_ring *rxc; > > > > + > > > > + if (head > lim) > > > > + return netmap_ring_reinit(kring); > > > > + > > > > + rxr = &rxq->vxrxq_cmd_ring[0]; > > > > + > > > > + /* no need to dma-sync the ring; memory barriers are > sufficient */ > > > > + > > > > + /* first part: import newly received packets */ > > > > + if (netmap_no_pendintr || force_update) { > > > > + rxc = &rxq->vxrxq_comp_ring; > > > > + nm_i = kring->nr_hwtail; > > > > + nic_i = netmap_idx_k2n(kring, nm_i); > > > > + for (;;) { > > > > + struct vmxnet3_rxcompdesc *rxcd; > > > > + struct vmxnet3_rxbuf *rxb; > > > > + > > > > + rxcd = &rxc->vxcr_u.rxcd[rxc->vxcr_next]; > > > > + > > > > + if (rxcd->gen != rxc->vxcr_gen) > > > > + break; > > > > + vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); > > > > + > > > > + while (__predict_false(rxcd->rxd_idx != > nic_i)) { > > > > + nm_prlim(1, "%u skipped! idx %u", > nic_i, > > > rxcd->rxd_idx); > > > > + /* to shelter the application from > this we > > > > + * would need to rotate the > kernel-owned > > > > + * portion of the netmap and nic > rings. We > > > > + * return len=0 for now and hope for > the > > > best. > > > > + */ > > > > + ring->slot[nm_i].len = 0; > > > > + nic_i = nm_next(nm_i, lim); > > > > + nm_i = nm_next(nm_i, lim); > > > > + } > > > > + > > > > + rxb = &rxr->vxrxr_rxbuf[nic_i]; > > > > + > > > > + ring->slot[nm_i].len = rxcd->len; > > > > + ring->slot[nm_i].flags = 0; > > > > + > > > > + bus_dmamap_sync(rxr->vxrxr_rxtag, > rxb->vrxb_dmamap, > > > > + BUS_DMASYNC_POSTREAD); > > > > + > > > > + nic_i = nm_next(nm_i, lim); > > > > + nm_i = nm_next(nm_i, lim); > > > > + > > > > + rxc->vxcr_next++; > > > > + if (__predict_false(rxc->vxcr_next == > > > rxc->vxcr_ndesc)) { > > > > + rxc->vxcr_next = 0; > > > > + rxc->vxcr_gen ^= 1; > > > > + } > > > > + } > > > > + kring->nr_hwtail = nm_i; > > > > + } > > > > + /* second part: skip past packets that userspace has released > */ > > > > + nm_i = kring->nr_hwcur; > > > > + if (nm_i != head) { > > > > + nic_i = netmap_idx_k2n(kring, nm_i); > > > > + while (nm_i != head) { > > > > + struct netmap_slot *slot = &ring->slot[nm_i]; > > > > + struct vmxnet3_rxdesc *rxd_fill; > > > > + struct vmxnet3_rxbuf *rxbuf; > > > > + > > > > + if (slot->flags & NS_BUF_CHANGED) { > > > > + uint64_t paddr; > > > > + void *addr = PNMB(na, slot, &paddr); > > > > + struct vmxnet3_rxdesc *rxd = > > > &rxr->vxrxr_rxd[nic_i]; > > > > + > > > > + > > > > + if (addr == NETMAP_BUF_BASE(na)) > > > > + return > netmap_ring_reinit(kring); > > > > + > > > > + rxd->addr = paddr; > > > > + rxbuf = &rxr->vxrxr_rxbuf[nic_i]; > > > > + netmap_reload_map(na, rxr->vxrxr_rxtag, > > > > + rxbuf->vrxb_dmamap, > addr); > > > > + slot->flags &= ~NS_BUF_CHANGED; > > > > + vmxnet3_barrier(sc, > VMXNET3_BARRIER_WR); > > > > + } > > > > + > > > > + rxd_fill = &rxr->vxrxr_rxd[rxr->vxrxr_fill]; > > > > + rxbuf = &rxr->vxrxr_rxbuf[rxr->vxrxr_fill]; > > > > + > > > > + bus_dmamap_sync(rxr->vxrxr_rxtag, > > > rxbuf->vrxb_dmamap, > > > > + BUS_DMASYNC_PREREAD); > > > > + > > > > + rxd_fill->gen = rxr->vxrxr_gen; > > > > + vmxnet3_rxr_increment_fill(rxr); > > > > + > > > > + nm_i = nm_next(nm_i, lim); > > > > + nic_i = nm_next(nic_i, lim); > > > > + } > > > > + kring->nr_hwcur = head; > > > > + if (__predict_false(rxq->vxrxq_rs->update_rxhead)) { > > > > + vmxnet3_write_bar0(sc, > > > > + VMXNET3_BAR0_RXH1(kring->ring_id), > > > rxr->vxrxr_fill); > > > > + } > > > > + } > > > > + return 0; > > > > +} > > > > + > > > > +static void > > > > +vmxnet3_netmap_attach(struct vmxnet3_softc *sc) > > > > +{ > > > > + struct netmap_adapter na; > > > > + int enable = 0; > > > > + > > > > + if (getenv_int("vmxnet3.netmap_native", &enable) < 0 || > !enable) { > > > > + return; > > > > + } > > > > + > > > > + bzero(&na, sizeof(na)); > > > > + > > > > + na.ifp = sc->vmx_ifp; > > > > + na.na_flags = NAF_BDG_MAYSLEEP; > > > > + na.num_tx_desc = sc->vmx_ntxdescs; > > > > + na.num_rx_desc = sc->vmx_nrxdescs; > > > > + na.num_tx_rings = sc->vmx_ntxqueues; > > > > + na.num_rx_rings = sc->vmx_nrxqueues; > > > > + na.nm_register = vmxnet3_netmap_reg; > > > > + na.nm_txsync = vmxnet3_netmap_txsync; > > > > + na.nm_rxsync = vmxnet3_netmap_rxsync; > > > > + netmap_attach(&na); > > > > +} > > > > > > > > > > > > > > -- > > > Rod Grimes > > > rgrimes@freebsd.org > > > > > > > > > -- > > Vincenzo > > -- > Rod Grimes > rgrimes@freebsd.org > -- Vincenzo From owner-svn-src-stable-11@freebsd.org Tue Feb 19 18:22:58 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BF7D14F7A09; Tue, 19 Feb 2019 18:22:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F211D6AA6D; Tue, 19 Feb 2019 18:22:57 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E41F22195B; Tue, 19 Feb 2019 18:22:57 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JIMvY3015415; Tue, 19 Feb 2019 18:22:57 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JIMv5E015414; Tue, 19 Feb 2019 18:22:57 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201902191822.x1JIMv5E015414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 19 Feb 2019 18:22:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344282 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 344282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F211D6AA6D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 18:22:58 -0000 Author: kp Date: Tue Feb 19 18:22:57 2019 New Revision: 344282 URL: https://svnweb.freebsd.org/changeset/base/344282 Log: MFC r344061: garp: Fix vnet related panic for gratuitous arp Gratuitous ARP packets are sent from a timer, which means we don't have a vnet context set. As a result we panic trying to send the packet. Set the vnet context based on the interface associated with the interface address. To reproduce: sysctl net.link.ether.inet.garp_rexmit_count=2 ifconfig vtnet1 10.0.0.1/24 up PR: 235699 Reviewed by: vangyzen@ Modified: stable/11/sys/netinet/if_ether.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/if_ether.c ============================================================================== --- stable/11/sys/netinet/if_ether.c Tue Feb 19 18:22:55 2019 (r344281) +++ stable/11/sys/netinet/if_ether.c Tue Feb 19 18:22:57 2019 (r344282) @@ -1351,6 +1351,8 @@ garp_rexmit(void *arg) return; } + CURVNET_SET(ia->ia_ifa.ifa_ifp->if_vnet); + /* * Drop lock while the ARP request is generated. */ @@ -1378,6 +1380,8 @@ garp_rexmit(void *arg) ifa_free(&ia->ia_ifa); } } + + CURVNET_RESTORE(); } /* From owner-svn-src-stable-11@freebsd.org Tue Feb 19 18:28:33 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FB9514F8381; Tue, 19 Feb 2019 18:28:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EC3506B579; Tue, 19 Feb 2019 18:28:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 937DF21981; Tue, 19 Feb 2019 18:28:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JISWcC015704; Tue, 19 Feb 2019 18:28:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JISWK3015703; Tue, 19 Feb 2019 18:28:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902191828.x1JISWK3015703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Feb 2019 18:28:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344283 - stable/11/stand/common X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/common X-SVN-Commit-Revision: 344283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EC3506B579 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 18:28:33 -0000 Author: kevans Date: Tue Feb 19 18:28:32 2019 New Revision: 344283 URL: https://svnweb.freebsd.org/changeset/base/344283 Log: MFC r330757: stand/interp_lua: correct errorr => error Modified: stable/11/stand/common/interp_lua.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/common/interp_lua.c ============================================================================== --- stable/11/stand/common/interp_lua.c Tue Feb 19 18:22:57 2019 (r344282) +++ stable/11/stand/common/interp_lua.c Tue Feb 19 18:28:32 2019 (r344283) @@ -123,7 +123,7 @@ interp_init(void) if (interp_include(filename) != 0) { const char *errstr = lua_tostring(luap, -1); errstr = errstr == NULL ? "unknown" : errstr; - printf("Startup errorr in %s:\nLUA ERROR: %s.\n", filename, errstr); + printf("Startup error in %s:\nLUA ERROR: %s.\n", filename, errstr); lua_pop(luap, 1); } } From owner-svn-src-stable-11@freebsd.org Tue Feb 19 18:30:38 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9654014F858A; Tue, 19 Feb 2019 18:30:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1FD136B885; Tue, 19 Feb 2019 18:30:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 136542198D; Tue, 19 Feb 2019 18:30:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JIUbeU016821; Tue, 19 Feb 2019 18:30:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JIUbuT016820; Tue, 19 Feb 2019 18:30:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902191830.x1JIUbuT016820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Feb 2019 18:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344284 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 344284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1FD136B885 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 18:30:38 -0000 Author: kevans Date: Tue Feb 19 18:30:37 2019 New Revision: 344284 URL: https://svnweb.freebsd.org/changeset/base/344284 Log: MFC r332270, r332272, r332275, r332413: nop r332270: loader: include efi.4th only if we do have uefi Also simplify efi.4th. r332272: loader: 332270 did use wrong path for efi.4th The correct path is still /boot/efi.4th r332275: loader: 332270 did left out stand/i386/loader/loader.rc we have 2 instances of loader.rc... r332413: Revert r332275, r332272, r332270 There's problems with them. The order of efi stuff isn't quite right, and there's various problems. Revert until thos problems can be fixed. Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable-11@freebsd.org Tue Feb 19 18:32:07 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 725F014F8862; Tue, 19 Feb 2019 18:32:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D8C0A6BE4C; Tue, 19 Feb 2019 18:32:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB23921B1D; Tue, 19 Feb 2019 18:32:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JIW5KB020801; Tue, 19 Feb 2019 18:32:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JIW5O6020800; Tue, 19 Feb 2019 18:32:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902191832.x1JIW5O6020800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Feb 2019 18:32:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344285 - stable/11/stand/common X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/common X-SVN-Commit-Revision: 344285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D8C0A6BE4C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 18:32:07 -0000 Author: kevans Date: Tue Feb 19 18:32:05 2019 New Revision: 344285 URL: https://svnweb.freebsd.org/changeset/base/344285 Log: MFC r332555: loader: provide values in help_getnext() With r328289 we attempt to make sure we free the resources allocated in help_getnext(), however, it is possible that we get no resources allocated and help_getnext() will return early. Make sure we have pointers set to NULL early in help_getnext(). Modified: stable/11/stand/common/commands.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/common/commands.c ============================================================================== --- stable/11/stand/common/commands.c Tue Feb 19 18:30:37 2019 (r344284) +++ stable/11/stand/common/commands.c Tue Feb 19 18:32:05 2019 (r344285) @@ -64,7 +64,9 @@ static int help_getnext(int fd, char **topic, char **subtopic, char **desc) { char line[81], *cp, *ep; - + + /* Make sure we provide sane values. */ + *topic = *subtopic = *desc = NULL; for (;;) { if (fgetstr(line, 80, fd) < 0) return(0); From owner-svn-src-stable-11@freebsd.org Tue Feb 19 18:34:01 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A102014F89DE; Tue, 19 Feb 2019 18:34:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5019C6C09F; Tue, 19 Feb 2019 18:34:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35B7F21B40; Tue, 19 Feb 2019 18:34:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JIY1Vw020956; Tue, 19 Feb 2019 18:34:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JIY0wu020954; Tue, 19 Feb 2019 18:34:00 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902191834.x1JIY0wu020954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Feb 2019 18:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344286 - stable/11/stand/common X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/common X-SVN-Commit-Revision: 344286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5019C6C09F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 18:34:01 -0000 Author: kevans Date: Tue Feb 19 18:34:00 2019 New Revision: 344286 URL: https://svnweb.freebsd.org/changeset/base/344286 Log: MFC r332557-r332558, r332560, r332565: loader command cleanup-lite r332557: loader: make sure we use snprintf() in commands.c Safeguard against memory corruptions. r332558: loader: command_errmsg should be const Use const char * for command_errmsg. r332560: loader: make sure we do not return garbage from help_getnext Since we do free subtopic and desc in help_getnext(), we need to set them also NULL, so we make sure we dont get double free(). r332565: loader: cstyle cleanup of command.c just clean it up. no functional changes intended. Modified: stable/11/stand/common/bootstrap.h stable/11/stand/common/commands.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/common/bootstrap.h ============================================================================== --- stable/11/stand/common/bootstrap.h Tue Feb 19 18:32:05 2019 (r344285) +++ stable/11/stand/common/bootstrap.h Tue Feb 19 18:34:00 2019 (r344286) @@ -36,7 +36,7 @@ /* Commands and return values; nonzero return sets command_errmsg != NULL */ typedef int (bootblk_cmd_t)(int argc, char *argv[]); #define COMMAND_ERRBUFSZ (256) -extern char *command_errmsg; +extern const char *command_errmsg; extern char command_errbuf[COMMAND_ERRBUFSZ]; #define CMD_OK 0 #define CMD_WARN 1 Modified: stable/11/stand/common/commands.c ============================================================================== --- stable/11/stand/common/commands.c Tue Feb 19 18:32:05 2019 (r344285) +++ stable/11/stand/common/commands.c Tue Feb 19 18:34:00 2019 (r344286) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" -char *command_errmsg; +const char *command_errmsg; /* XXX should have procedural interface for setting, size limit? */ char command_errbuf[COMMAND_ERRBUFSZ]; @@ -61,155 +61,160 @@ here COMMAND_SET(help, "help", "detailed help", command_help); static int -help_getnext(int fd, char **topic, char **subtopic, char **desc) +help_getnext(int fd, char **topic, char **subtopic, char **desc) { - char line[81], *cp, *ep; + char line[81], *cp, *ep; - /* Make sure we provide sane values. */ - *topic = *subtopic = *desc = NULL; - for (;;) { - if (fgetstr(line, 80, fd) < 0) - return(0); - - if ((strlen(line) < 3) || (line[0] != '#') || (line[1] != ' ')) - continue; - + /* Make sure we provide sane values. */ *topic = *subtopic = *desc = NULL; - cp = line + 2; - while((cp != NULL) && (*cp != 0)) { - ep = strchr(cp, ' '); - if ((*cp == 'T') && (*topic == NULL)) { - if (ep != NULL) - *ep++ = 0; - *topic = strdup(cp + 1); - } else if ((*cp == 'S') && (*subtopic == NULL)) { - if (ep != NULL) - *ep++ = 0; - *subtopic = strdup(cp + 1); - } else if (*cp == 'D') { - *desc = strdup(cp + 1); - ep = NULL; - } - cp = ep; + for (;;) { + if (fgetstr(line, 80, fd) < 0) + return (0); + + if (strlen(line) < 3 || line[0] != '#' || line[1] != ' ') + continue; + + cp = line + 2; + while (cp != NULL && *cp != 0) { + ep = strchr(cp, ' '); + if (*cp == 'T' && *topic == NULL) { + if (ep != NULL) + *ep++ = 0; + *topic = strdup(cp + 1); + } else if (*cp == 'S' && *subtopic == NULL) { + if (ep != NULL) + *ep++ = 0; + *subtopic = strdup(cp + 1); + } else if (*cp == 'D') { + *desc = strdup(cp + 1); + ep = NULL; + } + cp = ep; + } + if (*topic == NULL) { + free(*subtopic); + free(*desc); + *subtopic = *desc = NULL; + continue; + } + return (1); } - if (*topic == NULL) { - free(*subtopic); - free(*desc); - continue; - } - return(1); - } } static int help_emitsummary(char *topic, char *subtopic, char *desc) { - int i; - - pager_output(" "); - pager_output(topic); - i = strlen(topic); - if (subtopic != NULL) { - pager_output(" "); - pager_output(subtopic); - i += strlen(subtopic) + 1; - } - if (desc != NULL) { - do { - pager_output(" "); - } while (i++ < 30); - pager_output(desc); - } - return (pager_output("\n")); + int i; + + pager_output(" "); + pager_output(topic); + i = strlen(topic); + if (subtopic != NULL) { + pager_output(" "); + pager_output(subtopic); + i += strlen(subtopic) + 1; + } + if (desc != NULL) { + do { + pager_output(" "); + } while (i++ < 30); + pager_output(desc); + } + return (pager_output("\n")); } - + static int -command_help(int argc, char *argv[]) +command_help(int argc, char *argv[]) { - char buf[81]; /* XXX buffer size? */ - int hfd, matched, doindex; - char *topic, *subtopic, *t, *s, *d; + char buf[81]; /* XXX buffer size? */ + int hfd, matched, doindex; + char *topic, *subtopic, *t, *s, *d; - /* page the help text from our load path */ - snprintf(buf, sizeof(buf), "%s/boot/loader.help", getenv("loaddev")); - if ((hfd = open(buf, O_RDONLY)) < 0) { - printf("Verbose help not available, use '?' to list commands\n"); - return(CMD_OK); - } + /* page the help text from our load path */ + snprintf(buf, sizeof(buf), "%s/boot/loader.help", getenv("loaddev")); + if ((hfd = open(buf, O_RDONLY)) < 0) { + printf("Verbose help not available, " + "use '?' to list commands\n"); + return (CMD_OK); + } - /* pick up request from arguments */ - topic = subtopic = NULL; - switch(argc) { - case 3: - subtopic = strdup(argv[2]); - case 2: - topic = strdup(argv[1]); - break; - case 1: - topic = strdup("help"); - break; - default: - command_errmsg = "usage is 'help []"; - close(hfd); - return(CMD_ERROR); - } + /* pick up request from arguments */ + topic = subtopic = NULL; + switch (argc) { + case 3: + subtopic = strdup(argv[2]); + /* FALLTHROUGH */ + case 2: + topic = strdup(argv[1]); + break; + case 1: + topic = strdup("help"); + break; + default: + command_errmsg = "usage is 'help []"; + close(hfd); + return(CMD_ERROR); + } - /* magic "index" keyword */ - doindex = !strcmp(topic, "index"); - matched = doindex; - - /* Scan the helpfile looking for help matching the request */ - pager_open(); - while(help_getnext(hfd, &t, &s, &d)) { + /* magic "index" keyword */ + doindex = strcmp(topic, "index") == 0? 1 : 0; + matched = doindex; - if (doindex) { /* dink around formatting */ - if (help_emitsummary(t, s, d)) - break; + /* Scan the helpfile looking for help matching the request */ + pager_open(); + while (help_getnext(hfd, &t, &s, &d)) { - } else if (strcmp(topic, t)) { - /* topic mismatch */ - if (matched) /* nothing more on this topic, stop scanning */ - break; + if (doindex) { /* dink around formatting */ + if (help_emitsummary(t, s, d)) + break; - } else { - /* topic matched */ - matched = 1; - if (((subtopic == NULL) && (s == NULL)) || - ((subtopic != NULL) && (s != NULL) && !strcmp(subtopic, s))) { - /* exact match, print text */ - while ((fgetstr(buf, 80, hfd) >= 0) && (buf[0] != '#')) { - if (pager_output(buf)) - break; - if (pager_output("\n")) - break; + } else if (strcmp(topic, t)) { + /* topic mismatch */ + if (matched) { + /* nothing more on this topic, stop scanning */ + break; + } + } else { + /* topic matched */ + matched = 1; + if ((subtopic == NULL && s == NULL) || + (subtopic != NULL && s != NULL && + strcmp(subtopic, s) == 0)) { + /* exact match, print text */ + while (fgetstr(buf, 80, hfd) >= 0 && + buf[0] != '#') { + if (pager_output(buf)) + break; + if (pager_output("\n")) + break; + } + } else if (subtopic == NULL && s != NULL) { + /* topic match, list subtopics */ + if (help_emitsummary(t, s, d)) + break; + } } - } else if ((subtopic == NULL) && (s != NULL)) { - /* topic match, list subtopics */ - if (help_emitsummary(t, s, d)) - break; - } + free(t); + free(s); + free(d); + t = s = d = NULL; } free(t); free(s); free(d); - t = s = d = NULL; - } - free(t); - free(s); - free(d); - pager_close(); - close(hfd); - if (!matched) { - snprintf(command_errbuf, sizeof(command_errbuf), - "no help available for '%s'", topic); + pager_close(); + close(hfd); + if (!matched) { + snprintf(command_errbuf, sizeof(command_errbuf), + "no help available for '%s'", topic); + free(topic); + free(subtopic); + return (CMD_ERROR); + } free(topic); free(subtopic); - return(CMD_ERROR); - } - free(topic); - free(subtopic); - return(CMD_OK); + return (CMD_OK); } COMMAND_SET(commandlist, "?", "list commands", command_commandlist); @@ -223,27 +228,28 @@ COMMAND_SET(commandlist, "?", "list commands", command * fixing it. */ static int -command_commandlist(int argc, char *argv[]) +command_commandlist(int argc __unused, char *argv[] __unused) { - struct bootblk_command **cmdp; - int res; - char name[20]; + struct bootblk_command **cmdp; + int res; + char name[20]; - res = 0; - pager_open(); - res = pager_output("Available commands:\n"); - SET_FOREACH(cmdp, Xcommand_set) { - if (res) - break; - if (((*cmdp)->c_name != NULL) && ((*cmdp)->c_desc != NULL)) { - sprintf(name, " %-15s ", (*cmdp)->c_name); - pager_output(name); - pager_output((*cmdp)->c_desc); - res = pager_output("\n"); + res = 0; + pager_open(); + res = pager_output("Available commands:\n"); + SET_FOREACH(cmdp, Xcommand_set) { + if (res) + break; + if ((*cmdp)->c_name != NULL && (*cmdp)->c_desc != NULL) { + snprintf(name, sizeof(name), " %-15s ", + (*cmdp)->c_name); + pager_output(name); + pager_output((*cmdp)->c_desc); + res = pager_output("\n"); + } } - } - pager_close(); - return(CMD_OK); + pager_close(); + return (CMD_OK); } /* @@ -256,35 +262,35 @@ COMMAND_SET(show, "show", "show variable(s)", command_ static int command_show(int argc, char *argv[]) { - struct env_var *ev; - char *cp; + struct env_var *ev; + char *cp; - if (argc < 2) { - /* - * With no arguments, print everything. - */ - pager_open(); - for (ev = environ; ev != NULL; ev = ev->ev_next) { - pager_output(ev->ev_name); - cp = getenv(ev->ev_name); - if (cp != NULL) { - pager_output("="); - pager_output(cp); - } - if (pager_output("\n")) - break; - } - pager_close(); - } else { - if ((cp = getenv(argv[1])) != NULL) { - printf("%s\n", cp); + if (argc < 2) { + /* + * With no arguments, print everything. + */ + pager_open(); + for (ev = environ; ev != NULL; ev = ev->ev_next) { + pager_output(ev->ev_name); + cp = getenv(ev->ev_name); + if (cp != NULL) { + pager_output("="); + pager_output(cp); + } + if (pager_output("\n")) + break; + } + pager_close(); } else { - snprintf(command_errbuf, sizeof(command_errbuf), - "variable '%s' not found", argv[1]); - return(CMD_ERROR); + if ((cp = getenv(argv[1])) != NULL) { + printf("%s\n", cp); + } else { + snprintf(command_errbuf, sizeof(command_errbuf), + "variable '%s' not found", argv[1]); + return (CMD_ERROR); + } } - } - return(CMD_OK); + return (CMD_OK); } COMMAND_SET(set, "set", "set a variable", command_set); @@ -292,37 +298,37 @@ COMMAND_SET(set, "set", "set a variable", command_set) static int command_set(int argc, char *argv[]) { - int err; - - if (argc != 2) { - command_errmsg = "wrong number of arguments"; - return(CMD_ERROR); - } else { - if ((err = putenv(argv[1])) != 0) { - command_errmsg = strerror(err); - return(CMD_ERROR); + int err; + + if (argc != 2) { + command_errmsg = "wrong number of arguments"; + return (CMD_ERROR); + } else { + if ((err = putenv(argv[1])) != 0) { + command_errmsg = strerror(err); + return (CMD_ERROR); + } } - } - return(CMD_OK); + return (CMD_OK); } COMMAND_SET(unset, "unset", "unset a variable", command_unset); static int -command_unset(int argc, char *argv[]) +command_unset(int argc, char *argv[]) { - int err; - - if (argc != 2) { - command_errmsg = "wrong number of arguments"; - return(CMD_ERROR); - } else { - if ((err = unsetenv(argv[1])) != 0) { - command_errmsg = strerror(err); - return(CMD_ERROR); + int err; + + if (argc != 2) { + command_errmsg = "wrong number of arguments"; + return (CMD_ERROR); + } else { + if ((err = unsetenv(argv[1])) != 0) { + command_errmsg = strerror(err); + return (CMD_ERROR); + } } - } - return(CMD_OK); + return (CMD_OK); } COMMAND_SET(echo, "echo", "echo arguments", command_echo); @@ -330,34 +336,34 @@ COMMAND_SET(echo, "echo", "echo arguments", command_ec static int command_echo(int argc, char *argv[]) { - char *s; - int nl, ch; - - nl = 0; - optind = 1; - optreset = 1; - while ((ch = getopt(argc, argv, "n")) != -1) { - switch(ch) { - case 'n': - nl = 1; - break; - case '?': - default: - /* getopt has already reported an error */ - return(CMD_OK); + char *s; + int nl, ch; + + nl = 0; + optind = 1; + optreset = 1; + while ((ch = getopt(argc, argv, "n")) != -1) { + switch (ch) { + case 'n': + nl = 1; + break; + case '?': + default: + /* getopt has already reported an error */ + return (CMD_OK); + } } - } - argv += (optind); - argc -= (optind); + argv += (optind); + argc -= (optind); - s = unargv(argc, argv); - if (s != NULL) { - printf("%s", s); - free(s); - } - if (!nl) - printf("\n"); - return(CMD_OK); + s = unargv(argc, argv); + if (s != NULL) { + printf("%s", s); + free(s); + } + if (!nl) + printf("\n"); + return (CMD_OK); } /* @@ -369,55 +375,55 @@ COMMAND_SET(read, "read", "read input from the termina static int command_read(int argc, char *argv[]) { - char *prompt; - int timeout; - time_t when; - char *cp; - char *name; - char buf[256]; /* XXX size? */ - int c; + char *prompt; + int timeout; + time_t when; + char *cp; + char *name; + char buf[256]; /* XXX size? */ + int c; - timeout = -1; - prompt = NULL; - optind = 1; - optreset = 1; - while ((c = getopt(argc, argv, "p:t:")) != -1) { - switch(c) { - - case 'p': - prompt = optarg; - break; - case 't': - timeout = strtol(optarg, &cp, 0); - if (cp == optarg) { - snprintf(command_errbuf, sizeof(command_errbuf), - "bad timeout '%s'", optarg); - return(CMD_ERROR); - } - break; - default: - return(CMD_OK); + timeout = -1; + prompt = NULL; + optind = 1; + optreset = 1; + while ((c = getopt(argc, argv, "p:t:")) != -1) { + switch (c) { + case 'p': + prompt = optarg; + break; + case 't': + timeout = strtol(optarg, &cp, 0); + if (cp == optarg) { + snprintf(command_errbuf, + sizeof(command_errbuf), + "bad timeout '%s'", optarg); + return (CMD_ERROR); + } + break; + default: + return (CMD_OK); + } } - } - argv += (optind); - argc -= (optind); - name = (argc > 0) ? argv[0]: NULL; - - if (prompt != NULL) - printf("%s", prompt); - if (timeout >= 0) { - when = time(NULL) + timeout; - while (!ischar()) - if (time(NULL) >= when) - return(CMD_OK); /* is timeout an error? */ - } + argv += (optind); + argc -= (optind); + name = (argc > 0) ? argv[0]: NULL; - ngets(buf, sizeof(buf)); + if (prompt != NULL) + printf("%s", prompt); + if (timeout >= 0) { + when = time(NULL) + timeout; + while (!ischar()) + if (time(NULL) >= when) + return (CMD_OK); /* is timeout an error? */ + } - if (name != NULL) - setenv(name, buf, 1); - return(CMD_OK); + ngets(buf, sizeof(buf)); + + if (name != NULL) + setenv(name, buf, 1); + return (CMD_OK); } /* @@ -428,44 +434,46 @@ COMMAND_SET(more, "more", "show contents of a file", c static int command_more(int argc, char *argv[]) { - int i; - int res; - char line[80]; + int i; + int res; + char line[80]; - res=0; - pager_open(); - for (i = 1; (i < argc) && (res == 0); i++) { - sprintf(line, "*** FILE %s BEGIN ***\n", argv[i]); - if (pager_output(line)) - break; - res = page_file(argv[i]); - if (!res) { - sprintf(line, "*** FILE %s END ***\n", argv[i]); - res = pager_output(line); + res = 0; + pager_open(); + for (i = 1; (i < argc) && (res == 0); i++) { + snprintf(line, sizeof(line), "*** FILE %s BEGIN ***\n", + argv[i]); + if (pager_output(line)) + break; + res = page_file(argv[i]); + if (!res) { + snprintf(line, sizeof(line), "*** FILE %s END ***\n", + argv[i]); + res = pager_output(line); + } } - } - pager_close(); + pager_close(); - if (res == 0) - return CMD_OK; - else - return CMD_ERROR; + if (res == 0) + return (CMD_OK); + else + return (CMD_ERROR); } static int page_file(char *filename) { - int result; + int result; - result = pager_file(filename); + result = pager_file(filename); - if (result == -1) { - snprintf(command_errbuf, sizeof(command_errbuf), - "error showing %s", filename); - } + if (result == -1) { + snprintf(command_errbuf, sizeof(command_errbuf), + "error showing %s", filename); + } - return result; -} + return (result); +} /* * List all disk-like devices @@ -475,38 +483,38 @@ COMMAND_SET(lsdev, "lsdev", "list all devices", comman static int command_lsdev(int argc, char *argv[]) { - int verbose, ch, i; - char line[80]; - - verbose = 0; - optind = 1; - optreset = 1; - while ((ch = getopt(argc, argv, "v")) != -1) { - switch(ch) { - case 'v': - verbose = 1; - break; - case '?': - default: - /* getopt has already reported an error */ - return(CMD_OK); + int verbose, ch, i; + char line[80]; + + verbose = 0; + optind = 1; + optreset = 1; + while ((ch = getopt(argc, argv, "v")) != -1) { + switch (ch) { + case 'v': + verbose = 1; + break; + case '?': + default: + /* getopt has already reported an error */ + return (CMD_OK); + } } - } - argv += (optind); - argc -= (optind); + argv += (optind); + argc -= (optind); - pager_open(); - for (i = 0; devsw[i] != NULL; i++) { - if (devsw[i]->dv_print != NULL){ - if (devsw[i]->dv_print(verbose)) - break; - } else { - sprintf(line, "%s: (unknown)\n", devsw[i]->dv_name); - if (pager_output(line)) - break; + pager_open(); + for (i = 0; devsw[i] != NULL; i++) { + if (devsw[i]->dv_print != NULL) { + if (devsw[i]->dv_print(verbose)) + break; + } else { + snprintf(line, sizeof(line), "%s: (unknown)\n", + devsw[i]->dv_name); + if (pager_output(line)) + break; + } } - } - pager_close(); - return(CMD_OK); + pager_close(); + return (CMD_OK); } - From owner-svn-src-stable-11@freebsd.org Tue Feb 19 18:35:50 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8170514F8AD5; Tue, 19 Feb 2019 18:35:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 25FF66C297; Tue, 19 Feb 2019 18:35:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C5EC21B42; Tue, 19 Feb 2019 18:35:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JIZnE2021085; Tue, 19 Feb 2019 18:35:49 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JIZnnl021084; Tue, 19 Feb 2019 18:35:49 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902191835.x1JIZnnl021084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Feb 2019 18:35:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344287 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 344287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 25FF66C297 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 18:35:50 -0000 Author: kevans Date: Tue Feb 19 18:35:49 2019 New Revision: 344287 URL: https://svnweb.freebsd.org/changeset/base/344287 Log: MFC r333365, r333471: r333365: We don't use f_devdata, so don't set it. Should that need to change later, we can. This leaves ZFS as the only irregular f_devdata user in the tree. r333471: Revert r333365 Even though we don't use it, it appears something else requires it to be != 0 to work. This breaks tftp boot in loader.efi, so revert until that can be sorted out. Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable-11@freebsd.org Tue Feb 19 18:37:46 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CC2314F8C27; Tue, 19 Feb 2019 18:37:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D0B566C45F; Tue, 19 Feb 2019 18:37:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE67B21B43; Tue, 19 Feb 2019 18:37:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JIbj80021214; Tue, 19 Feb 2019 18:37:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JIbjSo021213; Tue, 19 Feb 2019 18:37:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902191837.x1JIbjSo021213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Feb 2019 18:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344288 - stable/11/stand/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/libsa X-SVN-Commit-Revision: 344288 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D0B566C45F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 18:37:46 -0000 Author: kevans Date: Tue Feb 19 18:37:45 2019 New Revision: 344288 URL: https://svnweb.freebsd.org/changeset/base/344288 Log: MFC r334868: Add st_mtime, st_ino and st_dev for ufs_stat Modified: stable/11/stand/libsa/ufs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/ufs.c ============================================================================== --- stable/11/stand/libsa/ufs.c Tue Feb 19 18:35:49 2019 (r344287) +++ stable/11/stand/libsa/ufs.c Tue Feb 19 18:37:45 2019 (r344288) @@ -124,6 +124,7 @@ struct file { ufs2_daddr_t f_buf_blkno; /* block number of data block */ char *f_buf; /* buffer for data block */ size_t f_buf_size; /* size of data block */ + int f_inumber; /* inumber */ }; #define DIP(fp, field) \ ((fp)->f_fs->fs_magic == FS_UFS1_MAGIC ? \ @@ -185,6 +186,7 @@ read_inode(inumber, f) fp->f_buf_blkno = -1; } fp->f_seekp = 0; + fp->f_inumber = inumber; out: free(buf); return (rc); @@ -831,6 +833,20 @@ ufs_stat(f, sb) sb->st_uid = DIP(fp, di_uid); sb->st_gid = DIP(fp, di_gid); sb->st_size = DIP(fp, di_size); + sb->st_mtime = DIP(fp, di_mtime); + /* + * The items below are ufs specific! + * Other fs types will need their own solution + * if these fields are needed. + */ + sb->st_ino = fp->f_inumber; + /* + * We need something to differentiate devs. + * fs_id is unique but 64bit, we xor the two + * halves to squeeze it into 32bits. + */ + sb->st_dev = (dev_t)(fp->f_fs->fs_id[0] ^ fp->f_fs->fs_id[1]); + return (0); } From owner-svn-src-stable-11@freebsd.org Tue Feb 19 18:45:42 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0EEF14F90DE; Tue, 19 Feb 2019 18:45:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 645966CB99; Tue, 19 Feb 2019 18:45:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 581CC21CE8; Tue, 19 Feb 2019 18:45:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JIjgCo026560; Tue, 19 Feb 2019 18:45:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JIjfpZ026554; Tue, 19 Feb 2019 18:45:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902191845.x1JIjfpZ026554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Feb 2019 18:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344289 - in stable/11/stand: . efi/loader libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: . efi/loader libsa X-SVN-Commit-Revision: 344289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 645966CB99 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 18:45:43 -0000 Author: kevans Date: Tue Feb 19 18:45:40 2019 New Revision: 344289 URL: https://svnweb.freebsd.org/changeset/base/344289 Log: MFC r335069-r335071, r335110, r335116: stand housecleaning r335069: Remove fail: label. It's unused. r335070: Remove unused variables. [kevans@: removed ufs.c modifications; those depend on ufs rewrite bits] r335071: Initialize variables we later free so they aren't used uninitialized in the error path. Remove unused variables. r335110: Remove redundant defs.mk includes. They aren't needed. r335116: Use bool for vargood, since it's a boolean. Modified: stable/11/stand/efi/loader/main.c stable/11/stand/ficl.mk stable/11/stand/libsa/nfs.c stable/11/stand/libsa/open.c stable/11/stand/libsa/tftp.c stable/11/stand/loader.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Tue Feb 19 18:37:45 2019 (r344288) +++ stable/11/stand/efi/loader/main.c Tue Feb 19 18:45:40 2019 (r344289) @@ -415,7 +415,8 @@ main(int argc, CHAR16 *argv[]) { char var[128]; EFI_GUID *guid; - int i, j, vargood, howto; + int i, j, howto; + bool vargood; UINTN k; int has_kbd; char *s; @@ -532,14 +533,14 @@ main(int argc, CHAR16 *argv[]) } } } else { - vargood = 0; + vargood = false; for (j = 0; argv[i][j] != 0; j++) { if (j == sizeof(var)) { - vargood = 0; + vargood = false; break; } if (j > 0 && argv[i][j] == '=') - vargood = 1; + vargood = true; var[j] = (char)argv[i][j]; } if (vargood) { Modified: stable/11/stand/ficl.mk ============================================================================== --- stable/11/stand/ficl.mk Tue Feb 19 18:37:45 2019 (r344288) +++ stable/11/stand/ficl.mk Tue Feb 19 18:45:40 2019 (r344289) @@ -2,8 +2,6 @@ # Common flags to build FICL related files -.include "defs.mk" - .if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1 FICL_CPUARCH= i386 .elif ${MACHINE_ARCH:Mmips64*} != "" Modified: stable/11/stand/libsa/nfs.c ============================================================================== --- stable/11/stand/libsa/nfs.c Tue Feb 19 18:37:45 2019 (r344288) +++ stable/11/stand/libsa/nfs.c Tue Feb 19 18:45:40 2019 (r344289) @@ -249,7 +249,7 @@ int nfs_lookupfh(struct nfs_iodesc *d, const char *name, struct nfs_iodesc *newfd) { void *pkt = NULL; - int len, rlen, pos; + int len, pos; struct args { uint32_t fhsize; uint32_t fhplusname[1 + @@ -465,14 +465,13 @@ int nfs_open(const char *upath, struct open_file *f) { struct iodesc *desc; - struct nfs_iodesc *currfd; + struct nfs_iodesc *currfd = NULL; char buf[2 * NFS_V3MAXFHSIZE + 3]; u_char *fh; char *cp; int i; #ifndef NFS_NOSYMLINK - struct nfs_iodesc *newfd; - struct nfsv3_fattrs *fa; + struct nfs_iodesc *newfd = NULL; char *ncp; int c; char namebuf[NFS_MAXPATHLEN + 1]; @@ -480,7 +479,7 @@ nfs_open(const char *upath, struct open_file *f) int nlinks = 0; #endif int error; - char *path; + char *path = NULL; if (netproto != NET_NFS) return (EINVAL); Modified: stable/11/stand/libsa/open.c ============================================================================== --- stable/11/stand/libsa/open.c Tue Feb 19 18:37:45 2019 (r344288) +++ stable/11/stand/libsa/open.c Tue Feb 19 18:45:40 2019 (r344289) @@ -141,7 +141,6 @@ open(const char *fname, int mode) } error = besterror; - fail: if ((f->f_flags & F_NODEV) == 0 && f->f_dev != NULL) f->f_dev->dv_close(f); if (error) Modified: stable/11/stand/libsa/tftp.c ============================================================================== --- stable/11/stand/libsa/tftp.c Tue Feb 19 18:37:45 2019 (r344288) +++ stable/11/stand/libsa/tftp.c Tue Feb 19 18:45:40 2019 (r344289) @@ -186,7 +186,6 @@ recvtftp(struct iodesc *d, void **pkt, void **payload, struct tftprecv_extra *extra; struct tftp_handle *h; struct tftphdr *t; - unsigned short *rtype; void *ptr = NULL; ssize_t len; Modified: stable/11/stand/loader.mk ============================================================================== --- stable/11/stand/loader.mk Tue Feb 19 18:37:45 2019 (r344288) +++ stable/11/stand/loader.mk Tue Feb 19 18:45:40 2019 (r344289) @@ -1,7 +1,5 @@ # $FreeBSD$ -.include "defs.mk" - .PATH: ${LDRSRC} ${BOOTSRC}/libsa CFLAGS+=-I${LDRSRC} From owner-svn-src-stable-11@freebsd.org Tue Feb 19 18:48:20 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2FD614F921E; Tue, 19 Feb 2019 18:48:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A9C86CDCE; Tue, 19 Feb 2019 18:48:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DF5521CFB; Tue, 19 Feb 2019 18:48:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JImKj9026739; Tue, 19 Feb 2019 18:48:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JImIhh026730; Tue, 19 Feb 2019 18:48:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902191848.x1JImIhh026730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Feb 2019 18:48:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344290 - in stable/11/stand: common efi/loader i386/loader mips/beri/loader pc98/loader powerpc/kboot powerpc/ofw sparc64/loader uboot/common userboot/userboot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: common efi/loader i386/loader mips/beri/loader pc98/loader powerpc/kboot powerpc/ofw sparc64/loader uboot/common userboot/userboot X-SVN-Commit-Revision: 344290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2A9C86CDCE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 18:48:21 -0000 Author: kevans Date: Tue Feb 19 18:48:17 2019 New Revision: 344290 URL: https://svnweb.freebsd.org/changeset/base/344290 Log: MFC r335117: stand bootprog_info consolidation bootprog_info is generated in vers.c. Move it's definition to bootstrap.h and remove all the redundant copies. Modified: stable/11/stand/common/bootstrap.h stable/11/stand/efi/loader/main.c stable/11/stand/i386/loader/main.c stable/11/stand/mips/beri/loader/loader.h stable/11/stand/pc98/loader/main.c stable/11/stand/powerpc/kboot/main.c stable/11/stand/powerpc/ofw/main.c stable/11/stand/sparc64/loader/main.c stable/11/stand/uboot/common/main.c stable/11/stand/userboot/userboot/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/common/bootstrap.h ============================================================================== --- stable/11/stand/common/bootstrap.h Tue Feb 19 18:45:40 2019 (r344289) +++ stable/11/stand/common/bootstrap.h Tue Feb 19 18:48:17 2019 (r344290) @@ -161,6 +161,11 @@ char *pnp_eisaformat(uint8_t *data); extern int isapnp_readport; /* + * Version information + */ +extern char bootprog_info[]; + +/* * Preloaded file metadata header. * * Metadata are allocated on our heap, and copied into kernel space Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Tue Feb 19 18:45:40 2019 (r344289) +++ stable/11/stand/efi/loader/main.c Tue Feb 19 18:48:17 2019 (r344290) @@ -53,8 +53,6 @@ __FBSDID("$FreeBSD$"); #include "loader_efi.h" -extern char bootprog_info[]; - struct arch_switch archsw; /* MI/MD interface boundary */ EFI_GUID acpi = ACPI_TABLE_GUID; Modified: stable/11/stand/i386/loader/main.c ============================================================================== --- stable/11/stand/i386/loader/main.c Tue Feb 19 18:45:40 2019 (r344289) +++ stable/11/stand/i386/loader/main.c Tue Feb 19 18:48:17 2019 (r344290) @@ -79,9 +79,6 @@ struct zfs_boot_args *zargs; static void i386_zfs_probe(void); #endif -/* from vers.c */ -extern char bootprog_info[]; - /* XXX debugging */ extern char end[]; Modified: stable/11/stand/mips/beri/loader/loader.h ============================================================================== --- stable/11/stand/mips/beri/loader/loader.h Tue Feb 19 18:45:40 2019 (r344289) +++ stable/11/stand/mips/beri/loader/loader.h Tue Feb 19 18:48:17 2019 (r344290) @@ -58,7 +58,4 @@ extern struct bootinfo boot2_bootinfo; /* metadata.c */ int md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtbp); -/* vers.c */ -extern char bootprog_info[]; - #endif /* !_BOOT_LOADER_H_ */ Modified: stable/11/stand/pc98/loader/main.c ============================================================================== --- stable/11/stand/pc98/loader/main.c Tue Feb 19 18:45:40 2019 (r344289) +++ stable/11/stand/pc98/loader/main.c Tue Feb 19 18:48:17 2019 (r344290) @@ -65,9 +65,6 @@ static int isa_inb(int port); static void isa_outb(int port, int value); void exit(int code); -/* from vers.c */ -extern char bootprog_info[]; - /* XXX debugging */ extern char end[]; Modified: stable/11/stand/powerpc/kboot/main.c ============================================================================== --- stable/11/stand/powerpc/kboot/main.c Tue Feb 19 18:45:40 2019 (r344289) +++ stable/11/stand/powerpc/kboot/main.c Tue Feb 19 18:48:17 2019 (r344290) @@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$"); struct arch_switch archsw; extern void *_end; -extern char bootprog_info[]; - int kboot_getdev(void **vdev, const char *devspec, const char **path); ssize_t kboot_copyin(const void *src, vm_offset_t dest, const size_t len); ssize_t kboot_copyout(vm_offset_t src, void *dest, const size_t len); Modified: stable/11/stand/powerpc/ofw/main.c ============================================================================== --- stable/11/stand/powerpc/ofw/main.c Tue Feb 19 18:45:40 2019 (r344289) +++ stable/11/stand/powerpc/ofw/main.c Tue Feb 19 18:48:17 2019 (r344290) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); struct arch_switch archsw; /* MI/MD interface boundary */ extern char end[]; -extern char bootprog_info[]; uint32_t acells, scells; Modified: stable/11/stand/sparc64/loader/main.c ============================================================================== --- stable/11/stand/sparc64/loader/main.c Tue Feb 19 18:45:40 2019 (r344289) +++ stable/11/stand/sparc64/loader/main.c Tue Feb 19 18:48:17 2019 (r344290) @@ -75,8 +75,6 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" #include "dev_net.h" -extern char bootprog_info[]; - enum { HEAPVA = 0x800000, HEAPSZ = 0x3000000, Modified: stable/11/stand/uboot/common/main.c ============================================================================== --- stable/11/stand/uboot/common/main.c Tue Feb 19 18:45:40 2019 (r344289) +++ stable/11/stand/uboot/common/main.c Tue Feb 19 18:48:17 2019 (r344290) @@ -66,7 +66,6 @@ struct device_type { }; extern char end[]; -extern char bootprog_info[]; extern unsigned char _etext[]; extern unsigned char _edata[]; Modified: stable/11/stand/userboot/userboot/main.c ============================================================================== --- stable/11/stand/userboot/userboot/main.c Tue Feb 19 18:45:40 2019 (r344289) +++ stable/11/stand/userboot/userboot/main.c Tue Feb 19 18:48:17 2019 (r344290) @@ -52,7 +52,6 @@ static int userboot_zfs_found; struct loader_callbacks *callbacks; void *callbacks_arg; -extern char bootprog_info[]; static jmp_buf jb; struct arch_switch archsw; /* MI/MD interface boundary */ From owner-svn-src-stable-11@freebsd.org Tue Feb 19 18:50:22 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4685C14F92F4; Tue, 19 Feb 2019 18:50:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E4A606CF8C; Tue, 19 Feb 2019 18:50:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF76F21D0F; Tue, 19 Feb 2019 18:50:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JIoL6N026912; Tue, 19 Feb 2019 18:50:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JIoL8j026906; Tue, 19 Feb 2019 18:50:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902191850.x1JIoL8j026906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Feb 2019 18:50:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344291 - in stable/11/stand: arm/loader libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: arm/loader libsa X-SVN-Commit-Revision: 344291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E4A606CF8C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 18:50:22 -0000 Author: kevans Date: Tue Feb 19 18:50:20 2019 New Revision: 344291 URL: https://svnweb.freebsd.org/changeset/base/344291 Log: MFC r335125-r335127, r335148, r335224 r335125: libsa: cstyle cleanup for open/close/read/write sources r335126: libsa: f_rabuf could be NULL It is possible that we will not get RA buffer from open(), therefore we must validate RA. r335127: libsa: remobe unneeded check before free() free() is checking for NULL, remove duplicate check. r335148: libsa: open() should use NULL instead of typecasted 0 r335224: Remove empty directory Deleted: stable/11/stand/arm/loader/ Modified: stable/11/stand/libsa/close.c stable/11/stand/libsa/open.c stable/11/stand/libsa/read.c stable/11/stand/libsa/write.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/close.c ============================================================================== --- stable/11/stand/libsa/close.c Tue Feb 19 18:48:17 2019 (r344290) +++ stable/11/stand/libsa/close.c Tue Feb 19 18:50:20 2019 (r344291) @@ -32,30 +32,30 @@ * SUCH DAMAGE. * * @(#)close.c 8.1 (Berkeley) 6/11/93 - * * + * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ @@ -68,31 +68,30 @@ __FBSDID("$FreeBSD$"); int close(int fd) { - struct open_file *f = &files[fd]; - int err1 = 0, err2 = 0; + struct open_file *f = &files[fd]; + int err1 = 0, err2 = 0; - if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) { - errno = EBADF; - return (-1); - } - if (f->f_rabuf != NULL) { + if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) { + errno = EBADF; + return (-1); + } free(f->f_rabuf); f->f_rabuf = NULL; - } - if (!(f->f_flags & F_RAW) && f->f_ops) - err1 = (f->f_ops->fo_close)(f); - if (!(f->f_flags & F_NODEV) && f->f_dev) - err2 = (f->f_dev->dv_close)(f); - if (f->f_devdata != NULL) - devclose(f); - f->f_flags = 0; - if (err1) { - errno = err1; - return (-1); - } - if (err2) { - errno = err2; - return (-1); - } - return (0); + + if (!(f->f_flags & F_RAW) && f->f_ops) + err1 = (f->f_ops->fo_close)(f); + if (!(f->f_flags & F_NODEV) && f->f_dev) + err2 = (f->f_dev->dv_close)(f); + if (f->f_devdata != NULL) + devclose(f); + f->f_flags = 0; + if (err1) { + errno = err1; + return (-1); + } + if (err2) { + errno = err2; + return (-1); + } + return (0); } Modified: stable/11/stand/libsa/open.c ============================================================================== --- stable/11/stand/libsa/open.c Tue Feb 19 18:48:17 2019 (r344290) +++ stable/11/stand/libsa/open.c Tue Feb 19 18:50:20 2019 (r344291) @@ -32,30 +32,30 @@ * SUCH DAMAGE. * * @(#)open.c 8.1 (Berkeley) 6/11/93 - * * + * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ @@ -70,89 +70,89 @@ struct fs_ops *exclusive_file_system; struct open_file files[SOPEN_MAX]; static int -o_gethandle(void) +o_gethandle(void) { - int fd; - - for (fd = 0; fd < SOPEN_MAX; fd++) - if (files[fd].f_flags == 0) - return(fd); - return(-1); + int fd; + + for (fd = 0; fd < SOPEN_MAX; fd++) + if (files[fd].f_flags == 0) + return (fd); + return (-1); } static void o_rainit(struct open_file *f) { - f->f_rabuf = malloc(SOPEN_RASIZE); - f->f_ralen = 0; - f->f_raoffset = 0; + f->f_rabuf = malloc(SOPEN_RASIZE); + f->f_ralen = 0; + f->f_raoffset = 0; } int open(const char *fname, int mode) { - struct fs_ops *fs; - struct open_file *f; - int fd, i, error, besterror; - const char *file; + struct fs_ops *fs; + struct open_file *f; + int fd, i, error, besterror; + const char *file; - if ((fd = o_gethandle()) == -1) { - errno = EMFILE; - return(-1); - } + if ((fd = o_gethandle()) == -1) { + errno = EMFILE; + return (-1); + } - f = &files[fd]; - f->f_flags = mode + 1; - f->f_dev = (struct devsw *)0; - f->f_ops = (struct fs_ops *)0; - f->f_offset = 0; - f->f_devdata = NULL; - file = (char *)0; + f = &files[fd]; + f->f_flags = mode + 1; + f->f_dev = NULL; + f->f_ops = NULL; + f->f_offset = 0; + f->f_devdata = NULL; + file = NULL; - if (exclusive_file_system != NULL) { - fs = exclusive_file_system; - error = (fs->fo_open)(fname, f); - if (error == 0) - goto ok; - goto err; - } + if (exclusive_file_system != NULL) { + fs = exclusive_file_system; + error = (fs->fo_open)(fname, f); + if (error == 0) + goto ok; + goto err; + } - error = devopen(f, fname, &file); - if (error || - (((f->f_flags & F_NODEV) == 0) && f->f_dev == (struct devsw *)0)) - goto err; + error = devopen(f, fname, &file); + if (error || + (((f->f_flags & F_NODEV) == 0) && f->f_dev == NULL)) + goto err; - /* see if we opened a raw device; otherwise, 'file' is the file name. */ - if (file == (char *)0 || *file == '\0') { - f->f_flags |= F_RAW; - f->f_rabuf = NULL; - return (fd); - } + /* see if we opened a raw device; otherwise, 'file' is the file name. */ + if (file == NULL || *file == '\0') { + f->f_flags |= F_RAW; + f->f_rabuf = NULL; + return (fd); + } - /* pass file name to the different filesystem open routines */ - besterror = ENOENT; - for (i = 0; file_system[i] != NULL; i++) { - fs = file_system[i]; - error = (fs->fo_open)(file, f); - if (error == 0) - goto ok; - if (error != EINVAL) - besterror = error; - } - error = besterror; + /* pass file name to the different filesystem open routines */ + besterror = ENOENT; + for (i = 0; file_system[i] != NULL; i++) { + fs = file_system[i]; + error = (fs->fo_open)(file, f); + if (error == 0) + goto ok; + if (error != EINVAL) + besterror = error; + } + error = besterror; - if ((f->f_flags & F_NODEV) == 0 && f->f_dev != NULL) - f->f_dev->dv_close(f); - if (error) - devclose(f); + if ((f->f_flags & F_NODEV) == 0 && f->f_dev != NULL) + f->f_dev->dv_close(f); + if (error) + devclose(f); - err: - f->f_flags = 0; - errno = error; - return (-1); +err: + f->f_flags = 0; + errno = error; + return (-1); - ok: - f->f_ops = fs; - o_rainit(f); - return (fd); +ok: + f->f_ops = fs; + o_rainit(f); + return (fd); } Modified: stable/11/stand/libsa/read.c ============================================================================== --- stable/11/stand/libsa/read.c Tue Feb 19 18:48:17 2019 (r344290) +++ stable/11/stand/libsa/read.c Tue Feb 19 18:50:20 2019 (r344291) @@ -32,30 +32,30 @@ * SUCH DAMAGE. * * @(#)read.c 8.1 (Berkeley) 6/11/93 - * * + * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ @@ -69,59 +69,65 @@ __FBSDID("$FreeBSD$"); ssize_t read(int fd, void *dest, size_t bcount) { - struct open_file *f = &files[fd]; - size_t resid; + struct open_file *f = &files[fd]; + size_t resid; - if ((unsigned)fd >= SOPEN_MAX || !(f->f_flags & F_READ)) { - errno = EBADF; - return (-1); - } - if (f->f_flags & F_RAW) { - twiddle(4); - errno = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - btodb(f->f_offset), bcount, dest, &resid); - if (errno) - return (-1); - f->f_offset += resid; - return (resid); - } - - /* - * Optimise reads from regular files using a readahead buffer. - * If the request can't be satisfied from the current buffer contents, - * check to see if it should be bypassed, or refill the buffer and complete - * the request. - */ - resid = bcount; - for (;;) { - size_t ccount, cresid; - /* how much can we supply? */ - ccount = imin(f->f_ralen, resid); - if (ccount > 0) { - bcopy(f->f_rabuf + f->f_raoffset, dest, ccount); - f->f_raoffset += ccount; - f->f_ralen -= ccount; - resid -= ccount; - if (resid == 0) - return(bcount); - dest = (char *)dest + ccount; + if ((unsigned)fd >= SOPEN_MAX || !(f->f_flags & F_READ)) { + errno = EBADF; + return (-1); } - - /* will filling the readahead buffer again not help? */ - if (resid >= SOPEN_RASIZE) { - /* bypass the rest of the request and leave the buffer empty */ - if ((errno = (f->f_ops->fo_read)(f, dest, resid, &cresid))) - return (-1); - return(bcount - cresid); + if (f->f_flags & F_RAW) { + twiddle(4); + errno = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, + btodb(f->f_offset), bcount, dest, &resid); + if (errno) + return (-1); + f->f_offset += resid; + return (resid); } - /* fetch more data */ - if ((errno = (f->f_ops->fo_read)(f, f->f_rabuf, SOPEN_RASIZE, &cresid))) - return (-1); - f->f_raoffset = 0; - f->f_ralen = SOPEN_RASIZE - cresid; - /* no more data, return what we had */ - if (f->f_ralen == 0) - return(bcount - resid); - } + /* + * Optimise reads from regular files using a readahead buffer. + * If the request can't be satisfied from the current buffer contents, + * check to see if it should be bypassed, or refill the buffer and + * complete the request. + */ + resid = bcount; + for (;;) { + size_t ccount, cresid; + /* how much can we supply? */ + ccount = imin(f->f_ralen, resid); + if (ccount > 0) { + bcopy(f->f_rabuf + f->f_raoffset, dest, ccount); + f->f_raoffset += ccount; + f->f_ralen -= ccount; + resid -= ccount; + if (resid == 0) + return (bcount); + dest = (char *)dest + ccount; + } + + /* will filling the readahead buffer again not help? */ + if (f->f_rabuf == NULL || resid >= SOPEN_RASIZE) { + /* + * bypass the rest of the request and leave the + * buffer empty + */ + errno = (f->f_ops->fo_read)(f, dest, resid, &cresid); + if (errno != 0) + return (-1); + return (bcount - cresid); + } + + /* fetch more data */ + errno = (f->f_ops->fo_read)(f, f->f_rabuf, SOPEN_RASIZE, + &cresid); + if (errno != 0) + return (-1); + f->f_raoffset = 0; + f->f_ralen = SOPEN_RASIZE - cresid; + /* no more data, return what we had */ + if (f->f_ralen == 0) + return (bcount - resid); + } } Modified: stable/11/stand/libsa/write.c ============================================================================== --- stable/11/stand/libsa/write.c Tue Feb 19 18:48:17 2019 (r344290) +++ stable/11/stand/libsa/write.c Tue Feb 19 18:50:20 2019 (r344291) @@ -32,30 +32,30 @@ * SUCH DAMAGE. * * @(#)write.c 8.1 (Berkeley) 6/11/93 - * * + * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ @@ -67,10 +67,7 @@ __FBSDID("$FreeBSD$"); #include "stand.h" ssize_t -write(fd, dest, bcount) - int fd; - const void *dest; - size_t bcount; +write(int fd, const void *dest, size_t bcount) { struct open_file *f = &files[fd]; size_t resid; @@ -82,8 +79,8 @@ write(fd, dest, bcount) if (f->f_flags & F_RAW) { twiddle(4); errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, - btodb(f->f_offset), bcount, __DECONST(void *, dest), - &resid); + btodb(f->f_offset), bcount, __DECONST(void *, dest), + &resid); if (errno) return (-1); f->f_offset += resid; From owner-svn-src-stable-11@freebsd.org Tue Feb 19 19:16:30 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D092B14FA097; Tue, 19 Feb 2019 19:16:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F10E6E425; Tue, 19 Feb 2019 19:16:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C6582224C; Tue, 19 Feb 2019 19:16:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JJGTB9042490; Tue, 19 Feb 2019 19:16:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JJGSU3042487; Tue, 19 Feb 2019 19:16:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902191916.x1JJGSU3042487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Feb 2019 19:16:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344295 - in stable/11/stand: common i386/libi386 i386/zfsboot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: common i386/libi386 i386/zfsboot X-SVN-Commit-Revision: 344295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6F10E6E425 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 19:16:30 -0000 Author: kevans Date: Tue Feb 19 19:16:28 2019 New Revision: 344295 URL: https://svnweb.freebsd.org/changeset/base/344295 Log: MFC r335245-r335248, r335254, r335276, r335298, r335398, r335868, r335883 r335245: Correct logic error in biosdisk.c:bd_realstrategy() The wrong condition is used when evaluating the return of disk_ioctl() This results in reaching the 'We should not get here' branch in most casts r335246: biosdisk.c remove redundant variable `rdev` and `disk` serve the same purpose, read the partition table without the `d_offset` or `d_slice` set, so the read is relative to the start of the disk. Reuse the already initialized `disk` instead of making another copy later. r335247: biosdisk.c: add missing \n to error message r335248: biosdisk.c: fix type in debug printf r335254: Avoid reading past the end of the disk in zfsboot.c and biosdisk.c The GELI boot code rounds reads up to 4k, since the encrypted sectors are 4k, and must be decrypted as a unit. With oddball sized disks (almost always virtual), this can lead to reading past the end of the disk. r335276: gptboot, zfsboot, gptzfsboot: Enable the video and serial consoles early Normally the serial console is not enabled until /boot.config is read and we know how the serial console should be configured. Initialize the consoles early in 'dual' mode (serial & keyboard) with a default serial rate of 115200. Then serial is re-initialized once the disk is decrypted and the /boot.config file can be read. This allows the GELIBoot passphrase to be provided via the serial console. r335298: stand/common/disk.c: Update debug printf This was missed in r330809 because it is compiled out by default r335398: Revert r335276 This was causing issues for people booting. I will likely bring this back as an optional feature, similar to boot0sio, like gptboot-serial or something. r335868: stand/common/disk.c: Read partition table relative to the start of the disk If a disk is of an oddball size, like the 200mb + 512b used in rootgen.sh, when disk_open() is called on a GELI encrypted partition, attempts to read the partition table fail, as they pass through the decryption process which turns the already plaintext data into jibberish. When reading the partition table, always pass a slice and partition setting of -1, and an offset of 0. Setting the slice to -1 prevents a false positive when checking the slice against the cache of GELI encrypted slices. r335883: stand/common/disk.c: dev->d_offset still needs to be set to 0 With r335868, I thought this was no longer necessary. I was wrong. Modified: stable/11/stand/common/disk.c stable/11/stand/i386/libi386/biosdisk.c stable/11/stand/i386/zfsboot/zfsboot.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/common/disk.c ============================================================================== --- stable/11/stand/common/disk.c Tue Feb 19 19:15:15 2019 (r344294) +++ stable/11/stand/common/disk.c Tue Feb 19 19:16:28 2019 (r344295) @@ -219,20 +219,13 @@ disk_ioctl(struct disk_devdesc *dev, u_long cmd, void int disk_open(struct disk_devdesc *dev, uint64_t mediasize, u_int sectorsize) { + struct disk_devdesc partdev; struct open_disk *od; struct ptable *table; struct ptable_entry part; int rc, slice, partition; rc = 0; - /* - * While we are reading disk metadata, make sure we do it relative - * to the start of the disk - */ - dev->d_offset = 0; - table = NULL; - slice = dev->d_slice; - partition = dev->d_partition; od = (struct open_disk *)malloc(sizeof(struct open_disk)); if (od == NULL) { DEBUG("no memory"); @@ -242,11 +235,25 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize od->entrysize = 0; od->mediasize = mediasize; od->sectorsize = sectorsize; + /* + * While we are reading disk metadata, make sure we do it relative + * to the start of the disk + */ + memcpy(&partdev, dev, sizeof(partdev)); + partdev.d_offset = 0; + partdev.d_slice = -1; + partdev.d_partition = -1; + + dev->d_offset = 0; + table = NULL; + slice = dev->d_slice; + partition = dev->d_partition; + DEBUG("%s unit %d, slice %d, partition %d => %p", - disk_fmtdev(dev), dev->d_unit, dev->d_slice, dev->d_partition, od); + disk_fmtdev(dev), dev->dd.d_unit, dev->d_slice, dev->d_partition, od); /* Determine disk layout. */ - od->table = ptable_open(dev, mediasize / sectorsize, sectorsize, + od->table = ptable_open(&partdev, mediasize / sectorsize, sectorsize, ptblread); if (od->table == NULL) { DEBUG("Can't read partition table"); Modified: stable/11/stand/i386/libi386/biosdisk.c ============================================================================== --- stable/11/stand/i386/libi386/biosdisk.c Tue Feb 19 19:15:15 2019 (r344294) +++ stable/11/stand/i386/libi386/biosdisk.c Tue Feb 19 19:16:28 2019 (r344295) @@ -379,7 +379,7 @@ bd_print(int verbose) static int bd_open(struct open_file *f, ...) { - struct disk_devdesc *dev, rdev; + struct disk_devdesc *dev; struct disk_devdesc disk; int err, g_err; va_list ap; @@ -445,11 +445,8 @@ bd_open(struct open_file *f, ...) dskp.part = dev->d_partition; dskp.start = dev->d_offset; - memcpy(&rdev, dev, sizeof(rdev)); - /* to read the GPT table, we need to read the first sector */ - rdev.d_offset = 0; /* We need the LBA of the end of the partition */ - table = ptable_open(&rdev, BD(dev).bd_sectors, + table = ptable_open(&disk, BD(dev).bd_sectors, BD(dev).bd_sectorsize, ptblread); if (table == NULL) { DEBUG("Can't read partition table"); @@ -594,8 +591,8 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s *rsize = 0; /* Get disk blocks, this value is either for whole disk or for partition */ - if (disk_ioctl(dev, DIOCGMEDIASIZE, &disk_blocks)) { - /* DIOCGMEDIASIZE does return bytes. */ + if (disk_ioctl(dev, DIOCGMEDIASIZE, &disk_blocks) == 0) { + /* DIOCGMEDIASIZE returns bytes. */ disk_blocks /= BD(dev).bd_sectorsize; } else { /* We should not get here. Just try to survive. */ @@ -622,7 +619,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s if (blks && (rc = bd_read(dev, dblk, blks, buf))) { /* Filter out floppy controller errors */ if (BD(dev).bd_flags != BD_FLOPPY || rc != 0x20) { - printf("read %d from %lld to %p, error: 0x%x", blks, dblk, + printf("read %d from %lld to %p, error: 0x%x\n", blks, dblk, buf, rc); } return (EIO); @@ -638,7 +635,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s #endif break; case F_WRITE : - DEBUG("write %d from %d to %p", blks, dblk, buf); + DEBUG("write %d from %lld to %p", blks, dblk, buf); if (blks && bd_write(dev, dblk, blks, buf)) { DEBUG("write error"); @@ -883,6 +880,12 @@ bd_read(struct disk_devdesc *dev, daddr_t dblk, int bl if (tmpbuf == NULL) { return (-1); } + } + + if (alignlba + alignblks > BD(dev).bd_sectors) { + DEBUG("Shorted read at %llu from %d to %llu blocks", + alignlba, alignblks, BD(dev).bd_sectors - alignlba); + alignblks = BD(dev).bd_sectors - alignlba; } err = bd_io(dev, alignlba, alignblks, tmpbuf, 0); Modified: stable/11/stand/i386/zfsboot/zfsboot.c ============================================================================== --- stable/11/stand/i386/zfsboot/zfsboot.c Tue Feb 19 19:15:15 2019 (r344294) +++ stable/11/stand/i386/zfsboot/zfsboot.c Tue Feb 19 19:16:28 2019 (r344295) @@ -209,6 +209,12 @@ vdev_read(void *xvdev, void *priv, off_t off, void *bu alignnb = roundup2(nb * DEV_BSIZE + diff, DEV_GELIBOOT_BSIZE) / DEV_BSIZE; + if (dsk->size > 0 && alignlba + alignnb > dsk->size + dsk->start) { + printf("Shortening read at %lld from %d to %lld\n", alignlba, + alignnb, (dsk->size + dsk->start) - alignlba); + alignnb = (dsk->size + dsk->start) - alignlba; + } + if (drvread(dsk, dmadat->rdbuf, alignlba, alignnb)) return -1; #ifdef LOADER_GELI_SUPPORT @@ -694,7 +700,7 @@ main(void) dsk->slice = *(uint8_t *)PTOV(ARGS + 1) + 1; dsk->part = 0; dsk->start = 0; - dsk->size = 0; + dsk->size = drvsize_ext(dsk); bootinfo.bi_version = BOOTINFO_VERSION; bootinfo.bi_size = sizeof(bootinfo); @@ -745,7 +751,7 @@ main(void) dsk->slice = 0; dsk->part = 0; dsk->start = 0; - dsk->size = 0; + dsk->size = drvsize_ext(dsk); probe_drive(dsk); } From owner-svn-src-stable-11@freebsd.org Wed Feb 20 14:12:26 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6502214F564C; Wed, 20 Feb 2019 14:12:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0487382FE8; Wed, 20 Feb 2019 14:12:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9AB66963; Wed, 20 Feb 2019 14:12:25 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KECPO8041368; Wed, 20 Feb 2019 14:12:25 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KECPA3041366; Wed, 20 Feb 2019 14:12:25 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201902201412.x1KECPA3041366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 20 Feb 2019 14:12:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344363 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 344363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0487382FE8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 14:12:26 -0000 Author: pfg Date: Wed Feb 20 14:12:25 2019 New Revision: 344363 URL: https://svnweb.freebsd.org/changeset/base/344363 Log: MFC r344042: UMA: unsign some variables related to allocation in hash_alloc(). As a followup to r343673, unsign some variables related to allocation since the hashsize cannot be negative. This gives a bit more space to handle bigger allocations and avoid some implicit casting. While here also unsign uh_hashmask, it makes little sense to keep it signed. Differential Revision: https://reviews.freebsd.org/D19148 Modified: stable/11/sys/vm/uma_core.c stable/11/sys/vm/uma_int.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/uma_core.c ============================================================================== --- stable/11/sys/vm/uma_core.c Wed Feb 20 14:10:46 2019 (r344362) +++ stable/11/sys/vm/uma_core.c Wed Feb 20 14:12:25 2019 (r344363) @@ -537,7 +537,7 @@ zone_timeout(uma_zone_t zone) static int hash_alloc(struct uma_hash *hash) { - int oldsize; + u_int oldsize; size_t alloc; oldsize = hash->uh_hashsize; @@ -581,8 +581,8 @@ static int hash_expand(struct uma_hash *oldhash, struct uma_hash *newhash) { uma_slab_t slab; - int hval; - int i; + u_int hval; + u_int idx; if (!newhash->uh_slab_hash) return (0); @@ -595,10 +595,10 @@ hash_expand(struct uma_hash *oldhash, struct uma_hash * full rehash. */ - for (i = 0; i < oldhash->uh_hashsize; i++) - while (!SLIST_EMPTY(&oldhash->uh_slab_hash[i])) { - slab = SLIST_FIRST(&oldhash->uh_slab_hash[i]); - SLIST_REMOVE_HEAD(&oldhash->uh_slab_hash[i], us_hlink); + for (idx = 0; idx < oldhash->uh_hashsize; idx++) + while (!SLIST_EMPTY(&oldhash->uh_slab_hash[idx])) { + slab = SLIST_FIRST(&oldhash->uh_slab_hash[idx]); + SLIST_REMOVE_HEAD(&oldhash->uh_slab_hash[idx], us_hlink); hval = UMA_HASH(newhash, slab->us_data); SLIST_INSERT_HEAD(&newhash->uh_slab_hash[hval], slab, us_hlink); Modified: stable/11/sys/vm/uma_int.h ============================================================================== --- stable/11/sys/vm/uma_int.h Wed Feb 20 14:10:46 2019 (r344362) +++ stable/11/sys/vm/uma_int.h Wed Feb 20 14:12:25 2019 (r344363) @@ -144,8 +144,8 @@ SLIST_HEAD(slabhead, uma_slab); struct uma_hash { struct slabhead *uh_slab_hash; /* Hash table for slabs */ - int uh_hashsize; /* Current size of the hash table */ - int uh_hashmask; /* Mask used during hashing */ + u_int uh_hashsize; /* Current size of the hash table */ + u_int uh_hashmask; /* Mask used during hashing */ }; /* @@ -386,7 +386,7 @@ static __inline uma_slab_t hash_sfind(struct uma_hash *hash, uint8_t *data) { uma_slab_t slab; - int hval; + u_int hval; hval = UMA_HASH(hash, data); From owner-svn-src-stable-11@freebsd.org Wed Feb 20 18:30:56 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0F4614FB9D4; Wed, 20 Feb 2019 18:30:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9778CC89; Wed, 20 Feb 2019 18:30:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 429299517; Wed, 20 Feb 2019 18:30:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KIUt96092225; Wed, 20 Feb 2019 18:30:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KIUskL092224; Wed, 20 Feb 2019 18:30:54 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902201830.x1KIUskL092224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 18:30:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344370 - stable/11/stand/userboot/userboot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/userboot/userboot X-SVN-Commit-Revision: 344370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4F9778CC89 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 18:30:56 -0000 Author: kevans Date: Wed Feb 20 18:30:54 2019 New Revision: 344370 URL: https://svnweb.freebsd.org/changeset/base/344370 Log: MFC r334412: userboot: Fix bad type-punning Pass a struct devdesc to the format commands. Use proper type rather than doing weird type-punning that happened to work because the size was right. We copied a zfs devdesc into a disk_devdesc and then after passing through a NULL pointer reinterpreted it as a zfs_devdesc. Instead, pass the base devdesc around and 'upcase' when we know the types are right. This has the happy side effect of fixing a gcc warning about bad type punning. Modified: stable/11/stand/userboot/userboot/devicename.c stable/11/stand/userboot/userboot/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/userboot/userboot/devicename.c ============================================================================== --- stable/11/stand/userboot/userboot/devicename.c Wed Feb 20 18:29:52 2019 (r344369) +++ stable/11/stand/userboot/userboot/devicename.c Wed Feb 20 18:30:54 2019 (r344370) @@ -175,30 +175,30 @@ userboot_parsedev(struct disk_devdesc **dev, const cha char * userboot_fmtdev(void *vdev) { - struct disk_devdesc *dev = (struct disk_devdesc *)vdev; + struct devdesc *dev = (struct devdesc *)vdev; static char buf[128]; /* XXX device length constant? */ - switch(dev->dd.d_dev->dv_type) { + switch(dev->d_dev->dv_type) { case DEVT_NONE: strcpy(buf, "(no device)"); break; case DEVT_CD: - sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit); + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); break; case DEVT_DISK: return (disk_fmtdev(vdev)); case DEVT_NET: - sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit); + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); break; case DEVT_ZFS: #if defined(USERBOOT_ZFS_SUPPORT) return (zfs_fmtdev(vdev)); #else - sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit); + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); #endif break; } Modified: stable/11/stand/userboot/userboot/main.c ============================================================================== --- stable/11/stand/userboot/userboot/main.c Wed Feb 20 18:29:52 2019 (r344369) +++ stable/11/stand/userboot/userboot/main.c Wed Feb 20 18:30:54 2019 (r344370) @@ -154,19 +154,18 @@ static void extract_currdev(void) { struct disk_devdesc dev; - - //bzero(&dev, sizeof(dev)); - + struct devdesc *dd; #if defined(USERBOOT_ZFS_SUPPORT) + struct zfs_devdesc zdev; + if (userboot_zfs_found) { - struct zfs_devdesc zdev; /* Leave the pool/root guid's unassigned */ bzero(&zdev, sizeof(zdev)); zdev.dd.d_dev = &zfs_dev; - dev = *(struct disk_devdesc *)&zdev; - init_zfs_bootenv(zfs_fmtdev(&dev)); + init_zfs_bootenv(zfs_fmtdev(&zdev)); + dd = &zdev.dd; } else #endif @@ -183,14 +182,16 @@ extract_currdev(void) dev.d_slice = -1; dev.d_partition = -1; } + dd = &dev.dd; } else { dev.dd.d_dev = &host_dev; dev.dd.d_unit = 0; + dd = &dev.dd; } - env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev), + env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(dd), userboot_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev), + env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(dd), env_noset, env_nounset); } From owner-svn-src-stable-11@freebsd.org Wed Feb 20 18:34:22 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B56814FBCAF; Wed, 20 Feb 2019 18:34:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF07E8D1CE; Wed, 20 Feb 2019 18:34:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C76D996C2; Wed, 20 Feb 2019 18:34:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KIYLTL097781; Wed, 20 Feb 2019 18:34:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KIYLda097779; Wed, 20 Feb 2019 18:34:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902201834.x1KIYLda097779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 18:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344371 - in stable/11/stand/efi: include libefi loader X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand/efi: include libefi loader X-SVN-Commit-Revision: 344371 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DF07E8D1CE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 18:34:22 -0000 Author: kevans Date: Wed Feb 20 18:34:20 2019 New Revision: 344371 URL: https://svnweb.freebsd.org/changeset/base/344371 Log: MFC r335228-r335231, r335272: stand: efiloader fixes r335228: Migrate has_keyboard to bool. r335229: Provide a more direct interface to tell ZFS what the preferred handle is. We tell the ZFS code now, and it checks rather than having a callback to do the checks. This will allow us to have a more graceful fallback code. In the future, it's anticipated that we may fallback to a more global search (or implement a command to do so) when reqeusted by the user, or we detect a violation of the UEFI Boot Manager protocol severe enough to warrant this backstop. For now, it just allows us to get rid of img as a global. r335230: Move arg parsing into its own routine for possible later reuse. r335231: There's no need to walk through the tables looking for the smbios table if we're just going to ignore it on arm, so expand, slightly, the reach of the ifdef. Move the buffer to the inner block so we don't have a separate #ifdef far away from these lines. The issue on arm is that smbios_detect does unaligned accesses, which in the u-boot implementing EFI context causes a crash. r335272: Many netboot scenarios don't have /boot/defaults/loader.conf. As a fallback, also check /boot/kernel/kernel existing as well, since that's the fallback behavior of the loader. Modified: stable/11/stand/efi/include/efizfs.h stable/11/stand/efi/libefi/efizfs.c stable/11/stand/efi/loader/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/include/efizfs.h ============================================================================== --- stable/11/stand/efi/include/efizfs.h Wed Feb 20 18:30:54 2019 (r344370) +++ stable/11/stand/efi/include/efizfs.h Wed Feb 20 18:34:20 2019 (r344371) @@ -44,11 +44,11 @@ typedef struct zfsinfo extern uint64_t pool_guid; -extern void efi_zfs_probe(void); -extern zfsinfo_list_t *efizfs_get_zfsinfo_list(void); -extern bool efi_zfs_is_preferred(EFI_HANDLE *h); -extern EFI_HANDLE efizfs_get_handle_by_guid(uint64_t); -extern bool efizfs_get_guid_by_handle(EFI_HANDLE, uint64_t *); +void efi_zfs_probe(void); +EFI_HANDLE efizfs_get_handle_by_guid(uint64_t); +bool efizfs_get_guid_by_handle(EFI_HANDLE, uint64_t *); +zfsinfo_list_t *efizfs_get_zfsinfo_list(void); +void efizfs_set_preferred(EFI_HANDLE); #endif Modified: stable/11/stand/efi/libefi/efizfs.c ============================================================================== --- stable/11/stand/efi/libefi/efizfs.c Wed Feb 20 18:30:54 2019 (r344370) +++ stable/11/stand/efi/libefi/efizfs.c Wed Feb 20 18:34:20 2019 (r344371) @@ -45,6 +45,14 @@ static zfsinfo_list_t zfsinfo; uint64_t pool_guid; +static EFI_HANDLE preferred; + +void +efizfs_set_preferred(EFI_HANDLE h) +{ + preferred = h; +} + zfsinfo_list_t * efizfs_get_zfsinfo_list(void) { @@ -110,16 +118,13 @@ efi_zfs_probe(void) */ STAILQ_FOREACH(hd, hdi, pd_link) { STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { - snprintf(devname, sizeof(devname), "%s%dp%d:", efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit); - - if (zfs_probe_dev(devname, &guid) == 0) { - insert_zfs(pd->pd_handle, guid); - - if (efi_zfs_is_preferred(pd->pd_handle)) - pool_guid = guid; - } + if (zfs_probe_dev(devname, &guid) == 0) { + insert_zfs(pd->pd_handle, guid); + if (pd->pd_handle == preferred) + pool_guid = guid; + } } } Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Wed Feb 20 18:30:54 2019 (r344370) +++ stable/11/stand/efi/loader/main.c Wed Feb 20 18:34:20 2019 (r344371) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #ifdef EFI_ZFS_BOOT #include - #include "efizfs.h" #endif @@ -73,8 +72,6 @@ EFI_GUID debugimg = DEBUG_IMAGE_INFO_TABLE_GUID; EFI_GUID fdtdtb = FDT_TABLE_GUID; EFI_GUID inputid = SIMPLE_TEXT_INPUT_PROTOCOL; -static EFI_LOADED_IMAGE *img; - /* * Number of seconds to wait for a keystroke before exiting with failure * in the event no currdev is found. -2 means always break, -1 means @@ -84,22 +81,14 @@ static EFI_LOADED_IMAGE *img; */ static int fail_timeout = 5; -#ifdef EFI_ZFS_BOOT -bool -efi_zfs_is_preferred(EFI_HANDLE *h) -{ - return (h == img->DeviceHandle); -} -#endif - -static int +static bool has_keyboard(void) { EFI_STATUS status; EFI_DEVICE_PATH *path; EFI_HANDLE *hin, *hin_end, *walker; UINTN sz; - int retval = 0; + bool retval = false; /* * Find all the handles that support the SIMPLE_TEXT_INPUT_PROTOCOL and @@ -146,7 +135,7 @@ has_keyboard(void) acpi = (ACPI_HID_DEVICE_PATH *)(void *)path; if ((EISA_ID_TO_NUM(acpi->HID) & 0xff00) == 0x300 && (acpi->HID & 0xffff) == PNP_EISA_ID_CONST) { - retval = 1; + retval = true; goto out; } /* @@ -162,7 +151,7 @@ has_keyboard(void) if (usb->DeviceClass == 3 && /* HID */ usb->DeviceSubClass == 1 && /* Boot devices */ usb->DeviceProtocol == 1) { /* Boot keyboards */ - retval = 1; + retval = true; goto out; } } @@ -231,7 +220,8 @@ sanity_check_currdev(void) { struct stat st; - return (stat("/boot/defaults/loader.conf", &st) == 0); + return (stat("/boot/defaults/loader.conf", &st) == 0 || + stat("/boot/kernel/kernel", &st) == 0); } #ifdef EFI_ZFS_BOOT @@ -408,58 +398,14 @@ interactive_interrupt(const char *msg) return (false); } -EFI_STATUS -main(int argc, CHAR16 *argv[]) +int +parse_args(int argc, CHAR16 *argv[], bool has_kbd) { - char var[128]; - EFI_GUID *guid; int i, j, howto; bool vargood; - UINTN k; - int has_kbd; - char *s; - EFI_DEVICE_PATH *imgpath; - CHAR16 *text; - EFI_STATUS status; - UINT16 boot_current; - size_t sz; - UINT16 boot_order[100]; -#if !defined(__arm__) - char buf[40]; -#endif + char var[128]; - archsw.arch_autoload = efi_autoload; - archsw.arch_getdev = efi_getdev; - archsw.arch_copyin = efi_copyin; - archsw.arch_copyout = efi_copyout; - archsw.arch_readin = efi_readin; -#ifdef EFI_ZFS_BOOT - /* Note this needs to be set before ZFS init. */ - archsw.arch_zfs_probe = efi_zfs_probe; -#endif - - /* Get our loaded image protocol interface structure. */ - BS->HandleProtocol(IH, &imgid, (VOID**)&img); - - /* Init the time source */ - efi_time_init(); - - has_kbd = has_keyboard(); - /* - * XXX Chicken-and-egg problem; we want to have console output - * early, but some console attributes may depend on reading from - * eg. the boot device, which we can't do yet. We can use - * printf() etc. once this is done. - */ - cons_probe(); - - /* - * Initialise the block cache. Set the upper limit. - */ - bcache_init(32768, 512); - - /* * Parse the args to set the console settings, etc * boot1.efi passes these in, if it can read /boot.config or /boot/config * or iPXE may be setup to pass these in. Or the optional argument in the @@ -547,7 +493,63 @@ main(int argc, CHAR16 *argv[]) } } } + return (howto); +} + +EFI_STATUS +main(int argc, CHAR16 *argv[]) +{ + EFI_GUID *guid; + int howto, i; + UINTN k; + bool has_kbd; + char *s; + EFI_DEVICE_PATH *imgpath; + CHAR16 *text; + EFI_STATUS status; + UINT16 boot_current; + size_t sz; + UINT16 boot_order[100]; + EFI_LOADED_IMAGE *img; + + archsw.arch_autoload = efi_autoload; + archsw.arch_getdev = efi_getdev; + archsw.arch_copyin = efi_copyin; + archsw.arch_copyout = efi_copyout; + archsw.arch_readin = efi_readin; +#ifdef EFI_ZFS_BOOT + /* Note this needs to be set before ZFS init. */ + archsw.arch_zfs_probe = efi_zfs_probe; +#endif + + /* Get our loaded image protocol interface structure. */ + BS->HandleProtocol(IH, &imgid, (VOID**)&img); + +#ifdef EFI_ZFS_BOOT + /* Tell ZFS probe code where we booted from */ + efizfs_set_preferred(img->DeviceHandle); +#endif + /* Init the time source */ + efi_time_init(); + + has_kbd = has_keyboard(); + + /* + * XXX Chicken-and-egg problem; we want to have console output + * early, but some console attributes may depend on reading from + * eg. the boot device, which we can't do yet. We can use + * printf() etc. once this is done. + */ + cons_probe(); + + /* + * Initialise the block cache. Set the upper limit. + */ + bcache_init(32768, 512); + + howto = parse_args(argc, argv, has_kbd); + bootenv_set(howto); /* @@ -651,18 +653,20 @@ main(int argc, CHAR16 *argv[]) efi_init_environment(); setenv("LINES", "24", 1); /* optional */ +#if !defined(__arm__) for (k = 0; k < ST->NumberOfTableEntries; k++) { guid = &ST->ConfigurationTable[k].VendorGuid; -#if !defined(__arm__) if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) { + char buf[40]; + snprintf(buf, sizeof(buf), "%p", ST->ConfigurationTable[k].VendorTable); setenv("hint.smbios.0.mem", buf, 1); smbios_detect(ST->ConfigurationTable[k].VendorTable); break; } -#endif } +#endif interact(); /* doesn't return */ From owner-svn-src-stable-11@freebsd.org Wed Feb 20 18:40:15 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29C2A14FBE8E; Wed, 20 Feb 2019 18:40:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E65668D4E9; Wed, 20 Feb 2019 18:40:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC20496C8; Wed, 20 Feb 2019 18:40:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KIeEqt098792; Wed, 20 Feb 2019 18:40:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KIeEZR098790; Wed, 20 Feb 2019 18:40:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902201840.x1KIeEZR098790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 18:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344372 - stable/11/stand/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/libsa X-SVN-Commit-Revision: 344372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E65668D4E9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 18:40:15 -0000 Author: kevans Date: Wed Feb 20 18:40:14 2019 New Revision: 344372 URL: https://svnweb.freebsd.org/changeset/base/344372 Log: MFC r335337: Remove stray debugging line. Modified: stable/11/stand/libsa/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/Makefile ============================================================================== --- stable/11/stand/libsa/Makefile Wed Feb 20 18:34:20 2019 (r344371) +++ stable/11/stand/libsa/Makefile Wed Feb 20 18:40:14 2019 (r344372) @@ -103,7 +103,6 @@ STAND_H_INC=ctype.h fcntl.h signal.h stdio.h stdlib.h OTHER_INC=stdarg.h errno.h stdint.h beforedepend: - echo beforedepend; \ mkdir -p ${FAKE_DIRS}; \ for i in ${SAFE_INCS}; do \ ln -sf ${SRCTOP}/include/$$i $$i; \ From owner-svn-src-stable-11@freebsd.org Wed Feb 20 18:44:12 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83A3014FC176; Wed, 20 Feb 2019 18:44:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B8408D9BF; Wed, 20 Feb 2019 18:44:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20131986A; Wed, 20 Feb 2019 18:44:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KIiCHV004317; Wed, 20 Feb 2019 18:44:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KIiA6K004307; Wed, 20 Feb 2019 18:44:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902201844.x1KIiA6K004307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 18:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344373 - in stable/11/stand: . geli i386/gptboot i386/gptzfsboot i386/isoboot i386/loader i386/zfsboot libsa libsa/geli X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: . geli i386/gptboot i386/gptzfsboot i386/isoboot i386/loader i386/zfsboot libsa libsa/geli X-SVN-Commit-Revision: 344373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2B8408D9BF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 18:44:12 -0000 Author: kevans Date: Wed Feb 20 18:44:09 2019 New Revision: 344373 URL: https://svnweb.freebsd.org/changeset/base/344373 Log: MFC r335321, r335336: stand: move libgeliboot into libsa r335321: stand: move libgeliboot into libsa. Reduce by 1 the number of crazy libraries we need in stand by moving geli into libsa (where architecturally it belonged all along). This just moves things around without any code changes. r335336: Remove now-empty geli directory Added: stable/11/stand/libsa/geli/ - copied from r335321, head/stand/libsa/geli/ Replaced: - copied unchanged from r344372, stable/11/stand/geli/geliboot.c - copied unchanged from r344372, stable/11/stand/geli/pwgets.c Directory Properties: stable/11/stand/libsa/geli/geliboot.c (props changed) stable/11/stand/libsa/geli/pwgets.c (props changed) Deleted: stable/11/stand/geli/ Modified: stable/11/stand/Makefile stable/11/stand/defs.mk stable/11/stand/i386/gptboot/Makefile stable/11/stand/i386/gptzfsboot/Makefile stable/11/stand/i386/isoboot/Makefile stable/11/stand/i386/loader/Makefile stable/11/stand/i386/zfsboot/Makefile stable/11/stand/libsa/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/Makefile ============================================================================== --- stable/11/stand/Makefile Wed Feb 20 18:40:14 2019 (r344372) +++ stable/11/stand/Makefile Wed Feb 20 18:44:09 2019 (r344373) @@ -21,8 +21,6 @@ S.${MK_ZFS}+= zfs S.yes+= defaults S.yes+= man -S.${MK_LOADER_GELI}+= geli - .include S.${MK_EFI}+= efi Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Wed Feb 20 18:40:14 2019 (r344372) +++ stable/11/stand/defs.mk Wed Feb 20 18:44:09 2019 (r344373) @@ -67,8 +67,7 @@ MK_LOADER_GELI=yes .endif .if ${MK_LOADER_GELI} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT -CFLAGS+= -I${BOOTSRC}/geli -LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a +CFLAGS+= -I${SASRC}/geli .endif # MK_LOADER_GELI .endif # HAVE_GELI Modified: stable/11/stand/i386/gptboot/Makefile ============================================================================== --- stable/11/stand/i386/gptboot/Makefile Wed Feb 20 18:40:14 2019 (r344372) +++ stable/11/stand/i386/gptboot/Makefile Wed Feb 20 18:44:09 2019 (r344373) @@ -64,7 +64,7 @@ gptboot.bin: gptboot.out ${OBJCOPY} -S -O binary gptboot.out ${.TARGET} gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} .include Modified: stable/11/stand/i386/gptzfsboot/Makefile ============================================================================== --- stable/11/stand/i386/gptzfsboot/Makefile Wed Feb 20 18:40:14 2019 (r344372) +++ stable/11/stand/i386/gptzfsboot/Makefile Wed Feb 20 18:44:09 2019 (r344373) @@ -75,7 +75,7 @@ gptzfsboot.bin: gptzfsboot.out gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o \ ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBZFSBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBSA32} zfsboot.o: ${ZFSSRC}/zfsimpl.c Modified: stable/11/stand/i386/isoboot/Makefile ============================================================================== --- stable/11/stand/i386/isoboot/Makefile Wed Feb 20 18:40:14 2019 (r344372) +++ stable/11/stand/i386/isoboot/Makefile Wed Feb 20 18:44:09 2019 (r344373) @@ -66,6 +66,6 @@ isoboot.bin: isoboot.out ${OBJCOPY} -S -O binary isoboot.out ${.TARGET} isoboot.out: ${BTXCRT} isoboot.o sio.o crc32.o drv.o cons.o ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} .include Modified: stable/11/stand/i386/loader/Makefile ============================================================================== --- stable/11/stand/i386/loader/Makefile Wed Feb 20 18:40:14 2019 (r344372) +++ stable/11/stand/i386/loader/Makefile Wed Feb 20 18:44:09 2019 (r344373) @@ -71,8 +71,8 @@ FILESMODE_${LOADER}= ${BINMODE} -b # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} -DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} -LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} +DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSA32} +LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSA32} .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -DLOADER_PREFER_AMD64 Modified: stable/11/stand/i386/zfsboot/Makefile ============================================================================== --- stable/11/stand/i386/zfsboot/Makefile Wed Feb 20 18:40:14 2019 (r344372) +++ stable/11/stand/i386/zfsboot/Makefile Wed Feb 20 18:44:09 2019 (r344373) @@ -82,7 +82,7 @@ zfsboot.bin: zfsboot.out ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET} zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBGELIBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBSA32} SRCS= zfsboot.c Modified: stable/11/stand/libsa/Makefile ============================================================================== --- stable/11/stand/libsa/Makefile Wed Feb 20 18:40:14 2019 (r344372) +++ stable/11/stand/libsa/Makefile Wed Feb 20 18:44:09 2019 (r344373) @@ -146,4 +146,9 @@ CFLAGS.bzipfs.c+= -I${SRCTOP}/contrib/bzip2 .PATH: ${SYSDIR}/libkern SRCS+= explicit_bzero.c +# Maybe GELI +.if ${MK_LOADER_GELI} == "yes" +.include "${SASRC}/geli/Makefile.inc" +.endif + .include Copied: stable/11/stand/libsa/geli/geliboot.c (from r344372, stable/11/stand/geli/geliboot.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/libsa/geli/geliboot.c Wed Feb 20 18:44:09 2019 (r344373, copy of r344372, stable/11/stand/geli/geliboot.c) @@ -0,0 +1,437 @@ +/*- + * Copyright (c) 2015 Allan Jude + * Copyright (c) 2005-2011 Pawel Jakub Dawidek + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "geliboot_internal.h" +#include "geliboot.h" + +SLIST_HEAD(geli_list, geli_entry) geli_head = SLIST_HEAD_INITIALIZER(geli_head); +struct geli_list *geli_headp; + +typedef u_char geli_ukey[G_ELI_USERKEYLEN]; + +static geli_ukey saved_keys[GELI_MAX_KEYS]; +static unsigned int nsaved_keys = 0; + +/* + * Copy keys from local storage to the keybuf struct. + * Destroy the local storage when finished. + */ +void +geli_fill_keybuf(struct keybuf *fkeybuf) +{ + unsigned int i; + + for (i = 0; i < nsaved_keys; i++) { + fkeybuf->kb_ents[i].ke_type = KEYBUF_TYPE_GELI; + memcpy(fkeybuf->kb_ents[i].ke_data, saved_keys[i], + G_ELI_USERKEYLEN); + } + fkeybuf->kb_nents = nsaved_keys; + explicit_bzero(saved_keys, sizeof(saved_keys)); +} + +/* + * Copy keys from a keybuf struct into local storage. + * Zero out the keybuf. + */ +void +geli_save_keybuf(struct keybuf *skeybuf) +{ + unsigned int i; + + for (i = 0; i < skeybuf->kb_nents && i < GELI_MAX_KEYS; i++) { + memcpy(saved_keys[i], skeybuf->kb_ents[i].ke_data, + G_ELI_USERKEYLEN); + explicit_bzero(skeybuf->kb_ents[i].ke_data, + G_ELI_USERKEYLEN); + skeybuf->kb_ents[i].ke_type = KEYBUF_TYPE_NONE; + } + nsaved_keys = skeybuf->kb_nents; + skeybuf->kb_nents = 0; +} + +static void +save_key(geli_ukey key) +{ + + /* + * If we run out of key space, the worst that will happen is + * it will ask the user for the password again. + */ + if (nsaved_keys < GELI_MAX_KEYS) { + memcpy(saved_keys[nsaved_keys], key, G_ELI_USERKEYLEN); + nsaved_keys++; + } +} + +static int +geli_same_device(struct geli_entry *ge, struct dsk *dskp) +{ + + if (ge->dsk->drive == dskp->drive && + dskp->part == 255 && ge->dsk->part == dskp->slice) { + /* + * Sometimes slice = slice, and sometimes part = slice + * If the incoming struct dsk has part=255, it means look at + * the slice instead of the part number + */ + return (0); + } + + /* Is this the same device? */ + if (ge->dsk->drive != dskp->drive || + ge->dsk->slice != dskp->slice || + ge->dsk->part != dskp->part) { + return (1); + } + + return (0); +} + +static int +geli_findkey(struct geli_entry *ge, struct dsk *dskp, u_char *mkey) +{ + u_int keynum; + int i; + + if (ge->keybuf_slot >= 0) { + if (g_eli_mkey_decrypt(&ge->md, saved_keys[ge->keybuf_slot], + mkey, &keynum) == 0) { + return (0); + } + } + + for (i = 0; i < nsaved_keys; i++) { + if (g_eli_mkey_decrypt(&ge->md, saved_keys[i], mkey, + &keynum) == 0) { + ge->keybuf_slot = i; + return (0); + } + } + + return (1); +} + +void +geli_init(void) +{ + + geli_count = 0; + SLIST_INIT(&geli_head); +} + +/* + * Read the last sector of the drive or partition pointed to by dsk and see + * if it is GELI encrypted + */ +int +geli_taste(int read_func(void *vdev, void *priv, off_t off, void *buf, + size_t bytes), struct dsk *dskp, daddr_t lastsector) +{ + struct g_eli_metadata md; + u_char buf[DEV_GELIBOOT_BSIZE]; + int error; + off_t alignsector; + + alignsector = rounddown2(lastsector * DEV_BSIZE, DEV_GELIBOOT_BSIZE); + if (alignsector + DEV_GELIBOOT_BSIZE > ((lastsector + 1) * DEV_BSIZE)) { + /* Don't read past the end of the disk */ + alignsector = (lastsector * DEV_BSIZE) + DEV_BSIZE + - DEV_GELIBOOT_BSIZE; + } + error = read_func(NULL, dskp, alignsector, &buf, DEV_GELIBOOT_BSIZE); + if (error != 0) { + return (error); + } + /* Extract the last 4k sector of the disk. */ + error = eli_metadata_decode(buf, &md); + if (error != 0) { + /* Try the last 512 byte sector instead. */ + error = eli_metadata_decode(buf + + (DEV_GELIBOOT_BSIZE - DEV_BSIZE), &md); + if (error != 0) { + return (error); + } + } + + if (!(md.md_flags & G_ELI_FLAG_GELIBOOT)) { + /* The GELIBOOT feature is not activated */ + return (1); + } + if ((md.md_flags & G_ELI_FLAG_ONETIME)) { + /* Swap device, skip it. */ + return (1); + } + if (md.md_iterations < 0) { + /* XXX TODO: Support loading key files. */ + /* Disk does not have a passphrase, skip it. */ + return (1); + } + geli_e = malloc(sizeof(struct geli_entry)); + if (geli_e == NULL) + return (2); + + geli_e->dsk = malloc(sizeof(struct dsk)); + if (geli_e->dsk == NULL) + return (2); + memcpy(geli_e->dsk, dskp, sizeof(struct dsk)); + geli_e->part_end = lastsector; + if (dskp->part == 255) { + geli_e->dsk->part = dskp->slice; + } + geli_e->keybuf_slot = -1; + + geli_e->md = md; + eli_metadata_softc(&geli_e->sc, &md, DEV_BSIZE, + (lastsector + DEV_BSIZE) * DEV_BSIZE); + + SLIST_INSERT_HEAD(&geli_head, geli_e, entries); + geli_count++; + + return (0); +} + +/* + * Attempt to decrypt the device + */ +static int +geli_attach(struct geli_entry *ge, struct dsk *dskp, const char *passphrase, + u_char *mkeyp) +{ + u_char key[G_ELI_USERKEYLEN], mkey[G_ELI_DATAIVKEYLEN], *mkp; + u_int keynum; + struct hmac_ctx ctx; + int error; + + if (mkeyp != NULL) { + memcpy(&mkey, mkeyp, G_ELI_DATAIVKEYLEN); + explicit_bzero(mkeyp, G_ELI_DATAIVKEYLEN); + } + + if (mkeyp != NULL || geli_findkey(ge, dskp, mkey) == 0) { + goto found_key; + } + + g_eli_crypto_hmac_init(&ctx, NULL, 0); + /* + * Prepare Derived-Key from the user passphrase. + */ + if (geli_e->md.md_iterations < 0) { + /* XXX TODO: Support loading key files. */ + return (1); + } else if (geli_e->md.md_iterations == 0) { + g_eli_crypto_hmac_update(&ctx, geli_e->md.md_salt, + sizeof(geli_e->md.md_salt)); + g_eli_crypto_hmac_update(&ctx, (const uint8_t *)passphrase, + strlen(passphrase)); + } else if (geli_e->md.md_iterations > 0) { + printf("Calculating GELI Decryption Key disk%dp%d @ %d" + " iterations...\n", dskp->unit, + (dskp->slice > 0 ? dskp->slice : dskp->part), + geli_e->md.md_iterations); + u_char dkey[G_ELI_USERKEYLEN]; + + pkcs5v2_genkey(dkey, sizeof(dkey), geli_e->md.md_salt, + sizeof(geli_e->md.md_salt), passphrase, + geli_e->md.md_iterations); + g_eli_crypto_hmac_update(&ctx, dkey, sizeof(dkey)); + explicit_bzero(dkey, sizeof(dkey)); + } + + g_eli_crypto_hmac_final(&ctx, key, 0); + + error = g_eli_mkey_decrypt(&geli_e->md, key, mkey, &keynum); + if (error == -1) { + explicit_bzero(mkey, sizeof(mkey)); + explicit_bzero(key, sizeof(key)); + printf("Bad GELI key: bad password?\n"); + return (error); + } else if (error != 0) { + explicit_bzero(mkey, sizeof(mkey)); + explicit_bzero(key, sizeof(key)); + printf("Failed to decrypt GELI master key: %d\n", error); + return (error); + } else { + /* Add key to keychain */ + save_key(key); + explicit_bzero(&key, sizeof(key)); + } + +found_key: + /* Store the keys */ + bcopy(mkey, geli_e->sc.sc_mkey, sizeof(geli_e->sc.sc_mkey)); + bcopy(mkey, geli_e->sc.sc_ivkey, sizeof(geli_e->sc.sc_ivkey)); + mkp = mkey + sizeof(geli_e->sc.sc_ivkey); + if ((geli_e->sc.sc_flags & G_ELI_FLAG_AUTH) == 0) { + bcopy(mkp, geli_e->sc.sc_ekey, G_ELI_DATAKEYLEN); + } else { + /* + * The encryption key is: ekey = HMAC_SHA512(Data-Key, 0x10) + */ + g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, (const uint8_t *)"\x10", 1, + geli_e->sc.sc_ekey, 0); + } + explicit_bzero(mkey, sizeof(mkey)); + + /* Initialize the per-sector IV. */ + switch (geli_e->sc.sc_ealgo) { + case CRYPTO_AES_XTS: + break; + default: + SHA256_Init(&geli_e->sc.sc_ivctx); + SHA256_Update(&geli_e->sc.sc_ivctx, geli_e->sc.sc_ivkey, + sizeof(geli_e->sc.sc_ivkey)); + break; + } + + return (0); +} + +int +is_geli(struct dsk *dskp) +{ + SLIST_FOREACH_SAFE(geli_e, &geli_head, entries, geli_e_tmp) { + if (geli_same_device(geli_e, dskp) == 0) { + return (0); + } + } + + return (1); +} + +int +geli_read(struct dsk *dskp, off_t offset, u_char *buf, size_t bytes) +{ + u_char iv[G_ELI_IVKEYLEN]; + u_char *pbuf; + int error; + off_t dstoff; + uint64_t keyno; + size_t n, nsec, secsize; + struct g_eli_key gkey; + + pbuf = buf; + SLIST_FOREACH_SAFE(geli_e, &geli_head, entries, geli_e_tmp) { + if (geli_same_device(geli_e, dskp) != 0) { + continue; + } + + secsize = geli_e->sc.sc_sectorsize; + nsec = bytes / secsize; + if (nsec == 0) { + /* + * A read of less than the GELI sector size has been + * requested. The caller provided destination buffer may + * not be big enough to boost the read to a full sector, + * so just attempt to decrypt the truncated sector. + */ + secsize = bytes; + nsec = 1; + } + + for (n = 0, dstoff = offset; n < nsec; n++, dstoff += secsize) { + + g_eli_crypto_ivgen(&geli_e->sc, dstoff, iv, + G_ELI_IVKEYLEN); + + /* Get the key that corresponds to this offset. */ + keyno = (dstoff >> G_ELI_KEY_SHIFT) / secsize; + g_eli_key_fill(&geli_e->sc, &gkey, keyno); + + error = geliboot_crypt(geli_e->sc.sc_ealgo, 0, pbuf, + secsize, gkey.gek_key, + geli_e->sc.sc_ekeylen, iv); + + if (error != 0) { + explicit_bzero(&gkey, sizeof(gkey)); + printf("Failed to decrypt in geli_read()!"); + return (error); + } + pbuf += secsize; + } + explicit_bzero(&gkey, sizeof(gkey)); + return (0); + } + + printf("GELI provider not found\n"); + return (1); +} + +int +geli_havekey(struct dsk *dskp) +{ + u_char mkey[G_ELI_DATAIVKEYLEN]; + + SLIST_FOREACH_SAFE(geli_e, &geli_head, entries, geli_e_tmp) { + if (geli_same_device(geli_e, dskp) != 0) { + continue; + } + + if (geli_findkey(geli_e, dskp, mkey) == 0) { + if (geli_attach(geli_e, dskp, NULL, mkey) == 0) { + return (0); + } + } + } + explicit_bzero(mkey, sizeof(mkey)); + + return (1); +} + +int +geli_passphrase(char *pw, int disk, int parttype, int part, struct dsk *dskp) +{ + int i; + + SLIST_FOREACH_SAFE(geli_e, &geli_head, entries, geli_e_tmp) { + if (geli_same_device(geli_e, dskp) != 0) { + continue; + } + + /* TODO: Implement GELI keyfile(s) support */ + for (i = 0; i < 3; i++) { + /* Try cached passphrase */ + if (i == 0 && pw[0] != '\0') { + if (geli_attach(geli_e, dskp, pw, NULL) == 0) { + return (0); + } + } + printf("GELI Passphrase for disk%d%c%d: ", disk, + parttype, part); + pwgets(pw, GELI_PW_MAXLEN, + (geli_e->md.md_flags & G_ELI_FLAG_GELIDISPLAYPASS) == 0); + printf("\n"); + if (geli_attach(geli_e, dskp, pw, NULL) == 0) { + return (0); + } + } + } + + return (1); +} Copied: stable/11/stand/libsa/geli/pwgets.c (from r344372, stable/11/stand/geli/pwgets.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/libsa/geli/pwgets.c Wed Feb 20 18:44:09 2019 (r344373, copy of r344372, stable/11/stand/geli/pwgets.c) @@ -0,0 +1,79 @@ +/* $NetBSD: gets.c,v 1.6 1995/10/11 21:16:57 pk Exp $ */ + +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)gets.c 8.1 (Berkeley) 6/11/93 + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "stand.h" + +/* gets() with constrained input length, for passwords */ + +void +pwgets(char *buf, int n, int hide) +{ + int c; + char *lp; + + for (lp = buf;;) + switch (c = getchar() & 0177) { + case '\n': + case '\r': + *lp = '\0'; + putchar('\n'); + return; + case '\b': + case '\177': + if (lp > buf) { + lp--; + if (hide == 0) { + putchar('\b'); + putchar(' '); + putchar('\b'); + } + } + break; + case 'u'&037: + case 'w'&037: + lp = buf; + putchar('\n'); + break; + default: + if ((n < 1) || ((lp - buf) < n - 1)) { + *lp++ = c; + if (hide == 0) { + putchar('*'); + } + } + } + /*NOTREACHED*/ +} From owner-svn-src-stable-11@freebsd.org Wed Feb 20 18:46:32 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB15F14FC59A; Wed, 20 Feb 2019 18:46:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B27A08DDA2; Wed, 20 Feb 2019 18:46:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A21DB986C; Wed, 20 Feb 2019 18:46:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KIkVsu004486; Wed, 20 Feb 2019 18:46:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KIkV65004485; Wed, 20 Feb 2019 18:46:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902201846.x1KIkV65004485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 18:46:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344374 - stable/11/stand/efi/boot1 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/efi/boot1 X-SVN-Commit-Revision: 344374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B27A08DDA2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 18:46:32 -0000 Author: kevans Date: Wed Feb 20 18:46:31 2019 New Revision: 344374 URL: https://svnweb.freebsd.org/changeset/base/344374 Log: MFC r335773: Revert preference to be an int. While in base we use it as a boolean (of the wrong spelling), there's at least one out of tree user that needs it to be int since priorirty is a small int, not a 0/1. In deference to the time it's wasted me and my team, push this up into FreeBSD for whatever short life boot1 may have in the tree. Modified: stable/11/stand/efi/boot1/boot_module.h Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/boot1/boot_module.h ============================================================================== --- stable/11/stand/efi/boot1/boot_module.h Wed Feb 20 18:44:09 2019 (r344373) +++ stable/11/stand/efi/boot1/boot_module.h Wed Feb 20 18:46:31 2019 (r344374) @@ -51,7 +51,7 @@ typedef struct dev_info EFI_HANDLE *devhandle; void *devdata; uint64_t partoff; - BOOLEAN preferred; + int preferred; struct dev_info *next; } dev_info_t; From owner-svn-src-stable-11@freebsd.org Wed Feb 20 18:48:38 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2914D14FC80B; Wed, 20 Feb 2019 18:48:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D8DB8DFF4; Wed, 20 Feb 2019 18:48:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87521986F; Wed, 20 Feb 2019 18:48:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KImbEa004635; Wed, 20 Feb 2019 18:48:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KImbTe004633; Wed, 20 Feb 2019 18:48:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902201848.x1KImbTe004633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 18:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344375 - in stable/11/stand/uboot: common fdt X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand/uboot: common fdt X-SVN-Commit-Revision: 344375 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9D8DB8DFF4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 18:48:38 -0000 Author: kevans Date: Wed Feb 20 18:48:36 2019 New Revision: 344375 URL: https://svnweb.freebsd.org/changeset/base/344375 Log: MFC r335869, r335933: stand: uboot behavioral fixes r335869: stand: uboot: Do not panic if we can't find a boot device It is really anoying to panic when there is no boot device as you cannot see the availables ones. r335933: loader: fdt: Try to load every possible DTB from u-boot U-Boot setup a few variables : - fdt_addr which is the board static dtb (most of the time loaded before u-boot or coming from some hardware like a ROM) - fdt_addr_r which is a location in RAM that holds the DTB loaded by u-boot or before u-boot In the case of u-boot + rpi firmware the DTB is loaded in RAM but the location still end up in the fdt_addr variable and the fdt_addr_r variable exist. Change the behavior so we test that a DTB exists for every possible variable : - fdt_addr_r is checked first as if u-boot needed to modify it the correct DTB will live there. - fdt_addr is checked second as if we run on a hardware with DTB in ROM it means that we what/need to run that - fdtaddr looks like a FreeBSD-ism but since I'm not sure leave it. Modified: stable/11/stand/uboot/common/main.c stable/11/stand/uboot/fdt/uboot_fdt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/uboot/common/main.c ============================================================================== --- stable/11/stand/uboot/common/main.c Wed Feb 20 18:46:31 2019 (r344374) +++ stable/11/stand/uboot/common/main.c Wed Feb 20 18:48:36 2019 (r344375) @@ -444,8 +444,10 @@ main(int argc, char **argv) /* * Enumerate U-Boot devices */ - if ((devs_no = ub_dev_enum()) == 0) - panic("no U-Boot devices found"); + if ((devs_no = ub_dev_enum()) == 0) { + printf("no U-Boot devices found"); + goto do_interact; + } printf("Number of U-Boot devices: %d\n", devs_no); get_load_device(&load_type, &load_unit, &load_slice, &load_partition); @@ -492,6 +494,7 @@ main(int argc, char **argv) env_setenv("loaddev", EV_VOLATILE, ldev, env_noset, env_nounset); printf("Booting from %s\n", ldev); +do_interact: setenv("LINES", "24", 1); /* optional */ setenv("prompt", "loader>", 1); Modified: stable/11/stand/uboot/fdt/uboot_fdt.c ============================================================================== --- stable/11/stand/uboot/fdt/uboot_fdt.c Wed Feb 20 18:46:31 2019 (r344374) +++ stable/11/stand/uboot/fdt/uboot_fdt.c Wed Feb 20 18:48:36 2019 (r344375) @@ -39,6 +39,30 @@ __FBSDID("$FreeBSD$"); #define STR(number) #number #define STRINGIFY(number) STR(number) +static int +fdt_platform_load_from_ubenv(const char *var) +{ + struct fdt_header *hdr; + const char *s; + char *p; + + s = ub_env_get(var); + if (s == NULL || *s == '\0') + return (1); + + hdr = (struct fdt_header *)strtoul(s, &p, 16); + if (*p != '\0') + return (1); + + if (fdt_load_dtb_addr(hdr) == 0) { + printf("Using DTB provided by U-Boot at " + "address %p.\n", hdr); + return (0); + } + + return (1); +} + int fdt_platform_load_dtb(void) { @@ -53,22 +77,12 @@ fdt_platform_load_dtb(void) * variable for fdt data loaded into ram is fdt_addr_r, so try that * first. Board vendors also use both fdtaddr and fdt_addr names. */ - s = ub_env_get("fdt_addr_r"); - if (s == NULL) - s = ub_env_get("fdtaddr"); - if (s == NULL) - s = ub_env_get("fdt_addr"); - if (s != NULL && *s != '\0') { - hdr = (struct fdt_header *)strtoul(s, &p, 16); - if (*p == '\0') { - if (fdt_load_dtb_addr(hdr) == 0) { - printf("Using DTB provided by U-Boot at " - "address %p.\n", hdr); - rv = 0; - goto exit; - } - } - } + if ((rv = fdt_platform_load_from_ubenv("fdt_addr_r")) == 0) + goto exit; + if ((rv = fdt_platform_load_from_ubenv("fdt_addr")) == 0) + goto exit; + if ((rv = fdt_platform_load_from_ubenv("fdtaddr")) == 0) + goto exit; rv = 1; From owner-svn-src-stable-11@freebsd.org Wed Feb 20 19:06:00 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5942614FCF2A; Wed, 20 Feb 2019 19:06:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F049F8EC0D; Wed, 20 Feb 2019 19:05:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCD4C9BBF; Wed, 20 Feb 2019 19:05:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KJ5xdn015676; Wed, 20 Feb 2019 19:05:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KJ5wqZ015669; Wed, 20 Feb 2019 19:05:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902201905.x1KJ5wqZ015669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 19:05:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344376 - in stable/11: stand/libsa sys/ufs/ffs sys/ufs/ufs X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: stand/libsa sys/ufs/ffs sys/ufs/ufs X-SVN-Commit-Revision: 344376 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F049F8EC0D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 19:06:00 -0000 Author: kevans Date: Wed Feb 20 19:05:58 2019 New Revision: 344376 URL: https://svnweb.freebsd.org/changeset/base/344376 Log: MFC r304850, r305480, r324550-r324551, r324655, r324684: correct mis-merge Some of these commits were improperly MFC'd in the sys/boot => stand mega-MFC, others were simply missed. Correct that mistake now by manually merging the few that were missed and record-only merge on the others. r304850: Unused variables and cstyle fix for loader dosfs r305480: Renumber the advertising clause. r324550: Add $FreeBSD$ to ancient sources that it's missing from. r324551: Move lib/libstand to sys/boot/libsa Move the sources to sys/boot. Make adjustments related to the move. Kill LIBSTAND_SRC since it's no longer needed. r324655: Remove the libstand directory which is now empty. r324684: Remove lib/libstand again, accidentally readded in r324683 Modified: stable/11/stand/libsa/bootparam.h stable/11/stand/libsa/dosfs.c stable/11/stand/libsa/tftp.h stable/11/stand/libsa/ufs.c stable/11/sys/ufs/ffs/fs.h stable/11/sys/ufs/ufs/dir.h Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/bootparam.h ============================================================================== --- stable/11/stand/libsa/bootparam.h Wed Feb 20 18:48:36 2019 (r344375) +++ stable/11/stand/libsa/bootparam.h Wed Feb 20 19:05:58 2019 (r344376) @@ -1,4 +1,5 @@ /* $NetBSD: bootparam.h,v 1.3 1998/01/05 19:19:41 perry Exp $ */ +/* $FreeBSD$ */ int bp_whoami(int sock); int bp_getfile(int sock, char *key, struct in_addr *addrp, char *path); Modified: stable/11/stand/libsa/dosfs.c ============================================================================== --- stable/11/stand/libsa/dosfs.c Wed Feb 20 18:48:36 2019 (r344375) +++ stable/11/stand/libsa/dosfs.c Wed Feb 20 19:05:58 2019 (r344376) @@ -426,7 +426,7 @@ dos_readdir(struct open_file *fd, struct dirent *d) u_char fn[261]; DOS_DIR dd; size_t res; - u_int chk, i, x, xdn; + u_int chk, x, xdn; int err; x = chk = 0; @@ -585,7 +585,7 @@ lookup(DOS_FS *fs, u_int clus, const char *name, DOS_D u_char lfn[261]; u_char sfn[13]; u_int nsec, lsec, xdn, chk, sec, ent, x; - int err, ok, i; + int err, ok; if (!clus) for (ent = 0; ent < 2; ent++) Modified: stable/11/stand/libsa/tftp.h ============================================================================== --- stable/11/stand/libsa/tftp.h Wed Feb 20 18:48:36 2019 (r344375) +++ stable/11/stand/libsa/tftp.h Wed Feb 20 19:05:58 2019 (r344376) @@ -30,6 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * + * $FreeBSD$ */ Modified: stable/11/stand/libsa/ufs.c ============================================================================== --- stable/11/stand/libsa/ufs.c Wed Feb 20 18:48:36 2019 (r344375) +++ stable/11/stand/libsa/ufs.c Wed Feb 20 19:05:58 2019 (r344376) @@ -24,7 +24,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * Modified: stable/11/sys/ufs/ffs/fs.h ============================================================================== --- stable/11/sys/ufs/ffs/fs.h Wed Feb 20 18:48:36 2019 (r344375) +++ stable/11/sys/ufs/ffs/fs.h Wed Feb 20 19:05:58 2019 (r344376) @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * Modified: stable/11/sys/ufs/ufs/dir.h ============================================================================== --- stable/11/sys/ufs/ufs/dir.h Wed Feb 20 18:48:36 2019 (r344375) +++ stable/11/sys/ufs/ufs/dir.h Wed Feb 20 19:05:58 2019 (r344376) @@ -15,7 +15,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * From owner-svn-src-stable-11@freebsd.org Wed Feb 20 19:13:15 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A260514FD1E7; Wed, 20 Feb 2019 19:13:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3ED208F189; Wed, 20 Feb 2019 19:13:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29F5D9D78; Wed, 20 Feb 2019 19:13:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KJDFUx022162; Wed, 20 Feb 2019 19:13:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KJD9LO022125; Wed, 20 Feb 2019 19:13:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902201913.x1KJD9LO022125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 19:13:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344377 - in stable/11/stand: . common efi/boot1 efi/loader i386/gptzfsboot i386/libi386 i386/loader i386/zfsboot i386/zfsloader libsa libsa/zfs ofw/libofw pc98/libpc98 sparc64/loader s... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: . common efi/boot1 efi/loader i386/gptzfsboot i386/libi386 i386/loader i386/zfsboot i386/zfsloader libsa libsa/zfs ofw/libofw pc98/libpc98 sparc64/loader sparc64/zfsloader userboot... X-SVN-Commit-Revision: 344377 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3ED208F189 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 19:13:15 -0000 Author: kevans Date: Wed Feb 20 19:13:09 2019 New Revision: 344377 URL: https://svnweb.freebsd.org/changeset/base/344377 Log: MFC r336084-r336085, r336118: Move zfs impl into libsa r336084: Move ZFS files into libsa Move the libzfs stuff into libsa. There's no need for it to be a separate library. The separate library adds to the issues of build ordering that we see from time to time. Move the filesystem support into libsa, like all the other filesystem support rather than making zfs the odd-duck out. Discussed with: allanjude@ r336085: Stop using ../zfs/libzfs.h but instead use libzfs.h. While ../zfs/libzfs.h mostly works, there are a few situations where it does not. Eliminate the problem by using plain libzfs.h, like we do for ufs support. This fixes the weird cases, and is easier to understand. It also follows the general style convetion of avoiding ../ in #includes. r336118: Remove dirs that git svn should have removed but didn't. Added: stable/11/stand/libsa/zfs/ - copied from r336085, head/stand/libsa/zfs/ Deleted: stable/11/stand/zfs/ stable/11/stand/zfs32/ Modified: stable/11/stand/Makefile stable/11/stand/common/zfs_cmd.c stable/11/stand/defs.mk stable/11/stand/efi/boot1/Makefile stable/11/stand/efi/loader/Makefile stable/11/stand/i386/gptzfsboot/Makefile stable/11/stand/i386/libi386/Makefile stable/11/stand/i386/libi386/devicename.c stable/11/stand/i386/loader/Makefile stable/11/stand/i386/loader/conf.c stable/11/stand/i386/loader/main.c stable/11/stand/i386/zfsboot/Makefile stable/11/stand/i386/zfsloader/Makefile stable/11/stand/libsa/Makefile stable/11/stand/loader.mk stable/11/stand/ofw/libofw/Makefile stable/11/stand/ofw/libofw/devicename.c stable/11/stand/pc98/libpc98/Makefile stable/11/stand/sparc64/loader/Makefile stable/11/stand/sparc64/loader/main.c stable/11/stand/sparc64/zfsloader/Makefile stable/11/stand/userboot/userboot/Makefile stable/11/stand/userboot/userboot/conf.c stable/11/stand/userboot/userboot/devicename.c stable/11/stand/userboot/userboot/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/Makefile ============================================================================== --- stable/11/stand/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -6,7 +6,7 @@ # others we don't. LIB32LIST is a list of libraries, which if # included, need to be built 32-bit as well. .if ${MACHINE_ARCH} == "amd64" -LIB32LIST=libsa ficl liblua zfs +LIB32LIST=libsa ficl liblua .endif S.yes+= libsa @@ -17,7 +17,6 @@ S.${MK_LOADER_LUA}+= liblua S.${MK_LOADER_LUA}+= lua S.${MK_FDT}+= fdt S.${MK_LOADER_OFW}+= ofw -S.${MK_ZFS}+= zfs S.yes+= defaults S.yes+= man Modified: stable/11/stand/common/zfs_cmd.c ============================================================================== --- stable/11/stand/common/zfs_cmd.c Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/common/zfs_cmd.c Wed Feb 20 19:13:09 2019 (r344377) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #ifdef LOADER_ZFS_SUPPORT -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/defs.mk Wed Feb 20 19:13:09 2019 (r344377) @@ -28,7 +28,7 @@ LUASRC= ${SRCTOP}/contrib/lua/src SASRC= ${BOOTSRC}/libsa SYSDIR= ${SRCTOP}/sys UBOOTSRC= ${BOOTSRC}/uboot -ZFSSRC= ${BOOTSRC}/zfs +ZFSSRC= ${SASRC}/zfs BOOTOBJ= ${OBJTOP}/stand Modified: stable/11/stand/efi/boot1/Makefile ============================================================================== --- stable/11/stand/efi/boot1/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/efi/boot1/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -30,7 +30,6 @@ CFLAGS.zfs_module.c+= -I${ZFSSRC} CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein CFLAGS+= -DEFI_ZFS_BOOT -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 @@ -72,8 +71,8 @@ LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a # __aeabi_* (arm) or __divdi3 (i386). # as well as required string and memory functions for all platforms. # -DPADD+= ${LIBEFI} ${LIBZFSBOOT} ${LIBSA} -LDADD+= ${LIBEFI} ${LIBZFSBOOT} ${LIBSA} +DPADD+= ${LIBEFI} ${LIBSA} +LDADD+= ${LIBEFI} ${LIBSA} DPADD+= ${LDSCRIPT} Modified: stable/11/stand/efi/loader/Makefile ============================================================================== --- stable/11/stand/efi/loader/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/efi/loader/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -25,7 +25,6 @@ SRCS= autoload.c \ vers.c .if ${MK_ZFS} != "no" -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a CFLAGS+= -I${ZFSSRC} CFLAGS+= -DEFI_ZFS_BOOT HAVE_ZFS= yes @@ -120,8 +119,7 @@ loader.efi: ${PROG} LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a -DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \ - ${LDSCRIPT} -LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} ${LDSCRIPT} +LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} .include Modified: stable/11/stand/i386/gptzfsboot/Makefile ============================================================================== --- stable/11/stand/i386/gptzfsboot/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/i386/gptzfsboot/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -43,12 +43,6 @@ CFLAGS.clang+= -Wno-tentative-definition-incomplete-ty NO_WCAST_ALIGN= -.if ${MACHINE} == "amd64" -LIBZFSBOOT=${BOOTOBJ}/zfs32/libzfsboot.a -.else -LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a -.endif - CFLAGS.gcc+= --param max-inline-insns-single=100 LD_FLAGS+=${LD_FLAGS_BIN} @@ -75,7 +69,7 @@ gptzfsboot.bin: gptzfsboot.out gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o \ ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} zfsboot.o: ${ZFSSRC}/zfsimpl.c Modified: stable/11/stand/i386/libi386/Makefile ============================================================================== --- stable/11/stand/i386/libi386/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/i386/libi386/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -14,6 +14,7 @@ SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp smbios.c time.c vidconsole.c amd64_tramp.S spinconsole.c .PATH: ${ZFSSRC} SRCS+= devicename_stubs.c +CFLAGS+= -I${ZFSSRC} BOOT_COMCONSOLE_PORT?= 0x3f8 CFLAGS+= -DCOMPORT=${BOOT_COMCONSOLE_PORT} Modified: stable/11/stand/i386/libi386/devicename.c ============================================================================== --- stable/11/stand/i386/libi386/devicename.c Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/i386/libi386/devicename.c Wed Feb 20 19:13:09 2019 (r344377) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "disk.h" #include "libi386.h" -#include "../zfs/libzfs.h" +#include "libzfs.h" static int i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path); Modified: stable/11/stand/i386/loader/Makefile ============================================================================== --- stable/11/stand/i386/loader/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/i386/loader/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -71,8 +71,8 @@ FILESMODE_${LOADER}= ${BINMODE} -b # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} -DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSA32} -LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSA32} +DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} +LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -DLOADER_PREFER_AMD64 Modified: stable/11/stand/i386/loader/conf.c ============================================================================== --- stable/11/stand/i386/loader/conf.c Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/i386/loader/conf.c Wed Feb 20 19:13:09 2019 (r344377) @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include "libi386/libi386.h" #if defined(LOADER_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif /* Modified: stable/11/stand/i386/loader/main.c ============================================================================== --- stable/11/stand/i386/loader/main.c Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/i386/loader/main.c Wed Feb 20 19:13:09 2019 (r344377) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "btxv86.h" #ifdef LOADER_ZFS_SUPPORT -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif CTASSERT(sizeof(struct bootargs) == BOOTARGS_SIZE); Modified: stable/11/stand/i386/zfsboot/Makefile ============================================================================== --- stable/11/stand/i386/zfsboot/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/i386/zfsboot/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -37,11 +37,6 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings CFLAGS.gcc+= --param max-inline-insns-single=100 -.if ${MACHINE} == "amd64" -LIBZFSBOOT=${BOOTOBJ}/zfs32/libzfsboot.a -.else -LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a -.endif LD_FLAGS+=${LD_FLAGS_BIN} @@ -82,7 +77,7 @@ zfsboot.bin: zfsboot.out ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET} zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} SRCS= zfsboot.c Modified: stable/11/stand/i386/zfsloader/Makefile ============================================================================== --- stable/11/stand/i386/zfsloader/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/i386/zfsloader/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -3,5 +3,6 @@ LOADER= zfsloader NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 HAVE_ZFS= yes +CFLAGS+= -DBOOTPROG=\"zfsloader\" .include "${.CURDIR}/../loader/Makefile" Modified: stable/11/stand/libsa/Makefile ============================================================================== --- stable/11/stand/libsa/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/libsa/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -151,4 +151,9 @@ SRCS+= explicit_bzero.c .include "${SASRC}/geli/Makefile.inc" .endif +# Maybe ZFS +.if ${MK_ZFS} == "yes" +.include "${SASRC}/zfs/Makefile.inc" +.endif + .include Modified: stable/11/stand/loader.mk ============================================================================== --- stable/11/stand/loader.mk Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/loader.mk Wed Feb 20 19:13:09 2019 (r344377) @@ -131,13 +131,6 @@ CFLAGS+= -DLOADER_ZFS_SUPPORT CFLAGS+= -I${ZFSSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs SRCS+= zfs_cmd.c -.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1 -# Have to override to use 32-bit version of zfs library... -# kinda lame to select that there XXX -LIBZFSBOOT= ${BOOTOBJ}/zfs32/libzfsboot.a -.else -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a -.endif .endif LIBFICL= ${BOOTOBJ}/ficl/libficl.a Modified: stable/11/stand/ofw/libofw/Makefile ============================================================================== --- stable/11/stand/ofw/libofw/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/ofw/libofw/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -9,6 +9,7 @@ SRCS= devicename.c ofw_console.c ofw_copy.c ofw_disk.c ofw_time.c openfirm.c .PATH: ${ZFSSRC} SRCS+= devicename_stubs.c +CFLAGS+= -I${ZFSSRC} # Pick up the bootstrap header for some interface items CFLAGS+= -I${LDRSRC} Modified: stable/11/stand/ofw/libofw/devicename.c ============================================================================== --- stable/11/stand/ofw/libofw/devicename.c Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/ofw/libofw/devicename.c Wed Feb 20 19:13:09 2019 (r344377) @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "libofw.h" -#include "../zfs/libzfs.h" +#include "libzfs.h" static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **); Modified: stable/11/stand/pc98/libpc98/Makefile ============================================================================== --- stable/11/stand/pc98/libpc98/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/pc98/libpc98/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -12,8 +12,9 @@ SRCS= bioscd.c biosdisk.c biosmem.c biospnp.c \ comconsole.c devicename.c elf32_freebsd.c \ i386_copy.c i386_module.c nullconsole.c pc98_sys.c pxe.c pxetramp.s \ time.c vidconsole.c -.PATH: ${BOOTSRC}/zfs +.PATH: ${ZFSSRC} SRCS+= devicename_stubs.c +CFLAGS+= -I${ZFSSRC} BOOT_COMCONSOLE_PORT?= 0x238 CFLAGS+= -DCOMPORT=${BOOT_COMCONSOLE_PORT} Modified: stable/11/stand/sparc64/loader/Makefile ============================================================================== --- stable/11/stand/sparc64/loader/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/sparc64/loader/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -44,7 +44,7 @@ LDFLAGS+= -static LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a CFLAGS+= -I${BOOTSRC}/ofw/libofw/ -DPADD= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} -LDADD= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} .include Modified: stable/11/stand/sparc64/loader/main.c ============================================================================== --- stable/11/stand/sparc64/loader/main.c Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/sparc64/loader/main.c Wed Feb 20 19:13:09 2019 (r344377) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef LOADER_ZFS_SUPPORT #include -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif #include Modified: stable/11/stand/sparc64/zfsloader/Makefile ============================================================================== --- stable/11/stand/sparc64/zfsloader/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/sparc64/zfsloader/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -3,5 +3,6 @@ PROG= zfsloader NEWVERSWHAT= "ZFS enabled bootstrap loader" sparc64 HAVE_ZFS= yes +CFLAGS+= -DBOOTPROG=\"zfsloader\" .include "${.CURDIR}/../loader/Makefile" Modified: stable/11/stand/userboot/userboot/Makefile ============================================================================== --- stable/11/stand/userboot/userboot/Makefile Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/userboot/userboot/Makefile Wed Feb 20 19:13:09 2019 (r344377) @@ -41,14 +41,13 @@ NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH} .if ${MK_ZFS} != "no" CFLAGS+= -DUSERBOOT_ZFS_SUPPORT -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a HAVE_ZFS=yes .endif # Always add MI sources .include "${BOOTSRC}/loader.mk" CFLAGS+= -I. -DPADD+= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBSA} -LDADD+= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBSA} +DPADD+= ${LDR_INTERP} ${LIBSA} +LDADD+= ${LDR_INTERP} ${LIBSA} .include Modified: stable/11/stand/userboot/userboot/conf.c ============================================================================== --- stable/11/stand/userboot/userboot/conf.c Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/userboot/userboot/conf.c Wed Feb 20 19:13:09 2019 (r344377) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include "libuserboot.h" #if defined(USERBOOT_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif /* Modified: stable/11/stand/userboot/userboot/devicename.c ============================================================================== --- stable/11/stand/userboot/userboot/devicename.c Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/userboot/userboot/devicename.c Wed Feb 20 19:13:09 2019 (r344377) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include "libuserboot.h" #if defined(USERBOOT_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif static int userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **path); Modified: stable/11/stand/userboot/userboot/main.c ============================================================================== --- stable/11/stand/userboot/userboot/main.c Wed Feb 20 19:05:58 2019 (r344376) +++ stable/11/stand/userboot/userboot/main.c Wed Feb 20 19:13:09 2019 (r344377) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include "libuserboot.h" #if defined(USERBOOT_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" static void userboot_zfs_probe(void); static int userboot_zfs_found; From owner-svn-src-stable-11@freebsd.org Wed Feb 20 19:19:28 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 349F114FD41F; Wed, 20 Feb 2019 19:19:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D78A28F4B3; Wed, 20 Feb 2019 19:19:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9E739D7A; Wed, 20 Feb 2019 19:19:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KJJRRQ023765; Wed, 20 Feb 2019 19:19:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KJJOij023189; Wed, 20 Feb 2019 19:19:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902201919.x1KJJOij023189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 19:19:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344378 - in stable/11: stand/common stand/efi/loader stand/i386/libi386 stand/libsa stand/userboot/userboot sys/arm/arm sys/conf sys/kern sys/sys sys/x86/xen X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: stand/common stand/efi/loader stand/i386/libi386 stand/libsa stand/userboot/userboot sys/arm/arm sys/conf sys/kern sys/sys sys/x86/xen X-SVN-Commit-Revision: 344378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D78A28F4B3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 19:19:28 -0000 Author: kevans Date: Wed Feb 20 19:19:24 2019 New Revision: 344378 URL: https://svnweb.freebsd.org/changeset/base/344378 Log: MFC r336244, r336246-r336247: Standardize boot arg parsing r336244: Create helper functions for parsing boot args. boot_parse_arg to parse a single arg boot_parse_cmdline to parse a command line string boot_parse_args to parse all the args in a vector boot_howto_to_env Convert howto bits to env vars boot_env_to_howto Return howto mask mased on what's set in the environment. All these routines return an int that's the bitmask of the args translated to RB_* flags. As a special case, the 'S' flag sets the comconsole_speed env var. Any arg that looks like a=b will set the env key 'a' to value 'b'. If =b is omitted, 'a' is set to '1'. This should help us reduce the number of redundant copies of these routines in the tree. It should also give a more uniform experience between platforms. Also, invent a new flag RB_PROBE that's set when 'P' is parsed. On x86 + BIOS, this means 'probe for the keyboard, and if it's not there set both RB_MULTIPLE and RB_SERIAL (which means show the output on both video and serial consoles, but make serial primary). Others it may be some similar concept of probing, but it's loader dependent what, exactly, it means. These routines are suitable for /boot/loader and/or the kernel, though they may not be suitable for the tightly hand-rolled-for-space environments like boot2. r336246: Eliminate boot loader copies of boot arg parsing. Eliminate 4 of the copies of the arg parsing in /boot/laoder by using boot_parse_cmdline. r336247: Transition to boot_env_to_howto and boot_howto_to_env in the boot loader. Added: stable/11/sys/kern/subr_boot.c - copied unchanged from r336244, head/sys/kern/subr_boot.c Modified: stable/11/stand/common/boot.c stable/11/stand/common/bootstrap.h stable/11/stand/common/metadata.c stable/11/stand/efi/loader/bootinfo.c stable/11/stand/efi/loader/main.c stable/11/stand/i386/libi386/bootinfo.c stable/11/stand/libsa/Makefile stable/11/stand/userboot/userboot/bootinfo.c stable/11/sys/arm/arm/machdep_boot.c stable/11/sys/conf/files stable/11/sys/sys/boot.h stable/11/sys/sys/reboot.h stable/11/sys/x86/xen/pv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/common/boot.c ============================================================================== --- stable/11/stand/common/boot.c Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/stand/common/boot.c Wed Feb 20 19:19:24 2019 (r344378) @@ -160,30 +160,6 @@ autoboot_maybe() autoboot(-1, NULL); /* try to boot automatically */ } -int -bootenv_flags() -{ - int i, howto; - char *val; - - for (howto = 0, i = 0; howto_names[i].ev != NULL; i++) { - val = getenv(howto_names[i].ev); - if (val != NULL && strcasecmp(val, "no") != 0) - howto |= howto_names[i].mask; - } - return (howto); -} - -void -bootenv_set(int howto) -{ - int i; - - for (i = 0; howto_names[i].ev != NULL; i++) - if (howto & howto_names[i].mask) - setenv(howto_names[i].ev, "YES", 1); -} - static int autoboot(int timeout, char *prompt) { Modified: stable/11/stand/common/bootstrap.h ============================================================================== --- stable/11/stand/common/bootstrap.h Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/stand/common/bootstrap.h Wed Feb 20 19:19:24 2019 (r344378) @@ -63,8 +63,6 @@ int parse(int *argc, char ***argv, const char *str); /* boot.c */ void autoboot_maybe(void); int getrootmount(char *rootdev); -int bootenv_flags(void); -void bootenv_set(int); /* misc.c */ char *unargv(int argc, char *argv[]); Modified: stable/11/stand/common/metadata.c ============================================================================== --- stable/11/stand/common/metadata.c Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/stand/common/metadata.c Wed Feb 20 19:19:24 2019 (r344378) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #if defined(LOADER_FDT_SUPPORT) #include @@ -96,62 +97,11 @@ md_bootserial(void) static int md_getboothowto(char *kargs) { - char *cp; int howto; - int active; /* Parse kargs */ - howto = 0; - if (kargs != NULL) { - cp = kargs; - active = 0; - while (*cp != 0) { - if (!active && (*cp == '-')) { - active = 1; - } else if (active) - switch (*cp) { - case 'a': - howto |= RB_ASKNAME; - break; - case 'C': - howto |= RB_CDROM; - break; - case 'd': - howto |= RB_KDB; - break; - case 'D': - howto |= RB_MULTIPLE; - break; - case 'm': - howto |= RB_MUTE; - break; - case 'g': - howto |= RB_GDB; - break; - case 'h': - howto |= RB_SERIAL; - break; - case 'p': - howto |= RB_PAUSE; - break; - case 'r': - howto |= RB_DFLTROOT; - break; - case 's': - howto |= RB_SINGLE; - break; - case 'v': - howto |= RB_VERBOSE; - break; - default: - active = 0; - break; - } - cp++; - } - } - - howto |= bootenv_flags(); + howto = boot_parse_cmdline(kargs); + howto |= boot_env_to_howto(); #if defined(__sparc64__) if (md_bootserial() != -1) howto |= RB_SERIAL; Modified: stable/11/stand/efi/loader/bootinfo.c ============================================================================== --- stable/11/stand/efi/loader/bootinfo.c Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/stand/efi/loader/bootinfo.c Wed Feb 20 19:19:24 2019 (r344378) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -59,12 +60,6 @@ int bi_load(char *args, vm_offset_t *modulep, vm_offse extern EFI_SYSTEM_TABLE *ST; -static const char howto_switches[] = "aCdrgDmphsv"; -static int howto_masks[] = { - RB_ASKNAME, RB_CDROM, RB_KDB, RB_DFLTROOT, RB_GDB, RB_MULTIPLE, - RB_MUTE, RB_PAUSE, RB_SERIAL, RB_SINGLE, RB_VERBOSE -}; - static int bi_getboothowto(char *kargs) { @@ -73,7 +68,8 @@ bi_getboothowto(char *kargs) char *console; int howto; - howto = bootenv_flags(); + howto = boot_parse_cmdline(kargs); + howto |= boot_env_to_howto(); console = getenv("console"); if (console != NULL) { @@ -81,21 +77,6 @@ bi_getboothowto(char *kargs) howto |= RB_SERIAL; if (strcmp(console, "nullconsole") == 0) howto |= RB_MUTE; - } - - /* Parse kargs */ - if (kargs == NULL) - return (howto); - - opts = strchr(kargs, '-'); - while (opts != NULL) { - while (*(++opts) != '\0') { - sw = strchr(howto_switches, *opts); - if (sw == NULL) - break; - howto |= howto_masks[sw - howto_switches]; - } - opts = strchr(opts, '-'); } return (howto); Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/stand/efi/loader/main.c Wed Feb 20 19:19:24 2019 (r344378) @@ -28,11 +28,13 @@ #include __FBSDID("$FreeBSD$"); +#include + #include #include #include +#include #include -#include #include #include #include @@ -420,79 +422,10 @@ parse_args(int argc, CHAR16 *argv[], bool has_kbd) */ howto = 0; for (i = 1; i < argc; i++) { - if (argv[i][0] == '-') { - for (j = 1; argv[i][j] != 0; j++) { - int ch; - - ch = argv[i][j]; - switch (ch) { - case 'a': - howto |= RB_ASKNAME; - break; - case 'd': - howto |= RB_KDB; - break; - case 'D': - howto |= RB_MULTIPLE; - break; - case 'h': - howto |= RB_SERIAL; - break; - case 'm': - howto |= RB_MUTE; - break; - case 'p': - howto |= RB_PAUSE; - break; - case 'P': - if (!has_kbd) - howto |= RB_SERIAL | RB_MULTIPLE; - break; - case 'r': - howto |= RB_DFLTROOT; - break; - case 's': - howto |= RB_SINGLE; - break; - case 'S': - if (argv[i][j + 1] == 0) { - if (i + 1 == argc) { - setenv("comconsole_speed", "115200", 1); - } else { - cpy16to8(&argv[i + 1][0], var, - sizeof(var)); - setenv("comconsole_speed", var, 1); - } - i++; - break; - } else { - cpy16to8(&argv[i][j + 1], var, - sizeof(var)); - setenv("comconsole_speed", var, 1); - break; - } - case 'v': - howto |= RB_VERBOSE; - break; - } - } - } else { - vargood = false; - for (j = 0; argv[i][j] != 0; j++) { - if (j == sizeof(var)) { - vargood = false; - break; - } - if (j > 0 && argv[i][j] == '=') - vargood = true; - var[j] = (char)argv[i][j]; - } - if (vargood) { - var[j] = 0; - putenv(var); - } - } + cpy16to8(argv[i], var, sizeof(var)); + howto |= boot_parse_arg(var); } + return (howto); } @@ -550,7 +483,7 @@ main(int argc, CHAR16 *argv[]) howto = parse_args(argc, argv, has_kbd); - bootenv_set(howto); + boot_howto_to_env(howto); /* * XXX we need fallback to this stuff after looking at the ConIn, ConOut and ConErr variables Modified: stable/11/stand/i386/libi386/bootinfo.c ============================================================================== --- stable/11/stand/i386/libi386/bootinfo.c Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/stand/i386/libi386/bootinfo.c Wed Feb 20 19:19:24 2019 (r344378) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "bootstrap.h" #include "libi386.h" @@ -38,63 +39,12 @@ __FBSDID("$FreeBSD$"); int bi_getboothowto(char *kargs) { - char *cp; char *curpos, *next, *string; int howto; - int active; int vidconsole; - /* Parse kargs */ - howto = 0; - if (kargs != NULL) { - cp = kargs; - active = 0; - while (*cp != 0) { - if (!active && (*cp == '-')) { - active = 1; - } else if (active) - switch (*cp) { - case 'a': - howto |= RB_ASKNAME; - break; - case 'C': - howto |= RB_CDROM; - break; - case 'd': - howto |= RB_KDB; - break; - case 'D': - howto |= RB_MULTIPLE; - break; - case 'm': - howto |= RB_MUTE; - break; - case 'g': - howto |= RB_GDB; - break; - case 'h': - howto |= RB_SERIAL; - break; - case 'p': - howto |= RB_PAUSE; - break; - case 'r': - howto |= RB_DFLTROOT; - break; - case 's': - howto |= RB_SINGLE; - break; - case 'v': - howto |= RB_VERBOSE; - break; - default: - active = 0; - break; - } - cp++; - } - } - howto |= bootenv_flags(); + howto = boot_parse_cmdline(kargs); + howto |= boot_env_to_howto(); /* Enable selected consoles */ string = next = strdup(getenv("console")); @@ -130,7 +80,7 @@ void bi_setboothowto(int howto) { - bootenv_set(howto); + boot_howto_to_env(howto); } /* Modified: stable/11/stand/libsa/Makefile ============================================================================== --- stable/11/stand/libsa/Makefile Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/stand/libsa/Makefile Wed Feb 20 19:19:24 2019 (r344378) @@ -37,6 +37,10 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c fls.c \ .PATH: ${LIBC_SRC}/stdlib SRCS+= abs.c strtol.c strtoll.c strtoul.c strtoull.c +# common boot code +.PATH: ${SYSDIR}/kern +SRCS+= subr_boot.c + .if ${MACHINE_CPUARCH} == "arm" .PATH: ${LIBC_SRC}/arm/gen Modified: stable/11/stand/userboot/userboot/bootinfo.c ============================================================================== --- stable/11/stand/userboot/userboot/bootinfo.c Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/stand/userboot/userboot/bootinfo.c Wed Feb 20 19:19:24 2019 (r344378) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "bootstrap.h" @@ -38,65 +39,13 @@ __FBSDID("$FreeBSD$"); int bi_getboothowto(char *kargs) { - char *cp; char *curpos, *next, *string; int howto; - int active; int vidconsole; - /* Parse kargs */ - howto = 0; - if (kargs != NULL) { - cp = kargs; - active = 0; - while (*cp != 0) { - if (!active && (*cp == '-')) { - active = 1; - } else if (active) - switch (*cp) { - case 'a': - howto |= RB_ASKNAME; - break; - case 'C': - howto |= RB_CDROM; - break; - case 'd': - howto |= RB_KDB; - break; - case 'D': - howto |= RB_MULTIPLE; - break; - case 'm': - howto |= RB_MUTE; - break; - case 'g': - howto |= RB_GDB; - break; - case 'h': - howto |= RB_SERIAL; - break; - case 'p': - howto |= RB_PAUSE; - break; - case 'r': - howto |= RB_DFLTROOT; - break; - case 's': - howto |= RB_SINGLE; - break; - case 'v': - howto |= RB_VERBOSE; - break; - default: - active = 0; - break; - } - cp++; - } - } + howto = boot_parse_cmdline(kargs); + howto |= boot_env_to_howto(); - howto |= bootenv_flags(); - /* Enable selected consoles */ string = next = strdup(getenv("console")); vidconsole = 0; @@ -117,7 +66,8 @@ bi_getboothowto(char *kargs) /* * XXX: Note that until the kernel is ready to respect multiple consoles - * for the boot messages, the first named console is the primary console + * for the messages from /etc/rc, the first named console is the primary + * console */ if (!strcmp(string, "vidconsole")) howto &= ~RB_SERIAL; @@ -131,7 +81,7 @@ void bi_setboothowto(int howto) { - bootenv_set(howto); + boot_howto_to_env(howto); } /* Modified: stable/11/sys/arm/arm/machdep_boot.c ============================================================================== --- stable/11/sys/arm/arm/machdep_boot.c Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/sys/arm/arm/machdep_boot.c Wed Feb 20 19:19:24 2019 (r344378) @@ -68,6 +68,8 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif +static char static_kenv[4096]; + extern int *end; static uint32_t board_revision; @@ -146,9 +148,8 @@ arm_print_kenv(void) static void cmdline_set_env(char *cmdline, const char *guard) { - char *cmdline_next, *env; + char *cmdline_next; size_t size, guard_len; - int i; size = strlen(cmdline); /* Skip leading spaces. */ @@ -164,37 +165,27 @@ cmdline_set_env(char *cmdline, const char *guard) size -= guard_len; } - /* Skip leading spaces. */ - for (; isspace(*cmdline) && (size > 0); cmdline++) - size--; - - /* Replace ',' with '\0'. */ - /* TODO: implement escaping for ',' character. */ - cmdline_next = cmdline; - while(strsep(&cmdline_next, ",") != NULL) - ; - init_static_kenv(cmdline, 0); - /* Parse boothowto. */ - for (i = 0; howto_names[i].ev != NULL; i++) { - env = kern_getenv(howto_names[i].ev); - if (env != NULL) { - if (strtoul(env, NULL, 10) != 0) - boothowto |= howto_names[i].mask; - freeenv(env); - } - } + boothowto |= boot_parse_cmdline(); } +/* + * Called for armv6 and newer. + */ void arm_parse_fdt_bootargs(void) { #ifdef FDT if (loader_envp == NULL && fdt_get_chosen_bootargs(linux_command_line, - LBABI_MAX_COMMAND_LINE) == 0) + LBABI_MAX_COMMAND_LINE) == 0) { + init_static_kenv(static_kenv, sizeof(static_kenv)); cmdline_set_env(linux_command_line, CMDLINE_GUARD); + } #endif } +/* + * Called for armv[45]. + */ static vm_offset_t linux_parse_boot_param(struct arm_boot_params *abp) { @@ -271,6 +262,7 @@ linux_parse_boot_param(struct arm_boot_params *abp) (char *)walker - (char *)atag_list + ATAG_SIZE(walker)); lastaddr = fake_preload_metadata(abp, NULL, 0); + init_static_kenv(static_kenv, sizeof(static_kenv)); cmdline_set_env(linux_command_line, CMDLINE_GUARD); return lastaddr; } Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/sys/conf/files Wed Feb 20 19:19:24 2019 (r344378) @@ -3675,6 +3675,7 @@ kern/subr_acl_nfs4.c optional ufs_acl | zfs kern/subr_acl_posix1e.c optional ufs_acl kern/subr_autoconf.c standard kern/subr_blist.c standard +kern/subr_boot.c standard kern/subr_bus.c standard kern/subr_bus_dma.c standard kern/subr_bufring.c standard Copied: stable/11/sys/kern/subr_boot.c (from r336244, head/sys/kern/subr_boot.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/kern/subr_boot.c Wed Feb 20 19:19:24 2019 (r344378, copy of r336244, head/sys/kern/subr_boot.c) @@ -0,0 +1,223 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 1998 Michael Smith + * All Rights Reserved. + * Copyright (c) 1998 Robert Nordier + * All Rights Reserved. + * Copyright (c) 2009, Oleksandr Tymoshenko + * All rights reserved. + * Copyright (c) 2014 Roger Pau Monné + * All Rights Reserved. + * Copyright (c) 2018 Kyle Evans + * Copyright (c) 2018 Netflix + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* Note: This is compiled in both the kernel and boot loader contexts */ + +#include +#ifdef _KERNEL +#include +#else +#include +#endif +#include +#include + +#ifdef _KERNEL +#define SETENV(k, v) kern_setenv(k, v) +#define GETENV(k) kern_getenv(k) +#define FREE(v) freeenv(v) +#else /* Boot loader */ +#define SETENV(k, v) setenv(k, v, 1) +#define GETENV(k) getenv(k) +#define FREE(v) +#endif + +static struct +{ + const char *ev; + int mask; +} howto_names[] = { + { "boot_askname", RB_ASKNAME}, + { "boot_cdrom", RB_CDROM}, + { "boot_ddb", RB_KDB}, + { "boot_dfltroot", RB_DFLTROOT}, + { "boot_gdb", RB_GDB}, + { "boot_multicons", RB_MULTIPLE}, + { "boot_mute", RB_MUTE}, + { "boot_pause", RB_PAUSE}, + { "boot_serial", RB_SERIAL}, + { "boot_single", RB_SINGLE}, + { "boot_verbose", RB_VERBOSE}, + { NULL, 0} +}; + +/* + * In the boot environment, we often parse a command line and have to throw away + * its contents. As we do so, we set environment variables that correspond to + * the flags we encounter. Later, to get a howto mask, we grovel through these + * to reconstruct it. This also allows users in their loader.conf to set them + * and have the kernel see them. + */ + +/** + * @brief convert the env vars in howto_names into a howto mask + */ +int +boot_env_to_howto(void) +{ + int i, howto; + char *val; + + for (howto = 0, i = 0; howto_names[i].ev != NULL; i++) { + val = GETENV(howto_names[i].ev); + if (val != NULL && strcasecmp(val, "no") != 0) + howto |= howto_names[i].mask; + FREE(val); + } + return (howto); +} + +/** + * @brief Set env vars from howto_names based on howto passed in + */ +void +boot_howto_to_env(int howto) +{ + int i; + + for (i = 0; howto_names[i].ev != NULL; i++) + if (howto & howto_names[i].mask) + SETENV(howto_names[i].ev, "YES"); +} + +/** + * @brief Helper routine to parse a single arg and return its mask + * + * Parse all the - options to create a mask (or a serial speed in the + * case of -S). If the arg doesn't start with '-' assume it's an env + * variable and set that instead. + */ +int +boot_parse_arg(char *v) +{ + char *n; + int howto; + +#if 0 +/* Need to see if this is better or worse than the meat of the #else */ +static const char howto_switches[] = "aCdrgDmphsv"; +static int howto_masks[] = { + RB_ASKNAME, RB_CDROM, RB_KDB, RB_DFLTROOT, RB_GDB, RB_MULTIPLE, + RB_MUTE, RB_PAUSE, RB_SERIAL, RB_SINGLE, RB_VERBOSE +}; + + opts = strchr(kargs, '-'); + while (opts != NULL) { + while (*(++opts) != '\0') { + sw = strchr(howto_switches, *opts); + if (sw == NULL) + break; + howto |= howto_masks[sw - howto_switches]; + } + opts = strchr(opts, '-'); + } +#else + howto = 0; + if (*v == '-') { + while (*v != '\0') { + v++; + switch (*v) { + case 'a': howto |= RB_ASKNAME; break; + case 'C': howto |= RB_CDROM; break; + case 'd': howto |= RB_KDB; break; + case 'D': howto |= RB_MULTIPLE; break; + case 'm': howto |= RB_MUTE; break; + case 'g': howto |= RB_GDB; break; + case 'h': howto |= RB_SERIAL; break; + case 'p': howto |= RB_PAUSE; break; + case 'P': howto |= RB_PROBE; break; + case 'r': howto |= RB_DFLTROOT; break; + case 's': howto |= RB_SINGLE; break; + case 'S': SETENV("comconsole_speed", v + 1); v += strlen(v); break; + case 'v': howto |= RB_VERBOSE; break; + } + } + } else { + n = strsep(&v, "="); + if (v == NULL) + SETENV(n, "1"); + else + SETENV(n, v); + } +#endif + return (howto); +} + +/** + * @brief breakup the command line into args, and pass to boot_parse_arg + */ +int +boot_parse_cmdline_delim(char *cmdline, const char *delim) +{ + char *v; + int howto; + + howto = 0; + while ((v = strsep(&cmdline, delim)) != NULL) { + if (*v == '\0') + continue; + howto |= boot_parse_arg(v); + } + return (howto); +} + +/** + * @brief Simplified interface for common 'space separated' args + */ +int +boot_parse_cmdline(char *cmdline) +{ + + return (boot_parse_cmdline_delim(cmdline, " \n")); +} + +/** + * @brief Pass a vector of strings to boot_parse_arg + */ +int +boot_parse_args(int argc, char *argv[]) +{ + int i, howto; + + howto = 0; + for (i = 1; i < argc; i++) + howto |= boot_parse_arg(argv[i]); + return (howto); +} Modified: stable/11/sys/sys/boot.h ============================================================================== --- stable/11/sys/sys/boot.h Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/sys/sys/boot.h Wed Feb 20 19:19:24 2019 (r344378) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2018 Netflix * Copyright (c) 2014 Roger Pau Monné * All rights reserved. * @@ -29,27 +30,11 @@ #ifndef _SYS_BOOT_H_ #define _SYS_BOOT_H_ -/* - * Return a 'boothowto' value corresponding to the kernel arguments in - * (kargs) and any relevant environment variables. - */ -static struct -{ - const char *ev; - int mask; -} howto_names[] = { - { "boot_askname", RB_ASKNAME}, - { "boot_cdrom", RB_CDROM}, - { "boot_ddb", RB_KDB}, - { "boot_dfltroot", RB_DFLTROOT}, - { "boot_gdb", RB_GDB}, - { "boot_multicons", RB_MULTIPLE}, - { "boot_mute", RB_MUTE}, - { "boot_pause", RB_PAUSE}, - { "boot_serial", RB_SERIAL}, - { "boot_single", RB_SINGLE}, - { "boot_verbose", RB_VERBOSE}, - { NULL, 0} -}; +int boot_env_to_howto(void); +void boot_howto_to_env(int howto); +int boot_parse_arg(char *v); +int boot_parse_cmdline_delim(char *cmdline, const char *delim); +int boot_parse_cmdline(char *cmdline); +int boot_parse_args(int argc, char *argv[]); #endif /* !_SYS_BOOT_H_ */ Modified: stable/11/sys/sys/reboot.h ============================================================================== --- stable/11/sys/sys/reboot.h Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/sys/sys/reboot.h Wed Feb 20 19:19:24 2019 (r344378) @@ -60,6 +60,7 @@ #define RB_RESERVED2 0x80000 /* reserved for internal use of boot blocks */ #define RB_PAUSE 0x100000 /* pause after each output line during probe */ #define RB_REROOT 0x200000 /* unmount the rootfs and mount it again */ +#define RB_PROBE 0x10000000 /* Probe multiple consoles */ #define RB_MULTIPLE 0x20000000 /* use multiple consoles */ #define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */ Modified: stable/11/sys/x86/xen/pv.c ============================================================================== --- stable/11/sys/x86/xen/pv.c Wed Feb 20 19:13:09 2019 (r344377) +++ stable/11/sys/x86/xen/pv.c Wed Feb 20 19:19:24 2019 (r344378) @@ -300,21 +300,6 @@ xen_pv_set_env(void) init_static_kenv(cmd_line, 0); } -static void -xen_pv_set_boothowto(void) -{ - int i; - char *env; - - /* get equivalents from the environment */ - for (i = 0; howto_names[i].ev != NULL; i++) { - if ((env = kern_getenv(howto_names[i].ev)) != NULL) { - boothowto |= howto_names[i].mask; - freeenv(env); - } - } -} - #ifdef DDB /* * The way Xen loads the symtab is different from the native boot loader, @@ -413,7 +398,7 @@ xen_pv_parse_preload_data(u_int64_t modulep) } else { /* Parse the extra boot information given by Xen */ xen_pv_set_env(); - xen_pv_set_boothowto(); + boothowto |= boot_env_to_howto(); kmdp = NULL; } From owner-svn-src-stable-11@freebsd.org Wed Feb 20 19:32:04 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4E8914FD954; Wed, 20 Feb 2019 19:32:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 726C26823A; Wed, 20 Feb 2019 19:32:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D6E2A0E7; Wed, 20 Feb 2019 19:32:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KJW3dX034482; Wed, 20 Feb 2019 19:32:03 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KJW2jK034477; Wed, 20 Feb 2019 19:32:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902201932.x1KJW2jK034477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 19:32:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344379 - in stable/11: stand/i386/kgzldr sys/conf sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: stand/i386/kgzldr sys/conf sys/kern X-SVN-Commit-Revision: 344379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 726C26823A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 19:32:04 -0000 Author: kevans Date: Wed Feb 20 19:32:02 2019 New Revision: 344379 URL: https://svnweb.freebsd.org/changeset/base/344379 Log: MFC r306681, r336249-r336250, r336261: remove inflate conflict r306681: ANSIfy inflate.c Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8143 r336249: Fix sparc64 builds gcc is complaining about struct infate being defined in a parameter list. It's inclear how long this has been broken, but the fix is simple enough. r336250: There's two files in the sys tree named inflate.c, in addition to it being a common name elsewhere. Rename the old kzip one to subr_inflate.c. This actually fixes the build issues on sparc64 that my inclusion of .PATH ${SYSDIR}/kern created in r336244, so also revert the broken workaround I committed in r336249. This slipped passed me because apparently, I never did a clean build. r336261: Catch up to the inflate renaming. Added: stable/11/sys/kern/subr_inflate.c (contents, props changed) - copied, changed from r344378, stable/11/sys/kern/inflate.c Deleted: stable/11/sys/kern/inflate.c Modified: stable/11/stand/i386/kgzldr/Makefile stable/11/sys/conf/Makefile.arm stable/11/sys/conf/files Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/i386/kgzldr/Makefile ============================================================================== --- stable/11/stand/i386/kgzldr/Makefile Wed Feb 20 19:19:24 2019 (r344378) +++ stable/11/stand/i386/kgzldr/Makefile Wed Feb 20 19:32:02 2019 (r344379) @@ -7,7 +7,7 @@ STRIP= BINMODE=${LIBMODE} BINDIR= ${LIBDIR} -SRCS= start.s boot.c inflate.c lib.c crt.s sio.s +SRCS= start.s boot.c subr_inflate.c lib.c crt.s sio.s CFLAGS= -Os CFLAGS+=-DKZIP NO_SHARED= Modified: stable/11/sys/conf/Makefile.arm ============================================================================== --- stable/11/sys/conf/Makefile.arm Wed Feb 20 19:19:24 2019 (r344378) +++ stable/11/sys/conf/Makefile.arm Wed Feb 20 19:32:02 2019 (r344379) @@ -111,7 +111,7 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S gzip -f9 ${KERNEL_KO}.tmp eval $$(stat -s ${KERNEL_KO}.tmp.gz) && \ echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h - ${CC} -O2 -ffreestanding -DKZIP -I. -I$S -c $S/kern/inflate.c -o \ + ${CC} -O2 -ffreestanding -DKZIP -I. -I$S -c $S/kern/subr_inflate.c -o \ inflate-tramp.o ${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker ldscript.$M.tramp \ -DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \ Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Wed Feb 20 19:19:24 2019 (r344378) +++ stable/11/sys/conf/files Wed Feb 20 19:32:02 2019 (r344379) @@ -3581,7 +3581,6 @@ kern/imgact_binmisc.c optional imagact_binmisc kern/imgact_elf.c standard kern/imgact_elf32.c optional compat_freebsd32 kern/imgact_shell.c standard -kern/inflate.c optional gzip kern/init_main.c standard kern/init_sysent.c standard kern/ksched.c optional _kposix_priority_scheduling @@ -3690,6 +3689,7 @@ kern/subr_firmware.c optional firmware kern/subr_gtaskqueue.c standard kern/subr_hash.c standard kern/subr_hints.c standard +kern/subr_inflate.c optional gzip kern/subr_kdb.c standard kern/subr_kobj.c standard kern/subr_lock.c standard Copied and modified: stable/11/sys/kern/subr_inflate.c (from r344378, stable/11/sys/kern/inflate.c) ============================================================================== --- stable/11/sys/kern/inflate.c Wed Feb 20 19:19:24 2019 (r344378, copy source) +++ stable/11/sys/kern/subr_inflate.c Wed Feb 20 19:32:02 2019 (r344379) @@ -411,16 +411,19 @@ static const int dbits = 6; /* bits in base distance l The code with value 256 is special, and the tables are constructed so that no bits beyond that code are fetched when that code is decoded. */ +/* + * Arguments: + * b code lengths in bits (all assumed <= BMAX) + * n number of codes (assumed <= N_MAX) + * s number of simple-valued codes (0..s-1) + * d list of base values for non-simple codes + * e list of extra bits for non-simple codes + * t result: starting table + * m maximum lookup bits, returns actual + */ static int -huft_build(glbl, b, n, s, d, e, t, m) - struct inflate *glbl; - unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ - unsigned n; /* number of codes (assumed <= N_MAX) */ - unsigned s; /* number of simple-valued codes (0..s-1) */ - const ush *d; /* list of base values for non-simple codes */ - const ush *e; /* list of extra bits for non-simple codes */ - struct huft **t; /* result: starting table */ - int *m; /* maximum lookup bits, returns actual */ +huft_build(struct inflate *glbl, unsigned *b, unsigned n, unsigned s, + const ush *d, const ush *e, struct huft **t, int *m) { unsigned a; /* counter for codes of length k */ unsigned c[BMAX + 1]; /* bit length count table */ @@ -614,10 +617,12 @@ huft_build(glbl, b, n, s, d, e, t, m) return y != 0 && g != 1; } +/* + * Arguments: + * t table to free + */ static int -huft_free(glbl, t) - struct inflate *glbl; - struct huft *t; /* table to free */ +huft_free(struct inflate *glbl, struct huft *t) /* Free the malloc'ed tables built by huft_build(), which makes a linked list of the tables it made, with the links in a dummy first entry of each table. */ @@ -636,11 +641,14 @@ huft_free(glbl, t) /* inflate (decompress) the codes in a deflated (compressed) block. Return an error code or zero if it all goes ok. */ +/* + * Arguments: + * tl, td literal/length and distance decoder tables + * bl, bd number of bits decoded by tl[] and td[] + */ static int -inflate_codes(glbl, tl, td, bl, bd) - struct inflate *glbl; - struct huft *tl, *td;/* literal/length and distance decoder tables */ - int bl, bd; /* number of bits decoded by tl[] and td[] */ +inflate_codes(struct inflate *glbl, struct huft *tl, struct huft*td, int bl, + int bd) { unsigned e; /* table entry flag/number of extra bits */ unsigned n, d; /* length and index for copy */ @@ -733,8 +741,7 @@ inflate_codes(glbl, tl, td, bl, bd) /* "decompress" an inflated type 0 (stored) block. */ static int -inflate_stored(glbl) - struct inflate *glbl; +inflate_stored(struct inflate *glbl) { unsigned n; /* number of bytes in block */ unsigned w; /* current window position */ @@ -780,8 +787,7 @@ inflate_stored(glbl) either replace this with a custom decoder, or at least precompute the Huffman tables. */ static int -inflate_fixed(glbl) - struct inflate *glbl; +inflate_fixed(struct inflate *glbl) { /* if first time, set up tables for fixed blocks */ if (glbl->gz_fixed_tl == (struct huft *) NULL) { @@ -822,8 +828,7 @@ inflate_fixed(glbl) /* decompress an inflated type 2 (dynamic Huffman codes) block. */ static int -inflate_dynamic(glbl) - struct inflate *glbl; +inflate_dynamic(struct inflate *glbl) { int i; /* temporary variables */ unsigned j; @@ -967,10 +972,12 @@ inflate_dynamic(glbl) } /* decompress an inflated block */ +/* + * Arguments: + * e last block flag + */ static int -inflate_block(glbl, e) - struct inflate *glbl; - int *e; /* last block flag */ +inflate_block(struct inflate *glbl, int *e) { unsigned t; /* block type */ ulg b; /* bit buffer */ @@ -1007,8 +1014,7 @@ inflate_block(glbl, e) /* decompress an inflated entry */ static int -xinflate(glbl) - struct inflate *glbl; +xinflate(struct inflate *glbl) { int e; /* last block flag */ int r; /* result code */ @@ -1040,8 +1046,7 @@ xinflate(glbl) /* Nobody uses this - why not? */ int -inflate(glbl) - struct inflate *glbl; +inflate(struct inflate *glbl) { int i; #ifdef _KERNEL From owner-svn-src-stable-11@freebsd.org Wed Feb 20 20:34:44 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A74114DADF1; Wed, 20 Feb 2019 20:34:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A16D76C4DB; Wed, 20 Feb 2019 20:34:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CB65AB69; Wed, 20 Feb 2019 20:34:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KKYh3R075237; Wed, 20 Feb 2019 20:34:43 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KKYhnI075236; Wed, 20 Feb 2019 20:34:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902202034.x1KKYhnI075236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 20:34:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344383 - stable/11/sys/arm/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/arm/arm X-SVN-Commit-Revision: 344383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A16D76C4DB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 20:34:44 -0000 Author: kevans Date: Wed Feb 20 20:34:43 2019 New Revision: 344383 URL: https://svnweb.freebsd.org/changeset/base/344383 Log: MFC r336283: Fix build after r344378 Eliminate an unused var warning-error; the var is used only when parsing linux-style boot args, so wrap it in the appropriate ifdef. Modified: stable/11/sys/arm/arm/machdep_boot.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/machdep_boot.c ============================================================================== --- stable/11/sys/arm/arm/machdep_boot.c Wed Feb 20 20:28:48 2019 (r344382) +++ stable/11/sys/arm/arm/machdep_boot.c Wed Feb 20 20:34:43 2019 (r344383) @@ -68,7 +68,9 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif +#ifdef LINUX_BOOT_ABI static char static_kenv[4096]; +#endif extern int *end; From owner-svn-src-stable-11@freebsd.org Wed Feb 20 22:48:56 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E2F314DF88A; Wed, 20 Feb 2019 22:48:56 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B81F72E70; Wed, 20 Feb 2019 22:48:56 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F13B6C377; Wed, 20 Feb 2019 22:48:55 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KMmtR0057855; Wed, 20 Feb 2019 22:48:55 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KMmtbq057854; Wed, 20 Feb 2019 22:48:55 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201902202248.x1KMmtbq057854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Wed, 20 Feb 2019 22:48:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344393 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: stable/11/sys/cam/scsi X-SVN-Commit-Revision: 344393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0B81F72E70 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.945,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 22:48:56 -0000 Author: dab Date: Wed Feb 20 22:48:55 2019 New Revision: 344393 URL: https://svnweb.freebsd.org/changeset/base/344393 Log: MFC r344024: CID 1009492: Logically dead code in sys/cam/scsi/scsi_xpt.c In `probedone()`, for the `PROBE_REPORT_LUNS` case, all paths that fall to the bottom of the case set `lp` to `NULL`, so the test for a non-NULL value of `lp` and call to `free()` if true is dead code as the test can never be true. Fix by eliminating the whole if statement. To guard against a possible future change that accidentally violates this assumption, use a `KASSERT()` to catch if `lp` is non-NULL. Sponsored by: Dell EMC Isilon Modified: stable/11/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_xpt.c Wed Feb 20 22:48:38 2019 (r344392) +++ stable/11/sys/cam/scsi/scsi_xpt.c Wed Feb 20 22:48:55 2019 (r344393) @@ -1379,6 +1379,12 @@ out: probe_purge_old(path, lp, softc->flags); lp = NULL; } + /* The processing above should either exit via a `goto + * out` or leave the `lp` variable `NULL` and (if + * applicable) `free()` the storage to which it had + * pointed. Assert here that is the case. + */ + KASSERT(lp == NULL, ("%s: lp is not NULL", __func__)); inq_buf = &path->device->inq_data; if (path->device->flags & CAM_DEV_INQUIRY_DATA_VALID && (SID_QUAL(inq_buf) == SID_QUAL_LU_CONNECTED || @@ -1391,9 +1397,6 @@ out: xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); goto out; - } - if (lp) { - free(lp, M_CAMXPT); } PROBE_SET_ACTION(softc, PROBE_INVALID); xpt_release_ccb(done_ccb); From owner-svn-src-stable-11@freebsd.org Wed Feb 20 23:42:06 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE9DF14E130E; Wed, 20 Feb 2019 23:42:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7ED4F75547; Wed, 20 Feb 2019 23:42:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 654AFCDAA; Wed, 20 Feb 2019 23:42:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KNg5IN086989; Wed, 20 Feb 2019 23:42:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KNg3qP086981; Wed, 20 Feb 2019 23:42:03 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902202342.x1KNg3qP086981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 23:42:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344397 - in stable/11: sbin/geom/class/eli stand/libsa/geli sys/geom/eli X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: sbin/geom/class/eli stand/libsa/geli sys/geom/eli X-SVN-Commit-Revision: 344397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7ED4F75547 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 23:42:06 -0000 Author: kevans Date: Wed Feb 20 23:42:03 2019 New Revision: 344397 URL: https://svnweb.freebsd.org/changeset/base/344397 Log: MFC r316312, r332361, r333438-r333439, r339804: GELI dry-run r316312: sys/geom/eli: Switch bzero() to explicit_bzero() for sensitive data In GELI, anywhere we are zeroing out possibly sensitive data, like the metadata struct, the metadata sector (both contain the encrypted master key), the user key, or the master key, use explicit_bzero. Didn't touch the bzero() used to initialize structs. r332361: Introduce dry run option for attaching the device. This will allow us to verify if passphrase and key is valid without decrypting whole device. r333438: Change option dry-run from 'n' to 'C' in geli attach command. 'n' is used in other commands to define the key index. We should be consistent with that. 'C' option is used by patch(1) to perform dryrun so lets use that. r333439: Introduce the 'n' flag for the geli attach command. If the 'n' flag is provided the provided key number will be used to decrypt device. This can be used combined with dryrun to verify if the key is set correctly. This can be also used to determine which key slot we want to change on already attached device. r339804: Restore backward compatibility for "attach" verb. In r332361 and r333439, two new parameters were added to geli attach verb using gctl_get_paraml, which requires the value to be present. This would prevent old geli(8) binary from attaching geli(4) device as they have no knowledge about the new parameters. Restore backward compatibility by treating the absense of these two values as seeing the default value supplied by userland. Modified: stable/11/sbin/geom/class/eli/geli.8 stable/11/sbin/geom/class/eli/geom_eli.c stable/11/stand/libsa/geli/geliboot.c stable/11/sys/geom/eli/g_eli.c stable/11/sys/geom/eli/g_eli.h stable/11/sys/geom/eli/g_eli_ctl.c stable/11/sys/geom/eli/g_eli_key.c stable/11/sys/geom/eli/g_eli_key_cache.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/geom/class/eli/geli.8 ============================================================================== --- stable/11/sbin/geom/class/eli/geli.8 Wed Feb 20 23:05:17 2019 (r344396) +++ stable/11/sbin/geom/class/eli/geli.8 Wed Feb 20 23:42:03 2019 (r344397) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2017 +.Dd May 9, 2018 .Dt GELI 8 .Os .Sh NAME @@ -67,7 +67,8 @@ utility: .Cm init .Nm .Cm attach -.Op Fl dprv +.Op Fl Cdprv +.Op Fl n Ar keyno .Op Fl j Ar passfile .Op Fl k Ar keyfile .Ar prov @@ -393,6 +394,9 @@ suffix. .Pp Additional options include: .Bl -tag -width ".Fl j Ar passfile" +.It Fl C +Do a dry-run decryption. +This is useful to verify passphrase and keyfile without decrypting the device. .It Fl d If specified, a decrypted provider will be detached automatically on last close. This can help with scarce memory so the user does not have to remember to detach the @@ -404,6 +408,9 @@ Probably a better choice is the option for the .Cm detach subcommand. +.It Fl n Ar keyno +Specifies the index number of the Master Key copy to use (could be 0 or 1). +If the index number is not provided all keys will be tested. .It Fl j Ar passfile Specifies a file which contains the passphrase component of the User Key (or part of it). Modified: stable/11/sbin/geom/class/eli/geom_eli.c ============================================================================== --- stable/11/sbin/geom/class/eli/geom_eli.c Wed Feb 20 23:05:17 2019 (r344396) +++ stable/11/sbin/geom/class/eli/geom_eli.c Wed Feb 20 23:42:03 2019 (r344397) @@ -86,7 +86,7 @@ static int eli_backup_create(struct gctl_req *req, con * * 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 + * attach [-Cdprv] [-n keyno] [-j passfile] [-k keyfile] prov * detach [-fl] prov ... * stop - alias for 'detach' * onetime [-d] [-a aalgo] [-e ealgo] [-l keylen] prov @@ -145,14 +145,16 @@ struct g_command class_commands[] = { }, { "attach", G_FLAG_VERBOSE | G_FLAG_LOADKLD, eli_main, { + { 'C', "dryrun", NULL, G_TYPE_BOOL }, { 'd', "detach", NULL, G_TYPE_BOOL }, { 'j', "passfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'k', "keyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'n', "keyno", "-1", G_TYPE_NUMBER }, { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, { 'r', "readonly", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - "[-dprv] [-j passfile] [-k keyfile] prov" + "[-Cdprv] [-n keyno] [-j passfile] [-k keyfile] prov" }, { "detach", 0, NULL, { @@ -1128,7 +1130,7 @@ eli_setkey_detached(struct gctl_req *req, const char * } /* Decrypt Master Key. */ - error = g_eli_mkey_decrypt(md, key, mkey, &nkey); + error = g_eli_mkey_decrypt_any(md, key, mkey, &nkey); bzero(key, sizeof(key)); if (error != 0) { bzero(md, sizeof(*md)); Modified: stable/11/stand/libsa/geli/geliboot.c ============================================================================== --- stable/11/stand/libsa/geli/geliboot.c Wed Feb 20 23:05:17 2019 (r344396) +++ stable/11/stand/libsa/geli/geliboot.c Wed Feb 20 23:42:03 2019 (r344397) @@ -121,14 +121,14 @@ geli_findkey(struct geli_entry *ge, struct dsk *dskp, int i; if (ge->keybuf_slot >= 0) { - if (g_eli_mkey_decrypt(&ge->md, saved_keys[ge->keybuf_slot], + if (g_eli_mkey_decrypt_any(&ge->md, saved_keys[ge->keybuf_slot], mkey, &keynum) == 0) { return (0); } } for (i = 0; i < nsaved_keys; i++) { - if (g_eli_mkey_decrypt(&ge->md, saved_keys[i], mkey, + if (g_eli_mkey_decrypt_any(&ge->md, saved_keys[i], mkey, &keynum) == 0) { ge->keybuf_slot = i; return (0); @@ -266,7 +266,7 @@ geli_attach(struct geli_entry *ge, struct dsk *dskp, c g_eli_crypto_hmac_final(&ctx, key, 0); - error = g_eli_mkey_decrypt(&geli_e->md, key, mkey, &keynum); + error = g_eli_mkey_decrypt_any(&geli_e->md, key, mkey, &keynum); if (error == -1) { explicit_bzero(mkey, sizeof(mkey)); explicit_bzero(key, sizeof(key)); Modified: stable/11/sys/geom/eli/g_eli.c ============================================================================== --- stable/11/sys/geom/eli/g_eli.c Wed Feb 20 23:05:17 2019 (r344396) +++ stable/11/sys/geom/eli/g_eli.c Wed Feb 20 23:42:03 2019 (r344397) @@ -1086,7 +1086,7 @@ g_eli_taste(struct g_class *mp, struct g_provider *pp, memcpy(key, keybuf->kb_ents[i].ke_data, sizeof(key)); - if (g_eli_mkey_decrypt(&md, key, + if (g_eli_mkey_decrypt_any(&md, key, mkey, &nkey) == 0 ) { explicit_bzero(key, sizeof(key)); goto have_key; @@ -1161,7 +1161,7 @@ g_eli_taste(struct g_class *mp, struct g_provider *pp, /* * Decrypt Master-Key. */ - error = g_eli_mkey_decrypt(&md, key, mkey, &nkey); + error = g_eli_mkey_decrypt_any(&md, key, mkey, &nkey); bzero(key, sizeof(key)); if (error == -1) { if (i == tries) { Modified: stable/11/sys/geom/eli/g_eli.h ============================================================================== --- stable/11/sys/geom/eli/g_eli.h Wed Feb 20 23:05:17 2019 (r344396) +++ stable/11/sys/geom/eli/g_eli.h Wed Feb 20 23:42:03 2019 (r344397) @@ -686,6 +686,8 @@ void g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t void g_eli_mkey_hmac(unsigned char *mkey, const unsigned char *key); int g_eli_mkey_decrypt(const struct g_eli_metadata *md, + const unsigned char *key, unsigned char *mkey, unsigned keyp); +int g_eli_mkey_decrypt_any(const struct g_eli_metadata *md, const unsigned char *key, unsigned char *mkey, unsigned *nkeyp); int g_eli_mkey_encrypt(unsigned algo, const unsigned char *key, unsigned keylen, unsigned char *mkey); Modified: stable/11/sys/geom/eli/g_eli_ctl.c ============================================================================== --- stable/11/sys/geom/eli/g_eli_ctl.c Wed Feb 20 23:05:17 2019 (r344396) +++ stable/11/sys/geom/eli/g_eli_ctl.c Wed Feb 20 23:42:03 2019 (r344397) @@ -57,9 +57,9 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class struct g_provider *pp; const char *name; u_char *key, mkey[G_ELI_DATAIVKEYLEN]; - int *nargs, *detach, *readonly; - int keysize, error; - u_int nkey; + int *nargs, *detach, *readonly, *dryrunp; + int keysize, error, nkey, dryrun, dummy; + intmax_t *valp; g_topology_assert(); @@ -79,12 +79,39 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class return; } + /* "keyno" is optional for backward compatibility */ + nkey = -1; + valp = gctl_get_param(req, "keyno", &dummy); + if (valp != NULL) { + valp = gctl_get_paraml(req, "keyno", sizeof(*valp)); + if (valp != NULL) + nkey = *valp; + } + if (nkey < -1 || nkey >= G_ELI_MAXMKEYS) { + gctl_error(req, "Invalid '%s' argument.", "keyno"); + return; + } + readonly = gctl_get_paraml(req, "readonly", sizeof(*readonly)); if (readonly == NULL) { gctl_error(req, "No '%s' argument.", "readonly"); return; } + /* "dryrun" is optional for backward compatibility */ + dryrun = 0; + dryrunp = gctl_get_param(req, "dryrun", &dummy); + if (dryrunp != NULL) { + dryrunp = gctl_get_paraml(req, "dryrun", sizeof(*dryrunp)); + if (dryrunp != NULL) + dryrun = *dryrunp; + } + + if (*detach && *readonly) { + gctl_error(req, "Options -d and -r are mutually exclusive."); + return; + } + name = gctl_get_asciiparam(req, "arg0"); if (name == NULL) { gctl_error(req, "No 'arg%u' argument.", 0); @@ -104,44 +131,43 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class return; } if (md.md_keys == 0x00) { - bzero(&md, sizeof(md)); + explicit_bzero(&md, sizeof(md)); gctl_error(req, "No valid keys on %s.", pp->name); return; } key = gctl_get_param(req, "key", &keysize); if (key == NULL || keysize != G_ELI_USERKEYLEN) { - bzero(&md, sizeof(md)); + explicit_bzero(&md, sizeof(md)); gctl_error(req, "No '%s' argument.", "key"); return; } - error = g_eli_mkey_decrypt(&md, key, mkey, &nkey); - bzero(key, keysize); + if (nkey == -1) + error = g_eli_mkey_decrypt_any(&md, key, mkey, &nkey); + else + error = g_eli_mkey_decrypt(&md, key, mkey, nkey); + explicit_bzero(key, keysize); if (error == -1) { - bzero(&md, sizeof(md)); + explicit_bzero(&md, sizeof(md)); gctl_error(req, "Wrong key for %s.", pp->name); return; } else if (error > 0) { - bzero(&md, sizeof(md)); + explicit_bzero(&md, sizeof(md)); gctl_error(req, "Cannot decrypt Master Key for %s (error=%d).", pp->name, error); return; } G_ELI_DEBUG(1, "Using Master Key %u for %s.", nkey, pp->name); - if (*detach && *readonly) { - bzero(&md, sizeof(md)); - gctl_error(req, "Options -d and -r are mutually exclusive."); - return; - } if (*detach) md.md_flags |= G_ELI_FLAG_WO_DETACH; if (*readonly) md.md_flags |= G_ELI_FLAG_RO; - g_eli_create(req, mp, pp, &md, mkey, nkey); - bzero(mkey, sizeof(mkey)); - bzero(&md, sizeof(md)); + if (!dryrun) + g_eli_create(req, mp, pp, &md, mkey, nkey); + explicit_bzero(mkey, sizeof(mkey)); + explicit_bzero(&md, sizeof(md)); } static struct g_eli_softc * @@ -362,8 +388,8 @@ g_eli_ctl_onetime(struct gctl_req *req, struct g_class } g_eli_create(req, mp, pp, &md, mkey, -1); - bzero(mkey, sizeof(mkey)); - bzero(&md, sizeof(md)); + explicit_bzero(mkey, sizeof(mkey)); + explicit_bzero(&md, sizeof(md)); } static void @@ -582,8 +608,8 @@ g_eli_ctl_configure(struct gctl_req *req, struct g_cla "Cannot store metadata on %s (error=%d).", prov, error); } - bzero(&md, sizeof(md)); - bzero(sector, pp->sectorsize); + explicit_bzero(&md, sizeof(md)); + explicit_bzero(sector, pp->sectorsize); free(sector, M_ELI); } } @@ -607,6 +633,11 @@ g_eli_ctl_setkey(struct gctl_req *req, struct g_class gctl_error(req, "No 'arg%u' argument.", 0); return; } + key = gctl_get_param(req, "key", &keysize); + if (key == NULL || keysize != G_ELI_USERKEYLEN) { + gctl_error(req, "No '%s' argument.", "key"); + return; + } sc = g_eli_find_device(mp, name); if (sc == NULL) { gctl_error(req, "Provider %s is invalid.", name); @@ -662,13 +693,6 @@ g_eli_ctl_setkey(struct gctl_req *req, struct g_class md.md_iterations = *valp; } - key = gctl_get_param(req, "key", &keysize); - if (key == NULL || keysize != G_ELI_USERKEYLEN) { - bzero(&md, sizeof(md)); - gctl_error(req, "No '%s' argument.", "key"); - return; - } - mkeydst = md.md_mkeys + nkey * G_ELI_MKEYLEN; md.md_keys |= (1 << nkey); @@ -676,9 +700,9 @@ g_eli_ctl_setkey(struct gctl_req *req, struct g_class /* Encrypt Master Key with the new key. */ error = g_eli_mkey_encrypt(md.md_ealgo, key, md.md_keylen, mkeydst); - bzero(key, keysize); + explicit_bzero(key, keysize); if (error != 0) { - bzero(&md, sizeof(md)); + explicit_bzero(&md, sizeof(md)); gctl_error(req, "Cannot encrypt Master Key (error=%d).", error); return; } @@ -686,10 +710,10 @@ g_eli_ctl_setkey(struct gctl_req *req, struct g_class sector = malloc(pp->sectorsize, M_ELI, M_WAITOK | M_ZERO); /* Store metadata with fresh key. */ eli_metadata_encode(&md, sector); - bzero(&md, sizeof(md)); + explicit_bzero(&md, sizeof(md)); error = g_write_data(cp, pp->mediasize - pp->sectorsize, sector, pp->sectorsize); - bzero(sector, pp->sectorsize); + explicit_bzero(sector, pp->sectorsize); free(sector, M_ELI); if (error != 0) { gctl_error(req, "Cannot store metadata on %s (error=%d).", @@ -787,7 +811,7 @@ g_eli_ctl_delkey(struct gctl_req *req, struct g_class sector = malloc(pp->sectorsize, M_ELI, M_WAITOK | M_ZERO); for (i = 0; i <= g_eli_overwrites; i++) { if (i == g_eli_overwrites) - bzero(mkeydst, keysize); + explicit_bzero(mkeydst, keysize); else arc4rand(mkeydst, keysize, 0); /* Store metadata with destroyed key. */ @@ -804,8 +828,8 @@ g_eli_ctl_delkey(struct gctl_req *req, struct g_class */ (void)g_io_flush(cp); } - bzero(&md, sizeof(md)); - bzero(sector, pp->sectorsize); + explicit_bzero(&md, sizeof(md)); + explicit_bzero(sector, pp->sectorsize); free(sector, M_ELI); if (*all) G_ELI_DEBUG(1, "All keys removed from %s.", pp->name); @@ -852,12 +876,12 @@ g_eli_suspend_one(struct g_eli_softc *sc, struct gctl_ /* * Clear sensitive data on suspend, they will be recovered on resume. */ - bzero(sc->sc_mkey, sizeof(sc->sc_mkey)); + explicit_bzero(sc->sc_mkey, sizeof(sc->sc_mkey)); g_eli_key_destroy(sc); - bzero(sc->sc_akey, sizeof(sc->sc_akey)); - bzero(&sc->sc_akeyctx, sizeof(sc->sc_akeyctx)); - bzero(sc->sc_ivkey, sizeof(sc->sc_ivkey)); - bzero(&sc->sc_ivctx, sizeof(sc->sc_ivctx)); + explicit_bzero(sc->sc_akey, sizeof(sc->sc_akey)); + explicit_bzero(&sc->sc_akeyctx, sizeof(sc->sc_akeyctx)); + explicit_bzero(sc->sc_ivkey, sizeof(sc->sc_ivkey)); + explicit_bzero(&sc->sc_ivctx, sizeof(sc->sc_ivctx)); mtx_unlock(&sc->sc_queue_mtx); G_ELI_DEBUG(0, "Device %s has been suspended.", sc->sc_name); } @@ -950,6 +974,11 @@ g_eli_ctl_resume(struct gctl_req *req, struct g_class gctl_error(req, "No 'arg%u' argument.", 0); return; } + key = gctl_get_param(req, "key", &keysize); + if (key == NULL || keysize != G_ELI_USERKEYLEN) { + gctl_error(req, "No '%s' argument.", "key"); + return; + } sc = g_eli_find_device(mp, name); if (sc == NULL) { gctl_error(req, "Provider %s is invalid.", name); @@ -964,26 +993,19 @@ g_eli_ctl_resume(struct gctl_req *req, struct g_class return; } if (md.md_keys == 0x00) { - bzero(&md, sizeof(md)); + explicit_bzero(&md, sizeof(md)); gctl_error(req, "No valid keys on %s.", pp->name); return; } - key = gctl_get_param(req, "key", &keysize); - if (key == NULL || keysize != G_ELI_USERKEYLEN) { - bzero(&md, sizeof(md)); - gctl_error(req, "No '%s' argument.", "key"); - return; - } - - error = g_eli_mkey_decrypt(&md, key, mkey, &nkey); - bzero(key, keysize); + error = g_eli_mkey_decrypt_any(&md, key, mkey, &nkey); + explicit_bzero(key, keysize); if (error == -1) { - bzero(&md, sizeof(md)); + explicit_bzero(&md, sizeof(md)); gctl_error(req, "Wrong key for %s.", pp->name); return; } else if (error > 0) { - bzero(&md, sizeof(md)); + explicit_bzero(&md, sizeof(md)); gctl_error(req, "Cannot decrypt Master Key for %s (error=%d).", pp->name, error); return; @@ -1001,8 +1023,8 @@ g_eli_ctl_resume(struct gctl_req *req, struct g_class wakeup(sc); } mtx_unlock(&sc->sc_queue_mtx); - bzero(mkey, sizeof(mkey)); - bzero(&md, sizeof(md)); + explicit_bzero(mkey, sizeof(mkey)); + explicit_bzero(&md, sizeof(md)); } static int Modified: stable/11/sys/geom/eli/g_eli_key.c ============================================================================== --- stable/11/sys/geom/eli/g_eli_key.c Wed Feb 20 23:05:17 2019 (r344396) +++ stable/11/sys/geom/eli/g_eli_key.c Wed Feb 20 23:42:03 2019 (r344397) @@ -69,7 +69,7 @@ g_eli_mkey_verify(const unsigned char *mkey, const uns g_eli_crypto_hmac(hmkey, sizeof(hmkey), mkey, G_ELI_DATAIVKEYLEN, chmac, 0); - bzero(hmkey, sizeof(hmkey)); + explicit_bzero(hmkey, sizeof(hmkey)); /* * Compare calculated HMAC with HMAC from metadata. @@ -97,56 +97,81 @@ g_eli_mkey_hmac(unsigned char *mkey, const unsigned ch g_eli_crypto_hmac(hmkey, sizeof(hmkey), mkey, G_ELI_DATAIVKEYLEN, odhmac, 0); - bzero(hmkey, sizeof(hmkey)); + explicit_bzero(hmkey, sizeof(hmkey)); } /* - * Find and decrypt Master Key encrypted with 'key'. - * Return decrypted Master Key number in 'nkeyp' if not NULL. + * Find and decrypt Master Key encrypted with 'key' at slot 'nkey'. * Return 0 on success, > 0 on failure, -1 on bad key. */ int g_eli_mkey_decrypt(const struct g_eli_metadata *md, const unsigned char *key, - unsigned char *mkey, unsigned *nkeyp) + unsigned char *mkey, unsigned nkey) { unsigned char tmpmkey[G_ELI_MKEYLEN]; unsigned char enckey[SHA512_MDLEN]; /* Key for encryption. */ const unsigned char *mmkey; - int bit, error, nkey; + int bit, error; - if (nkeyp != NULL) - *nkeyp = -1; + if (nkey > G_ELI_MKEYLEN) + return (-1); /* * The key for encryption is: enckey = HMAC_SHA512(Derived-Key, 1) */ g_eli_crypto_hmac(key, G_ELI_USERKEYLEN, "\x01", 1, enckey, 0); - mmkey = md->md_mkeys; - for (nkey = 0; nkey < G_ELI_MAXMKEYS; nkey++, mmkey += G_ELI_MKEYLEN) { - bit = (1 << nkey); - if (!(md->md_keys & bit)) - continue; - bcopy(mmkey, tmpmkey, G_ELI_MKEYLEN); - error = g_eli_crypto_decrypt(md->md_ealgo, tmpmkey, - G_ELI_MKEYLEN, enckey, md->md_keylen); - if (error != 0) { - bzero(tmpmkey, sizeof(tmpmkey)); - bzero(enckey, sizeof(enckey)); - return (error); - } - if (g_eli_mkey_verify(tmpmkey, key)) { - bcopy(tmpmkey, mkey, G_ELI_DATAIVKEYLEN); - bzero(tmpmkey, sizeof(tmpmkey)); - bzero(enckey, sizeof(enckey)); + mmkey = md->md_mkeys + G_ELI_MKEYLEN * nkey; + bit = (1 << nkey); + if (!(md->md_keys & bit)) + return (-1); + bcopy(mmkey, tmpmkey, G_ELI_MKEYLEN); + error = g_eli_crypto_decrypt(md->md_ealgo, tmpmkey, + G_ELI_MKEYLEN, enckey, md->md_keylen); + if (error != 0) { + explicit_bzero(tmpmkey, sizeof(tmpmkey)); + explicit_bzero(enckey, sizeof(enckey)); + return (error); + } + if (g_eli_mkey_verify(tmpmkey, key)) { + bcopy(tmpmkey, mkey, G_ELI_DATAIVKEYLEN); + explicit_bzero(tmpmkey, sizeof(tmpmkey)); + explicit_bzero(enckey, sizeof(enckey)); + return (0); + } + explicit_bzero(enckey, sizeof(enckey)); + explicit_bzero(tmpmkey, sizeof(tmpmkey)); + + return (-1); +} + +/* + * Find and decrypt Master Key encrypted with 'key'. + * Return decrypted Master Key number in 'nkeyp' if not NULL. + * Return 0 on success, > 0 on failure, -1 on bad key. + */ +int +g_eli_mkey_decrypt_any(const struct g_eli_metadata *md, + const unsigned char *key, unsigned char *mkey, unsigned *nkeyp) +{ + int error, nkey; + + if (nkeyp != NULL) + *nkeyp = -1; + + error = -1; + for (nkey = 0; nkey < G_ELI_MAXMKEYS; nkey++) { + error = g_eli_mkey_decrypt(md, key, mkey, nkey); + if (error == 0) { if (nkeyp != NULL) *nkeyp = nkey; - return (0); + break; + } else if (error > 0) { + break; } } - bzero(enckey, sizeof(enckey)); - bzero(tmpmkey, sizeof(tmpmkey)); - return (-1); + + return (error); } /* @@ -175,7 +200,7 @@ g_eli_mkey_encrypt(unsigned algo, const unsigned char */ error = g_eli_crypto_encrypt(algo, mkey, G_ELI_MKEYLEN, enckey, keylen); - bzero(enckey, sizeof(enckey)); + explicit_bzero(enckey, sizeof(enckey)); return (error); } Modified: stable/11/sys/geom/eli/g_eli_key_cache.c ============================================================================== --- stable/11/sys/geom/eli/g_eli_key_cache.c Wed Feb 20 23:05:17 2019 (r344396) +++ stable/11/sys/geom/eli/g_eli_key_cache.c Wed Feb 20 23:42:03 2019 (r344397) @@ -117,7 +117,7 @@ g_eli_key_allocate(struct g_eli_softc *sc, uint64_t ke keysearch.gek_keyno = keyno; ekey = RB_FIND(g_eli_key_tree, &sc->sc_ekeys_tree, &keysearch); if (ekey != NULL) { - bzero(key, sizeof(*key)); + explicit_bzero(key, sizeof(*key)); free(key, M_ELI); key = ekey; TAILQ_REMOVE(&sc->sc_ekeys_queue, key, gek_next); @@ -174,7 +174,7 @@ g_eli_key_remove(struct g_eli_softc *sc, struct g_eli_ RB_REMOVE(g_eli_key_tree, &sc->sc_ekeys_tree, key); TAILQ_REMOVE(&sc->sc_ekeys_queue, key, gek_next); sc->sc_ekeys_allocated--; - bzero(key, sizeof(*key)); + explicit_bzero(key, sizeof(*key)); free(key, M_ELI); } @@ -239,7 +239,7 @@ g_eli_key_destroy(struct g_eli_softc *sc) mtx_lock(&sc->sc_ekeys_lock); if ((sc->sc_flags & G_ELI_FLAG_SINGLE_KEY) != 0) { - bzero(sc->sc_ekey, sizeof(sc->sc_ekey)); + explicit_bzero(sc->sc_ekey, sizeof(sc->sc_ekey)); } else { struct g_eli_key *key; From owner-svn-src-stable-11@freebsd.org Wed Feb 20 23:55:41 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33B3414E1840; Wed, 20 Feb 2019 23:55:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF19275DE0; Wed, 20 Feb 2019 23:55:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B258ECF66; Wed, 20 Feb 2019 23:55:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1KNte03094564; Wed, 20 Feb 2019 23:55:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1KNtZ3c094540; Wed, 20 Feb 2019 23:55:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902202355.x1KNtZ3c094540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Feb 2019 23:55:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344399 - in stable/11: . share/mk stand stand/common stand/efi/boot1 stand/efi/libefi stand/efi/loader stand/i386 stand/i386/boot2 stand/i386/common stand/i386/gptboot stand/i386/gptzf... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: . share/mk stand stand/common stand/efi/boot1 stand/efi/libefi stand/efi/loader stand/i386 stand/i386/boot2 stand/i386/common stand/i386/gptboot stand/i386/gptzfsboot stand/i386/isoboot ... X-SVN-Commit-Revision: 344399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CF19275DE0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 23:55:41 -0000 Author: kevans Date: Wed Feb 20 23:55:35 2019 New Revision: 344399 URL: https://svnweb.freebsd.org/changeset/base/344399 Log: MFC GELI Loader Improvements: r336252, r336254, r336256, r336354, r336532-r336534, r336537, r336626, r337326, r337349, r341071, r341160, r341420, r341473, r341651, r342793 Note that this MFC contains some seemingly unrelated zfsloader bits -- this was needed in order to pull in some later fixes for GELI hand-off w/ ZFS bits included. r336252: Extend loader(8) geli support to all architectures and all disk-like devices. This moves the bulk of the geli support from lib386/biosdisk.c into a new geli/gelidev.c which implements a devsw-type device whose dv_strategy() function handles geli decryption. Support for all arches comes from moving the taste-and-attach code to the devopen() function in libsa. After opening any DEVT_DISK device, devopen() calls the new function geli_probe_and_attach(), which will "attach" the geli code to the open_file struct by creating a geli_devdesc instance to replace the disk_devdesc instance in the open_file. That routes all IO for the device through the geli code. A new public geli_add_key() function is added, to allow arch/vendor-specific code to add keys obtained from custom hardware or other sources. With these changes, geli support will be compiled into all variations of loader(8) on all arches because the default is WITH_LOADER_GELI. r336254: Use if rather than case for a simple boolean. gcc thinks blks is undefined sometimes with the case, but enc is always 0 or 1, so and if / else is better anyway. r336256: Fix glitched indentation (and rewrap as needed due to deeper indent). No functional changes. r336354: zfsboot: fix build with WITHOUT_LOADER_GELI r336532: Collapse zfsloader functionality back down into loader. We no longer really need a separate zfsloader. It was useful when we were first supporting ZFS and had limited ability to properly boot off of ZFS without the special boot loader. Now that the boot loader has matured, go the way loader.efi pioneered and just build one binary. Change the name of the loader to load in the secondary boot blocks to be just /boot/loader. Provide a symbolic link from zfsloader to loader so people who have not upgraded their boot blocks are not affected. This has the happy benefit of making coexistence easier as well (fewer binaries in the matrix). r336533: Eliminate zfsloader man page. Remove all cross references to zfsloader.8 and /boot/zfsloader. Move ZFS specific info into loader.8. r336534: NM and OBJCOPY are already defined for all builds. There's no need to conditionally define them here. r336537: Mention zfsloader being folded into loader in UPDATING. r336626: Older zfs boot blocks don't support symlinks. install the link to zfsloader as a hard link. While newer ones do, the whole point of the link was to transition to the new world order smoothly. A hard link is less flexible, but it works and will result in fewer bumps. Adjust UPDATING entry to match. r337326: loader: biosdisk.c has leftover geli header. A small cleanup, remove unneeded #include. r337349: zfsboot: Fix startup crash On a FreeNAS mini XL, with geli encrypted drives the loader crashed in geli_read(). When we iterate over the list of disks and allocate the zfsdsk structures we don’t zero out the gdev pointer. In one case that resulted in geli_read() (called on the bogus pointer) dividing by zero. Use calloc() to ensure the zfsdsk structure is always zeroed, so the pointer is initialised to NULL. As a side benefit it gets rid of one #ifdef LOADER_GELI_SUPPORT. r341071: Restore the ability to override the disk unit/partition at the boot: prompt in gptboot. When arch-independent geli support was added, a new static 'gdsk' struct was added, but there was still a static 'dsk' struct, and when you typed in an alternate disk/partition, the string was parsed into that struct, which was then never used for anything. Now the string gets parsed into gdsk.dsk, the struct that's actually used. r341160: Add comments describing the bootargs handoff between loader(8) and gptboot or zfsboot, when loader(8) is the BTX loader. No functional changes. r341420: Eliminate duplicated code and struct member definitions in the handoff of args data between gptboot/zfsboot and loader(8). Despite what seems like a lot of changes here, there are no actual changes in behavior, or in the data layout in the structures involved. This is just eliminating identical code pasted into multiple locations. In detail, the changes are... - Move struct zfs_boot_args definition from libsa/zfs/libzfs.h to i386/common/bootargs.h because it is specific to x86 booting and the handoff between zfsboot and loader, and has no relation to the zfs library code in general. - The geli_boot_args and zfs_boot_args structs both contain an identical set of member variables containing geli information. Extract this out to a new geli_boot_data struct, and embed it in the arg-passing structs. - Provide new routines geli_import_boot_data() and geli_export_boot_data() that can be shared between gptboot, zfsboot, and loader instead of pasting identical code into several different .c files. - Remove some checks for a NULL pointer that can never be true because the pointer being tested was set using pointer math (kargs + 1) and that can never result in NULL in this code. r341473: Fix args cross-threading between gptboot(8) and loader(8) with zfs support. When loader(8) is built with zfs support enabled, it assumes that any extarg data present is a zfs_boot_args struct, but if the first-stage loader was gptboot(8) the extarg data is actually a geli_boot_args struct. Luckily, zfsboot(8) and gptzfsboot(8) have always passed KARGS_FLAGS_ZFS along with KARGS_FLAGS_EXTARG, so we can use KARGS_FLAGS_ZFS to decide whether the extarg data is a zfs_boot_args struct. To avoid similar problems in the future, gptboot(8) now passes a new KARGS_FLAGS_GELI to indicate that extarg data is geli_boot_args. In loader(8), if the neither KARGS_FLAGS_ZFS nor KARGS_FLAGS_GELI is set but extarg data is present (which will be the case for gptboot compiled before this change), we now check for the known size of the geli_boot_args struct passed by the older versions of gptboot as a way of confirming what type of extarg data is present. In a semi-related tidying up, since loader's main() has already decided what type of extarg data is present and set the global 'zargs' var accordingly, don't repeat the check in extract_currdev, just check whether zargs is NULL or not. r341651: Don't reference zfs-specific variables if LOADER_ZFS_SUPPORT is undefined because the variables will be undefined too. r342793: MK_ZFS -> {MK_ZFS|MK_LOADER_ZFS}, this is so we can diable userland / kernel ZFS but keep the boot-loaders when using ZoL port. Relnotes: yes (GELI support extended) Relnotes: yes (zfsloader has been collapsed into loader and may be removed after boot blocks have been updated) Added: stable/11/stand/libsa/geli/geli_metadata.c - copied unchanged from r336252, head/stand/libsa/geli/geli_metadata.c stable/11/stand/libsa/geli/gelidev.c - copied unchanged from r336252, head/stand/libsa/geli/gelidev.c stable/11/tools/build/options/WITHOUT_LOADER_ZFS - copied unchanged from r342793, head/tools/build/options/WITHOUT_LOADER_ZFS Deleted: stable/11/stand/i386/zfsloader/Makefile stable/11/stand/man/zfsloader.8 stable/11/stand/sparc64/zfsloader/Makefile Modified: stable/11/.gitattributes stable/11/UPDATING stable/11/share/mk/src.opts.mk stable/11/stand/common/devopen.c stable/11/stand/common/metadata.c stable/11/stand/common/paths.h stable/11/stand/defs.mk stable/11/stand/efi/boot1/Makefile stable/11/stand/efi/libefi/Makefile stable/11/stand/efi/loader/Makefile stable/11/stand/efi/loader/bootinfo.c stable/11/stand/i386/Makefile stable/11/stand/i386/boot2/Makefile stable/11/stand/i386/common/bootargs.h stable/11/stand/i386/gptboot/Makefile stable/11/stand/i386/gptboot/gptboot.c stable/11/stand/i386/gptzfsboot/Makefile stable/11/stand/i386/gptzfsboot/gptzfsboot.8 stable/11/stand/i386/isoboot/Makefile stable/11/stand/i386/libi386/Makefile stable/11/stand/i386/libi386/biosdisk.c stable/11/stand/i386/libi386/bootinfo32.c stable/11/stand/i386/libi386/bootinfo64.c stable/11/stand/i386/loader/Makefile stable/11/stand/i386/loader/main.c stable/11/stand/i386/zfsboot/Makefile stable/11/stand/i386/zfsboot/zfsboot.8 stable/11/stand/i386/zfsboot/zfsboot.c stable/11/stand/libsa/Makefile stable/11/stand/libsa/geli/Makefile.inc stable/11/stand/libsa/geli/geliboot.c stable/11/stand/libsa/geli/geliboot.h stable/11/stand/libsa/geli/geliboot_crypto.c stable/11/stand/libsa/geli/geliboot_internal.h stable/11/stand/libsa/zfs/libzfs.h stable/11/stand/loader.mk stable/11/stand/lua/core.lua.8 stable/11/stand/man/Makefile stable/11/stand/man/loader.8 stable/11/stand/sparc64/Makefile stable/11/stand/sparc64/loader/Makefile stable/11/stand/userboot/userboot/Makefile stable/11/stand/userboot/userboot/bootinfo32.c stable/11/tools/build/options/WITHOUT_ZFS Directory Properties: stable/11/ (props changed) Modified: stable/11/.gitattributes ============================================================================== --- stable/11/.gitattributes Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/.gitattributes Wed Feb 20 23:55:35 2019 (r344399) @@ -3,3 +3,4 @@ *.cpp diff=cpp *.hpp diff=cpp *.py diff=python +. svn-properties=svn:keywords=tools/build/options/WITHOUT_LOADER_ZFS Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/UPDATING Wed Feb 20 23:55:35 2019 (r344399) @@ -16,6 +16,14 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20190220: + zfsloader's functionality has now been folded into loader. + zfsloader is no longer necesasary once you've updated your + boot blocks. For a transition period, we will install a + hardlink for zfsloader to loader to allow a smooth transition + until the boot blocks can be updated (hard link because old + zfs boot blocks don't understand symlinks). + 20190216: Lualoader has been merged to facilitate testing on this branch. It's purely opt-in for now by building WITH_LOADER_LUA and WITHOUT_FORTH in Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/share/mk/src.opts.mk Wed Feb 20 23:55:35 2019 (r344399) @@ -183,6 +183,7 @@ __DEFAULT_YES_OPTIONS = \ WIRELESS \ WPA_SUPPLICANT_EAPOL \ ZFS \ + LOADER_ZFS \ ZONEINFO __DEFAULT_NO_OPTIONS = \ @@ -290,10 +291,6 @@ BROKEN_OPTIONS+=LIBSOFT ${__T:Mriscv*} BROKEN_OPTIONS+=EFI .endif -# GELI isn't supported on !x86 -.if ${__T} != "i386" && ${__T} != "amd64" -BROKEN_OPTIONS+=LOADER_GELI -.endif # OFW is only for powerpc and sparc64, exclude others .if ${__T:Mpowerpc*} == "" && ${__T:Msparc64} == "" BROKEN_OPTIONS+=LOADER_OFW @@ -377,6 +374,7 @@ MK_SOURCELESS_UCODE:= no .if ${MK_CDDL} == "no" MK_ZFS:= no +MK_LOADER_ZFS:= no MK_CTF:= no .endif Modified: stable/11/stand/common/devopen.c ============================================================================== --- stable/11/stand/common/devopen.c Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/common/devopen.c Wed Feb 20 23:55:35 2019 (r344399) @@ -32,6 +32,10 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" +#ifdef LOADER_GELI_SUPPORT +#include "geliboot.h" +#endif + int devopen(struct open_file *f, const char *fname, const char **file) { @@ -43,6 +47,7 @@ devopen(struct open_file *f, const char *fname, const return (result); /* point to device-specific data so that device open can use it */ + f->f_dev = dev->d_dev; f->f_devdata = dev; result = dev->d_dev->dv_open(f, dev); if (result != 0) { @@ -51,8 +56,17 @@ devopen(struct open_file *f, const char *fname, const return (result); } - /* reference the devsw entry from the open_file structure */ - f->f_dev = dev->d_dev; +#ifdef LOADER_GELI_SUPPORT + /* + * If f->f_dev is geli-encrypted and we can decrypt it (will prompt for + * pw if needed), this will attach the geli code to the open_file by + * replacing f->f_dev and f_devdata with pointers to a geli_devdesc. + */ + if (f->f_dev->dv_type == DEVT_DISK) { + geli_probe_and_attach(f); + } +#endif + return (0); } Modified: stable/11/stand/common/metadata.c ============================================================================== --- stable/11/stand/common/metadata.c Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/common/metadata.c Wed Feb 20 23:55:35 2019 (r344399) @@ -45,6 +45,10 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" +#ifdef LOADER_GELI_SUPPORT +#include "geliboot.h" +#endif + #if defined(__sparc64__) #include @@ -355,7 +359,9 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offs #endif file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend); } - +#ifdef LOADER_GELI_SUPPORT + geli_export_key_metadata(kfp); +#endif #if defined(__sparc64__) file_addmetadata(kfp, MODINFOMD_DTLB_SLOTS, sizeof dtlb_slot, &dtlb_slot); Modified: stable/11/stand/common/paths.h ============================================================================== --- stable/11/stand/common/paths.h Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/common/paths.h Wed Feb 20 23:55:35 2019 (r344399) @@ -33,7 +33,6 @@ #define PATH_CONFIG "/boot/config" #define PATH_LOADER "/boot/loader" #define PATH_LOADER_EFI "/boot/loader.efi" -#define PATH_LOADER_ZFS "/boot/zfsloader" #define PATH_KERNEL "/boot/kernel/kernel" #endif /* _PATHS_H_ */ Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/defs.mk Wed Feb 20 23:55:35 2019 (r344399) @@ -56,7 +56,6 @@ CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=floaty-mc # GELI Support, with backward compat hooks (mostly) -.if defined(HAVE_GELI) .if defined(LOADER_NO_GELI_SUPPORT) MK_LOADER_GELI=no .warning "Please move from LOADER_NO_GELI_SUPPORT to WITHOUT_LOADER_GELI" @@ -69,7 +68,6 @@ MK_LOADER_GELI=yes CFLAGS+= -DLOADER_GELI_SUPPORT CFLAGS+= -I${SASRC}/geli .endif # MK_LOADER_GELI -.endif # HAVE_GELI # These should be confined to loader.mk, but can't because uboot/lib # also uses it. It's part of loader, but isn't a loader so we can't Modified: stable/11/stand/efi/boot1/Makefile ============================================================================== --- stable/11/stand/efi/boot1/Makefile Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/efi/boot1/Makefile Wed Feb 20 23:55:35 2019 (r344399) @@ -24,7 +24,7 @@ CWARNFLAGS.zfs_module.c += -Wno-unused-function # architecture-specific loader code SRCS= boot1.c self_reloc.c start.S ufs_module.c -.if ${MK_ZFS} != "no" +.if ${MK_LOADER_ZFS} != "no" SRCS+= zfs_module.c CFLAGS.zfs_module.c+= -I${ZFSSRC} CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs @@ -75,9 +75,6 @@ DPADD+= ${LIBEFI} ${LIBSA} LDADD+= ${LIBEFI} ${LIBSA} DPADD+= ${LDSCRIPT} - -NM?= nm -OBJCOPY?= objcopy .if ${MACHINE_CPUARCH} == "amd64" EFI_TARGET= efi-app-x86_64 Modified: stable/11/stand/efi/libefi/Makefile ============================================================================== --- stable/11/stand/efi/libefi/Makefile Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/efi/libefi/Makefile Wed Feb 20 23:55:35 2019 (r344399) @@ -44,7 +44,7 @@ CFLAGS+= -fPIC -mno-red-zone .endif CFLAGS+= -I${EFIINC} CFLAGS+= -I${EFIINCMD} -.if ${MK_ZFS} != "no" +.if ${MK_LOADER_ZFS} != "no" CFLAGS+= -I${ZFSSRC} CFLAGS+= -DEFI_ZFS_BOOT .endif Modified: stable/11/stand/efi/loader/Makefile ============================================================================== --- stable/11/stand/efi/loader/Makefile Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/efi/loader/Makefile Wed Feb 20 23:55:35 2019 (r344399) @@ -24,7 +24,7 @@ SRCS= autoload.c \ smbios.c \ vers.c -.if ${MK_ZFS} != "no" +.if ${MK_LOADER_ZFS} != "no" CFLAGS+= -I${ZFSSRC} CFLAGS+= -DEFI_ZFS_BOOT HAVE_ZFS= yes @@ -90,9 +90,6 @@ LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -share CLEANFILES+= loader.efi NEWVERSWHAT= "EFI loader" ${MACHINE} - -NM?= nm -OBJCOPY?= objcopy .if ${MACHINE_CPUARCH} == "amd64" EFI_TARGET= efi-app-x86_64 Modified: stable/11/stand/efi/loader/bootinfo.c ============================================================================== --- stable/11/stand/efi/loader/bootinfo.c Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/efi/loader/bootinfo.c Wed Feb 20 23:55:35 2019 (r344399) @@ -56,6 +56,10 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef LOADER_GELI_SUPPORT +#include "geliboot.h" +#endif + int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); extern EFI_SYSTEM_TABLE *ST; @@ -452,7 +456,9 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t #endif file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend); file_addmetadata(kfp, MODINFOMD_FW_HANDLE, sizeof ST, &ST); - +#ifdef LOADER_GELI_SUPPORT + geli_export_key_metadata(kfp); +#endif bi_load_efi_data(kfp); /* Figure out the size and location of the metadata. */ Modified: stable/11/stand/i386/Makefile ============================================================================== --- stable/11/stand/i386/Makefile Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/i386/Makefile Wed Feb 20 23:55:35 2019 (r344399) @@ -18,6 +18,6 @@ SUBDIR.yes+= pxeldr SUBDIR.yes+= kgzldr .endif -SUBDIR.${MK_ZFS}+= zfsboot gptzfsboot zfsloader +SUBDIR.${MK_LOADER_ZFS}+= zfsboot gptzfsboot .include Modified: stable/11/stand/i386/boot2/Makefile ============================================================================== --- stable/11/stand/i386/boot2/Makefile Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/i386/boot2/Makefile Wed Feb 20 23:55:35 2019 (r344399) @@ -4,8 +4,6 @@ FILES= boot boot1 boot2 -NM?= nm - # A value of 0x80 enables LBA support. BOOT_BOOT1_FLAGS?= 0x80 Modified: stable/11/stand/i386/common/bootargs.h ============================================================================== --- stable/11/stand/i386/common/bootargs.h Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/i386/common/bootargs.h Wed Feb 20 23:55:35 2019 (r344399) @@ -18,10 +18,11 @@ #ifndef _BOOT_I386_ARGS_H_ #define _BOOT_I386_ARGS_H_ -#define KARGS_FLAGS_CD 0x1 -#define KARGS_FLAGS_PXE 0x2 -#define KARGS_FLAGS_ZFS 0x4 -#define KARGS_FLAGS_EXTARG 0x8 /* variably sized extended argument */ +#define KARGS_FLAGS_CD 0x0001 /* .bootdev is a bios CD dev */ +#define KARGS_FLAGS_PXE 0x0002 /* .pxeinfo is valid */ +#define KARGS_FLAGS_ZFS 0x0004 /* .zfspool is valid, EXTARG is zfs_boot_args */ +#define KARGS_FLAGS_EXTARG 0x0008 /* variably sized extended argument */ +#define KARGS_FLAGS_GELI 0x0010 /* EXTARG is geli_boot_args */ #define BOOTARGS_SIZE 24 /* sizeof(struct bootargs) */ #define BA_BOOTFLAGS 8 /* offsetof(struct bootargs, bootflags) */ @@ -43,6 +44,24 @@ #ifndef __ASSEMBLER__ +/* + * This struct describes the contents of the stack on entry to btxldr.S. This + * is the data that follows the return address, so it begins at 4(%esp). On + * the sending side, this data is passed as individual args to __exec(). On the + * receiving side, code in btxldr.S copies the data from the entry stack to a + * known fixed location in the new address space. Then, btxcsu.S sets the + * global variable __args to point to that known fixed location before calling + * main(), which casts __args to a struct bootargs pointer to access the data. + * The btxldr.S code is aware of KARGS_FLAGS_EXTARG, and if it's set, the extra + * args data is copied along with the other bootargs from the entry stack to the + * fixed location in the new address space. + * + * The bootinfo field is actually a pointer to a bootinfo struct that has been + * converted to uint32_t using VTOP(). On the receiving side it must be + * converted back to a pointer using PTOV(). Code in btxldr.S is aware of this + * field and if it's non-NULL it copies the data it points to into another known + * fixed location, and adjusts the bootinfo field to point to that new location. + */ struct bootargs { uint32_t howto; @@ -66,11 +85,15 @@ struct bootargs #ifdef LOADER_GELI_SUPPORT #include +#include "geliboot.h" #endif -struct geli_boot_args +/* + * geli_boot_data is embedded in geli_boot_args (passed from gptboot to loader) + * and in zfs_boot_args (passed from zfsboot and gptzfsboot to loader). + */ +struct geli_boot_data { - uint32_t size; union { char gelipw[256]; struct { @@ -86,6 +109,49 @@ struct geli_boot_args #endif }; }; +}; + +#ifdef LOADER_GELI_SUPPORT + +static inline void +export_geli_boot_data(struct geli_boot_data *gbdata) +{ + + gbdata->notapw = '\0'; + gbdata->keybuf_sentinel = KEYBUF_SENTINEL; + gbdata->keybuf = malloc(sizeof(struct keybuf) + + (GELI_MAX_KEYS * sizeof(struct keybuf_ent))); + geli_export_key_buffer(gbdata->keybuf); +} + +static inline void +import_geli_boot_data(struct geli_boot_data *gbdata) +{ + + if (gbdata->gelipw[0] != '\0') { + setenv("kern.geom.eli.passphrase", gbdata->gelipw, 1); + explicit_bzero(gbdata->gelipw, sizeof(gbdata->gelipw)); + } else if (gbdata->keybuf_sentinel == KEYBUF_SENTINEL) { + geli_import_key_buffer(gbdata->keybuf); + } +} +#endif /* LOADER_GELI_SUPPORT */ + +struct geli_boot_args +{ + uint32_t size; + struct geli_boot_data gelidata; +}; + +struct zfs_boot_args +{ + uint32_t size; + uint32_t reserved; + uint64_t pool; + uint64_t root; + uint64_t primary_pool; + uint64_t primary_vdev; + struct geli_boot_data gelidata; }; #endif /*__ASSEMBLER__*/ Modified: stable/11/stand/i386/gptboot/Makefile ============================================================================== --- stable/11/stand/i386/gptboot/Makefile Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/i386/gptboot/Makefile Wed Feb 20 23:55:35 2019 (r344399) @@ -1,15 +1,11 @@ # $FreeBSD$ -HAVE_GELI= yes - .include .PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common ${SASRC} FILES= gptboot MAN= gptboot.8 - -NM?= nm BOOT_COMCONSOLE_PORT?= 0x3f8 BOOT_COMCONSOLE_SPEED?= 9600 Modified: stable/11/stand/i386/gptboot/gptboot.c ============================================================================== --- stable/11/stand/i386/gptboot/gptboot.c Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/i386/gptboot/gptboot.c Wed Feb 20 23:55:35 2019 (r344399) @@ -81,7 +81,6 @@ uint32_t opts; static const char *const dev_nm[NDEV] = {"ad", "da", "fd"}; static const unsigned char dev_maj[NDEV] = {30, 4, 2}; -static struct dsk dsk; static char kname[1024]; static int comspeed = SIOSPD; static struct bootinfo bootinfo; @@ -113,11 +112,19 @@ static int vdev_read(void *vdev __unused, void *priv, #include "ufsread.c" #include "gpt.c" #ifdef LOADER_GELI_SUPPORT -#include "geliboot.c" +#include "geliboot.h" static char gelipw[GELI_PW_MAXLEN]; -static struct keybuf *gelibuf; #endif +struct gptdsk { + struct dsk dsk; +#ifdef LOADER_GELI_SUPPORT + struct geli_dev *gdev; +#endif +}; + +static struct gptdsk gdsk; + static inline int xfsread(ufs_ino_t inode, void *buf, size_t nbyte) { @@ -225,19 +232,21 @@ static int gptinit(void) { - if (gptread(&freebsd_ufs_uuid, &dsk, dmadat->secbuf) == -1) { + if (gptread(&freebsd_ufs_uuid, &gdsk.dsk, dmadat->secbuf) == -1) { printf("%s: unable to load GPT\n", BOOTPROG); return (-1); } - if (gptfind(&freebsd_ufs_uuid, &dsk, dsk.part) == -1) { + if (gptfind(&freebsd_ufs_uuid, &gdsk.dsk, gdsk.dsk.part) == -1) { printf("%s: no UFS partition was found\n", BOOTPROG); return (-1); } #ifdef LOADER_GELI_SUPPORT - if (geli_taste(vdev_read, &dsk, (gpttable[curent].ent_lba_end - - gpttable[curent].ent_lba_start)) == 0) { - if (geli_havekey(&dsk) != 0 && geli_passphrase(gelipw, - dsk.unit, 'p', curent + 1, &dsk) != 0) { + gdsk.gdev = geli_taste(vdev_read, &gdsk.dsk, + (gpttable[curent].ent_lba_end - gpttable[curent].ent_lba_start), + "disk%up%u:", gdsk.dsk.unit, curent + 1); + if (gdsk.gdev != NULL) { + if (geli_havekey(gdsk.gdev) != 0 && + geli_passphrase(gdsk.gdev, gelipw) != 0) { printf("%s: unable to decrypt GELI key\n", BOOTPROG); return (-1); } @@ -273,21 +282,18 @@ main(void) v86.ctl = V86_FLAGS; v86.efl = PSL_RESERVED_DEFAULT | PSL_I; - dsk.drive = *(uint8_t *)PTOV(ARGS); - dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD; - dsk.unit = dsk.drive & DRV_MASK; - dsk.part = -1; - dsk.start = 0; + gdsk.dsk.drive = *(uint8_t *)PTOV(ARGS); + gdsk.dsk.type = gdsk.dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD; + gdsk.dsk.unit = gdsk.dsk.drive & DRV_MASK; + gdsk.dsk.part = -1; + gdsk.dsk.start = 0; bootinfo.bi_version = BOOTINFO_VERSION; bootinfo.bi_size = sizeof(bootinfo); bootinfo.bi_basemem = bios_basemem / 1024; bootinfo.bi_extmem = bios_extmem / 1024; bootinfo.bi_memsizes_valid++; - bootinfo.bi_bios_dev = dsk.drive; + bootinfo.bi_bios_dev = gdsk.dsk.drive; -#ifdef LOADER_GELI_SUPPORT - geli_init(); -#endif /* Process configuration file */ if (gptinit() != 0) @@ -332,8 +338,8 @@ main(void) load(); memcpy(kname, PATH_KERNEL, sizeof(PATH_KERNEL)); load(); - gptbootfailed(&dsk); - if (gptfind(&freebsd_ufs_uuid, &dsk, -1) == -1) + gptbootfailed(&gdsk.dsk); + if (gptfind(&freebsd_ufs_uuid, &gdsk.dsk, -1) == -1) break; dsk_meta = 0; } @@ -345,8 +351,8 @@ main(void) printf("\nFreeBSD/x86 boot\n" "Default: %u:%s(%up%u)%s\n" "boot: ", - dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, - dsk.part, kname); + gdsk.dsk.drive & DRV_MASK, dev_nm[gdsk.dsk.type], + gdsk.dsk.unit, gdsk.dsk.part, kname); } if (ioctrl & IO_SERIAL) sio_flush(); @@ -392,9 +398,9 @@ load(void) if (!(ino = lookup(kname))) { if (!ls) { printf("%s: No %s on %u:%s(%up%u)\n", BOOTPROG, - kname, dsk.drive & DRV_MASK, dev_nm[dsk.type], - dsk.unit, - dsk.part); + kname, gdsk.dsk.drive & DRV_MASK, + dev_nm[gdsk.dsk.type], gdsk.dsk.unit, + gdsk.dsk.part); } return; } @@ -469,21 +475,22 @@ load(void) } bootinfo.bi_esymtab = VTOP(p); bootinfo.bi_kernelname = VTOP(kname); - bootinfo.bi_bios_dev = dsk.drive; + bootinfo.bi_bios_dev = gdsk.dsk.drive; #ifdef LOADER_GELI_SUPPORT geliargs.size = sizeof(geliargs); explicit_bzero(gelipw, sizeof(gelipw)); - gelibuf = malloc(sizeof(struct keybuf) + - (GELI_MAX_KEYS * sizeof(struct keybuf_ent))); - geli_fill_keybuf(gelibuf); - geliargs.notapw = '\0'; - geliargs.keybuf_sentinel = KEYBUF_SENTINEL; - geliargs.keybuf = gelibuf; + export_geli_boot_data(&geliargs.gelidata); #endif + /* + * Note that the geliargs struct is passed by value, not by pointer. + * Code in btxldr.S copies the values from the entry stack to a fixed + * location within loader(8) at startup due to the presence of the + * KARGS_FLAGS_EXTARG flag. + */ __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), - MAKEBOOTDEV(dev_maj[dsk.type], dsk.part + 1, dsk.unit, 0xff), + MAKEBOOTDEV(dev_maj[gdsk.dsk.type], gdsk.dsk.part + 1, gdsk.dsk.unit, 0xff), #ifdef LOADER_GELI_SUPPORT - KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo), geliargs + KARGS_FLAGS_GELI | KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo), geliargs #else 0, 0, 0, VTOP(&bootinfo) #endif @@ -561,22 +568,22 @@ parse_cmds(char *cmdstr, int *dskupdated) arg[1] != dev_nm[i][1]; i++) if (i == NDEV - 1) return (-1); - dsk.type = i; + gdsk.dsk.type = i; arg += 3; - dsk.unit = *arg - '0'; - if (arg[1] != 'p' || dsk.unit > 9) + gdsk.dsk.unit = *arg - '0'; + if (arg[1] != 'p' || gdsk.dsk.unit > 9) return (-1); arg += 2; - dsk.part = *arg - '0'; - if (dsk.part < 1 || dsk.part > 9) + gdsk.dsk.part = *arg - '0'; + if (gdsk.dsk.part < 1 || gdsk.dsk.part > 9) return (-1); arg++; if (arg[0] != ')') return (-1); arg++; if (drv == -1) - drv = dsk.unit; - dsk.drive = (dsk.type <= TYPE_MAXHARD + drv = gdsk.dsk.unit; + gdsk.dsk.drive = (gdsk.dsk.type <= TYPE_MAXHARD ? DRV_HARD : 0) + drv; *dskupdated = 1; } @@ -596,12 +603,13 @@ dskread(void *buf, daddr_t lba, unsigned nblk) { int err; - err = drvread(&dsk, buf, lba + dsk.start, nblk); + err = drvread(&gdsk.dsk, buf, lba + gdsk.dsk.start, nblk); #ifdef LOADER_GELI_SUPPORT - if (err == 0 && is_geli(&dsk) == 0) { + if (err == 0 && gdsk.gdev != NULL) { /* Decrypt */ - if (geli_read(&dsk, lba * DEV_BSIZE, buf, nblk * DEV_BSIZE)) + if (geli_read(gdsk.gdev, lba * DEV_BSIZE, buf, + nblk * DEV_BSIZE)) return (err); } #endif @@ -611,8 +619,8 @@ dskread(void *buf, daddr_t lba, unsigned nblk) #ifdef LOADER_GELI_SUPPORT /* - * Read function compartible with the ZFS callback, required to keep the GELI - * Implementation the same for both UFS and ZFS + * Read function compatible with the ZFS callback, required to keep the GELI + * implementation the same for both UFS and ZFS. */ static int vdev_read(void *vdev __unused, void *priv, off_t off, void *buf, size_t bytes) @@ -620,22 +628,22 @@ vdev_read(void *vdev __unused, void *priv, off_t off, char *p; daddr_t lba; unsigned int nb; - struct dsk *dskp; + struct gptdsk *dskp; - dskp = (struct dsk *)priv; + dskp = (struct gptdsk *)priv; if ((off & (DEV_BSIZE - 1)) || (bytes & (DEV_BSIZE - 1))) return (-1); p = buf; lba = off / DEV_BSIZE; - lba += dskp->start; + lba += dskp->dsk.start; while (bytes > 0) { nb = bytes / DEV_BSIZE; if (nb > VBLKSIZE / DEV_BSIZE) nb = VBLKSIZE / DEV_BSIZE; - if (drvread(dskp, dmadat->blkbuf, lba, nb)) + if (drvread(&dskp->dsk, dmadat->blkbuf, lba, nb)) return (-1); memcpy(p, dmadat->blkbuf, nb * DEV_BSIZE); p += nb * DEV_BSIZE; Modified: stable/11/stand/i386/gptzfsboot/Makefile ============================================================================== --- stable/11/stand/i386/gptzfsboot/Makefile Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/i386/gptzfsboot/Makefile Wed Feb 20 23:55:35 2019 (r344399) @@ -1,7 +1,5 @@ # $FreeBSD$ -HAVE_GELI= yes - .include .PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \ @@ -10,8 +8,6 @@ HAVE_GELI= yes FILES= gptzfsboot MAN= gptzfsboot.8 - -NM?= nm BOOT_COMCONSOLE_PORT?= 0x3f8 BOOT_COMCONSOLE_SPEED?= 9600 Modified: stable/11/stand/i386/gptzfsboot/gptzfsboot.8 ============================================================================== --- stable/11/stand/i386/gptzfsboot/gptzfsboot.8 Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/i386/gptzfsboot/gptzfsboot.8 Wed Feb 20 23:55:35 2019 (r344399) @@ -71,7 +71,7 @@ If the .Cm bootfs property is not set, then the root filesystem of the pool is used as the default. -.Xr zfsloader 8 +.Xr loader 8 is loaded from the boot filesystem. If .Pa /boot.config @@ -83,7 +83,7 @@ in the same way as .Pp The ZFS GUIDs of the first successfully probed device and the first detected pool are made available to -.Xr zfsloader 8 +.Xr loader 8 in the .Cm vfs.zfs.boot.primary_vdev and @@ -104,7 +104,7 @@ accepts all the options that supports. .Pp The filesystem specification and the path to -.Xr zfsloader 8 +.Xr loader 8 are different from .Xr boot 8 . The format is @@ -116,7 +116,7 @@ The format is Both the filesystem and the path can be specified. If only a path is specified, then the default filesystem is used. If only a pool and filesystem are specified, then -.Pa /boot/zfsloader +.Pa /boot/loader is used as a path. .Pp Additionally, the @@ -128,7 +128,7 @@ The output format is similar to that of .Pp The configured or automatically determined ZFS boot filesystem is stored in the -.Xr zfsloader 8 +.Xr loader 8 .Cm loaddev variable, and also set as the initial value of the .Cm currdev @@ -171,7 +171,6 @@ gpart bootcode -p /boot/gptzfsboot -i 1 ada0 .Xr boot 8 , .Xr gpart 8 , .Xr loader 8 , -.Xr zfsloader 8 , .Xr zpool 8 .Sh HISTORY .Nm Modified: stable/11/stand/i386/isoboot/Makefile ============================================================================== --- stable/11/stand/i386/isoboot/Makefile Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/i386/isoboot/Makefile Wed Feb 20 23:55:35 2019 (r344399) @@ -1,7 +1,5 @@ # $FreeBSD$ -HAVE_GELI= yes - .include .PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \ @@ -9,8 +7,6 @@ HAVE_GELI= yes FILES= isoboot MAN= isoboot.8 - -NM?= nm BOOT_COMCONSOLE_PORT?= 0x3f8 BOOT_COMCONSOLE_SPEED?= 9600 Modified: stable/11/stand/i386/libi386/Makefile ============================================================================== --- stable/11/stand/i386/libi386/Makefile Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/i386/libi386/Makefile Wed Feb 20 23:55:35 2019 (r344399) @@ -1,7 +1,5 @@ # $FreeBSD$ -HAVE_GELI= yes - .include LIB= i386 Modified: stable/11/stand/i386/libi386/biosdisk.c ============================================================================== --- stable/11/stand/i386/libi386/biosdisk.c Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/i386/libi386/biosdisk.c Wed Feb 20 23:55:35 2019 (r344399) @@ -50,34 +50,6 @@ __FBSDID("$FreeBSD$"); #include "disk.h" #include "libi386.h" -#ifdef LOADER_GELI_SUPPORT -#include "cons.h" -#include "drv.h" -#include "gpt.h" -#include "part.h" -#include -struct pentry { - struct ptable_entry part; - uint64_t flags; - union { - uint8_t bsd; - uint8_t mbr; - uuid_t gpt; - uint16_t vtoc8; - } type; - STAILQ_ENTRY(pentry) entry; -}; -struct ptable { - enum ptable_type type; - uint16_t sectorsize; - uint64_t sectors; - - STAILQ_HEAD(, pentry) entries; -}; - -#include "geliboot.c" -#endif /* LOADER_GELI_SUPPORT */ - #define BIOS_NUMDRIVES 0x475 #define BIOSDISK_SECSIZE 512 #define BUFSIZE (1 * BIOSDISK_SECSIZE) @@ -138,17 +110,6 @@ static int bd_close(struct open_file *f); static int bd_ioctl(struct open_file *f, u_long cmd, void *data); static int bd_print(int verbose); -#ifdef LOADER_GELI_SUPPORT -enum isgeli { - ISGELI_UNKNOWN, - ISGELI_NO, - ISGELI_YES -}; -static enum isgeli geli_status[MAXBDDEV][MAXTBLENTS]; - -int bios_read(void *, void *, off_t off, void *buf, size_t bytes); -#endif /* LOADER_GELI_SUPPORT */ - struct devsw biosdisk = { "disk", DEVT_DISK, @@ -195,9 +156,6 @@ bd_init(void) { int base, unit, nfd = 0; -#ifdef LOADER_GELI_SUPPORT - geli_init(); -#endif /* sequence 0, 0x80 */ for (base = 0; base <= 0x80; base += 0x80) { for (unit = base; (nbdinfo < MAXBDDEV); unit++) { @@ -379,7 +337,7 @@ bd_print(int verbose) static int bd_open(struct open_file *f, ...) { - struct disk_devdesc *dev; + struct disk_devdesc *dev, rdev; struct disk_devdesc disk; int err, g_err; va_list ap; @@ -421,81 +379,6 @@ bd_open(struct open_file *f, ...) err = disk_open(dev, BD(dev).bd_sectors * BD(dev).bd_sectorsize, BD(dev).bd_sectorsize); -#ifdef LOADER_GELI_SUPPORT - static char gelipw[GELI_PW_MAXLEN]; - char *passphrase; - - if (err) - return (err); - - /* if we already know there is no GELI, skip the rest */ - if (geli_status[dev->dd.d_unit][dev->d_slice] != ISGELI_UNKNOWN) - return (err); - - struct dsk dskp; - struct ptable *table = NULL; - struct ptable_entry part; - struct pentry *entry; - int geli_part = 0; - - dskp.drive = bd_unit2bios(dev->dd.d_unit); - dskp.type = dev->dd.d_dev->dv_type; - dskp.unit = dev->dd.d_unit; - dskp.slice = dev->d_slice; - dskp.part = dev->d_partition; - dskp.start = dev->d_offset; - - /* We need the LBA of the end of the partition */ - table = ptable_open(&disk, BD(dev).bd_sectors, - BD(dev).bd_sectorsize, ptblread); - if (table == NULL) { - DEBUG("Can't read partition table"); - /* soft failure, return the exit status of disk_open */ - return (err); - } - - if (table->type == PTABLE_GPT) - dskp.part = 255; - - STAILQ_FOREACH(entry, &table->entries, entry) { - dskp.slice = entry->part.index; - dskp.start = entry->part.start; - if (is_geli(&dskp) == 0) { - geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_YES; - return (0); - } - if (geli_taste(bios_read, &dskp, - entry->part.end - entry->part.start) == 0) { - if (geli_havekey(&dskp) == 0) { - geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_YES; - geli_part++; - continue; - } - if ((passphrase = getenv("kern.geom.eli.passphrase")) - != NULL) { - /* Use the cached passphrase */ - bcopy(passphrase, &gelipw, GELI_PW_MAXLEN); - } - if (geli_passphrase(gelipw, dskp.unit, 'p', - (dskp.slice > 0 ? dskp.slice : dskp.part), - &dskp) == 0) { - setenv("kern.geom.eli.passphrase", gelipw, 1); - bzero(gelipw, sizeof(gelipw)); - geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_YES; - geli_part++; - continue; - } - } else - geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_NO; - } - - /* none of the partitions on this disk have GELI */ - if (geli_part == 0) { - /* found no GELI */ - geli_status[dev->dd.d_unit][dev->d_slice] = ISGELI_NO; - } -#endif /* LOADER_GELI_SUPPORT */ - return (err); } @@ -841,80 +724,7 @@ bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks static int bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest) { -#ifdef LOADER_GELI_SUPPORT - struct dsk dskp; - off_t p_off, diff; - daddr_t alignlba; - int err, n, alignblks; - char *tmpbuf; - /* if we already know there is no GELI, skip the rest */ - if (geli_status[dev->dd.d_unit][dev->d_slice] != ISGELI_YES) - return (bd_io(dev, dblk, blks, dest, 0)); - - if (geli_status[dev->dd.d_unit][dev->d_slice] == ISGELI_YES) { - /* - * Align reads to DEV_GELIBOOT_BSIZE bytes because partial - * sectors cannot be decrypted. Round the requested LBA down to - * nearest multiple of DEV_GELIBOOT_BSIZE bytes. - */ - alignlba = rounddown2(dblk * BD(dev).bd_sectorsize, - DEV_GELIBOOT_BSIZE) / BD(dev).bd_sectorsize; - /* - * Round number of blocks to read up to nearest multiple of - * DEV_GELIBOOT_BSIZE - */ - diff = (dblk - alignlba) * BD(dev).bd_sectorsize; - alignblks = roundup2(blks * BD(dev).bd_sectorsize + diff, - DEV_GELIBOOT_BSIZE) / BD(dev).bd_sectorsize; - - /* - * If the read is rounded up to a larger size, use a temporary - * buffer here because the buffer provided by the caller may be - * too small. - */ - if (diff == 0) { - tmpbuf = dest; - } else { - tmpbuf = malloc(alignblks * BD(dev).bd_sectorsize); - if (tmpbuf == NULL) { - return (-1); - } - } - - if (alignlba + alignblks > BD(dev).bd_sectors) { - DEBUG("Shorted read at %llu from %d to %llu blocks", - alignlba, alignblks, BD(dev).bd_sectors - alignlba); - alignblks = BD(dev).bd_sectors - alignlba; - } - - err = bd_io(dev, alignlba, alignblks, tmpbuf, 0); - if (err) - return (err); - - dskp.drive = bd_unit2bios(dev->dd.d_unit); - dskp.type = dev->dd.d_dev->dv_type; - dskp.unit = dev->dd.d_unit; - dskp.slice = dev->d_slice; - dskp.part = dev->d_partition; - dskp.start = dev->d_offset; - - /* GELI needs the offset relative to the partition start */ - p_off = alignlba - dskp.start; - - err = geli_read(&dskp, p_off * BD(dev).bd_sectorsize, (u_char *)tmpbuf, - alignblks * BD(dev).bd_sectorsize); - if (err) - return (err); - - if (tmpbuf != dest) { - bcopy(tmpbuf + diff, dest, blks * BD(dev).bd_sectorsize); - free(tmpbuf); - } - return (0); - } -#endif /* LOADER_GELI_SUPPORT */ - return (bd_io(dev, dblk, blks, dest, 0)); } @@ -1009,25 +819,3 @@ bd_getdev(struct i386_devdesc *d) DEBUG("dev is 0x%x\n", rootdev); return(rootdev); } - -#ifdef LOADER_GELI_SUPPORT -int -bios_read(void *vdev __unused, void *xpriv, off_t off, void *buf, size_t bytes) -{ - struct disk_devdesc dev; - struct dsk *priv = xpriv; - - dev.dd.d_dev = &biosdisk; - dev.dd.d_unit = priv->unit; - dev.d_slice = priv->slice; - dev.d_partition = priv->part; - dev.d_offset = priv->start; - - off = off / BD(&dev).bd_sectorsize; - /* GELI gives us the offset relative to the partition start */ - off += dev.d_offset; - bytes = bytes / BD(&dev).bd_sectorsize; - - return (bd_io(&dev, off, bytes, buf, 0)); -} -#endif /* LOADER_GELI_SUPPORT */ Modified: stable/11/stand/i386/libi386/bootinfo32.c ============================================================================== --- stable/11/stand/i386/libi386/bootinfo32.c Wed Feb 20 23:53:39 2019 (r344398) +++ stable/11/stand/i386/libi386/bootinfo32.c Wed Feb 20 23:55:35 2019 (r344399) @@ -39,9 +39,6 @@ __FBSDID("$FreeBSD$"); #ifdef LOADER_GELI_SUPPORT #include "geliboot.h" - -static const size_t keybuf_size = sizeof(struct keybuf) + - (GELI_MAX_KEYS * sizeof(struct keybuf_ent)); #endif static struct bootinfo bi; @@ -154,10 +151,6 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_o int bootdevnr, i, howto; char *kernelname; const char *kernelpath; -#ifdef LOADER_GELI_SUPPORT - char buf[keybuf_size]; - struct keybuf *keybuf = (struct keybuf *)buf; -#endif *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Thu Feb 21 00:44:27 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F56714E32C4; Thu, 21 Feb 2019 00:44:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CF9177C9A; Thu, 21 Feb 2019 00:44:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7753D7B1; Thu, 21 Feb 2019 00:44:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L0iQk2022374; Thu, 21 Feb 2019 00:44:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L0iQY3022372; Thu, 21 Feb 2019 00:44:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201902210044.x1L0iQY3022372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 21 Feb 2019 00:44:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344401 - stable/11/sys/dev/ioat X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/ioat X-SVN-Commit-Revision: 344401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1CF9177C9A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 00:44:27 -0000 Author: mav Date: Thu Feb 21 00:44:26 2019 New Revision: 344401 URL: https://svnweb.freebsd.org/changeset/base/344401 Log: MFC r302669,302677-302686,303761,304602,304603,305027-305028,305259, 305710,305711,308067-308070,308178,308179,308230,308553,309338,309526, 343125 (by cem): Synchronize ioat(4) with head. Most of these changes are 3 years old, just never got merged. Modified: stable/11/sys/dev/ioat/ioat.c stable/11/sys/dev/ioat/ioat.h stable/11/sys/dev/ioat/ioat_hw.h stable/11/sys/dev/ioat/ioat_internal.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ioat/ioat.c ============================================================================== --- stable/11/sys/dev/ioat/ioat.c Thu Feb 21 00:17:24 2019 (r344400) +++ stable/11/sys/dev/ioat/ioat.c Thu Feb 21 00:44:26 2019 (r344401) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -62,7 +63,6 @@ __FBSDID("$FreeBSD$"); #define BUS_SPACE_MAXADDR_40BIT 0xFFFFFFFFFFULL #endif #define IOAT_REFLK (&ioat->submit_lock) -#define IOAT_SHRINK_PERIOD (10 * hz) static int ioat_probe(device_t device); static int ioat_attach(device_t device); @@ -81,23 +81,14 @@ static void ioat_process_events(struct ioat_softc *ioa static inline uint32_t ioat_get_active(struct ioat_softc *ioat); static inline uint32_t ioat_get_ring_space(struct ioat_softc *ioat); static void ioat_free_ring(struct ioat_softc *, uint32_t size, - struct ioat_descriptor **); -static void ioat_free_ring_entry(struct ioat_softc *ioat, - struct ioat_descriptor *desc); -static struct ioat_descriptor *ioat_alloc_ring_entry(struct ioat_softc *, - int mflags); + struct ioat_descriptor *); static int ioat_reserve_space(struct ioat_softc *, uint32_t, int mflags); -static struct ioat_descriptor *ioat_get_ring_entry(struct ioat_softc *ioat, +static union ioat_hw_descriptor *ioat_get_descriptor(struct ioat_softc *, uint32_t index); -static struct ioat_descriptor **ioat_prealloc_ring(struct ioat_softc *, - uint32_t size, boolean_t need_dscr, int mflags); -static int ring_grow(struct ioat_softc *, uint32_t oldorder, - struct ioat_descriptor **); -static int ring_shrink(struct ioat_softc *, uint32_t oldorder, - struct ioat_descriptor **); +static struct ioat_descriptor *ioat_get_ring_entry(struct ioat_softc *, + uint32_t index); static void ioat_halted_debug(struct ioat_softc *, uint32_t); static void ioat_poll_timer_callback(void *arg); -static void ioat_shrink_timer_callback(void *arg); static void dump_descriptor(void *hw_desc); static void ioat_submit_single(struct ioat_softc *ioat); static void ioat_comp_update_map(void *arg, bus_dma_segment_t *seg, int nseg, @@ -134,6 +125,10 @@ int g_ioat_debug_level = 0; SYSCTL_INT(_hw_ioat, OID_AUTO, debug_level, CTLFLAG_RWTUN, &g_ioat_debug_level, 0, "Set log level (0-3) for ioat(4). Higher is more verbose."); +unsigned g_ioat_ring_order = 13; +SYSCTL_UINT(_hw_ioat, OID_AUTO, ring_order, CTLFLAG_RDTUN, &g_ioat_ring_order, + 0, "Set IOAT ring order. (1 << this) == ring size."); + /* * OS <-> Driver interface structures */ @@ -335,7 +330,6 @@ ioat_detach(device_t device) ioat_teardown_intr(ioat); callout_drain(&ioat->poll_timer); - callout_drain(&ioat->shrink_timer); pci_disable_busmaster(device); @@ -353,7 +347,12 @@ ioat_detach(device_t device) bus_dma_tag_destroy(ioat->comp_update_tag); } - bus_dma_tag_destroy(ioat->hw_desc_tag); + if (ioat->hw_desc_ring != NULL) { + bus_dmamap_unload(ioat->hw_desc_tag, ioat->hw_desc_map); + bus_dmamem_free(ioat->hw_desc_tag, ioat->hw_desc_ring, + ioat->hw_desc_map); + bus_dma_tag_destroy(ioat->hw_desc_tag); + } return (0); } @@ -387,8 +386,8 @@ ioat_start_channel(struct ioat_softc *ioat) /* Submit 'NULL' operation manually to avoid quiescing flag */ desc = ioat_get_ring_entry(ioat, ioat->head); + hw_desc = &ioat_get_descriptor(ioat, ioat->head)->dma; dmadesc = &desc->bus_dmadesc; - hw_desc = desc->u.dma; dmadesc->callback_fn = NULL; dmadesc->callback_arg = NULL; @@ -425,9 +424,10 @@ static int ioat3_attach(device_t device) { struct ioat_softc *ioat; - struct ioat_descriptor **ring; - struct ioat_descriptor *next; + struct ioat_descriptor *ring; struct ioat_dma_hw_descriptor *dma_hw_desc; + void *hw_desc; + size_t ringsz; int i, num_descriptors; int error; uint8_t xfercap; @@ -452,7 +452,6 @@ ioat3_attach(device_t device) mtx_init(&ioat->submit_lock, "ioat_submit", NULL, MTX_DEF); mtx_init(&ioat->cleanup_lock, "ioat_cleanup", NULL, MTX_DEF); callout_init(&ioat->poll_timer, 1); - callout_init(&ioat->shrink_timer, 1); TASK_INIT(&ioat->reset_task, 0, ioat_reset_hw_task, ioat); /* Establish lock order for Witness */ @@ -461,7 +460,7 @@ ioat3_attach(device_t device) mtx_unlock(&ioat->cleanup_lock); mtx_unlock(&ioat->submit_lock); - ioat->is_resize_pending = FALSE; + ioat->is_submitter_processing = FALSE; ioat->is_completion_pending = FALSE; ioat->is_reset_pending = FALSE; ioat->is_channel_running = FALSE; @@ -482,37 +481,43 @@ ioat3_attach(device_t device) if (error != 0) return (error); - ioat->ring_size_order = IOAT_MIN_ORDER; - + ioat->ring_size_order = g_ioat_ring_order; num_descriptors = 1 << ioat->ring_size_order; + ringsz = sizeof(struct ioat_dma_hw_descriptor) * num_descriptors; - bus_dma_tag_create(bus_get_dma_tag(ioat->device), 0x40, 0x0, - BUS_SPACE_MAXADDR_40BIT, BUS_SPACE_MAXADDR, NULL, NULL, - sizeof(struct ioat_dma_hw_descriptor), 1, - sizeof(struct ioat_dma_hw_descriptor), 0, NULL, NULL, + error = bus_dma_tag_create(bus_get_dma_tag(ioat->device), + 2 * 1024 * 1024, 0x0, (bus_addr_t)BUS_SPACE_MAXADDR_40BIT, + BUS_SPACE_MAXADDR, NULL, NULL, ringsz, 1, ringsz, 0, NULL, NULL, &ioat->hw_desc_tag); + if (error != 0) + return (error); + error = bus_dmamem_alloc(ioat->hw_desc_tag, &hw_desc, + BUS_DMA_ZERO | BUS_DMA_WAITOK, &ioat->hw_desc_map); + if (error != 0) + return (error); + + error = bus_dmamap_load(ioat->hw_desc_tag, ioat->hw_desc_map, hw_desc, + ringsz, ioat_dmamap_cb, &ioat->hw_desc_bus_addr, BUS_DMA_WAITOK); + if (error) + return (error); + + ioat->hw_desc_ring = hw_desc; + ioat->ring = malloc(num_descriptors * sizeof(*ring), M_IOAT, M_ZERO | M_WAITOK); ring = ioat->ring; for (i = 0; i < num_descriptors; i++) { - ring[i] = ioat_alloc_ring_entry(ioat, M_WAITOK); - if (ring[i] == NULL) - return (ENOMEM); - - ring[i]->id = i; + memset(&ring[i].bus_dmadesc, 0, sizeof(ring[i].bus_dmadesc)); + ring[i].id = i; } - for (i = 0; i < num_descriptors - 1; i++) { - next = ring[i + 1]; - dma_hw_desc = ring[i]->u.dma; - - dma_hw_desc->next = next->hw_desc_bus_addr; + for (i = 0; i < num_descriptors; i++) { + dma_hw_desc = &ioat->hw_desc_ring[i].dma; + dma_hw_desc->next = RING_PHYS_ADDR(ioat, i + 1); } - ring[i]->u.dma->next = ring[0]->hw_desc_bus_addr; - ioat->head = ioat->hw_head = 0; ioat->tail = 0; ioat->last_seen = 0; @@ -662,8 +667,6 @@ ioat_process_events(struct ioat_softc *ioat) boolean_t pending; int error; - CTR0(KTR_IOAT, __func__); - mtx_lock(&ioat->cleanup_lock); /* @@ -680,31 +683,42 @@ ioat_process_events(struct ioat_softc *ioat) comp_update = *ioat->comp_update; status = comp_update & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_MASK; + if (status < ioat->hw_desc_bus_addr || + status >= ioat->hw_desc_bus_addr + (1 << ioat->ring_size_order) * + sizeof(struct ioat_generic_hw_descriptor)) + panic("Bogus completion address %jx (channel %u)", + (uintmax_t)status, ioat->chan_idx); + if (status == ioat->last_seen) { /* * If we landed in process_events and nothing has been * completed, check for a timeout due to channel halt. */ - comp_update = ioat_get_chansts(ioat); goto out; } + CTR4(KTR_IOAT, "%s channel=%u hw_status=0x%lx last_seen=0x%lx", + __func__, ioat->chan_idx, comp_update, ioat->last_seen); - while (1) { + while (RING_PHYS_ADDR(ioat, ioat->tail - 1) != status) { desc = ioat_get_ring_entry(ioat, ioat->tail); dmadesc = &desc->bus_dmadesc; - CTR1(KTR_IOAT, "completing desc %d", ioat->tail); + CTR5(KTR_IOAT, "channel=%u completing desc idx %u (%p) ok cb %p(%p)", + ioat->chan_idx, ioat->tail, dmadesc, dmadesc->callback_fn, + dmadesc->callback_arg); if (dmadesc->callback_fn != NULL) dmadesc->callback_fn(dmadesc->callback_arg, 0); completed++; ioat->tail++; - if (desc->hw_desc_bus_addr == status) - break; } + CTR5(KTR_IOAT, "%s channel=%u head=%u tail=%u active=%u", __func__, + ioat->chan_idx, ioat->head, ioat->tail, ioat_get_active(ioat)); - ioat->last_seen = desc->hw_desc_bus_addr; - ioat->stats.descriptors_processed += completed; + if (completed != 0) { + ioat->last_seen = RING_PHYS_ADDR(ioat, ioat->tail - 1); + ioat->stats.descriptors_processed += completed; + } out: ioat_write_chanctrl(ioat, IOAT_CHANCTRL_RUN); @@ -719,8 +733,6 @@ out: pending = (ioat_get_active(ioat) != 0); if (!pending && ioat->is_completion_pending) { ioat->is_completion_pending = FALSE; - callout_reset(&ioat->shrink_timer, IOAT_SHRINK_PERIOD, - ioat_shrink_timer_callback, ioat); callout_stop(&ioat->poll_timer); } mtx_unlock(&ioat->submit_lock); @@ -736,6 +748,12 @@ out: wakeup(&ioat->tail); } + /* + * The device doesn't seem to reliably push suspend/halt statuses to + * the channel completion memory address, so poll the device register + * here. + */ + comp_update = ioat_get_chansts(ioat) & IOAT_CHANSTS_STATUS; if (!is_ioat_halted(comp_update) && !is_ioat_suspended(comp_update)) return; @@ -745,19 +763,30 @@ out: * Fatal programming error on this DMA channel. Flush any outstanding * work with error status and restart the engine. */ - ioat_log_message(0, "Channel halted due to fatal programming error\n"); mtx_lock(&ioat->submit_lock); mtx_lock(&ioat->cleanup_lock); ioat->quiescing = TRUE; + /* + * This is safe to do here because we have both locks and the submit + * queue is quiesced. We know that we will drain all outstanding + * events, so ioat_reset_hw can't deadlock. It is necessary to + * protect other ioat_process_event threads from racing ioat_reset_hw, + * reading an indeterminate hw state, and attempting to continue + * issuing completions. + */ + ioat->resetting_cleanup = TRUE; chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET); - ioat_halted_debug(ioat, chanerr); + if (1 <= g_ioat_debug_level) + ioat_halted_debug(ioat, chanerr); ioat->stats.last_halt_chanerr = chanerr; while (ioat_get_active(ioat) > 0) { desc = ioat_get_ring_entry(ioat, ioat->tail); dmadesc = &desc->bus_dmadesc; - CTR1(KTR_IOAT, "completing err desc %d", ioat->tail); + CTR5(KTR_IOAT, "channel=%u completing desc idx %u (%p) err cb %p(%p)", + ioat->chan_idx, ioat->tail, dmadesc, dmadesc->callback_fn, + dmadesc->callback_arg); if (dmadesc->callback_fn != NULL) dmadesc->callback_fn(dmadesc->callback_arg, @@ -768,7 +797,14 @@ out: ioat->stats.descriptors_processed++; ioat->stats.descriptors_error++; } + CTR5(KTR_IOAT, "%s channel=%u head=%u tail=%u active=%u", __func__, + ioat->chan_idx, ioat->head, ioat->tail, ioat_get_active(ioat)); + if (ioat->is_completion_pending) { + ioat->is_completion_pending = FALSE; + callout_stop(&ioat->poll_timer); + } + /* Clear error status */ ioat_write_4(ioat, IOAT_CHANERR_OFFSET, chanerr); @@ -869,6 +905,15 @@ ioat_get_max_io_size(bus_dmaengine_t dmaengine) return (ioat->max_xfer_size); } +uint32_t +ioat_get_capabilities(bus_dmaengine_t dmaengine) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + return (ioat->capabilities); +} + int ioat_set_interrupt_coalesce(bus_dmaengine_t dmaengine, uint16_t delay) { @@ -902,7 +947,8 @@ ioat_acquire(bus_dmaengine_t dmaengine) ioat = to_ioat_softc(dmaengine); mtx_lock(&ioat->submit_lock); - CTR0(KTR_IOAT, __func__); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); + ioat->acq_head = ioat->head; } int @@ -926,8 +972,22 @@ ioat_release(bus_dmaengine_t dmaengine) struct ioat_softc *ioat; ioat = to_ioat_softc(dmaengine); - CTR0(KTR_IOAT, __func__); - ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, (uint16_t)ioat->hw_head); + CTR4(KTR_IOAT, "%s channel=%u dispatch1 hw_head=%u head=%u", __func__, + ioat->chan_idx, ioat->hw_head & UINT16_MAX, ioat->head); + KFAIL_POINT_CODE(DEBUG_FP, ioat_release, /* do nothing */); + CTR4(KTR_IOAT, "%s channel=%u dispatch2 hw_head=%u head=%u", __func__, + ioat->chan_idx, ioat->hw_head & UINT16_MAX, ioat->head); + + if (ioat->acq_head != ioat->head) { + ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, + (uint16_t)ioat->hw_head); + + if (!ioat->is_completion_pending) { + ioat->is_completion_pending = TRUE; + callout_reset(&ioat->poll_timer, 1, + ioat_poll_timer_callback, ioat); + } + } mtx_unlock(&ioat->submit_lock); } @@ -960,7 +1020,7 @@ ioat_op_generic(struct ioat_softc *ioat, uint8_t op, return (NULL); desc = ioat_get_ring_entry(ioat, ioat->head); - hw_desc = desc->u.generic; + hw_desc = &ioat_get_descriptor(ioat, ioat->head)->generic; hw_desc->u.control_raw = 0; hw_desc->u.control_generic.op = op; @@ -988,15 +1048,15 @@ ioat_null(bus_dmaengine_t dmaengine, bus_dmaengine_cal struct ioat_descriptor *desc; struct ioat_softc *ioat; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); desc = ioat_op_generic(ioat, IOAT_OP_COPY, 8, 0, 0, callback_fn, callback_arg, flags); if (desc == NULL) return (NULL); - hw_desc = desc->u.dma; + hw_desc = &ioat_get_descriptor(ioat, desc->id)->dma; hw_desc->u.control.null = 1; ioat_submit_single(ioat); return (&desc->bus_dmadesc); @@ -1011,7 +1071,6 @@ ioat_copy(bus_dmaengine_t dmaengine, bus_addr_t dst, struct ioat_descriptor *desc; struct ioat_softc *ioat; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); if (((src | dst) & (0xffffull << 48)) != 0) { @@ -1025,11 +1084,13 @@ ioat_copy(bus_dmaengine_t dmaengine, bus_addr_t dst, if (desc == NULL) return (NULL); - hw_desc = desc->u.dma; + hw_desc = &ioat_get_descriptor(ioat, desc->id)->dma; if (g_ioat_debug_level >= 3) dump_descriptor(hw_desc); ioat_submit_single(ioat); + CTR6(KTR_IOAT, "%s channel=%u desc=%p dest=%lx src=%lx len=%lx", + __func__, ioat->chan_idx, &desc->bus_dmadesc, dst, src, len); return (&desc->bus_dmadesc); } @@ -1042,8 +1103,8 @@ ioat_copy_8k_aligned(bus_dmaengine_t dmaengine, bus_ad struct ioat_descriptor *desc; struct ioat_softc *ioat; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); if (((src1 | src2 | dst1 | dst2) & (0xffffull << 48)) != 0) { ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n", @@ -1061,7 +1122,7 @@ ioat_copy_8k_aligned(bus_dmaengine_t dmaengine, bus_ad if (desc == NULL) return (NULL); - hw_desc = desc->u.dma; + hw_desc = &ioat_get_descriptor(ioat, desc->id)->dma; if (src2 != src1 + PAGE_SIZE) { hw_desc->u.control.src_page_break = 1; hw_desc->next_src_addr = src2; @@ -1089,8 +1150,8 @@ ioat_copy_crc(bus_dmaengine_t dmaengine, bus_addr_t ds uint32_t teststore; uint8_t op; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); if ((ioat->capabilities & IOAT_DMACAP_MOVECRC) == 0) { ioat_log_message(0, "%s: Device lacks MOVECRC capability\n", @@ -1138,7 +1199,7 @@ ioat_copy_crc(bus_dmaengine_t dmaengine, bus_addr_t ds if (desc == NULL) return (NULL); - hw_desc = desc->u.crc32; + hw_desc = &ioat_get_descriptor(ioat, desc->id)->crc32; if ((flags & DMA_CRC_INLINE) == 0) hw_desc->crc_address = crcptr; @@ -1168,8 +1229,8 @@ ioat_crc(bus_dmaengine_t dmaengine, bus_addr_t src, bu uint32_t teststore; uint8_t op; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); if ((ioat->capabilities & IOAT_DMACAP_CRC) == 0) { ioat_log_message(0, "%s: Device lacks CRC capability\n", @@ -1217,7 +1278,7 @@ ioat_crc(bus_dmaengine_t dmaengine, bus_addr_t src, bu if (desc == NULL) return (NULL); - hw_desc = desc->u.crc32; + hw_desc = &ioat_get_descriptor(ioat, desc->id)->crc32; if ((flags & DMA_CRC_INLINE) == 0) hw_desc->crc_address = crcptr; @@ -1245,8 +1306,8 @@ ioat_blockfill(bus_dmaengine_t dmaengine, bus_addr_t d struct ioat_descriptor *desc; struct ioat_softc *ioat; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); if ((ioat->capabilities & IOAT_DMACAP_BFILL) == 0) { ioat_log_message(0, "%s: Device lacks BFILL capability\n", @@ -1265,7 +1326,7 @@ ioat_blockfill(bus_dmaengine_t dmaengine, bus_addr_t d if (desc == NULL) return (NULL); - hw_desc = desc->u.fill; + hw_desc = &ioat_get_descriptor(ioat, desc->id)->fill; if (g_ioat_debug_level >= 3) dump_descriptor(hw_desc); @@ -1290,60 +1351,6 @@ ioat_get_ring_space(struct ioat_softc *ioat) return ((1 << ioat->ring_size_order) - ioat_get_active(ioat) - 1); } -static struct ioat_descriptor * -ioat_alloc_ring_entry(struct ioat_softc *ioat, int mflags) -{ - struct ioat_generic_hw_descriptor *hw_desc; - struct ioat_descriptor *desc; - int error, busdmaflag; - - error = ENOMEM; - hw_desc = NULL; - - if ((mflags & M_WAITOK) != 0) - busdmaflag = BUS_DMA_WAITOK; - else - busdmaflag = BUS_DMA_NOWAIT; - - desc = malloc(sizeof(*desc), M_IOAT, mflags); - if (desc == NULL) - goto out; - - bus_dmamem_alloc(ioat->hw_desc_tag, (void **)&hw_desc, - BUS_DMA_ZERO | busdmaflag, &ioat->hw_desc_map); - if (hw_desc == NULL) - goto out; - - memset(&desc->bus_dmadesc, 0, sizeof(desc->bus_dmadesc)); - desc->u.generic = hw_desc; - - error = bus_dmamap_load(ioat->hw_desc_tag, ioat->hw_desc_map, hw_desc, - sizeof(*hw_desc), ioat_dmamap_cb, &desc->hw_desc_bus_addr, - busdmaflag); - if (error) - goto out; - -out: - if (error) { - ioat_free_ring_entry(ioat, desc); - return (NULL); - } - return (desc); -} - -static void -ioat_free_ring_entry(struct ioat_softc *ioat, struct ioat_descriptor *desc) -{ - - if (desc == NULL) - return; - - if (desc->u.generic) - bus_dmamem_free(ioat->hw_desc_tag, desc->u.generic, - ioat->hw_desc_map); - free(desc, M_IOAT); -} - /* * Reserves space in this IOAT descriptor ring by ensuring enough slots remain * for 'num_descs'. @@ -1363,114 +1370,70 @@ ioat_free_ring_entry(struct ioat_softc *ioat, struct i static int ioat_reserve_space(struct ioat_softc *ioat, uint32_t num_descs, int mflags) { - struct ioat_descriptor **new_ring; - uint32_t order; + boolean_t dug; int error; mtx_assert(&ioat->submit_lock, MA_OWNED); error = 0; + dug = FALSE; - if (num_descs < 1 || num_descs > (1 << IOAT_MAX_ORDER)) { + if (num_descs < 1 || num_descs >= (1 << ioat->ring_size_order)) { error = EINVAL; goto out; } - if (ioat->quiescing) { - error = ENXIO; - goto out; - } for (;;) { + if (ioat->quiescing) { + error = ENXIO; + goto out; + } + if (ioat_get_ring_space(ioat) >= num_descs) goto out; - order = ioat->ring_size_order; - if (ioat->is_resize_pending || order == IOAT_MAX_ORDER) { - if ((mflags & M_WAITOK) != 0) { - msleep(&ioat->tail, &ioat->submit_lock, 0, - "ioat_rsz", 0); - continue; - } + CTR3(KTR_IOAT, "%s channel=%u starved (%u)", __func__, + ioat->chan_idx, num_descs); - error = EAGAIN; - break; - } - - ioat->is_resize_pending = TRUE; - for (;;) { + if (!dug && !ioat->is_submitter_processing) { + ioat->is_submitter_processing = TRUE; mtx_unlock(&ioat->submit_lock); - new_ring = ioat_prealloc_ring(ioat, 1 << (order + 1), - TRUE, mflags); + CTR2(KTR_IOAT, "%s channel=%u attempting to process events", + __func__, ioat->chan_idx); + ioat_process_events(ioat); mtx_lock(&ioat->submit_lock); - KASSERT(ioat->ring_size_order == order, - ("is_resize_pending should protect order")); - - if (new_ring == NULL) { - KASSERT((mflags & M_WAITOK) == 0, - ("allocation failed")); - error = EAGAIN; - break; - } - - error = ring_grow(ioat, order, new_ring); - if (error == 0) - break; + dug = TRUE; + KASSERT(ioat->is_submitter_processing == TRUE, + ("is_submitter_processing")); + ioat->is_submitter_processing = FALSE; + wakeup(&ioat->tail); + continue; } - ioat->is_resize_pending = FALSE; - wakeup(&ioat->tail); - if (error) + + if ((mflags & M_WAITOK) == 0) { + error = EAGAIN; break; + } + CTR2(KTR_IOAT, "%s channel=%u blocking on completions", + __func__, ioat->chan_idx); + msleep(&ioat->tail, &ioat->submit_lock, 0, + "ioat_full", 0); + continue; } out: mtx_assert(&ioat->submit_lock, MA_OWNED); + KASSERT(!ioat->quiescing || error == ENXIO, + ("reserved during quiesce")); return (error); } -static struct ioat_descriptor ** -ioat_prealloc_ring(struct ioat_softc *ioat, uint32_t size, boolean_t need_dscr, - int mflags) -{ - struct ioat_descriptor **ring; - uint32_t i; - int error; - - KASSERT(size > 0 && powerof2(size), ("bogus size")); - - ring = malloc(size * sizeof(*ring), M_IOAT, M_ZERO | mflags); - if (ring == NULL) - return (NULL); - - if (need_dscr) { - error = ENOMEM; - for (i = size / 2; i < size; i++) { - ring[i] = ioat_alloc_ring_entry(ioat, mflags); - if (ring[i] == NULL) - goto out; - ring[i]->id = i; - } - } - error = 0; - -out: - if (error != 0 && ring != NULL) { - ioat_free_ring(ioat, size, ring); - ring = NULL; - } - return (ring); -} - static void ioat_free_ring(struct ioat_softc *ioat, uint32_t size, - struct ioat_descriptor **ring) + struct ioat_descriptor *ring) { - uint32_t i; - for (i = 0; i < size; i++) { - if (ring[i] != NULL) - ioat_free_ring_entry(ioat, ring[i]); - } free(ring, M_IOAT); } @@ -1478,164 +1441,20 @@ static struct ioat_descriptor * ioat_get_ring_entry(struct ioat_softc *ioat, uint32_t index) { - return (ioat->ring[index % (1 << ioat->ring_size_order)]); + return (&ioat->ring[index % (1 << ioat->ring_size_order)]); } -static int -ring_grow(struct ioat_softc *ioat, uint32_t oldorder, - struct ioat_descriptor **newring) +static union ioat_hw_descriptor * +ioat_get_descriptor(struct ioat_softc *ioat, uint32_t index) { - struct ioat_descriptor *tmp, *next; - struct ioat_dma_hw_descriptor *hw; - uint32_t oldsize, newsize, head, tail, i, end; - int error; - CTR0(KTR_IOAT, __func__); - - mtx_assert(&ioat->submit_lock, MA_OWNED); - - if (oldorder != ioat->ring_size_order || oldorder >= IOAT_MAX_ORDER) { - error = EINVAL; - goto out; - } - - oldsize = (1 << oldorder); - newsize = (1 << (oldorder + 1)); - - mtx_lock(&ioat->cleanup_lock); - - head = ioat->head & (oldsize - 1); - tail = ioat->tail & (oldsize - 1); - - /* Copy old descriptors to new ring */ - for (i = 0; i < oldsize; i++) - newring[i] = ioat->ring[i]; - - /* - * If head has wrapped but tail hasn't, we must swap some descriptors - * around so that tail can increment directly to head. - */ - if (head < tail) { - for (i = 0; i <= head; i++) { - tmp = newring[oldsize + i]; - - newring[oldsize + i] = newring[i]; - newring[oldsize + i]->id = oldsize + i; - - newring[i] = tmp; - newring[i]->id = i; - } - head += oldsize; - } - - KASSERT(head >= tail, ("invariants")); - - /* Head didn't wrap; we only need to link in oldsize..newsize */ - if (head < oldsize) { - i = oldsize - 1; - end = newsize; - } else { - /* Head did wrap; link newhead..newsize and 0..oldhead */ - i = head; - end = newsize + (head - oldsize) + 1; - } - - /* - * Fix up hardware ring, being careful not to trample the active - * section (tail -> head). - */ - for (; i < end; i++) { - KASSERT((i & (newsize - 1)) < tail || - (i & (newsize - 1)) >= head, ("trampling snake")); - - next = newring[(i + 1) & (newsize - 1)]; - hw = newring[i & (newsize - 1)]->u.dma; - hw->next = next->hw_desc_bus_addr; - } - - free(ioat->ring, M_IOAT); - ioat->ring = newring; - ioat->ring_size_order = oldorder + 1; - ioat->tail = tail; - ioat->head = head; - error = 0; - - mtx_unlock(&ioat->cleanup_lock); -out: - if (error) - ioat_free_ring(ioat, (1 << (oldorder + 1)), newring); - return (error); + return (&ioat->hw_desc_ring[index % (1 << ioat->ring_size_order)]); } -static int -ring_shrink(struct ioat_softc *ioat, uint32_t oldorder, - struct ioat_descriptor **newring) -{ - struct ioat_dma_hw_descriptor *hw; - struct ioat_descriptor *ent, *next; - uint32_t oldsize, newsize, current_idx, new_idx, i; - int error; - - CTR0(KTR_IOAT, __func__); - - mtx_assert(&ioat->submit_lock, MA_OWNED); - - if (oldorder != ioat->ring_size_order || oldorder <= IOAT_MIN_ORDER) { - error = EINVAL; - goto out_unlocked; - } - - oldsize = (1 << oldorder); - newsize = (1 << (oldorder - 1)); - - mtx_lock(&ioat->cleanup_lock); - - /* Can't shrink below current active set! */ - if (ioat_get_active(ioat) >= newsize) { - error = ENOMEM; - goto out; - } - - /* - * Copy current descriptors to the new ring, dropping the removed - * descriptors. - */ - for (i = 0; i < newsize; i++) { - current_idx = (ioat->tail + i) & (oldsize - 1); - new_idx = (ioat->tail + i) & (newsize - 1); - - newring[new_idx] = ioat->ring[current_idx]; - newring[new_idx]->id = new_idx; - } - - /* Free deleted descriptors */ - for (i = newsize; i < oldsize; i++) { - ent = ioat_get_ring_entry(ioat, ioat->tail + i); - ioat_free_ring_entry(ioat, ent); - } - - /* Fix up hardware ring. */ - hw = newring[(ioat->tail + newsize - 1) & (newsize - 1)]->u.dma; - next = newring[(ioat->tail + newsize) & (newsize - 1)]; - hw->next = next->hw_desc_bus_addr; - - free(ioat->ring, M_IOAT); - ioat->ring = newring; - ioat->ring_size_order = oldorder - 1; - error = 0; - -out: - mtx_unlock(&ioat->cleanup_lock); -out_unlocked: - if (error) - ioat_free_ring(ioat, (1 << (oldorder - 1)), newring); - return (error); -} - static void ioat_halted_debug(struct ioat_softc *ioat, uint32_t chanerr) { - struct ioat_descriptor *desc; + union ioat_hw_descriptor *desc; ioat_log_message(0, "Channel halted (%b)\n", (int)chanerr, IOAT_CHANERR_STR); @@ -1644,11 +1463,11 @@ ioat_halted_debug(struct ioat_softc *ioat, uint32_t ch mtx_assert(&ioat->cleanup_lock, MA_OWNED); - desc = ioat_get_ring_entry(ioat, ioat->tail + 0); - dump_descriptor(desc->u.raw); + desc = ioat_get_descriptor(ioat, ioat->tail + 0); + dump_descriptor(desc); - desc = ioat_get_ring_entry(ioat, ioat->tail + 1); - dump_descriptor(desc->u.raw); + desc = ioat_get_descriptor(ioat, ioat->tail + 1); + dump_descriptor(desc); } static void @@ -1662,52 +1481,6 @@ ioat_poll_timer_callback(void *arg) ioat_process_events(ioat); } -static void -ioat_shrink_timer_callback(void *arg) -{ - struct ioat_descriptor **newring; - struct ioat_softc *ioat; - uint32_t order; - - ioat = arg; - ioat_log_message(1, "%s\n", __func__); - - /* Slowly scale the ring down if idle. */ - mtx_lock(&ioat->submit_lock); - - /* Don't run while the hardware is being reset. */ - if (ioat->resetting) { - mtx_unlock(&ioat->submit_lock); - return; - } - - order = ioat->ring_size_order; - if (ioat->is_resize_pending || order == IOAT_MIN_ORDER) { - mtx_unlock(&ioat->submit_lock); - goto out; - } - ioat->is_resize_pending = TRUE; - mtx_unlock(&ioat->submit_lock); - - newring = ioat_prealloc_ring(ioat, 1 << (order - 1), FALSE, - M_NOWAIT); - - mtx_lock(&ioat->submit_lock); - KASSERT(ioat->ring_size_order == order, - ("resize_pending protects order")); - - if (newring != NULL) - ring_shrink(ioat, order, newring); - - ioat->is_resize_pending = FALSE; - mtx_unlock(&ioat->submit_lock); - -out: - if (ioat->ring_size_order > IOAT_MIN_ORDER) - callout_reset(&ioat->poll_timer, IOAT_SHRINK_PERIOD, - ioat_shrink_timer_callback, ioat); -} - /* * Support Functions */ @@ -1715,17 +1488,15 @@ static void ioat_submit_single(struct ioat_softc *ioat) { + mtx_assert(&ioat->submit_lock, MA_OWNED); + ioat_get(ioat, IOAT_ACTIVE_DESCR_REF); atomic_add_rel_int(&ioat->head, 1); atomic_add_rel_int(&ioat->hw_head, 1); + CTR5(KTR_IOAT, "%s channel=%u head=%u hw_head=%u tail=%u", __func__, + ioat->chan_idx, ioat->head, ioat->hw_head & UINT16_MAX, + ioat->tail); - if (!ioat->is_completion_pending) { - ioat->is_completion_pending = TRUE; - callout_reset(&ioat->poll_timer, 1, ioat_poll_timer_callback, - ioat); - callout_stop(&ioat->shrink_timer); - } - ioat->stats.descriptors_submitted++; } @@ -1737,6 +1508,8 @@ ioat_reset_hw(struct ioat_softc *ioat) unsigned timeout; int error; + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); + mtx_lock(IOAT_REFLK); while (ioat->resetting && !ioat->destroying) msleep(&ioat->resetting, IOAT_REFLK, 0, "IRH_drain", 0); @@ -1758,6 +1531,9 @@ ioat_reset_hw(struct ioat_softc *ioat) ioat->resetting_cleanup = TRUE; mtx_unlock(&ioat->cleanup_lock); + CTR2(KTR_IOAT, "%s channel=%u quiesced and drained", __func__, + ioat->chan_idx); + status = ioat_get_chansts(ioat); if (is_ioat_active(status) || is_ioat_idle(status)) ioat_suspend(ioat); @@ -1778,6 +1554,9 @@ ioat_reset_hw(struct ioat_softc *ioat) chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET); ioat_write_4(ioat, IOAT_CHANERR_OFFSET, chanerr); + CTR2(KTR_IOAT, "%s channel=%u hardware suspended", __func__, + ioat->chan_idx); + /* * IOAT v3 workaround - CHANERRMSK_INT with 3E07h to masks out errors * that can cause stability issues for IOAT v3. @@ -1797,6 +1576,8 @@ ioat_reset_hw(struct ioat_softc *ioat) } ioat_reset(ioat); + CTR2(KTR_IOAT, "%s channel=%u hardware reset", __func__, + ioat->chan_idx); /* Wait at most 20 ms */ for (timeout = 0; ioat_reset_pending(ioat) && timeout < 20; timeout++) @@ -1840,26 +1621,30 @@ ioat_reset_hw(struct ioat_softc *ioat) ioat->tail = ioat->head = ioat->hw_head = 0; ioat->last_seen = 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Thu Feb 21 02:32:31 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C84A514EA37F; Thu, 21 Feb 2019 02:32:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C83985345; Thu, 21 Feb 2019 02:32:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D896EFF6; Thu, 21 Feb 2019 02:32:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L2WVD1080392; Thu, 21 Feb 2019 02:32:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L2WUde080390; Thu, 21 Feb 2019 02:32:30 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210232.x1L2WUde080390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 02:32:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344405 - in stable/11/stand/efi: . boot1 loader X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand/efi: . boot1 loader X-SVN-Commit-Revision: 344405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6C83985345 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.945,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 02:32:32 -0000 Author: kevans Date: Thu Feb 21 02:32:30 2019 New Revision: 344405 URL: https://svnweb.freebsd.org/changeset/base/344405 Log: MFC r336535: Hoist EFI_TARGET and SOURCE_DATE_EPOCH up into efi/Makefile.inc Modified: stable/11/stand/efi/Makefile.inc stable/11/stand/efi/boot1/Makefile stable/11/stand/efi/loader/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/Makefile.inc ============================================================================== --- stable/11/stand/efi/Makefile.inc Thu Feb 21 02:31:14 2019 (r344404) +++ stable/11/stand/efi/Makefile.inc Thu Feb 21 02:32:30 2019 (r344405) @@ -19,4 +19,16 @@ CFLAGS+= -fPIC CFLAGS+= -fPIC .endif +.if ${MACHINE_CPUARCH} == "amd64" +EFI_TARGET= efi-app-x86_64 +.elif ${MACHINE_CPUARCH} == "i386" +EFI_TARGET= efi-app-ia32 +.else +EFI_TARGET= binary +.endif + +# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00 +# for build reproducibility. +SOURCE_DATE_EPOCH?=1451606400 + .include "../Makefile.inc" Modified: stable/11/stand/efi/boot1/Makefile ============================================================================== --- stable/11/stand/efi/boot1/Makefile Thu Feb 21 02:31:14 2019 (r344404) +++ stable/11/stand/efi/boot1/Makefile Thu Feb 21 02:32:30 2019 (r344405) @@ -76,17 +76,6 @@ LDADD+= ${LIBEFI} ${LIBSA} DPADD+= ${LDSCRIPT} -.if ${MACHINE_CPUARCH} == "amd64" -EFI_TARGET= efi-app-x86_64 -.elif ${MACHINE_CPUARCH} == "i386" -EFI_TARGET= efi-app-ia32 -.else -EFI_TARGET= binary -.endif - -# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00 -# for build reproducibility. -SOURCE_DATE_EPOCH?=1451606400 boot1.efi: ${PROG} if ${NM} ${.ALLSRC} | grep ' U '; then \ echo "Undefined symbols in ${.ALLSRC}"; \ Modified: stable/11/stand/efi/loader/Makefile ============================================================================== --- stable/11/stand/efi/loader/Makefile Thu Feb 21 02:31:14 2019 (r344404) +++ stable/11/stand/efi/loader/Makefile Thu Feb 21 02:32:30 2019 (r344405) @@ -91,17 +91,6 @@ CLEANFILES+= loader.efi NEWVERSWHAT= "EFI loader" ${MACHINE} -.if ${MACHINE_CPUARCH} == "amd64" -EFI_TARGET= efi-app-x86_64 -.elif ${MACHINE_CPUARCH} == "i386" -EFI_TARGET= efi-app-ia32 -.else -EFI_TARGET= binary -.endif - -# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00 -# for build reproducibility. -SOURCE_DATE_EPOCH?=1451606400 loader.efi: ${PROG} if ${NM} ${.ALLSRC} | grep ' U '; then \ echo "Undefined symbols in ${.ALLSRC}"; \ From owner-svn-src-stable-11@freebsd.org Thu Feb 21 02:31:15 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C9D114EA167; Thu, 21 Feb 2019 02:31:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CBB585058; Thu, 21 Feb 2019 02:31:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F028EE78; Thu, 21 Feb 2019 02:31:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L2VEDG078841; Thu, 21 Feb 2019 02:31:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L2VEAd078840; Thu, 21 Feb 2019 02:31:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210231.x1L2VEAd078840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 02:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344404 - stable/11/stand/efi/loader X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/efi/loader X-SVN-Commit-Revision: 344404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1CBB585058 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 02:31:15 -0000 Author: kevans Date: Thu Feb 21 02:31:14 2019 New Revision: 344404 URL: https://svnweb.freebsd.org/changeset/base/344404 Log: MFC r336463: If rootdev is set, use it as currdev. Setting rootdev in the enviornment should specify things completely. If it is set, then have it override everything else. Modified: stable/11/stand/efi/loader/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Thu Feb 21 02:28:04 2019 (r344403) +++ stable/11/stand/efi/loader/main.c Thu Feb 21 02:31:14 2019 (r344404) @@ -166,16 +166,21 @@ out: } static void +set_currdev(const char *devname) +{ + + env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, env_nounset); + env_setenv("loaddev", EV_VOLATILE, devname, env_noset, env_nounset); +} + +static void set_currdev_devdesc(struct devdesc *currdev) { const char *devname; devname = efi_fmtdev(currdev); - printf("Setting currdev to %s\n", devname); - - env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, devname, env_noset, env_nounset); + set_currdev(devname); } static void @@ -279,7 +284,15 @@ find_currdev(EFI_LOADED_IMAGE *img) struct devsw *dev; int unit; uint64_t extra; + char *rootdev; + rootdev = getenv("rootdev"); + if (rootdev != NULL) { + printf("Setting currdev to configured rootdev %s\n", rootdev); + set_currdev(rootdev); + return (0); + } + #ifdef EFI_ZFS_BOOT /* * Did efi_zfs_probe() detect the boot pool? If so, use the zpool @@ -616,7 +629,7 @@ main(int argc, CHAR16 *argv[]) * set the env based on it. */ boot_howto_to_env(howto); - + if (efi_copy_init()) { printf("failed to allocate staging area\n"); return (EFI_BUFFER_TOO_SMALL); From owner-svn-src-stable-11@freebsd.org Thu Feb 21 02:28:05 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB79014EA022; Thu, 21 Feb 2019 02:28:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6853884ECF; Thu, 21 Feb 2019 02:28:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53294EE34; Thu, 21 Feb 2019 02:28:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L2S5dg075577; Thu, 21 Feb 2019 02:28:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L2S4dn075574; Thu, 21 Feb 2019 02:28:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210228.x1L2S4dn075574@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 02:28:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344403 - in stable/11/stand/efi: include loader X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand/efi: include loader X-SVN-Commit-Revision: 344403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6853884ECF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 02:28:06 -0000 Author: kevans Date: Thu Feb 21 02:28:04 2019 New Revision: 344403 URL: https://svnweb.freebsd.org/changeset/base/344403 Log: MFC r336264, r336270-r336272, r336464, r336627: UEFI Console Improvements r336264: Define ADR subtype of ACPI type for a device path. r336270: uefi stand: Guess the console better For server machines, ComOut is set to the set of devices that the efi console suppots. Parse it to see if we have serial, video or both. Make that take precidence over the command line args. boot1.efi parses them, but loader.efi doesn't. It's not clear where to read boot.conf from, so we don't do that. The command line args can still be set via efibootmgr, which is more inline with the UEFI boot manager to replace that. These args are typically used only to set serial vs video and the com speed line. We can infer that from ComOut, so do so. Remember the com speed and hw.uart.console to match. r336271: Add reporting of whether or not a keyboard is detected. In addition, note that r336270's commit message was slightly incorrect. It changed the default setting of the console to honor the ConOut variable. Overrides via the command line are still possible, and we use the devices in ConOut to set the proper console. If, for example, serial cosnole is specified, we'll set console to "efi" if ConOut has a serial port list and to either "efi comconsole" or "comconsole efi" if not depending on whether -D or -D -h was specified. r336272: Minor adjustments: o Fix the parsing of the device path. a last minute change terminated it too soon. o Kill setting LINES. We don't need to do it, and even if we did hard coding it to 24 is wrong. o Now that the console is working again for the loader, adjust the printfs to be more in line with other platforms. r336464: If the console is already set, don't override it. If console=X is specified on the command line, it's effectively overridden by the current code. It shouldn't do that. r336627: Fix the attempt to see if we're overriding the console in the command line args. I had thought console would be NULL, but it's efi. Set it to efi (as a clue) before we initialize the console, then test it to see if it changed on the command line to do the automatic override. This gets my serial console back. RelNotes: yes Modified: stable/11/stand/efi/include/efidevp.h stable/11/stand/efi/loader/bootinfo.c stable/11/stand/efi/loader/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/include/efidevp.h ============================================================================== --- stable/11/stand/efi/include/efidevp.h Thu Feb 21 01:30:37 2019 (r344402) +++ stable/11/stand/efi/include/efidevp.h Thu Feb 21 02:28:04 2019 (r344403) @@ -141,6 +141,9 @@ typedef struct _ACPI_EXTENDED_HID_DEVICE_PATH { UINT32 CID; } ACPI_EXTENDED_HID_DEVICE_PATH; +#define ACPI_ADR_DP 0x03 +/* ACPI_ADR_DEVICE_PATH not defined */ + // // EISA ID Macro // EISA ID Definition 32-bits Modified: stable/11/stand/efi/loader/bootinfo.c ============================================================================== --- stable/11/stand/efi/loader/bootinfo.c Thu Feb 21 01:30:37 2019 (r344402) +++ stable/11/stand/efi/loader/bootinfo.c Thu Feb 21 02:28:04 2019 (r344403) @@ -67,10 +67,11 @@ extern EFI_SYSTEM_TABLE *ST; static int bi_getboothowto(char *kargs) { - const char *sw; + const char *sw, *tmp; char *opts; char *console; - int howto; + int howto, speed, port; + char buf[50]; howto = boot_parse_cmdline(kargs); howto |= boot_env_to_howto(); @@ -81,6 +82,35 @@ bi_getboothowto(char *kargs) howto |= RB_SERIAL; if (strcmp(console, "nullconsole") == 0) howto |= RB_MUTE; + if (strcmp(console, "efi") == 0) { + /* + * If we found a com port and com speed, we need to tell + * the kernel where the serial port is, and how + * fast. Ideally, we'd get the port from ACPI, but that + * isn't running in the loader. Do the next best thing + * by allowing it to be set by a loader.conf variable, + * either a EFI specific one, or the compatible + * comconsole_port if not. PCI support is needed, but + * for that we'd ideally refactor the + * libi386/comconsole.c code to have identical behavior. + */ + tmp = getenv("efi_com_speed"); + if (tmp != NULL) { + speed = strtol(tmp, NULL, 0); + tmp = getenv("efi_com_port"); + if (tmp == NULL) + tmp = getenv("comconsole_port"); + /* XXX fallback to EFI variable set in rc.d? */ + if (tmp != NULL) + port = strtol(tmp, NULL, 0); + else + port = 0x3f8; + snprintf(buf, sizeof(buf), "io:%d,br:%d", port, + speed); + env_setenv("hw.uart.console", EV_VOLATILE, buf, + NULL, NULL); + } + } } return (howto); Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Thu Feb 21 01:30:37 2019 (r344402) +++ stable/11/stand/efi/loader/main.c Thu Feb 21 02:28:04 2019 (r344403) @@ -316,11 +316,6 @@ find_currdev(EFI_LOADED_IMAGE *img) if (dp->pd_parent != NULL) { dp = dp->pd_parent; STAILQ_FOREACH(pp, &dp->pd_part, pd_link) { - text = efi_devpath_name(pp->pd_devpath); - if (text != NULL) { - printf("And now the part: %S\n", text); - efi_free_devpath_name(text); - } /* * Roll up the ZFS special case * for those partitions that have @@ -400,8 +395,8 @@ interactive_interrupt(const char *msg) return (false); } -int -parse_args(int argc, CHAR16 *argv[], bool has_kbd) +static int +parse_args(int argc, CHAR16 *argv[]) { int i, j, howto; bool vargood; @@ -429,12 +424,97 @@ parse_args(int argc, CHAR16 *argv[], bool has_kbd) return (howto); } +/* + * Parse ConOut (the list of consoles active) and see if we can find a + * serial port and/or a video port. It would be nice to also walk the + * ACPI name space to map the UID for the serial port to a port. The + * latter is especially hard. + */ +static int +parse_uefi_con_out(void) +{ + int how, rv; + int vid_seen = 0, com_seen = 0, seen = 0; + size_t sz; + char buf[4096], *ep; + EFI_DEVICE_PATH *node; + ACPI_HID_DEVICE_PATH *acpi; + UART_DEVICE_PATH *uart; + bool pci_pending; + how = 0; + sz = sizeof(buf); + rv = efi_global_getenv("ConOut", buf, &sz); + if (rv != EFI_SUCCESS) + goto out; + ep = buf + sz; + node = (EFI_DEVICE_PATH *)buf; + while ((char *)node < ep) { + pci_pending = false; + if (DevicePathType(node) == ACPI_DEVICE_PATH && + DevicePathSubType(node) == ACPI_DP) { + /* Check for Serial node */ + acpi = (void *)node; + if (EISA_ID_TO_NUM(acpi->HID) == 0x501) + com_seen = ++seen; + } else if (DevicePathType(node) == MESSAGING_DEVICE_PATH && + DevicePathSubType(node) == MSG_UART_DP) { + char bd[16]; + + uart = (void *)node; + snprintf(bd, sizeof(bd), "%d", uart->BaudRate); + setenv("efi_com_speed", bd, 1); + } else if (DevicePathType(node) == ACPI_DEVICE_PATH && + DevicePathSubType(node) == ACPI_ADR_DP) { + /* Check for AcpiAdr() Node for video */ + vid_seen = ++seen; + } else if (DevicePathType(node) == HARDWARE_DEVICE_PATH && + DevicePathSubType(node) == HW_PCI_DP) { + /* + * Note, vmware fusion has a funky console device + * PciRoot(0x0)/Pci(0xf,0x0) + * which we can only detect at the end since we also + * have to cope with: + * PciRoot(0x0)/Pci(0x1f,0x0)/Serial(0x1) + * so only match it if it's last. + */ + pci_pending = true; + } + node = NextDevicePathNode(node); /* Skip the end node */ + } + if (pci_pending && vid_seen == 0) + vid_seen = ++seen; + + /* + * Truth table for RB_MULTIPLE | RB_SERIAL + * Value Result + * 0 Use only video console + * RB_SERIAL Use only serial console + * RB_MULTIPLE Use both video and serial console + * (but video is primary so gets rc messages) + * both Use both video and serial console + * (but serial is primary so gets rc messages) + * + * Try to honor this as best we can. If only one of serial / video + * found, then use that. Otherwise, use the first one we found. + * This also implies if we found nothing, default to video. + */ + how = 0; + if (vid_seen && com_seen) { + how |= RB_MULTIPLE; + if (com_seen < vid_seen) + how |= RB_SERIAL; + } else if (com_seen) + how |= RB_SERIAL; +out: + return (how); +} + EFI_STATUS main(int argc, CHAR16 *argv[]) { EFI_GUID *guid; - int howto, i; + int howto, i, uhowto; UINTN k; bool has_kbd; char *s; @@ -474,6 +554,7 @@ main(int argc, CHAR16 *argv[]) * eg. the boot device, which we can't do yet. We can use * printf() etc. once this is done. */ + setenv("console", "efi", 1); cons_probe(); /* @@ -481,23 +562,61 @@ main(int argc, CHAR16 *argv[]) */ bcache_init(32768, 512); - howto = parse_args(argc, argv, has_kbd); + howto = parse_args(argc, argv); + if (!has_kbd && (howto & RB_PROBE)) + howto |= RB_SERIAL | RB_MULTIPLE; + howto &= ~RB_PROBE; + uhowto = parse_uefi_con_out(); - boot_howto_to_env(howto); - /* - * XXX we need fallback to this stuff after looking at the ConIn, ConOut and ConErr variables + * We now have two notions of console. howto should be viewed as + * overrides. If console is already set, don't set it again. */ - if (howto & RB_MULTIPLE) { - if (howto & RB_SERIAL) - setenv("console", "comconsole efi" , 1); - else - setenv("console", "efi comconsole" , 1); - } else if (howto & RB_SERIAL) { - setenv("console", "comconsole" , 1); - } else - setenv("console", "efi", 1); - +#define VIDEO_ONLY 0 +#define SERIAL_ONLY RB_SERIAL +#define VID_SER_BOTH RB_MULTIPLE +#define SER_VID_BOTH (RB_SERIAL | RB_MULTIPLE) +#define CON_MASK (RB_SERIAL | RB_MULTIPLE) + if (strcmp(getenv("console"), "efi") == 0) { + if ((howto & CON_MASK) == 0) { + /* No override, uhowto is controlling and efi cons is perfect */ + howto = howto | (uhowto & CON_MASK); + setenv("console", "efi", 1); + } else if ((howto & CON_MASK) == (uhowto & CON_MASK)) { + /* override matches what UEFI told us, efi console is perfect */ + setenv("console", "efi", 1); + } else if ((uhowto & (CON_MASK)) != 0) { + /* + * We detected a serial console on ConOut. All possible + * overrides include serial. We can't really override what efi + * gives us, so we use it knowing it's the best choice. + */ + setenv("console", "efi", 1); + } else { + /* + * We detected some kind of serial in the override, but ConOut + * has no serial, so we have to sort out which case it really is. + */ + switch (howto & CON_MASK) { + case SERIAL_ONLY: + setenv("console", "comconsole", 1); + break; + case VID_SER_BOTH: + setenv("console", "efi comconsole", 1); + break; + case SER_VID_BOTH: + setenv("console", "comconsole efi", 1); + break; + /* case VIDEO_ONLY can't happen -- it's the first if above */ + } + } + } + /* + * howto is set now how we want to export the flags to the kernel, so + * set the env based on it. + */ + boot_howto_to_env(howto); + if (efi_copy_init()) { printf("failed to allocate staging area\n"); return (EFI_BUFFER_TOO_SMALL); @@ -517,18 +636,17 @@ main(int argc, CHAR16 *argv[]) } else printf("efipart_inithandles failed %d, expect failures", i); - printf("Command line arguments:"); + printf("%s\n", bootprog_info); + printf(" Command line arguments:"); for (i = 0; i < argc; i++) printf(" %S", argv[i]); printf("\n"); - printf("Image base: 0x%lx\n", (u_long)img->ImageBase); - printf("EFI version: %d.%02d\n", ST->Hdr.Revision >> 16, + printf(" EFI version: %d.%02d\n", ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff); - printf("EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor, + printf(" EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff); - printf("\n%s", bootprog_info); /* Determine the devpath of our image so we can prefer it. */ text = efi_devpath_name(img->FilePath); @@ -584,7 +702,6 @@ main(int argc, CHAR16 *argv[]) return (EFI_NOT_FOUND); efi_init_environment(); - setenv("LINES", "24", 1); /* optional */ #if !defined(__arm__) for (k = 0; k < ST->NumberOfTableEntries; k++) { From owner-svn-src-stable-11@freebsd.org Thu Feb 21 02:50:46 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA17C14EB1FE; Thu, 21 Feb 2019 02:50:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5835D8625D; Thu, 21 Feb 2019 02:50:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AA3BF317; Thu, 21 Feb 2019 02:50:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L2ok2q089315; Thu, 21 Feb 2019 02:50:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L2okVU089314; Thu, 21 Feb 2019 02:50:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210250.x1L2okVU089314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 02:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344411 - stable/11/stand/efi/libefi X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/efi/libefi X-SVN-Commit-Revision: 344411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5835D8625D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 02:50:47 -0000 Author: kevans Date: Thu Feb 21 02:50:45 2019 New Revision: 344411 URL: https://svnweb.freebsd.org/changeset/base/344411 Log: MFC r336431: stand: Fix UEFI console scrolling Remove bogus attempt to simulate scrolling. It's not needed and messes up serial output. Setting the cursor position after every character is inefficient, and causes all lines to be over-printed in the serial console for the boot loader. Allow the terminal to do the emulation. This isn't completely perfect when the size of the terminal attached to the serial port isn't the same as 80x25 to match the viedoe console (or whatever the video console is). While imperfect still, these changes make it much better. This makes the serial port useful with UEFI. Modified: stable/11/stand/efi/libefi/efi_console.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/libefi/efi_console.c ============================================================================== --- stable/11/stand/efi/libefi/efi_console.c Thu Feb 21 02:48:38 2019 (r344410) +++ stable/11/stand/efi/libefi/efi_console.c Thu Feb 21 02:50:45 2019 (r344411) @@ -147,20 +147,20 @@ efi_cons_rawputchar(int c) switch (c) { case '\r': curx = 0; - curs_move(&curx, &cury, curx, cury); + efi_cons_efiputchar('\r'); return; case '\n': + efi_cons_efiputchar('\n'); + efi_cons_efiputchar('\r'); cury++; - if (cury >= y) { - efi_cons_efiputchar('\n'); + if (cury >= y) cury--; - } else - curs_move(&curx, &cury, curx, cury); + curx = 0; return; case '\b': if (curx > 0) { + efi_cons_efiputchar('\b'); curx--; - curs_move(&curx, &cury, curx, cury); } return; default: @@ -175,7 +175,6 @@ efi_cons_rawputchar(int c) cury--; } } - curs_move(&curx, &cury, curx, cury); #endif } } From owner-svn-src-stable-11@freebsd.org Thu Feb 21 03:39:52 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A06A14EDB32; Thu, 21 Feb 2019 03:39:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DEBE4886EB; Thu, 21 Feb 2019 03:39:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0C0CFB67; Thu, 21 Feb 2019 03:39:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L3dphI013700; Thu, 21 Feb 2019 03:39:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L3dpvj013699; Thu, 21 Feb 2019 03:39:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210339.x1L3dpvj013699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 03:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344417 - stable/11/share/man/man7 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/share/man/man7 X-SVN-Commit-Revision: 344417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DEBE4886EB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 03:39:52 -0000 Author: kevans Date: Thu Feb 21 03:39:51 2019 New Revision: 344417 URL: https://svnweb.freebsd.org/changeset/base/344417 Log: MFc r338043: Document LOADER_DEFAULT_INTERP. This controls what interpreter the default boot loader in /boot/loader{,.efi} is, and which one we compile into userboot by default. Modified: stable/11/share/man/man7/build.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/build.7 ============================================================================== --- stable/11/share/man/man7/build.7 Thu Feb 21 03:37:31 2019 (r344416) +++ stable/11/share/man/man7/build.7 Thu Feb 21 03:39:51 2019 (r344417) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 10, 2018 +.Dd February 20, 2019 .Dt BUILD 7 .Os .Sh NAME @@ -572,6 +572,18 @@ using the option of .Xr make 1 : .Bl -tag -width ".Va -DNO_KERNELCONFIG" +.It Va LOADER_DEFAULT_INTERP +Defines what interpreter the default loader program will have. +Valid values include +.Dq 4th , +.Dq lua , +and +.Dq simp . +This creates the default link for +.Pa /boot/loader +to the loader with that interpreter. +It also determines what interpreter is compiled into +.Pa userboot . .It Va NO_CLEANDIR If set, the build targets that clean parts of the object tree use the equivalent of From owner-svn-src-stable-11@freebsd.org Thu Feb 21 03:22:21 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35E3114ECEF4; Thu, 21 Feb 2019 03:22:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF70687A88; Thu, 21 Feb 2019 03:22:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C123CF968; Thu, 21 Feb 2019 03:22:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L3MKCw007121; Thu, 21 Feb 2019 03:22:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L3MKeV007120; Thu, 21 Feb 2019 03:22:20 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210322.x1L3MKeV007120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 03:22:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344414 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 344414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CF70687A88 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 03:22:21 -0000 Author: kevans Date: Thu Feb 21 03:22:20 2019 New Revision: 344414 URL: https://svnweb.freebsd.org/changeset/base/344414 Log: MFC (RECORD ONLY) r338050: Loader default interpreter flip The default interpreter for stable/11 is 4th; this will never and can never change. Record MFC of r338050 to proactively prevent any accidents in future batching of MFCs. Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable-11@freebsd.org Thu Feb 21 03:48:40 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D160F14EE6E5; Thu, 21 Feb 2019 03:48:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 73346890E4; Thu, 21 Feb 2019 03:48:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F25FFD44; Thu, 21 Feb 2019 03:48:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L3meeR018888; Thu, 21 Feb 2019 03:48:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L3meFu018887; Thu, 21 Feb 2019 03:48:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210348.x1L3meFu018887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 03:48:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344418 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 344418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 73346890E4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 03:48:41 -0000 Author: kevans Date: Thu Feb 21 03:48:39 2019 New Revision: 344418 URL: https://svnweb.freebsd.org/changeset/base/344418 Log: Direct commit for post-mortem UPDATING update regarding lualoader Indicate that it's been merged (after some delay since lua came back to this branch) and how one can test lua, both by swapping build knobs and creating links in /boot. Modified: stable/11/UPDATING Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Thu Feb 21 03:39:51 2019 (r344417) +++ stable/11/UPDATING Thu Feb 21 03:48:39 2019 (r344418) @@ -17,6 +17,20 @@ the tip of head, and then rebuild without this option. from older version of current across the gcc/clang cutover is a bit fragile. 20190220: + Co-existance for Forth and Lua interpreters in bootloaders has now been + merged to ease testing of lualoader. LOADER_DEFAULT_INTERP, documented + in build(7), may be used to control which interpreter flavor is used in + the default loader to be installed. For systems where Lua and Forth + coexist, this switch can also be made on a running system by creating a + link from /boot/loader_${flavor}{,efi} to /boot/loader{,.efi} rather + than requiring a rebuild. + + The default flavor in this branch will remain Forth. As indicated in + the 20190216 UPDATING entry, booting is a complex environment; it would + be prudent to assume that lualoader may not work for your setup and make + provisions for backup boot methods. + +20190220: zfsloader's functionality has now been folded into loader. zfsloader is no longer necesasary once you've updated your boot blocks. For a transition period, we will install a From owner-svn-src-stable-11@freebsd.org Thu Feb 21 02:37:03 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2064414EA85D; Thu, 21 Feb 2019 02:37:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B01E485760; Thu, 21 Feb 2019 02:37:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A25E5F008; Thu, 21 Feb 2019 02:37:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L2b2ii080671; Thu, 21 Feb 2019 02:37:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L2b28G080669; Thu, 21 Feb 2019 02:37:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210237.x1L2b28G080669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 02:37:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344406 - in stable/11/stand/efi: include libefi X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand/efi: include libefi X-SVN-Commit-Revision: 344406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B01E485760 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 02:37:03 -0000 Author: kevans Date: Thu Feb 21 02:37:01 2019 New Revision: 344406 URL: https://svnweb.freebsd.org/changeset/base/344406 Log: MFC r336651-r336655: stand: libefi: various boot protocol aux impl. r336651: Implement efi_devpath_to_media_path Takes a generic device path as its input. Scans through it to find the first media_path node in it and returns a pointer to it. If none is found, NULL is returned. r336652: Store the number of handles we get back in efipart_nhandles rather than the number of bytes. Don't divide by the element size every time we have to iterate. Eliminate now-unused variables. r336653: Implement efi_devpath_match_node Returns true if the first node pointed to by devpath1 is identical to the first node pointed to by devpath2, with care taken to not read past the end of the valid parts of either devpath1 or devpath2. Otherwise, returns false. r336654: Implement efi_devpath_length Return the total length, in bytes, of the device path (including the terminating node at the end). r336655: Implement efiblk_get_pdinfo_by_device_path Lookup a block device by it's device path. We use a 'loose' lookup whereby we scan forward to the first Media Path portion of the device path, then look at all our handles for one whose first Media Path matches. This will also work if the device path pointed to has a following file path (or paths) as that's ignored. It assumes that there's only one media path node that describes the entire device, which is true as of the latest UEFI spec (2.7 Errata A) as far as I've been able to determine. Modified: stable/11/stand/efi/include/efilib.h stable/11/stand/efi/libefi/devpath.c stable/11/stand/efi/libefi/efipart.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/include/efilib.h ============================================================================== --- stable/11/stand/efi/include/efilib.h Thu Feb 21 02:32:30 2019 (r344405) +++ stable/11/stand/efi/include/efilib.h Thu Feb 21 02:37:01 2019 (r344406) @@ -66,6 +66,7 @@ typedef struct pdinfo pdinfo_list_t *efiblk_get_pdinfo_list(struct devsw *dev); pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev); pdinfo_t *efiblk_get_pdinfo_by_handle(EFI_HANDLE h); +pdinfo_t *efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path); void *efi_get_table(EFI_GUID *tbl); @@ -85,9 +86,12 @@ EFI_HANDLE efi_devpath_handle(EFI_DEVICE_PATH *); EFI_DEVICE_PATH *efi_devpath_last_node(EFI_DEVICE_PATH *); EFI_DEVICE_PATH *efi_devpath_trim(EFI_DEVICE_PATH *); bool efi_devpath_match(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *); +bool efi_devpath_match_node(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *); bool efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *); CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *); void efi_free_devpath_name(CHAR16 *); +EFI_DEVICE_PATH *efi_devpath_to_media_path(EFI_DEVICE_PATH *); +UINTN efi_devpath_length(EFI_DEVICE_PATH *); int efi_status_to_errno(EFI_STATUS); EFI_STATUS errno_to_efi_status(int errno); Modified: stable/11/stand/efi/libefi/devpath.c ============================================================================== --- stable/11/stand/efi/libefi/devpath.c Thu Feb 21 02:32:30 2019 (r344405) +++ stable/11/stand/efi/libefi/devpath.c Thu Feb 21 02:37:01 2019 (r344406) @@ -140,25 +140,33 @@ efi_devpath_handle(EFI_DEVICE_PATH *devpath) } bool -efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2) +efi_devpath_match_node(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2) { size_t len; if (devpath1 == NULL || devpath2 == NULL) return (false); + if (DevicePathType(devpath1) != DevicePathType(devpath2) || + DevicePathSubType(devpath1) != DevicePathSubType(devpath2)) + return (false); + len = DevicePathNodeLength(devpath1); + if (len != DevicePathNodeLength(devpath2)) + return (false); + if (memcmp(devpath1, devpath2, len) != 0) + return (false); + return (true); +} - while (true) { - if (DevicePathType(devpath1) != DevicePathType(devpath2) || - DevicePathSubType(devpath1) != DevicePathSubType(devpath2)) - return (false); +bool +efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2) +{ - len = DevicePathNodeLength(devpath1); - if (len != DevicePathNodeLength(devpath2)) - return (false); + if (devpath1 == NULL || devpath2 == NULL) + return (false); - if (memcmp(devpath1, devpath2, len) != 0) - return (false); - + while (true) { + if (!efi_devpath_match_node(devpath1, devpath2)) + return false; if (IsDevicePathEnd(devpath1)) break; devpath1 = NextDevicePathNode(devpath1); @@ -194,4 +202,30 @@ efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEV path = NextDevicePathNode(path); } return (true); +} + +/* + * Skip over the 'prefix' part of path and return the part of the path + * that starts with the first node that's a MEDIA_DEVICE_PATH. + */ +EFI_DEVICE_PATH * +efi_devpath_to_media_path(EFI_DEVICE_PATH *path) +{ + + while (!IsDevicePathEnd(path)) { + if (DevicePathType(path) == MEDIA_DEVICE_PATH) + return (path); + path = NextDevicePathNode(path); + } + return (NULL); +} + +UINTN +efi_devpath_length(EFI_DEVICE_PATH *path) +{ + EFI_DEVICE_PATH *start = path; + + while (!IsDevicePathEnd(path)) + path = NextDevicePathNode(path); + return ((UINTN)path - (UINTN)start) + DevicePathNodeLength(path); } Modified: stable/11/stand/efi/libefi/efipart.c ============================================================================== --- stable/11/stand/efi/libefi/efipart.c Thu Feb 21 02:32:30 2019 (r344405) +++ stable/11/stand/efi/libefi/efipart.c Thu Feb 21 02:37:01 2019 (r344406) @@ -137,6 +137,28 @@ efiblk_get_pdinfo(struct devdesc *dev) return (pd); } +pdinfo_t * +efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path) +{ + unsigned i; + EFI_DEVICE_PATH *media, *devpath; + EFI_HANDLE h; + + media = efi_devpath_to_media_path(path); + if (media == NULL) + return (NULL); + for (i = 0; i < efipart_nhandles; i++) { + h = efipart_handles[i]; + devpath = efi_lookup_devpath(h); + if (devpath == NULL) + continue; + if (!efi_devpath_match_node(media, efi_devpath_to_media_path(devpath))) + continue; + return (efiblk_get_pdinfo_by_handle(h)); + } + return (NULL); +} + static bool same_handle(pdinfo_t *pd, EFI_HANDLE h) { @@ -210,7 +232,7 @@ efipart_inithandles(void) return (efi_status_to_errno(status)); efipart_handles = hin; - efipart_nhandles = sz; + efipart_nhandles = sz / sizeof(*hin); #ifdef EFIPART_DEBUG printf("%s: Got %d BLOCK IO MEDIA handle(s)\n", __func__, efipart_nhandles); @@ -246,7 +268,7 @@ efipart_floppy(EFI_DEVICE_PATH *node) static bool efipart_hdd(EFI_DEVICE_PATH *dp) { - unsigned i, nin; + unsigned i; EFI_DEVICE_PATH *devpath, *node; EFI_BLOCK_IO *blkio; EFI_STATUS status; @@ -264,8 +286,7 @@ efipart_hdd(EFI_DEVICE_PATH *dp) * Test every EFI BLOCK IO handle to make sure dp is not device path * for CD/DVD. */ - nin = efipart_nhandles / sizeof (*efipart_handles); - for (i = 0; i < nin; i++) { + for (i = 0; i < efipart_nhandles; i++) { devpath = efi_lookup_devpath(efipart_handles[i]); if (devpath == NULL) return (false); @@ -340,10 +361,9 @@ efipart_updatefd(void) { EFI_DEVICE_PATH *devpath, *node; ACPI_HID_DEVICE_PATH *acpi; - int i, nin; + int i; - nin = efipart_nhandles / sizeof (*efipart_handles); - for (i = 0; i < nin; i++) { + for (i = 0; i < efipart_nhandles; i++) { devpath = efi_lookup_devpath(efipart_handles[i]); if (devpath == NULL) continue; @@ -410,14 +430,13 @@ efipart_cdinfo_add(EFI_HANDLE handle, EFI_HANDLE alias static void efipart_updatecd(void) { - int i, nin; + int i; EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; EFI_HANDLE handle; EFI_BLOCK_IO *blkio; EFI_STATUS status; - nin = efipart_nhandles / sizeof (*efipart_handles); - for (i = 0; i < nin; i++) { + for (i = 0; i < efipart_nhandles; i++) { devpath = efi_lookup_devpath(efipart_handles[i]); if (devpath == NULL) continue; @@ -666,14 +685,13 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) static void efipart_updatehd(void) { - int i, nin; + int i; EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; EFI_HANDLE handle; EFI_BLOCK_IO *blkio; EFI_STATUS status; - nin = efipart_nhandles / sizeof (*efipart_handles); - for (i = 0; i < nin; i++) { + for (i = 0; i < efipart_nhandles; i++) { devpath = efi_lookup_devpath(efipart_handles[i]); if (devpath == NULL) continue; From owner-svn-src-stable-11@freebsd.org Thu Feb 21 02:43:51 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6132214EAD4D; Thu, 21 Feb 2019 02:43:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 10D4585CC1; Thu, 21 Feb 2019 02:43:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01B47F1D7; Thu, 21 Feb 2019 02:43:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L2hoMD085836; Thu, 21 Feb 2019 02:43:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L2hmNk085825; Thu, 21 Feb 2019 02:43:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210243.x1L2hmNk085825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 02:43:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344408 - in stable/11/stand/libsa: . zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand/libsa: . zfs X-SVN-Commit-Revision: 344408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 10D4585CC1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 02:43:51 -0000 Author: kevans Date: Thu Feb 21 02:43:48 2019 New Revision: 344408 URL: https://svnweb.freebsd.org/changeset/base/344408 Log: MFC various libsa fixes: r337037-r337039, r337065, r337412-r337413, r337874, r338535, r338540, r339651, r339992-r339993, r340026 r337037: libsa: pointer differs in signedness A small cleanup, fix the argument type and while there, replace (char *)0 with NULL. r337038: libsa: bootp is using pointers with different sign Just change bp_file to char and same for variable s. r337039: libsa: assignment to char * from u_char * Cast to char * instead of u_char * r337065: libsa: dereferencing type-punned pointer in cd9660 The warning is given by gcc build, but it is good to fix anyhow. use bcopy instead of direct assignment. r337412: libsa: dos_checksum() should take unsigned chars Fix pointers to integers with different sign issue. r337413: libsa: gzipfs.c converts pointers to integer types with different sign Signed versus unsigned char. r337874: libsa: zfs_probe() needs to set spa to NULL Silence the warning about possibly uninitialized use of spa. r338535: libsa: memory leak in tftp_open() tftpfile is allocated just above and needs to be freed. r338540: libsa: validate tftp_makereq() after we did reset the read The name check referred in the comment is not the only possible error source, we need to validate the result. r339651: libsa: re-send ACK for older data packets in tftp In current tftp code we drop out-of-order packets; however, we should play nice and re-send ACK for older data packets we are receiving. This will hopefully stop server repeating those packets we already have received. Note we do not answer duplicates from "previous" session (that is, session with different port number), those will eventually time out. r339992: libsa: tftp should not read past file end When we have the file size via tsize option, use it to make sure we will not attempt to read past file end. r339993: libsa: tftp should use calloc instead of malloc() memset(), use calloc(). r340026: libsa: cstyle cleanup tftp.c No functinal changes intended. Modified: stable/11/stand/libsa/bootp.c stable/11/stand/libsa/bootp.h stable/11/stand/libsa/cd9660.c stable/11/stand/libsa/cd9660read.c stable/11/stand/libsa/dosfs.c stable/11/stand/libsa/gzipfs.c stable/11/stand/libsa/net.c stable/11/stand/libsa/nfs.c stable/11/stand/libsa/tftp.c stable/11/stand/libsa/zfs/zfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/bootp.c ============================================================================== --- stable/11/stand/libsa/bootp.c Thu Feb 21 02:41:57 2019 (r344407) +++ stable/11/stand/libsa/bootp.c Thu Feb 21 02:43:48 2019 (r344408) @@ -735,7 +735,7 @@ setenv_(u_char *cp, u_char *ep, struct dhcp_opt *opts bcopy(cp, buf, size); /* cannot overflow */ buf[size] = '\0'; for (endv = buf; endv; endv = vp) { - u_char *s = NULL; /* semicolon ? */ + char *s = NULL; /* semicolon ? */ /* skip leading whitespace */ while (*endv && strchr(" \t\n\r", *endv)) Modified: stable/11/stand/libsa/bootp.h ============================================================================== --- stable/11/stand/libsa/bootp.h Thu Feb 21 02:41:57 2019 (r344407) +++ stable/11/stand/libsa/bootp.h Thu Feb 21 02:43:48 2019 (r344408) @@ -39,7 +39,7 @@ struct bootp { struct in_addr bp_giaddr; /* gateway IP address */ unsigned char bp_chaddr[16]; /* client hardware address */ unsigned char bp_sname[64]; /* server host name */ - unsigned char bp_file[128]; /* boot file name */ + char bp_file[128]; /* boot file name */ #ifdef SUPPORT_DHCP #define BOOTP_VENDSIZE 312 #else Modified: stable/11/stand/libsa/cd9660.c ============================================================================== --- stable/11/stand/libsa/cd9660.c Thu Feb 21 02:41:57 2019 (r344407) +++ stable/11/stand/libsa/cd9660.c Thu Feb 21 02:43:48 2019 (r344408) @@ -304,7 +304,7 @@ cd9660_open(const char *path, struct open_file *f) if (isonum_723(vd->logical_block_size) != ISO_DEFAULT_BLOCK_SIZE) goto out; - rec = *(struct iso_directory_record *) vd->root_directory_record; + bcopy(vd->root_directory_record, &rec, sizeof(rec)); if (*path == '/') path++; /* eat leading '/' */ first = 1; Modified: stable/11/stand/libsa/cd9660read.c ============================================================================== --- stable/11/stand/libsa/cd9660read.c Thu Feb 21 02:41:57 2019 (r344407) +++ stable/11/stand/libsa/cd9660read.c Thu Feb 21 02:43:48 2019 (r344408) @@ -241,7 +241,7 @@ cd9660_lookup(const char *path) break; } - rec = *(struct iso_directory_record *) vd->root_directory_record; + bcopy(vd->root_directory_record, &rec, sizeof(rec)); if (*path == '/') path++; /* eat leading '/' */ first = 1; Modified: stable/11/stand/libsa/dosfs.c ============================================================================== --- stable/11/stand/libsa/dosfs.c Thu Feb 21 02:41:57 2019 (r344407) +++ stable/11/stand/libsa/dosfs.c Thu Feb 21 02:43:48 2019 (r344408) @@ -403,7 +403,7 @@ dos_stat(struct open_file *fd, struct stat *sb) } static int -dos_checksum(char *name, char *ext) +dos_checksum(unsigned char *name, unsigned char *ext) { int x, i; char buf[11]; Modified: stable/11/stand/libsa/gzipfs.c ============================================================================== --- stable/11/stand/libsa/gzipfs.c Thu Feb 21 02:41:57 2019 (r344407) +++ stable/11/stand/libsa/gzipfs.c Thu Feb 21 02:43:48 2019 (r344408) @@ -40,7 +40,7 @@ struct z_file int zf_rawfd; off_t zf_dataoffset; z_stream zf_zstream; - char zf_buf[Z_BUFSIZE]; + unsigned char zf_buf[Z_BUFSIZE]; int zf_endseen; }; Modified: stable/11/stand/libsa/net.c ============================================================================== --- stable/11/stand/libsa/net.c Thu Feb 21 02:41:57 2019 (r344407) +++ stable/11/stand/libsa/net.c Thu Feb 21 02:43:48 2019 (r344408) @@ -267,7 +267,7 @@ intoa(n_long addr) } static char * -number(char *s, int *n) +number(char *s, n_long *n) { for (*n = 0; isdigit(*s); s++) *n = (*n * 10) + *s - '0'; @@ -280,7 +280,7 @@ ip_convertaddr(char *p) #define IP_ANYADDR 0 n_long addr = 0, n; - if (p == (char *)0 || *p == '\0') + if (p == NULL || *p == '\0') return IP_ANYADDR; p = number(p, &n); addr |= (n << 24) & 0xff000000; Modified: stable/11/stand/libsa/nfs.c ============================================================================== --- stable/11/stand/libsa/nfs.c Thu Feb 21 02:41:57 2019 (r344407) +++ stable/11/stand/libsa/nfs.c Thu Feb 21 02:43:48 2019 (r344408) @@ -837,7 +837,7 @@ nfs_readdir(struct open_file *f, struct dirent *d) fp->off = cookie = ((uint64_t)ntohl(rent->nameplus[pos]) << 32) | ntohl(rent->nameplus[pos + 1]); pos += 2; - buf = (u_char *)&rent->nameplus[pos]; + buf = (char *)&rent->nameplus[pos]; return (0); err: Modified: stable/11/stand/libsa/tftp.c ============================================================================== --- stable/11/stand/libsa/tftp.c Thu Feb 21 02:41:57 2019 (r344407) +++ stable/11/stand/libsa/tftp.c Thu Feb 21 02:43:48 2019 (r344408) @@ -63,30 +63,29 @@ __FBSDID("$FreeBSD$"); struct tftp_handle; struct tftprecv_extra; -static ssize_t recvtftp(struct iodesc *d, void **pkt, void **payload, - time_t tleft, void *recv_extra); -static int tftp_open(const char *path, struct open_file *f); -static int tftp_close(struct open_file *f); -static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len); -static int tftp_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static off_t tftp_seek(struct open_file *f, off_t offset, int where); -static int tftp_set_blksize(struct tftp_handle *h, const char *str); -static int tftp_stat(struct open_file *f, struct stat *sb); +static ssize_t recvtftp(struct iodesc *, void **, void **, time_t, void *); +static int tftp_open(const char *, struct open_file *); +static int tftp_close(struct open_file *); +static int tftp_parse_oack(struct tftp_handle *, char *, size_t); +static int tftp_read(struct open_file *, void *, size_t, size_t *); +static off_t tftp_seek(struct open_file *, off_t, int); +static int tftp_set_blksize(struct tftp_handle *, const char *); +static int tftp_stat(struct open_file *, struct stat *); struct fs_ops tftp_fsops = { - "tftp", - tftp_open, - tftp_close, - tftp_read, - null_write, - tftp_seek, - tftp_stat, - null_readdir + .fs_name = "tftp", + .fo_open = tftp_open, + .fo_close = tftp_close, + .fo_read = tftp_read, + .fo_write = null_write, + .fo_seek = tftp_seek, + .fo_stat = tftp_stat, + .fo_readdir = null_readdir }; extern struct in_addr servip; -static int tftpport = 2000; +static int tftpport = 2000; static int is_open = 0; /* @@ -94,21 +93,21 @@ static int is_open = 0; * TFTP_REQUESTED_BLKSIZE of 1428 is (Ethernet MTU, less the TFTP, UDP and * IP header lengths). */ -#define TFTP_REQUESTED_BLKSIZE 1428 +#define TFTP_REQUESTED_BLKSIZE 1428 /* * Choose a blksize big enough so we can test with Ethernet * Jumbo frames in the future. */ -#define TFTP_MAX_BLKSIZE 9008 +#define TFTP_MAX_BLKSIZE 9008 struct tftp_handle { struct iodesc *iodesc; - int currblock; /* contents of lastdata */ - int islastblock; /* flag */ - int validsize; - int off; - char *path; /* saved for re-requests */ + int currblock; /* contents of lastdata */ + int islastblock; /* flag */ + int validsize; + int off; + char *path; /* saved for re-requests */ unsigned int tftp_blksize; unsigned long tftp_tsize; void *pkt; @@ -117,7 +116,7 @@ struct tftp_handle { struct tftprecv_extra { struct tftp_handle *tftp_handle; - unsigned short rtype; /* Received type */ + unsigned short rtype; /* Received type */ }; #define TFTP_MAX_ERRCODE EOPTNEG @@ -141,42 +140,42 @@ tftp_senderr(struct tftp_handle *h, u_short errcode, c { struct { u_char header[HEADER_SIZE]; - struct tftphdr t; + struct tftphdr t; u_char space[63]; /* +1 from t */ } __packed __aligned(4) wbuf; - char *wtail; - int len; + char *wtail; + int len; len = strlen(msg); if (len > sizeof(wbuf.space)) len = sizeof(wbuf.space); - wbuf.t.th_opcode = htons((u_short) ERROR); - wbuf.t.th_code = htons(errcode); + wbuf.t.th_opcode = htons((u_short)ERROR); + wbuf.t.th_code = htons(errcode); wtail = wbuf.t.th_msg; bcopy(msg, wtail, len); wtail[len] = '\0'; wtail += len + 1; - sendudp(h->iodesc, &wbuf.t, wtail - (char *) &wbuf.t); + sendudp(h->iodesc, &wbuf.t, wtail - (char *)&wbuf.t); } static void -tftp_sendack(struct tftp_handle *h) +tftp_sendack(struct tftp_handle *h, u_short block) { struct { u_char header[HEADER_SIZE]; struct tftphdr t; } __packed __aligned(4) wbuf; - char *wtail; + char *wtail; - wbuf.t.th_opcode = htons((u_short) ACK); - wtail = (char *) &wbuf.t.th_block; - wbuf.t.th_block = htons((u_short) h->currblock); + wbuf.t.th_opcode = htons((u_short)ACK); + wtail = (char *)&wbuf.t.th_block; + wbuf.t.th_block = htons(block); wtail += 2; - sendudp(h->iodesc, &wbuf.t, wtail - (char *) &wbuf.t); + sendudp(h->iodesc, &wbuf.t, wtail - (char *)&wbuf.t); } static ssize_t @@ -190,7 +189,7 @@ recvtftp(struct iodesc *d, void **pkt, void **payload, ssize_t len; errno = 0; - extra = (struct tftprecv_extra *)recv_extra; + extra = recv_extra; h = extra->tftp_handle; len = readudp(d, &ptr, (void **)&t, tleft); @@ -205,28 +204,36 @@ recvtftp(struct iodesc *d, void **pkt, void **payload, case DATA: { int got; - if (htons(t->th_block) != (u_short) d->xid) { + if (htons(t->th_block) < (u_short)d->xid) { /* - * Expected block? + * Apparently our ACK was missed, re-send. */ + tftp_sendack(h, htons(t->th_block)); free(ptr); return (-1); } + if (htons(t->th_block) != (u_short)d->xid) { + /* + * Packet from the future, drop this. + */ + free(ptr); + return (-1); + } if (d->xid == 1) { /* * First data packet from new port. */ struct udphdr *uh; - uh = (struct udphdr *) t - 1; + uh = (struct udphdr *)t - 1; d->destport = uh->uh_sport; - } /* else check uh_sport has not changed??? */ + } got = len - (t->th_data - (char *)t); *pkt = ptr; *payload = t; return (got); } case ERROR: - if ((unsigned) ntohs(t->th_code) > TFTP_MAX_ERRCODE) { + if ((unsigned)ntohs(t->th_code) > TFTP_MAX_ERRCODE) { printf("illegal tftp error %d\n", ntohs(t->th_code)); errno = EIO; } else { @@ -241,8 +248,8 @@ recvtftp(struct iodesc *d, void **pkt, void **payload, struct udphdr *uh; int tftp_oack_len; - /* - * Unexpected OACK. TFTP transfer already in progress. + /* + * Unexpected OACK. TFTP transfer already in progress. * Drop the pkt. */ if (d->xid != 1) { @@ -254,9 +261,9 @@ recvtftp(struct iodesc *d, void **pkt, void **payload, * Remember which port this OACK came from, because we need * to send the ACK or errors back to it. */ - uh = (struct udphdr *) t - 1; + uh = (struct udphdr *)t - 1; d->destport = uh->uh_sport; - + /* Parse options ACK-ed by the server. */ tftp_oack_len = len - sizeof(t->th_opcode); if (tftp_parse_oack(h, t->th_u.tu_stuff, tftp_oack_len) != 0) { @@ -288,9 +295,9 @@ tftp_makereq(struct tftp_handle *h) u_char space[FNAME_SIZE + 6]; } __packed __aligned(4) wbuf; struct tftprecv_extra recv_extra; - char *wtail; - int l; - ssize_t res; + char *wtail; + int l; + ssize_t res; void *pkt; struct tftphdr *t; char *tftp_blksize = NULL; @@ -304,7 +311,7 @@ tftp_makereq(struct tftp_handle *h) tftp_set_blksize(h, tftp_blksize); } - wbuf.t.th_opcode = htons((u_short) RRQ); + wbuf.t.th_opcode = htons((u_short)RRQ); wtail = wbuf.t.th_stuff; l = strlen(h->path); #ifdef TFTP_PREPEND_PATH @@ -329,7 +336,6 @@ tftp_makereq(struct tftp_handle *h) bcopy("0", wtail, 2); wtail += 2; - /* h->iodesc->myport = htons(--tftpport); */ h->iodesc->myport = htons(tftpport + (getsecs() & 0x3ff)); h->iodesc->destport = htons(IPPORT_TFTP); h->iodesc->xid = 1; /* expected block */ @@ -340,8 +346,8 @@ tftp_makereq(struct tftp_handle *h) pkt = NULL; recv_extra.tftp_handle = h; - res = sendrecv(h->iodesc, &sendudp, &wbuf.t, wtail - (char *) &wbuf.t, - (void *)&recvtftp, &pkt, (void **)&t, &recv_extra); + res = sendrecv(h->iodesc, &sendudp, &wbuf.t, wtail - (char *)&wbuf.t, + &recvtftp, &pkt, (void **)&t, &recv_extra); if (res == -1) { free(pkt); return (errno); @@ -364,7 +370,7 @@ tftp_makereq(struct tftp_handle *h) h->islastblock = 0; if (res < h->tftp_blksize) { h->islastblock = 1; /* very short file */ - tftp_sendack(h); + tftp_sendack(h, h->currblock); } return (0); } @@ -376,7 +382,7 @@ tftp_makereq(struct tftp_handle *h) } /* ack block, expect next */ -static int +static int tftp_getnextblock(struct tftp_handle *h) { struct { @@ -384,21 +390,22 @@ tftp_getnextblock(struct tftp_handle *h) struct tftphdr t; } __packed __aligned(4) wbuf; struct tftprecv_extra recv_extra; - char *wtail; - int res; + char *wtail; + int res; void *pkt; struct tftphdr *t; - wbuf.t.th_opcode = htons((u_short) ACK); - wtail = (char *) &wbuf.t.th_block; - wbuf.t.th_block = htons((u_short) h->currblock); + + wbuf.t.th_opcode = htons((u_short)ACK); + wtail = (char *)&wbuf.t.th_block; + wbuf.t.th_block = htons((u_short)h->currblock); wtail += 2; h->iodesc->xid = h->currblock + 1; /* expected block */ pkt = NULL; recv_extra.tftp_handle = h; - res = sendrecv(h->iodesc, &sendudp, &wbuf.t, wtail - (char *) &wbuf.t, - (void *)&recvtftp, &pkt, (void **)&t, &recv_extra); + res = sendrecv(h->iodesc, &sendudp, &wbuf.t, wtail - (char *)&wbuf.t, + &recvtftp, &pkt, (void **)&t, &recv_extra); if (res == -1) { /* 0 is OK! */ free(pkt); @@ -414,8 +421,8 @@ tftp_getnextblock(struct tftp_handle *h) h->islastblock = 1; /* EOF */ if (h->islastblock == 1) { - /* Send an ACK for the last block */ - wbuf.t.th_block = htons((u_short) h->currblock); + /* Send an ACK for the last block */ + wbuf.t.th_block = htons((u_short)h->currblock); sendudp(h->iodesc, &wbuf.t, wtail - (char *)&wbuf.t); } @@ -426,10 +433,10 @@ static int tftp_open(const char *path, struct open_file *f) { struct tftp_handle *tftpfile; - struct iodesc *io; - int res; - size_t pathsize; - const char *extraslash; + struct iodesc *io; + int res; + size_t pathsize; + const char *extraslash; if (netproto != NET_TFTP) return (EINVAL); @@ -440,15 +447,16 @@ tftp_open(const char *path, struct open_file *f) if (is_open) return (EBUSY); - tftpfile = (struct tftp_handle *) malloc(sizeof(*tftpfile)); + tftpfile = calloc(1, sizeof(*tftpfile)); if (!tftpfile) return (ENOMEM); - memset(tftpfile, 0, sizeof(*tftpfile)); tftpfile->tftp_blksize = TFTP_REQUESTED_BLKSIZE; - tftpfile->iodesc = io = socktodesc(*(int *) (f->f_devdata)); - if (io == NULL) + tftpfile->iodesc = io = socktodesc(*(int *)(f->f_devdata)); + if (io == NULL) { + free(tftpfile); return (EINVAL); + } io->destip = servip; tftpfile->off = 0; @@ -456,7 +464,7 @@ tftp_open(const char *path, struct open_file *f) tftpfile->path = malloc(pathsize); if (tftpfile->path == NULL) { free(tftpfile); - return(ENOMEM); + return (ENOMEM); } if (rootpath[strlen(rootpath) - 1] == '/' || path[0] == '/') extraslash = ""; @@ -467,7 +475,7 @@ tftp_open(const char *path, struct open_file *f) if (res < 0 || res > pathsize) { free(tftpfile->path); free(tftpfile); - return(ENOMEM); + return (ENOMEM); } res = tftp_makereq(tftpfile); @@ -478,7 +486,7 @@ tftp_open(const char *path, struct open_file *f) free(tftpfile); return (res); } - f->f_fsdata = (void *) tftpfile; + f->f_fsdata = tftpfile; is_open = 1; return (0); } @@ -488,8 +496,19 @@ tftp_read(struct open_file *f, void *addr, size_t size size_t *resid /* out */) { struct tftp_handle *tftpfile; - tftpfile = (struct tftp_handle *) f->f_fsdata; + size_t res; + int rc; + rc = 0; + res = size; + tftpfile = f->f_fsdata; + + /* Make sure we will not read past file end */ + if (tftpfile->tftp_tsize > 0 && + tftpfile->off + size > tftpfile->tftp_tsize) { + size = tftpfile->tftp_tsize - tftpfile->off; + } + while (size > 0) { int needblock, count; @@ -499,19 +518,19 @@ tftp_read(struct open_file *f, void *addr, size_t size if (tftpfile->currblock > needblock) { /* seek backwards */ tftp_senderr(tftpfile, 0, "No error: read aborted"); - tftp_makereq(tftpfile); /* no error check, it worked - * for open */ + rc = tftp_makereq(tftpfile); + if (rc != 0) + break; } while (tftpfile->currblock < needblock) { - int res; - res = tftp_getnextblock(tftpfile); - if (res) { /* no answer */ + rc = tftp_getnextblock(tftpfile); + if (rc) { /* no answer */ #ifdef TFTP_DEBUG printf("tftp: read error\n"); #endif - return (res); + return (rc); } if (tftpfile->islastblock) break; @@ -537,6 +556,7 @@ tftp_read(struct open_file *f, void *addr, size_t size addr = (char *)addr + count; tftpfile->off += count; size -= count; + res -= count; if ((tftpfile->islastblock) && (count == inbuffer)) break; /* EOF */ @@ -549,16 +569,16 @@ tftp_read(struct open_file *f, void *addr, size_t size } - if (resid) - *resid = size; - return (0); + if (resid != NULL) + *resid = res; + return (rc); } -static int +static int tftp_close(struct open_file *f) { struct tftp_handle *tftpfile; - tftpfile = (struct tftp_handle *) f->f_fsdata; + tftpfile = f->f_fsdata; /* let it time out ... */ @@ -571,17 +591,17 @@ tftp_close(struct open_file *f) return (0); } -static int +static int tftp_stat(struct open_file *f, struct stat *sb) { struct tftp_handle *tftpfile; - tftpfile = (struct tftp_handle *) f->f_fsdata; + tftpfile = f->f_fsdata; sb->st_mode = 0444 | S_IFREG; sb->st_nlink = 1; sb->st_uid = 0; sb->st_gid = 0; - sb->st_size = (off_t) tftpfile->tftp_tsize; + sb->st_size = tftpfile->tftp_tsize; return (0); } @@ -589,7 +609,7 @@ static off_t tftp_seek(struct open_file *f, off_t offset, int where) { struct tftp_handle *tftpfile; - tftpfile = (struct tftp_handle *) f->f_fsdata; + tftpfile = f->f_fsdata; switch (where) { case SEEK_SET: @@ -608,7 +628,7 @@ tftp_seek(struct open_file *f, off_t offset, int where static int tftp_set_blksize(struct tftp_handle *h, const char *str) { - char *endptr; + char *endptr; int new_blksize; int ret = 0; @@ -623,8 +643,8 @@ tftp_set_blksize(struct tftp_handle *h, const char *st * RFC2348 specifies that acceptable values are 8-65464. * Let's choose a limit less than MAXRSPACE. */ - if (*endptr == '\0' && new_blksize >= 8 - && new_blksize <= TFTP_MAX_BLKSIZE) { + if (*endptr == '\0' && new_blksize >= 8 && + new_blksize <= TFTP_MAX_BLKSIZE) { h->tftp_blksize = new_blksize; ret = 1; } @@ -655,10 +675,10 @@ tftp_set_blksize(struct tftp_handle *h, const char *st * optN, valueN * The final option/value acknowledgment pair. */ -static int +static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len) { - /* + /* * We parse the OACK strings into an array * of name-value pairs. */ @@ -668,7 +688,7 @@ tftp_parse_oack(struct tftp_handle *h, char *buf, size int option_idx = 0; int blksize_is_set = 0; int tsize = 0; - + unsigned int orig_blksize; while (option_idx < 128 && i < len) { @@ -685,26 +705,30 @@ tftp_parse_oack(struct tftp_handle *h, char *buf, size /* Save the block size we requested for sanity check later. */ orig_blksize = h->tftp_blksize; - /* + /* * Parse individual TFTP options. * * "blksize" is specified in RFC2348. * * "tsize" is specified in RFC2349. - */ + */ for (i = 0; i < option_idx; i += 2) { - if (strcasecmp(tftp_options[i], "blksize") == 0) { - if (i + 1 < option_idx) - blksize_is_set = - tftp_set_blksize(h, tftp_options[i + 1]); - } else if (strcasecmp(tftp_options[i], "tsize") == 0) { - if (i + 1 < option_idx) - tsize = strtol(tftp_options[i + 1], (char **)NULL, 10); - if (tsize != 0) - h->tftp_tsize = tsize; - } else { - /* Do not allow any options we did not expect to be ACKed. */ - printf("unexpected tftp option '%s'\n", tftp_options[i]); - return (-1); - } + if (strcasecmp(tftp_options[i], "blksize") == 0) { + if (i + 1 < option_idx) + blksize_is_set = + tftp_set_blksize(h, tftp_options[i + 1]); + } else if (strcasecmp(tftp_options[i], "tsize") == 0) { + if (i + 1 < option_idx) + tsize = strtol(tftp_options[i + 1], NULL, 10); + if (tsize != 0) + h->tftp_tsize = tsize; + } else { + /* + * Do not allow any options we did not expect to be + * ACKed. + */ + printf("unexpected tftp option '%s'\n", + tftp_options[i]); + return (-1); + } } if (!blksize_is_set) { @@ -726,5 +750,5 @@ tftp_parse_oack(struct tftp_handle *h, char *buf, size printf("tftp_blksize: %u\n", h->tftp_blksize); printf("tftp_tsize: %lu\n", h->tftp_tsize); #endif - return 0; + return (0); } Modified: stable/11/stand/libsa/zfs/zfs.c ============================================================================== --- stable/11/stand/libsa/zfs/zfs.c Thu Feb 21 02:41:57 2019 (r344407) +++ stable/11/stand/libsa/zfs/zfs.c Thu Feb 21 02:43:48 2019 (r344408) @@ -467,6 +467,7 @@ zfs_probe(int fd, uint64_t *pool_guid) spa_t *spa; int ret; + spa = NULL; ret = vdev_probe(vdev_read, (void *)(uintptr_t)fd, &spa); if (ret == 0 && pool_guid != NULL) *pool_guid = spa->spa_guid; From owner-svn-src-stable-11@freebsd.org Thu Feb 21 02:48:39 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7708D14EB124; Thu, 21 Feb 2019 02:48:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1AE1A860FD; Thu, 21 Feb 2019 02:48:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C57BF1E5; Thu, 21 Feb 2019 02:48:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L2mcl8086180; Thu, 21 Feb 2019 02:48:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L2mcJ0086179; Thu, 21 Feb 2019 02:48:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210248.x1L2mcJ0086179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 02:48:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344410 - stable/11/stand/efi/loader X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/efi/loader X-SVN-Commit-Revision: 344410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1AE1A860FD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 02:48:39 -0000 Author: kevans Date: Thu Feb 21 02:48:38 2019 New Revision: 344410 URL: https://svnweb.freebsd.org/changeset/base/344410 Log: MFC r337131, r337231: stand: efipart fixes r337131: loader.efi: efipart_inithandles() failure should not prevent devsw initialization The efipart_inithandles() can return error code when there are no block devices, however, we still should walk and initialize devsw. r337231: loader.efi: clean up misleading noise from missing block devices If there are no block devices, there is no need to printout error (ENOENT). In case of netboot, our image path has no block device, no need to make noise about it. Modified: stable/11/stand/efi/loader/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Thu Feb 21 02:46:32 2019 (r344409) +++ stable/11/stand/efi/loader/main.c Thu Feb 21 02:48:38 2019 (r344410) @@ -338,8 +338,6 @@ find_currdev(EFI_LOADED_IMAGE *img) return (0); } } - } else { - printf("Can't find device by handle\n"); } /* @@ -642,12 +640,15 @@ main(int argc, CHAR16 *argv[]) * Scan the BLOCK IO MEDIA handles then * march through the device switch probing for things. */ - if ((i = efipart_inithandles()) == 0) { - for (i = 0; devsw[i] != NULL; i++) - if (devsw[i]->dv_init != NULL) - (devsw[i]->dv_init)(); - } else - printf("efipart_inithandles failed %d, expect failures", i); + i = efipart_inithandles(); + if (i != 0 && i != ENOENT) { + printf("efipart_inithandles failed with ERRNO %d, expect " + "failures\n", i); + } + + for (i = 0; devsw[i] != NULL; i++) + if (devsw[i]->dv_init != NULL) + (devsw[i]->dv_init)(); printf("%s\n", bootprog_info); printf(" Command line arguments:"); From owner-svn-src-stable-11@freebsd.org Thu Feb 21 06:16:13 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B12014F72A3; Thu, 21 Feb 2019 06:16:13 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D67268FE20; Thu, 21 Feb 2019 06:16:12 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x1L6G7Pj018722; Wed, 20 Feb 2019 22:16:07 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id x1L6G7SV018721; Wed, 20 Feb 2019 22:16:07 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201902210616.x1L6G7SV018721@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r344414 - stable/11 In-Reply-To: <201902210322.x1L3MKeV007120@repo.freebsd.org> To: Kyle Evans Date: Wed, 20 Feb 2019 22:16:07 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: D67268FE20 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 06:16:13 -0000 > Author: kevans > Date: Thu Feb 21 03:22:20 2019 > New Revision: 344414 > URL: https://svnweb.freebsd.org/changeset/base/344414 > > Log: > MFC (RECORD ONLY) r338050: Loader default interpreter flip > > The default interpreter for stable/11 is 4th; this will never and can never > change. Record MFC of r338050 to proactively prevent any accidents in future > batching of MFCs. > > Modified: > Directory Properties: > stable/11/ (props changed) Does it make sense to do a direct commit to stable/11 marking the line that does this flip with a "Do not change this in the stable/11 branch" so that someone does not try to manually merge the change if they happen to notice the code is different? -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Thu Feb 21 06:20:18 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C638A14F763E; Thu, 21 Feb 2019 06:20:18 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25C4890130; Thu, 21 Feb 2019 06:20:17 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x1L6KG3x018739; Wed, 20 Feb 2019 22:20:16 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id x1L6KGnv018738; Wed, 20 Feb 2019 22:20:16 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201902210620.x1L6KGnv018738@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r344418 - stable/11 In-Reply-To: <201902210348.x1L3meFu018887@repo.freebsd.org> To: Kyle Evans Date: Wed, 20 Feb 2019 22:20:16 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 25C4890130 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 06:20:18 -0000 > Author: kevans > Date: Thu Feb 21 03:48:39 2019 > New Revision: 344418 > URL: https://svnweb.freebsd.org/changeset/base/344418 > > Log: > Direct commit for post-mortem UPDATING update regarding lualoader > > Indicate that it's been merged (after some delay since lua came back to this > branch) and how one can test lua, both by swapping build knobs and creating > links in /boot. > > Modified: > stable/11/UPDATING > > Modified: stable/11/UPDATING > ============================================================================== > --- stable/11/UPDATING Thu Feb 21 03:39:51 2019 (r344417) > +++ stable/11/UPDATING Thu Feb 21 03:48:39 2019 (r344418) > @@ -17,6 +17,20 @@ the tip of head, and then rebuild without this option. > from older version of current across the gcc/clang cutover is a bit fragile. > > 20190220: > + Co-existance for Forth and Lua interpreters in bootloaders has now been > + merged to ease testing of lualoader. LOADER_DEFAULT_INTERP, documented > + in build(7), may be used to control which interpreter flavor is used in > + the default loader to be installed. For systems where Lua and Forth > + coexist, this switch can also be made on a running system by creating a > + link from /boot/loader_${flavor}{,efi} to /boot/loader{,.efi} rather ^. missing And is not the direction of that link reversed? /boot/loader_${,.efi} -> /boot/loader_${flavor}{,.efi} is what I would expect the link to be for this. > + than requiring a rebuild. > + > + The default flavor in this branch will remain Forth. As indicated in > + the 20190216 UPDATING entry, booting is a complex environment; it would > + be prudent to assume that lualoader may not work for your setup and make > + provisions for backup boot methods. > + > +20190220: > zfsloader's functionality has now been folded into loader. > zfsloader is no longer necesasary once you've updated your > boot blocks. For a transition period, we will install a > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Thu Feb 21 02:52:28 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F40814EB3FB; Thu, 21 Feb 2019 02:52:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DFC48659E; Thu, 21 Feb 2019 02:52:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF3E2F396; Thu, 21 Feb 2019 02:52:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L2qRLe091306; Thu, 21 Feb 2019 02:52:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L2qRtl091304; Thu, 21 Feb 2019 02:52:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210252.x1L2qRtl091304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 02:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344412 - stable/11/stand/efi/loader X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/efi/loader X-SVN-Commit-Revision: 344412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0DFC48659E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.945,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 02:52:28 -0000 Author: kevans Date: Thu Feb 21 02:52:27 2019 New Revision: 344412 URL: https://svnweb.freebsd.org/changeset/base/344412 Log: MFC r336837: Be more conservative about setting hw.uart.console Note when we've found a 8250 PNP node. Only try to set hw.uart.console if we see one (otherwise ignore serial hints). The 8250 is the only one known to have I/O ports, so limit the guessing to when we've positively seen one. And limit this to x86 since that's the only platform where we have I/O ports. Otherwise, we'd set the serial port to something crazy for the platform and fall off the cliff early in boot. Modified: stable/11/stand/efi/loader/bootinfo.c stable/11/stand/efi/loader/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/loader/bootinfo.c ============================================================================== --- stable/11/stand/efi/loader/bootinfo.c Thu Feb 21 02:50:45 2019 (r344411) +++ stable/11/stand/efi/loader/bootinfo.c Thu Feb 21 02:52:27 2019 (r344412) @@ -82,10 +82,13 @@ bi_getboothowto(char *kargs) howto |= RB_SERIAL; if (strcmp(console, "nullconsole") == 0) howto |= RB_MUTE; - if (strcmp(console, "efi") == 0) { +#if defined(__i386__) || defined(__amd64__) + if (strcmp(console, "efi") == 0 && + getenv("efi_8250_uid") != NULL && + getenv("hw.uart.console") == NULL) { /* - * If we found a com port and com speed, we need to tell - * the kernel where the serial port is, and how + * If we found a 8250 com port and com speed, we need to + * tell the kernel where the serial port is, and how * fast. Ideally, we'd get the port from ACPI, but that * isn't running in the loader. Do the next best thing * by allowing it to be set by a loader.conf variable, @@ -93,24 +96,31 @@ bi_getboothowto(char *kargs) * comconsole_port if not. PCI support is needed, but * for that we'd ideally refactor the * libi386/comconsole.c code to have identical behavior. + * We only try to set the port for cases where we saw + * the Serial(x) node when parsing, otherwise + * specialized hardware that has Uart nodes will have a + * bogus address set. + * But if someone specifically setup hw.uart.console, + * don't override that. */ + speed = -1; + port = -1; tmp = getenv("efi_com_speed"); - if (tmp != NULL) { + if (tmp != NULL) speed = strtol(tmp, NULL, 0); - tmp = getenv("efi_com_port"); - if (tmp == NULL) - tmp = getenv("comconsole_port"); - /* XXX fallback to EFI variable set in rc.d? */ - if (tmp != NULL) - port = strtol(tmp, NULL, 0); - else - port = 0x3f8; + tmp = getenv("efi_com_port"); + if (tmp == NULL) + tmp = getenv("comconsole_port"); + if (tmp != NULL) + port = strtol(tmp, NULL, 0); + if (speed != -1 && port != -1) { snprintf(buf, sizeof(buf), "io:%d,br:%d", port, speed); env_setenv("hw.uart.console", EV_VOLATILE, buf, NULL, NULL); } } +#endif } return (howto); Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Thu Feb 21 02:50:45 2019 (r344411) +++ stable/11/stand/efi/loader/main.c Thu Feb 21 02:52:27 2019 (r344412) @@ -435,6 +435,15 @@ parse_args(int argc, CHAR16 *argv[]) return (howto); } +static void +setenv_int(const char *key, int val) +{ + char buf[20]; + + snprintf(buf, sizeof(buf), "%d", val); + setenv(key, buf, 1); +} + /* * Parse ConOut (the list of consoles active) and see if we can find a * serial port and/or a video port. It would be nice to also walk the @@ -466,15 +475,15 @@ parse_uefi_con_out(void) DevicePathSubType(node) == ACPI_DP) { /* Check for Serial node */ acpi = (void *)node; - if (EISA_ID_TO_NUM(acpi->HID) == 0x501) + if (EISA_ID_TO_NUM(acpi->HID) == 0x501) { + setenv_int("efi_8250_uid", acpi->UID); com_seen = ++seen; + } } else if (DevicePathType(node) == MESSAGING_DEVICE_PATH && DevicePathSubType(node) == MSG_UART_DP) { - char bd[16]; uart = (void *)node; - snprintf(bd, sizeof(bd), "%d", uart->BaudRate); - setenv("efi_com_speed", bd, 1); + setenv_int("efi_com_speed", uart->BaudRate); } else if (DevicePathType(node) == ACPI_DEVICE_PATH && DevicePathSubType(node) == ACPI_ADR_DP) { /* Check for AcpiAdr() Node for video */ From owner-svn-src-stable-11@freebsd.org Thu Feb 21 02:46:33 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53FC214EB074; Thu, 21 Feb 2019 02:46:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA3FA85FF6; Thu, 21 Feb 2019 02:46:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBC14F1E0; Thu, 21 Feb 2019 02:46:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L2kWuo086033; Thu, 21 Feb 2019 02:46:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L2kW7g086031; Thu, 21 Feb 2019 02:46:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210246.x1L2kW7g086031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 02:46:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344409 - in stable/11/stand/efi: boot1 loader/arch/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand/efi: boot1 loader/arch/arm64 X-SVN-Commit-Revision: 344409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EA3FA85FF6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 02:46:33 -0000 Author: kevans Date: Thu Feb 21 02:46:32 2019 New Revision: 344409 URL: https://svnweb.freebsd.org/changeset/base/344409 Log: MFC r338337: Fix lualoader on arm64 Lua has a few places where it allocates a large buffer on the stack. This is normally fine, except there are a few places where there can be multiple frames with this buffer. This can cause a stack overflow on some arm64 SoCs. Fix this by allocating our own stack in loader.efi large enough for these objects. The required size has been found by tracing how the stack pointer changes in a virtual machine and found to be no larger than 50kB. A larger stack is allocated to reduce the likelihood of overflow from future changes. Modified: stable/11/stand/efi/boot1/Makefile stable/11/stand/efi/loader/arch/arm64/start.S Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/boot1/Makefile ============================================================================== --- stable/11/stand/efi/boot1/Makefile Thu Feb 21 02:43:48 2019 (r344408) +++ stable/11/stand/efi/boot1/Makefile Thu Feb 21 02:46:32 2019 (r344409) @@ -6,6 +6,7 @@ PROG= boot1.sym INTERNALPROG= WARNS?= 6 +CFLAGS+= -DEFI_BOOT1 # We implement a slightly non-standard %S in that it always takes a # CHAR16 that's common in UEFI-land instead of a wchar_t. This only # seems to matter on arm64 where wchar_t defaults to an int instead Modified: stable/11/stand/efi/loader/arch/arm64/start.S ============================================================================== --- stable/11/stand/efi/loader/arch/arm64/start.S Thu Feb 21 02:43:48 2019 (r344408) +++ stable/11/stand/efi/loader/arch/arm64/start.S Thu Feb 21 02:46:32 2019 (r344409) @@ -160,6 +160,23 @@ _start: ldp x0, x1, [sp], #16 +#ifndef EFI_BOOT1 + /* + * Load the stack to use. The default stack may be too small for + * the lua loader. + */ + adr x2, initstack_end + mov sp, x2 +#endif + bl efi_main 1: b 1b + +#ifndef EFI_BOOT1 +.bss + .align 4 +initstack: + .space (64 * 1024) +initstack_end: +#endif From owner-svn-src-stable-11@freebsd.org Thu Feb 21 03:18:18 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1BB314ECA1C; Thu, 21 Feb 2019 03:18:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E8868743F; Thu, 21 Feb 2019 03:18:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E027F7C6; Thu, 21 Feb 2019 03:18:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L3IHjm002956; Thu, 21 Feb 2019 03:18:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L3IDMI002935; Thu, 21 Feb 2019 03:18:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210318.x1L3IDMI002935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 03:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344413 - in stable/11: release/tools share/mk stand stand/common stand/efi stand/efi/loader stand/efi/loader_4th stand/efi/loader_lua stand/efi/loader_simp stand/i386 stand/i386/loader... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: release/tools share/mk stand stand/common stand/efi stand/efi/loader stand/efi/loader_4th stand/efi/loader_lua stand/efi/loader_simp stand/i386 stand/i386/loader stand/i386/loader_4th st... X-SVN-Commit-Revision: 344413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9E8868743F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 03:18:18 -0000 Author: kevans Date: Thu Feb 21 03:18:12 2019 New Revision: 344413 URL: https://svnweb.freebsd.org/changeset/base/344413 Log: MFC Loader Interpreter Coexistance: r337806, r337868, r337914, r337927, r337989, r338052, r338064, r338407, r338418, r338474 r337806: Create a loader for each interpreter for x86 BIOS and all EFI Create loader_{4th,lua,simp}{,.efi}. All of these are installed by default. Create LOADER_DEFAULT_INTERP to specify the default interpreter when no other is specified. LOADER_INTERP is the current interpreter language building. Turn building of lua on by default to match 4th. simploader is a simplified loader build w/o any interpreter language (but with a simple loader). This is the historic behavir you got with WITHOUT_FORTH. Make a hard link to the default loader. This has to be a hard link rather than the more desirable soft link because older zfsboot blocks don't support symlinks. r337868: stand: Use -Oz/-Os for all loader/stand builds. While we're not super size constrained, the x86 BIOS /boot/loader has to be less than about 520k-530k to be reliable. The LUA loader is at this size today. -Oz saves 15-20% on the size, keeping us safely small enough (comparable to where we were with the 4th loader). This will also help with sjg's work on bringing in bearssl, though we may again be looking for space in the LUA loader. Size table for clang 6.0.0: default -O1 -Os -Oz 4th 442368 417792 389120 376832 lua 524288 479232 446464 430080 r337914: Install links for loader.efi. r337927: Add ashldi3 and ashrdi3 to mips. Now that we're using -Os, mips needs these routines. r337989: Copy the boot loader from the new location for the co-existing loaders. r338052: libsa: Add lshrdi3.c for powerpc* and mips r338064: Turn back the clock just a little: make userboot.so always be 4th Turns out there was a hidden dependency we hasn't counted upon. The host load /boot/userboot.so to boot the VMs it runs. This means that the change to lua meant suddently that nobody could run their older VMs because LUA wasn't in 10.0, last month's HardenedBSD, 11.2 or whatever. Even more than for the /boot/loader* binaries, we need a good coexistance strategy for this. While that's being designed and implemented, drop back to always 4th for userboot.so. This will fail safe in all but the most extreme environments (but lua-only hacks to .lua files won't be processes in VMs until we fix it). r338407: lualoader: Print error messages from command failures at the prompt Previously lualoader would remain silent, rather than printing command_errmsg or noting that a command had failed or was not found. r338418: userboot: handle guest interpreter mismatches more intelligently The switch to lualoader creates a problem with userboot: the host is inclined to build userboot with Lua, but the host userboot's interpreter must match what's available on the guest. For almost all FreeBSD guests in the wild, Lua is not yet available and a Lua-based userboot will fail. This revision updates userboot protocol to version 5, which adds a swap_interpreter callback to request a different interpreter, and tries to determine the proper interpreter to be used based on how the guest /boot/loader is compiled. This is still a bit of a guess, but it's likely the best possible guess we can make in order to get it right. The interpreter is now embedded in the resulting executable, so we can open /boot/loader on the guest and hunt that down to derive the interpreter it was built with. Using -l with bhyveload will not allow an intepreter swap, even if the loader specified happens to be a userboot with the wrong interpreter. We'll simply complain about the mismatch and bail out. For legacy guests without the interpreter marker, we assume they're 4th. For new guests with the interpreter marker, we'll read it and swap over to the proper interpreter if it doesn't match what the userboot we're using was compiled with. Both flavors of userboot are installed by default, userboot_4th.so and userboot_lua.so. This fixes the build WITHOUT_FORTH as a coincidence, which was broken by userboot being forced to 4th. r338474: Be a little conservative about when to force size optimizations. Reports have come in that there's issue with powerpc and sparc64 since we've switched to using -Oz / -Os. We don't strictly need them for !x86, so be conservative about when we enable them. Added: stable/11/stand/efi/loader_4th/ - copied from r337806, head/stand/efi/loader_4th/ stable/11/stand/efi/loader_lua/ - copied from r337806, head/stand/efi/loader_lua/ stable/11/stand/efi/loader_simp/ - copied from r337806, head/stand/efi/loader_simp/ stable/11/stand/i386/loader_4th/ - copied from r337806, head/stand/i386/loader_4th/ stable/11/stand/i386/loader_lua/ - copied from r337806, head/stand/i386/loader_lua/ stable/11/stand/i386/loader_simp/ - copied from r337806, head/stand/i386/loader_simp/ stable/11/stand/userboot/userboot_4th/ - copied from r338418, head/stand/userboot/userboot_4th/ stable/11/stand/userboot/userboot_lua/ - copied from r338418, head/stand/userboot/userboot_lua/ Modified: stable/11/release/tools/arm.subr stable/11/share/mk/src.opts.mk stable/11/stand/common/bootstrap.h stable/11/stand/common/interp_forth.c stable/11/stand/common/interp_lua.c stable/11/stand/common/interp_simple.c stable/11/stand/defs.mk stable/11/stand/efi/Makefile stable/11/stand/efi/loader/Makefile stable/11/stand/i386/Makefile stable/11/stand/i386/loader/Makefile stable/11/stand/i386/pxeldr/Makefile stable/11/stand/libsa/Makefile stable/11/stand/loader.mk stable/11/stand/userboot/Makefile stable/11/stand/userboot/userboot.h stable/11/stand/userboot/userboot/Makefile stable/11/stand/userboot/userboot/main.c stable/11/stand/userboot/userboot/version stable/11/usr.sbin/bhyveload/bhyveload.c Directory Properties: stable/11/ (props changed) Modified: stable/11/release/tools/arm.subr ============================================================================== --- stable/11/release/tools/arm.subr Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/release/tools/arm.subr Thu Feb 21 03:18:12 2019 (r344413) @@ -152,7 +152,7 @@ arm_install_boot() { BOOTFILES="$(chroot ${CHROOTDIR} realpath ${BOOTFILES})" chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/EFI/BOOT - chroot ${CHROOTDIR} cp -p ${BOOTFILES}/efi/loader/loader.efi \ + chroot ${CHROOTDIR} cp -p ${BOOTFILES}/efi/loader_lua/loader_lua.efi \ ${FATMOUNT}/EFI/BOOT/$(efi_boot_name ${EMBEDDED_TARGET}) chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/share/mk/src.opts.mk Thu Feb 21 03:18:12 2019 (r344413) @@ -126,6 +126,7 @@ __DEFAULT_YES_OPTIONS = \ LIBPTHREAD \ LIBTHR \ LOADER_GELI \ + LOADER_LUA \ LOADER_OFW \ LOADER_UBOOT \ LOCALES \ @@ -196,7 +197,6 @@ __DEFAULT_NO_OPTIONS = \ LINT \ LOADER_FIREWIRE \ LOADER_FORCE_LE \ - LOADER_LUA \ NAND \ OFED_EXTRA \ OPENLDAP \ Modified: stable/11/stand/common/bootstrap.h ============================================================================== --- stable/11/stand/common/bootstrap.h Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/common/bootstrap.h Thu Feb 21 03:18:12 2019 (r344413) @@ -164,6 +164,14 @@ extern int isapnp_readport; extern char bootprog_info[]; /* + * Interpreter information + */ +extern const char bootprog_interp[]; +#define INTERP_DEFINE(interpstr) \ +const char bootprog_interp[] = "$Interpreter:" interpstr + + +/* * Preloaded file metadata header. * * Metadata are allocated on our heap, and copied into kernel space Modified: stable/11/stand/common/interp_forth.c ============================================================================== --- stable/11/stand/common/interp_forth.c Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/common/interp_forth.c Thu Feb 21 03:18:12 2019 (r344413) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include "ficl.h" extern unsigned bootprog_rev; +INTERP_DEFINE("4th"); /* #define BFORTH_DEBUG */ Modified: stable/11/stand/common/interp_lua.c ============================================================================== --- stable/11/stand/common/interp_lua.c Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/common/interp_lua.c Thu Feb 21 03:18:12 2019 (r344413) @@ -60,6 +60,7 @@ static struct interp_lua_softc lua_softc; #define LDBG(...) #endif +INTERP_DEFINE("lua"); static void * interp_lua_realloc(void *ud __unused, void *ptr, size_t osize __unused, size_t nsize) @@ -135,7 +136,7 @@ interp_run(const char *line) char **argv; lua_State *luap; struct interp_lua_softc *softc = &lua_softc; - int status; + int status, ret; luap = softc->luap; LDBG("executing line..."); @@ -147,14 +148,16 @@ interp_run(const char *line) * run it through cli_execute. If that fails, then we'll try it * as a builtin. */ + command_errmsg = NULL; if (parse(&argc, &argv, line) == 0) { lua_getglobal(luap, "cli_execute"); for (nargc = 0; nargc < argc; ++nargc) { lua_pushstring(luap, argv[nargc]); } status = lua_pcall(luap, argc, 1, 0); + ret = lua_tointeger(luap, 1); lua_pop(luap, 1); - if (status != 0) { + if (status != 0 || ret != 0) { /* * Lua cli_execute will pass the function back * through loader.command, which is a proxy to @@ -166,7 +169,10 @@ interp_run(const char *line) status = interp_builtin_cmd(argc, argv); } if (status != 0) { - printf("Command failed\n"); + if (command_errmsg != NULL) + printf("%s\n", command_errmsg); + else + printf("Command failed\n"); status = CMD_ERROR; } free(argv); Modified: stable/11/stand/common/interp_simple.c ============================================================================== --- stable/11/stand/common/interp_simple.c Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/common/interp_simple.c Thu Feb 21 03:18:12 2019 (r344413) @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" +INTERP_DEFINE("simp"); + void interp_init(void) { Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/defs.mk Thu Feb 21 03:18:12 2019 (r344413) @@ -53,8 +53,15 @@ CFLAGS+= -I${SASRC} -D_STANDALONE CFLAGS+= -I${SYSDIR} # Spike the floating point interfaces CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" +# Slim down the image. This saves about 15% in size with clang 6 on x86 +# Our most constrained /boot/loader env is BIOS booting on x86, where +# our text + data + BTX have to fit into 640k below the ISA hole. +# Experience has shown that problems arise between ~520k to ~530k. +CFLAGS.clang+= -Oz +CFLAGS.gcc+= -Os +.endif - # GELI Support, with backward compat hooks (mostly) .if defined(LOADER_NO_GELI_SUPPORT) MK_LOADER_GELI=no @@ -145,6 +152,18 @@ CFLAGS+= -G0 -fno-pic -mno-abicalls CFLAGS+= -mlittle-endian .endif .endif + +# +# Have a sensible default +# +.if ${MK_FORTH} == "yes" +LOADER_DEFAULT_INTERP?=4th +.elif ${MK_LOADER_LUA} == "yes" +LOADER_DEFAULT_INTERP?=lua +.else +LOADER_DEFAULT_INTERP?=simp +.endif +LOADER_INTERP?=${LOADER_DEFAULT_INTERP} # Make sure we use the machine link we're about to create CFLAGS+=-I. Modified: stable/11/stand/efi/Makefile ============================================================================== --- stable/11/stand/efi/Makefile Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/efi/Makefile Thu Feb 21 03:18:12 2019 (r344413) @@ -9,7 +9,10 @@ NO_OBJ=t .if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500 SUBDIR.${MK_FDT}+= fdt -SUBDIR.yes+= libefi loader boot1 +SUBDIR.yes+= libefi boot1 +SUBDIR.${MK_FORTH}+= loader_4th +SUBDIR.${MK_LOADER_LUA}+= loader_lua +SUBDIR.yes+= loader_simp .endif # ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500 Modified: stable/11/stand/efi/loader/Makefile ============================================================================== --- stable/11/stand/efi/loader/Makefile Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/efi/loader/Makefile Thu Feb 21 03:18:12 2019 (r344413) @@ -8,7 +8,8 @@ LOADER_EXT2FS_SUPPORT?= no .include -PROG= loader.sym +LOADER?= loader_${LOADER_INTERP} +PROG= ${LOADER}.sym INTERNALPROG= WARNS?= 3 @@ -24,6 +25,7 @@ SRCS= autoload.c \ smbios.c \ vers.c +CFLAGS+= -I${.CURDIR}/../loader .if ${MK_LOADER_ZFS} != "no" CFLAGS+= -I${ZFSSRC} CFLAGS+= -DEFI_ZFS_BOOT @@ -41,10 +43,11 @@ CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitializ # warnings for now. CWARNFLAGS.main.c+= -Wno-format -.PATH: ${.CURDIR}/arch/${MACHINE} -# For smbios.c +.PATH: ${.CURDIR}/../loader +.PATH: ${.CURDIR}/../loader/arch/${MACHINE} +# For smbios.c XXX need to abstract properly .PATH: ${BOOTSRC}/i386/libi386 -.include "${.CURDIR}/arch/${MACHINE}/Makefile.inc" +.include "${.CURDIR}/../loader/arch/${MACHINE}/Makefile.inc" CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/arch/${MACHINE} @@ -78,20 +81,25 @@ HAVE_BCACHE= yes CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE} .endif +NEWVERSWHAT= "EFI loader" ${MACHINE} +VERSION_FILE= ${.CURDIR}/../loader/version + # Always add MI sources .include "${BOOTSRC}/loader.mk" -FILES+= loader.efi -FILESMODE_loader.efi= ${BINMODE} +FILES+= ${LOADER}.efi +FILESMODE_${LOADER}.efi= ${BINMODE} -LDSCRIPT= ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE} +.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} +LINKS+= ${BINDIR}/${LOADER}.efi ${BINDIR}/loader.efi +.endif + +LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE} LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared CLEANFILES+= loader.efi -NEWVERSWHAT= "EFI loader" ${MACHINE} - -loader.efi: ${PROG} +${LOADER}.efi: ${PROG} if ${NM} ${.ALLSRC} | grep ' U '; then \ echo "Undefined symbols in ${.ALLSRC}"; \ exit 1; \ Modified: stable/11/stand/i386/Makefile ============================================================================== --- stable/11/stand/i386/Makefile Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/i386/Makefile Thu Feb 21 03:18:12 2019 (r344413) @@ -9,7 +9,9 @@ SUBDIR.yes= mbr pmbr boot0 boot0sio btx boot2 cdboot g SUBDIR.${MK_LOADER_FIREWIRE}+= libfirewire -SUBDIR.yes+= loader +SUBDIR.${MK_FORTH}+= loader_4th +SUBDIR.${MK_LOADER_LUA}+= loader_lua +SUBDIR.yes+= loader_simp # special boot programs, 'self-extracting boot2+loader' SUBDIR.yes+= pxeldr Modified: stable/11/stand/i386/loader/Makefile ============================================================================== --- stable/11/stand/i386/loader/Makefile Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/i386/loader/Makefile Thu Feb 21 03:18:12 2019 (r344413) @@ -14,7 +14,7 @@ LOADER_BZIP2_SUPPORT?= yes .include -LOADER?= loader +LOADER?= loader_${LOADER_INTERP} PROG= ${LOADER}.sym INTERNALPROG= NEWVERSWHAT?= "bootstrap loader" x86 @@ -64,12 +64,13 @@ ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} ${LOADER}.bin: ${LOADER}.sym strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC} -# XXX TODO: Fix this when coexistence comes in -.if ${MK_LOADER_ZFS} == "yes" # && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} +.if ${MK_LOADER_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} LINKS+= ${BINDIR}/${LOADER} ${BINDIR}/zfsloader .endif +.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} +LINKS+= ${BINDIR}/${LOADER} ${BINDIR}/loader +.endif FILES+= ${LOADER} -# XXX INSTALLFLAGS_loader= -b FILESMODE_${LOADER}= ${BINMODE} -b # XXX crt0.o needs to be first for pxeboot(8) to work Modified: stable/11/stand/i386/pxeldr/Makefile ============================================================================== --- stable/11/stand/i386/pxeldr/Makefile Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/i386/pxeldr/Makefile Thu Feb 21 03:18:12 2019 (r344413) @@ -24,7 +24,8 @@ CFLAGS+=-DALWAYS_SERIAL CFLAGS+=-I${BOOTSRC}/i386/common -LOADERBIN= ${BOOTOBJ}/i386/loader/loader.bin +L=${LOADER_DEFAULT_INTERP} +LOADERBIN= ${BOOTOBJ}/i386/loader_${L}/loader_${L}.bin CLEANFILES+= ${BOOT}.tmp Modified: stable/11/stand/libsa/Makefile ============================================================================== --- stable/11/stand/libsa/Makefile Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/libsa/Makefile Thu Feb 21 03:18:12 2019 (r344413) @@ -73,8 +73,13 @@ SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S a .if ${MACHINE_CPUARCH} == "powerpc" .PATH: ${LIBC_SRC}/quad -SRCS+= ashldi3.c ashrdi3.c +SRCS+= ashldi3.c ashrdi3.c lshrdi3.c SRCS+= syncicache.c +.endif + +.if ${MACHINE_CPUARCH} == "mips" +.PATH: ${LIBC_SRC}/quad +SRCS+= ashldi3.c ashrdi3.c lshrdi3.c .endif # uuid functions from libc Modified: stable/11/stand/loader.mk ============================================================================== --- stable/11/stand/loader.mk Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/loader.mk Thu Feb 21 03:18:12 2019 (r344413) @@ -59,19 +59,20 @@ SRCS+= isapnp.c SRCS+= pnp.c .endif -# Forth interpreter -.if ${MK_FORTH} != "no" -SRCS+= interp_forth.c -.include "${BOOTSRC}/ficl.mk" -LDR_INTERP= ${LIBFICL} -LDR_INTERP32= ${LIBFICL32} -.elif ${MK_LOADER_LUA} != "no" +.if ${LOADER_INTERP} == "lua" SRCS+= interp_lua.c .include "${BOOTSRC}/lua.mk" LDR_INTERP= ${LIBLUA} LDR_INTERP32= ${LIBLUA32} -.else +.elif ${LOADER_INTERP} == "4th" +SRCS+= interp_forth.c +.include "${BOOTSRC}/ficl.mk" +LDR_INTERP= ${LIBFICL} +LDR_INTERP32= ${LIBFICL32} +.elif ${LOADER_INTERP} == "simp" SRCS+= interp_simple.c +.else +.error Unknown interpreter ${LOADER_INTERP} .endif .if defined(BOOT_PROMPT_123) Modified: stable/11/stand/userboot/Makefile ============================================================================== --- stable/11/stand/userboot/Makefile Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/userboot/Makefile Thu Feb 21 03:18:12 2019 (r344413) @@ -1,8 +1,10 @@ # $FreeBSD$ -.include +.include -SUBDIR= test userboot +SUBDIR.yes= test +SUBDIR.${MK_FORTH}+= userboot_4th +SUBDIR.${MK_LOADER_LUA}+= userboot_lua .include Modified: stable/11/stand/userboot/userboot.h ============================================================================== --- stable/11/stand/userboot/userboot.h Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/userboot/userboot.h Thu Feb 21 03:18:12 2019 (r344413) @@ -42,6 +42,13 @@ #define USERBOOT_VERSION_4 4 /* + * Version 5 added a callback for indicating that the guest + * should be restarted with a different interpreter. The callback + * structure is still backward compatible. + */ +#define USERBOOT_VERSION_5 5 + +/* * Exit codes from the loader */ #define USERBOOT_EXIT_QUIT 1 @@ -210,4 +217,9 @@ struct loader_callbacks { int (*vm_set_register)(void *arg, int vcpu, int reg, uint64_t val); int (*vm_set_desc)(void *arg, int vcpu, int reg, uint64_t base, u_int limit, u_int access); + + /* + * Version 5 addition. + */ + void (*swap_interpreter)(void *arg, const char *interp); }; Modified: stable/11/stand/userboot/userboot/Makefile ============================================================================== --- stable/11/stand/userboot/userboot/Makefile Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/userboot/userboot/Makefile Thu Feb 21 03:18:12 2019 (r344413) @@ -8,10 +8,11 @@ PIC=yes .include -SHLIB_NAME= userboot.so +SHLIB_NAME= userboot_${LOADER_INTERP}.so STRIP= LIBDIR= /boot +.PATH: ${.CURDIR}/../userboot SRCS= autoload.c SRCS+= bcache.c SRCS+= biossmap.c @@ -37,7 +38,12 @@ CWARNFLAGS.main.c += -Wno-implicit-function-declaratio LDFLAGS+= -nostdlib -Wl,-Bsymbolic -NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH} +NEWVERSWHAT= "User boot ${LOADER_INTERP}" ${MACHINE_CPUARCH} +VERSION_FILE= ${.CURDIR}/../userboot/version + +.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} +LINKS+= ${BINDIR}/${SHLIB_NAME} ${BINDIR}/userboot.so +.endif .if ${MK_LOADER_ZFS} != "no" CFLAGS+= -DUSERBOOT_ZFS_SUPPORT Modified: stable/11/stand/userboot/userboot/main.c ============================================================================== --- stable/11/stand/userboot/userboot/main.c Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/userboot/userboot/main.c Thu Feb 21 03:18:12 2019 (r344413) @@ -47,6 +47,9 @@ static int userboot_zfs_found; /* Minimum version required */ #define USERBOOT_VERSION USERBOOT_VERSION_3 +#define LOADER_PATH "/boot/loader" +#define INTERP_MARKER "$Interpreter:" + #define MALLOCSZ (64*1024*1024) struct loader_callbacks *callbacks; @@ -57,6 +60,7 @@ static jmp_buf jb; struct arch_switch archsw; /* MI/MD interface boundary */ static void extract_currdev(void); +static void check_interpreter(void); void delay(int usec) @@ -73,6 +77,62 @@ exit(int v) longjmp(jb, 1); } +static void +check_interpreter(void) +{ + struct stat st; + size_t marklen, rdsize; + const char *guest_interp, *my_interp; + char *buf; + int fd; + + /* + * If we can't stat(2) or open(2) LOADER_PATH, then we'll fail by + * simply letting us roll on with whatever interpreter we were compiled + * with. This is likely not going to be an issue in reality. + */ + buf = NULL; + if (stat(LOADER_PATH, &st) != 0) + return; + if ((fd = open(LOADER_PATH, O_RDONLY)) < 0) + return; + + rdsize = st.st_size; + buf = malloc(rdsize); + if (buf == NULL) + goto out; + if (read(fd, buf, rdsize) < rdsize) + goto out; + + marklen = strlen(INTERP_MARKER); + my_interp = bootprog_interp + marklen; + + /* + * Here we make the assumption that a loader binary without the + * interpreter marker is a 4th one. All loader binaries going forward + * should have this properly specified, so our assumption should always + * be a good one. + */ + if ((guest_interp = memmem(buf, rdsize, INTERP_MARKER, + marklen)) != NULL) + guest_interp += marklen; + else + guest_interp = "4th"; + + /* + * The guest interpreter may not have a version of loader that + * specifies the interpreter installed. If that's the case, we'll + * assume it's legacy (4th) and request a swap to that if we're + * a Lua-userboot. + */ + if (strcmp(my_interp, guest_interp) != 0) + CALLBACK(swap_interpreter, guest_interp); +out: + free(buf); + close(fd); + return; +} + void loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks) { @@ -137,6 +197,14 @@ loader_main(struct loader_callbacks *cb, void *arg, in (devsw[i]->dv_init)(); extract_currdev(); + + /* + * Checking the interpreter isn't worth the overhead unless we + * actually have the swap_interpreter callback, so we actually version + * check here rather than later on. + */ + if (version >= USERBOOT_VERSION_5) + check_interpreter(); if (setjmp(jb)) return; Modified: stable/11/stand/userboot/userboot/version ============================================================================== --- stable/11/stand/userboot/userboot/version Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/stand/userboot/userboot/version Thu Feb 21 03:18:12 2019 (r344413) @@ -1,4 +1,5 @@ $FreeBSD$ +1.2: Userboot with lua or forth 1.1: Initial userland boot Modified: stable/11/usr.sbin/bhyveload/bhyveload.c ============================================================================== --- stable/11/usr.sbin/bhyveload/bhyveload.c Thu Feb 21 02:52:27 2019 (r344412) +++ stable/11/usr.sbin/bhyveload/bhyveload.c Thu Feb 21 03:18:12 2019 (r344413) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -98,6 +99,13 @@ static int disk_fd[NDISKS]; static int ndisks; static int consin_fd, consout_fd; +static int need_reinit; + +static void *loader_hdl; +static char *loader; +static int explicit_loader; +static jmp_buf jb; + static char *vmname, *progname; static struct vmctx *ctx; @@ -560,6 +568,30 @@ cb_vm_set_desc(void *arg, int vcpu, int reg, uint64_t return (vm_set_desc(ctx, vcpu, reg, base, limit, access)); } +static void +cb_swap_interpreter(void *arg, const char *interp_req) +{ + + /* + * If the user specified a loader but we detected a mismatch, we should + * not try to pivot to a different loader on them. + */ + free(loader); + if (explicit_loader == 1) { + perror("requested loader interpreter does not match guest userboot"); + cb_exit(NULL, 1); + } + if (interp_req == NULL || *interp_req == '\0') { + perror("guest failed to request an interpreter"); + cb_exit(NULL, 1); + } + + if (asprintf(&loader, "/boot/userboot_%s.so", interp_req) == -1) + err(EX_OSERR, "malloc"); + need_reinit = 1; + longjmp(jb, 1); +} + static struct loader_callbacks cb = { .getc = cb_getc, .putc = cb_putc, @@ -593,6 +625,9 @@ static struct loader_callbacks cb = { /* Version 4 additions */ .vm_set_register = cb_vm_set_register, .vm_set_desc = cb_vm_set_desc, + + /* Version 5 additions */ + .swap_interpreter = cb_swap_interpreter, }; static int @@ -661,16 +696,12 @@ usage(void) int main(int argc, char** argv) { - char *loader; - void *h; void (*func)(struct loader_callbacks *, void *, int, int); uint64_t mem_size; - int opt, error, need_reinit, memflags; + int opt, error, memflags; progname = basename(argv[0]); - loader = NULL; - memflags = 0; mem_size = 256 * MB; @@ -705,6 +736,7 @@ main(int argc, char** argv) loader = strdup(optarg); if (loader == NULL) err(EX_OSERR, "malloc"); + explicit_loader = 1; break; case 'm': @@ -747,6 +779,13 @@ main(int argc, char** argv) exit(1); } + /* + * setjmp in the case the guest wants to swap out interpreter, + * cb_swap_interpreter will swap out loader as appropriate and set + * need_reinit so that we end up in a clean state once again. + */ + setjmp(jb); + if (need_reinit) { error = vm_reinit(ctx); if (error) { @@ -767,13 +806,15 @@ main(int argc, char** argv) if (loader == NULL) err(EX_OSERR, "malloc"); } - h = dlopen(loader, RTLD_LOCAL); - if (!h) { + if (loader_hdl != NULL) + dlclose(loader_hdl); + loader_hdl = dlopen(loader, RTLD_LOCAL); + if (!loader_hdl) { printf("%s\n", dlerror()); free(loader); return (1); } - func = dlsym(h, "loader_main"); + func = dlsym(loader_hdl, "loader_main"); if (!func) { printf("%s\n", dlerror()); free(loader); @@ -790,7 +831,7 @@ main(int argc, char** argv) addenv("smbios.bios.vendor=BHYVE"); addenv("boot_serial=1"); - func(&cb, NULL, USERBOOT_VERSION_4, ndisks); + func(&cb, NULL, USERBOOT_VERSION_5, ndisks); free(loader); return (0); From owner-svn-src-stable-11@freebsd.org Thu Feb 21 04:13:21 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B17DD14EFDEF; Thu, 21 Feb 2019 04:13:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 51E088A2AF; Thu, 21 Feb 2019 04:13:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DCD8182BD; Thu, 21 Feb 2019 04:13:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L4DLPo034170; Thu, 21 Feb 2019 04:13:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L4DLOK034169; Thu, 21 Feb 2019 04:13:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210413.x1L4DLOK034169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 04:13:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344419 - stable/11/etc/mtree X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/etc/mtree X-SVN-Commit-Revision: 344419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 51E088A2AF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 04:13:21 -0000 Author: kevans Date: Thu Feb 21 04:13:20 2019 New Revision: 344419 URL: https://svnweb.freebsd.org/changeset/base/344419 Log: MFC r329226: Add /boot/lua to mtree spec Modified: stable/11/etc/mtree/BSD.root.dist Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.root.dist ============================================================================== --- stable/11/etc/mtree/BSD.root.dist Thu Feb 21 03:48:39 2019 (r344418) +++ stable/11/etc/mtree/BSD.root.dist Thu Feb 21 04:13:20 2019 (r344419) @@ -16,6 +16,8 @@ .. firmware .. + lua + .. kernel .. modules From owner-svn-src-stable-11@freebsd.org Thu Feb 21 06:02:52 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B090E14F6817; Thu, 21 Feb 2019 06:02:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CACC8F347; Thu, 21 Feb 2019 06:02:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3ED2319674; Thu, 21 Feb 2019 06:02:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L62qng091862; Thu, 21 Feb 2019 06:02:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L62p8O091859; Thu, 21 Feb 2019 06:02:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902210602.x1L62p8O091859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Feb 2019 06:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344421 - in stable/11: share/mk stand/pc98/kgzldr stand/pc98/libpc98 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: share/mk stand/pc98/kgzldr stand/pc98/libpc98 X-SVN-Commit-Revision: 344421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4CACC8F347 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 06:02:52 -0000 Author: kevans Date: Thu Feb 21 06:02:51 2019 New Revision: 344421 URL: https://svnweb.freebsd.org/changeset/base/344421 Log: Direct commit to catch pc98 up to recent changes I have no means of actually testing the new features on pc98, so simply mark them as BROKEN_OPTIONS on pc98 and interested parties can test/report back as to the functionality. This is done out of an abundance of caution. pc98 also needed catching up on the inflate.c -> subr_inflate.c rename. Modified: stable/11/share/mk/src.opts.mk stable/11/stand/pc98/kgzldr/Makefile stable/11/stand/pc98/libpc98/biosdisk.c Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Thu Feb 21 04:47:44 2019 (r344420) +++ stable/11/share/mk/src.opts.mk Thu Feb 21 06:02:51 2019 (r344421) @@ -306,7 +306,11 @@ BROKEN_OPTIONS+=LOADER_UBOOT .if ${__T} == "sparc64" || ${__T:Mpowerpc*} BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA .endif - +# Both features are untested on pc98, so we'll mark them as disabled just to +# be safe and make sure we keep pc98 stable. +.if ${__TT:Mpc98*} +BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA +.endif .if ${__T:Mmips64*} # profiling won't work on MIPS64 because there is only assembly for o32 BROKEN_OPTIONS+=PROFILE Modified: stable/11/stand/pc98/kgzldr/Makefile ============================================================================== --- stable/11/stand/pc98/kgzldr/Makefile Thu Feb 21 04:47:44 2019 (r344420) +++ stable/11/stand/pc98/kgzldr/Makefile Thu Feb 21 06:02:51 2019 (r344421) @@ -7,7 +7,7 @@ STRIP= BINMODE=${LIBMODE} BINDIR= ${LIBDIR} -SRCS= start.s boot.c inflate.c lib.c crt.s sio.s +SRCS= start.s boot.c subr_inflate.c lib.c crt.s sio.s CFLAGS= -Os CFLAGS+=-DKZIP NO_SHARED= Modified: stable/11/stand/pc98/libpc98/biosdisk.c ============================================================================== --- stable/11/stand/pc98/libpc98/biosdisk.c Thu Feb 21 04:47:44 2019 (r344420) +++ stable/11/stand/pc98/libpc98/biosdisk.c Thu Feb 21 06:02:51 2019 (r344421) @@ -51,10 +51,6 @@ __FBSDID("$FreeBSD$"); #include "disk.h" #include "libi386.h" -#ifdef LOADER_GELI_SUPPORT -#error "Nope! No GELI on pc98 so sorry." -#endif - #define BIOS_NUMDRIVES 0x475 #define BIOSDISK_SECSIZE 512 #define BUFSIZE (1 * BIOSDISK_SECSIZE) @@ -364,7 +360,6 @@ bd_open(struct open_file *f, ...) err = disk_open(dev, BD(dev).bd_sectors * BD(dev).bd_sectorsize, BD(dev).bd_sectorsize); - /* i386 has GELI here */ return(err); } @@ -665,7 +660,6 @@ static int bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest) { - /* i386 has GELI here */ return (bd_io(dev, dblk, blks, dest, 0)); } From owner-svn-src-stable-11@freebsd.org Thu Feb 21 07:20:19 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D96ED14FA7F1; Thu, 21 Feb 2019 07:20:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 79B029327D; Thu, 21 Feb 2019 07:20:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 689291A266; Thu, 21 Feb 2019 07:20:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L7KISq029233; Thu, 21 Feb 2019 07:20:18 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L7KIUT029232; Thu, 21 Feb 2019 07:20:18 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201902210720.x1L7KIUT029232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 21 Feb 2019 07:20:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344425 - in stable: 11/contrib/libc++/include 12/contrib/libc++/include X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/libc++/include 12/contrib/libc++/include X-SVN-Commit-Revision: 344425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 79B029327D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 07:20:19 -0000 Author: dim Date: Thu Feb 21 07:20:17 2019 New Revision: 344425 URL: https://svnweb.freebsd.org/changeset/base/344425 Log: MFC r344261: Pull in r345199 from upstream libc++ trunk (by Petr Hosek): Revert "Teach __libcpp_is_floating_point that __fp16 and _Float16 are floating-point types." This reverts commits r333103 and r333108. _Float16 and __fp16 are C11 extensions and compilers other than Clang don't define these for C++. Differential Revision: https://reviews.llvm.org/D53670 This prevents "_Float16 is not supported on this target" errors in libc++'s type_traits header, in some cases. Reported by: Charlie Li Modified: stable/11/contrib/libc++/include/type_traits Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/libc++/include/type_traits Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/libc++/include/type_traits ============================================================================== --- stable/11/contrib/libc++/include/type_traits Thu Feb 21 06:51:35 2019 (r344424) +++ stable/11/contrib/libc++/include/type_traits Thu Feb 21 07:20:17 2019 (r344425) @@ -733,12 +733,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_integral_ // is_floating_point template struct __libcpp_is_floating_point : public false_type {}; -#ifdef __clang__ -template <> struct __libcpp_is_floating_point<__fp16> : public true_type {}; -#endif -#ifdef __FLT16_MANT_DIG__ -template <> struct __libcpp_is_floating_point<_Float16> : public true_type {}; -#endif template <> struct __libcpp_is_floating_point : public true_type {}; template <> struct __libcpp_is_floating_point : public true_type {}; template <> struct __libcpp_is_floating_point : public true_type {}; From owner-svn-src-stable-11@freebsd.org Thu Feb 21 07:22:07 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2124514FA9F3; Thu, 21 Feb 2019 07:22:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B812F93785; Thu, 21 Feb 2019 07:22:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6FCE1A3DD; Thu, 21 Feb 2019 07:22:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L7M6ad033161; Thu, 21 Feb 2019 07:22:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L7M6df033160; Thu, 21 Feb 2019 07:22:06 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201902210722.x1L7M6df033160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 21 Feb 2019 07:22:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344426 - in stable: 11/lib/clang/libllvmminimal 12/lib/clang/libllvmminimal X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/lib/clang/libllvmminimal 12/lib/clang/libllvmminimal X-SVN-Commit-Revision: 344426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B812F93785 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 07:22:07 -0000 Author: dim Date: Thu Feb 21 07:22:05 2019 New Revision: 344426 URL: https://svnweb.freebsd.org/changeset/base/344426 Log: MFC r344264: Add one additional file to libllvmminimal, since in some cases (e.g. upgrading from stable/10 to stable/11) symbols from it are needed to link llvm-tblgen and clang-tblgen. Reported by: kib Modified: stable/11/lib/clang/libllvmminimal/Makefile Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/lib/clang/libllvmminimal/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/11/lib/clang/libllvmminimal/Makefile ============================================================================== --- stable/11/lib/clang/libllvmminimal/Makefile Thu Feb 21 07:20:17 2019 (r344425) +++ stable/11/lib/clang/libllvmminimal/Makefile Thu Feb 21 07:22:05 2019 (r344426) @@ -18,6 +18,7 @@ SRCS+= Support/Errno.cpp SRCS+= Support/Error.cpp SRCS+= Support/ErrorHandling.cpp SRCS+= Support/FoldingSet.cpp +SRCS+= Support/FormatVariadic.cpp SRCS+= Support/FormattedStream.cpp SRCS+= Support/Hashing.cpp SRCS+= Support/Host.cpp From owner-svn-src-stable-11@freebsd.org Thu Feb 21 09:54:12 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C28E14DA08D; Thu, 21 Feb 2019 09:54:12 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D272F6B956; Thu, 21 Feb 2019 09:54:11 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C22801BE6E; Thu, 21 Feb 2019 09:54:11 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1L9sBJX012322; Thu, 21 Feb 2019 09:54:11 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1L9sB5p012320; Thu, 21 Feb 2019 09:54:11 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902210954.x1L9sB5p012320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Thu, 21 Feb 2019 09:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344430 - in stable: 11/sys/conf 11/sys/dev/ata 12/sys/conf 12/sys/dev/ata X-SVN-Group: stable-11 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 11/sys/conf 11/sys/dev/ata 12/sys/conf 12/sys/dev/ata X-SVN-Commit-Revision: 344430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D272F6B956 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.91 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.916,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 09:54:12 -0000 Author: avos Date: Thu Feb 21 09:54:10 2019 New Revision: 344430 URL: https://svnweb.freebsd.org/changeset/base/344430 Log: MFC r344198: GC ATA_REQUEST_TIMEOUT option remnants It was removed from code in r249083 and from sys/conf/options in r249213. PR: 193935, 222170 Modified: stable/11/sys/conf/NOTES stable/11/sys/dev/ata/ata-all.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/conf/NOTES stable/12/sys/dev/ata/ata-all.h Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Thu Feb 21 09:43:14 2019 (r344429) +++ stable/11/sys/conf/NOTES Thu Feb 21 09:54:10 2019 (r344430) @@ -1785,14 +1785,6 @@ hint.ata.1.port="0x170" hint.ata.1.irq="15" # -# The following options are valid on the ATA driver: -# -# ATA_REQUEST_TIMEOUT: the number of seconds to wait for an ATA request -# before timing out. - -#options ATA_REQUEST_TIMEOUT=10 - -# # Standard floppy disk controllers and floppy tapes, supports # the Y-E DATA External FDD (PC Card) # Modified: stable/11/sys/dev/ata/ata-all.h ============================================================================== --- stable/11/sys/dev/ata/ata-all.h Thu Feb 21 09:43:14 2019 (r344429) +++ stable/11/sys/dev/ata/ata-all.h Thu Feb 21 09:54:10 2019 (r344430) @@ -207,10 +207,6 @@ #define ATA_OP_FINISHED 1 #define ATA_MAX_28BIT_LBA 268435455UL -#ifndef ATA_REQUEST_TIMEOUT -#define ATA_REQUEST_TIMEOUT 10 -#endif - /* structure used for composite atomic operations */ #define MAX_COMPOSITES 32 /* u_int32_t bits */ struct ata_composite { From owner-svn-src-stable-11@freebsd.org Thu Feb 21 12:35:53 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4092114DF119; Thu, 21 Feb 2019 12:35:53 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C61CF70EBB; Thu, 21 Feb 2019 12:35:52 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 7511BA5D4; Thu, 21 Feb 2019 12:35:52 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lf1-f51.google.com with SMTP id j1so20220901lfb.10; Thu, 21 Feb 2019 04:35:52 -0800 (PST) X-Gm-Message-State: AHQUAuboRkIvWICByJeKIDTdjJL4ImlSxVqBR20VKbxMN6n7Y9ycITZK LbmWv3z9iXMOro5wPrES+/PYOXaTixH+O+fpjII= X-Google-Smtp-Source: AHgI3IYT174TBhXDOVj4KHWhBlr9ujKJ1xeX/b24dUOBS1jWDyuUOtaaeN3ztSjrYbwhBPPQmOs8rjFFKQX+EIxX2kI= X-Received: by 2002:a19:c50c:: with SMTP id w12mr23621039lfe.53.1550752550923; Thu, 21 Feb 2019 04:35:50 -0800 (PST) MIME-Version: 1.0 References: <201902210348.x1L3meFu018887@repo.freebsd.org> <201902210620.x1L6KGnv018738@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201902210620.x1L6KGnv018738@pdx.rh.CN85.dnsmgr.net> From: Kyle Evans Date: Thu, 21 Feb 2019 06:35:39 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r344418 - stable/11 To: "Rodney W. Grimes" Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: C61CF70EBB X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.947,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 12:35:53 -0000 On Thu, Feb 21, 2019 at 12:20 AM Rodney W. Grimes wrote: > > > Author: kevans > > Date: Thu Feb 21 03:48:39 2019 > > New Revision: 344418 > > URL: https://svnweb.freebsd.org/changeset/base/344418 > > > > Log: > > Direct commit for post-mortem UPDATING update regarding lualoader > > > > Indicate that it's been merged (after some delay since lua came back to this > > branch) and how one can test lua, both by swapping build knobs and creating > > links in /boot. > > > > Modified: > > stable/11/UPDATING > > > > Modified: stable/11/UPDATING > > ============================================================================== > > --- stable/11/UPDATING Thu Feb 21 03:39:51 2019 (r344417) > > +++ stable/11/UPDATING Thu Feb 21 03:48:39 2019 (r344418) > > @@ -17,6 +17,20 @@ the tip of head, and then rebuild without this option. > > from older version of current across the gcc/clang cutover is a bit fragile. > > > > 20190220: > > + Co-existance for Forth and Lua interpreters in bootloaders has now been > > + merged to ease testing of lualoader. LOADER_DEFAULT_INTERP, documented > > + in build(7), may be used to control which interpreter flavor is used in > > + the default loader to be installed. For systems where Lua and Forth > > + coexist, this switch can also be made on a running system by creating a > > + link from /boot/loader_${flavor}{,efi} to /boot/loader{,.efi} rather > ^. missing > And is not the direction of that link reversed? > /boot/loader_${,.efi} -> /boot/loader_${flavor}{,.efi} > is what I would expect the link to be for this. > Whoops. Will fix shortly, thanks! Kyle Evans From owner-svn-src-stable-11@freebsd.org Thu Feb 21 12:44:00 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A5BA14DFAFB; Thu, 21 Feb 2019 12:44:00 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C1D8A716A4; Thu, 21 Feb 2019 12:43:59 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 66CE1A6FB; Thu, 21 Feb 2019 12:43:59 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lj1-f181.google.com with SMTP id j19so23073735ljg.5; Thu, 21 Feb 2019 04:43:59 -0800 (PST) X-Gm-Message-State: AHQUAubvFVFTIuO+Xv8YgCLnistAtCPQUuG9m42iAUu3YpNkD5kdiq/G Qt1N9SrMEyqUbUXtKY7XTljDwHd7v0GbgdNIzeQ= X-Google-Smtp-Source: AHgI3Ia+ROueJ0zSSIUfHm0qHeZUiKroACHMGNUpMRxvLg3C3hZVJQOLNgqWigdO1UZbDq9hwyHQLK5Mq7xtb2bZIvw= X-Received: by 2002:a2e:9f49:: with SMTP id v9mr23409622ljk.77.1550753037840; Thu, 21 Feb 2019 04:43:57 -0800 (PST) MIME-Version: 1.0 References: <201902210322.x1L3MKeV007120@repo.freebsd.org> <201902210616.x1L6G7SV018721@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201902210616.x1L6G7SV018721@pdx.rh.CN85.dnsmgr.net> From: Kyle Evans Date: Thu, 21 Feb 2019 06:43:46 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r344414 - stable/11 To: "Rodney W. Grimes" Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: C1D8A716A4 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.950,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 12:44:00 -0000 On Thu, Feb 21, 2019 at 12:16 AM Rodney W. Grimes wrote: > > > Author: kevans > > Date: Thu Feb 21 03:22:20 2019 > > New Revision: 344414 > > URL: https://svnweb.freebsd.org/changeset/base/344414 > > > > Log: > > MFC (RECORD ONLY) r338050: Loader default interpreter flip > > > > The default interpreter for stable/11 is 4th; this will never and can never > > change. Record MFC of r338050 to proactively prevent any accidents in future > > batching of MFCs. > > > > Modified: > > Directory Properties: > > stable/11/ (props changed) > > Does it make sense to do a direct commit to stable/11 > marking the line that does this flip with a > "Do not change this in the stable/11 branch" > so that someone does not try to manually merge > the change if they happen to notice the code > is different? > I'll chew on it for a little bit. It's fairly clear what the ramifications of swapping those lines around are, even from diff review, and I'd like to assume no one would willfully do it if they put a couple seconds thought into what they were about to commit. From owner-svn-src-stable-11@freebsd.org Thu Feb 21 16:28:34 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 412C414E6D73; Thu, 21 Feb 2019 16:28:34 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 978508206D; Thu, 21 Feb 2019 16:28:33 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg1-x529.google.com with SMTP id i130so13939527pgd.1; Thu, 21 Feb 2019 08:28:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hZP6DDnvc540eJHBg8RcvyZ9Ogw09cukITCRskFEQU8=; b=eMh0i1qrXI4b+O5ap/M+PfhvH/1KWD95zF0ld/5Dx/WL4P0/kxD6o4e5dcevpVKs9C l+Du2/imm50VCC7S66xVSBZrhAryH2Ab6adare8JBGPTnecjmMmevhV7SW2e5hRaFAqs IvsNY4qIiPsUTV/5RTACSLNOYH/VPRw8mX9CMDysZRGi4a5Z9tZZABH34BWeFoYvvFjg Kx7Q1vRPvgz4BhTvldQtUEdi9Kmfv5VczWYLNzK2z+pJwJeRnGW/wl+IIcFkFAUFQ37m YBJVVUhFBL7Rl0JHUHBt5CaWeQSHsKsYvQaA1W2TM82q45sTZQ5LX64OVN3cYSrBnF7Y lKdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hZP6DDnvc540eJHBg8RcvyZ9Ogw09cukITCRskFEQU8=; b=gQY5XoYc6WbN9GzqjRWuTlbQgaTypCZbaMc4jZb1dmA/P7sVhqwRs80VzAZAmfBC3S Vef6zoTN0GZXSmROjWMeIJO/cwtQaXcjPoHG5yhSt0g/z0GnoDMqewoEPyN634fD1wcg g+qutCXBqraSVQ2Bp3uwxwQVXE/Omvw00caKbwFSfd4ECyzu/+hey7MUibddETpTuR8v kRoACyIXJ4vswTFj9ka0DHLxH/SMZ1n15/2nEwZdhgcV37NjUnQhWOXzYv5K9BvsOHsk HFh5NsFCcSgx4dTSOn536qlWkTLLkvoCBRs18JPeZKKNlUETi371Xzguhp2kS7qOIt4b TMIQ== X-Gm-Message-State: AHQUAuZreanVXmXlCh3tOaR1wKT7jogV25V5H0L5gF06MUFXMNF+ks49 EA1DiDmcMUPiDZGHKuBSHi8sAsTL X-Google-Smtp-Source: AHgI3IbzIq1L6SaNeE7VRF68yGGqYYgf4oWHLlj0FV1feGjowXD8dqXK+03dBr15qim6TtigAyeucg== X-Received: by 2002:a62:11ca:: with SMTP id 71mr36864039pfr.18.1550766512078; Thu, 21 Feb 2019 08:28:32 -0800 (PST) Received: from [192.168.20.22] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id k64sm45160840pfj.69.2019.02.21.08.28.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 08:28:31 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r344414 - stable/11 From: Enji Cooper X-Mailer: iPhone Mail (16D57) In-Reply-To: Date: Thu, 21 Feb 2019 08:28:30 -0800 Cc: "Rodney W. Grimes" , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <6A8C488C-05F4-4607-8F40-F301AF91E7EA@gmail.com> References: <201902210322.x1L3MKeV007120@repo.freebsd.org> <201902210616.x1L6G7SV018721@pdx.rh.CN85.dnsmgr.net> To: Kyle Evans X-Rspamd-Queue-Id: 978508206D X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 16:28:34 -0000 > On Feb 21, 2019, at 04:43, Kyle Evans wrote: >=20 > On Thu, Feb 21, 2019 at 12:16 AM Rodney W. Grimes > wrote: >>=20 >>> Author: kevans >>> Date: Thu Feb 21 03:22:20 2019 >>> New Revision: 344414 >>> URL: https://svnweb.freebsd.org/changeset/base/344414 >>>=20 >>> Log: >>> MFC (RECORD ONLY) r338050: Loader default interpreter flip >>>=20 >>> The default interpreter for stable/11 is 4th; this will never and can n= ever >>> change. Record MFC of r338050 to proactively prevent any accidents in f= uture >>> batching of MFCs. >>>=20 >>> Modified: >>> Directory Properties: >>> stable/11/ (props changed) >>=20 >> Does it make sense to do a direct commit to stable/11 >> marking the line that does this flip with a >> "Do not change this in the stable/11 branch" >> so that someone does not try to manually merge >> the change if they happen to notice the code >> is different? >=20 > I'll chew on it for a little bit. It's fairly clear what the > ramifications of swapping those lines around are, even from diff > review, and I'd like to assume no one would willfully do it if they > put a couple seconds thought into what they were about to commit. Kyle, I think what you did makes sense. I=E2=80=99ve done this and I=E2=80=99v= e seen others do similar in the past.=20 As someone who=E2=80=99s merged code in from others, I appreciate measur= es like this, which would prevent me from breaking a stable branch by accide= nt. Thanks! -Enji= From owner-svn-src-stable-11@freebsd.org Thu Feb 21 16:41:05 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 172DE14E774F; Thu, 21 Feb 2019 16:41:05 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7044E82A7A; Thu, 21 Feb 2019 16:41:03 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x1LGetR2021291; Thu, 21 Feb 2019 08:40:55 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id x1LGetma021290; Thu, 21 Feb 2019 08:40:55 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201902211640.x1LGetma021290@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r344414 - stable/11 In-Reply-To: <6A8C488C-05F4-4607-8F40-F301AF91E7EA@gmail.com> To: Enji Cooper Date: Thu, 21 Feb 2019 08:40:55 -0800 (PST) CC: Kyle Evans , "Rodney W. Grimes" , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 7044E82A7A X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 16:41:05 -0000 > > On Feb 21, 2019, at 04:43, Kyle Evans wrote: > > > > On Thu, Feb 21, 2019 at 12:16 AM Rodney W. Grimes > > wrote: > >> > >>> Author: kevans > >>> Date: Thu Feb 21 03:22:20 2019 > >>> New Revision: 344414 > >>> URL: https://svnweb.freebsd.org/changeset/base/344414 > >>> > >>> Log: > >>> MFC (RECORD ONLY) r338050: Loader default interpreter flip > >>> > >>> The default interpreter for stable/11 is 4th; this will never and can never > >>> change. Record MFC of r338050 to proactively prevent any accidents in future > >>> batching of MFCs. > >>> > >>> Modified: > >>> Directory Properties: > >>> stable/11/ (props changed) > >> > >> Does it make sense to do a direct commit to stable/11 > >> marking the line that does this flip with a > >> "Do not change this in the stable/11 branch" > >> so that someone does not try to manually merge > >> the change if they happen to notice the code > >> is different? > > > > I'll chew on it for a little bit. It's fairly clear what the > > ramifications of swapping those lines around are, even from diff > > review, and I'd like to assume no one would willfully do it if they > > put a couple seconds thought into what they were about to commit. > > Kyle, > I think what you did makes sense. I?ve done this and I?ve > seen others do similar in the past. I concur, what he did do makes perfect since. > As someone who?s merged code in from others, I appreciate > measures like this, which would prevent me from breaking a > stable branch by accident. I am just wondering about a second safety belt, as the current one just makes a svn merge -c338050 a silent nop, but in no way stops someone from manually applying the diff. We have people that are very good with svn and would know how to investigate the nop, and we have people who can barely manage to do a merge with proper mergeinfo. > Thanks! > -Enji -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Thu Feb 21 17:27:40 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A037714E9007; Thu, 21 Feb 2019 17:27:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3FF7B84580; Thu, 21 Feb 2019 17:27:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3136B20BAA; Thu, 21 Feb 2019 17:27:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1LHRe04048127; Thu, 21 Feb 2019 17:27:40 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1LHRc1F048118; Thu, 21 Feb 2019 17:27:38 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201902211727.x1LHRc1F048118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 21 Feb 2019 17:27:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344442 - stable/11/release/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/arm X-SVN-Commit-Revision: 344442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3FF7B84580 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 17:27:40 -0000 Author: gjb Date: Thu Feb 21 17:27:37 2019 New Revision: 344442 URL: https://svnweb.freebsd.org/changeset/base/344442 Log: Update the stable/11 arm SoC IMAGE_SIZE to 3072M as build failures were encountered due to the target filesystem running out of space during the installkernel target. The 3072M size is used as it is consistent with head and stable/12 image sizes, and build failures due to a full filesystem have been common enough to justify making the default size the same across all supported branches in order to avoid such surprises. This is a direct commit to stable/11, as there are several changes between several size bumps that are unrelated or unnecessary in this branch. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/arm/BANANAPI.conf stable/11/release/arm/BEAGLEBONE.conf stable/11/release/arm/CUBIEBOARD.conf stable/11/release/arm/CUBIEBOARD2.conf stable/11/release/arm/CUBOX-HUMMINGBOARD.conf stable/11/release/arm/GUMSTIX.conf stable/11/release/arm/PANDABOARD.conf stable/11/release/arm/RPI-B.conf stable/11/release/arm/RPI2.conf stable/11/release/arm/WANDBOARD.conf Modified: stable/11/release/arm/BANANAPI.conf ============================================================================== --- stable/11/release/arm/BANANAPI.conf Thu Feb 21 16:47:36 2019 (r344441) +++ stable/11/release/arm/BANANAPI.conf Thu Feb 21 17:27:37 2019 (r344442) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-bananapi" FAT_SIZE="50m -b 1m" FAT_TYPE="16" -IMAGE_SIZE="1G" +IMAGE_SIZE="3072M" KERNEL="ALLWINNER" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: stable/11/release/arm/BEAGLEBONE.conf ============================================================================== --- stable/11/release/arm/BEAGLEBONE.conf Thu Feb 21 16:47:36 2019 (r344441) +++ stable/11/release/arm/BEAGLEBONE.conf Thu Feb 21 17:27:37 2019 (r344442) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-beaglebone" FAT_SIZE="50m" FAT_TYPE="16" -IMAGE_SIZE="1G" +IMAGE_SIZE="3072M" KERNEL="BEAGLEBONE" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: stable/11/release/arm/CUBIEBOARD.conf ============================================================================== --- stable/11/release/arm/CUBIEBOARD.conf Thu Feb 21 16:47:36 2019 (r344441) +++ stable/11/release/arm/CUBIEBOARD.conf Thu Feb 21 17:27:37 2019 (r344442) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-cubieboard" FAT_SIZE="50m -b 1m" FAT_TYPE="16" -IMAGE_SIZE="1G" +IMAGE_SIZE="3072M" KERNEL="ALLWINNER_UP" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: stable/11/release/arm/CUBIEBOARD2.conf ============================================================================== --- stable/11/release/arm/CUBIEBOARD2.conf Thu Feb 21 16:47:36 2019 (r344441) +++ stable/11/release/arm/CUBIEBOARD2.conf Thu Feb 21 17:27:37 2019 (r344442) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-cubieboard2" FAT_SIZE="50m -b 1m" FAT_TYPE="16" -IMAGE_SIZE="1G" +IMAGE_SIZE="3072M" KERNEL="ALLWINNER" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: stable/11/release/arm/CUBOX-HUMMINGBOARD.conf ============================================================================== --- stable/11/release/arm/CUBOX-HUMMINGBOARD.conf Thu Feb 21 16:47:36 2019 (r344441) +++ stable/11/release/arm/CUBOX-HUMMINGBOARD.conf Thu Feb 21 17:27:37 2019 (r344442) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-cubox-hummingboard" FAT_SIZE="50m -b 16384" FAT_TYPE="16" -IMAGE_SIZE="1536M" +IMAGE_SIZE="3072M" KERNEL="IMX6" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: stable/11/release/arm/GUMSTIX.conf ============================================================================== --- stable/11/release/arm/GUMSTIX.conf Thu Feb 21 16:47:36 2019 (r344441) +++ stable/11/release/arm/GUMSTIX.conf Thu Feb 21 17:27:37 2019 (r344442) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-duovero" FAT_SIZE="50m" FAT_TYPE="16" -IMAGE_SIZE="1G" +IMAGE_SIZE="3072M" KERNEL="GUMSTIX" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: stable/11/release/arm/PANDABOARD.conf ============================================================================== --- stable/11/release/arm/PANDABOARD.conf Thu Feb 21 16:47:36 2019 (r344441) +++ stable/11/release/arm/PANDABOARD.conf Thu Feb 21 17:27:37 2019 (r344442) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-pandaboard" FAT_SIZE="50m" FAT_TYPE="16" -IMAGE_SIZE="1G" +IMAGE_SIZE="3072M" KERNEL="PANDABOARD" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: stable/11/release/arm/RPI-B.conf ============================================================================== --- stable/11/release/arm/RPI-B.conf Thu Feb 21 16:47:36 2019 (r344441) +++ stable/11/release/arm/RPI-B.conf Thu Feb 21 17:27:37 2019 (r344442) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-rpi sysutils/rpi-firmware" FAT_SIZE="50m" FAT_TYPE="16" -IMAGE_SIZE="1G" +IMAGE_SIZE="3072M" KERNEL="RPI-B" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: stable/11/release/arm/RPI2.conf ============================================================================== --- stable/11/release/arm/RPI2.conf Thu Feb 21 16:47:36 2019 (r344441) +++ stable/11/release/arm/RPI2.conf Thu Feb 21 17:27:37 2019 (r344442) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-rpi2 sysutils/rpi-firmware" FAT_SIZE="50m" FAT_TYPE="16" -IMAGE_SIZE="1536M" +IMAGE_SIZE="3072M" KERNEL="RPI2" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: stable/11/release/arm/WANDBOARD.conf ============================================================================== --- stable/11/release/arm/WANDBOARD.conf Thu Feb 21 16:47:36 2019 (r344441) +++ stable/11/release/arm/WANDBOARD.conf Thu Feb 21 17:27:37 2019 (r344442) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-wandboard" FAT_SIZE="50m -b 16384" FAT_TYPE="16" -IMAGE_SIZE="1536M" +IMAGE_SIZE="3072M" KERNEL="IMX6" MD_ARGS="-x 63 -y 255" NODOC=1 From owner-svn-src-stable-11@freebsd.org Thu Feb 21 23:53:53 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D8D614F6D57; Thu, 21 Feb 2019 23:53:53 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 02EAC6E0A8; Thu, 21 Feb 2019 23:53:53 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8CC324FC9; Thu, 21 Feb 2019 23:53:52 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1LNrqx5051965; Thu, 21 Feb 2019 23:53:52 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1LNrqZZ051964; Thu, 21 Feb 2019 23:53:52 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902212353.x1LNrqZZ051964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Thu, 21 Feb 2019 23:53:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344454 - in stable: 11/tools/build/mk 12/tools/build/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 11/tools/build/mk 12/tools/build/mk X-SVN-Commit-Revision: 344454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 02EAC6E0A8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 23:53:53 -0000 Author: avos Date: Thu Feb 21 23:53:52 2019 New Revision: 344454 URL: https://svnweb.freebsd.org/changeset/base/344454 Log: MFC r344201: Remove vi(1)-related files via 'make delete-old' when WITHOUT_VI=1 is set. Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/12/ (props changed) Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Thu Feb 21 22:56:54 2019 (r344453) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Thu Feb 21 23:53:52 2019 (r344454) @@ -9339,6 +9339,32 @@ OLD_FILES+=usr/share/man/man8/lastlogin.8.gz OLD_FILES+=usr/share/man/man8/utx.8.gz .endif +.if ${MK_VI} == no +OLD_FILES+=etc/rc.d/virecover +OLD_FILES+=rescue/ex +OLD_FILES+=rescue/vi +OLD_FILES+=usr/bin/ex +OLD_FILES+=usr/bin/nex +OLD_FILES+=usr/bin/nvi +OLD_FILES+=usr/bin/nview +OLD_FILES+=usr/bin/vi +OLD_FILES+=usr/bin/view +OLD_FILES+=usr/share/man/man1/ex.1.gz +OLD_FILES+=usr/share/man/man1/nex.1.gz +OLD_FILES+=usr/share/man/man1/nvi.1.gz +OLD_FILES+=usr/share/man/man1/nview.1.gz +OLD_FILES+=usr/share/man/man1/vi.1.gz +OLD_FILES+=usr/share/man/man1/view.1.gz +. if exists(${DESTDIR}/usr/share/vi) +VI_DIRS!=find ${DESTDIR}/usr/share/vi -type d \ + | sed -e 's,^${DESTDIR}/,,'; echo +VI_FILES!=find ${DESTDIR}/usr/share/vi \! -type d \ + | sed -e 's,^${DESTDIR}/,,'; echo +OLD_DIRS+=${VI_DIRS} +OLD_FILES+=${VI_FILES} +. endif +.endif + .if ${MK_WIRELESS} == no OLD_FILES+=etc/regdomain.xml OLD_FILES+=etc/rc.d/hostapd From owner-svn-src-stable-11@freebsd.org Fri Feb 22 03:10:25 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDF7114FCBFE; Fri, 22 Feb 2019 03:10:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CB8A76219; Fri, 22 Feb 2019 03:10:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A0DD271B2; Fri, 22 Feb 2019 03:10:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1M3APgK053327; Fri, 22 Feb 2019 03:10:25 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1M3AOpJ053326; Fri, 22 Feb 2019 03:10:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201902220310.x1M3AOpJ053326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 22 Feb 2019 03:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344455 - in stable/11: . stand X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: . stand X-SVN-Commit-Revision: 344455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6CB8A76219 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.941,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 03:10:26 -0000 Author: kevans Date: Fri Feb 22 03:10:24 2019 New Revision: 344455 URL: https://svnweb.freebsd.org/changeset/base/344455 Log: Direct commit for some clarification/correction The notice in UPDATING stated the wrong direction for the link. Additionally, it's decidedly not a bad idea to throw in a comment mandating that the ordering of LOADER_DEFAULT_INTERP bits remains the same in this branch. This makes it even more obvious from diff review (against head) that this difference is intentional and creates merge conflicts if someone tries to apply the original commit manually. I suspect this won't be a problem given the set of people that maintain loader bits in stable/11, but it does offer a peace of mind. Reported by: rgrimes Modified: stable/11/UPDATING stable/11/stand/defs.mk Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Thu Feb 21 23:53:52 2019 (r344454) +++ stable/11/UPDATING Fri Feb 22 03:10:24 2019 (r344455) @@ -22,7 +22,7 @@ from older version of current across the gcc/clang cut in build(7), may be used to control which interpreter flavor is used in the default loader to be installed. For systems where Lua and Forth coexist, this switch can also be made on a running system by creating a - link from /boot/loader_${flavor}{,efi} to /boot/loader{,.efi} rather + link from /boot/loader{,.efi} to /boot/loader_${flavor}{,efi} rather than requiring a rebuild. The default flavor in this branch will remain Forth. As indicated in Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Thu Feb 21 23:53:52 2019 (r344454) +++ stable/11/stand/defs.mk Fri Feb 22 03:10:24 2019 (r344455) @@ -156,6 +156,8 @@ CFLAGS+= -mlittle-endian # # Have a sensible default # +# XXX Do not change the ordering of this chain in this branch. 4th must remain +# the default for the lifetime of stable/11. .if ${MK_FORTH} == "yes" LOADER_DEFAULT_INTERP?=4th .elif ${MK_LOADER_LUA} == "yes" From owner-svn-src-stable-11@freebsd.org Fri Feb 22 03:12:57 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70E6314FCEF4; Fri, 22 Feb 2019 03:12:57 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13FAD7678F; Fri, 22 Feb 2019 03:12:57 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id B165110573; Fri, 22 Feb 2019 03:12:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lj1-f177.google.com with SMTP id v16so476978ljg.13; Thu, 21 Feb 2019 19:12:56 -0800 (PST) X-Gm-Message-State: AHQUAubytw5M5Ow6x1UjstU4sg+Jys+UGTQNN6YHj2DtoSte7jxy5l/j cBFnYZMbVzkTsRGoWGttQdCyZAinXxhcetwfysw= X-Google-Smtp-Source: AHgI3IZwtrnZzQbgSQYfXchTs72p0GmGUIa5LVFSfQ9tdSSAet4vksG8Q//cUy0Gq/FpZfL9Fe5GaYfZ63bL/vmXNgw= X-Received: by 2002:a2e:8006:: with SMTP id j6-v6mr929890ljg.186.1550805175226; Thu, 21 Feb 2019 19:12:55 -0800 (PST) MIME-Version: 1.0 References: <6A8C488C-05F4-4607-8F40-F301AF91E7EA@gmail.com> <201902211640.x1LGetma021290@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201902211640.x1LGetma021290@pdx.rh.CN85.dnsmgr.net> From: Kyle Evans Date: Thu, 21 Feb 2019 21:12:43 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r344414 - stable/11 To: "Rodney W. Grimes" Cc: Enji Cooper , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 13FAD7678F X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.938,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 03:12:57 -0000 On Thu, Feb 21, 2019 at 10:41 AM Rodney W. Grimes wrote: > > > > On Feb 21, 2019, at 04:43, Kyle Evans wrote: > > > > > > On Thu, Feb 21, 2019 at 12:16 AM Rodney W. Grimes > > > wrote: > > >> > > >>> Author: kevans > > >>> Date: Thu Feb 21 03:22:20 2019 > > >>> New Revision: 344414 > > >>> URL: https://svnweb.freebsd.org/changeset/base/344414 > > >>> > > >>> Log: > > >>> MFC (RECORD ONLY) r338050: Loader default interpreter flip > > >>> > > >>> The default interpreter for stable/11 is 4th; this will never and can never > > >>> change. Record MFC of r338050 to proactively prevent any accidents in future > > >>> batching of MFCs. > > >>> > > >>> Modified: > > >>> Directory Properties: > > >>> stable/11/ (props changed) > > >> > > >> Does it make sense to do a direct commit to stable/11 > > >> marking the line that does this flip with a > > >> "Do not change this in the stable/11 branch" > > >> so that someone does not try to manually merge > > >> the change if they happen to notice the code > > >> is different? > > > > > > I'll chew on it for a little bit. It's fairly clear what the > > > ramifications of swapping those lines around are, even from diff > > > review, and I'd like to assume no one would willfully do it if they > > > put a couple seconds thought into what they were about to commit. > > > > Kyle, > > I think what you did makes sense. I?ve done this and I?ve > > seen others do similar in the past. > I concur, what he did do makes perfect since. > > > As someone who?s merged code in from others, I appreciate > > measures like this, which would prevent me from breaking a > > stable branch by accident. > > I am just wondering about a second safety belt, > as the current one just makes a svn merge -c338050 a silent nop, > but in no way stops someone from manually applying the diff. > > We have people that are very good with svn and would know how > to investigate the nop, and we have people who can barely > manage to do a merge with proper mergeinfo. > After mulling it over, I went ahead and committed the result in r344455. I still don't necessarily think it'll be a problem, but I certainly don't object to more safety belts and peace of mind -- especially since it's a subtle change to flip the ordering that might not be easy to catch at a glance without the ugly warning nearby. From owner-svn-src-stable-11@freebsd.org Fri Feb 22 04:40:13 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4A7414FF2F4; Fri, 22 Feb 2019 04:40:13 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07FAD80E41; Fri, 22 Feb 2019 04:40:12 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x1M4eAnN023764; Thu, 21 Feb 2019 20:40:10 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id x1M4eAND023763; Thu, 21 Feb 2019 20:40:10 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201902220440.x1M4eAND023763@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r344455 - in stable/11: . stand In-Reply-To: <201902220310.x1M3AOpJ053326@repo.freebsd.org> To: Kyle Evans Date: Thu, 21 Feb 2019 20:40:10 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 07FAD80E41 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 04:40:13 -0000 > Author: kevans > Date: Fri Feb 22 03:10:24 2019 > New Revision: 344455 > URL: https://svnweb.freebsd.org/changeset/base/344455 > > Log: > Direct commit for some clarification/correction > > The notice in UPDATING stated the wrong direction for the link. > > Additionally, it's decidedly not a bad idea to throw in a comment mandating > that the ordering of LOADER_DEFAULT_INTERP bits remains the same in this > branch. This makes it even more obvious from diff review (against head) that > this difference is intentional and creates merge conflicts if someone tries > to apply the original commit manually. I suspect this won't be a problem > given the set of people that maintain loader bits in stable/11, but it does > offer a peace of mind. > > Reported by: rgrimes Thank you, but you still missed the missing . > > Modified: > stable/11/UPDATING > stable/11/stand/defs.mk > > Modified: stable/11/UPDATING > ============================================================================== > --- stable/11/UPDATING Thu Feb 21 23:53:52 2019 (r344454) > +++ stable/11/UPDATING Fri Feb 22 03:10:24 2019 (r344455) > @@ -22,7 +22,7 @@ from older version of current across the gcc/clang cut > in build(7), may be used to control which interpreter flavor is used in > the default loader to be installed. For systems where Lua and Forth > coexist, this switch can also be made on a running system by creating a > - link from /boot/loader_${flavor}{,efi} to /boot/loader{,.efi} rather > + link from /boot/loader{,.efi} to /boot/loader_${flavor}{,efi} rather ^.efi? > than requiring a rebuild. > > The default flavor in this branch will remain Forth. As indicated in > > Modified: stable/11/stand/defs.mk > ============================================================================== > --- stable/11/stand/defs.mk Thu Feb 21 23:53:52 2019 (r344454) > +++ stable/11/stand/defs.mk Fri Feb 22 03:10:24 2019 (r344455) > @@ -156,6 +156,8 @@ CFLAGS+= -mlittle-endian > # > # Have a sensible default > # > +# XXX Do not change the ordering of this chain in this branch. 4th must remain > +# the default for the lifetime of stable/11. > .if ${MK_FORTH} == "yes" > LOADER_DEFAULT_INTERP?=4th > .elif ${MK_LOADER_LUA} == "yes" > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Fri Feb 22 08:10:59 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D93CF14DFF91; Fri, 22 Feb 2019 08:10:59 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F91C8879B; Fri, 22 Feb 2019 08:10:59 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 362A2270B; Fri, 22 Feb 2019 08:10:59 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1M8AxO5013639; Fri, 22 Feb 2019 08:10:59 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1M8AxCI013638; Fri, 22 Feb 2019 08:10:59 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902220810.x1M8AxCI013638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Fri, 22 Feb 2019 08:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344462 - stable/11/tools/build/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/11/tools/build/mk X-SVN-Commit-Revision: 344462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7F91C8879B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 08:11:00 -0000 Author: avos Date: Fri Feb 22 08:10:58 2019 New Revision: 344462 URL: https://svnweb.freebsd.org/changeset/base/344462 Log: MFC r344214: Refresh OptionalObsoleteFiles.inc for MK_PMC: - Add missing pmc.haswellxeon.3 to the list. - Correct man page section for pmcstudy.8. Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Fri Feb 22 08:04:50 2019 (r344461) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Fri Feb 22 08:10:58 2019 (r344462) @@ -7036,7 +7036,6 @@ OLD_FILES+=usr/lib32/libpmc_p.a OLD_FILES+=usr/sbin/pmcannotate OLD_FILES+=usr/sbin/pmccontrol OLD_FILES+=usr/sbin/pmcstat -OLD_FILES+=usr/share/man/man1/pmcstudy.1.gz OLD_FILES+=usr/share/man/man3/pmc.3.gz OLD_FILES+=usr/share/man/man3/pmc.atom.3.gz OLD_FILES+=usr/share/man/man3/pmc.atomsilvermont.3.gz @@ -7046,6 +7045,7 @@ OLD_FILES+=usr/share/man/man3/pmc.corei7.3.gz OLD_FILES+=usr/share/man/man3/pmc.corei7uc.3.gz OLD_FILES+=usr/share/man/man3/pmc.haswell.3.gz OLD_FILES+=usr/share/man/man3/pmc.haswelluc.3.gz +OLD_FILES+=usr/share/man/man3/pmc.haswellxeon.3.gz OLD_FILES+=usr/share/man/man3/pmc.iaf.3.gz OLD_FILES+=usr/share/man/man3/pmc.ivybridge.3.gz OLD_FILES+=usr/share/man/man3/pmc.ivybridgexeon.3.gz @@ -7105,6 +7105,7 @@ OLD_FILES+=usr/share/man/man3/pmclog_read.3.gz OLD_FILES+=usr/share/man/man8/pmcannotate.8.gz OLD_FILES+=usr/share/man/man8/pmccontrol.8.gz OLD_FILES+=usr/share/man/man8/pmcstat.8.gz +OLD_FILES+=usr/share/man/man8/pmcstudy.8.gz .endif .if ${MK_PORTSNAP} == no From owner-svn-src-stable-11@freebsd.org Fri Feb 22 18:24:58 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B493C14F5E23; Fri, 22 Feb 2019 18:24:58 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5324080C1B; Fri, 22 Feb 2019 18:24:58 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46AF491BB; Fri, 22 Feb 2019 18:24:58 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1MIOwSq035511; Fri, 22 Feb 2019 18:24:58 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1MIOwWS035510; Fri, 22 Feb 2019 18:24:58 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201902221824.x1MIOwWS035510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Fri, 22 Feb 2019 18:24:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344472 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 344472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5324080C1B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 18:24:58 -0000 Author: shurd Date: Fri Feb 22 18:24:57 2019 New Revision: 344472 URL: https://svnweb.freebsd.org/changeset/base/344472 Log: MFC r333131: Fix iflib_encap() EFBIG handling bugs 1) Don't give up if m_collapse() fails. Rather than giving up, try m_defrag() immediately. 2) Fix a leak where, if the NIC driver rejected the defrag'ed chain as having too many segments, we would fail to free the chain. Reviewed by: Matthew Macy (this version of patch) Submitted by: Matthew Macy (early version of leak fix) Modified: stable/11/sys/net/iflib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/iflib.c ============================================================================== --- stable/11/sys/net/iflib.c Fri Feb 22 18:02:46 2019 (r344471) +++ stable/11/sys/net/iflib.c Fri Feb 22 18:24:57 2019 (r344472) @@ -3229,8 +3229,12 @@ defrag: switch (err) { case EFBIG: /* try collapse once and defrag once */ - if (remap == 0) + if (remap == 0) { m_head = m_collapse(*m_headp, M_NOWAIT, max_segs); + /* try defrag if collapsing fails */ + if (m_head == NULL) + remap++; + } if (remap == 1) m_head = m_defrag(*m_headp, M_NOWAIT); remap++; @@ -3318,13 +3322,18 @@ defrag: */ txq->ift_pidx = pi.ipi_new_pidx; txq->ift_npending += pi.ipi_ndescs; - } else if (__predict_false(err == EFBIG && remap < 2)) { + } else { *m_headp = m_head = iflib_remove_mbuf(txq); - remap = 1; - txq->ift_txd_encap_efbig++; - goto defrag; - } else + if (err == EFBIG) { + txq->ift_txd_encap_efbig++; + if (remap < 2) { + remap = 1; + goto defrag; + } + } DBG_COUNTER_INC(encap_txd_encap_fail); + goto defrag_failed; + } return (err); defrag_failed: From owner-svn-src-stable-11@freebsd.org Sat Feb 23 14:27:11 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A06C1517D3C; Sat, 23 Feb 2019 14:27:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C61E98CE7E; Sat, 23 Feb 2019 14:27:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAB1F1E8A8; Sat, 23 Feb 2019 14:27:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1NERALp067537; Sat, 23 Feb 2019 14:27:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1NERAL2067536; Sat, 23 Feb 2019 14:27:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201902231427.x1NERAL2067536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 23 Feb 2019 14:27:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r344483 - in stable: 11/contrib/libc++/include 12/contrib/libc++/include X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/libc++/include 12/contrib/libc++/include X-SVN-Commit-Revision: 344483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C61E98CE7E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Feb 2019 14:27:11 -0000 Author: dim Date: Sat Feb 23 14:27:09 2019 New Revision: 344483 URL: https://svnweb.freebsd.org/changeset/base/344483 Log: MFC r344386: Pull in r354515 from upstream libc++ trunk: Fix the build with gcc when `-Wredundant-decls` is passed Summary: gcc warns that `__throw_runtime_error` is declared both in `<__locale>` and ``, if `-Wredundant-decls` is passed on the command line; this is the case with FreeBSD when ${WARNS} == 6. Since `<__locale>` gets its first declaration via a transitive include of ``, and the second declaration is after the first invocation of `__throw_runtime_error`, delete that second declaration. Signed-off-by: Enji Cooper Reviewers: kristina, MaskRay, EricWF, ldionne, ngie Reviewed By: EricWF Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D58425 Submitted by: ngie Modified: stable/11/contrib/libc++/include/__locale Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/libc++/include/__locale Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/libc++/include/__locale ============================================================================== --- stable/11/contrib/libc++/include/__locale Sat Feb 23 09:34:57 2019 (r344482) +++ stable/11/contrib/libc++/include/__locale Sat Feb 23 14:27:09 2019 (r344483) @@ -1230,8 +1230,6 @@ _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) -_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*); - template struct __narrow_to_utf8 {