mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* NULL pointer deref crash on barebox 2020.08.0
@ 2020-08-20 12:18 Giorgio Dal Molin
  2020-08-20 12:21 ` Ahmad Fatoum
  0 siblings, 1 reply; 9+ messages in thread
From: Giorgio Dal Molin @ 2020-08-20 12:18 UTC (permalink / raw)
  To: barebox

Hi,

I've tried the current barebox v2020.08.0 on my imx7d module and it crashes
while executing the command:

imx7d: / cp /mnt/boot/kernel.img /dev/mmc1.fw_update
unable to handle NULL pointer dereference at address 0x00000000
pc : [<ffe6c2dc>]    lr : [<ffe6c2c0>]
sp : fffefcd0  ip : fffefcd0  fp : c00f8850
r10: ffe981ef  r9 : 00000000  r8 : ffe981ef
r7 : ffe98dcb  r6 : ffea60a8  r5 : ffe98dbd  r4 : c00ef1e8
r3 : 00000000  r2 : bfefb8e0  r1 : ffe98dbd  r0 : 00028888
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32

no stack data available


I could track the problem down to a call to list_del(&inode->i_sb_list); in
fs/fs.c:iput(struct inode *inode):

void iput(struct inode *inode)
{
	if (!inode)
		return;

	inode->i_count--;

	if (!inode->i_count) {
		list_del(&inode->i_sb_list);        <== this call segfaults
		destroy_inode(inode);
	}
}

I've checked that the struct list_head inode->i_sb_list has its .prev pointer NULL
and that's the immediate reason why I get a segfault (at WRITE_ONCE(prev->next, next)
in __list_del(prev, next); what I don't know is whether a NULL .prev is OK and the error
is a missing test in __list_del() or if a NULL .prev is already wrong.

giorgio

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

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

* Re: NULL pointer deref crash on barebox 2020.08.0
  2020-08-20 12:18 NULL pointer deref crash on barebox 2020.08.0 Giorgio Dal Molin
@ 2020-08-20 12:21 ` Ahmad Fatoum
  2020-08-20 12:26   ` Giorgio Dal Molin
  0 siblings, 1 reply; 9+ messages in thread
From: Ahmad Fatoum @ 2020-08-20 12:21 UTC (permalink / raw)
  To: Giorgio Dal Molin, barebox

Hello Giorgio,

On 8/20/20 2:18 PM, Giorgio Dal Molin wrote:
> Hi,
> 
> I've tried the current barebox v2020.08.0 on my imx7d module and it crashes
> while executing the command:
> 
> imx7d: / cp /mnt/boot/kernel.img /dev/mmc1.fw_update
> unable to handle NULL pointer dereference at address 0x00000000
> pc : [<ffe6c2dc>]    lr : [<ffe6c2c0>]
> sp : fffefcd0  ip : fffefcd0  fp : c00f8850
> r10: ffe981ef  r9 : 00000000  r8 : ffe981ef
> r7 : ffe98dcb  r6 : ffea60a8  r5 : ffe98dbd  r4 : c00ef1e8
> r3 : 00000000  r2 : bfefb8e0  r1 : ffe98dbd  r0 : 00028888
> Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> 
> no stack data available
> 
> 
> I could track the problem down to a call to list_del(&inode->i_sb_list); in
> fs/fs.c:iput(struct inode *inode):
> 
> void iput(struct inode *inode)
> {
> 	if (!inode)
> 		return;
> 
> 	inode->i_count--;
> 
> 	if (!inode->i_count) {
> 		list_del(&inode->i_sb_list);        <== this call segfaults
> 		destroy_inode(inode);
> 	}
> }
> 
> I've checked that the struct list_head inode->i_sb_list has its .prev pointer NULL
> and that's the immediate reason why I get a segfault (at WRITE_ONCE(prev->next, next)
> in __list_del(prev, next); what I don't know is whether a NULL .prev is OK and the error
> is a missing test in __list_del() or if a NULL .prev is already wrong.

What kind of file system is mounted at /mnt/boot?

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

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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] 9+ messages in thread

* Re: NULL pointer deref crash on barebox 2020.08.0
  2020-08-20 12:21 ` Ahmad Fatoum
@ 2020-08-20 12:26   ` Giorgio Dal Molin
  2020-08-20 12:28     ` Ahmad Fatoum
  0 siblings, 1 reply; 9+ messages in thread
From: Giorgio Dal Molin @ 2020-08-20 12:26 UTC (permalink / raw)
  To: Ahmad Fatoum, barebox


