Changing file permissions on /dev/dt to allow non-root access and a
simple `btrace -l' as non-root user already dt(4)'s KASSERT()s.
Instead of panicing the machine I think we can return early just like
in other failure cases and either allow the requested operation as
non-root (listing available probes works) or let it fail further down
in the ioctl path (probing as non-root will not work).
Feedback? OK?
Index: dev/dt/dt_dev.c
===================================================================
RCS file: /cvs/src/sys/dev/dt/dt_dev.c,v
retrieving revision 1.4
diff -u -p -r1.4 dt_dev.c
--- dev/dt/dt_dev.c 4 Feb 2020 10:56:15 -0000 1.4
+++ dev/dt/dt_dev.c 19 Mar 2020 19:44:27 -0000
@@ -406,7 +406,8 @@ dt_ioctl_record_stop(struct dt_softc *sc
{
struct dt_pcb *dp;
- KASSERT(suser(curproc) == 0);
+ if (suser(curproc) != 0)
+ return;
if (!sc->ds_recording)
return;
@@ -438,7 +439,8 @@ dt_ioctl_probe_enable(struct dt_softc *s
struct dt_pcb *dp;
int error;
- KASSERT(suser(curproc) == 0);
+ if (suser(curproc) != 0)
+ return EPERM;
if (!dtioc_req_isvalid(dtrq))
return EINVAL;