This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Question on direction of GCC support for HWASAN.
- From: "Evgenii Stepanov via gcc-patches" <gcc-patches at gcc dot gnu dot org>
- To: Szabolcs Nagy <Szabolcs dot Nagy at arm dot com>
- Cc: Martin Liška <mliska at suse dot cz>, Matthew Malcomson <Matthew dot Malcomson at arm dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>, "kcc at google dot com" <kcc at google dot com>, Peter Collingbourne <pcc at google dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Tue, 24 Sep 2019 11:09:02 -0700
- Subject: Re: Question on direction of GCC support for HWASAN.
- References: <4d5ac626-b4f6-b543-871c-d5bd8cc4850a@arm.com> <63db8ec3-bee8-ed33-f448-e2b60a7749c4@suse.cz> <4ada50ce-a51c-6e9a-0163-5c6cce1e7ab5@arm.com>
- Reply-to: Evgenii Stepanov <eugenis at google dot com>
On Tue, Sep 24, 2019 at 9:36 AM Szabolcs Nagy <Szabolcs.Nagy@arm.com> wrote:
>
> On 23/09/2019 08:52, Martin Liška wrote:
> > On 9/20/19 7:11 PM, Matthew Malcomson wrote:
> >> The implementation is unlikely to be production-quality since
> >> development on libhwasan is only on its `platform` ABI. This libhwasan
> >> ABI requires changes to the system libc so that it calls into libhwasan
> >> on interesting events.
> >> I haven't looked into adding these changes to glibc, but expect that
> >> most people running a Linux distribution would not want to install a
> >> special glibc to use this sanitizer.
> >
> > Can you please provide a link about what special one needs in glibc
> > to support HWASAN?
>
> i don't know if there is such a link other than taking
> a hint from the internal api in the source
> https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/hwasan/hwasan_interface_internal.h
>
> memory has to be (un)tagged on (de)allocation, which
> requires libc help to know the limits and when the
> (de)allocation happens in case of tls/stack memory
> (e.g. dealloced at unwind, longjmp, setcontext, thread
> exit, thread cancel, child exit after vfork) and in
> case of global data in dynamically loaded shared libs.
This is a slightly better link, but it misses
__hwasan_library_(load|unload) hooks:
https://github.com/llvm/llvm-project/blob/master/compiler-rt/include/sanitizer/hwasan_interface.h
You can also search bionic source for __hwasan and __sanitizer:
https://android.googlesource.com/platform/bionic/+/refs/heads/master