Path: blob/master/security/apparmor/include/apparmor.h
10817 views
/*1* AppArmor security module2*3* This file contains AppArmor basic global and lib definitions4*5* Copyright (C) 1998-2008 Novell/SUSE6* Copyright 2009-2010 Canonical Ltd.7*8* This program is free software; you can redistribute it and/or9* modify it under the terms of the GNU General Public License as10* published by the Free Software Foundation, version 2 of the11* License.12*/1314#ifndef __APPARMOR_H15#define __APPARMOR_H1617#include <linux/fs.h>1819#include "match.h"2021/* Control parameters settable through module/boot flags */22extern enum audit_mode aa_g_audit;23extern int aa_g_audit_header;24extern int aa_g_debug;25extern int aa_g_lock_policy;26extern int aa_g_logsyscall;27extern int aa_g_paranoid_load;28extern unsigned int aa_g_path_max;2930/*31* DEBUG remains global (no per profile flag) since it is mostly used in sysctl32* which is not related to profile accesses.33*/3435#define AA_DEBUG(fmt, args...) \36do { \37if (aa_g_debug && printk_ratelimit()) \38printk(KERN_DEBUG "AppArmor: " fmt, ##args); \39} while (0)4041#define AA_ERROR(fmt, args...) \42do { \43if (printk_ratelimit()) \44printk(KERN_ERR "AppArmor: " fmt, ##args); \45} while (0)4647/* Flag indicating whether initialization completed */48extern int apparmor_initialized __initdata;4950/* fn's in lib */51char *aa_split_fqname(char *args, char **ns_name);52void aa_info_message(const char *str);53void *kvmalloc(size_t size);54void kvfree(void *buffer);555657/**58* aa_strneq - compare null terminated @str to a non null terminated substring59* @str: a null terminated string60* @sub: a substring, not necessarily null terminated61* @len: length of @sub to compare62*63* The @str string must be full consumed for this to be considered a match64*/65static inline bool aa_strneq(const char *str, const char *sub, int len)66{67return !strncmp(str, sub, len) && !str[len];68}6970/**71* aa_dfa_null_transition - step to next state after null character72* @dfa: the dfa to match against73* @start: the state of the dfa to start matching in74*75* aa_dfa_null_transition transitions to the next state after a null76* character which is not used in standard matching and is only77* used to separate pairs.78*/79static inline unsigned int aa_dfa_null_transition(struct aa_dfa *dfa,80unsigned int start)81{82/* the null transition only needs the string's null terminator byte */83return aa_dfa_match_len(dfa, start, "", 1);84}8586static inline bool mediated_filesystem(struct inode *inode)87{88return !(inode->i_sb->s_flags & MS_NOUSER);89}9091#endif /* __APPARMOR_H */929394