All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] audit: compact name entries and context fields
@ 2026-11-06 15:03 Christian Göttsche
  2026-11-06 15:03 ` [PATCH v2 2/3] audit: return the collected entry from __audit_inode() Christian Göttsche
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christian Göttsche @ 2026-11-06 15:03 UTC (permalink / raw)
  To: audit; +Cc: Paul Moore, Eric Paris, Christian Göttsche

From: Christian Göttsche <cgzones@googlemail.com>

Group the inode metadata and the small scalar fields of audit_names to
remove padding, while keeping the pathname next to its length and the
file capability revision next to the file capabilities. Store the
per-name file capability revision in s16: it must represent both the
eight-bit on-disk revision and the -1 AUDIT_INODE_NOEVAL sentinel. Keep
the existing formatter and its unknown-capability output unchanged.

Move name_count ahead of the embedded name slots to remove two alignment
holes, and place personality before the task credential scalars.
Preserve the first int dummy member required by audit_dummy_context(),
all five embedded name slots, and the existing allocation and reference
lifetimes.

On x86_64 with SELinux this reduces audit_context from 928 to 880 bytes,
leaving room for descriptor paths while staying below 1 KiB. On the tested
arm64 configuration without property-bearing LSMs it falls to 872 bytes.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
v2:
- keep name next to name_len and fcap_ver next to fcap
- move name_count below the names_list comment
---
 kernel/audit.h | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/kernel/audit.h b/kernel/audit.h
index 7640d2c0fba4..614afa1cfa14 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -77,17 +77,14 @@ struct audit_names {
 
 	struct filename		*name;
 	int			name_len;	/* number of chars to log */
-	bool			hidden;		/* don't log this record */
-
-	u64			ino;
 	dev_t			dev;
-	umode_t			mode;
+	u64			ino;
 	kuid_t			uid;
 	kgid_t			gid;
 	dev_t			rdev;
 	struct lsm_prop		oprop;
-	struct audit_file_caps	fcap;
-	unsigned int		fcap_ver;
+	umode_t			mode;
+	bool			hidden;		/* don't log this record */
 	unsigned char		type;		/* record type */
 	/*
 	 * This was an allocated audit_names and not from the array of
@@ -95,6 +92,8 @@ struct audit_names {
 	 * should be freed on syscall exit.
 	 */
 	bool			should_free;
+	s16			fcap_ver;	/* 8-bit revision, or -1 for NOEVAL */
+	struct audit_file_caps	fcap;
 };
 
 struct audit_proctitle {
@@ -132,8 +131,8 @@ struct audit_context {
 	 * through the preallocated_names array and should only be found/used
 	 * by running the names_list.
 	 */
-	struct audit_names  preallocated_names[AUDIT_NAMES];
 	int		    name_count; /* total records in names_list */
+	struct audit_names  preallocated_names[AUDIT_NAMES];
 	struct list_head    names_list;	/* struct audit_names->list anchor */
 	char		    *filterkey;	/* key for rule that triggered record */
 	struct path	    pwd;
@@ -142,10 +141,10 @@ struct audit_context {
 	struct sockaddr_storage *sockaddr;
 	size_t sockaddr_len;
 	/* Save things to print about task_struct */
+	unsigned long	    personality;
 	pid_t		    ppid;
 	kuid_t		    uid, euid, suid, fsuid;
 	kgid_t		    gid, egid, sgid, fsgid;
-	unsigned long	    personality;
 	int		    arch;
 
 	pid_t		    target_pid;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-06 15:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 15:03 [PATCH v2 1/3] audit: compact name entries and context fields Christian Göttsche
2026-11-06 15:03 ` [PATCH v2 2/3] audit: return the collected entry from __audit_inode() Christian Göttsche
2026-11-06 15:07   ` sashiko-bot
2026-11-06 15:03 ` [PATCH v2 3/3] audit: retain file paths for descriptor PATH records Christian Göttsche
2026-11-06 15:12   ` sashiko-bot
2026-11-06 15:09 ` [PATCH v2 1/3] audit: compact name entries and context fields sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.