> On August 20, 2020 at 2:21 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
> 
> 
> Hello Giorgio,
> 
> On 8/20/20 2:18 PM, Giorgio Dal Molin wrote:
> > Hi,
> > 
> > I've tried the current barebox v2020.08.0 on my imx7d module and it crashes
> > while executing the command:
> > 
> > imx7d: / cp /mnt/boot/kernel.img /dev/mmc1.fw_update
> > unable to handle NULL pointer dereference at address 0x00000000
> > pc : [<ffe6c2dc>]    lr : [<ffe6c2c0>]
> > sp : fffefcd0  ip : fffefcd0  fp : c00f8850
> > r10: ffe981ef  r9 : 00000000  r8 : ffe981ef
> > r7 : ffe98dcb  r6 : ffea60a8  r5 : ffe98dbd  r4 : c00ef1e8
> > r3 : 00000000  r2 : bfefb8e0  r1 : ffe98dbd  r0 : 00028888
> > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> > 
> > no stack data available
> > 
> > 
> > I could track the problem down to a call to list_del(&inode->i_sb_list); in
> > fs/fs.c:iput(struct inode *inode):
> > 
> > void iput(struct inode *inode)
> > {
> > 	if (!inode)
> > 		return;
> > 
> > 	inode->i_count--;
> > 
> > 	if (!inode->i_count) {
> > 		list_del(&inode->i_sb_list);        <== this call segfaults
> > 		destroy_inode(inode);
> > 	}
> > }
> > 
> > I've checked that the struct list_head inode->i_sb_list has its .prev pointer NULL
> > and that's the immediate reason why I get a segfault (at WRITE_ONCE(prev->next, next)
> > in __list_del(prev, next); what I don't know is whether a NULL .prev is OK and the error
> > is a missing test in __list_del() or if a NULL .prev is already wrong.
> 
> What kind of file system is mounted at /mnt/boot?
> 

Hi

it's a squashfs:

imx7d: / mount 
none on / type ramfs
none on /dev type devfs
/dev/mmc1.userland on /mnt/userland type squashfs
/dev/mmc1.boot on /mnt/boot type squashfs

giorgio

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

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

* Re: NULL pointer deref crash on barebox 2020.08.0
  2020-08-20 12:26   ` Giorgio Dal Molin
@ 2020-08-20 12:28     ` Ahmad Fatoum
  2020-08-20 12:50       ` Giorgio Dal Molin
  0 siblings, 1 reply; 9+ messages in thread
From: Ahmad Fatoum @ 2020-08-20 12:28 UTC (permalink / raw)
  To: Giorgio Dal Molin, barebox

Hello,

On 8/20/20 2:26 PM, Giorgio Dal Molin wrote:
>> What kind of file system is mounted at /mnt/boot?
>>
> 
> Hi
> 
> it's a squashfs:

Do you have Sascha's "squashfs: Fix current master" series applied?
https://lists.infradead.org/pipermail/barebox/2020-August/033488.html

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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] 9+ messages in thread

* Re: NULL pointer deref crash on barebox 2020.08.0
  2020-08-20 12:28     ` Ahmad Fatoum
@ 2020-08-20 12:50       ` Giorgio Dal Molin
  2020-08-20 12:57         ` Sascha Hauer
  0 siblings, 1 reply; 9+ messages in thread
From: Giorgio Dal Molin @ 2020-08-20 12:50 UTC (permalink / raw)
  To: Ahmad Fatoum, barebox


> On August 20, 2020 at 2:28 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
> 
> 
> Hello,
> 
> On 8/20/20 2:26 PM, Giorgio Dal Molin wrote:
> >> What kind of file system is mounted at /mnt/boot?
> >>
> > 
> > Hi
> > 
> > it's a squashfs:
> 
> Do you have Sascha's "squashfs: Fix current master" series applied?
> https://lists.infradead.org/pipermail/barebox/2020-August/033488.html
> 
Hi,

are these commits already visible in git://git.pengutronix.de/git/barebox.git

I cannot find them.

giorgio

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

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

* Re: NULL pointer deref crash on barebox 2020.08.0
  2020-08-20 12:50       ` Giorgio Dal Molin
@ 2020-08-20 12:57         ` Sascha Hauer
  2020-08-20 13:06           ` Giorgio Dal Molin
  2020-08-20 13:26           ` Giorgio Dal Molin
  0 siblings, 2 replies; 9+ messages in thread
From: Sascha Hauer @ 2020-08-20 12:57 UTC (permalink / raw)
  To: Giorgio Dal Molin; +Cc: barebox, Ahmad Fatoum

