* Bug in get_insn_opcode.
@ 2001-03-02 16:56 Carsten Langgaard
2001-03-02 18:34 ` Jun Sun
2001-03-03 7:21 ` Ralf Baechle
0 siblings, 2 replies; 5+ messages in thread
From: Carsten Langgaard @ 2001-03-02 16:56 UTC (permalink / raw)
To: linux-mips
There is a bug in the function get_insn_opcode in traps.c
As 'epc' is an int pointer here, it should only be increased by 1 (4
byte) and not by 4 (4*4 = 16 bytes).
See the patch below.
/Carsten
Index: arch/mips/kernel/traps.c
===================================================================
RCS file: /home/repository/sw/linux-2.4.0/arch/mips/kernel/traps.c,v
retrieving revision 1.10
diff -u -r1.10 traps.c
--- traps.c 2001/02/28 13:46:43 1.10
+++ traps.c 2001/03/02 16:50:27
@@ -410,7 +410,7 @@
epc = (unsigned int *) (unsigned long) regs->cp0_epc;
if (regs->cp0_cause & CAUSEF_BD)
- epc += 4;
+ epc++;
if (verify_area(VERIFY_READ, epc, 4)) {
force_sig(SIGSEGV, current);
Index: arch/mips64/kernel/traps.c
===================================================================
RCS file: /home/repository/sw/linux-2.4.0/arch/mips64/kernel/traps.c,v
retrieving revision 1.5
diff -u -r1.5 traps.c
--- traps.c 2001/02/19 16:02:52 1.5
+++ traps.c 2001/03/02 16:50:13
@@ -371,7 +371,7 @@
epc = (unsigned int *) (unsigned long) regs->cp0_epc;
if (regs->cp0_cause & CAUSEF_BD)
- epc += 4;
+ epc++;
if (verify_area(VERIFY_READ, epc, 4)) {
force_sig(SIGSEGV, current);
--
_ _ ____ ___ Carsten Langgaard Mailto:carstenl@mips.com
|\ /|||___)(___ MIPS Denmark Direct: +45 4486 5527
| \/ ||| ____) Lautrupvang 4B Switch: +45 4486 5555
TECHNOLOGIES 2750 Ballerup Fax...: +45 4486 5556
Denmark http://www.mips.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug in get_insn_opcode.
2001-03-02 16:56 Bug in get_insn_opcode Carsten Langgaard
@ 2001-03-02 18:34 ` Jun Sun
2001-03-03 7:21 ` Ralf Baechle
1 sibling, 0 replies; 5+ messages in thread
From: Jun Sun @ 2001-03-02 18:34 UTC (permalink / raw)
To: Carsten Langgaard; +Cc: linux-mips
On Fri, Mar 02, 2001 at 05:56:48PM +0100, Carsten Langgaard wrote:
> There is a bug in the function get_insn_opcode in traps.c
>
> As 'epc' is an int pointer here, it should only be increased by 1 (4
> byte) and not by 4 (4*4 = 16 bytes).
> See the patch below.
>
> /Carsten
>
Good catch!
I am surprised that trap on branch delay slot is rare that we only discover
this bug now ...
Jun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug in get_insn_opcode.
2001-03-02 16:56 Bug in get_insn_opcode Carsten Langgaard
2001-03-02 18:34 ` Jun Sun
@ 2001-03-03 7:21 ` Ralf Baechle
2001-03-03 15:15 ` Geert Uytterhoeven
1 sibling, 1 reply; 5+ messages in thread
From: Ralf Baechle @ 2001-03-03 7:21 UTC (permalink / raw)
To: Carsten Langgaard; +Cc: linux-mips
On Fri, Mar 02, 2001 at 05:56:48PM +0100, Carsten Langgaard wrote:
> Date: Fri, 02 Mar 2001 17:56:48 +0100
> From: Carsten Langgaard <carstenl@mips.com>
> To: linux-mips@oss.sgi.com
> Subject: Bug in get_insn_opcode.
>
> There is a bug in the function get_insn_opcode in traps.c
>
> As 'epc' is an int pointer here, it should only be increased by 1 (4
> byte) and not by 4 (4*4 = 16 bytes).
> See the patch below.
> Index: arch/mips/kernel/traps.c
> ===================================================================
> RCS file: /home/repository/sw/linux-2.4.0/arch/mips/kernel/traps.c,v
> retrieving revision 1.10
> diff -u -r1.10 traps.c
> --- traps.c 2001/02/28 13:46:43 1.10
> +++ traps.c 2001/03/02 16:50:27
Patch will behave (un-)funny on a cvs diff generated patch like this which
lacks full pathnames in the --- and +++ lines. Patches for this
behaviour are available on ftp.cyclic.com (so it still exists ...) or in
more recent cvs rpms.
Applied anyway, of course.
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug in get_insn_opcode.
2001-03-03 7:21 ` Ralf Baechle
@ 2001-03-03 15:15 ` Geert Uytterhoeven
2001-03-04 19:48 ` Ralf Baechle
0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2001-03-03 15:15 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Carsten Langgaard, linux-mips
On Sat, 3 Mar 2001, Ralf Baechle wrote:
> On Fri, Mar 02, 2001 at 05:56:48PM +0100, Carsten Langgaard wrote:
> > Index: arch/mips/kernel/traps.c
> > ===================================================================
> > RCS file: /home/repository/sw/linux-2.4.0/arch/mips/kernel/traps.c,v
> > retrieving revision 1.10
> > diff -u -r1.10 traps.c
> > --- traps.c 2001/02/28 13:46:43 1.10
> > +++ traps.c 2001/03/02 16:50:27
>
> Patch will behave (un-)funny on a cvs diff generated patch like this which
> lacks full pathnames in the --- and +++ lines. Patches for this
> behaviour are available on ftp.cyclic.com (so it still exists ...) or in
> more recent cvs rpms.
Isn't patch supposed to look at the `Index' line?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug in get_insn_opcode.
2001-03-03 15:15 ` Geert Uytterhoeven
@ 2001-03-04 19:48 ` Ralf Baechle
0 siblings, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2001-03-04 19:48 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Carsten Langgaard, linux-mips
On Sat, Mar 03, 2001 at 04:15:05PM +0100, Geert Uytterhoeven wrote:
> > > Index: arch/mips/kernel/traps.c
> > > ===================================================================
> > > RCS file: /home/repository/sw/linux-2.4.0/arch/mips/kernel/traps.c,v
> > > retrieving revision 1.10
> > > diff -u -r1.10 traps.c
> > > --- traps.c 2001/02/28 13:46:43 1.10
> > > +++ traps.c 2001/03/02 16:50:27
> >
> > Patch will behave (un-)funny on a cvs diff generated patch like this which
> > lacks full pathnames in the --- and +++ lines. Patches for this
> > behaviour are available on ftp.cyclic.com (so it still exists ...) or in
> > more recent cvs rpms.
>
> Isn't patch supposed to look at the `Index' line?
Only when the environment variable POSIXLY_CORRECT is set to y which has
a ton of other unwanted side effects, so patch would need wrapper scripts
or what not else.
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-03-04 19:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-02 16:56 Bug in get_insn_opcode Carsten Langgaard
2001-03-02 18:34 ` Jun Sun
2001-03-03 7:21 ` Ralf Baechle
2001-03-03 15:15 ` Geert Uytterhoeven
2001-03-04 19:48 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox