diff options
author | 2020-03-28 15:42:25 +0000 | |
---|---|---|
committer | 2020-03-28 15:42:25 +0000 | |
commit | 238295763ced58d84d82653d6eb4cda9b1927b27 (patch) | |
tree | 6a51f1c6e114fa4c978c5f9aacd8f3d939fed3fc /sys | |
parent | CRYPTO_ALGORITHM_ALL died in a 2010 viking raid. Use (diff) | |
download | wireguard-openbsd-238295763ced58d84d82653d6eb4cda9b1927b27.tar.xz wireguard-openbsd-238295763ced58d84d82653d6eb4cda9b1927b27.zip |
Export the number of arguments exposed by a probe to userland.
Also make the syscall provider exports the number of syscall
arguments. This will allow for stricter checks when parsing
`argN' and future `args->name'.
This is an ABI change, don't forget to keep btrace(8) and your
kernel in sync.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/dt/dt_dev.c | 3 | ||||
-rw-r--r-- | sys/dev/dt/dt_prov_syscall.c | 3 | ||||
-rw-r--r-- | sys/dev/dt/dtvar.h | 7 |
3 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/dt/dt_dev.c b/sys/dev/dt/dt_dev.c index 710134b0871..d8826cbd97f 100644 --- a/sys/dev/dt/dt_dev.c +++ b/sys/dev/dt/dt_dev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_dev.c,v 1.5 2020/03/25 14:59:23 mpi Exp $ */ +/* $OpenBSD: dt_dev.c,v 1.6 2020/03/28 15:42:25 mpi Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org> @@ -361,6 +361,7 @@ dt_ioctl_list_probes(struct dt_softc *sc, struct dtioc_probe *dtpr) break; } info.dtpi_pbn = dtp->dtp_pbn; + info.dtpi_nargs = dtp->dtp_nargs; strlcpy(info.dtpi_prov, dtp->dtp_prov->dtpv_name, sizeof(info.dtpi_prov)); strlcpy(info.dtpi_func, dtp->dtp_func, sizeof(info.dtpi_func)); diff --git a/sys/dev/dt/dt_prov_syscall.c b/sys/dev/dt/dt_prov_syscall.c index f311ac185ca..3f765193efa 100644 --- a/sys/dev/dt/dt_prov_syscall.c +++ b/sys/dev/dt/dt_prov_syscall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_prov_syscall.c,v 1.2 2020/03/25 14:59:23 mpi Exp $ */ +/* $OpenBSD: dt_prov_syscall.c,v 1.3 2020/03/28 15:42:25 mpi Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org> @@ -79,6 +79,7 @@ dt_prov_syscall_init(void) free(sysnb, M_DT, len); break; } + dtp->dtp_nargs = sysent[i].sy_narg; dtp->dtp_sysnum = i; dtps_entry[i] = dtp; dt_dev_register_probe(dtp); diff --git a/sys/dev/dt/dtvar.h b/sys/dev/dt/dtvar.h index e62793d584a..9db1276a3fe 100644 --- a/sys/dev/dt/dtvar.h +++ b/sys/dev/dt/dtvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dtvar.h,v 1.2 2020/03/25 14:59:23 mpi Exp $ */ +/* $OpenBSD: dtvar.h,v 1.3 2020/03/28 15:42:25 mpi Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org> @@ -104,7 +104,8 @@ struct dt_filter { struct dtioc_probe_info { - uint32_t dtpi_pbn; /* Probe number */ + uint32_t dtpi_pbn; /* probe number */ + uint8_t dtpi_nargs; /* # of arguments */ char dtpi_prov[DTNAMESIZE]; char dtpi_func[DTNAMESIZE]; char dtpi_name[DTNAMESIZE]; @@ -214,11 +215,11 @@ struct dt_probe { const char *dtp_name; /* [I] probe name */ uint32_t dtp_pbn; /* [I] unique ID */ volatile uint32_t dtp_recording; /* [d] is it recording? */ + uint8_t dtp_nargs; /* [I] # of arguments */ /* Provider specific fields. */ int dtp_sysnum; /* [I] related # of syscall */ const char *dtp_argtype[5];/* [I] type of arguments */ - int dtp_nargs; /* [I] # of arguments */ }; |