Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ribalda
Copy link

@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 [email protected]

void *old_kernel, *dtb, *ptr;
int diff;

page_sz = le32_to_cpu(old_aboot->page_size);
old_kernel = aboot_get_kernel(old_aboot);
kernel_sz = kernelgz_size(kernel);
dtb = aboot_get_dtb(old_aboot);

if (kernel_has_appended_dtb(kernel)){
Copy link
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 <[email protected]>
@ribalda
Copy link
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