freebsd-nq/sys/netpfil
Mark Johnston 2b82c57e39 pf: Initialize arrays before copying out to userland
A number of pf ioctls populate an array of structures and copy it out.
They have the following structures:
- caller specifies the size of its output buffer
- ioctl handler allocates a kernel buffer of the same size
- ioctl handler populates the buffer, possibly leaving some items
  initialized if the caller provided more space than needed
- ioctl handler copies the entire buffer out to userland

Thus, if more space was provided than is required, we end up copying out
uninitialized kernel memory.  Simply zero the buffer at allocation time
to prevent this.

Reported by:	KMSAN
Reviewed by:	kp
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31313
2021-07-28 10:40:49 -04:00
..
ipfw dummynet: reduce console spam 2021-07-08 20:25:05 +02:00
pf pf: Initialize arrays before copying out to userland 2021-07-28 10:40:49 -04:00