[DTrace-devel] [PATCH] Provide the maximum string length as BPF symbol STRSZ
Kris Van Hees
kris.van.hees at oracle.com
Fri Aug 20 10:07:17 PDT 2021
On Fri, Aug 20, 2021 at 12:16:05PM -0400, Eugene Loh wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
> though the value isn't so much provided by STRSZ as by &STRSZ. So, the
> subject line could perhaps be a little more precise, though I suppose it
> doesn't matter. Good enough as is.
It is provided by the STRSZ symbol, but the way we need to access use it is
as &STRSZ because of the way we use relocations for this. So yes, it does not
matter. I am documenting it from the implementtion side where the symbol that
gets added to the list of symbols and to the reloc resolver is named STRSZ.
> On 8/20/21 2:46 AM, Kris Van Hees wrote:
> > Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> > ---
> > libdtrace/dt_bpf.h | 7 ++++---
> > libdtrace/dt_cc.c | 4 ++++
> > libdtrace/dt_dlibs.c | 1 +
> > 3 files changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/libdtrace/dt_bpf.h b/libdtrace/dt_bpf.h
> > index dcc82b80..68e4aa07 100644
> > --- a/libdtrace/dt_bpf.h
> > +++ b/libdtrace/dt_bpf.h
> > @@ -23,9 +23,10 @@ extern "C" {
> > #define DT_CONST_CLID 3
> > #define DT_CONST_ARGC 4
> > #define DT_CONST_STBSZ 5
> > -#define DT_CONST_STKOFF 6
> > -#define DT_CONST_STKSIZ 7
> > -#define DT_CONST_BOOTTM 8
> > +#define DT_CONST_STRSZ 6
> > +#define DT_CONST_STKOFF 7
> > +#define DT_CONST_STKSIZ 8
> > +#define DT_CONST_BOOTTM 9
> >
> > extern int perf_event_open(struct perf_event_attr *attr, pid_t pid, int cpu,
> > int group_fd, unsigned long flags);
> > diff --git a/libdtrace/dt_cc.c b/libdtrace/dt_cc.c
> > index 2a6904a0..f69c750d 100644
> > --- a/libdtrace/dt_cc.c
> > +++ b/libdtrace/dt_cc.c
> > @@ -2348,6 +2348,10 @@ dt_link_construct(dtrace_hdl_t *dtp, const dt_probe_t *prp, dtrace_difo_t *dp,
> > case DT_CONST_STBSZ:
> > nrp->dofr_data = dtp->dt_strlen;
> > continue;
> > + case DT_CONST_STRSZ:
> > + nrp->dofr_data =
> > + dtp->dt_options[DTRACEOPT_STRSIZE];
> > + continue;
> > case DT_CONST_STKOFF:
> > nrp->dofr_data = roundup(dtp->dt_maxreclen, 8);
> > continue;
> > diff --git a/libdtrace/dt_dlibs.c b/libdtrace/dt_dlibs.c
> > index 35a18596..53abe2f7 100644
> > --- a/libdtrace/dt_dlibs.c
> > +++ b/libdtrace/dt_dlibs.c
> > @@ -78,6 +78,7 @@ static const dt_ident_t dt_bpf_symbols[] = {
> > DT_BPF_SYMBOL_ID(CLID, DT_IDENT_SCALAR, DT_CONST_CLID),
> > DT_BPF_SYMBOL_ID(ARGC, DT_IDENT_SCALAR, DT_CONST_ARGC),
> > DT_BPF_SYMBOL_ID(STBSZ, DT_IDENT_SCALAR, DT_CONST_STBSZ),
> > + DT_BPF_SYMBOL_ID(STRSZ, DT_IDENT_SCALAR, DT_CONST_STRSZ),
> > DT_BPF_SYMBOL_ID(STKOFF, DT_IDENT_SCALAR, DT_CONST_STKOFF),
> > DT_BPF_SYMBOL_ID(STKSIZ, DT_IDENT_SCALAR, DT_CONST_STKSIZ),
> > DT_BPF_SYMBOL_ID(BOOTTM, DT_IDENT_SCALAR, DT_CONST_BOOTTM),
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
More information about the DTrace-devel
mailing list