WARNING: Improper SPDX comment style for 'tools/testing/selftests/bpf/libarena/include/libarena/asan.h', please use '/*' instead #30: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:1: +// SPDX-License-Identifier: LGPL-2.1 OR BSD-2-Clause WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 #30: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:1: +// SPDX-License-Identifier: LGPL-2.1 OR BSD-2-Clause WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #41: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:12: +extern volatile u64 __asan_shadow_memory_dynamic_address; WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #42: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:13: +extern volatile u32 asan_reported; WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #43: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:14: +extern volatile bool asan_inited; WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #44: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:15: +extern volatile bool asan_report_once; CHECK: Prefer using the BIT_ULL macro #49: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:20: +#define ASAN_SHADOW_SCALE (1ULL << ASAN_SHADOW_SHIFT) CHECK: spaces preferred around that '*' (ctx:WxV) #60: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:31: +s8a *mem_to_shadow(void __arena __arg_arena *addr) ^ CHECK: spaces preferred around that '*' (ctx:WxV) #72: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:43: +int asan_poison(void __arena *addr, s8 val, size_t size); ^ CHECK: spaces preferred around that '*' (ctx:WxV) #73: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:44: +int asan_unpoison(void __arena *addr, size_t size); ^ CHECK: spaces preferred around that '*' (ctx:WxV) #74: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:45: +bool asan_shadow_set(void __arena *addr); ^ WARNING: macros should not use a trailing semicolon #81: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:52: +#define DECLARE_ASAN_LOAD_STORE_SIZE(size) \ + void __asan_store##size(intptr_t addr); \ + void __asan_store##size##_noabort(intptr_t addr); \ + void __asan_load##size(intptr_t addr); \ + void __asan_load##size##_noabort(intptr_t addr); \ + void __asan_report_store##size(intptr_t addr); \ + void __asan_report_store##size##_noabort(intptr_t addr); \ + void __asan_report_load##size(intptr_t addr); \ + void __asan_report_load##size##_noabort(intptr_t addr); WARNING: line length of 81 exceeds 80 columns #87: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:58: + void __asan_report_store##size##_noabort(intptr_t addr); \ ERROR: Macros with complex values should be enclosed in parentheses #105: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:76: +#define ASAN_LOAD_STORE_SIZE(size) \ + __asan_store##size, \ + __asan_store##size##_noabort, \ + __asan_load##size, \ + __asan_load##size##_noabort, \ + __asan_report_store##size, \ + __asan_report_store##size##_noabort, \ + __asan_report_load##size, \ + __asan_report_load##size##_noabort BUT SEE: do {} while (0) advice is over-stated in a few situations: The more obvious case is macros, like MODULE_PARM_DESC, invoked at file-scope, where C disallows code (it must be in functions). See $exceptions if you have one to add by name. More troublesome is declarative macros used at top of new scope, like DECLARE_PER_CPU. These might just compile with a do-while-0 wrapper, but would be incorrect. Most of these are handled by detecting struct,union,etc declaration primitives in $exceptions. Theres also macros called inside an if (block), which "return" an expression. These cannot do-while, and need a ({}) wrapper. Enjoy this qualification while we work to improve our heuristics. WARNING: Prefer __used over __attribute__((used)) #115: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:86: +__attribute__((used)) WARNING: line length of 84 exceeds 80 columns #125: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:96: +static inline int asan_poison(void __arena *addr, s8 val, size_t size) { return 0; } CHECK: spaces preferred around that '*' (ctx:WxV) #125: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:96: +static inline int asan_poison(void __arena *addr, s8 val, size_t size) { return 0; } ^ CHECK: spaces preferred around that '*' (ctx:WxV) #126: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:97: +static inline int asan_unpoison(void __arena *addr, size_t size) { return 0; } ^ CHECK: spaces preferred around that '*' (ctx:WxV) #127: FILE: tools/testing/selftests/bpf/libarena/include/libarena/asan.h:98: +static inline bool asan_shadow_set(void __arena *addr) { return 0; } ^ WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #141: FILE: tools/testing/selftests/bpf/libarena/include/libarena/common.h:47: +extern volatile u64 asan_violated; CHECK: Please don't use multiple blank lines #157: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:7: + + WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #241: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:91: +volatile u64 asan_violated = 0; WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #246: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:96: +volatile u64 __asan_shadow_memory_dynamic_address; WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #248: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:98: +volatile u32 asan_reported = false; WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #249: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:99: +volatile bool asan_inited = false; WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #254: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:104: +volatile bool asan_report_once = false; CHECK: spaces preferred around that '*' (ctx:WxV) #263: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:113: +__weak int asan_memset(s8a __arg_arena *dst, s8 val, size_t size) ^ WARNING: line length of 84 exceeds 80 columns #283: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:133: + * Byte is non-zero. Access is valid if granule offset in [0, shadow_value), CHECK: spaces preferred around that '*' (ctx:WxV) #311: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:161: +__weak bool asan_shadow_set(void __arena __arg_arena *addr) ^ WARNING: line length of 84 exceeds 80 columns #342: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:192: + return unlikely(ret != end || ASAN_GRANULE(addr + size - 1) >= *(s8a *)end); CHECK: spaces preferred around that '*' (ctx:WxV) #345: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:195: +__weak int asan_report(s8a __arg_arena *addr, size_t sz, u32 flags) ^ WARNING: line length of 84 exceeds 80 columns #355: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:205: + arena_stderr("Memory violation for address %p (0x%lx) for %s of size %ld\n", CHECK: Alignment should match open parenthesis #356: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:206: + arena_stderr("Memory violation for address %p (0x%lx) for %s of size %ld\n", + addr, (u64)addr, WARNING: Possible repeated word: 'the' #374: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:224: + * Wraparound is possible for values close to the the edge of the WARNING: line length of 83 exceeds 80 columns #378: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:228: + * The wraparound detection below works for small sizes. check_asan_args is WARNING: line length of 82 exceeds 80 columns #380: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:230: + * for storeN/loadN that we do not expect to encounter the intrinsics will WARNING: Prefer 'fallthrough;' over fallthrough comment #396: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:246: + /* FALLTHROUGH */ WARNING: please, no space before tabs #533: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:383: + * ^Ia) pulling memory from the arena segment using bpf_arena_alloc_pages()$ WARNING: please, no space before tabs #534: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:384: + * ^Ib) freeing memory from application code$ CHECK: spaces preferred around that '*' (ctx:WxV) #536: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:386: +__hidden __noasan int asan_poison(void __arena *addr, s8 val, size_t size) ^ WARNING: line length of 84 exceeds 80 columns #542: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:392: + * Poisoning from a non-granule address makes no sense: We can only allocate WARNING: line length of 81 exceeds 80 columns #543: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:393: + * memory to the application that has a granule-aligned starting address, WARNING: line length of 86 exceeds 80 columns #567: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:417: + * That would be possible if we could free unaligned regions, so prevent that. CHECK: spaces preferred around that '*' (ctx:WxV) #593: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:443: +__hidden __noasan int asan_unpoison(void __arena *addr, size_t size) ^ CHECK: Alignment should match open parenthesis #659: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:509: + arena_stderr("error: globals %lx do not fit in arena %lx", + globals_pages, all_pages); WARNING: line length of 87 exceeds 80 columns #664: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:514: + arena_stderr("error: globals %lx do not leave room for shadow map %lx " WARNING: quoted string split across lines #665: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:515: + arena_stderr("error: globals %lx do not leave room for shadow map %lx " + "(arena pages %lx)", WARNING: line length of 84 exceeds 80 columns #674: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:524: + * Allocate the last (1/ASAN_SHADOW_SCALE)th of an arena's pages for the map WARNING: line length of 88 exceeds 80 columns #677: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:527: + * The allocated map pages are zeroed out, meaning all memory is marked as valid WARNING: line length of 88 exceeds 80 columns #678: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:528: + * even if it's not allocated already. This is expected: Since the actual memory WARNING: line length of 87 exceeds 80 columns #679: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:529: + * pages are not allocated, accesses to it will trigger page faults and will be WARNING: line length of 90 exceeds 80 columns #680: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:530: + * reported through BPF streams. Any pages allocated through bpf_arena_alloc_pages CHECK: Lines should not end with a '(' #683: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:533: + shadow_map = (u64)bpf_arena_alloc_pages( total: 1 errors, 35 warnings, 17 checks, 663 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. Commit cab08a64b82e ("selftests/bpf: Add arena ASAN runtime to libarena") has style problems, please review. NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT BAD_REPORTED_BY_LINK CAMELCASE COMMIT_LOG_LONG_LINE FILE_PATH_CHANGES GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.