Setting a calling convention doesn't trigger argument locations to be redetermined

Abierto
#4,530 0 comentarios 2 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
cpp

Línea de trabajo

Start with the calling-convention update path and inspect how current_function.type.parameters[0].location relates to bv.arch.get_reg_name(current_function.parameter_vars[0].storage). Reproduce the sequence of removing an explicit location and changing the calling convention; done means parameters using the default location move to the new convention's default location.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Component: Core Effort: Low Impact: Low

Version and Platform (required):

  • Binary Ninja Version: 3.5.4390-dev
  • OS: macOS
  • OS Version: 13.5
  • CPU Architecture: arm64

Bug Description:
Created a custom calling convention that took the first argument at x20 (this in Swift) and applied it, but it didn't work:

image

Explicit argument locations do work, however:

image

It turns out this is a little more complicated than 'it doesn't work', though. What appears to be happening is that:

  1. If you have the argument location at x20 first
  2. ...and then edit the signature to remove the explicit argument location
  3. ...and then change the calling convention
  4. ...the argument won't be at x20 because the calling convention updates the type, but doesn't update the actual variables

Removing the explicit location changes the argument to the "default location" (x0, in this case) and then the update does not change the variable location even though the calling convention has changed in the type of the function. The variable in the type is still at "default location" but the variable in the analysis has not been changed to the "default location" of the new calling convention. Check current_function.type.parameters[0].location is None vs bv.arch.get_reg_name(current_function.parameter_vars[0].storage) to see that this is the case.

Expected Behavior:
Any time the calling convention has changed, it should update the parameter variable locations if they are set to the default location. It should update to use the default location in the new calling convention.

Additional Information:
Lots of thanks to @CouleeApps for figuring out what was actually happening here, since it appeared to be working non-deterministically before.

Lenguaje dominante
C++
Estrellas
1.3k
Forks
298
Merge medio
5 d 5 h
PR fusionados (30 d)
19

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Vector35/binaryninja-api

Todos los issues de Vector35/binaryninja-api

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.