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

Read error when apply QEMU patch #51

Open
yaozhenguo opened this issue Aug 31, 2020 · 5 comments
Open

Read error when apply QEMU patch #51

yaozhenguo opened this issue Aug 31, 2020 · 5 comments

Comments

@yaozhenguo
Copy link

yaozhenguo commented Aug 31, 2020

I made QEMU patch by libcare-patch-make successfully. But After apply patch for QEMU, following error logs are reported

Copying 0x5 bytes from 0x4ceda0 to 0x555555db2240 in target... FAIL
kpatch_patch.c(495): Patching qemu-system-x86_64 failed, unapplying partially applied patch
Verifying safety for pid 32695...

I have checked kpatch_process_mem_read return is 5(I/O error) and patch info->daddr is 0x4ceda0. But qemu-system-x86_64 text section is as below

Object 'qemu-system-x86_64' (806:643262840), patch: yes
VM areas:
inmem: 555555554000-555555d5461c r-e, ondisk: 00000000-0080061c r-e
inmem: 555555f54d80-55555610c000 r--, ondisk: 00800d80-009b8000 r--
inmem: 55555610c000-5555565b4300 rw-, ondisk: 009b8000-00a16b28 rw-

0x4ceda0 (info->daddr) is invalid in qemu‘s process,Does it need add some offset to info->daddr when reading it? Or, is there something wrong when making patch but logs are not reported?

@yaozhenguo
Copy link
Author

I notice that qemu-system-x86_64 is built with PIE enabled. I disabled PIE, patch is successful.

@yaozhenguo
Copy link
Author

It works when PIE enabled. when c++ is installed. qemu uses c++ as linker. this lead to libcare-cc wrapper can't add -Wl,-q flags to linker. Relocations of the patch is dropped after linking. Removing c++ and then it works.

@coryee
Copy link

coryee commented Oct 10, 2020

Hi @yaozhenguo,
Can you please tell me how to make QEMU patch?
I've tried it in the same way as sample SERVER does, but there is no kpatch info found in the patched qemu-system-xxx using "eu-readelf -S" which cause no patch file generated.

Are there any modifications should be made to qemu makefile?

@loyfan
Copy link
Contributor

loyfan commented Oct 14, 2020

@coryee check if #52 solves your problem.

@coryee
Copy link

coryee commented Oct 19, 2020

@loyfan Thanks a lot

I found that the commit 9edc19c(make: switch from -I to -iquote) of the qemu changed the compile options

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

No branches or pull requests

3 participants