Skip to content

dbootimg: Fix sigsegv while updating kernel with no dtb#6

Open
ribalda wants to merge 1 commit into96boards:masterfrom
ribalda:master
Open

dbootimg: Fix sigsegv while updating kernel with no dtb#6
ribalda wants to merge 1 commit into96boards:masterfrom
ribalda:master

Conversation

@ribalda
Copy link
Copy Markdown

@ribalda ribalda commented Aug 9, 2018

Trying to update a kernel with no appended dtb resulted in:

root@qt5506:~# dbootimg /dev/disk/by-partlabel/boot -u kernel /boot/Image.gz
DTB not found in boot image
[ 2130.770995] audit: type=1701 audit(1533805111.476:2): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=3453 comm="dbootimg" exe="/usr/bin/dbootimg" sig=11 res=1
Segmentation fault (core dumped)

This patch allows upding the dtb IIF the old image contained an appended
dtb.

Signed-off-by: Ricardo Ribalda Delgado ricardo.ribalda@gmail.com

kernel_sz = kernelgz_size(kernel);
dtb = aboot_get_dtb(old_aboot);

if (kernel_has_appended_dtb(kernel)){
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't really care if the new kernel has appended dtb, we just want to avoid error if the current one does not have dtb.
dtb = aboot_get_dtb(old_aboot);
dtb_sz = dtb ? dtb_size(dtb) : 0;

Trying to update a kernel with no appended dtb resulted in:

root@qt5506:~# dbootimg /dev/disk/by-partlabel/boot -u kernel /boot/Image.gz
DTB not found in boot image
[ 2130.770995] audit: type=1701 audit(1533805111.476:2): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=3453 comm="dbootimg" exe="/usr/bin/dbootimg" sig=11 res=1
Segmentation fault (core dumped)

This patch allows upding the dtb IIF the old image contained an appended
dtb.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
@ribalda
Copy link
Copy Markdown
Author

ribalda commented Sep 18, 2018

Changes applied as requested.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants