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] [thread-next>] [day] [month] [year] [list]
Message-ID: <f75e5273-6c5f-4b47-ae2c-3cd21a0b5289@csgroup.eu>
Date:   Thu, 14 Dec 2023 09:20:06 +0000
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     Nicholas Miehlbradt <nicholas@...ux.ibm.com>,
        "glider@...gle.com" <glider@...gle.com>,
        "elver@...gle.com" <elver@...gle.com>,
        "dvyukov@...gle.com" <dvyukov@...gle.com>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "mpe@...erman.id.au" <mpe@...erman.id.au>,
        "npiggin@...il.com" <npiggin@...il.com>
CC:     "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "kasan-dev@...glegroups.com" <kasan-dev@...glegroups.com>,
        "iii@...ux.ibm.com" <iii@...ux.ibm.com>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 11/13] powerpc: Implement architecture specific KMSAN
 interface



Le 14/12/2023 à 06:55, Nicholas Miehlbradt a écrit :
> arch_kmsan_get_meta_or_null finds the metadata addresses for addresses
> in the ioremap region which is mapped separately on powerpc.
> 
> kmsan_vir_addr_valid is the same as virt_addr_valid except excludes the
> check that addr is less than high_memory since this function can be
> called on addresses higher than this.
> 
> Signed-off-by: Nicholas Miehlbradt <nicholas@...ux.ibm.com>
> ---
>   arch/powerpc/include/asm/kmsan.h | 44 ++++++++++++++++++++++++++++++++
>   1 file changed, 44 insertions(+)
>   create mode 100644 arch/powerpc/include/asm/kmsan.h
> 
> diff --git a/arch/powerpc/include/asm/kmsan.h b/arch/powerpc/include/asm/kmsan.h
> new file mode 100644
> index 000000000000..bc84f6ff2ee9
> --- /dev/null
> +++ b/arch/powerpc/include/asm/kmsan.h
> @@ -0,0 +1,44 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * powerpc KMSAN support.
> + *
> + */
> +
> +#ifndef _ASM_POWERPC_KMSAN_H
> +#define _ASM_POWERPC_KMSAN_H
> +
> +#ifndef __ASSEMBLY__
> +#ifndef MODULE
> +
> +#include <linux/mmzone.h>
> +#include <asm/page.h>
> +#include <asm/book3s/64/pgtable.h>
> +
> +/*
> + * Functions below are declared in the header to make sure they are inlined.
> + * They all are called from kmsan_get_metadata() for every memory access in
> + * the kernel, so speed is important here.
> + */
> +
> +/*
> + * No powerpc specific metadata locations
> + */
> +static inline void *arch_kmsan_get_meta_or_null(void *addr, bool is_origin)
> +{
> +	unsigned long addr64 = (unsigned long)addr, off;

Missing blank line.

> +	if (KERN_IO_START <= addr64 && addr64 < KERN_IO_END) {

off is only used in that block so it should be declared here, can be 
done as a single line (followed by a blank line too):

	unsigned long off = addr64 - KERN_IO_START;

> +		off = addr64 - KERN_IO_START;
> +		return (void *)off + (is_origin ? KERN_IO_ORIGIN_START : KERN_IO_SHADOW_START);
> +	} else {
> +		return 0;
> +	}
> +}
> +
> +static inline bool kmsan_virt_addr_valid(void *addr)
> +{
> +	return (unsigned long)addr >= PAGE_OFFSET && pfn_valid(virt_to_pfn(addr));
> +}
> +
> +#endif /* !MODULE */
> +#endif /* !__ASSEMBLY__ */
> +#endif /* _ASM_POWERPC_KMSAN_H */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