Date: Sat, 21 Sep 2019 20:43:58 -0400 From: Ryan Stone <rysto32@gmail.com> To: FreeBSD Current <freebsd-current@freebsd.org> Subject: ktrace/kdump give incorrect message on unlinkat() failure due to capabilities Message-ID: <CAFMmRNwLYUhf8YYr-Jpw3CrPj-sU6mg-5xMF-krTE-PpKxnPRA@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
I have written a short test program that runs unlinkat(2) in capability mode and fails due to not having the write capabilities: https://people.freebsd.org/~rstone/src/unlink.c If I run the binary under ktrace and look at the kdump output, it gives the following incorrect output: 43775 unlink CALL unlinkat(0x3,0x7fffffffe995,0) 43775 unlink NAMI "from.QAUlAA0" 43775 unlink CAP operation requires CAP_LOOKUP, descriptor holds CAP_LOOKUP 43775 unlink RET unlinkat -1 errno 93 Capabilities insufficient The message should instead say that the operation requires CAP_UNLINKAT. Looking at sys/capsicum.h, I suspect that the problem is related to the strange definition of CAP_UNLINKAT: #define CAP_UNLINKAT (CAP_LOOKUP | 0x0000000010000000ULL) I have observed the same problem with renameat(2) and CAP_RENAMEAT_SOURCE and CAP_RENAMEAT_TARGET: https://people.freebsd.org/~rstone/src/rename.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFMmRNwLYUhf8YYr-Jpw3CrPj-sU6mg-5xMF-krTE-PpKxnPRA>