All of lore.kernel.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	Nicholas Miehlbradt <nicholas@linux.ibm.com>
Subject: Re: [PATCH] powerpc/64: Implement arch_within_stack_frames
Date: Wed, 14 Dec 2022 18:17:25 -0600	[thread overview]
Message-ID: <20221215001725.GS25951@gate.crashing.org> (raw)
In-Reply-To: <CP1IFJNCTTZ4.33ROBE5VAFAKM@bobo>

On Wed, Dec 14, 2022 at 09:39:25PM +1000, Nicholas Piggin wrote:
> What about just copying x86's implementation including using
> __builtin_frame_address(1/2)? Are those builtins reliable for all
> our targets and compiler versions?

__builtin_frame_address(n) with n > 0 is specifically not supported, not
on any architecture; it does not work in all situations on *any* arch,
and not in *any* situation on some archs.

This is clearly documented:

     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.

(and that warning is enabled by -Wall).


Segher

  parent reply	other threads:[~2022-12-15  0:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14  4:42 [PATCH] powerpc/64: Implement arch_within_stack_frames Nicholas Miehlbradt
2022-12-14  8:39 ` Christophe Leroy
2022-12-14 11:39   ` Nicholas Piggin
2022-12-14 11:48     ` Christophe Leroy
2022-12-14 11:54       ` Christophe Leroy
2022-12-15  0:17     ` Segher Boessenkool [this message]
2022-12-15  0:52       ` Nicholas Piggin
2022-12-15 16:29         ` Segher Boessenkool
2022-12-15 17:16           ` Segher Boessenkool
2022-12-19  6:32     ` Nicholas Miehlbradt

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=20221215001725.GS25951@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nicholas@linux.ibm.com \
    --cc=npiggin@gmail.com \
    /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.