[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] grub-file: fix segmentation fault
From: |
Michael Chang |
Subject: |
Re: [PATCH v2] grub-file: fix segmentation fault |
Date: |
Tue, 22 Nov 2016 15:10:08 +0800 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Fri, Nov 18, 2016 at 11:50:25AM +0300, Andrei Borzenkov wrote:
> Hmm ... I must admit I am confused how we can get NULL here. Filters
> are called after primary file->name is set and each filter copies
> previous struct file, which means returned file will inherit pointer
> to the same file name.
No. I don't think so. Looking into gzio or xzio file filters they did not copy
original handle to new allocated one. And the new handle gets initialized
without file->name being set from original one. The new handle then returned
to upper file layer with file->name being null.
> Anyway, exactly because filters themselves do not free file->name this
> patch means memory leak.
Same reason above, as long as the filters did not allocate it, they did not
need to free.
> Michael, could you provide reproducer for it?
I can still reproduce the segfault on latest git HEAD. Here is kernel image
attached to reproduce the problem with:
grub/build-xen # ./grub-file --is-x86_64-xen-domu
/boot/vmlinux-4.8.4-1-default.gz
Segmentation fault (core dumped)
Thanks,
Michael
vmlinux-4.8.4-1-default.gz
Description: GNU Zip compressed data