Page MenuHomeFreeBSD

dtrace/arm: Really trap translation faults
ClosedPublic

Authored by freebsd_dev.thsi.be on Sun, Aug 30, 10:51 PM.
Tags
None
Referenced Files
F170721901: D59281.id185461.diff
Sun, Sep 6, 5:29 AM
F170697678: D59281.id185503.diff
Sun, Sep 6, 2:11 AM
F170663394: D59281.id185461.diff
Sat, Sep 5, 9:41 PM
F170610950: D59281.id185699.diff
Sat, Sep 5, 3:30 PM
F170564857: D59281.id185503.diff
Sat, Sep 5, 10:43 AM
Unknown Object (File)
Sat, Sep 5, 5:12 AM
Unknown Object (File)
Sat, Sep 5, 1:49 AM
Unknown Object (File)
Fri, Sep 4, 11:46 PM
Subscribers

Details

Summary

Fix the constant case label to properly handle translation faults
caused by DTrace probes. Alignment errors are not expected to be
generated, so stop handling them.

While at it, correct an amd64-specific comment and add a comment
regarding the missing faulting address which could be addressed by a
later improvement.

PR: 298064
MFC after: 1 month

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76340
Build 73223: arc lint + arc unit

Event Timeline

sys/cddl/dev/dtrace/arm/dtrace_subr.c
191

Shouldn't this handle FAULT_PERM_L2 and FAULT_PERM_L1 as well? Otherwise we won't intercept, e.g., dtrace_copyout to read-only memory.

added case for FAULT_PERM_L2 and FAULT_PERM_L1

Good point, I didn't think about this situation. I think that is what the DTrace toxic_range is supposed to prevent, but I'm not sure it is kept updated with such read-only mapping, so better safe than sorry. FWIW I think that copyout needs it own implementation because right now it is using copyin with inversed uaddr and kaddr argument and that's expected to not work. I'll have a closer look on how one can use copyout (aka destructive mode) and if it needs fixing.

Good point, I didn't think about this situation. I think that is what the DTrace toxic_range is supposed to prevent, but I'm not sure it is kept updated with such read-only mapping, so better safe than sorry. FWIW I think that copyout needs it own implementation because right now it is using copyin with inversed uaddr and kaddr argument and that's expected to not work. I'll have a closer look on how one can use copyout (aka destructive mode) and if it needs fixing.

Toxic ranges are for preventing accesses to device memory where reads may have side effects. See the comment above the definition of struct dtrace_toxrange. We rely on the MMU to raise a trap if copyout() tries to write to a read-only mapping.

This revision is now accepted and ready to land.Thu, Sep 3, 1:26 PM
This revision was automatically updated to reflect the committed changes.