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

WARNING: You just tried to use a timer, and timers are not enabled! Try adding use_timers: True and use_nvic: True to your firmware's YAML file. #6

Open
dierye opened this issue Aug 17, 2022 · 1 comment

Comments

@dierye
Copy link

dierye commented Aug 17, 2022

I got this error when run 'test_st_plc.sh', but I'm sure that use_timers: True and use_nvic: True was added in the file st_plc.yaml. Is that normal ?

Loading fuzz from: ./tests/st-plc/inputs/input1
Executing until a crash
WARNING: You just tried to use a timer, and timers are not enabled! Try adding `use_timers: True` and `use_nvic: True` to your firmware's YAML file.
Traceback (most recent call last):
  File "/home/halfuzz/hal-fuzz/hal_fuzz/hal_fuzz/handlers/__init__.py", line 61, in func_hook_handler
    hook(uc)
  File "/home/halfuzz/hal-fuzz/hal_fuzz/hal_fuzz/handlers/stm32f4_hal/stm32f4_wifi.py", line 26, in wifi_init
    Timer.start_timer(hex(tim1), wifi_timer_rate, 45)
  File "/home/halfuzz/hal-fuzz/hal_fuzz/hal_fuzz/models/timer.py", line 105, in start_timer
    internal_ind = native.add_timer(timer_rate, isr_num=timer_func_irq)
  File "/home/halfuzz/hal-fuzz/hal_fuzz/hal_fuzz/native.py", line 221, in add_timer
    sys.exit(1)
SystemExit: 1
Exiting via os._exit
@mariusmue
Copy link

I encountered the very same issue, for another example. I looked into the issue, and my suspicion that this check is inverted:

    if timer_cb_wrapper is not None or timer_cb_user_data is not None:
        print("WARNING: You just tried to use a timer, and timers are not enabled! Try adding `use_timers: True` and `use_nvic: True` to your firmware's YAML file.")
        sys.exit(1)

(https://github.com/ucsb-seclab/hal-fuzz/blob/master/hal_fuzz/hal_fuzz/native.py#L219)

I think the logic should be:

if timer_cb_wrapper is None or timer_cb_user_data is None:

Inverting this check accordingly made HALucinator at least run for my usecase, but it would be great to have confirmation by the maintainers before supplying a PR.

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

2 participants