File tree Expand file tree Collapse file tree 4 files changed +16
-9
lines changed Expand file tree Collapse file tree 4 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -925,7 +925,7 @@ static inline int may_follow_link(struct nameidata *nd)
925
925
return - ECHILD ;
926
926
927
927
audit_inode (nd -> name , nd -> stack [0 ].link .dentry , 0 );
928
- audit_log_link_denied ( "follow_link" );
928
+ audit_log_path_denied ( AUDIT_ANOM_LINK , "follow_link" );
929
929
return - EACCES ;
930
930
}
931
931
@@ -993,7 +993,7 @@ static int may_linkat(struct path *link)
993
993
if (safe_hardlink_source (inode ) || inode_owner_or_capable (inode ))
994
994
return 0 ;
995
995
996
- audit_log_link_denied ( "linkat" );
996
+ audit_log_path_denied ( AUDIT_ANOM_LINK , "linkat" );
997
997
return - EPERM ;
998
998
}
999
999
@@ -1031,6 +1031,10 @@ static int may_create_in_sticky(struct dentry * const dir,
1031
1031
(dir -> d_inode -> i_mode & 0020 &&
1032
1032
((sysctl_protected_fifos >= 2 && S_ISFIFO (inode -> i_mode )) ||
1033
1033
(sysctl_protected_regular >= 2 && S_ISREG (inode -> i_mode ))))) {
1034
+ const char * operation = S_ISFIFO (inode -> i_mode ) ?
1035
+ "sticky_create_fifo" :
1036
+ "sticky_create_regular" ;
1037
+ audit_log_path_denied (AUDIT_ANOM_CREAT , operation );
1034
1038
return - EACCES ;
1035
1039
}
1036
1040
return 0 ;
Original file line number Diff line number Diff line change @@ -156,7 +156,8 @@ extern void audit_log_d_path(struct audit_buffer *ab,
156
156
const struct path * path );
157
157
extern void audit_log_key (struct audit_buffer * ab ,
158
158
char * key );
159
- extern void audit_log_link_denied (const char * operation );
159
+ extern void audit_log_path_denied (int type ,
160
+ const char * operation );
160
161
extern void audit_log_lost (const char * message );
161
162
162
163
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,
217
218
{ }
218
219
static inline void audit_log_key (struct audit_buffer * ab , char * key )
219
220
{ }
220
- static inline void audit_log_link_denied ( const char * string )
221
+ static inline void audit_log_path_denied ( int type , const char * operation )
221
222
{ }
222
223
static inline int audit_log_task_context (struct audit_buffer * ab )
223
224
{
Original file line number Diff line number Diff line change 143
143
#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */
144
144
#define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */
145
145
#define AUDIT_ANOM_LINK 1702 /* Suspicious use of file links */
146
+ #define AUDIT_ANOM_CREAT 1703 /* Suspicious file creation */
146
147
#define AUDIT_INTEGRITY_DATA 1800 /* Data integrity verification */
147
148
#define AUDIT_INTEGRITY_METADATA 1801 /* Metadata integrity verification */
148
149
#define AUDIT_INTEGRITY_STATUS 1802 /* Integrity enable status */
Original file line number Diff line number Diff line change @@ -2155,18 +2155,19 @@ void audit_log_task_info(struct audit_buffer *ab)
2155
2155
EXPORT_SYMBOL (audit_log_task_info );
2156
2156
2157
2157
/**
2158
- * audit_log_link_denied - report a link restriction denial
2159
- * @operation: specific link operation
2158
+ * audit_log_path_denied - report a path restriction denial
2159
+ * @type: audit message type (AUDIT_ANOM_LINK, AUDIT_ANOM_CREAT, etc)
2160
+ * @operation: specific operation name
2160
2161
*/
2161
- void audit_log_link_denied ( const char * operation )
2162
+ void audit_log_path_denied ( int type , const char * operation )
2162
2163
{
2163
2164
struct audit_buffer * ab ;
2164
2165
2165
2166
if (!audit_enabled || audit_dummy_context ())
2166
2167
return ;
2167
2168
2168
- /* Generate AUDIT_ANOM_LINK with subject, operation, outcome. */
2169
- ab = audit_log_start (audit_context (), GFP_KERNEL , AUDIT_ANOM_LINK );
2169
+ /* Generate log with subject, operation, outcome. */
2170
+ ab = audit_log_start (audit_context (), GFP_KERNEL , type );
2170
2171
if (!ab )
2171
2172
return ;
2172
2173
audit_log_format (ab , "op=%s" , operation );
You can’t perform that action at this time.
0 commit comments