git: 5a7d63129a67 - stable/13 - pf: Avoid leaking pad bytes in struct pfr_astats when copying out

Mark Johnston markj at FreeBSD.org
Tue Jun 8 13:38:02 UTC 2021


The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=5a7d63129a67ab5b343ef3054fa1ac4122218506

commit 5a7d63129a67ab5b343ef3054fa1ac4122218506
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-06-01 14:56:23 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-06-08 13:27:07 +0000

    pf: Avoid leaking pad bytes in struct pfr_astats when copying out
    
    There is padding between pfr_astats.pfras_a and pfras_packets that was
    not getting initialized.
    
    Reported by:    KMSAN
    Reviewed by:    kp, imp
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 60a38abb8982e11ee71559057dd7128bd097043e)
---
 sys/netpfil/pf/pf_table.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c
index af2f614c9e8c..f643790ff620 100644
--- a/sys/netpfil/pf/pf_table.c
+++ b/sys/netpfil/pf/pf_table.c
@@ -1028,6 +1028,7 @@ pfr_copyout_astats(struct pfr_astats *as, const struct pfr_kentry *ke,
 	int dir, op;
 	const struct pfr_kcounters *kc = &ke->pfrke_counters;
 
+	bzero(as, sizeof(*as));
 	pfr_copyout_addr(&as->pfras_a, ke);
 	as->pfras_tzero = kc->pfrkc_tzero;
 


More information about the dev-commits-src-all mailing list