Page MenuHomeFreeBSD

ktrdump(8): Capsicumify
ClosedPublic

Authored by cem on Sep 18 2016, 6:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 6, 10:26 PM
Unknown Object (File)
Thu, Mar 6, 10:23 PM
Unknown Object (File)
Thu, Mar 6, 7:37 PM
Unknown Object (File)
Thu, Mar 6, 6:15 PM
Unknown Object (File)
Thu, Mar 6, 5:07 PM
Unknown Object (File)
Thu, Mar 6, 2:34 PM
Unknown Object (File)
Jan 25 2025, 11:34 PM
Unknown Object (File)
Jan 2 2025, 7:32 PM
Subscribers

Details

Summary

We restrict the (optional) input file and output files. It would be
nice to restrict the KVM files, but that's up to libkvm.

We wait until after kvm_nlist() is invoked to cap_enter() because
kldsym() isn't supported in the Capsicum sandbox.

Test Plan
  • Someone™ needs to test this with a KTR-enabled kernel. My GENERIC kernel doesn't have KTR and I don't want to reboot into a different kernel quite yet.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

cem retitled this revision from to ktrdump(8): Capsicumify.
cem updated this object.
cem edited the test plan for this revision. (Show Details)
cem added reviewers: emaste, jhb, allanjude, neel.
usr.bin/ktrdump/ktrdump.c
31–32 ↗(On Diff #20419)

style(9) as noted elsewhere

94 ↗(On Diff #20419)

I think cap_rights_t should sort with structs

144–146 ↗(On Diff #20419)

what's up here?

usr.bin/ktrdump/ktrdump.c
31–32 ↗(On Diff #20419)

Well, not style(9) :-).

94 ↗(On Diff #20419)

What specific ordering do you want here? It is adjacent to the only other struct variable.

144–146 ↗(On Diff #20419)

The fopen() should have stayed fopen(optarg). (Initially, I had the strlcpy first. After I moved it below, I forgot to change the fopen argument.)

usr.bin/ktrdump/ktrdump.c
31–32 ↗(On Diff #20419)

Yes, style(9).

usr.bin/ktrdump/ktrdump.c
31–32 ↗(On Diff #20419)

style, not style(9) -- it is our style, it's just not documented as such in the man page

94 ↗(On Diff #20419)

there's struct ktr_entry above; I didn't notice the other struct below.

usr.bin/ktrdump/ktrdump.c
31–32 ↗(On Diff #20419)

style(9) is an ambiguous term. It is also the shorthand for our style as (poorly) documented in /usr/src/share/man/man9/style.9 and tribal knowledge of the group. It's also an emotionally charged topic that elicits PTSD type behavior and responses.

usr.bin/ktrdump/ktrdump.c
31–32 ↗(On Diff #20419)

I think imp's reading into style(9) a suggestion that isn't really there. It should be explicit in the document. To me "style(9)" refers specifically to the document.

94 ↗(On Diff #20419)

That's a pointer. I have no idea how the sorting is supposed to work, though.

usr.bin/ktrdump/ktrdump.c
31–32 ↗(On Diff #20419)

Added in rS306010

usr.bin/ktrdump/ktrdump.c
31–32 ↗(On Diff #20419)

I've made some sensible changes to style(9) that you should find favorable. Or at least not unfavorable...

usr.bin/ktrdump/ktrdump.c
94 ↗(On Diff #20419)

Sigh, so it is.

style(9) does actually have guidance here: "When declaring variables in functions declare them sorted by size, then in alphabetical order"

cem marked 9 inline comments as done.
  • Sort headers correctly
  • Unbreak '-o' fopen(3) call
usr.bin/ktrdump/ktrdump.c
94 ↗(On Diff #20419)

Left as-is due to lack of any apparent prevailing order. :-)

to be updated with capsicum helpers

cem edited edge metadata.

Use capsicum helper for opening NLS catpages.

This revision was automatically updated to reflect the committed changes.