qilingframework / qilingframework/qiling

Creating a Cortex M Linux Qiling instance causes `AttributeError`.

Open
#1,215 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.1k
Forks
798
Avg merge
1d 1h
Merged PRs (30d)
9

Description

Describe the bug
Creating a Cortex M Qiling instance with a Linux ostype causes an AttributeError.

Sample Code

import qiling
qiling.Qiling(code=b"\0", archtype=qiling.const.QL_ARCH.CORTEX_M, ostype='linux')

Expected behavior
No error.

Result

Traceback (most recent call last):
  File "test.py", line 2, in <module>
    qiling.Qiling(code=b"\0", archtype=qiling.const.QL_ARCH.CORTEX_M, ostype='linux')
  File "~/.local/lib/python3.8/site-packages/qiling/core.py", line 179, in __init__
    self._os = select_os(ostype)(self)
  File "~/.local/lib/python3.8/site-packages/qiling/os/linux/linux.py", line 48, in __init__
    self.load()
  File "~/.local/lib/python3.8/site-packages/qiling/os/linux/linux.py", line 56, in load
    self.ql.arch.enable_vfp()
  File "~/.local/lib/python3.8/site-packages/qiling/arch/arm.py", line 104, in enable_vfp
    self.regs.c1_c0_2 = self.regs.c1_c0_2 | (0b11 << 20) | (0b11 << 22)
  File "~/.local/lib/python3.8/site-packages/qiling/arch/register.py", line 41, in __getattr__
    return super().__getattribute__(name)
AttributeError: 'QlRegisterManager' object has no attribute 'c1_c0_2'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the sample with Cortex M and Linux, then inspect qiling/os/linux/linux.py where load() calls enable_vfp. Follow that call into qiling/arch/arm.py and qiling/arch/register.py to understand the missing register access. Done means the sample no longer raises AttributeError and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems, reverse-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.