ERROR AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)

Dear team members,
My toolchain is updated to glibc-2.35 and verifying clang-14 with address sanitizer c example code is failing with below error.
{{
/# clang-14 leak.c -o leak -fsanitize=address -O1 -fno-omit-frame-pointer -g
/# ./leak
==3814811==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)
==3814811==Process memory map follows:
0x000000400000-0x00000041f000 /leak

==3814811==End of process memory map.
AddressSanitizer: CHECK failed: sanitizer_common.cpp:53 “((0 && “unable to mmap”)) != (0)” (0x0, 0x0) (tid=3814811)

}}
/# cat leak.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, const char *argv) {
char *s = malloc(15);
strcpy(s, “Hello world!”);
printf(“string is: %s\n”, s);
free(s);
return 0;
}
From llvm-project/compiler-rt/ identified below commit i.e proposed to fix above issue but still observed it on clang-14 as below commit is already present in it.
{{
commit 82150606fb11d28813ae6da1101f5bda638165fe

Author: Vitaly Buka <vitalybuka@google.com>

Date: Fri Apr 16 09:50:24 2021 -0700

Sanitizer built against glibc 2.34 doesn’t work

As mentioned in 100114 – libasan built against latest glibc doesn't work , glibc starting with the

https://sourceware.org/git/?p=glibc.git;a=commit;h=6c57d320484988e87e446e2e60ce42816bf51d53

change doesn’t define SIGSTKSZ and MINSIGSTKSZ macros to constants, but to sysconf function call.

sanitizer_posix_libcdep.cpp has

static const uptr kAltStackSize = SIGSTKSZ * 4; // SIGSTKSZ is not enough.

which is generally fine, just means that when SIGSTKSZ is not a compile time constant will be initialized later.

The problem is that kAltStackSize is used in SetAlternateSignalStack which is called very early, from .preinit_array

initialization, i.e. far before file scope variables are constructed, which means it is not initialized and

mmapping 0 will fail:

==145==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)

Here is one possible fix, another one could be to make kAltStackSize a preprocessor macro if _SG_SIGSTKSZ is defined

(but perhaps with having an automatic const variable initialized to it so that sysconf isn’t at least called twice

during SetAlternateSignalStack.

Reviewed By: vitalybuka

Differential Revision: ⚙ D100645 Sanitizer built against glibc 2.34 doesn't work

}}
Any input on resolveing above issue?

regards
koti