Issue 162410
Summary [clang][PAC] Don't issue a "changes pointer-authentication of pointee type" warning for memcpy/move, etc even if the types have the same schemas
Labels clang
Assignees ojhunt
Reporter ojhunt
    I noticed this while trying to clean up some annoying cast work arounds in the hardening upstreaming:

```cpp
   typedef void __ptrauth(0, 0, 0) *ptr_type;
   ptr_type p, q;
   // assume init
   memcpy(&q, &p, sizeof(p));
```

produces 

```
 passing '__ptrauth(0,0,0) void **' (aka '__ptrauth(0,0,0) unsigned long *') to parameter of type 'const void *' changes pointer-authentication of pointee type
```

The issue is that the analysis producing this warning is looking at the destination type of arg0 and/or arg1, which at the point of checking may already have been cast (either implicitly or explicitly) to `void*` as that is the required type of the destination.

When fixing this we should also consider implicit schemas, and consider warning if the values are address discriminated - though how to suppress that warning is an adventure in its own misery.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to