[DTrace-devel] [PATCH 1/2] bpf: add PC to fault reporting using dt_probe_error()
Eugene Loh
eugene.loh at oracle.com
Thu May 11 15:50:31 UTC 2023
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
but surely it's possible to have at least rudimentary tests for this.
On 5/11/23 01:23, Kris Van Hees via DTrace-devel wrote:
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
> bpf/get_bvar.c | 3 ++-
> bpf/speculation.c | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/bpf/get_bvar.c b/bpf/get_bvar.c
> index ef2e2ca6..4fc6b880 100644
> --- a/bpf/get_bvar.c
> +++ b/bpf/get_bvar.c
> @@ -23,13 +23,14 @@ extern struct bpf_map_def cpuinfo;
> extern struct bpf_map_def probes;
> extern struct bpf_map_def state;
>
> +extern uint64_t PC;
> extern uint64_t STBSZ;
> extern uint64_t STKSIZ;
> extern uint64_t BOOTTM;
>
> #define error(dctx, fault, illval) \
> ({ \
> - dt_probe_error((dctx), -1, (fault), (illval)); \
> + dt_probe_error((dctx), (uint64_t)&PC, (fault), (illval)); \
> -1; \
> })
>
> diff --git a/bpf/speculation.c b/bpf/speculation.c
> index 6e032a44..c565c8da 100644
> --- a/bpf/speculation.c
> +++ b/bpf/speculation.c
> @@ -20,6 +20,7 @@
>
> extern struct bpf_map_def specs;
> extern struct bpf_map_def state;
> +extern uint64_t PC;
> extern uint64_t NSPEC;
>
> /*
> @@ -151,7 +152,7 @@ dt_speculation_set_drainable(const dt_dctx_t *dctx, uint32_t id)
> if ((spec = bpf_map_lookup_elem(&specs, &id)) == NULL) {
> if (id <= (uint64_t) &NSPEC)
> return 0;
> - dt_probe_error(dctx, -1, DTRACEFLT_ILLOP, 0);
> + dt_probe_error(dctx, (uint64_t)&PC, DTRACEFLT_ILLOP, 0);
> return -1;
> }
> spec->draining = 1;
More information about the DTrace-devel
mailing list