All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: madvenka@linux.microsoft.com
Cc: mark.rutland@arm.com, jpoimboe@redhat.com, ardb@kernel.org,
	nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com,
	catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org,
	linux-arm-kernel@lists.infradead.org,
	live-patching@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v11 4/5] arm64: Introduce stack trace reliability checks in the unwinder
Date: Thu, 25 Nov 2021 14:56:44 +0000	[thread overview]
Message-ID: <YZ+kLPT+h6ZGw20p@sirena.org.uk> (raw)
In-Reply-To: <20211123193723.12112-5-madvenka@linux.microsoft.com>

[-- Attachment #1: Type: text/plain, Size: 1493 bytes --]

On Tue, Nov 23, 2021 at 01:37:22PM -0600, madvenka@linux.microsoft.com wrote:

> Introduce arch_stack_walk_reliable() for ARM64. This works like
> arch_stack_walk() except that it returns -EINVAL if the stack trace is not
> reliable.

> Until all the reliability checks are in place, arch_stack_walk_reliable()
> may not be used by livepatch. But it may be used by debug and test code.

Probably also worth noting that this doesn't select
HAVE_RELIABLE_STACKTRACE which is what any actual users are going to use
to identify if the architecture has the feature.  I would have been
tempted to add arch_stack_walk() as a separate patch but equally having
the user code there (even if it itself can't yet be used...) helps with
reviewing the actual unwinder so I don't mind.

> +static void unwind_check_reliability(struct task_struct *task,
> +				     struct stackframe *frame)
> +{
> +	if (frame->fp == (unsigned long)task_pt_regs(task)->stackframe) {
> +		/* Final frame; no more unwind, no need to check reliability */
> +		return;
> +	}

If the unwinder carries on for some reason (the code for that is
elsewhere and may be updated separately...) then this will start
checking again.  I'm not sure if this is a *problem* as such but the
thing about this being the final frame coupled with not actually
explicitly stopping the unwind here makes me think this should at least
be clearer, the comment begs the question about what happens if
something decides it is not in fact the final frame.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: madvenka@linux.microsoft.com
Cc: mark.rutland@arm.com, jpoimboe@redhat.com, ardb@kernel.org,
	nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com,
	catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org,
	linux-arm-kernel@lists.infradead.org,
	live-patching@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v11 4/5] arm64: Introduce stack trace reliability checks in the unwinder
Date: Thu, 25 Nov 2021 14:56:44 +0000	[thread overview]
Message-ID: <YZ+kLPT+h6ZGw20p@sirena.org.uk> (raw)
In-Reply-To: <20211123193723.12112-5-madvenka@linux.microsoft.com>


[-- Attachment #1.1: Type: text/plain, Size: 1493 bytes --]

On Tue, Nov 23, 2021 at 01:37:22PM -0600, madvenka@linux.microsoft.com wrote:

> Introduce arch_stack_walk_reliable() for ARM64. This works like
> arch_stack_walk() except that it returns -EINVAL if the stack trace is not
> reliable.

> Until all the reliability checks are in place, arch_stack_walk_reliable()
> may not be used by livepatch. But it may be used by debug and test code.

Probably also worth noting that this doesn't select
HAVE_RELIABLE_STACKTRACE which is what any actual users are going to use
to identify if the architecture has the feature.  I would have been
tempted to add arch_stack_walk() as a separate patch but equally having
the user code there (even if it itself can't yet be used...) helps with
reviewing the actual unwinder so I don't mind.

> +static void unwind_check_reliability(struct task_struct *task,
> +				     struct stackframe *frame)
> +{
> +	if (frame->fp == (unsigned long)task_pt_regs(task)->stackframe) {
> +		/* Final frame; no more unwind, no need to check reliability */
> +		return;
> +	}

If the unwinder carries on for some reason (the code for that is
elsewhere and may be updated separately...) then this will start
checking again.  I'm not sure if this is a *problem* as such but the
thing about this being the final frame coupled with not actually
explicitly stopping the unwind here makes me think this should at least
be clearer, the comment begs the question about what happens if
something decides it is not in fact the final frame.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-11-25 14:58 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8b861784d85a21a9bf08598938c11aff1b1249b9>
2021-11-23 19:37 ` [PATCH v11 0/5] arm64: Reorganize the unwinder and implement stack trace reliability checks madvenka
2021-11-23 19:37   ` madvenka
2021-11-23 19:37   ` [PATCH v11 1/5] arm64: Call stack_backtrace() only from within walk_stackframe() madvenka
2021-11-23 19:37     ` madvenka
2021-11-25 13:48     ` Mark Brown
2021-11-25 13:48       ` Mark Brown
2021-11-30 15:05     ` Mark Rutland
2021-11-30 15:05       ` Mark Rutland
2021-11-30 17:13       ` Madhavan T. Venkataraman
2021-11-30 17:13         ` Madhavan T. Venkataraman
2021-11-30 18:29         ` Mark Rutland
2021-11-30 18:29           ` Mark Rutland
2021-11-30 20:29           ` Madhavan T. Venkataraman
2021-11-30 20:29             ` Madhavan T. Venkataraman
2021-12-10  4:13             ` Madhavan T. Venkataraman
2021-12-10  4:13               ` Madhavan T. Venkataraman
2021-11-23 19:37   ` [PATCH v11 2/5] arm64: Rename unwinder functions madvenka
2021-11-23 19:37     ` madvenka
2021-11-24 17:10     ` Mark Brown
2021-11-24 17:10       ` Mark Brown
2021-11-30 15:08     ` Mark Rutland
2021-11-30 15:08       ` Mark Rutland
2021-11-30 17:15       ` Madhavan T. Venkataraman
2021-11-30 17:15         ` Madhavan T. Venkataraman
2021-11-23 19:37   ` [PATCH v11 3/5] arm64: Make the unwind loop in unwind() similar to other architectures madvenka
2021-11-23 19:37     ` madvenka
2021-11-25 14:30     ` Mark Brown
2021-11-25 14:30       ` Mark Brown
2021-11-23 19:37   ` [PATCH v11 4/5] arm64: Introduce stack trace reliability checks in the unwinder madvenka
2021-11-23 19:37     ` madvenka
2021-11-25 14:56     ` Mark Brown [this message]
2021-11-25 14:56       ` Mark Brown
2021-11-25 16:59       ` Madhavan T. Venkataraman
2021-11-25 16:59         ` Madhavan T. Venkataraman
2021-11-26 13:29         ` Mark Brown
2021-11-26 13:29           ` Mark Brown
2021-11-26 17:23           ` Madhavan T. Venkataraman
2021-11-26 17:23             ` Madhavan T. Venkataraman
2021-11-23 19:37   ` [PATCH v11 5/5] arm64: Create a list of SYM_CODE functions, check return PC against list madvenka
2021-11-23 19:37     ` madvenka
2021-11-25 15:05     ` Mark Brown
2021-11-25 15:05       ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZ+kLPT+h6ZGw20p@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=jmorris@namei.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=madvenka@linux.microsoft.com \
    --cc=mark.rutland@arm.com \
    --cc=nobuta.keiya@fujitsu.com \
    --cc=sjitindarsingh@gmail.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.