Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jul 2021 12:01:58 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e331b1d19f6b - stable/12 - pf: assert that sizeof(struct pf_state) <= 312
Message-ID:  <202107051201.165C1wp4054644@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mjg:

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

commit e331b1d19f6bc28b1e64758357f4a408f058a8a6
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-06-28 12:49:40 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-07-05 11:37:56 +0000

    pf: assert that sizeof(struct pf_state) <= 312
    
    To prevent accidentally going over a threshold which makes UMA fit only
    12 objects per page instead of 13.
    
    Reviewed by:    kp
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit e6dd0e2e8d4f59275fb576a9ccb9d356d36457bb)
---
 sys/net/pfvar.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index da7a6731150e..7d7e7b20ab6f 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -548,6 +548,11 @@ struct pf_state {
 	u_int8_t		 sync_updates;
 	u_int8_t		_tail[3];
 };
+
+/*
+ * Size <= fits 13 objects per page on LP64. Try to not grow the struct beyond that.
+ */
+_Static_assert(sizeof(struct pf_state) <= 312, "pf_state size crosses 312 bytes");
 #endif
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107051201.165C1wp4054644>