WARNING: Improper SPDX comment style for 'tools/testing/selftests/bpf/libarena/include/asan.h', please use '/*' instead #30: FILE: tools/testing/selftests/bpf/libarena/include/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/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/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/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/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/asan.h:15: +extern volatile bool asan_report_once; WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #45: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:16: +extern volatile bool asan_emit_stack; CHECK: Prefer using the BIT_ULL macro #50: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:21: +#define ASAN_SHADOW_SCALE (1ULL << ASAN_SHADOW_SHIFT) CHECK: spaces preferred around that '*' (ctx:WxV) #61: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:32: +s8a *mem_to_shadow(void __arena __arg_arena *addr) ^ CHECK: spaces preferred around that '*' (ctx:WxV) #73: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:44: +int asan_poison(void __arena *addr, s8 val, size_t size); ^ CHECK: spaces preferred around that '*' (ctx:WxV) #74: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:45: +int asan_unpoison(void __arena *addr, size_t size); ^ CHECK: spaces preferred around that '*' (ctx:WxV) #75: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:46: +bool asan_shadow_set(void __arena *addr); ^ WARNING: macros should not use a trailing semicolon #82: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:53: +#define DECLARE_ASAN_LOAD_STORE_SIZE(size) \ + void __asan_store##size(void *addr); \ + void __asan_store##size##_noabort(void *addr); \ + void __asan_load##size(void *addr); \ + void __asan_load##size##_noabort(void *addr); \ + void __asan_report_store##size(void *addr); \ + void __asan_report_store##size##_noabort(void *addr); \ + void __asan_report_load##size(void *addr); \ + void __asan_report_load##size##_noabort(void *addr); ERROR: Macros with complex values should be enclosed in parentheses #101: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:72: +#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)) #117: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:88: +__attribute__((used)) WARNING: line length of 84 exceeds 80 columns #127: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:98: +static inline int asan_poison(void __arena *addr, s8 val, size_t size) { return 0; } CHECK: spaces preferred around that '*' (ctx:WxV) #127: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:98: +static inline int asan_poison(void __arena *addr, s8 val, size_t size) { return 0; } ^ CHECK: spaces preferred around that '*' (ctx:WxV) #128: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:99: +static inline int asan_unpoison(void __arena *addr, size_t size) { return 0; } ^ CHECK: spaces preferred around that '*' (ctx:WxV) #129: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:100: +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 #143: FILE: tools/testing/selftests/bpf/libarena/include/common.h:42: +extern volatile u64 asan_violated; CHECK: Please don't use multiple blank lines #159: 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 #243: 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 #248: 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 #250: 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 #251: 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 #256: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:104: +volatile bool asan_report_once = false; WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #257: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:105: +volatile bool asan_emit_stack = false; CHECK: spaces preferred around that '*' (ctx:WxV) #266: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:114: +__weak int asan_memset(s8a __arg_arena *dst, s8 val, size_t size) ^ WARNING: line length of 84 exceeds 80 columns #286: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:134: + * Byte is non-zero. Access is valid if granule offset in [0, shadow_value), CHECK: spaces preferred around that '*' (ctx:WxV) #314: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:162: +__weak bool asan_shadow_set(void __arena __arg_arena *addr) ^ WARNING: line length of 84 exceeds 80 columns #345: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:193: + return unlikely(ret != end || ASAN_GRANULE(addr + size - 1) >= *(s8a *)end); CHECK: spaces preferred around that '*' (ctx:WxV) #348: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:196: +__weak int asan_report(s8a __arg_arena *addr, size_t sz, u32 flags) ^ WARNING: line length of 90 exceeds 80 columns #359: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:207: + arena_stderr("Memory violation for address %p (0x%lx) for %s of size %ld", CHECK: Alignment should match open parenthesis #360: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:208: + arena_stderr("Memory violation for address %p (0x%lx) for %s of size %ld", + addr, (u64)addr, WARNING: Possible repeated word: 'the' #379: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:227: + * Wraparound is possible for values close to the the edge of the WARNING: line length of 82 exceeds 80 columns #383: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:231: + * The wraparound detection below works for small sizes.check_asan_args is WARNING: line length of 81 exceeds 80 columns #385: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:233: + * not implement storeN/loadN, so size is guaranteed to be in that range. WARNING: Prefer 'fallthrough;' over fallthrough comment #402: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:250: + /* FALLTHROUGH */ WARNING: please, no space before tabs #529: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:377: + * ^Ia) pulling memory from the arena segment using bpf_arena_alloc_pages()$ WARNING: please, no space before tabs #530: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:378: + * ^Ib) freeing memory from application code$ CHECK: spaces preferred around that '*' (ctx:WxV) #532: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:380: +__hidden __noasan int asan_poison(void __arena *addr, s8 val, size_t size) ^ WARNING: line length of 84 exceeds 80 columns #538: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:386: + * Poisoning from a non-granule address makes no sense: We can only allocate WARNING: line length of 81 exceeds 80 columns #539: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:387: + * memory to the application that has a granule-aligned starting address, WARNING: line length of 86 exceeds 80 columns #563: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:411: + * That would be possible if we could free unaligned regions, so prevent that. CHECK: spaces preferred around that '*' (ctx:WxV) #589: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:437: +__hidden __noasan int asan_unpoison(void __arena *addr, size_t size) ^ CHECK: Alignment should match open parenthesis #658: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:506: + arena_stderr("error: globals %lx do not fit in arena %lx", + globals_pages, all_pages); WARNING: line length of 87 exceeds 80 columns #663: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:511: + arena_stderr("error: globals %lx do not leave room for shadow map %lx " WARNING: quoted string split across lines #664: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:512: + arena_stderr("error: globals %lx do not leave room for shadow map %lx " + "(arena pages %lx)", WARNING: line length of 84 exceeds 80 columns #673: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:521: + * Allocate the last (1/ASAN_SHADOW_SCALE)th of an arena's pages for the map WARNING: line length of 88 exceeds 80 columns #676: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:524: + * The allocated map pages are zeroed out, meaning all memory is marked as valid WARNING: line length of 88 exceeds 80 columns #677: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:525: + * even if it's not allocated already. This is expected: Since the actual memory WARNING: line length of 87 exceeds 80 columns #678: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:526: + * pages are not allocated, accesses to it will trigger page faults and will be WARNING: line length of 90 exceeds 80 columns #679: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:527: + * reported through BPF streams. Any pages allocated through bpf_arena_alloc_pages CHECK: Lines should not end with a '(' #682: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:530: + shadow_map = (u64)bpf_arena_alloc_pages( total: 1 errors, 36 warnings, 17 checks, 662 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 7f9fb22b727b ("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.