/* SPDX-License-Identifier: GPL-2.0-or-later */ /* audit -- definition of audit_context structure and supporting types * * Copyright 2003-2004 Red Hat, Inc. * Copyright 2005 Hewlett-Packard Development Company, L.P. * Copyright 2005 IBM Corporation
*/
/* AUDIT_NAMES is the number of slots we reserve in the audit_context * for saving names from getname(). If we get more names we will allocate
* a name dynamically and also add those to the list anchored by names_list. */ #define AUDIT_NAMES 5
/* At task start time, the audit_state is set in the audit_context using a per-task filter. At syscall entry, the audit_state is augmented by
the syscall filter. */ enum audit_state {
AUDIT_STATE_DISABLED, /* Do not create per-task audit_context. * No syscall-specific audit records can
* be generated. */
AUDIT_STATE_BUILD, /* Create the per-task audit_context, * and fill it in at syscall * entry time. This makes a full * syscall record available if some * other part of the kernel decides it
* should be recorded. */
AUDIT_STATE_RECORD /* Create the per-task audit_context, * always fill it in at syscall entry * time, and always write out the audit
* record at syscall exit time. */
};
struct audit_cap_data {
kernel_cap_t permitted;
kernel_cap_t inheritable; union { unsignedint fE; /* effective bit of file cap */
kernel_cap_t effective; /* effective set of process */
};
kernel_cap_t ambient;
kuid_t rootid;
};
/* When fs/namei.c:getname() is called, we store the pointer in name and bump * the refcnt in the associated filename struct. * * Further, in fs/namei.c:path_lookup() we store the inode and device.
*/ struct audit_names { struct list_head list; /* audit_context->names_list */
struct filename *name; int name_len; /* number of chars to log */ bool hidden; /* don't log this record */
unsignedlong ino;
dev_t dev;
umode_t mode;
kuid_t uid;
kgid_t gid;
dev_t rdev; struct lsm_prop oprop; struct audit_cap_data fcap; unsignedint fcap_ver; unsignedchar type; /* record type */ /* * This was an allocated audit_names and not from the array of * names allocated in the task audit context. Thus this name * should be freed on syscall exit.
*/ bool should_free;
};
struct audit_proctitle { int len; /* length of the cmdline field. */ char *value; /* the cmdline field */
};
/* The per-task audit context. */ struct audit_context { int dummy; /* must be the first element */ enum {
AUDIT_CTX_UNUSED, /* audit_context is currently unused */
AUDIT_CTX_SYSCALL, /* in use by syscall */
AUDIT_CTX_URING, /* in use by io_uring */
} context; enum audit_state state, current_state; unsignedint serial; /* serial number for record */ int major; /* syscall number */ int uring_op; /* uring operation */ struct timespec64 ctime; /* time of syscall entry */ unsignedlong argv[4]; /* syscall arguments */ long return_code;/* syscall return code */
u64 prio; int return_valid; /* return code is valid */ /* * The names_list is the list of all audit_names collected during this * syscall. The first AUDIT_NAMES entries in the names_list will * actually be from the preallocated_names array for performance * reasons. Except during allocation they should never be referenced * 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 list_head names_list; /* struct audit_names->list anchor */ char *filterkey; /* key for rule that triggered record */ struct path pwd; struct audit_aux_data *aux; struct audit_aux_data *aux_pids; struct sockaddr_storage *sockaddr;
size_t sockaddr_len; /* Save things to print about task_struct */
pid_t ppid;
kuid_t uid, euid, suid, fsuid;
kgid_t gid, egid, sgid, fsgid; unsignedlong personality; int arch;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.