[AArch64] [mid-end] [__RTL] Allow backends to set state when skipping passes.

2019-11-20 Thread Matthew Malcomson
xample by implementing this hook for the AArch64 backend. regtested on x86_64 and aarch64. gcc/ChangeLog: 2019-11-20 Matthew Malcomson * config/aarch64/aarch64.c (aarch64_skip_pass): New. (TARGET_BACKEND_SKIP_PASS): New. * doc/tm.texi: Document BACKEND_SKIP_PASS hook.

Re: v2 [PATCH 0/X] Introduce HWASAN sanitizer to GCC

2019-11-20 Thread Matthew Malcomson
On 20/11/2019 14:29, Martin Liška wrote: > On 11/7/19 7:37 PM, Matthew Malcomson wrote: >> I have rebased this series onto Martin Liska's patches that take the most >> recent libhwasan from upstream LLVM. >> https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00340.html >> &

Re: [PATCH 3/X] [libsanitizer] Add option to bootstrap using HWASAN

2019-11-20 Thread Matthew Malcomson
On 20/11/2019 14:33, Martin Liška wrote: > On 11/13/19 4:24 PM, Matthew Malcomson wrote: >> On 12/11/2019 12:08, Martin Liška wrote: >>> On 11/11/19 5:03 PM, Matthew Malcomson wrote: >>>> Ah! >>>> My apologies -- I sent up a series with a few docume

Re: [PATCH 5/X] [libsanitizer][mid-end] Introduce stack variable handling for HWASAN

2019-11-20 Thread Matthew Malcomson
On 20/11/2019 14:46, Martin Liška wrote: > On 11/20/19 3:37 PM, Matthew Malcomson wrote: >> Hi Martin, >> >> Thanks for the review, > > You're welcome. > >> I'll get working on your comments now, but since I really enjoyed >> finding this bug in ./co

Re: [PATCH 5/X] [libsanitizer][mid-end] Introduce stack variable handling for HWASAN

2019-11-20 Thread Matthew Malcomson
Hi Martin, Thanks for the review, I'll get working on your comments now, but since I really enjoyed finding this bug in ./configure when I hit it I thought I'd answer this right away. On 20/11/2019 14:02, Martin Liška wrote: > On 11/7/19 7:37 PM, Matthew Malcomson wrote: >> >

[Patch] [mid-end][__RTL] Account for column numbers in __RTL functions

2019-11-15 Thread Matthew Malcomson
The documentation for __RTL tests (see "(gccint) RTL Tests" info node) has the following snippet. ``` The parser expects the RTL body to be in the format emitted by this dumping function: DEBUG_FUNCTION void print_rtx_function (FILE *outfile, function *fn, bool compact); when

[Patch] [mid-end][__RTL] Set global epilogue_completed in skip_pass

2019-11-15 Thread Matthew Malcomson
on native x64_86 gcc/ChangeLog: 2019-11-15 Matthew Malcomson * passes.c (skip_pass): Set epilogue_completed if skipping the pro_and_epilogue pass. gcc/testsuite/ChangeLog: 2019-11-15 Matthew Malcomson * gcc.dg/rtl/aarch64/test-epilogue-set.c: New test

[Patch] [mid-end][__RTL] Clean df state despite invalid __RTL startwith passes

2019-11-14 Thread Matthew Malcomson
reg:DI x19) (reg:DI x0))) (cinsn 10 (use (reg/i:SI x19))) (edge-to exit (flags "FALLTHRU")) ) ;; block 2 ) ;; insn-chain ) ;; function "foo2" } ``` Now it silently ignores the __RTL function and successfully compiles foo2. regtest done on aarch64 regtest done on x86_64 OK f

[mid-end][__RTL] Clean state despite unspecified __RTL startwith passes

