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

UEFI does not work with qdb #1416

Open
dotCirill opened this issue Dec 7, 2023 · 4 comments
Open

UEFI does not work with qdb #1416

dotCirill opened this issue Dec 7, 2023 · 4 comments

Comments

@dotCirill
Copy link

The code (emulation of Combined DXE/SMM module):

from qiling import Qiling

if __name__ == "__main__":
    ql = Qiling([
        "files/SuperSMM_DXE_module.efi"
    ], "files")
    ql.debugger = "qdb"


    ql.run()

On 1.4.6 release and current master branch it dies with this error:

... init logs ...
Qdb> *several n (next-steps)*
AttributeError: 'QlOsUefi' object has no attribute 'smm'

backtrace:

# qiling/core.py
debugger(self) # self.os.run is below
# qiling/debugger/qdb/qdb.py
elf.dbg_hook(init_hook)
self.interactive()
self.cmdloop()
...
# qiling/core_hooks.py
hook.call(ql)
# qiling/core_hooks_types.py
self.callback(ql, *args)
# qiling/os/uefi/fncc.py
ql.os.call(pc, f, params, onenter, onexit)
self.fcall.call(func, proto, args, onenter, onexit, passthru)
# qiling/os/fcall.py
func(ql, pc, params)
# qiling/os/uefi/protocols/EfiSmmBase2Protocol.py
ql.log.debug(f'InSmram = {ql.os.smm.active}')

As I understand ql.os.run should be runned but it isn't.

On dev branch I have this backtrace:

ql.run()
# qiling/core.py
debugger = debugger(self) 
# qiling/debugger/qdb/qdb.py
if addr_elf_entry := getattr(self.ql.loader, 'elf_entry'):

AttributeError: 'QlLoaderPE_UEFI' object has no attribute 'elf_entry'
@ucgJhe
Copy link
Collaborator

ucgJhe commented Dec 14, 2023

Hi, I think it should be getattr(self.ql.loader, 'elf_entry', None), please let me know if this fix the issue.

@dotCirill
Copy link
Author

dotCirill commented Dec 15, 2023

Hi, it seems to be OK with that (should be fixed in do_show and gdb_hook).

@loki52501
Copy link

is this fixed?

@dotCirill
Copy link
Author

is this fixed?

Yes qdb works after the fix

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