mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* bmp splash memory corruption
@ 2012-11-20 21:57 Robert Jarzmik
  2012-11-21  9:06 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-21  9:07 ` [PATCH 1/2] splash: init struct allocated the stack to 0 Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 6+ messages in thread
From: Robert Jarzmik @ 2012-11-20 21:57 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

Hi Jean-Christophe,

I'm having another bmp memory corruption, could you have a look at this too :
(gdb) bt
#0  free (mem=0xa3026688) at common/dlmalloc.c:1362
#1  0xa3f242a4 in image_renderer_close (img=0xa2fa5228) at lib/gui/image_renderer.c:69
#2  0xa3f18ea0 in image_renderer_file (argc=2, argv=<value optimized out>) at include/gui/image_renderer.h:69
#3  do_splash (argc=2, argv=<value optimized out>) at commands/splash.c:70
#4  0xa3f05b2c in execute_command (argc=2, argv=0xa2fa4968) at common/command.c:77
#5  0xa3f01964 in run_pipe_real (ctx=0xa2effda8, pi=0xa2fa4288) at common/hush.c:790
#6  run_list_real (ctx=0xa2effda8, pi=0xa2fa4288) at common/hush.c:914
#7  0xa3f01bfc in run_list (ctx=0xa2effda8, inp=0xa2effd7c, flag=2) at common/hush.c:1033
#8  parse_stream_outer (ctx=0xa2effda8, inp=0xa2effd7c, flag=2) at common/hush.c:1618
#9  0xa3f01d80 in parse_string_outer (ctx=0xa2effda8, 
    s=0xa2f01890 "#!/bin/sh\n\nPATH=/env/bin\nexport PATH\n\n. /env/config\naddpart /dev/mtd0 $mtdparts\n\nusbserial -s \"Mio A701 usb gadget\"\nled keyboard 0\n\nsdcard_override\n\nfb0.enable=1\nsplash /dev/mtd0.barebox-logo\n\nmtd_env"..., flag=2) at common/hush.c:1662
#10 0xa3f01e24 in source_script (path=<value optimized out>, argc=<value optimized out>, argv=<value optimized out>) at common/hush.c:1815
#11 0xa3f01fdc in do_source (argc=2, argv=<value optimized out>) at common/hush.c:1877
#12 0xa3f05b2c in execute_command (argc=2, argv=0xa2f01708) at common/command.c:77
#13 0xa3f01964 in run_pipe_real (ctx=0xa2efff58, pi=0xa2f0ffc8) at common/hush.c:790
#14 run_list_real (ctx=0xa2efff58, pi=0xa2f0ffc8) at common/hush.c:914
#15 0xa3f01bfc in run_list (ctx=0xa2efff58, inp=0xa2efff2c, flag=2) at common/hush.c:1033
#16 parse_stream_outer (ctx=0xa2efff58, inp=0xa2efff2c, flag=2) at common/hush.c:1618
#17 0xa3f01d80 in parse_string_outer (ctx=0xa2efff58, s=0xa3f3477a "source /env/bin/init", flag=2) at common/hush.c:1662
#18 0xa3f01eb8 in run_command (cmd=0xa2f7b7fe "\377\377", flag=<value optimized out>) at common/hush.c:1783
#19 0xa3f07428 in start_barebox () at common/startup.c:124
#20 0xa3f33158 in board_init_lowlevel_return () at arch/arm/cpu/start.c:62

(gdb) p *p
$10 = {prev_size = 15, size = 2750562700, fd = 0xa3f24184, bk = 0xa3f23f24}
(gdb) p/x p->size
$11 = 0xa3f2418c
(gdb) p bmp_open
$12 = {struct image *(char *, int)} 0xa3f2418c <bmp_open>

As you can see here, p->size equals bmp_open(), while p is the
mem2chunk(mem). This _seems_ to imply that the memchunk headers were somehow
corrupted by bmp_open address ... hence my mail to see if that rings a bell to
you.

Cheers.

-- 
Robert

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bmp splash memory corruption
  2012-11-20 21:57 bmp splash memory corruption Robert Jarzmik
@ 2012-11-21  9:06 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-21  9:07 ` [PATCH 1/2] splash: init struct allocated the stack to 0 Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21  9:06 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: barebox

