• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3# Print out the KASAN_SHADOW_OFFSETS required to place the KASAN SHADOW
4# start address at the mid-point of the kernel VA space
5
6print_kasan_offset () {
7	printf "%02d\t" $1
8	printf "0x%08x00000000\n" $(( (0xffffffff & (-1 << ($1 - 1 - 32))) \
9			+ (1 << ($1 - 32 - $2)) \
10			- (1 << (64 - 32 - $2)) ))
11}
12
13echo KASAN_SHADOW_SCALE_SHIFT = 3
14printf "VABITS\tKASAN_SHADOW_OFFSET\n"
15print_kasan_offset 48 3
16print_kasan_offset 47 3
17print_kasan_offset 42 3
18print_kasan_offset 39 3
19print_kasan_offset 36 3
20echo
21echo KASAN_SHADOW_SCALE_SHIFT = 4
22printf "VABITS\tKASAN_SHADOW_OFFSET\n"
23print_kasan_offset 48 4
24print_kasan_offset 47 4
25print_kasan_offset 42 4
26print_kasan_offset 39 4
27print_kasan_offset 36 4
28