microsoft / binskim

A binary static analysis tool that provides security and correctness results for Windows Portable Executable and *nix ELF binary formats
Other
770 stars 156 forks source link

BinSkim BA2014 compatibility with the new Arm64EC files #979

Open shaopeng-gh opened 8 months ago

shaopeng-gh commented 8 months ago

User report that BinSkim BA2014 could have compatibility issue with the new Arm64EC files

https://learn.microsoft.com/en-us/windows/arm/arm64ec-build#msbuild-projects With the HelloWorld app created using above guide, binskim complain about the function noCheckBuffers. (Some other functions could be reported as well, e.g. _mm_setcsr)

This issue is created to investigate if improvements can be made.

#include
<immintrin.h>

using
namespace
std;

typedef
struct {

int
x[20];
}
BUFFER;
static
__declspec(safebuffers)

int
noCheckBuffers() {

BUFFER
ncb;

for(int
i
=0;
i<20;i++){

cout
<<
ncb.x[i];
    }

return
0;
}

int
main()
{
    // try my own function

noCheckBuffers();

    // try the same function as in the bug report

_mm_setcsr(555);

unsigned
int
a
=
_mm_getcsr();

cout
<<
a
<<
endl;

return
0;
}