All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Will Deacon <will@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Android Kernel Team <kernel-team@android.com>,
	Mark Brown <broonie@kernel.org>, Marco Elver <elver@google.com>,
	Chen Jun <chenjun102@huawei.com>
Subject: Re: [PATCH] arm64: stacktrace: don't trace arch_stack_walk()
Date: Mon, 22 Mar 2021 16:57:22 +0100	[thread overview]
Message-ID: <CAMj1kXGpFW73sO0viR7_kwuVDgKSUzbn-FeZZi14tYj2DpDjpA@mail.gmail.com> (raw)
In-Reply-To: <161641697038.3900410.16800195752008718733.b4-ty@kernel.org>

On Mon, 22 Mar 2021 at 14:26, Will Deacon <will@kernel.org> wrote:
>
> On Fri, 19 Mar 2021 18:41:06 +0000, Mark Rutland wrote:
> > We recently converted arm64 to use arch_stack_walk() in commit:
> >
> >   5fc57df2f6fd ("arm64: stacktrace: Convert to ARCH_STACKWALK")
> >
> > The core stacktrace code expects that (when tracing the current task)
> > arch_stack_walk() starts a trace at its caller, and does not include
> > itself in the trace. However, arm64's arch_stack_walk() includes itself,
> > and so traces include one more entry than callers expect. The core
> > stacktrace code which calls arch_stack_walk() tries to skip a number of
> > entries to prevent itself appearing in a trace, and the additional entry
> > prevents skipping one of the core stacktrace functions, leaving this in
> > the trace unexpectedly.
> >
> > [...]
>
> Applied to arm64 (for-next/fixes), thanks!
>
> [1/1] arm64: stacktrace: don't trace arch_stack_walk()
>       https://git.kernel.org/arm64/c/c607ab4f916d
>

Ehm, did anyone check if the following caveat regarding
__builtin_frame_address() applies on arm64? (from the GCC man page
[0])

"""
Calling this function with a nonzero argument can have unpredictable
effects, including crashing the calling program. As a result, calls
that are considered unsafe are diagnosed when the -Wframe-address
option is in effect. Such calls should only be made in debugging
situations.
"""

[0] https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html

WARNING: multiple messages have this Message-ID (diff)
From: Ard Biesheuvel <ardb@kernel.org>
To: Will Deacon <will@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	 Linux ARM <linux-arm-kernel@lists.infradead.org>,
	 Catalin Marinas <catalin.marinas@arm.com>,
	Android Kernel Team <kernel-team@android.com>,
	 Mark Brown <broonie@kernel.org>, Marco Elver <elver@google.com>,
	Chen Jun <chenjun102@huawei.com>
Subject: Re: [PATCH] arm64: stacktrace: don't trace arch_stack_walk()
Date: Mon, 22 Mar 2021 16:57:22 +0100	[thread overview]
Message-ID: <CAMj1kXGpFW73sO0viR7_kwuVDgKSUzbn-FeZZi14tYj2DpDjpA@mail.gmail.com> (raw)
In-Reply-To: <161641697038.3900410.16800195752008718733.b4-ty@kernel.org>

On Mon, 22 Mar 2021 at 14:26, Will Deacon <will@kernel.org> wrote:
>
> On Fri, 19 Mar 2021 18:41:06 +0000, Mark Rutland wrote:
> > We recently converted arm64 to use arch_stack_walk() in commit:
> >
> >   5fc57df2f6fd ("arm64: stacktrace: Convert to ARCH_STACKWALK")
> >
> > The core stacktrace code expects that (when tracing the current task)
> > arch_stack_walk() starts a trace at its caller, and does not include
> > itself in the trace. However, arm64's arch_stack_walk() includes itself,
> > and so traces include one more entry than callers expect. The core
> > stacktrace code which calls arch_stack_walk() tries to skip a number of
> > entries to prevent itself appearing in a trace, and the additional entry
> > prevents skipping one of the core stacktrace functions, leaving this in
> > the trace unexpectedly.
> >
> > [...]
>
> Applied to arm64 (for-next/fixes), thanks!
>
> [1/1] arm64: stacktrace: don't trace arch_stack_walk()
>       https://git.kernel.org/arm64/c/c607ab4f916d
>

Ehm, did anyone check if the following caveat regarding
__builtin_frame_address() applies on arm64? (from the GCC man page
[0])

"""
Calling this function with a nonzero argument can have unpredictable
effects, including crashing the calling program. As a result, calls
that are considered unsafe are diagnosed when the -Wframe-address
option is in effect. Such calls should only be made in debugging
situations.
"""

[0] https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html

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

  reply	other threads:[~2021-03-22 15:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 18:41 [PATCH] arm64: stacktrace: don't trace arch_stack_walk() Mark Rutland
2021-03-19 18:41 ` Mark Rutland
2021-03-19 19:02 ` Catalin Marinas
2021-03-19 19:02   ` Catalin Marinas
2021-03-22 13:01   ` Mark Rutland
2021-03-22 13:01     ` Mark Rutland
2021-03-22 12:13 ` Mark Brown
2021-03-22 12:13   ` Mark Brown
2021-03-22 13:19 ` Will Deacon
2021-03-22 13:19   ` Will Deacon
2021-03-22 15:57   ` Ard Biesheuvel [this message]
2021-03-22 15:57     ` Ard Biesheuvel
2021-03-22 16:05     ` Ard Biesheuvel
2021-03-22 16:05       ` Ard Biesheuvel

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=CAMj1kXGpFW73sO0viR7_kwuVDgKSUzbn-FeZZi14tYj2DpDjpA@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=chenjun102@huawei.com \
    --cc=elver@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.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.