Hi Sebastien,
I had a similar diff lying around, although with if/else, and forgot
about it :\
OK mestre@ if someone wants to commit it and thank you!
On 09:03 Fri 28 Sep , Sebastien Marie wrote:
> Hi,
>
> The unveil(2) call for savecore(8) is incomplete. savecore(8) needs to
> access to the /bsd to copying it.
>
> Without it, savecore(8) abort the process, and due to karl, the original
> kernel is lost.
>
> Without the patch:
> ------------------
> savecore: reboot after panic: pool_do_get: vmmpepl free list modified: page
> 0xffffff0187540000; item addr 0xffffff01875400a8; offset 0x38=0xd6adbeef
> savecore: system went down at Fri Sep 28 08:07:31 2018
> savecore: /bsd: No such file or directory
>
>
> I was able to successfully extract the dump with the patch (but /bsd
> wasn't the right kernel anymore due to reboot).
>
> Thanks.
> --
> Sebastien Marie
>
>
> Index: savecore.c
> ===================================================================
> RCS file: /cvs/src/sbin/savecore/savecore.c,v
> retrieving revision 1.58
> diff -u -p -r1.58 savecore.c
> --- savecore.c 24 Sep 2018 21:26:38 -0000 1.58
> +++ savecore.c 28 Sep 2018 06:47:58 -0000
> @@ -175,6 +175,10 @@ main(int argc, char *argv[])
> syslog(LOG_ERR, "unveil: %m");
> exit(1);
> }
> + if (unveil(kernel ? kernel : _PATH_UNIX, "r") == -1) {
> + syslog(LOG_ERR, "unveil: %m");
> + exit(1);
> + }
> if (pledge("stdio rpath wpath cpath", NULL) == -1) {
> syslog(LOG_ERR, "pledge: %m");
> exit(1);
>