I realise "df on unmountd devices is deprecated", but even so, as it stands, there appears to be an invalid free, which causes coredump.
Line 276 and 277:
if (iov != NULL)
This is called prior to building the mount structure for nmount. If the structure has been used before, it tries to free it, but causes a coredump in the process.
To reproduce, run df on 2 or more unmounted devices (you don't actually need a real unmounted device to trigger the bug, simply doing "df /dev/*" will trigger the above codepath.
[ I tagged this "current" because it still occurs in current, but it's in 12-stable too ]
Seems also affecting 11.2-RELEASE.
I'll provide a patch to fix or remove this depracted code if required.
See also: https://reviews.freebsd.org/D8801
IMO, removing it is a reasonable fix for CURRENT, and maybe 12 (I don't touch stable myself, though). I can do it for CURRENT if I get an ack from a committer (e.g., Brooks), or Brooks can go ahead and do it (feel free to 'Discussed with: me' the commit).
I agree removing this feature.
WHR, the quick fix would be:
17:15 (8) "src" jamie@thompson% diff -u bin//df/Makefile.orig bin/df/Makefile
--- bin//df/Makefile.orig 2017-03-04 11:31:08.753360000 +0000
+++ bin/df/Makefile 2019-04-18 21:54:54.741564000 +0100
@@ -10,7 +10,7 @@
+# CFLAGS+= -DMOUNT_CHAR_DEVS
LIBADD= xo util