2019-11-14 Thread Matthew Malcomson
} ``` Now it silently ignores the __RTL function and successfully compiles foo_a. regtest done on aarch64 regtest done on x86_64 OK for trunk? gcc/ChangeLog: 2019-11-14 Matthew Malcomson * run-rtl-passes.c (run_rtl_passes): Accept and handle empty "initial_pass_name&qu

Re: [PATCH 3/X] [libsanitizer] Add option to bootstrap using HWASAN

2019-11-13 Thread Matthew Malcomson
On 12/11/2019 12:08, Martin Liška wrote: > On 11/11/19 5:03 PM, Matthew Malcomson wrote: >> Ah! >> My apologies -- I sent up a series with a few documentation mistakes. >> (the others were wording problems so less noticeable) > > That's fine, I fixed that very ea

[mid-end] Add notes to dataflow insn info when re-emitting (PR92410)

2019-11-12 Thread Matthew Malcomson
and regression test on aarch64-none-linux-gnu native. gcc/ChangeLog: 2019-11-12 Matthew Malcomson PR middle-end/92410 * bb-reorder.c (pass_reorder_blocks::execute): Recompute dataflow luids once basic blocks have been reordered. * haifa-sched.c (reemit_no

Re: v2 [PATCH 0/X] Introduce HWASAN sanitizer to GCC

2019-11-11 Thread Matthew Malcomson
On 11/11/2019 16:13, Matthew Malcomson wrote: > On 07/11/2019 18:37, Matthew Malcomson wrote: >> I have rebased this series onto Martin Liska's patches that take the most >> recent libhwasan from upstream LLVM. >> https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00340.html >&

Re: v2 [PATCH 0/X] Introduce HWASAN sanitizer to GCC

2019-11-11 Thread Matthew Malcomson
On 07/11/2019 18:37, Matthew Malcomson wrote: > I have rebased this series onto Martin Liska's patches that take the most > recent libhwasan from upstream LLVM. > https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00340.html > > I've also cleared up some nomenclature (I had previousl

Re: [PATCH 3/X] [libsanitizer] Add option to bootstrap using HWASAN

2019-11-11 Thread Matthew Malcomson
On 11/11/2019 14:30, Martin Liška wrote: > On 11/7/19 7:37 PM, Matthew Malcomson wrote: >> +@item @samp{bootstrap-hwasan} >> +Compiles GCC itself using HWAddress Sanitization in order to catch >> invalid >> +memory accesses within the GCC code.  This option is on

[PATCH 7/X] [libsanitizer] Add tests

2019-11-07 Thread Matthew Malcomson
Adding hwasan tests. Frankly, these could be tidied up a little. I will be tidying them up while getting feedback on the hwasan introduction. gcc/testsuite/ChangeLog: 2019-11-07 Matthew Malcomson * c-c++-common/hwasan/arguments.c: New test. * c-c++-common/hwasan

[PATCH 5/X] [libsanitizer][mid-end] Introduce stack variable handling for HWASAN

2019-11-07 Thread Matthew Malcomson
-over tag. Hence we ensure that the entire stack frame is cleared on function exit. gcc/ChangeLog: 2019-11-07 Matthew Malcomson * asan.c (hwasan_record_base): New function. (hwasan_emit_untag_frame): New. (hwasan_increment_tag): New function. (hwasan_with_tag): New

[PATCH 6/X] [libsanitizer] Add hwasan pass and associated gimple changes

2019-11-07 Thread Matthew Malcomson
at behaves exactly the same but has a different name. gcc/ChangeLog: 2019-11-07 Matthew Malcomson * asan.c (handle_builtin_stack_restore): Account for HWASAN. (handle_builtin_alloca): Account for HWASAN. (get_mem_refs_of_builtin_call): Special case strlen

[PATCH 4/X] [libsanitizer][options] Add hwasan flags and argument parsing

2019-11-07 Thread Matthew Malcomson
/ChangeLog: 2019-11-07 Matthew Malcomson * asan.c (memory_tagging_p): New. * asan.h (memory_tagging_p): New. * common.opt (flag_sanitize_recover): Default for kernel hwaddress. (static-libhwasan): New cli option. * config/aarch64/aarch64.c

[PATCH 1/X] [libsanitizer] Tie the hwasan library into our build system

2019-11-07 Thread Matthew Malcomson
This patch does tries to tie libhwasan into the GCC build system in the same way that the other sanitizer runtime libraries are handled. libsanitizer/ChangeLog: 2019-11-07 Matthew Malcomson * Makefile.am: Build libhwasan. * Makefile.in: Build libhwasan. * asan

[PATCH 3/X] [libsanitizer] Add option to bootstrap using HWASAN

2019-11-07 Thread Matthew Malcomson
passed. ChangeLog: 2019-08-29 Matthew Malcomson * configure: Regenerate. * configure.ac: Add --bootstrap-hwasan option. config/ChangeLog: 2019-11-07 Matthew Malcomson * bootstrap-hwasan.mk: New file. libiberty/ChangeLog: 2019-11-07 Matthew Malcomson

[PATCH 2/X] [libsanitizer] Only build libhwasan when targeting AArch64

2019-11-07 Thread Matthew Malcomson
Though the library has limited support for x86, we don't have any support for generating code targeting x86 so there is no point building for that target. libsanitizer/ChangeLog: 2019-11-07 Matthew Malcomson * Makefile.am: Condition building hwasan directory. * Makefile.in

v2 [PATCH 0/X] Introduce HWASAN sanitizer to GCC

2019-11-07 Thread Matthew Malcomson
I have rebased this series onto Martin Liska's patches that take the most recent libhwasan from upstream LLVM. https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00340.html I've also cleared up some nomenclature (I had previously used the word 'colour' a few times instead of the word 'tag' and that

Re: [PATCH 13/X] [libsanitizer][options] Add hwasan flags and argument parsing

2019-11-07 Thread Matthew Malcomson
On 05/11/2019 13:11, Andrey Konovalov wrote: > On Tue, Nov 5, 2019 at 12:34 PM Matthew Malcomson > wrote: >> >> NOTE: >> -- >> I have defined a new macro of __SANITIZE_HWADDRESS__ that gets >> automatically defined when compiling with hwasan. This is

Re: [PATCH 0/X] Introduce HWASAN sanitizer to GCC

2019-11-05 Thread Matthew Malcomson
On 05/11/2019 17:22, Martin Liška wrote: > On 11/5/19 5:11 PM, Matthew Malcomson wrote: >> On 05/11/2019 15:10, Martin Liška wrote: >>> On 11/5/19 12:32 PM, Matthew Malcomson wrote: >>>> Hello, >>>> >>>> This patch series adds the LLVM hardware

Re: [PATCH 0/X] Introduce HWASAN sanitizer to GCC

2019-11-05 Thread Matthew Malcomson
On 05/11/2019 15:10, Martin Liška wrote: > On 11/5/19 12:32 PM, Matthew Malcomson wrote: >> Hello, >> >> This patch series adds the LLVM hardware address sanitizer (HWASAN) to >> GCC.  The document describing HWASAN can be found here &g

Re: [PATCH 0/X] Introduce HWASAN sanitizer to GCC

2019-11-05 Thread Matthew Malcomson
On 05/11/2019 11:32, Matthew Malcomson wrote: > > Testing done: > Full bootstrap and regtest on x86_64 (no difference -- hwasan not used). > > Full bootstrap and regtest on AArch64 sanitizing with hwasan and running > on recent kernel. > Regressions all accounted for: >

[PATCH 16/X] [libsanitizer] Add tests

2019-11-05 Thread Matthew Malcomson
Adding hwasan tests. Frankly, these could be tidied up a little. I will be tidying them up while getting feedback on the hwasan introduction. gcc/testsuite/ChangeLog: 2019-11-05 Matthew Malcomson * c-c++-common/hwasan/arguments.c: New test. * c-c++-common/hwasan

[PATCH 17/X] [libsanitizer] Add hwasan Exception handling

2019-11-05 Thread Matthew Malcomson
29); // x29 +uptr fp = *(uptr *)sp; +if (fp == 0) + return rc; #else #error Unsupported architecture #endif -uptr sp = get_cfa(context); TagMemory(sp, fp - sp, 0); } ## gcc/ChangeLog: 2019-11-05 Matthew Malcomson * asan.c (hwasan_create_personality

[PATCH 18/X] [libsanitizer] Add in MTE stubs

2019-11-05 Thread Matthew Malcomson
it. The optimisation is hence disabled for memory tagging since it provides no benefit and would require all backends that wanted this feature to implement a similar dummy hook. gcc/ChangeLog: 2019-11-05 Matthew Malcomson * asan.c (hwasan_tag_init): Choose initialisation value based

[PATCH 14/X] [libsanitizer][mid-end] Introduce stack variable handling for HWASAN

2019-11-05 Thread Matthew Malcomson
stack area with left-over colour. Hence we ensure that the entire stack frame is cleared on function exit. gcc/ChangeLog: 2019-11-05 Matthew Malcomson * asan.c (hwasan_record_base): New function. (hwasan_emit_uncolour_frame): New. (hwasan_increment_tag): New function

[PATCH 13/X] [libsanitizer][options] Add hwasan flags and argument parsing

2019-11-05 Thread Matthew Malcomson
the point above. -- gcc/ChangeLog: 2019-11-05 Matthew Malcomson * asan.c (memory_tagging_p): New. * asan.h (memory_tagging_p): New. * common.opt (flag_sanitize_recover): Default for kernel hwaddress. (static-libhwasan): New cli option

[PATCH 15/X] [libsanitizer] Add hwasan pass and associated gimple changes

2019-11-05 Thread Matthew Malcomson
a function that behaves exactly the same but has a different name. gcc/ChangeLog: 2019-11-05 Matthew Malcomson * asan.c (handle_builtin_stack_restore): Account for HWASAN. (handle_builtin_alloca): Account for HWASAN. (get_mem_refs_of_builtin_call): Special case strlen

[PATCH 11/X] [libsanitizer] Only build libhwasan when targeting AArch64

2019-11-05 Thread Matthew Malcomson
Though the library has limited support for x86, we don't have any support for generating code targeting x86 so there is no point building for that target. libsanitizer/ChangeLog: 2019-11-05 Matthew Malcomson * Makefile.am: Condition building hwasan directory. * Makefile.in

[PATCH 12/X] [libsanitizer] Add option to bootstrap using HWASAN

2019-11-05 Thread Matthew Malcomson
passed. ChangeLog: 2019-08-29 Matthew Malcomson * configure: Regenerate. * configure.ac: Add --bootstrap-hwasan option. config/ChangeLog: 2019-11-05 Matthew Malcomson * bootstrap-hwasan.mk: New file. libiberty/ChangeLog: 2019-11-05 Matthew Malcomson

[PATCH 10/X] [libsanitizer] Tie the hwasan library into our build system

2019-11-05 Thread Matthew Malcomson
This patch does tries to tie libhwasan into the GCC build system in the same way that the other sanitizer runtime libraries are handled. libsanitizer/ChangeLog: 2019-11-05 Matthew Malcomson * Makefile.am: Build libhwasan. * Makefile.in: Build libhwasan. * asan

[PATCH 8/X] [libsanitizer] Expose __hwasan_tag_mismatch_stub

2019-11-05 Thread Matthew Malcomson
Backport from llvm upstream (monorepo revision 612eadb). This allows us to report tag mismatches without threading it through the backend to generate assembly. libsanitizer/ChangeLog: 2019-11-05 Matthew Malcomson * hwasan/hwasan_interface_internal.h (__hwasan_tag_mismatch4

[PATCH 6/X] [libsanitizer] Add hwasan_exceptions.cpp file

2019-11-05 Thread Matthew Malcomson
This is needed for the hwasan_personality instrumentation I've added. Backported from llvm-svn: 369721 libsanitizer/ChangeLog: 2019-11-05 Matthew Malcomson * hwasan/hwasan_exceptions.cpp: New file. ### Attachment also inlined for ease of reply

[PATCH 7/X] [libsanitizer] Add missing SANITIZER_INTERFACE_ATTRIBUTE on __hwasan_personality_wrapper

2019-11-05 Thread Matthew Malcomson
Backport from llvm upstream llvm-svn: 375298. libsanitizer/ChangeLog: 2019-11-05 Matthew Malcomson * hwasan/hwasan_exceptions.cpp (__hwasan_personality_wrapper): Add missing interface attribute. ### Attachment also inlined for ease of reply

[PATCH 9/X] [libsanitizer] Remove lazy thread initialisation

2019-11-05 Thread Matthew Malcomson
Backport from llvm upstream (monorepo revision 91167e2). This was an experiment made possible by a non-standard feature of the Android dynamic loader. libsanitizer/ChangeLog: 2019-11-05 Matthew Malcomson * hwasan/hwasan_interceptors.cpp (HwasanThreadStartFunc): Re-introduce

[PATCH 4/X] [libsanitizer] libhwasan add longjmp & setjmp interceptors

2019-11-05 Thread Matthew Malcomson
Backported from LLVM git id 67474c60d libsanitizer/ChangeLog: 2019-11-05 Matthew Malcomson * hwasan/hwasan.h (__hw_jmp_buf_struct, __hw_jmp_buf, __hw_sigjmp_buf): Define new types for internal longjmp implementation. * hwasan/hwasan_interceptors.cpp

[PATCH 5/X] [libsanitizer] Remove system allocator fallback

2019-11-05 Thread Matthew Malcomson
Backport from llvm-svn: 375296. This was an experiment made possible by a non-standard feature of the Android dynamic loader. Going without that experiment makes implementation for glibc easier. libsanitizer/ChangeLog: 2019-11-05 Matthew Malcomson * hwasan/hwasan_allocator.cpp

[PATCH 3/X] [libsanitizer] libhwasan initialisation include kernel syscall ABI relaxation

2019-11-05 Thread Matthew Malcomson
Backported from LLVM-svn 375166. libsanitizer/ChangeLog: 2019-11-05 Matthew Malcomson * hwasan/hwasan.cc (InitInstrumentation): Call InitPrctl. * hwasan/hwasan.h (InitPrctl): New decl. * hwasan/hwasan_linux.cc (InitPrctl): New function

[aarch64] Allocate enough space for err_str in aarch64_handle_attr_branch_protection

2019-11-05 Thread Matthew Malcomson
on aarch64 with hwasan (though not a full bootstrap since it's obvious). gcc/ChangeLog: 2019-11-05 Matthew Malcomson * config/aarch64/aarch64.c (aarch64_handle_attr_cpu): Allocate enough bytes for the NULL character. ### Attachment also inlined for ease of reply

[PATCH 2/X] [libsanitizer] Introduce libhwasan to GCC tree

2019-11-05 Thread Matthew Malcomson
revision 368656 as mentioned in libsanitizer/MERGE). libsanitizer/ChangeLog: 2019-11-05 Matthew Malcomson * README.gcc: Mention now including lib/hwasan. * hwasan/hwasan.cpp: New file. * hwasan/hwasan.h: New file. * hwasan/hwasan.syms.extra: New file

[PATCH 1/X][mid-end] Fix declared type of personality functions

2019-11-05 Thread Matthew Malcomson
Matthew Malcomson * expr.c (build_personality_function): Fix generated type to match actual personality functions. ### Attachment also inlined for ease of reply### diff --git a/gcc/expr.c b/gcc/expr.c index 2f2b53f8b6905013b4214eea137d67c666b0c795

Re: [Patch 0/X] [WIP][RFC][libsanitizer] Introduce HWASAN to GCC

2019-10-23 Thread Matthew Malcomson
Hi Martin, I'm getting close to putting up a patch series that I believe could go in before stage1 close. I currently have to do testing on sanitizing the kernel, and track down a bootstrap comparison diff in the code handling shadow-stack cleanup during exception unwinding. I just thought

Question on direction of GCC support for HWASAN.

2019-09-20 Thread Matthew Malcomson
Hello, I'm nearing the point where I think the hardware-asan patch series could go in and would appreciate some feedback on what features need to be implemented before it could be put into trunk. (The RFC can be found at https://gcc.gnu.org/ml/gcc-patches/2019-09/msg00387.html, the only change to

Re: [ARM/FDPIC v6 13/24] [ARM] FDPIC: Force LSB bit for PC in Cortex-M architecture

2019-09-20 Thread Matthew Malcomson
On 19/09/19 16:14, Kyrill Tkachov wrote: > > On 9/19/19 4:13 PM, Christophe Lyon wrote: >> On Tue, 17 Sep 2019 at 14:08, Christophe Lyon >> wrote: >> > >> > On 17/09/2019 13:38, Wilco Dijkstra wrote: >> > > Hi Christophe, >> > > >> > > Can you explain this in more detail - it doesn't make sense

Re: [Patch 0/X] [WIP][RFC][libsanitizer] Introduce HWASAN to GCC

2019-09-11 Thread Matthew Malcomson
On 11/09/19 12:53, Martin Liška wrote: > On 9/9/19 5:54 PM, Matthew Malcomson wrote: >> On 09/09/19 11:47, Martin Liška wrote: >>> On 9/6/19 4:46 PM, Matthew Malcomson wrote: >>>> Hello, >>>> >> As I understand it, `hwasan-abi=interceptor` vs

Re: [SVE] PR86753

2019-09-10 Thread Matthew Malcomson
Resending because I forgot to avoid the disclaimer and hence my email didn't go to the gcc-patches list. On 09/09/19 21:55, Prathamesh Kulkarni wrote: > On Mon, 9 Sep 2019 at 22:06, Prathamesh Kulkarni > wrote: >> >> On Mon, 9 Sep 2019 at 16:45, Richard Sandiford >> wrote: >>> >>> >>> Thanks

Re: [Patch 0/X] [WIP][RFC][libsanitizer] Introduce HWASAN to GCC

2019-09-09 Thread Matthew Malcomson
On 09/09/19 11:47, Martin Liška wrote: > On 9/6/19 4:46 PM, Matthew Malcomson wrote: >> Hello, >> >> This patch series is a WORK-IN-PROGRESS towards porting the LLVM hardware >> address sanitizer (HWASAN) in GCC. The document describing HWASAN can be >> found &

Re: [RFC][PATCH 5/X][libsanitizer] Introduce longjmp/setjmp interceptors to libhwasan

2019-09-09 Thread Matthew Malcomson
On 09/09/19 11:01, Martin Liška wrote: > Hi. > > On 9/6/19 4:46 PM, Matthew Malcomson wrote: >> Ensuring that the shadow stack is cleared on normal function exit will >> be done by adding instrumentation to the function epilogue through the >> compiler. >> lon

Re: [RFC][PATCH 6/X][libsanitizer] Add -fsanitize=hwaddress flags

2019-09-09 Thread Matthew Malcomson
On 09/09/19 11:06, Martin Liška wrote: > On 9/6/19 4:46 PM, Matthew Malcomson wrote: >> This flag can't be used at the same time as any of the other sanitizers. >> We add an equivalent flag to -static-libasan in -static-libhwasan to >> ensure static linking. > > Hello.

[RFC][PATCH 11/X][libsanitizer] Uncolour stack frame on function exit

2019-09-06 Thread Matthew Malcomson
with left-over colour causing a false-positive. Here we ensure that the entire stack frame is cleared on function exit. gcc/ChangeLog: 2019-09-06 Matthew Malcomson * asan.c (hwasan_emit_uncolour_frame): New. * asan.h (hwasan_emit_uncolour_frame): New. * cfgexpand.c

[RFC][PATCH 15/X][libsanitizer] Add in MTE stubs

2019-09-06 Thread Matthew Malcomson
tagging since it provides no benefit without the HWASAN_CHECK functions. This patch also gives backends extra control over how a tag is stored in a pointer and how many real-memory bytes is represented by each byte in the shadow space. gcc/ChangeLog: 2019-09-06 Matthew Malcomson * asan.c

[RFC][PATCH 10/X][libsanitizer] Colour the shadow stack for each stack variable

2019-09-06 Thread Matthew Malcomson
. This is the first patch where we use the HWASAN shadow space, so we need to add in the libhwasan initialisation code that creates this shadow memory region into the binary we produce. This instrumentation is done in `compile_file`. gcc/ChangeLog: 2019-09-06 Matthew Malcomson * asan.c

[RFC][PATCH 9/X][libsanitizer] Put tags into each stack variable pointer

2019-09-06 Thread Matthew Malcomson
addition -- by using a hook in force_operand and hwasan_with_tag -- the method of adding a new RTL expression is under flux). gcc/ChangeLog: 2019-09-06 Matthew Malcomson * asan.c (hwasan_record_base): New function. (hwasan_increment_tag):New function. (hwasan_with_tag

[RFC][PATCH 16/X][libsanitizer] Build libhwasan with interceptors

2019-09-06 Thread Matthew Malcomson
Matthew Malcomson * hwasan/Makefile.am: Set HWASAN_WITH_INTERCEPTORS macro. * hwasan/Makefile.in: Regenerate. ### Attachment also inlined for ease of reply### diff --git a/libsanitizer/hwasan/Makefile.am b/libsanitizer/hwasan/Makefile.am index

[RFC][PATCH 14/X][libsanitizer] Introduce HWASAN block-scope poisoning

2019-09-06 Thread Matthew Malcomson
that the naming may be a little confusing, but a positive that handling of the internal function doesn't have to be duplicated for a function that behaves exactly the same but has a different name. gcc/ChangeLog: 2019-09-06 Matthew Malcomson * asan.c (asan_expand_mark_ifn): New

[RFC][PATCH 13/X][libsanitizer] Instrument known builtin function calls

2019-09-06 Thread Matthew Malcomson
e specific handling of such stack modifications. gcc/ChangeLog: 2019-09-06 Matthew Malcomson * asan.c (handle_builtin_stack_restore): Handle HWASAN. (handle_builtin_alloca): Handle HWASAN. (get_mem_refs_of_builtin_call): Avoid strlen for HWASAN. (maybe_instr

[RFC][PATCH 7/X][libsanitizer] Add option to bootstrap using HWASAN

2019-09-06 Thread Matthew Malcomson
passed. ChangeLog: 2019-08-29 Matthew Malcomson * configure: Regenerate. * configure.ac: Add --bootstrap-hwasan option. config/ChangeLog: 2019-09-06 Matthew Malcomson * bootstrap-hwasan.mk: New file. gcc/ChangeLog: 2019-09-06 Matthew Malcomson * asan.c

[RFC][PATCH 12/X][libsanitizer] Check pointer tags match address tags

2019-09-06 Thread Matthew Malcomson
on a tag mismatch, and always check tags via a library call to libhwasan. Allowing a program to continue from tag mismatch, and implementing inline checks are intended for a later revision. gcc/ChangeLog: 2019-09-06 Matthew Malcomson * asan.c (build_check_stmt): Generate HWASAN_CHECK

[RFC][PATCH 8/X][libsanitizer] Ensure HWASAN required alignment for stack variables

2019-09-06 Thread Matthew Malcomson
for the current frame. This patch also adds some macros defining how the HWASAN shadow memory is stored and how a tag is stored in a pointer. gcc/ChangeLog: 2019-09-06 Matthew Malcomson * asan.h (HWASAN_TAG_SIZE): New macro. (HWASAN_TAG_GRANULE_SIZE):New macro

[RFC][PATCH 2/X][libsanitizer] Tie the hwasan library into our build system

2019-09-06 Thread Matthew Malcomson
This patch does tries to tie libhwasan into the GCC build system in the same way that the other sanitizer runtime libraries are handled. libsanitizer/ChangeLog: 2019-09-06 Matthew Malcomson * Makefile.am: Build libhwasan. * Makefile.in: Build libhwasan. * asan

[RFC][PATCH 5/X][libsanitizer] Introduce longjmp/setjmp interceptors to libhwasan

2019-09-06 Thread Matthew Malcomson
be able to handle sigsetjmp we manually define a __sigset_t structure and similarly we define data structures to use for the intercepting setjmp/longjmp. libsanitizer/ChangeLog: 2019-09-06 Matthew Malcomson * hwasan/Makefile.am: Add hwasan_setjmp.S. * hwasan/Makefile.in: Regenerate

[RFC][PATCH 6/X][libsanitizer] Add -fsanitize=hwaddress flags

2019-09-06 Thread Matthew Malcomson
This flag can't be used at the same time as any of the other sanitizers. We add an equivalent flag to -static-libasan in -static-libhwasan to ensure static linking. gcc/ChangeLog: 2019-09-06 Matthew Malcomson * common.opt (static-libhwasan): New cli option. * config/gnu

[RFC][PATCH 4/X][libsanitizer] Pass size and pointer info to error reporting functions

2019-09-06 Thread Matthew Malcomson
the commit does not apply cleanly. libsanitizer/ChangeLog: 2019-09-06 Matthew Malcomson * hwasan/hwasan.cc (CheckAddressSized): Use new sized SigTrap. (SigTrap): Record pointer in x0 for error report and add an overloaded version that takes both pointer and size

[RFC][PATCH 3/X][libsanitizer] Allow compilation for HWASAN_WITH_INTERCEPTORS=OFF

2019-09-06 Thread Matthew Malcomson
This is a port of the LLVM-svn commit number 359914, it allows compilation of the library without using interceptors. This has been useful for testing. libsanitizer/ChangeLog: 2019-09-06 Matthew Malcomson * hwasan/hwasan_linux.cc: Allow compilation without interceptors

[Patch 0/X] [WIP][RFC][libsanitizer] Introduce HWASAN to GCC

2019-09-06 Thread Matthew Malcomson
Hello, This patch series is a WORK-IN-PROGRESS towards porting the LLVM hardware address sanitizer (HWASAN) in GCC. The document describing HWASAN can be found here http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html. The current patch series is far from complete, but I'm

[RFC][PATCH 1/X][libsanitizer] Introduce libsanitizer to GCC tree

2019-09-06 Thread Matthew Malcomson
sanitizer libraries are taken from (SVN revision 345033 as mentioned in libsanitizer/MERGE). libsanitizer/ChangeLog: 2019-09-06 Matthew Malcomson * hwasan/hwasan.cc: New file. * hwasan/hwasan.h: New file. * hwasan/hwasan.syms.extra: New file. * hwasan

[Patch] [aarch64] Change two function declaration types

2019-05-24 Thread Matthew Malcomson
to see that -march=armv8-a+typo prints out the expected flags while using the new feature flags does not complain about missing flags. gcc/ChangeLog: 2019-05-24 Matthew Malcomson PR target/90588 * common/config/aarch64/aarch64-common.c (aarch64_rewrite_selected_cpu): Change

Re: [PATCH] [aarch64] Introduce flags for SVE2.

2019-05-15 Thread Matthew Malcomson
> Matthew Malcomson writes: >> @@ -326,16 +326,22 @@ int opt_ext_cmp (const void* a, const void* b) Cheers Richard -- modified patch attached and inlined. MM ### Attachment also inlined for ease of reply### diff --git a/gcc/common/config/aarch6

Re: [PATCH] [aarch64] Introduce flags for SVE2.

2019-05-15 Thread Matthew Malcomson
On 15/05/19 09:46, Matthew Malcomson wrote: >> Matthew Malcomson writes: Oops ... messed up my email there. Patch is attached to this email. diff --git a/gcc/common/config/aarch64/aarch64-common.c b/gcc/common/config/aarch64/aarch64-common.c index bab3ab3fa36c66906d1b4367e2b7bfb1bf

Re: [PATCH] [aarch64] Introduce flags for SVE2.

2019-05-15 Thread Matthew Malcomson
> Matthew Malcomson writes: >> @@ -326,16 +326,18 @@ int opt_ext_cmp (const void* a, const void* b) >> turns on as a dependency. As an example +dotprod turns on FL_DOTPROD >> and >> FL_SIMD. As such the set of bits represented by this option is &g

[PATCH] [aarch64] Introduce flags for SVE2.

2019-05-09 Thread Matthew Malcomson
f those variables working with these feature flags to ensure they use 64 bit quantities. Tested with bootstrap on aarch64-none-linux-gnu and manually seeing that -march=armv8-a+typo prints out the expected flags while using the new feature flags does not complain about a missing flag (until reaching th

Re: [Patch] [testsuite][arm] Update warning prune regex

2019-04-12 Thread Matthew Malcomson
On 12/04/19 15:16, Christophe Lyon wrote: > On Thu, 11 Apr 2019 at 11:26, Matthew Malcomson > wrote: >> >> r269586 changed the format of some warning messages. >> >> Each switch in the warning message is now surrounded by single quotes. >> >> This com

[Patch] [testsuite][arm] Update warning prune regex

2019-04-11 Thread Matthew Malcomson
(e.g. arm-eabi-aem/-marm/-march=armv7-a/-mfpu=vfpv3-d16/-mfloat-abi=softfp). Regtested arm.exp with cross-compiler arm-none-eabi gcc/testsuite/ChangeLog: 2019-04-11 Matthew Malcomson * g++.target/arm/arm.exp: Change format of default prune regex. * gcc.target/arm/arm.exp

Re: [Patch] [arm] Ensure *neon_mov constraint uses correct mode.

2019-04-08 Thread Matthew Malcomson
On 08/04/19 14:00, Kyrill Tkachov wrote: > Hi Matthew, > > On 4/5/19 12:06 PM, Matthew Malcomson wrote: >> >> Bootstrapped and regtested on arm-none-linux-gnueabihf >> Regtested on cross-compiler arm-none-eabi >> > > Does this fix a PR? &g

[Patch] [arm] Ensure *neon_mov constraint uses correct mode.

2019-04-05 Thread Matthew Malcomson
/neon.md (*neon_mov): Account for TImode and DImode differences directly. (*smax3_neon, vashl3, vashr3_imm): Use Dm constraint. gcc/testsuite/ChangeLog: 2019-04-05 Matthew Malcomson * gcc.dg/torture/neon-immediate-timode.c: New test. ### Attachment also in

Re: [Patch] [aarch64] PR target/89324 Handle stack pointer for SUBS/ADDS instructions

2019-02-22 Thread Matthew Malcomson
Hi James, On 22/02/19 00:09, James Greenhalgh wrote: > On Mon, Feb 18, 2019 at 08:40:12AM -0600, Matthew Malcomson wrote: >> >> Additionally, this patch contains two tidy-ups (happy to remove them or put >> in >> a separate patch if people want): > > Gener

[Patch] [aarch64] PR target/89324 Handle stack pointer for SUBS/ADDS instructions

2019-02-18 Thread Matthew Malcomson
nch of RTL testcases that I used in development, these don't exercise much of the compiler and are pretty specific to the backend as it currently is, so I'm not sure they give much value. I'd appreciate feedback on whether this is in general considered useful. gcc/ChangeLog: 2019-02-18 Matthew Malcoms

Re: [Patch] [arm] Fix 88714, Arm LDRD/STRD peepholes

2019-02-11 Thread Matthew Malcomson
none-linux-gnueabihf. Also ran this testcase with `make check` natively. Ok for trunk? gcc/testsuite/ChangeLog: 2019-02-11 Matthew Malcomson * gcc.dg/rtl/arm/ldrd-peepholes.c: Restrict testcase. * lib/target-supports.exp: Add procedure to check for ldrd. diff --git a/gcc/tes

Re: [Patch] [arm] Fix 88714, Arm LDRD/STRD peepholes

2019-02-08 Thread Matthew Malcomson
On 08/02/19 10:23, Jakub Jelinek wrote: > On Fri, Feb 08, 2019 at 11:06:02AM +0100, Christophe Lyon wrote: >> On Fri, 8 Feb 2019 at 10:51, Jakub Jelinek wrote: >>> >>> On Fri, Feb 08, 2019 at 10:18:03AM +0100, Christophe Lyon wrote: I'm afaid this patch causes several regressions. Maybe they

[committed] [obvious][testsuite] Only run rtl/arm/ldrd-peepholes.c test on arm architecture

2019-02-07 Thread Matthew Malcomson
My previous patch failed to only run an arm test on arm architecture. This adds that condition to the test. Committed to trunk as obvious. gcc/testsuite/ChangeLog: 2019-02-07 Matthew Malcomson * gcc.dg/rtl/arm/ldrd-peepholes.c: Only run on arm ### Attachment also

Re: [Patch] [arm] Fix 88714, Arm LDRD/STRD peepholes

2019-02-07 Thread Matthew Malcomson
well. > > This looks ok to me. > Thanks for fixing this and thanks Jakub for the analysis and fixes too! > > Kyrill > Thanks Kyrill, I've committed with the changelog below. gcc/ChangeLog: 2019-02-07 Matthew Malcomson Jakub Jelinek PR bootstr

[Patch] [arm] Fix 88714, Arm LDRD/STRD peepholes

2019-02-05 Thread Matthew Malcomson
and regtested on arm-none-linux-gnu. Demonstrated fix of bug 88714 by bootstrapping on armv7l. gcc/ChangeLog: 2019-02-05 Matthew Malcomson PR bootstrap/88714 * config/arm/arm-protos.h (valid_operands_ldrd_strd, arm_count_ldrdstrd_insns): New declarations

Re: [RFC] [Patch] [Debug] Add new FUNCTION_BEG NOTE to be used for debugging.

2019-01-18 Thread Matthew Malcomson
Ping. (note -- when running the GDB testsuite ensuring that -fstack-protector-all is used for compiling each testcase, this patch fixes over 1500 FAIL's) On 10/01/19 13:28, Matthew Malcomson wrote: > At the moment NOTE_INSN_FUNCTION_BEG is used for three different purposes. > The

[RFC] [Patch] [Debug] Add new NOTE to be used for debugging.

2019-01-10 Thread Matthew Malcomson
tests done on resulting debug information -- yet to be automated. gcc/ChangeLog: 2019-01-10 Matthew Malcomson PR debug/88432 * cfgexpand.c (pass_expand::execute): Insert NOTE_INSN_DEBUG_FUNCTION_BEG. * function.c (thread_prologue_and_epilogue_insns

ping: [PATCH][GCC][AARCH64]Introduce aarch64 atomic_{load,store}ti patterns

2018-12-17 Thread Matthew Malcomson
Ping On 27/09/18 14:43, Matthew Malcomson wrote: > [PATCH][GCC][AARCH64] Introduce aarch64 atomic_{load,store}ti patterns > > In Armv8.4-a these patterns use the LDP/STP instructions that are guaranteed > to > be single-copy atomic, ensure correct memory ordering semantics by

[Patch][gcc][testsuite] Skip testcases using freopen when on wrapped board

2018-11-16 Thread Matthew Malcomson
On 16/11/18 16:04, Jeff Law wrote: > On 11/15/18 12:06 PM, Martin Sebor wrote: >> On 11/15/2018 02:39 AM, Matthew Malcomson wrote: >>> If not we could add an >>>     { dg-require-effective-target unwrapped } >>> directive in the testcases to stop the fai

Re: [PATCH] avoid -Wnonnull for printf format in dead code (PR 87041)

2018-11-15 Thread Matthew Malcomson
On 02/11/18 09:54, Christophe Lyon wrote: > Hi, > > I've noticed failure on targets using newlib (aarch64-elf and arm-eabi): > FAIL: gcc.c-torture/execute/printf-2.c > FAIL: gcc.c-torture/execute/user-printf.c > > my gcc.log contains: > gcc.c-torture/execute/user-printf.c -O0 execution test

Re: [PATCH] detect attribute mismatches in alias declarations (PR 81824)

2018-11-12 Thread Matthew Malcomson
Hello Martin, The new testcase Wattribute-alias.c fails on targets without ifunc support (e.g. aarch64-none-elf cross-build). It seems that just adding a directive `{ dg-require-ifunc "" }` to the test file changes the test to unsupported instead of having a fail. I don't know much about this

Re: [C++ PATCH 1/3] Fix various latent issues revealed by P0732 work.

2018-11-09 Thread Matthew Malcomson
(Third attempt to put this on the mailing list now -- today is not a good day for my email skills :-[) Hi there, This patch has caused a few g++ and libstdc++ regression test failures on arm, I've included the g++ failures below. Do you mind looking into this? Cheers, Matthew

Re: [Patch][gdb] Initialise quiet flag for "info functions"

2018-11-02 Thread Matthew Malcomson
Oops -- wrong list -- please ignore. On 02/11/18 11:27, Matthew Malcomson wrote: > With this flag unset, using 'info functions' without a set quiet flag > was not deterministic and was causing some flaky test failures. > > Failures seen in (at least). > gdb.base/info_qt.exp > g

[Patch][gdb] Initialise quiet flag for "info functions"

2018-11-02 Thread Matthew Malcomson
/ChangeLog: 2018-11-02 Matthew Malcomson * symtab.c (info_functions_command): Initialise quiet flag. ### Attachment also inlined for ease of reply### diff --git a/gdb/symtab.c b/gdb/symtab.c index cd27a75e8ca2370a9d11ae6057d051ca6ce13f90

[Patch][gdb] Initialise quiet flag for "info functions"

2018-11-02 Thread Matthew Malcomson
/ChangeLog: 2018-11-02 Matthew Malcomson * symtab.c (info_functions_command): Initialise quiet flag. ### Attachment also inlined for ease of reply### diff --git a/gdb/symtab.c b/gdb/symtab.c index cd27a75e8ca2370a9d11ae6057d051ca6ce13f90

Re: [PATCH][GCC][AARCH64]Introduce aarch64 atomic_{load,store}ti patterns

2018-10-15 Thread Matthew Malcomson
ping On 27/09/18 14:43, Matthew Malcomson wrote: [PATCH][GCC][AARCH64] Introduce aarch64 atomic_{load,store}ti patterns In Armv8.4-a these patterns use the LDP/STP instructions that are guaranteed to be single-copy atomic, ensure correct memory ordering semantics by using the DMB instruction

Re: [PATCH, AArch64 10/11] aarch64: Implement TImode compare-and-swap

2018-10-01 Thread Matthew Malcomson
Hi Richard, On 26/09/18 06:03, rth7...@gmail.com wrote: From: Richard Henderson This pattern will only be used with the __sync functions, because we do not yet have a bare TImode atomic load. Does this mean that the libatomic `defined(atomic_compare_exchange_n)` checks would return false

Re: [PATCH][GCC][AARCH64] Add even-pair register classes

2018-09-28 Thread Matthew Malcomson
Hi Wilko, On 28/09/18 13:33, Wilco Dijkstra wrote: Matthew wrote: The canonical way to require even-odd pairs of registers to implement a TImode pseudo register as mentioned in the documentation is to limit *all* TImode registers to being even-odd by using the TARGET_HARD_REGNO_MODE_OK hook.

Re: [PATCH, AArch64 10/11] aarch64: Implement TImode compare-and-swap

2018-09-27 Thread Matthew Malcomson
On 27/09/18 17:32, Richard Henderson wrote: On 9/27/18 6:04 AM, Matthew Malcomson wrote: Hi Richard, On 26/09/18 06:03, rth7...@gmail.com wrote: From: Richard Henderson This pattern will only be used with the __sync functions, because we do not yet have a bare TImode atomic load. I

<    1   2   3   >