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
A commit references this bug:
Date: Fri Nov 13 16:47:42 UTC 2020
New revision: 367642
df: Remove support for mounting devices
This was marked deprecated in r329092, over two and a half years ago.
This functionality is also buggy per PR 237368.
Reviewed by: brooks, cem, emaste, imp
Differential Revision: https://reviews.freebsd.org/D27197
I'm sorry that it took a while to get this resolved. I just went ahead and deleted the code in question.
I'm not sure what to do on stable/12. We probably shouldn't merge the removal. If there's a patch which fixes the bug I can apply it there, but existing releases will still have the bug, so I'm not sure it's worth the effort at this point.
(In reply to Mark Johnston from comment #9)
Since there was no feedback I will leave things be on stable/12.
(In reply to Mark Johnston from comment #10)
Apologies, I missed the notification of your updates.
Thanks for doing this.
As you say, may as well leave FreeBSD 11/12 as they are.