-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
RISCV PLT call causes subsequent instructions to be lost. #1606
Comments
Playing with
Specifically, we have |
Looking at the files I attached
When I investigated in June/July I noticed that I was able to resolve this issue by forking the LLVM respository and setting |
@matt-j-griffin I'm not aware of it, but it may be useful to check with them. I'd be curious if there was a way to tell BAP's disassembler via the Knowledge Base about this, without having to fork LLVM. |
There's a way of course, but theoretically BAP should have handled this even without extra hint from the disassembler. This instruction semantics is described in the lisp file: (defun JAL (lr off)
(let ((pc (get-program-counter)))
(set$ lr (+ pc 4))
(exec-addr (+ pc off)))) And currently there is no primitive or an attribute, which fits better here, to specify that the instruction is a call. Ideally, we should be able to write it like this, (defun JAL (lr off)
(declare (instruction-properties 'is-call))
(let ((pc (get-program-counter)))
(set$ lr (+ pc 4))
(exec-addr (+ pc off)))) adding such functionality wouldn't be hard and it will easily fix this issue. But the underlying issue is a little bit deeper. The disassembler driver should be able to handle this on its own as we treat a jump to a subroutine as a call. Here
and then change all accesses to |
I've been using BAP to analyze cURL in RISC-V (libcurl.4.4.0).
Calling
llvm-objdump
on the binary results in this dump.Generating BIL for the same binary using
bap libcurl.4.4.0 -dbil.adt
produces this file.In the BIL output, after the instruction
jal
appears in a subroutine all the subsequent instructions are lost. In these cases,jal
is used to call PLT stubs in the binary.An example can be found in the
curl_easy_getinfo
subroutine given below:The BIL for this subroutine is as follows:
Instructions at
1be44
,1be46
and1be48
do not appear in the BIL output.Is there a workaround?
The text was updated successfully, but these errors were encountered: