提交 671a2781 编写于 作者: J Jeff Vander Stoep 提交者: Paul Moore

security: add ioctl specific auditing to lsm_audit

Add information about ioctl calls to the LSM audit data. Log the
file path and command number.
Signed-off-by: NJeff Vander Stoep <jeffv@google.com>
Acked-by: NNick Kralevich <nnk@google.com>
[PM: subject line tweak]
Signed-off-by: NPaul Moore <pmoore@redhat.com>
上级 892e8cac
...@@ -40,6 +40,11 @@ struct lsm_network_audit { ...@@ -40,6 +40,11 @@ struct lsm_network_audit {
} fam; } fam;
}; };
struct lsm_ioctlop_audit {
struct path path;
u16 cmd;
};
/* Auxiliary data to use in generating the audit record. */ /* Auxiliary data to use in generating the audit record. */
struct common_audit_data { struct common_audit_data {
char type; char type;
...@@ -53,6 +58,7 @@ struct common_audit_data { ...@@ -53,6 +58,7 @@ struct common_audit_data {
#define LSM_AUDIT_DATA_KMOD 8 #define LSM_AUDIT_DATA_KMOD 8
#define LSM_AUDIT_DATA_INODE 9 #define LSM_AUDIT_DATA_INODE 9
#define LSM_AUDIT_DATA_DENTRY 10 #define LSM_AUDIT_DATA_DENTRY 10
#define LSM_AUDIT_DATA_IOCTL_OP 11
union { union {
struct path path; struct path path;
struct dentry *dentry; struct dentry *dentry;
...@@ -68,6 +74,7 @@ struct common_audit_data { ...@@ -68,6 +74,7 @@ struct common_audit_data {
} key_struct; } key_struct;
#endif #endif
char *kmod_name; char *kmod_name;
struct lsm_ioctlop_audit *op;
} u; } u;
/* this union contains LSM specific data */ /* this union contains LSM specific data */
union { union {
......
...@@ -245,6 +245,21 @@ static void dump_common_audit_data(struct audit_buffer *ab, ...@@ -245,6 +245,21 @@ static void dump_common_audit_data(struct audit_buffer *ab,
} }
break; break;
} }
case LSM_AUDIT_DATA_IOCTL_OP: {
struct inode *inode;
audit_log_d_path(ab, " path=", &a->u.op->path);
inode = a->u.op->path.dentry->d_inode;
if (inode) {
audit_log_format(ab, " dev=");
audit_log_untrustedstring(ab, inode->i_sb->s_id);
audit_log_format(ab, " ino=%lu", inode->i_ino);
}
audit_log_format(ab, " ioctlcmd=%hx", a->u.op->cmd);
break;
}
case LSM_AUDIT_DATA_DENTRY: { case LSM_AUDIT_DATA_DENTRY: {
struct inode *inode; struct inode *inode;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册