From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: aout-core: zero thread debug registers in a.out core dump
Date: Thu, 10 Mar 2011 10:15:36 -0000 [thread overview]
Message-ID: <000701cbdf0c$19272af0$4b7580d0$@deacon@arm.com> (raw)
In-Reply-To: <AANLkTi=uhEfpv1bD_Wtoq4i7kJ5D8yDFmqBwchAnqtXu@mail.gmail.com>
Hi Bryan,
> > Hi Bryan,
> >
> > Feel free to upgrade your tag on this (signed-off / acked) since this is
> > clearly based on the patch you posted yesterday. I'd like to get this to
> > Russell ASAP so that we don't get a build-breaker in the near future.
> >
>
> Oh, I missed this email. Just send out an similar patch.
No problem, I'd just like to get this in the pipeline asap!
> > diff --git a/arch/arm/include/asm/a.out-core.h b/arch/arm/include/asm/a.out-core.h
> > index 93d04ac..92f10cb 100644
> > --- a/arch/arm/include/asm/a.out-core.h
> > +++ b/arch/arm/include/asm/a.out-core.h
> > @@ -32,11 +32,7 @@ static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
> > ? ? ? ?dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> PAGE_SHIFT;
> > ? ? ? ?dump->u_ssize = 0;
> >
> > - ? ? ? dump->u_debugreg[0] = tsk->thread.debug.bp[0].address;
> > - ? ? ? dump->u_debugreg[1] = tsk->thread.debug.bp[1].address;
> > - ? ? ? dump->u_debugreg[2] = tsk->thread.debug.bp[0].insn.arm;
> > - ? ? ? dump->u_debugreg[3] = tsk->thread.debug.bp[1].insn.arm;
> > - ? ? ? dump->u_debugreg[4] = tsk->thread.debug.nsaved;
> > + ? ? ? memset(dump->u_debugreg, 0, sizeof(dump->u_debugreg));
> >
> I think this should be
> memset(dump->u_debugreg, 0, sizeof(dump->u_debugreg) * 8);
>
> u_debugreg is a pointer to a int, the array contains 8 of them as we
> found in the user.h
dump_udebugreg is an integer array of fixed size. If you look at
the disassembly of fs/binfmt_aout.o (removed some inlining,
recompiled with -01):
00000c7c <aout_dump_thread>:
c7c: e92d4038 push {r3, r4, r5, lr}
c80: e1a05000 mov r5, r0
c84: e1a04001 mov r4, r1
c88: e1a0200d mov r2, sp
[...]
cfc: e2840090 add r0, r4, #144 ; 0x90
d00: e3a01020 mov r1, #32
d04: ebfffffe bl 0 <__memzero>
So the size from sizeof is correct, multiplying it by 8 is asking
for trouble! If we used the ARRAY_SIZE macro, then the multiplication
would be necessary because we would have performed the division inside
the macro.
Please can you submit another patch? I think the one I posted the other
day was alright, so if you re-post that you can add my S-o-B.
Thanks,
Will
next prev parent reply other threads:[~2011-03-10 10:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-08 10:57 [PATCH] ARM: aout-core: zero thread debug registers in a.out core dump Will Deacon
2011-03-10 3:43 ` Bryan Wu
2011-03-10 10:15 ` Will Deacon [this message]
[not found] ` <-4405681450588494999@unknownmsgid>
2011-03-10 11:06 ` Bryan Wu
2011-03-10 13:08 ` Will Deacon
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='000701cbdf0c$19272af0$4b7580d0$@deacon@arm.com' \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).