Re: [PATCH] audit: Report suspicious O_CREAT usage

From: kbuild test robot
Date: Wed Sep 25 2019 - 17:41:47 EST


Hi Kees,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190924]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Kees-Cook/audit-Report-suspicious-O_CREAT-usage/20190926-050423
config: i386-tinyconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

In file included from include/linux/fsnotify.h:16:0,
from fs///attr.c:15:
>> include/linux/audit.h:222:1: error: expected identifier or '(' before '{' token
{ }
^
include/linux/audit.h:221:20: warning: 'audit_log_path_denied' declared 'static' but never defined [-Wunused-function]
static inline void audit_log_path_denied(int type, const char *string);
^~~~~~~~~~~~~~~~~~~~~

vim +222 include/linux/audit.h

b48345aafb2038 Richard Guy Briggs 2019-05-10 187
96368701e1c890 Paul Moore 2016-01-13 188 #else /* CONFIG_AUDIT */
96368701e1c890 Paul Moore 2016-01-13 189 static inline __printf(4, 5)
96368701e1c890 Paul Moore 2016-01-13 190 void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
96368701e1c890 Paul Moore 2016-01-13 191 const char *fmt, ...)
96368701e1c890 Paul Moore 2016-01-13 192 { }
96368701e1c890 Paul Moore 2016-01-13 193 static inline struct audit_buffer *audit_log_start(struct audit_context *ctx,
96368701e1c890 Paul Moore 2016-01-13 194 gfp_t gfp_mask, int type)
96368701e1c890 Paul Moore 2016-01-13 195 {
96368701e1c890 Paul Moore 2016-01-13 196 return NULL;
96368701e1c890 Paul Moore 2016-01-13 197 }
96368701e1c890 Paul Moore 2016-01-13 198 static inline __printf(2, 3)
96368701e1c890 Paul Moore 2016-01-13 199 void audit_log_format(struct audit_buffer *ab, const char *fmt, ...)
96368701e1c890 Paul Moore 2016-01-13 200 { }
96368701e1c890 Paul Moore 2016-01-13 201 static inline void audit_log_end(struct audit_buffer *ab)
96368701e1c890 Paul Moore 2016-01-13 202 { }
96368701e1c890 Paul Moore 2016-01-13 203 static inline void audit_log_n_hex(struct audit_buffer *ab,
96368701e1c890 Paul Moore 2016-01-13 204 const unsigned char *buf, size_t len)
96368701e1c890 Paul Moore 2016-01-13 205 { }
96368701e1c890 Paul Moore 2016-01-13 206 static inline void audit_log_n_string(struct audit_buffer *ab,
96368701e1c890 Paul Moore 2016-01-13 207 const char *buf, size_t n)
96368701e1c890 Paul Moore 2016-01-13 208 { }
96368701e1c890 Paul Moore 2016-01-13 209 static inline void audit_log_n_untrustedstring(struct audit_buffer *ab,
96368701e1c890 Paul Moore 2016-01-13 210 const char *string, size_t n)
96368701e1c890 Paul Moore 2016-01-13 211 { }
96368701e1c890 Paul Moore 2016-01-13 212 static inline void audit_log_untrustedstring(struct audit_buffer *ab,
96368701e1c890 Paul Moore 2016-01-13 213 const char *string)
96368701e1c890 Paul Moore 2016-01-13 214 { }
96368701e1c890 Paul Moore 2016-01-13 215 static inline void audit_log_d_path(struct audit_buffer *ab,
96368701e1c890 Paul Moore 2016-01-13 216 const char *prefix,
96368701e1c890 Paul Moore 2016-01-13 217 const struct path *path)
96368701e1c890 Paul Moore 2016-01-13 218 { }
96368701e1c890 Paul Moore 2016-01-13 219 static inline void audit_log_key(struct audit_buffer *ab, char *key)
96368701e1c890 Paul Moore 2016-01-13 220 { }
21e61058cf0f22 Kees Cook 2019-09-25 221 static inline void audit_log_path_denied(int type, const char *string);
96368701e1c890 Paul Moore 2016-01-13 @222 { }
96368701e1c890 Paul Moore 2016-01-13 223 static inline int audit_log_task_context(struct audit_buffer *ab)
96368701e1c890 Paul Moore 2016-01-13 224 {
96368701e1c890 Paul Moore 2016-01-13 225 return 0;
96368701e1c890 Paul Moore 2016-01-13 226 }
2a1fe215e7300c Paul Moore 2018-11-26 227 static inline void audit_log_task_info(struct audit_buffer *ab)
96368701e1c890 Paul Moore 2016-01-13 228 { }
4b7d248b3a1de4 Richard Guy Briggs 2019-01-22 229

:::::: The code at line 222 was first introduced by commit
:::::: 96368701e1c89057bbf39222e965161c68a85b4b audit: force seccomp event logging to honor the audit_enabled flag

:::::: TO: Paul Moore <pmoore@xxxxxxxxxx>
:::::: CC: Paul Moore <paul@xxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip