kmsan: Add kmsan_check_uio()

This was handy for some ad-hoc debugging and fits in with other
kmsan_check_*() routines which operate on some kind of data container.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2023-12-06 11:31:15 -05:00
parent 6b96125afd
commit be5464ae23
4 changed files with 17 additions and 1 deletions

View file

@ -1370,6 +1370,7 @@ MLINKS+=kmsan.9 KMSAN.9 \
kmsan.9 kmsan_check_bio.9 \
kmsan.9 kmsan_check_ccb.9 \
kmsan.9 kmsan_check_mbuf.9 \
kmsan.9 kmsan_check_uio.9 \
kmsan.9 kmsan_mark.9 \
kmsan.9 kmsan_oirg.9
MLINKS+=kobj.9 DEFINE_CLASS.9 \

View file

@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd October 13, 2023
.Dd December 6, 2023
.Dt KMSAN 9
.Os
.Sh NAME
@ -56,6 +56,8 @@ kernel configuration file:
.Fn kmsan_check_ccb "const union ccb *" "const char *descr"
.Ft void
.Fn kmsan_check_mbuf "const struct mbuf *" "const char *descr"
.Ft void
.Fn kmsan_check_uio "const struct uio *" "const char *descr"
.Sh DESCRIPTION
.Nm
is a subsystem which leverages compiler instrumentation to detect uses of
@ -306,6 +308,7 @@ f(size_t osz)
.Xr busdma 9 ,
.Xr copyout 9 ,
.Xr KASAN 9 ,
.Xr uio 9 ,
.Xr uma 9
.Rs
.%A Evgeniy Stepanov

View file

@ -587,6 +587,15 @@ kmsan_check_mbuf(const struct mbuf *m, const char *descr)
} while ((m = m->m_next) != NULL);
}
void
kmsan_check_uio(const struct uio *uio, const char *descr)
{
for (int i = 0; i < uio->uio_iovcnt; i++) {
kmsan_check(uio->uio_iov[i].iov_base, uio->uio_iov[i].iov_len,
descr);
}
}
void
kmsan_init(void)
{

View file

@ -50,6 +50,7 @@ union ccb;
struct bio;
struct mbuf;
struct memdesc;
struct uio;
void kmsan_init(void);
@ -69,6 +70,7 @@ void kmsan_check(const void *, size_t, const char *);
void kmsan_check_bio(const struct bio *, const char *);
void kmsan_check_ccb(const union ccb *, const char *);
void kmsan_check_mbuf(const struct mbuf *, const char *);
void kmsan_check_uio(const struct uio *, const char *);
#else
#define kmsan_init(u)
@ -85,6 +87,7 @@ void kmsan_check_mbuf(const struct mbuf *, const char *);
#define kmsan_check_bio(b, d)
#define kmsan_check_ccb(c, d)
#define kmsan_check_mbuf(m, d)
#define kmsan_check_uio(u, d)
#define kmsan_bus_dmamap_sync(d, op)
#endif