On 22:57 Tue 20 Nov     , Robert Jarzmik wrote:
> Hi Jean-Christophe,
try the replied patch
> 
> I'm having another bmp memory corruption, could you have a look at this too :
> (gdb) bt
> #0  free (mem=0xa3026688) at common/dlmalloc.c:1362
> #1  0xa3f242a4 in image_renderer_close (img=0xa2fa5228) at lib/gui/image_renderer.c:69
> #2  0xa3f18ea0 in image_renderer_file (argc=2, argv=<value optimized out>) at include/gui/image_renderer.h:69
> #3  do_splash (argc=2, argv=<value optimized out>) at commands/splash.c:70
> #4  0xa3f05b2c in execute_command (argc=2, argv=0xa2fa4968) at common/command.c:77
> #5  0xa3f01964 in run_pipe_real (ctx=0xa2effda8, pi=0xa2fa4288) at common/hush.c:790
> #6  run_list_real (ctx=0xa2effda8, pi=0xa2fa4288) at common/hush.c:914
> #7  0xa3f01bfc in run_list (ctx=0xa2effda8, inp=0xa2effd7c, flag=2) at common/hush.c:1033
> #8  parse_stream_outer (ctx=0xa2effda8, inp=0xa2effd7c, flag=2) at common/hush.c:1618
> #9  0xa3f01d80 in parse_string_outer (ctx=0xa2effda8, 
>     s=0xa2f01890 "#!/bin/sh\n\nPATH=/env/bin\nexport PATH\n\n. /env/config\naddpart /dev/mtd0 $mtdparts\n\nusbserial -s \"Mio A701 usb gadget\"\nled keyboard 0\n\nsdcard_override\n\nfb0.enable=1\nsplash /dev/mtd0.barebox-logo\n\nmtd_env"..., flag=2) at common/hush.c:1662
> #10 0xa3f01e24 in source_script (path=<value optimized out>, argc=<value optimized out>, argv=<value optimized out>) at common/hush.c:1815
> #11 0xa3f01fdc in do_source (argc=2, argv=<value optimized out>) at common/hush.c:1877
> #12 0xa3f05b2c in execute_command (argc=2, argv=0xa2f01708) at common/command.c:77
> #13 0xa3f01964 in run_pipe_real (ctx=0xa2efff58, pi=0xa2f0ffc8) at common/hush.c:790
> #14 run_list_real (ctx=0xa2efff58, pi=0xa2f0ffc8) at common/hush.c:914
> #15 0xa3f01bfc in run_list (ctx=0xa2efff58, inp=0xa2efff2c, flag=2) at common/hush.c:1033
> #16 parse_stream_outer (ctx=0xa2efff58, inp=0xa2efff2c, flag=2) at common/hush.c:1618
> #17 0xa3f01d80 in parse_string_outer (ctx=0xa2efff58, s=0xa3f3477a "source /env/bin/init", flag=2) at common/hush.c:1662
> #18 0xa3f01eb8 in run_command (cmd=0xa2f7b7fe "\377\377", flag=<value optimized out>) at common/hush.c:1783
> #19 0xa3f07428 in start_barebox () at common/startup.c:124
> #20 0xa3f33158 in board_init_lowlevel_return () at arch/arm/cpu/start.c:62
> 
> (gdb) p *p
> $10 = {prev_size = 15, size = 2750562700, fd = 0xa3f24184, bk = 0xa3f23f24}
> (gdb) p/x p->size
> $11 = 0xa3f2418c
> (gdb) p bmp_open
> $12 = {struct image *(char *, int)} 0xa3f2418c <bmp_open>
> 
> As you can see here, p->size equals bmp_open(), while p is the
> mem2chunk(mem). This _seems_ to imply that the memchunk headers were somehow
> corrupted by bmp_open address ... hence my mail to see if that rings a bell to
> you.
> 
> Cheers.
> 
> -- 
> Robert

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] splash: init struct allocated the stack to 0
  2012-11-20 21:57 bmp splash memory corruption Robert Jarzmik
  2012-11-21  9:06 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-21  9:07 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-21  9:07   ` [PATCH 2/2] bmp: specify we need to keep the data read from the file Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21  9:07 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/splash.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/commands/splash.c b/commands/splash.c
index 65dd530..4cc463e 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -19,6 +19,10 @@ static int do_splash(int argc, char *argv[])
 	u32 bg_color = 0x00000000;
 	bool do_bg = false;
 
+	memset(&s, 0, sizeof(s));
+	memset(&sc, 0, sizeof(sc));
+	memset(&info, 0, sizeof(info));
+
 	s.x = -1;
 	s.y = -1;
 	s.width = -1;
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] bmp: specify we need to keep the data read from the file
  2012-11-21  9:07 ` [PATCH 1/2] splash: init struct allocated the stack to 0 Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-21  9:07   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-21 10:48     ` Robert Jarzmik
  0 siblings, 1 reply; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21  9:07 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 lib/gui/bmp.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/gui/bmp.c b/lib/gui/bmp.c
index d576121..fce0e69 100644
--- a/lib/gui/bmp.c
+++ b/lib/gui/bmp.c
@@ -125,6 +125,7 @@ static struct image_renderer bmp = {
 	.open = bmp_open,
 	.close = bmp_close,
 	.renderer = bmp_renderer,
+	.keep_file_data = 1,
 };
 
 static int bmp_init(void)
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] bmp: specify we need to keep the data read from the file
  2012-11-21  9:07   ` [PATCH 2/2] bmp: specify we need to keep the data read from the file Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-21 10:48     ` Robert Jarzmik
  2012-11-21 10:55       ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Jarzmik @ 2012-11-21 10:48 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> writes:
... zip ...

Yeah, that's it, I don't have my corruptions anymore.

Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>

-- 
Robert

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] bmp: specify we need to keep the data read from the file
  2012-11-21 10:48     ` Robert Jarzmik
@ 2012-11-21 10:55       ` Sascha Hauer
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2012-11-21 10:55 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: barebox

On Wed, Nov 21, 2012 at 11:48:42AM +0100, Robert Jarzmik wrote:
> Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> writes:
> ... zip ...
> 
> Yeah, that's it, I don't have my corruptions anymore.
> 
> Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-21 10:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-20 21:57 bmp splash memory corruption Robert Jarzmik
2012-11-21  9:06 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-21  9:07 ` [PATCH 1/2] splash: init struct allocated the stack to 0 Jean-Christophe PLAGNIOL-VILLARD
2012-11-21  9:07   ` [PATCH 2/2] bmp: specify we need to keep the data read from the file Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 10:48     ` Robert Jarzmik
2012-11-21 10:55       ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox