forked from Minki/linux
audit/stable-5.5 PR 20191126
-----BEGIN PGP SIGNATURE----- iQJIBAABCAAyFiEES0KozwfymdVUl37v6iDy2pc3iXMFAl3dbM4UHHBhdWxAcGF1 bC1tb29yZS5jb20ACgkQ6iDy2pc3iXMagw/+MiOlIHFykjK0NGOyUbXR7AwjdrHz 1Fgkh7VZCAHMfCcdlljIIkYe7P+ybfdK51E1QLBiTPGh353JJRAvrjFbDcIyT4kf u7AVddUeT0QQefFs39ZFWTV0mvJjDBfjFkmiL3cdY9ulx4ZX8V426qjyl8KIwTHe YkQF3pYMmO28G1SfZu298zTmrFRA10FezxCUbBRZTTE9FcD7mnGQRB7w/wY9t0H1 ebIDgDA0EBh3oznGD3qxD63b5ULdSrImTzvSmEfhzZZsoZB4XGO5MOnLRqgBwFbT qfRSRfHVl+1JtDHCU43zOUlzScAsff5mvfVNdDMLAFtGGSjDGxgxKNyLwp8+5wmH GzvB99QQECvCN+gbaedm6adWBGzi7vpoCcgfqY0UPLYvCqsNFbZw4U/iu5ONKWy/ cEGVUGzHf0pWofugDIJfGQuRt6iS2XT9Ode6+QMx8OiC3auZcluhTuJSxMQIhFZ1 5XmoHOQddBwlalmIx8fsIHSo6xsAjNFwTOikEFVzUB+ECR2Urs8eHvQj+d94xz6e q9LrNkt/eVIDiI+PeP+UBD5IJlfmRSoyUd/mIDFMfmqMBubBSQl70Eyt3dUdt1Bz 0PBs6xjYztpgk3Q7s35TMn8EvDcEksG0WEoFM5fEohYPLWQf8tJ5BbyYJJqc0sod ExlXu1lPfg9ppKc= =fc7R -----END PGP SIGNATURE----- Merge tag 'audit-pr-20191126' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit Pull audit updates from Paul Moore: "Audit is back for v5.5, albeit with only two patches: - Allow for the auditing of suspicious O_CREAT usage via the new AUDIT_ANOM_CREAT record. - Remove a redundant if-conditional check found during code analysis. It's a minor change, but when the pull request is only two patches long, you need filler in the pull request email" [ Heh on the pull request filler. I wish more people tried to write better pull request messages, even if maybe it's not worth it for the trivial cases ;^) - Linus ] * tag 'audit-pr-20191126' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit: audit: remove redundant condition check in kauditd_thread() audit: Report suspicious O_CREAT usage
This commit is contained in:
commit
3b805ca177
@ -925,7 +925,7 @@ static inline int may_follow_link(struct nameidata *nd)
|
||||
return -ECHILD;
|
||||
|
||||
audit_inode(nd->name, nd->stack[0].link.dentry, 0);
|
||||
audit_log_link_denied("follow_link");
|
||||
audit_log_path_denied(AUDIT_ANOM_LINK, "follow_link");
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
@ -993,7 +993,7 @@ static int may_linkat(struct path *link)
|
||||
if (safe_hardlink_source(inode) || inode_owner_or_capable(inode))
|
||||
return 0;
|
||||
|
||||
audit_log_link_denied("linkat");
|
||||
audit_log_path_denied(AUDIT_ANOM_LINK, "linkat");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
@ -1031,6 +1031,10 @@ static int may_create_in_sticky(struct dentry * const dir,
|
||||
(dir->d_inode->i_mode & 0020 &&
|
||||
((sysctl_protected_fifos >= 2 && S_ISFIFO(inode->i_mode)) ||
|
||||
(sysctl_protected_regular >= 2 && S_ISREG(inode->i_mode))))) {
|
||||
const char *operation = S_ISFIFO(inode->i_mode) ?
|
||||
"sticky_create_fifo" :
|
||||
"sticky_create_regular";
|
||||
audit_log_path_denied(AUDIT_ANOM_CREAT, operation);
|
||||
return -EACCES;
|
||||
}
|
||||
return 0;
|
||||
|
@ -156,7 +156,8 @@ extern void audit_log_d_path(struct audit_buffer *ab,
|
||||
const struct path *path);
|
||||
extern void audit_log_key(struct audit_buffer *ab,
|
||||
char *key);
|
||||
extern void audit_log_link_denied(const char *operation);
|
||||
extern void audit_log_path_denied(int type,
|
||||
const char *operation);
|
||||
extern void audit_log_lost(const char *message);
|
||||
|
||||
extern int audit_log_task_context(struct audit_buffer *ab);
|
||||
@ -217,7 +218,7 @@ static inline void audit_log_d_path(struct audit_buffer *ab,
|
||||
{ }
|
||||
static inline void audit_log_key(struct audit_buffer *ab, char *key)
|
||||
{ }
|
||||
static inline void audit_log_link_denied(const char *string)
|
||||
static inline void audit_log_path_denied(int type, const char *operation)
|
||||
{ }
|
||||
static inline int audit_log_task_context(struct audit_buffer *ab)
|
||||
{
|
||||
|
@ -143,6 +143,7 @@
|
||||
#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */
|
||||
#define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */
|
||||
#define AUDIT_ANOM_LINK 1702 /* Suspicious use of file links */
|
||||
#define AUDIT_ANOM_CREAT 1703 /* Suspicious file creation */
|
||||
#define AUDIT_INTEGRITY_DATA 1800 /* Data integrity verification */
|
||||
#define AUDIT_INTEGRITY_METADATA 1801 /* Metadata integrity verification */
|
||||
#define AUDIT_INTEGRITY_STATUS 1802 /* Integrity enable status */
|
||||
|
@ -830,7 +830,7 @@ static int kauditd_thread(void *dummy)
|
||||
rc = kauditd_send_queue(sk, portid,
|
||||
&audit_hold_queue, UNICAST_RETRIES,
|
||||
NULL, kauditd_rehold_skb);
|
||||
if (ac && rc < 0) {
|
||||
if (rc < 0) {
|
||||
sk = NULL;
|
||||
auditd_reset(ac);
|
||||
goto main_queue;
|
||||
@ -840,7 +840,7 @@ static int kauditd_thread(void *dummy)
|
||||
rc = kauditd_send_queue(sk, portid,
|
||||
&audit_retry_queue, UNICAST_RETRIES,
|
||||
NULL, kauditd_hold_skb);
|
||||
if (ac && rc < 0) {
|
||||
if (rc < 0) {
|
||||
sk = NULL;
|
||||
auditd_reset(ac);
|
||||
goto main_queue;
|
||||
@ -2155,18 +2155,19 @@ void audit_log_task_info(struct audit_buffer *ab)
|
||||
EXPORT_SYMBOL(audit_log_task_info);
|
||||
|
||||
/**
|
||||
* audit_log_link_denied - report a link restriction denial
|
||||
* @operation: specific link operation
|
||||
* audit_log_path_denied - report a path restriction denial
|
||||
* @type: audit message type (AUDIT_ANOM_LINK, AUDIT_ANOM_CREAT, etc)
|
||||
* @operation: specific operation name
|
||||
*/
|
||||
void audit_log_link_denied(const char *operation)
|
||||
void audit_log_path_denied(int type, const char *operation)
|
||||
{
|
||||
struct audit_buffer *ab;
|
||||
|
||||
if (!audit_enabled || audit_dummy_context())
|
||||
return;
|
||||
|
||||
/* Generate AUDIT_ANOM_LINK with subject, operation, outcome. */
|
||||
ab = audit_log_start(audit_context(), GFP_KERNEL, AUDIT_ANOM_LINK);
|
||||
/* Generate log with subject, operation, outcome. */
|
||||
ab = audit_log_start(audit_context(), GFP_KERNEL, type);
|
||||
if (!ab)
|
||||
return;
|
||||
audit_log_format(ab, "op=%s", operation);
|
||||
|
Loading…
Reference in New Issue
Block a user