HomeFreeBSD

rtsock: fix panic in rtsock_msg_buffer()

Description

rtsock: fix panic in rtsock_msg_buffer()

The rtsock_msg_buffer() can be called without walkarg, just to calculate
required length. It can also be called with a degenerate walkarg, that
doesn't have a w_req. The latter happens when the function is called from
update_rtm_from_info() for the second time.

Zero init walkarg in update_rtm_from_info() and don't pass random stack
garbage as w_req.

In rtsock_msg_buffer() initialize compat32 boolean only once and take of
possible empty w_req. Simplify the rest of code once compat32 is already
set.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D47662
Reported-by: syzbot+d4a2682059e23179e76e@syzkaller.appspotmail.com
Reported-by: syzbot+66d7c9b3062e27a56f3f@syzkaller.appspotmail.com

Details

Provenance
glebiusAuthored on Nov 18 2024, 10:12 PM
Reviewer
melifaro
Differential Revision
D47662: rtsock: fix panic in rtsock_msg_buffer()
Parents
rG43e045c1733d: atf: Guard libexec/atf with WITH_TESTS_SUPPORT
Branches
Unknown
Tags
Unknown