mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-20 02:18:05 +07:00
[PATCH] inline more audit helpers
pull checks for ->audit_context into inlined wrappers Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
e018290929
commit
d8945bb51a
@ -301,11 +301,16 @@ extern void audit_syscall_entry(int arch,
|
|||||||
int major, unsigned long a0, unsigned long a1,
|
int major, unsigned long a0, unsigned long a1,
|
||||||
unsigned long a2, unsigned long a3);
|
unsigned long a2, unsigned long a3);
|
||||||
extern void audit_syscall_exit(int failed, long return_code);
|
extern void audit_syscall_exit(int failed, long return_code);
|
||||||
extern void audit_getname(const char *name);
|
extern void __audit_getname(const char *name);
|
||||||
extern void audit_putname(const char *name);
|
extern void audit_putname(const char *name);
|
||||||
extern void __audit_inode(const char *name, const struct inode *inode, unsigned flags);
|
extern void __audit_inode(const char *name, const struct inode *inode, unsigned flags);
|
||||||
extern void __audit_inode_child(const char *dname, const struct inode *inode,
|
extern void __audit_inode_child(const char *dname, const struct inode *inode,
|
||||||
unsigned long pino);
|
unsigned long pino);
|
||||||
|
static inline void audit_getname(const char *name)
|
||||||
|
{
|
||||||
|
if (unlikely(current->audit_context))
|
||||||
|
__audit_getname(name);
|
||||||
|
}
|
||||||
static inline void audit_inode(const char *name, const struct inode *inode,
|
static inline void audit_inode(const char *name, const struct inode *inode,
|
||||||
unsigned flags) {
|
unsigned flags) {
|
||||||
if (unlikely(current->audit_context))
|
if (unlikely(current->audit_context))
|
||||||
@ -324,13 +329,26 @@ extern void auditsc_get_stamp(struct audit_context *ctx,
|
|||||||
struct timespec *t, unsigned int *serial);
|
struct timespec *t, unsigned int *serial);
|
||||||
extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
|
extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
|
||||||
extern uid_t audit_get_loginuid(struct audit_context *ctx);
|
extern uid_t audit_get_loginuid(struct audit_context *ctx);
|
||||||
extern int audit_ipc_obj(struct kern_ipc_perm *ipcp);
|
extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp);
|
||||||
extern int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
|
extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
|
||||||
extern int audit_bprm(struct linux_binprm *bprm);
|
extern int audit_bprm(struct linux_binprm *bprm);
|
||||||
extern int audit_socketcall(int nargs, unsigned long *args);
|
extern int audit_socketcall(int nargs, unsigned long *args);
|
||||||
extern int audit_sockaddr(int len, void *addr);
|
extern int audit_sockaddr(int len, void *addr);
|
||||||
extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt);
|
extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt);
|
||||||
extern int audit_set_macxattr(const char *name);
|
extern int audit_set_macxattr(const char *name);
|
||||||
|
|
||||||
|
static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
|
||||||
|
{
|
||||||
|
if (unlikely(current->audit_context))
|
||||||
|
return __audit_ipc_obj(ipcp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
|
||||||
|
{
|
||||||
|
if (unlikely(current->audit_context))
|
||||||
|
return __audit_ipc_set_perm(qbytes, uid, gid, mode);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#define audit_alloc(t) ({ 0; })
|
#define audit_alloc(t) ({ 0; })
|
||||||
#define audit_free(t) do { ; } while (0)
|
#define audit_free(t) do { ; } while (0)
|
||||||
|
@ -922,11 +922,11 @@ void audit_syscall_exit(int valid, long return_code)
|
|||||||
* Add a name to the list of audit names for this context.
|
* Add a name to the list of audit names for this context.
|
||||||
* Called from fs/namei.c:getname().
|
* Called from fs/namei.c:getname().
|
||||||
*/
|
*/
|
||||||
void audit_getname(const char *name)
|
void __audit_getname(const char *name)
|
||||||
{
|
{
|
||||||
struct audit_context *context = current->audit_context;
|
struct audit_context *context = current->audit_context;
|
||||||
|
|
||||||
if (!context || IS_ERR(name) || !name)
|
if (IS_ERR(name) || !name)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!context->in_syscall) {
|
if (!context->in_syscall) {
|
||||||
@ -1189,14 +1189,11 @@ uid_t audit_get_loginuid(struct audit_context *ctx)
|
|||||||
*
|
*
|
||||||
* Returns 0 for success or NULL context or < 0 on error.
|
* Returns 0 for success or NULL context or < 0 on error.
|
||||||
*/
|
*/
|
||||||
int audit_ipc_obj(struct kern_ipc_perm *ipcp)
|
int __audit_ipc_obj(struct kern_ipc_perm *ipcp)
|
||||||
{
|
{
|
||||||
struct audit_aux_data_ipcctl *ax;
|
struct audit_aux_data_ipcctl *ax;
|
||||||
struct audit_context *context = current->audit_context;
|
struct audit_context *context = current->audit_context;
|
||||||
|
|
||||||
if (likely(!context))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ax = kmalloc(sizeof(*ax), GFP_ATOMIC);
|
ax = kmalloc(sizeof(*ax), GFP_ATOMIC);
|
||||||
if (!ax)
|
if (!ax)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -1221,14 +1218,11 @@ int audit_ipc_obj(struct kern_ipc_perm *ipcp)
|
|||||||
*
|
*
|
||||||
* Returns 0 for success or NULL context or < 0 on error.
|
* Returns 0 for success or NULL context or < 0 on error.
|
||||||
*/
|
*/
|
||||||
int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
|
int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
|
||||||
{
|
{
|
||||||
struct audit_aux_data_ipcctl *ax;
|
struct audit_aux_data_ipcctl *ax;
|
||||||
struct audit_context *context = current->audit_context;
|
struct audit_context *context = current->audit_context;
|
||||||
|
|
||||||
if (likely(!context))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ax = kmalloc(sizeof(*ax), GFP_ATOMIC);
|
ax = kmalloc(sizeof(*ax), GFP_ATOMIC);
|
||||||
if (!ax)
|
if (!ax)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user