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 #106: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:77: +#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)) #122: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:93: +__attribute__((used)) WARNING: Prefer __used over __attribute__((used)) #130: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:101: +__attribute__((used)) WARNING: line length of 84 exceeds 80 columns #140: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:111: +static inline int asan_poison(void __arena *addr, s8 val, size_t size) { return 0; } CHECK: spaces preferred around that '*' (ctx:WxV) #140: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:111: +static inline int asan_poison(void __arena *addr, s8 val, size_t size) { return 0; } ^ CHECK: spaces preferred around that '*' (ctx:WxV) #141: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:112: +static inline int asan_unpoison(void __arena *addr, size_t size) { return 0; } ^ CHECK: spaces preferred around that '*' (ctx:WxV) #142: FILE: tools/testing/selftests/bpf/libarena/include/asan.h:113: +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 #156: FILE: tools/testing/selftests/bpf/libarena/include/common.h:41: +extern volatile u64 asan_violated; CHECK: Please don't use multiple blank lines #172: 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 #256: 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 #261: 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 #263: 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 #264: 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 #269: 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 #270: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:105: +volatile bool asan_emit_stack = false; CHECK: spaces preferred around that '*' (ctx:WxV) #279: 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 #299: 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) #327: 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 #358: 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) #361: 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 #372: 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 #373: 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' #392: 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 83 exceeds 80 columns #396: 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 82 exceeds 80 columns #398: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:233: + * for storeN/loadN that we do not expect to encounter the intrinsics will WARNING: Prefer 'fallthrough;' over fallthrough comment #414: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:249: + /* FALLTHROUGH */ WARNING: please, no space before tabs #551: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:386: + * ^Ia) pulling memory from the arena segment using bpf_arena_alloc_pages()$ WARNING: please, no space before tabs #552: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:387: + * ^Ib) freeing memory from application code$ CHECK: spaces preferred around that '*' (ctx:WxV) #554: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:389: +__hidden __noasan int asan_poison(void __arena *addr, s8 val, size_t size) ^ WARNING: line length of 84 exceeds 80 columns #560: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:395: + * Poisoning from a non-granule address makes no sense: We can only allocate WARNING: line length of 81 exceeds 80 columns #561: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:396: + * memory to the application that has a granule-aligned starting address, WARNING: line length of 86 exceeds 80 columns #585: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:420: + * That would be possible if we could free unaligned regions, so prevent that. CHECK: spaces preferred around that '*' (ctx:WxV) #611: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:446: +__hidden __noasan int asan_unpoison(void __arena *addr, size_t size) ^ CHECK: Alignment should match open parenthesis #680: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:515: + arena_stderr("error: globals %lx do not fit in arena %lx", + globals_pages, all_pages); WARNING: line length of 87 exceeds 80 columns #685: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:520: + arena_stderr("error: globals %lx do not leave room for shadow map %lx " WARNING: quoted string split across lines #686: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:521: + arena_stderr("error: globals %lx do not leave room for shadow map %lx " + "(arena pages %lx)", WARNING: line length of 84 exceeds 80 columns #695: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:530: + * Allocate the last (1/ASAN_SHADOW_SCALE)th of an arena's pages for the map WARNING: line length of 88 exceeds 80 columns #698: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:533: + * The allocated map pages are zeroed out, meaning all memory is marked as valid WARNING: line length of 88 exceeds 80 columns #699: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:534: + * even if it's not allocated already. This is expected: Since the actual memory WARNING: line length of 87 exceeds 80 columns #700: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:535: + * pages are not allocated, accesses to it will trigger page faults and will be WARNING: line length of 90 exceeds 80 columns #701: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:536: + * reported through BPF streams. Any pages allocated through bpf_arena_alloc_pages CHECK: Lines should not end with a '(' #704: FILE: tools/testing/selftests/bpf/libarena/src/asan.bpf.c:539: + shadow_map = (u64)bpf_arena_alloc_pages( total: 1 errors, 37 warnings, 17 checks, 684 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 4235fabf09da ("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.