lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e5207d4b-3177-4ee5-a6db-e095e3a5ce6e@siemens.com>
Date: Sun, 1 Feb 2026 13:59:39 +0100
From: Jan Kiszka <jan.kiszka@...mens.com>
To: Seongjun Hong <hsj0512@....ac.kr>, kbingham@...nel.org
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scripts/gdb: support lx-slabinfo on x86

On 01.02.26 13:06, Seongjun Hong wrote:
> The lx-slabinfo command failed on x86 because x86_page_ops was not
> implemented. This patch implements x86_page_ops in mm.py.
> 
> Additionally, CONFIG_PAGE_SHIFT is required for the calculation but
> was only available for ARM64 in constants.py.in. This patch moves
> it to be available for all architectures.
> 
> Signed-off-by: Seongjun Hong <hsj0512@....ac.kr>
> ---
>  scripts/gdb/linux/constants.py.in |  2 +-
>  scripts/gdb/linux/mm.py           | 25 ++++++++++++++++++++++++-
>  2 files changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in
> index c3886739a028..11fd4ba6ba85 100644
> --- a/scripts/gdb/linux/constants.py.in
> +++ b/scripts/gdb/linux/constants.py.in
> @@ -150,8 +150,8 @@ LX_CONFIG(CONFIG_ARM64_64K_PAGES)
>  if IS_BUILTIN(CONFIG_ARM64):
>      LX_VALUE(CONFIG_ARM64_PA_BITS)
>      LX_VALUE(CONFIG_ARM64_VA_BITS)
> -    LX_VALUE(CONFIG_PAGE_SHIFT)
>      LX_VALUE(CONFIG_ARCH_FORCE_MAX_ORDER)
> +LX_VALUE(CONFIG_PAGE_SHIFT)
>  LX_CONFIG(CONFIG_SPARSEMEM)
>  LX_CONFIG(CONFIG_SPARSEMEM_EXTREME)
>  LX_CONFIG(CONFIG_SPARSEMEM_VMEMMAP)
> diff --git a/scripts/gdb/linux/mm.py b/scripts/gdb/linux/mm.py
> index 7571aebbe650..d6e84e4bf102 100644
> --- a/scripts/gdb/linux/mm.py
> +++ b/scripts/gdb/linux/mm.py
> @@ -26,8 +26,31 @@ class page_ops():
>              raise gdb.GdbError('Only support CONFIG_SPARSEMEM_VMEMMAP now')
>          if constants.LX_CONFIG_ARM64 and utils.is_target_arch('aarch64'):
>              self.ops = aarch64_page_ops()
> +        elif utils.is_target_arch('x86_64') or utils.is_target_arch('x86-64'):
> +            self.ops = x86_page_ops()
>          else:
> -            raise gdb.GdbError('Only support aarch64 now')
> +            raise gdb.GdbError('Only support aarch64 and x86_64 now')
> +
> +class x86_page_ops():
> +    def __init__(self):
> +        self.MAX_NUMNODES = 1 << constants.LX_CONFIG_NODES_SHIFT
> +        self.struct_page_size = utils.get_page_type().sizeof
> +        self.PAGE_SHIFT = constants.LX_CONFIG_PAGE_SHIFT
> +        self.PAGE_SIZE = 1 << self.PAGE_SHIFT
> +        self.PAGE_OFFSET = int(gdb.parse_and_eval("page_offset_base"))
> +        self.VMEMMAP_START = int(gdb.parse_and_eval("vmemmap_base"))
> +
> +    def page_to_virt(self, page):
> +        page_ptr = page.cast(utils.get_page_type().pointer())
> +        vmemmap_ptr = gdb.Value(self.VMEMMAP_START).cast(utils.get_page_type().pointer())
> +        idx = int(page_ptr - vmemmap_ptr)
> +        return self.PAGE_OFFSET + (idx * self.PAGE_SIZE)
> +
> +    def page_address(self, page):
> +        return self.page_to_virt(page)
> +
> +    def folio_address(self, folio):
> +        return self.page_address(folio['page'].address)
>  
>  class aarch64_page_ops():
>      def __init__(self):

Thanks for the contribution! From my quick (re-)reading, there are more
page_ops than what you implement above. I think command like
lx-pfn_to_page will now cause splats rather than a nicer "not
implemented yet". Could you add the missing ops or handle those cases
more gracefully for now?

Jan

-- 
Siemens AG, Foundational Technologies
Linux Expert Center

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