tree:
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git queue-5.4
head: dcf7104e8ee83d0a2555bff0701e88b899a07710
commit: 1950f718bed0c32e4404121532351f2f5576e1b7 [146/215] ima: Free the entire rule if it
fails to parse
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 1950f718bed0c32e4404121532351f2f5576e1b7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from arch/m68k/include/asm/io_mm.h:25,
from arch/m68k/include/asm/io.h:8,
from include/linux/kexec.h:19,
from include/linux/ima.h:12,
from security/integrity/ima/ima_policy.c:22:
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsb':
arch/m68k/include/asm/raw_io.h:83:7: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
83 | ({u8 __w, __v = (b); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:430:3: note: in expansion of macro 'rom_out_8'
430 | rom_out_8(port, *buf++);
| ^~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw':
arch/m68k/include/asm/raw_io.h:86:8: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
86 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:448:3: note: in expansion of macro
'rom_out_be16'
448 | rom_out_be16(port, *buf++);
| ^~~~~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw_swapw':
arch/m68k/include/asm/raw_io.h:90:8: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
90 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:466:3: note: in expansion of macro
'rom_out_le16'
466 | rom_out_le16(port, *buf++);
| ^~~~~~~~~~~~
security/integrity/ima/ima_policy.c: In function 'ima_parse_add_rule':
> security/integrity/ima/ima_policy.c:1280:3: error: implicit
declaration of function 'ima_free_rule'; did you mean 'ima_parse_rule'?
[-Werror=implicit-function-declaration]
1280 | ima_free_rule(entry);
| ^~~~~~~~~~~~~
| ima_parse_rule
cc1: some warnings being treated as errors
vim +1280 security/integrity/ima/ima_policy.c
1246
1247 /**
1248 * ima_parse_add_rule - add a rule to ima_policy_rules
1249 * @rule - ima measurement policy rule
1250 *
1251 * Avoid locking by allowing just one writer at a time in ima_write_policy()
1252 * Returns the length of the rule parsed, an error code on failure
1253 */
1254 ssize_t ima_parse_add_rule(char *rule)
1255 {
1256 static const char op[] = "update_policy";
1257 char *p;
1258 struct ima_rule_entry *entry;
1259 ssize_t result, len;
1260 int audit_info = 0;
1261
1262 p = strsep(&rule, "\n");
1263 len = strlen(p) + 1;
1264 p += strspn(p, " \t");
1265
1266 if (*p == '#' || *p == '\0')
1267 return len;
1268
1269 entry = kzalloc(sizeof(*entry), GFP_KERNEL);
1270 if (!entry) {
1271 integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL,
1272 NULL, op, "-ENOMEM", -ENOMEM, audit_info);
1273 return -ENOMEM;
1274 }
1275
1276 INIT_LIST_HEAD(&entry->list);
1277
1278 result = ima_parse_rule(p, entry);
1279 if (result) {
1280 ima_free_rule(entry);
1281 integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL,
1282 NULL, op, "invalid-policy", result,
1283 audit_info);
1284 return result;
1285 }
1286
1287 list_add_tail(&entry->list, &ima_temp_rules);
1288
1289 return len;
1290 }
1291
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org