git: a6398c245128 - stable/15 - MAC/do: Comment to explain the main invariant for configurations

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Mon, 29 Jun 2026 19:26:01 UTC
The branch stable/15 has been updated by olce:

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

commit a6398c245128cbc5a2b9a98971ea09ef03bb6234
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-04-29 17:11:34 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-06-29 19:23:53 +0000

    MAC/do: Comment to explain the main invariant for configurations
    
    Once visible, configuration structures must *never* change.
    
    Spell that out in a comment to help future readers/contributors
    understand the design.
    
    Reviewed by:    bapt
    MFC after:      1 month
    Sponsored by:   The FreeBSD Foundation
    Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/38
    
    (cherry picked from commit 5bedb5e44757ba83dba9d618f5b951416cf44345)
---
 sys/security/mac_do/mac_do.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c
index 4ba545ec5a19..a175b92c764d 100644
--- a/sys/security/mac_do/mac_do.c
+++ b/sys/security/mac_do/mac_do.c
@@ -212,6 +212,11 @@ struct exec_paths {
 	int exec_path_count;
 };
 
+/*
+ * Once in use, i.e., being pointed to by a jail, a configuration structure MUST
+ * NEVER CHANGE (except for the 'use_count' field).  This invariant is
+ * fundamental to correctness!
+ */
 struct conf {
 	struct rules rules;
 	struct exec_paths exec_paths;