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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a69651l9.wl-maz@kernel.org>
Date:   Mon, 18 Jul 2022 08:20:18 +0100
From:   Marc Zyngier <maz@...nel.org>
To:     Kalesh Singh <kaleshsingh@...gle.com>
Cc:     mark.rutland@....com, broonie@...nel.org,
        madvenka@...ux.microsoft.com, will@...nel.org, qperret@...gle.com,
        tabba@...gle.com, james.morse@....com, alexandru.elisei@....com,
        suzuki.poulose@....com, catalin.marinas@....com,
        andreyknvl@...il.com, russell.king@...cle.com,
        vincenzo.frascino@....com, mhiramat@...nel.org, ast@...nel.org,
        drjones@...hat.com, wangkefeng.wang@...wei.com, elver@...gle.com,
        keirf@...gle.com, yuzenghui@...wei.com, ardb@...nel.org,
        oupton@...gle.com, linux-arm-kernel@...ts.infradead.org,
        kvmarm@...ts.cs.columbia.edu, linux-kernel@...r.kernel.org,
        android-mm@...gle.com, kernel-team@...roid.com
Subject: Re: [PATCH v4 10/18] KVM: arm64: Stub implementation of pKVM HYP stack unwinder

On Fri, 15 Jul 2022 07:10:19 +0100,
Kalesh Singh <kaleshsingh@...gle.com> wrote:
> 
> Add some stub implementations of protected nVHE stack unwinder, for
> building. These are implemented later in this series.
> 
> Signed-off-by: Kalesh Singh <kaleshsingh@...gle.com>
> ---
>  arch/arm64/include/asm/stacktrace/nvhe.h | 57 ++++++++++++++++++++++++
>  arch/arm64/kvm/hyp/nvhe/stacktrace.c     |  3 +-
>  2 files changed, 58 insertions(+), 2 deletions(-)
>  create mode 100644 arch/arm64/include/asm/stacktrace/nvhe.h
> 
> diff --git a/arch/arm64/include/asm/stacktrace/nvhe.h b/arch/arm64/include/asm/stacktrace/nvhe.h
> new file mode 100644
> index 000000000000..1eac4e57f2ae
> --- /dev/null
> +++ b/arch/arm64/include/asm/stacktrace/nvhe.h
> @@ -0,0 +1,57 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * KVM nVHE hypervisor stack tracing support.
> + *
> + * The unwinder implementation depends on the nVHE mode:
> + *
> + *   1) pKVM (protected nVHE) mode - the host cannot directly access
> + *      the HYP memory. The stack is unwinded in EL2 and dumped to a shared
> + *      buffer where the host can read and print the stacktrace.
> + *
> + * Copyright (C) 2022 Google LLC
> + */
> +#ifndef __ASM_STACKTRACE_NVHE_H
> +#define __ASM_STACKTRACE_NVHE_H
> +
> +#include <asm/stacktrace/common.h>
> +
> +static inline bool on_accessible_stack(const struct task_struct *tsk,
> +				       unsigned long sp, unsigned long size,
> +				       struct stack_info *info)
> +{
> +	return false;
> +}
> +
> +/*
> + * Protected nVHE HYP stack unwinder
> + */
> +#ifdef __KVM_NVHE_HYPERVISOR__
> +
> +#ifdef CONFIG_PROTECTED_NVHE_STACKTRACE
> +static inline bool on_overflow_stack(unsigned long sp, unsigned long size,
> +				     struct stack_info *info)
> +{
> +	return false;
> +}
> +
> +static int notrace unwind_next(struct unwind_state *state)
> +{
> +	return 0;
> +}
> +NOKPROBE_SYMBOL(unwind_next);

I find this rather dodgy. It means that every compilation unit that
(indirectly) drags this include file may end-up with an 'unwind_next'
function. At best this will be eliminated at compilation time, but it
may also generate a warning.

Why can't this me made an 'inline' function? At the very least, it
should have a __maybe_unused attribute.

> +#else	/* !CONFIG_PROTECTED_NVHE_STACKTRACE */
> +static inline bool on_overflow_stack(unsigned long sp, unsigned long size,
> +				     struct stack_info *info)
> +{
> +	return false;
> +}
> +
> +static int notrace unwind_next(struct unwind_state *state)
> +{
> +	return 0;
> +}
> +NOKPROBE_SYMBOL(unwind_next);

Same thing here.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