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

Function type is invalid by default #3062

Closed
Kharos102 opened this issue Apr 9, 2022 · 9 comments
Closed

Function type is invalid by default #3062

Kharos102 opened this issue Apr 9, 2022 · 9 comments
Labels
DebugInfo: PDB Related to parsing PDB files Type: Bug Issue is a non-crashing bug with repro steps
Milestone

Comments

@Kharos102
Copy link
Contributor

Binary Ninja Version: 3.0.3337-dev Personal, 7daa28e8
Platform: Windows 11 Version 2009
Example File: C:\windows\system32\wevtsvc.dll

When disassembling this file with symbols, Binja will create the function prototypes.

However, these prototypes can be invalid when attempting to edit them.

The screenshot I've attached is the function prototype as created by binary ninja when parsing the file with symbols, if I go to edit it, its already invalid before I can change it (so if i wanted to change arg2 to another type, it wouldn't work because something with the pre-filled prototype defined by binja prevents parsing).
binja1

@plafosse plafosse added the Type: Bug Issue is a non-crashing bug with repro steps label Apr 11, 2022
@plafosse
Copy link
Member

This is likely due to us not parsing the __ptr64 We should be hiding those when we emit the string.

@plafosse plafosse added this to the 3.1 (Debugger) milestone Apr 11, 2022
@plafosse
Copy link
Member

This output comes from the output of the msvc++ name demangler.

@Kharos102
Copy link
Contributor Author

This is likely due to us not parsing the __ptr64 We should be hiding those when we emit the string.

Yes, fixing up this line does fix this issue.

@CouleeApps
Copy link
Member

Clang says: '__ptr64' attribute only applies to pointer arguments. This is a bug in whatever generated that type, since __ptr64 does not apply to references. It should be easily worked around by changing the parameter type to a pointer. Will leave this open for future as this is likely a bug with the PDB parser.

@CouleeApps CouleeApps added the DebugInfo: PDB Related to parsing PDB files label May 25, 2022
@CouleeApps CouleeApps removed their assignment May 25, 2022
@Kharos102
Copy link
Contributor Author

sample.zip
Adding another example here which may be the same issue?

It affects a rust binary compiled for Arm64 rust (no PDBs) -- trying to change the type of a function symbol generated during analysis is also invalid by default.

Attached the screenshot and binary.

Screen Shot 2022-05-30 at 12 13 27 AM

@CouleeApps
Copy link
Member

int128_t is not supported on the default type parser-- try switching to Clang in the Settings (analysis -> type parser) or use a different type.

@fuzyll
Copy link
Contributor

fuzyll commented Jun 20, 2022

We're closing this as fixed because it should work with the Clang parser. Please let us know if this isn't actually fixed and we'll look into it further.

@fuzyll fuzyll closed this as completed Jun 20, 2022
@Kharos102
Copy link
Contributor Author

Hi,

This still is broken, even with the latest dev binja.

This time the error is different, see the screenshot of the result of analysing "c:\windows\system32\wevtsvc.dll" and attempting to change the function type (but not changing it, just immediately hitting ok)
image

@CouleeApps
Copy link
Member

Looks like the PDB did not define the class wmi::AutoRef<class Log> and so Clang creates an empty struct when it sees class wmi::AutoRef<class Log> and returns that instead of the function. I'm not quite sure what the expected behavior is here, considering that the "change type" dialog is now trying to define a type, but the PDB loader bugs are still leading to type parsing bugs down the line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DebugInfo: PDB Related to parsing PDB files Type: Bug Issue is a non-crashing bug with repro steps
Projects
None yet
Development

No branches or pull requests

4 participants