| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * AppArmor security module |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright (C) 1998-2008 Novell/SUSE |
|---|
| 7 | 8 | * Copyright 2009-2010 Canonical Ltd. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or |
|---|
| 10 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 11 | | - * published by the Free Software Foundation, version 2 of the |
|---|
| 12 | | - * License. |
|---|
| 13 | 9 | */ |
|---|
| 14 | 10 | |
|---|
| 15 | 11 | #ifndef __AA_FILE_H |
|---|
| .. | .. |
|---|
| 32 | 28 | AA_MAY_CHMOD | AA_MAY_CHOWN | AA_MAY_LOCK | \ |
|---|
| 33 | 29 | AA_EXEC_MMAP | AA_MAY_LINK) |
|---|
| 34 | 30 | |
|---|
| 35 | | -#define file_ctx(X) ((struct aa_file_ctx *)(X)->f_security) |
|---|
| 31 | +static inline struct aa_file_ctx *file_ctx(struct file *file) |
|---|
| 32 | +{ |
|---|
| 33 | + return file->f_security + apparmor_blob_sizes.lbs_file; |
|---|
| 34 | +} |
|---|
| 36 | 35 | |
|---|
| 37 | 36 | /* struct aa_file_ctx - the AppArmor context the file was opened in |
|---|
| 38 | 37 | * @lock: lock to update the ctx |
|---|
| .. | .. |
|---|
| 73 | 72 | { |
|---|
| 74 | 73 | if (ctx) { |
|---|
| 75 | 74 | aa_put_label(rcu_access_pointer(ctx->label)); |
|---|
| 76 | | - kzfree(ctx); |
|---|
| 75 | + kfree_sensitive(ctx); |
|---|
| 77 | 76 | } |
|---|
| 78 | 77 | } |
|---|
| 79 | 78 | |
|---|
| .. | .. |
|---|
| 198 | 197 | const struct path *new_dir, struct dentry *new_dentry); |
|---|
| 199 | 198 | |
|---|
| 200 | 199 | int aa_file_perm(const char *op, struct aa_label *label, struct file *file, |
|---|
| 201 | | - u32 request); |
|---|
| 200 | + u32 request, bool in_atomic); |
|---|
| 202 | 201 | |
|---|
| 203 | 202 | void aa_inherit_files(const struct cred *cred, struct files_struct *files); |
|---|
| 204 | 203 | |
|---|