HomeFreeBSD

netlink: Zero-initialize mbuf messages

Description

netlink: Zero-initialize mbuf messages

Some users of nlmsg_reserve_object() and nlmsg_reserve_data() are not
careful to fully initialize pad and reserved fields, allowing
uninitialized bytes to leak to userspace. For example, dump_nhgrp()
doesn't set nhm->resvd = 0.

Meanwhile, nlmsg_get_ns_buf() and nlmsg_get_ns_lbuf() zero-initialize
the buffer, so nlmsg_get_ns_mbuf() is inconsistent. Let's just make
them all behave the same here.

Reported by: KMSAN
Reviewed by: melifaro
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38098

(cherry picked from commit d91be0f1211b0196a0087cdfa237a6a0d2a43b65)

Details

Provenance
markjAuthored on Jan 17 2023, 2:36 PM
melifaroCommitted on Feb 18 2023, 11:53 AM
Reviewer
melifaro
Differential Revision
D38098: netlink: Zero-initialize mbuf messages
Parents
rG1ab869503314: usb: Remove unused member in struct mos_softc
Branches
Unknown
Tags
Unknown