123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #include <linux/mm.h>
- #include <linux/slab.h>
- #include <linux/string.h>
- #include <linux/vmalloc.h>
- #include "include/audit.h"
- #include "include/apparmor.h"
- char *aa_split_fqname(char *fqname, char **ns_name)
- {
- char *name = strim(fqname);
- *ns_name = NULL;
- if (name[0] == ':') {
- char *split = strchr(&name[1], ':');
- *ns_name = skip_spaces(&name[1]);
- if (split) {
-
- *split++ = 0;
- if (strncmp(split, "//", 2) == 0)
- split += 2;
- name = skip_spaces(split);
- } else
-
- name = NULL;
- }
- if (name && *name == 0)
- name = NULL;
- return name;
- }
- void aa_info_message(const char *str)
- {
- if (audit_enabled) {
- struct common_audit_data sa;
- struct apparmor_audit_data aad = {0,};
- sa.type = LSM_AUDIT_DATA_NONE;
- sa.aad = &aad;
- aad.info = str;
- aa_audit_msg(AUDIT_APPARMOR_STATUS, &sa, NULL);
- }
- printk(KERN_INFO "AppArmor: %s\n", str);
- }
- void *__aa_kvmalloc(size_t size, gfp_t flags)
- {
- void *buffer = NULL;
- if (size == 0)
- return NULL;
-
- if (size <= (16*PAGE_SIZE))
- buffer = kmalloc(size, flags | GFP_NOIO | __GFP_NOWARN);
- if (!buffer) {
- if (flags & __GFP_ZERO)
- buffer = vzalloc(size);
- else
- buffer = vmalloc(size);
- }
- return buffer;
- }
|