Page MenuHomeFreeBSD

pfilctl: initialize pio_nheads for PFILIOC_LISTHEADS ioctl
Needs ReviewPublic

Authored by rew on Apr 24 2022, 6:17 PM.
Tags
None
Referenced Files
F153232510: D35044.id105370.diff
Sun, Apr 19, 11:25 PM
Unknown Object (File)
Sat, Apr 18, 10:33 PM
Unknown Object (File)
Tue, Apr 7, 3:21 AM
Unknown Object (File)
Tue, Apr 7, 2:00 AM
Unknown Object (File)
Sun, Apr 5, 6:11 PM
Unknown Object (File)
Sun, Apr 5, 4:41 AM
Unknown Object (File)
Sat, Mar 21, 12:48 PM
Unknown Object (File)
Jan 8 2026, 12:21 PM
Subscribers

Details

Reviewers
glebius
Summary

When pfilctl hooks is called with no hooks present:

% pfilctl hooks
pfilctl: ioctl(PFILIOC_LISTHEADS): Bad address

If pio_nheads or pio_nhooks is not initialized, pfilioc_listheads()
thinks the caller wants the heads/hooks copied out. However, in this
case, the caller is only expecting the number of heads/hooks returned
and hasn't prepared the buffer that pfilioc_listheads() is trying to
copyout to, causing the bad address error.

Looking at pfilioc_listheads() in sys/net/pfil.c, should the semantics
be to return the number of heads/hooks when either pio_nheads or
pio_nhooks is zero?

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45343
Build 42231: arc lint + arc unit