Re: [Mingw-w64-public] [PATCH v3] crt: Add support for Control Flow Guard

2022-09-26 Thread Martin Storsjö
On Thu, 22 Sep 2022, Martin Storsjö wrote: On Thu, 22 Sep 2022, Alvin Wong via Mingw-w64-public wrote: This adds support to enable building mingw-w64-crt and user code with Control Flow Guard using Clang, with the option `--enable-cfguard`. With this option enabled, the Clang 16 compiler optio

Re: [Mingw-w64-public] [PATCH v2 1/4] headers: Implement the __fastfail intrinsic

2022-09-26 Thread Martin Storsjö
On Thu, 22 Sep 2022, Martin Storsjö wrote: On Thu, 22 Sep 2022, Alvin Wong via Mingw-w64-public wrote: Thanks! Do you also need to add the prototype of __fastfail to intrin.h? Hmm, apparently we do that for __debugbreak, although I'm not entirely sure why that's needed here, since it's impl

Re: [Mingw-w64-public] [PATCH v3] crt: Add support for Control Flow Guard

2022-09-26 Thread Alvin Wong via Mingw-w64-public
Cheers, I will get to the changes on the llvm-mingw side soon. On 26/9/2022 15:30, Martin Storsjö wrote: > On Thu, 22 Sep 2022, Martin Storsjö wrote: > >> On Thu, 22 Sep 2022, Alvin Wong via Mingw-w64-public wrote: >> >>> This adds support to enable building mingw-w64-crt and user code with >>> C

Re: [Mingw-w64-public] [PATCH] crt: expose non-dllimport variant of rand_s

2022-09-26 Thread Martin Storsjö
On Fri, 9 Sep 2022, Martin Storsjö wrote: I don't have a good explanation yet for exactly why lld fails to resolve the symbol in this case. It does load the right object file though (by passing "-verbose -demangle:no" to the lld-link command, I can see that it outputs "Loaded msvcrt-os.lib(ran

Re: [Mingw-w64-public] found an API that is not available in Mingw-w64

2022-09-26 Thread Biswapriyo Nath
_set_thread_local_invalid_parameter_handler is available only in ucrt. Make sure the compiler toolchain has ucrt enabled. ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-pub

Re: [Mingw-w64-public] [PATCH v2 3/4] crt: Provide the stack protector functions/variables in libmingwex too

2022-09-26 Thread Alvin Wong via Mingw-w64-public
On 22/9/2022 0:01, Martin Storsjö wrote: > +static void __cdecl __attribute__((__constructor__)) init(void) > +{ > + HCRYPTPROV crypt = 0; > + if (__stack_chk_guard != 0) > +return; > + > + if (CryptAcquireContext(&crypt, NULL, NULL, PROV_RSA_FULL, > CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { >

Re: [Mingw-w64-public] [PATCH v2 3/4] crt: Provide the stack protector functions/variables in libmingwex too

2022-09-26 Thread LIU Hao
在 2022-09-26 21:37, Alvin Wong via Mingw-w64-public 写道: Now whether to use `RtlGenRandom` or `BCryptGenRandom` as the replacement: For UWP, `BCryptGenRandom` is the only choice. For desktop, a comment in a BoringSSL issue claims t

Re: [Mingw-w64-public] [PATCH v2 3/4] crt: Provide the stack protector functions/variables in libmingwex too

2022-09-26 Thread Martin Storsjö
On Mon, 26 Sep 2022, Alvin Wong wrote: On 22/9/2022 0:01, Martin Storsjö wrote: +static void __cdecl __attribute__((__constructor__)) init(void) +{ + HCRYPTPROV crypt = 0; + if (__stack_chk_guard != 0) +return; + + if (CryptAcquireContext(&crypt, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYC

Re: [Mingw-w64-public] [PATCH v2 3/4] crt: Provide the stack protector functions/variables in libmingwex too

2022-09-26 Thread Steve Lhomme
Hi, On 2022-09-26 23:33, Martin Storsjö wrote: On Mon, 26 Sep 2022, Alvin Wong wrote: On 22/9/2022 0:01, Martin Storsjö wrote: +static void __cdecl __attribute__((__constructor__)) init(void) +{ +  HCRYPTPROV crypt = 0; +  if (__stack_chk_guard != 0) +    return; + +  if (CryptAcquireContext(

Re: [Mingw-w64-public] [PATCH v2 3/4] crt: Provide the stack protector functions/variables in libmingwex too

2022-09-26 Thread Martin Storsjö
On Tue, 27 Sep 2022, Steve Lhomme wrote: Hi, On 2022-09-26 23:33, Martin Storsjö wrote: FWIW, CryptGenRandom is not available in UWP mode at all, which is why libwinstorecompat has got a reimplementation of it. It is reimplemented on top of the Windows.Security.Cryptography.CryptographicBuffe