-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial port of DTrace for Morello #2309
Open
markjdb
wants to merge
47
commits into
CTSRD-CHERI:dev
Choose a base branch
from
markjdb:dev-dtrace2
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
6690b99
dtrace: Remove an unused typedef
markjdb 4b460d7
dtrace tests: Avoid hard-coding paths to required programs
markjdb 375ded9
dtrace: Fix the definition of pc_t
markjdb 2035a30
libdtrace: Use C99 designated initializers for dt_idops_t
markjdb 06a1c6e
dtrace/arm64: Simplify variable declarations in the invop handler
markjdb 6b0068f
dtrace: Use size_t instead of uintptr_t to represent buffer offsets
markjdb 8a0fe9d
dtrace tests: Fix the ATF config variable name
markjdb ea90dbb
libdtrace: Generalize handling of data models a bit
markjdb 8ad6b87
libdtrace: Use designators to initialize the opcode array
markjdb c8ad5e1
sdt: Stop defining probe and provider structures as arrays
markjdb 07a7561
dtrace/arm64: Fix enumeration of FBT return probes
markjdb 6b295f9
linker: Improve handling of ifunc symbols
markjdb 1c82ae6
sdt: Use .chericap to store pointers
markjdb 3ef81df
sdt: Avoid setting subobject bounds when adding tracepoint definitions
markjdb 89938db
sdt: Make sure that tracepoints carry a valid capability for patching
markjdb 3fa774a
dtrace/arm64: Add some support for FBT on Morello
markjdb 09f86aa
dtrace: Remove COMPAT_FREEBSD64 hooks
markjdb d3d26ed
sys/tools/syscalls: Convert sysent probe parameters to intcap_t
markjdb 30b3636
dtrace: Build systrace_freebsd32 only if COMPAT_FREEBSD32 is configured
markjdb 294cfdb
systrace: Use uintcap_t for probe arguments
markjdb 809583f
systrace: Regenerate
markjdb ac8492f
sdt: Fix format strings for uintptr_t
markjdb 5eea5d2
kinst: Use a vm_pointer_t to store a trampoine address
markjdb ad51be4
dtrace: Cast to ptraddr_t instead of uintptr_t where appropriate
markjdb e0a289f
dtrace: Make fuword* and copy(in|out) wrappers capability aware
markjdb ff2ccfa
dtrace: Avoid applying subobject bounds in dtrace_ecb_aggregation_cre…
markjdb 3f45c07
libdtrace: Add a new data model for CHERI
markjdb 5fbe282
dtrace: Extend use of the dtrace_uarg_t type
markjdb 4450611
dtrace: Convert more incorrect uses of uintptr_t to size_t
markjdb d952d94
dtrace: Introduce dtrace_difval_t
markjdb f629227
dtrace: Return a uint64ptr_t from provider getarg routines
markjdb 3eef650
dtrace tests: Exclude json and usdt tests for now
markjdb 88d7794
ctfconvert: Teach the DWARF parser about intcap encodings
markjdb 014fce9
dtrace: Add a new probe error type for CHERI exceptions
markjdb aa329c8
libdtrace: Add support for printing capabilities
markjdb 316af71
dtrace: Improve a few MD subroutines
markjdb 5a73f78
libdtrace: Use the right width for CPU registers
markjdb 5f5aa50
dtrace: Add capability load and store DIF instructions
markjdb 0d36ec4
libdtrace: Emit LDC and STC DIF instructions when appropriate
markjdb 850a735
dtrace: Permit storing capability-sized values to the trace buffer
markjdb ba62ac3
dtrace: Fix handling of dynamic state in purecap kernels
markjdb 27bb3b6
dtrace/arm64: Avoid calling memcpy() in dtrace_getarg()
markjdb e1917f3
dtrace/arm64: Handle purecap function prologues in kinst
markjdb e17ac4e
dtrace/arm64: Synthesize patchpoint capabilities
markjdb 976f039
share/mk: Enable WITH_DTRACE by default
markjdb 2d0c820
arm64: Enable KDTRACE_HOOKS in GENERIC-MORELLO
markjdb 3003ee1
dtrace: Add a sysctl to block loading of dtrace.ko in CHERI kernels
markjdb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the problem not just that we should be doing make_capability prior to the IFUNC check, rather than after?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, or I don't understand your suggestion.
Consumers of this interface generally don't want to know about ifuncs. What we do for ifuncs is provide a function symbol that refers to the implementation selected by the resolver. Without this change, we were kind of doing that, but the symbol value would be a sentry capability and the size would be that of the ifunc symbol (which in practice is the size of the resolver function). My goal with this change is to eliminate those differences. I don't see how calling make_capability() first would help with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return value of the resolver is what we want to be giving, because it itself comes from some other non-IFUNC capability that the linker's properly constructed. The problem is that make_capability, for an IFUNC, thinks it's been given a capability that's ef->address plus some constant, but it's not, it's got the actual function pointer. On the flip side, we're calling the resolver via a capability that's ef->address plus some constant, so hasn't had its permissions restricted. IFUNCs are in essence "get a capability to the function as normal, but then call it to get the real capability", but we're failing to implement that here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think I see, but addressing that won't fix my problem: the resolver returns a function pointer, which isn't what callers of
link_elf_each_function_nameval()
expect. I'd have to, at least, unseal the symbol value.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that's what it returns for normal STT_FUNC today, too? Why are IFUNCs special in that regard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main consumer of this interface is linker_file_lookup_set(), which definitely requires capabilities, though I expect that linker sets generally don't contain function symbols. I don't think we can return a ptraddr_t here.
I don't quite follow your comment about calling the ifunc resolver with the "right" capability - from what I can, relocate_file1() passes
ef->address
asrelocbase
toelf_reloc_internal()
, where it's used to derive the resolver capability, just as we do here. You said earlier that we should perhaps callmake_capability()
before invoking the resolver, which is makes sense to me, but it doesn't solve my problem.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in the capability we use for the call should have code capability permissions only (and the right bounds, but I believe we don't bound kernel code capabilities even on Morello?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, you are asking me to make that change in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, other than that if we're thinking carefully about and rewriting this code to be less weird it might be something that gets folded into the rewrite rather than preserving the oddity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I need to go and understand exactly what these interfaces are being used for to be able to assess what the right thing to do about your issue is)