On Thu, Aug 20, 2020 at 02:50:40PM +0200, Giorgio Dal Molin wrote:
> 
> > On August 20, 2020 at 2:28 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
> > 
> > 
> > Hello,
> > 
> > On 8/20/20 2:26 PM, Giorgio Dal Molin wrote:
> > >> What kind of file system is mounted at /mnt/boot?
> > >>
> > > 
> > > Hi
> > > 
> > > it's a squashfs:
> > 
> > Do you have Sascha's "squashfs: Fix current master" series applied?
> > https://lists.infradead.org/pipermail/barebox/2020-August/033488.html
> > 
> Hi,
> 
> are these commits already visible in git://git.pengutronix.de/git/barebox.git

They are not because I forgot to apply them. Give me a minute, Ahmad is
just testing them

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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] 9+ messages in thread

* Re: NULL pointer deref crash on barebox 2020.08.0
  2020-08-20 12:57         ` Sascha Hauer
@ 2020-08-20 13:06           ` Giorgio Dal Molin
  2020-08-20 13:26           ` Giorgio Dal Molin
  1 sibling, 0 replies; 9+ messages in thread
From: Giorgio Dal Molin @ 2020-08-20 13:06 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Ahmad Fatoum


> On August 20, 2020 at 2:57 PM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> 
> On Thu, Aug 20, 2020 at 02:50:40PM +0200, Giorgio Dal Molin wrote:
> > 
> > > On August 20, 2020 at 2:28 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
> > > 
> > > 
> > > Hello,
> > > 
> > > On 8/20/20 2:26 PM, Giorgio Dal Molin wrote:
> > > >> What kind of file system is mounted at /mnt/boot?
> > > >>
> > > > 
> > > > Hi
> > > > 
> > > > it's a squashfs:
> > > 
> > > Do you have Sascha's "squashfs: Fix current master" series applied?
> > > https://lists.infradead.org/pipermail/barebox/2020-August/033488.html
> > > 
> > Hi,
> > 
> > are these commits already visible in git://git.pengutronix.de/git/barebox.git
> 
> They are not because I forgot to apply them. Give me a minute, Ahmad is
> just testing them
> 
> Sascha

Hi,

I'm actually not in a hurry, I just noticed the problem and reported it.

giorgio

> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 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

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

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

* Re: NULL pointer deref crash on barebox 2020.08.0
  2020-08-20 12:57         ` Sascha Hauer
  2020-08-20 13:06           ` Giorgio Dal Molin
@ 2020-08-20 13:26           ` Giorgio Dal Molin
  2020-08-21  4:37             ` Sascha Hauer
  1 sibling, 1 reply; 9+ messages in thread
From: Giorgio Dal Molin @ 2020-08-20 13:26 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Ahmad Fatoum

Hi,

can confirm v2020.08.1 fixes the problems I had with my cp from a squashfs.

thank you,

giorgio


> On August 20, 2020 at 2:57 PM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> 
> On Thu, Aug 20, 2020 at 02:50:40PM +0200, Giorgio Dal Molin wrote:
> > 
> > > On August 20, 2020 at 2:28 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
> > > 
> > > 
> > > Hello,
> > > 
> > > On 8/20/20 2:26 PM, Giorgio Dal Molin wrote:
> > > >> What kind of file system is mounted at /mnt/boot?
> > > >>
> > > > 
> > > > Hi
> > > > 
> > > > it's a squashfs:
> > > 
> > > Do you have Sascha's "squashfs: Fix current master" series applied?
> > > https://lists.infradead.org/pipermail/barebox/2020-August/033488.html
> > > 
> > Hi,
> > 
> > are these commits already visible in git://git.pengutronix.de/git/barebox.git
> 
> They are not because I forgot to apply them. Give me a minute, Ahmad is
> just testing them
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 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

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

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

* Re: NULL pointer deref crash on barebox 2020.08.0
  2020-08-20 13:26           ` Giorgio Dal Molin
@ 2020-08-21  4:37             ` Sascha Hauer
  0 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2020-08-21  4:37 UTC (permalink / raw)
  To: Giorgio Dal Molin; +Cc: barebox, Ahmad Fatoum

On Thu, Aug 20, 2020 at 03:26:40PM +0200, Giorgio Dal Molin wrote:
> Hi,
> 
> can confirm v2020.08.1 fixes the problems I had with my cp from a squashfs.

Great, thanks for testing.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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] 9+ messages in thread

end of thread, other threads:[~2020-08-21  4:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 12:18 NULL pointer deref crash on barebox 2020.08.0 Giorgio Dal Molin
2020-08-20 12:21 ` Ahmad Fatoum
2020-08-20 12:26   ` Giorgio Dal Molin
2020-08-20 12:28     ` Ahmad Fatoum
2020-08-20 12:50       ` Giorgio Dal Molin
2020-08-20 12:57         ` Sascha Hauer
2020-08-20 13:06           ` Giorgio Dal Molin
2020-08-20 13:26           ` Giorgio Dal Molin
2020-08-21  4:37             ` Sascha Hauer

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