From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: kernel test robot <fengguang.wu@intel.com>, LKP <lkp@01.org>,
linux-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org,
dma <dmaengine@vger.kernel.org>,
linux-samsung-soc@vger.kernel.org,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
USB list <linux-usb@vger.kernel.org>,
Vinod Koul <vinod.koul@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
wfg@linux.intel.com
Subject: Re: 4879b7ae05 ("Merge tag 'dmaengine-4.12-rc1' of .."): WARNING: kernel stack regs at bd92bc2e in 01-cpu-hotplug:3811 has bad 'bp' value 000001be
Date: Mon, 2 Oct 2017 20:17:17 -0500 [thread overview]
Message-ID: <20171003011717.gl6sbyoykb3lzhed@treble> (raw)
In-Reply-To: <CA+55aFwo4U3vHFtKyCrGaumcfCMszfS48QSxNfEC3pD5wLxQnA@mail.gmail.com>
On Mon, Oct 02, 2017 at 02:58:08PM -0700, Linus Torvalds wrote:
> On Mon, Oct 2, 2017 at 2:26 PM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >
> > The bisect is pointing to a commit which is almost 5 months old, so this
> > is pre-ORC. Kallsyms *is* enabled, but the unwinder dump isn't smart
> > enough to realize it's dumping misaligned stack addresses:
>
> Ahh, I didn't pick up on that "esp isn't aligned" part.
>
> That said, if %esp gets unaligned at some point, it's not clear
> exactly when we should align it. An unaligned stack pointer will
> continue to _work_ just potentially perform fairly badly.
True, but unaligned stacks seem to be very rare, and I don't remember
ever seeing one with frame pointers enabled. I think the call return
addresses will always be aligned, so I think it makes sense to align the
starting address before dumping.
> But more likely, we picked the wrong frame value to begin with.
Agreed.
> For example, maybe that decode_frame_pointer() logic really should
> check not that the low bit in bp is set, but instead check that it's a
> valid "unsigned long *" that has the low bit set.
>
> IOW, the difference would be that instead of checking
>
> if (!(regs & 0x1))
> return NULL;
>
> if would check
>
> if ((regs & (sizeof(unsigned long)-1)) != 1)
> return NULL;
Yeah, that would be an improvement.
> but also maybe add logic to simply not trust a next frame pointer that
> isn't appropriately aligned.
Also a good idea.
> So I think adding PTR_ALIGN() there in the unwind dumper might be a
> bit late. By that time it has already accepted what looks like a
> garbage frame. No?
Yeah, maybe. I guess it really depends on what exactly the root cause
is. It got a bad frame pointer somehow, but maybe not *too* bad because
it still ended up in the task stack somehow. It's not clear how that
happened, but it's possible the task stack had some clues about what led
up to it.
I'll implement your suggestions in addition to the patch to align sp in
the dump code. Having all of them together would hopefully enable the
unwinder to detect a bad condition as early as possible and also do a
better job at dumping it.
--
Josh
prev parent reply other threads:[~2017-10-03 1:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-01 23:17 4879b7ae05 ("Merge tag 'dmaengine-4.12-rc1' of .."): WARNING: kernel stack regs at bd92bc2e in 01-cpu-hotplug:3811 has bad 'bp' value 000001be kernel test robot
2017-10-02 20:09 ` Linus Torvalds
[not found] ` <CA+55aFz_ijfUxyk2kdLhfzfS1z0_uRBw6eQb9UxFvh=5zOzzaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-02 21:26 ` Josh Poimboeuf
2017-10-02 21:31 ` Josh Poimboeuf
2017-10-03 3:45 ` Fengguang Wu
2017-10-03 13:21 ` Josh Poimboeuf
2017-10-03 13:45 ` Fengguang Wu
2017-10-02 21:58 ` Linus Torvalds
2017-10-03 1:17 ` Josh Poimboeuf [this message]
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=20171003011717.gl6sbyoykb3lzhed@treble \
--to=jpoimboe@redhat.com \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=fengguang.wu@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lkp@01.org \
--cc=torvalds@linux-foundation.org \
--cc=vinod.koul@intel.com \
--cc=wfg@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox