binaryninja-api: IL not available for mach-o binaries

Version and Platform (required):

  • Binary Ninja Version: 4.1.5747
  • OS: macOS
  • OS Version: 14.5
  • CPU Architecture: M1

Bug Description:

IL is not loaded (always).

Steps To Reproduce:

class ...:
    def __init__(self, binary_view: "BinaryView")
        self.bv = binary_view
        # ...
    def wow(self, call: ReferenceSource):
        if not call.function.llil_if_available:
            logger.debug("@%#x LLIL not available", call.address)
            return []
        return str(call.function.llil) # example
        # ...

    def analyze(self, ...):
        # ....
        func: List["Function"] = self.get_funcs()
        for ref in func.caller_sites:
            res = self.wow(ref)
            print(res)

Every ref results into LLIL not available.

Expected Behavior: LLIL avilable for most cases.

Binary:

Binary is Mach-O universal binary. The binary does not contain objc info.

Additional Information:

This code worked completely fine before the update.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

Full address is 0x10000deb8. I redacted the last digits. Sorry for the confusion.

Binja bails during analysis of the function because the time to analyze that function exceeds the default threshold of 20 seconds. If you increase the “Max Function Analysis Time” setting to something higher (like 60000 milliseconds) then Binja analyzes it fine. You can also force analysis by setting func.analysis_skipped to False.

To increase the timeout threshold for function analysis:

bv = BinaryView.load(filepath, options={"analysis.limits.maxFunctionAnalysisTime": 60000})

To force analysis of a skipped function:

func = bv.get_function_at(0x10000deb8)
if func.analysis_skipped:
    log_debug("Forcing analysis of skipped function at {hex(func.start)}")
    func.analysis_skipped = False

To summarize, it is expected that when you query IL for certain functions that ILException will be raised. When this occurs you can still force analysis using the method described above (in most cases).

FYI: I shared the files with xusheng6 on slack 20 minutes ago.

I think you can join our public slack and share the file with me in private. You do not need to upload it here. Our public slack is at https://slack.binary.ninja/. Alternatively, you can also email it to us via binaryninja@vector35.com