| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The barrier code was using semaphores which have been deprecated in
macOS and not working at all, causing a race condition. Since macOS
does not have pthread_barrier_*(), this change uses a condition
variable instead.
PR: 290958
Reported by: wosch
MFC after: 2 weeks
Reviewed by: imp, markj
Differential Revision: https://reviews.freebsd.org/D54018
|
| |
|
|
|
| |
MFC after: 1 week
Fixes: e7e964cb2ebd ("syscalls: normalize _exit(2) declerations")
|
| |
|
|
|
|
|
|
| |
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1907
|
| |
|
|
|
|
|
|
| |
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1907
|
| |
|
|
|
|
|
|
| |
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1907
|
| |
|
|
|
|
|
|
| |
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1907
|
| |
|
|
|
|
| |
Fixes: 6efcc2f26ab0 Add static tracing for privilege checking
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D53630
|
| |
|
|
|
|
| |
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D53627
|
| |
|
|
|
|
| |
There should be no space between -x's "arg" and "=value".
MFC after: 3 days
|
| |
|
|
|
| |
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D51287
|
| |
|
|
|
|
| |
MFC after: 2 weeks
Fixes: 91dd9aae1ab8 Add explicit static DTrace tracing to the callout mechanism
Differential Revision: https://reviews.freebsd.org/D51397
|
| |
|
|
|
|
| |
Reviewed by: bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D51317
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
printm is specific to the FreeBSD dtrace port. I believe it's
effectively the same as tracemem(), though printm apparently predates
it. It stores the size of the buffer of traced data inline. Currently
it represents that size using a uintptr_t, which isn't really right and
poses challenges when porting to CHERI because
`DTRACE_STORE(uintptr_t, ...` requires the destination to be suitably
aligned, but this isn't necessary since we're just storing a size.
Convert to using a size_t. This should be a no-op since
sizeof(uintptr_t) == sizeof(size_t) on non-CHERI platforms (and besides
that I don't see a reason to use printm() when tracemem() is available
and is simpler to use.)
Reviewed by: Domagoj Stolfa, avg
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D52055
|
| |
|
|
|
|
|
|
| |
PR: 288284
Reviewed by: bcr, markj
MFC after: 3 days
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51633
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Symbols defined using assembler directives lack type info, but in this
case one ought to be able to cast a pointer to the symbol and
dereference the pointer to get a value. Without this change, D
disallows this trick since it requires all identifiers to have a type.
Relax the rules slightly and allow an identifier to have type "void" if
we know we're just taking its address.
As a result, the following dtrace invocation works:
dtrace -n 'tick-1s {printf("%d", *(int *)&`ticks);}'
In particular, since commit b2b974f7ef4c ("clock: Simplify subr_ticks
and rename"), "ticks" does not have any type info associated with it, so
its value couldn't be printed. This trick provides a workaround and is
probably generally useful.
Add a regression test which exercises this functionality.
PR: 287752
Reviewed by: avg
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D51417
|
| |
|
|
|
|
| |
Also make the array const. No functional change intended.
MFC after: 1 week
|
| |
|
|
|
|
|
|
|
| |
Reported by: markj
Reviewed by: christos, markj (earlier version), ziaee
Obtained from: Mark Johnston, DTrace, FreeBSD Journal, May 2014
Obtained from: https://wiki.freebsd.org/DTrace/One-Liners
MFC after: 2 weeks
Relnotes: yes
|
| |
|
|
|
|
| |
Reviewed by: christos, ziaee
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D51301
|
| |
|
|
|
|
|
| |
Event: Berlin Hackathon 202507
Reviewed by: bcr, christos
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D51278
|
| |
|
|
|
|
|
| |
Reviewed by: bcr, christos, ziaee
Event: Berlin Hackathon 202507
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D51268
|
| |
|
|
|
|
|
| |
Reviewed by: bcr, christos
Event: Berlin Hackathon 202507
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D51267
|
| |
|
|
|
| |
Reviewed by: bcr
Event: Berlin 2025 Hackathon
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Dtrace assumes only ELF sections of type SHT_PROGBITS or SHT_NOBITS
occupy memory space. However, sections with SHF_ALLOC flag also consume
memory space. Moreover, the symbol address initialization skips symbols
at the very beginning of a section in ET_REL KLDs.
Fix: Check section flag for calculating section offset, and disable the
skipping at the beginning of a section.
PR: 288000
Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D51188
|
| |
|
|
|
| |
MFC after: 1 month
Pull Request: https://github.com/freebsd/freebsd-src/pull/1698
|
| |
|
|
|
|
|
|
| |
Taken from last commit bb9475a199514dcace79d04d02c1eff05d65b94f from
https://github.com/illumos/illumos-gate/tree/master/usr/src/test/os-tests/tests/oclo
MFC after: 1 month
Pull Request: https://github.com/freebsd/freebsd-src/pull/1698
|
| |
|
|
|
|
|
| |
Reviewed by: bnovkov, christos, markj
Approved by: bnovkov (mentor), christos (mentor), markj (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D50852
|
| |
|
|
|
|
|
|
| |
Otherwise these tests fail spuriously, depending on which compiler is
installed as cc.
MFC after: 2 weeks
Sponsored by: Innovate UK
|
| |
|
|
|
|
|
| |
dt_oformat_drop() should only be called when in structured output mode.
Reviewed by: Domagoj Stolfa
Fixes: 93f27766a7e1 ("dtrace: Add the 'oformat' libdtrace option")
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The illumos-specific _SC_CPUID_MAX is the largest CPU ID in the system. This
was mapped to _SC_NPROCESSORS_CONF, which is the total number of CPUs recognized
by the kernel. If CPU IDs are contiguous, as is the case on amd64 and arm64,
this value is one greater than the maximum ID. As a result, when consuming
per-CPU dtrace buffers, libdtrace tries to fetch from a non-existent CPU. This
is mostly harmless in practice, but still wrong.
As we don't have a sysconf value for the maximum CPU ID, add a wrapper which
fetches it using the kern.smp.maxid sysctl.
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D49243
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The zero'th index in the array is unused, so a priority queue of N elements
needs N+1 array slots. Fix the allocation.
Also fix the assertion in dt_pq_insert(): the assertion needs to be checked
after incrementing the count of items in the priority queue, otherwise it can
miss an overflow.
Reported by: CHERI
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D49242
|
| |
|
|
|
|
|
| |
No functional change intended.
MFC after: 2 weeks
Sponsored by: Innovate UK
|
| |
|
|
|
|
|
|
|
|
| |
Make it easier to support data models other than ILP32 and LP64 by
avoiding constructs which assume that it must be one or the other.
No functional change intended.
MFC after: 2 weeks
Sponsored by: Innovate UK
|
| |
|
|
|
|
|
| |
No functional change intended.
MFC after: 1 week
Sponsored by: Innovate UK
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If one of two pointers refers to a forward declaration, let the pointers
be compatible so long as the referred types have the same name.
Otherwise we can get spurious errors.
To give a specific example, this can happen when ipfw_nat.ko is loaded
before ipfw.ko and /usr/lib/dtrace/ipfw.d is processed. Currently,
ipfw_nat.ko does not have a definition for struct inpcb (i.e., none of
its files include in_pcb.h), so in the CTF type graph, struct
ip_fw_args' "inp" member refers to a forward declaration, represented in
CTF with CTF_K_FORWARD.
Then, when libdtrace processes the ipfw_match_info_t translator in
ipfw.d, it decides that the "inp" field assignment is incorrect because
the two pointers are incompatible. However, there's no harm in allowing
this assignment. Add some logic to dt_node_is_ptrcompat() to detect
this case and declare the pointers as compatible so long as the name of
the thing they refer to is the same, similar to how any pointer is
compatible with a void *.
Reported by: marck
Reviewed by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D48254
|
| |
|
|
|
|
| |
Reviewed by: avg
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D46674
|
| |
|
|
|
|
|
|
| |
The use of an ifdef here most likely carries over from when the dtrace
port only worked on x86 platforms.
MFC after: 2 weeks
Sponsored by: Innovate UK
|
| |
|
|
|
|
|
| |
No functional change intended.
MFC after: 1 week
Sponsored by: Innovate UK
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The idea here is to avoid a memory access and conditional branch per
probe site. Instead, the probe is represented by an "unreachable"
unconditional function call. asm goto is used to store the address of
the probe site (represented by a no-op sled) and the address of the
function call into a tracepoint record. Each SDT probe carries a list
of tracepoints.
When the probe is enabled, the no-op sled corresponding to each
tracepoint is overwritten with a jmp to the corresponding label. The
implementation uses smp_rendezvous() to park all other CPUs while the
instruction is being overwritten, as this can't be done atomically in
general. The compiler moves argument marshalling code and the
sdt_probe() function call out-of-line, i.e., to the end of the function.
Per gallatin@ in D43504, this approach has less overhead when probes are
disabled. To make the implementation a bit simpler, I removed support
for probes with 7 arguments; nothing makes use of this except a
regression test case. It could be re-added later if need be.
The approach taken in this patch enables some more improvements:
1. We can now automatically fill out the "function" field of SDT probe
names. The SDT macros let the programmer specify the function and
module names, but this is really a bug and shouldn't have been
allowed. The intent was to be able to have the same probe in
multiple functions and to let the user restrict which probes actually
get enabled by specifying a function name or glob.
2. We can avoid branching on SDT_PROBES_ENABLED() by adding the ability
to include blocks of code in the out-of-line path. For example:
if (SDT_PROBES_ENABLED()) {
int reason = CLD_EXITED;
if (WCOREDUMP(signo))
reason = CLD_DUMPED;
else if (WIFSIGNALED(signo))
reason = CLD_KILLED;
SDT_PROBE1(proc, , , exit, reason);
}
could be written
SDT_PROBE1_EXT(proc, , , exit, reason,
int reason;
reason = CLD_EXITED;
if (WCOREDUMP(signo))
reason = CLD_DUMPED;
else if (WIFSIGNALED(signo))
reason = CLD_KILLED;
);
In the future I would like to use this mechanism more generally, e.g.,
to remove branches and marshalling code used by hwpmc, and generally to
make it easier to add new tracepoint consumers without having to add
more conditional branches to hot code paths.
Reviewed by: Domagoj Stolfa, avg
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D44483
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When compiling dt_lex.l, flex produces warnings of the form:
dt_lex.l:413: warning, trailing context made variable due to preceding '|' action
dt_lex.l:412: warning, dangerous trailing context
dt_lex.l:412: warning, dangerous trailing context
Here, trailing context refers to the use of "$", which expands to "/\n".
The meaning behind these warnings is described in the first two
paragraphs of the flex manual's DEFICIENCIES/BUGS section:
Some trailing context patterns cannot be properly matched and generate
warning messages ("dangerous trailing context"). These are patterns
where the ending of the first part of the rule matches the beginning of
the second part, such as "zx*/xy*", where the 'x*' matches the 'x' at
the beginning of the trailing context. (Note that the POSIX draft
states that the text matched by such patterns is undefined.)
For some trailing context rules, parts which are actually fixed-length
are not recognized as such, leading to the above mentioned performance
loss. In particular, parts using '|' or {n} (such as "foo{3}") are
always considered variable-length.
Here, the warnings appear to be bogus in this case. The lexer has no
problem matching either of the referenced patterns, e.g.,
printf("foobar
or
# 1 "asdfasdf
Introduce a small amount of code duplication to silence the warning.
MFC after: 2 weeks
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If there are no CTF sections then ctfmerge just has nothing to do; it
should not be an error.
Note that ctfmerge has an option to require CTF:
-t Make sure that all object files have a CTF section.
Before this change, this option explicitly exited without error if none
of the object files have CTF sections, with the comment:
If we're verifying that C files have CTF, it's safe to
assume that in this case, we're building only from assembly
inputs.
PR: 276930
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43878
|
| |
|
|
|
|
| |
Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43715
|
| |
|
|
| |
MFC after: 1 week
|
| |
|
|
| |
MFC after: 1 week
|
| |
|
|
|
|
|
|
| |
In particular, avoid loading the user's .profile file, since that can
have undesirable side effects. Most tests were already careful to do
this.
MFC after: 1 week
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This option can be used to specify a format to use in DTrace output.
The following formats are supported:
- json
- xml
- html
- none (default DTrace output)
This is implemented using libxo and integrated into libdtrace. Client
code only works with the following API:
- dtrace_oformat_setup(dtrace_hdl_t *) -- to be called when output is starting.
- dtrace_oformat_teardown(dtrace_hdl_t *) -- to be called when output is finished
- dtrace_oformat(dtrace_hdl_t *) -- check if oformat is enabled.
- dtrace_set_outfp(FILE *) -- sets the output file for oformat.
- Ensure that oformat is correctly checked in the drop handler and record
processing callbacks.
This commit also adds tests which check if the generated output is
valid (JSON, XML) and extends the dtrace(1) describing the structured output.
Reviewed by: markj
Discussed with: phil
MFC after: 2 months
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41745
|
| |
|
|
|
|
|
|
|
| |
This attribute is new in DWARF 4 and supersedes DW_AT_bit_offset.
PR: 276059
Reported by: rscheff
Tested by: rscheff
MFC after: 1 week
|
| |
|
|
| |
MFC after: 1 week
|
| |
|
|
|
|
| |
Approved by: markj (cddl/contrib changes)
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41961
|
| |
|
|
|
|
|
|
|
|
| |
libproc's PR_REQUESTED is not implemented on FreeBSD. Remove dead code
in dtrace that would handle it.
Reviewed by: markj
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D41225
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
dtrace stored its PR_RLC and PR_KLC flags in the proc_handle's flags,
where they collided with PATTACH_FORCE and PATTACH_RDONLY, respectively.
Thus, Psetflags(PR_KLC) effectively also set the PATTACH_RDONLY flag.
Since the flags are private to dtrace (at least on FreeBSD), store them in
dtrace's own dt_proc structure instead.
On FreeBSD, either PR_RLC or PR_KLC was always set, so remove code that
would handle the case where neither was set.
Reviewed by: markj
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D41121
|