FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Crash Utility

 
 
LinkBack Thread Tools
 
Old 02-11-2012, 01:30 PM
Rabin Vincent
 
Default ARM: fix unwinding on recent kernels

Unwinding doesn't work on recent ARM kernels since after the following
commit the kernel doesn't perform the prel31_to_addr() conversion of the
offsets in the index table. The leads to crash not finding the correct
unwind instructions.

http://git.kernel.org/linus/de66a979012dbc66b1ec0125795a3f79ee667b8a

The patch below makes crash do the conversion itself if necessary.

Rabin

diff --git a/unwind_arm.c b/unwind_arm.c
index d86ec63..e804cfb 100644
--- a/unwind_arm.c
+++ b/unwind_arm.c
@@ -71,6 +71,8 @@ struct unwind_table {
static struct unwind_table *kernel_unwind_table;
static struct unwind_table *module_unwind_tables;

+static int index_in_prel31;
+
struct unwind_ctrl_block {
ulong vrs[16];
ulong insn;
@@ -104,6 +106,7 @@ static int is_core_kernel_text(ulong);
static struct unwind_table *search_table(ulong);
static struct unwind_idx *search_index(const struct unwind_table *, ulong);
static ulong prel31_to_addr(ulong, ulong);
+static void index_prel31_to_addr(struct unwind_table *);
static int unwind_frame(struct stackframe *, ulong);

/*
@@ -187,6 +190,8 @@ init_kernel_unwind_table(void)
goto fail;
}

+ index_in_prel31 = !is_kernel_text(kernel_unwind_table->idx[0].addr);
+
kernel_unwind_table->start = kernel_unwind_table->idx;
kernel_unwind_table->end = (struct unwind_idx *)
((char *)kernel_unwind_table->idx + idx_size);
@@ -194,6 +199,9 @@ init_kernel_unwind_table(void)
kernel_unwind_table->end_addr = (kernel_unwind_table->end - 1)->addr;
kernel_unwind_table->kv_base = idx_start;

+ if (index_in_prel31)
+ index_prel31_to_addr(kernel_unwind_table);
+
if (CRASHDEBUG(1)) {
fprintf(fp, "UNWIND: master kernel table start
");
fprintf(fp, "UNWIND: size : %ld
", idx_size);
@@ -260,6 +268,9 @@ read_module_unwind_table(struct unwind_table *tbl, ulong addr)
tbl->end_addr = TABLE_VALUE(buf, unwind_table_end_addr);
tbl->kv_base = idx_start;

+ if (index_in_prel31)
+ index_prel31_to_addr(tbl);
+
if (CRASHDEBUG(1)) {
fprintf(fp, "UNWIND: module table start
");
fprintf(fp, "UNWIND: start : %p
", tbl->start);
@@ -571,6 +582,16 @@ prel31_to_addr(ulong addr, ulong insn)
return addr + offset;
}

+static void
+index_prel31_to_addr(struct unwind_table *tbl)
+{
+ struct unwind_idx *idx = tbl->start;
+ ulong kvaddr = tbl->kv_base;
+
+ for (; idx < tbl->end; idx++, kvaddr += sizeof(struct unwind_idx))
+ idx->addr = prel31_to_addr(kvaddr, idx->addr);
+}
+
static int
unwind_frame(struct stackframe *frame, ulong stacktop)
{

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 02-13-2012, 07:01 AM
Mika Westerberg
 
Default ARM: fix unwinding on recent kernels

On Sat, Feb 11, 2012 at 08:00:34PM +0530, Rabin Vincent wrote:
> Unwinding doesn't work on recent ARM kernels since after the following
> commit the kernel doesn't perform the prel31_to_addr() conversion of the
> offsets in the index table. The leads to crash not finding the correct
> unwind instructions.
>
> http://git.kernel.org/linus/de66a979012dbc66b1ec0125795a3f79ee667b8a
>
> The patch below makes crash do the conversion itself if necessary.
>
> Rabin
>
> diff --git a/unwind_arm.c b/unwind_arm.c
> index d86ec63..e804cfb 100644
> --- a/unwind_arm.c
> +++ b/unwind_arm.c
> @@ -71,6 +71,8 @@ struct unwind_table {
> static struct unwind_table *kernel_unwind_table;
> static struct unwind_table *module_unwind_tables;
>
> +static int index_in_prel31;
> +
> struct unwind_ctrl_block {
> ulong vrs[16];
> ulong insn;
> @@ -104,6 +106,7 @@ static int is_core_kernel_text(ulong);
> static struct unwind_table *search_table(ulong);
> static struct unwind_idx *search_index(const struct unwind_table *, ulong);
> static ulong prel31_to_addr(ulong, ulong);
> +static void index_prel31_to_addr(struct unwind_table *);
> static int unwind_frame(struct stackframe *, ulong);
>
> /*
> @@ -187,6 +190,8 @@ init_kernel_unwind_table(void)
> goto fail;
> }
>
> + index_in_prel31 = !is_kernel_text(kernel_unwind_table->idx[0].addr);

Maybe add some comment explaining why we do this check (a reference to the
kernel commit perhaps)?

Otherwise looks good and my older ARM crashdumps still seem to work with this
change.

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 02-13-2012, 03:59 PM
Dave Anderson
 
Default ARM: fix unwinding on recent kernels

----- Original Message -----
> On Sat, Feb 11, 2012 at 08:00:34PM +0530, Rabin Vincent wrote:
> > Unwinding doesn't work on recent ARM kernels since after the following
> > commit the kernel doesn't perform the prel31_to_addr() conversion of the
> > offsets in the index table. The leads to crash not finding the correct
> > unwind instructions.
> >
> > http://git.kernel.org/linus/de66a979012dbc66b1ec0125795a3f79ee667b8a
> >
> > The patch below makes crash do the conversion itself if necessary.
> >
> > Rabin
> >
> > diff --git a/unwind_arm.c b/unwind_arm.c
> > index d86ec63..e804cfb 100644
> > --- a/unwind_arm.c
> > +++ b/unwind_arm.c
> > @@ -71,6 +71,8 @@ struct unwind_table {
> > static struct unwind_table *kernel_unwind_table;
> > static struct unwind_table *module_unwind_tables;
> >
> > +static int index_in_prel31;
> > +
> > struct unwind_ctrl_block {
> > ulong vrs[16];
> > ulong insn;
> > @@ -104,6 +106,7 @@ static int is_core_kernel_text(ulong);
> > static struct unwind_table *search_table(ulong);
> > static struct unwind_idx *search_index(const struct unwind_table
> > *, ulong);
> > static ulong prel31_to_addr(ulong, ulong);
> > +static void index_prel31_to_addr(struct unwind_table *);
> > static int unwind_frame(struct stackframe *, ulong);
> >
> > /*
> > @@ -187,6 +190,8 @@ init_kernel_unwind_table(void)
> > goto fail;
> > }
> >
> > + index_in_prel31 =
> > !is_kernel_text(kernel_unwind_table->idx[0].addr);
>
> Maybe add some comment explaining why we do this check (a reference to the
> kernel commit perhaps)?

I agree about the comment -- and then some...

This seems to be a fairly signficant piece of information to be hidden
in a static variable:

+static int index_in_prel31;

Can you put it in the ARM machine_specific data structure? And then
display it in arm_dump_machdep_table() for "help -m".

Thanks,
Dave



--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

Mon Feb 13 19:30:01 2012
Return-path: <arch-general-bounces@archlinux.org>
Envelope-to: tom@linux-archive.org
Delivery-date: Mon, 13 Feb 2012 19:02:08 +0200
Received: from gerolde.archlinux.org ([66.211.214.132]:42011)
by s2.java-tips.org with esmtp (Exim 4.69)
(envelope-from <arch-general-bounces@archlinux.org>)
id 1RwzHz-0003D6-Vn
for tom@linux-archive.org; Mon, 13 Feb 2012 19:02:08 +0200
Received: from gudrun.archlinux.org (gudrun.archlinux.org [66.211.214.131])
by gerolde.archlinux.org (Postfix) with ESMTP id E15079004A;
Mon, 13 Feb 2012 12:02:05 -0500 (EST)
Received: from gerolde.archlinux.org (gerolde.archlinux.org [66.211.214.132])
by gudrun.archlinux.org (Postfix) with ESMTP id D92C5921A4
for <arch-general@archlinux.org>; Mon, 13 Feb 2012 12:02:03 -0500 (EST)
Received-SPF: pass (bounce.linkedin.com ... linkedin.com: 69.28.147.147 is
authorized to use
's-uYzc6fhOYX7HgLOsr4I9w-GRUH7m5CksUJkRe3nocm7qSAOkRFdG5G@bounce.linkedin.c om'
in 'mfrom' identity (mechanism 'ip4:69.28.147.128/26' matched))
receiver=gerolde.archlinux.org; identity=mailfrom;
envelope-from="s-uYzc6fhOYX7HgLOsr4I9w-GRUH7m5CksUJkRe3nocm7qSAOkRFdG5G@bounce.linkedin.c om";
helo=mailb-ab.linkedin.com; client-ip=69.28.147.147
Received: from mailb-ab.linkedin.com (mailb-ab.linkedin.com [69.28.147.147])
by gerolde.archlinux.org (Postfix) with ESMTP id 849F790046
for <arch-general@archlinux.org>; Mon, 13 Feb 2012 12:02:03 -0500 (EST)
DomainKey-Signature: q=dns; a=rsa-sha1; c=nofws; s=prod; d=linkedin.com;
h=DKIM-Signature:Senderate:From:Reply-To:To:Message-ID:Subject:MIME-Version:Content-Type:X-LinkedIn-Template:X-LinkedIn-Class:X-LinkedIn-fbl;
b=MDggfLbrho5Y/1QofDjANFjxj73x+ZkXPlmtCt4iloQS1JoNQUsAbTbAA0x81JB x
FmMyc+TG4ohd/bEH7fU61sYFt9aAkp68Lwt1LbCRAlc6BJEH5YG/1eJ+ODHKX7N1
DKIM-Signature: v=1; a=rsa-sha1; d=linkedin.com; s=proddkim; c=relaxed/relaxed;
q=dns/txt; i=@linkedin.com; t=1329152527;
h=From:Subjectate:To:MIME-Version:Content-Type:X-LinkedIn-Class:X-LinkedIn-fbl:
X-LinkedIn-Template; bh=7I9ihEz6hNTgmYkvlir/6b5Noy8=;
b=mI3+89ckjZOf6yBBQDVYzu8zVrADFE2Y5bGscOmBsUKm8VEC J3iD8jwLMqU3l4y4
XE/ps5W06WLlYuyIxPT18d1d+Yr+0P3yV+WFwyPuB/xta3HJc02GEvPVfXVHVw2A;
Date: Mon, 13 Feb 2012 17:02:07 +0000 (UTC)
From: =?UTF-8?Q?Erwin_Jos=C3=A9_L=C3=B3pez_Pulgar=C3=ADn_via_L inkedIn?=
<member@linkedin.com>
To: "Gergely I." <arch-general@archlinux.org>
Message-ID: <209021706.9963188.1329152527097.JavaMail.app@el a4-app0129.prod>
MIME-Version: 1.0
X-LinkedIn-Template: invite_member_28
X-LinkedIn-Class: INVITE-MBR
X-LinkedIn-fbl: s-uYzc6fhOYX7HgLOsr4I9w-GRUH7m5CksUJkRe3nocm7qSAOkRFdG5G
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
Subject: [arch-general] Join my network on LinkedIn
X-BeenThere: arch-general@archlinux.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: =?ISO-8859-1?Q?Erwin_Jos=E9_L=F3pez_Pulgar=EDn?=
<erwinkendo@gmail.com>,
General Discussion about Arch Linux <arch-general@archlinux.org>
List-Id: General Discussion about Arch Linux <arch-general.archlinux.org>
List-Unsubscribe: <http://mailman.archlinux.org/mailman/options/arch-general>,
<mailto:arch-general-request@archlinux.org?subject=unsubscribe>
List-Archive: <http://mailman.archlinux.org/pipermail/arch-general>
List-Post: <mailto:arch-general@archlinux.org>
List-Help: <mailto:arch-general-request@archlinux.org?subject=help>
List-Subscribe: <http://mailman.archlinux.org/mailman/listinfo/arch-general>,
<mailto:arch-general-request@archlinux.org?subject=subscribe>
Errors-To: arch-general-bounces@archlinux.org
Sender: arch-general-bounces@archlinux.org

LinkedIn
------------




Erwin Jos=C3=A9 L=C3=B3pez Pulgar=C3=ADn requested to add you as a conn=
ection on LinkedIn:
=20

------------------------------------------

I'd like to add you to my professional network on LinkedIn.

Accept invitation from Erwin Jos=C3=A9 L=C3=B3pez Pulgar=C3=ADn
http://www.linkedin.com/e/j2jirp-gylr3hmd-5n/URVwc-9dcTd5kGQV68qFBFAwcTxbHZ=
htaNkxhTYz/blk/I179420958_70/1BpC5vrmRLoRZcjkkZt5YCpnlOt3RApnhMpmdzgmhxrSNB=
szYMdRYUdjAMczgVdP59bS9KlQpMsCxTbP4Mdz4TcjoPdPgLrC BxbOYWrSlI/EML_comm_afe/?=
hs=3Dfalse&tok=3D1eUC4XfK1u1l81

View profile of Erwin Jos=C3=A9 L=C3=B3pez Pulgar=C3=ADn
http://www.linkedin.com/e/j2jirp-gylr3hmd-5n/vpn/101664577/3p9X/name/?hs=3D=
false&tok=3D2hErJx8ZJu1l81
------------------------------------------
You are receiving Invitation emails.


This email was intended for Gergely Imreh.
Learn why this is included: http://www.linkedin.com/e/j2jirp-gylr3hmd-5n/pl=
h/http%3A%2F%2Fhelp%2Elinkedin%2Ecom%2Fapp%2Fanswers %2Fdetail%2Fa_id%2F4788=
/-GXI/?hs=3Dfalse&tok=3D31eGzqKCpu1l81

(c) 2012, LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, =
USA.
 
Old 02-14-2012, 12:47 PM
Rabin Vincent
 
Default ARM: fix unwinding on recent kernels

On Mon, Feb 13, 2012 at 11:59:04AM -0500, Dave Anderson wrote:
> > Maybe add some comment explaining why we do this check (a reference to the
> > kernel commit perhaps)?
>
> I agree about the comment -- and then some...
>
> This seems to be a fairly signficant piece of information to be hidden
> in a static variable:
>
> +static int index_in_prel31;
>
> Can you put it in the ARM machine_specific data structure? And then
> display it in arm_dump_machdep_table() for "help -m".

Here's a v2 of the patch.

Rabin

diff --git a/arm.c b/arm.c
index 4ca2fcd..4be224e 100644
--- a/arm.c
+++ b/arm.c
@@ -406,6 +406,7 @@ arm_dump_machdep_table(ulong arg)
fprintf(fp, "exception_text_start: %lx
", ms->exception_text_start);
fprintf(fp, " exception_text_end: %lx
", ms->exception_text_end);
fprintf(fp, " crash_task_regs: %lx
", (ulong)ms->crash_task_regs);
+ fprintf(fp, "unwind_index_prel31: %d
", ms->unwind_index_prel31);
}

/*
diff --git a/defs.h b/defs.h
index 82d51e5..2e7f6bd 100755
--- a/defs.h
+++ b/defs.h
@@ -4241,6 +4241,7 @@ struct machine_specific {
ulong exception_text_start;
ulong exception_text_end;
struct arm_pt_regs *crash_task_regs;
+ int unwind_index_prel31;
};

int init_unwind_tables(void);
diff --git a/unwind_arm.c b/unwind_arm.c
index d86ec63..640d6c9 100644
--- a/unwind_arm.c
+++ b/unwind_arm.c
@@ -104,6 +104,7 @@ static int is_core_kernel_text(ulong);
static struct unwind_table *search_table(ulong);
static struct unwind_idx *search_index(const struct unwind_table *, ulong);
static ulong prel31_to_addr(ulong, ulong);
+static void index_prel31_to_addr(struct unwind_table *);
static int unwind_frame(struct stackframe *, ulong);

/*
@@ -187,6 +188,19 @@ init_kernel_unwind_table(void)
goto fail;
}

+ /*
+ * Kernel versions before v3.2 (specifically, before commit
+ * de66a979012db "ARM: 7187/1: fix unwinding for XIP kernels")
+ * converted the prel31 offsets in the unwind index table to absolute
+ * addresses on startup. Newer kernels don't perform this conversion,
+ * and have a slightly more involved search algorithm.
+ *
+ * We always just use the older search method (a straightforward binary
+ * search) and convert the index table offsets ourselves if we detect
+ * that the kernel didn't do it.
+ */
+ machdep->machspec->unwind_index_prel31 = !is_kernel_text(kernel_unwind_table->idx[0].addr);
+
kernel_unwind_table->start = kernel_unwind_table->idx;
kernel_unwind_table->end = (struct unwind_idx *)
((char *)kernel_unwind_table->idx + idx_size);
@@ -194,6 +208,9 @@ init_kernel_unwind_table(void)
kernel_unwind_table->end_addr = (kernel_unwind_table->end - 1)->addr;
kernel_unwind_table->kv_base = idx_start;

+ if (machdep->machspec->unwind_index_prel31)
+ index_prel31_to_addr(kernel_unwind_table);
+
if (CRASHDEBUG(1)) {
fprintf(fp, "UNWIND: master kernel table start
");
fprintf(fp, "UNWIND: size : %ld
", idx_size);
@@ -260,6 +277,9 @@ read_module_unwind_table(struct unwind_table *tbl, ulong addr)
tbl->end_addr = TABLE_VALUE(buf, unwind_table_end_addr);
tbl->kv_base = idx_start;

+ if (machdep->machspec->unwind_index_prel31)
+ index_prel31_to_addr(tbl);
+
if (CRASHDEBUG(1)) {
fprintf(fp, "UNWIND: module table start
");
fprintf(fp, "UNWIND: start : %p
", tbl->start);
@@ -571,6 +591,16 @@ prel31_to_addr(ulong addr, ulong insn)
return addr + offset;
}

+static void
+index_prel31_to_addr(struct unwind_table *tbl)
+{
+ struct unwind_idx *idx = tbl->start;
+ ulong kvaddr = tbl->kv_base;
+
+ for (; idx < tbl->end; idx++, kvaddr += sizeof(struct unwind_idx))
+ idx->addr = prel31_to_addr(kvaddr, idx->addr);
+}
+
static int
unwind_frame(struct stackframe *frame, ulong stacktop)
{

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 02-14-2012, 01:44 PM
Dave Anderson
 
Default ARM: fix unwinding on recent kernels

----- Original Message -----
> On Mon, Feb 13, 2012 at 11:59:04AM -0500, Dave Anderson wrote:
> > > Maybe add some comment explaining why we do this check (a reference to the
> > > kernel commit perhaps)?
> >
> > I agree about the comment -- and then some...
> >
> > This seems to be a fairly signficant piece of information to be hidden
> > in a static variable:
> >
> > +static int index_in_prel31;
> >
> > Can you put it in the ARM machine_specific data structure? And then
> > display it in arm_dump_machdep_table() for "help -m".
>
> Here's a v2 of the patch.
>
> Rabin

Nice -- queued for crash-6.0.4.

Thanks,
Dave


> diff --git a/arm.c b/arm.c
> index 4ca2fcd..4be224e 100644
> --- a/arm.c
> +++ b/arm.c
> @@ -406,6 +406,7 @@ arm_dump_machdep_table(ulong arg)
> fprintf(fp, "exception_text_start: %lx
",
> ms->exception_text_start);
> fprintf(fp, " exception_text_end: %lx
", ms->exception_text_end);
> fprintf(fp, " crash_task_regs: %lx
",
> (ulong)ms->crash_task_regs);
> + fprintf(fp, "unwind_index_prel31: %d
", ms->unwind_index_prel31);
> }
>
> /*
> diff --git a/defs.h b/defs.h
> index 82d51e5..2e7f6bd 100755
> --- a/defs.h
> +++ b/defs.h
> @@ -4241,6 +4241,7 @@ struct machine_specific {
> ulong exception_text_start;
> ulong exception_text_end;
> struct arm_pt_regs *crash_task_regs;
> + int unwind_index_prel31;
> };
>
> int init_unwind_tables(void);
> diff --git a/unwind_arm.c b/unwind_arm.c
> index d86ec63..640d6c9 100644
> --- a/unwind_arm.c
> +++ b/unwind_arm.c
> @@ -104,6 +104,7 @@ static int is_core_kernel_text(ulong);
> static struct unwind_table *search_table(ulong);
> static struct unwind_idx *search_index(const struct unwind_table *,
> ulong);
> static ulong prel31_to_addr(ulong, ulong);
> +static void index_prel31_to_addr(struct unwind_table *);
> static int unwind_frame(struct stackframe *, ulong);
>
> /*
> @@ -187,6 +188,19 @@ init_kernel_unwind_table(void)
> goto fail;
> }
>
> + /*
> + * Kernel versions before v3.2 (specifically, before commit
> + * de66a979012db "ARM: 7187/1: fix unwinding for XIP kernels")
> + * converted the prel31 offsets in the unwind index table to absolute
> + * addresses on startup. Newer kernels don't perform this conversion,
> + * and have a slightly more involved search algorithm.
> + *
> + * We always just use the older search method (a straightforward binary
> + * search) and convert the index table offsets ourselves if we detect
> + * that the kernel didn't do it.
> + */
> + machdep->machspec->unwind_index_prel31 = !is_kernel_text(kernel_unwind_table->idx[0].addr);
> +
> kernel_unwind_table->start = kernel_unwind_table->idx;
> kernel_unwind_table->end = (struct unwind_idx *)
> ((char *)kernel_unwind_table->idx + idx_size);
> @@ -194,6 +208,9 @@ init_kernel_unwind_table(void)
> kernel_unwind_table->end_addr = (kernel_unwind_table->end - 1)->addr;
> kernel_unwind_table->kv_base = idx_start;
>
> + if (machdep->machspec->unwind_index_prel31)
> + index_prel31_to_addr(kernel_unwind_table);
> +
> if (CRASHDEBUG(1)) {
> fprintf(fp, "UNWIND: master kernel table start
");
> fprintf(fp, "UNWIND: size : %ld
", idx_size);
> @@ -260,6 +277,9 @@ read_module_unwind_table(struct unwind_table *tbl, ulong addr)
> tbl->end_addr = TABLE_VALUE(buf, unwind_table_end_addr);
> tbl->kv_base = idx_start;
>
> + if (machdep->machspec->unwind_index_prel31)
> + index_prel31_to_addr(tbl);
> +
> if (CRASHDEBUG(1)) {
> fprintf(fp, "UNWIND: module table start
");
> fprintf(fp, "UNWIND: start : %p
", tbl->start);
> @@ -571,6 +591,16 @@ prel31_to_addr(ulong addr, ulong insn)
> return addr + offset;
> }
>
> +static void
> +index_prel31_to_addr(struct unwind_table *tbl)
> +{
> + struct unwind_idx *idx = tbl->start;
> + ulong kvaddr = tbl->kv_base;
> +
> + for (; idx < tbl->end; idx++, kvaddr += sizeof(struct unwind_idx))
> + idx->addr = prel31_to_addr(kvaddr, idx->addr);
> +}
> +
> static int
> unwind_frame(struct stackframe *frame, ulong stacktop)
> {

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 

Thread Tools




All times are GMT. The time now is 08:42 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org