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

Details

Provenance
markjAuthored on Jan 17 2023, 2:36 PM
Reviewer
melifaro
Differential Revision
D38098: netlink: Zero-initialize mbuf messages
Parents
rGe5f5ca7fee26: mixer(3): remove redundant argument in _mixer_readvol()
Branches
Unknown
Tags
Unknown