Files
RedLintu16andClaude Opus 5.5 a45821994b Import from Sony 73.1.A.2.74 open source archive
kernel_platform/common (Android common kernel, android16-6.12) from opendevices.sony.net, "Open source archive for 73.1.A.2.74" (Xperia 1 VIII), unmodified. This is the kernel Sony ships, so stock-built modules (e.g. the WLAN driver, whose source is not in the archive) match it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-14 00:28:16 +00:00

45 lines
1.4 KiB
Python

# SPDX-License-Identifier: GPL-2.0
#
# Copyright 2024 Canonical Ltd.
#
# Authors:
# Kuan-Ying Lee <[email protected]>
#
import gdb
from linux import constants, mm
def help():
t = """Usage: lx-kasan_mem_to_shadow [Hex memory addr]
Example:
lx-kasan_mem_to_shadow 0xffff000008eca008\n"""
gdb.write("Unrecognized command\n")
raise gdb.GdbError(t)
class KasanMemToShadow(gdb.Command):
"""Translate memory address to kasan shadow address"""
p_ops = None
def __init__(self):
if constants.LX_CONFIG_KASAN_GENERIC or constants.LX_CONFIG_KASAN_SW_TAGS:
super(KasanMemToShadow, self).__init__("lx-kasan_mem_to_shadow", gdb.COMMAND_SUPPORT)
def invoke(self, args, from_tty):
if not constants.LX_CONFIG_KASAN_GENERIC or constants.LX_CONFIG_KASAN_SW_TAGS:
raise gdb.GdbError('CONFIG_KASAN_GENERIC or CONFIG_KASAN_SW_TAGS is not set')
argv = gdb.string_to_argv(args)
if len(argv) == 1:
if self.p_ops is None:
self.p_ops = mm.page_ops().ops
addr = int(argv[0], 16)
shadow_addr = self.kasan_mem_to_shadow(addr)
gdb.write('shadow addr: 0x%x\n' % shadow_addr)
else:
help()
def kasan_mem_to_shadow(self, addr):
return (addr >> self.p_ops.KASAN_SHADOW_SCALE_SHIFT) + self.p_ops.KASAN_SHADOW_OFFSET
KasanMemToShadow()