mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-10 11:01:33 -04:00
A number of functions take a struct aa_profile * argument that is only
ever read from: they compute DFA matches or apply the profile's mode
flags without modifying the profile, taking a reference on it, or
touching its embedded label. Mark those parameters const struct
aa_profile * to document intent and let the compiler enforce it.
The converted functions are the permission "compute" path plus a few
pure readers:
- aa_apply_modes_to_perms(), aa_profile_match_label()
- AUDIT_MODE()
- aa_label_match() and its match_component()/label_compound_match()/
label_components_match() helpers (label.c)
- match_component()/label_compound_match()/label_components_match()/
label_match()/change_profile_perms()/aa_xattrs_match() (domain.c)
- match_iface()/match_addr_iface()/match_addr_iface_label()/
skb_match_to_sk()/skb_match_to_cmd() (af_inet.c)
- aa_profile_capget(), path_flags(), profile_query_cb()
The remaining aa_profile * parameters cannot be made const: the audit
path stores &profile->label into the owned, refcounted
apparmor_audit_data.subj_label/peer fields, and the domain/lifecycle
paths take references on the profile's embedded label
(aa_get_label()/aa_get_newest_label()/aa_get_profile()) or write
profile fields.
No functional change.
Signed-off-by: John Johansen <john.johansen@canonical.com>
Assisted-by: Claude:claude-opus-4.8
50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* AppArmor security module
|
|
*
|
|
* This file contains AppArmor capability mediation definitions.
|
|
*
|
|
* Copyright (C) 1998-2008 Novell/SUSE
|
|
* Copyright 2009-2013 Canonical Ltd.
|
|
*/
|
|
|
|
#ifndef __AA_CAPABILITY_H
|
|
#define __AA_CAPABILITY_H
|
|
|
|
#include <linux/capability.h>
|
|
#include <linux/sched.h>
|
|
|
|
#include "apparmorfs.h"
|
|
|
|
struct aa_label;
|
|
|
|
/* aa_caps - confinement data for capabilities
|
|
* @allowed: capabilities mask
|
|
* @audit: caps that are to be audited
|
|
* @denied: caps that are explicitly denied
|
|
* @quiet: caps that should not be audited
|
|
* @kill: caps that when requested will result in the task being killed
|
|
* @extended: caps that are subject finer grained mediation
|
|
*/
|
|
struct aa_caps {
|
|
kernel_cap_t allow;
|
|
kernel_cap_t audit;
|
|
kernel_cap_t denied;
|
|
kernel_cap_t quiet;
|
|
kernel_cap_t kill;
|
|
kernel_cap_t extended;
|
|
};
|
|
|
|
extern struct aa_sfs_entry aa_sfs_entry_caps[];
|
|
|
|
kernel_cap_t aa_profile_capget(const struct aa_profile *profile);
|
|
int aa_capable(const struct cred *subj_cred, struct aa_label *label,
|
|
int cap, unsigned int opts);
|
|
|
|
static inline void aa_free_cap_rules(struct aa_caps *caps)
|
|
{
|
|
/* NOP */
|
|
}
|
|
|
|
#endif /* __AA_CAPBILITY_H */
|