* [akpm-mm:mm-new 283/303] mm/kasan/report.c:674:80: sparse: sparse: cast truncates bits from constant value (ff00000000000000 becomes 0)
@ 2026-01-13 9:40 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-01-13 9:40 UTC (permalink / raw)
To: Samuel Holland
Cc: oe-kbuild-all, David Hildenbrand, Andrew Morton,
Linux Memory Management List, Maciej Wieczor-Retman
tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
head: abb8eb84b7bb668d982e556b2b19f0e3ac42c591
commit: a63f13759f21f65c96a77ad92773d94162380948 [283/303] kasan: sw_tags: use arithmetic shift for shadow computation
config: powerpc-randconfig-r132-20260113 (https://download.01.org/0day-ci/archive/20260113/202601131757.U5JRrwbH-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260113/202601131757.U5JRrwbH-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601131757.U5JRrwbH-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
mm/kasan/report.c:206:13: sparse: sparse: context imbalance in 'start_report' - wrong count at exit
mm/kasan/report.c:225:9: sparse: sparse: context imbalance in 'end_report' - unexpected unlock
>> mm/kasan/report.c:674:80: sparse: sparse: cast truncates bits from constant value (ff00000000000000 becomes 0)
vim +674 mm/kasan/report.c
630
631 #if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
632 /*
633 * With compiler-based KASAN modes, accesses to bogus pointers (outside of the
634 * mapped kernel address space regions) cause faults when KASAN tries to check
635 * the shadow memory before the actual memory access. This results in cryptic
636 * GPF reports, which are hard for users to interpret. This hook helps users to
637 * figure out what the original bogus pointer was.
638 */
639 void kasan_non_canonical_hook(unsigned long addr)
640 {
641 unsigned long orig_addr;
642 const char *bug_type;
643
644 /*
645 * For Generic KASAN, kasan_mem_to_shadow() uses the logical right shift
646 * and never overflows with the chosen KASAN_SHADOW_OFFSET values (on
647 * both x86 and arm64). Thus, the possible shadow addresses (even for
648 * bogus pointers) belong to a single contiguous region that is the
649 * result of kasan_mem_to_shadow() applied to the whole address space.
650 */
651 if (IS_ENABLED(CONFIG_KASAN_GENERIC)) {
652 if (addr < (unsigned long)kasan_mem_to_shadow((void *)(0ULL)) ||
653 addr > (unsigned long)kasan_mem_to_shadow((void *)(~0ULL)))
654 return;
655 }
656
657 /*
658 * For Software Tag-Based KASAN, kasan_mem_to_shadow() uses the
659 * arithmetic shift. Normally, this would make checking for a possible
660 * shadow address complicated, as the shadow address computation
661 * operation would overflow only for some memory addresses. However, due
662 * to the chosen KASAN_SHADOW_OFFSET values and the fact the
663 * kasan_mem_to_shadow() only operates on pointers with the tag reset,
664 * the overflow always happens.
665 *
666 * For arm64, the top byte of the pointer gets reset to 0xFF. Thus, the
667 * possible shadow addresses belong to a region that is the result of
668 * kasan_mem_to_shadow() applied to the memory range
669 * [0xFF000000000000, 0xFFFFFFFFFFFFFFFF]. Despite the overflow, the
670 * resulting possible shadow region is contiguous, as the overflow
671 * happens for both 0xFF000000000000 and 0xFFFFFFFFFFFFFFFF.
672 */
673 if (IS_ENABLED(CONFIG_KASAN_SW_TAGS) && IS_ENABLED(CONFIG_ARM64)) {
> 674 if (addr < (unsigned long)kasan_mem_to_shadow((void *)(0xFFULL << 56)) ||
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-01-13 9:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-13 9:40 [akpm-mm:mm-new 283/303] mm/kasan/report.c:674:80: sparse: sparse: cast truncates bits from constant value (ff00000000000000 becomes 0) kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox