• Masami Hiramatsu's avatar
    kprobes: Fix error check when reusing optimized probes · 5f843ed4
    Masami Hiramatsu authored
    The following commit introduced a bug in one of our error paths:
    
      819319fc ("kprobes: Return error if we fail to reuse kprobe instead of BUG_ON()")
    
    it missed to handle the return value of kprobe_optready() as
    error-value. In reality, the kprobe_optready() returns a bool
    result, so "true" case must be passed instead of 0.
    
    This causes some errors on kprobe boot-time selftests on ARM:
    
     [   ] Beginning kprobe tests...
     [   ] Probe ARM code
     [   ]     kprobe
     [   ]     kretprobe
     [   ] ARM instruction simulation
     [   ]     Check decoding tables
     [   ]     Run test cases
     [   ] FAIL: test_case_handler not run
     [   ] FAIL: Test andge	r10, r11, r14, asr r7
     [   ] FAIL: Scenario 11
     ...
     [   ] FAIL: Scenario 7
     [   ] Total instruction simulation tests=1631, pass=1433 fail=198
     [   ] kprobe tests failed
    
    This can happen if an optimized probe is unregistered and next
    kprobe is registered on same address until the previous probe
    is not reclaimed.
    
    If thi...
    5f843ed4
kprobes.c 63.6 KB