[PATCH][GCC][AARCH64] Canonicalize aarch64 widening simd plus insns

2018-07-11 Thread Matthew Malcomson
differing requirements. Ready for trunk? Bootstrap and test on aarch64-none-linux-gnu Changelog for gcc/testsuite/Changelog 2018-07-10  Matthew Malcomson      * gcc.target/aarch64/vect-su-add-sub.c: New. Changelog for gcc/Changelog 2018-07-10  Matthew Malcomson      * config/aarch64

Re: [PATCH][GCC][AARCH64] Canonicalize aarch64 widening simd plus insns

2018-07-19 Thread Matthew Malcomson
Hi again. Providing an updated patch to include the formatting suggestions. Thanks, Matthew On 12/07/18 11:39, Sudakshina Das wrote: Hi Matthew On 12/07/18 11:18, Richard Sandiford wrote: Looks good to me FWIW (not a maintainer), just a minor formatting thing: Matthew Malcomson writes

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 I'

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

2019-11-05 Thread Matthew Malcomson
og: 2019-11-05 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 2f2b53f8b6905013b4214eea1

[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

[aarch64] Allocate enough space for err_str in aarch64_handle_attr_branch_protection

2019-11-05 Thread Matthew Malcomson
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

[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

[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 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 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 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

[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 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 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 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. * Makefi

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

2019-11-05 Thread Matthew Malcomson
given 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 o

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

2019-11-05 Thread Matthew Malcomson
o be duplicated for 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):

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

2019-11-05 Thread Matthew Malcomson
st a shadow 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):

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

2019-11-05 Thread Matthew Malcomson
-uptr fp = get_gr(context, 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 * asa

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

2019-11-05 Thread Matthew Malcomson
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 bas

[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

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: >

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 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 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

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 cla

[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. * Makefi

[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 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 4/X] [libsanitizer][options] Add hwasan flags and argument parsing

2019-11-07 Thread Matthew Malcomson
gcc/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/aarc

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

2019-11-07 Thread Matthew Malcomson
ed for a function that 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):

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

2019-11-07 Thread Matthew Malcomson
with left-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

[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

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

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

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

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

2019-11-12 Thread Matthew Malcomson
otstrapped 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

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 ve

[Patch] [AArch64] [SVE] Implement svld1ro intrinsic.

2020-01-09 Thread Matthew Malcomson
e at https://developer.arm.com/architectures/system-architectures/software-standards/acle gcc/ChangeLog: 2020-01-09 Matthew Malcomson * config/aarch64/aarch64-protos.h (aarch64_sve_ld1ro_operand_p): New. * config/aarch64/aarch64-sve-builtins-base.cc (class load

Re: Document --with-build-config=bootstrap-asan option.

2020-01-13 Thread Matthew Malcomson
On 11/01/2020 07:19, Gerald Pfeifer wrote: > On Thu, 12 Dec 2019, Matthew Malcomson wrote: >> gcc/ChangeLog: >> >> 2019-12-12 Matthew Malcomson >> >> * doc/install.texi: Document bootstrap-asan configuration option. > > I see this introduces a n

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

2020-01-13 Thread Matthew Malcomson
> On 12/12/19 4:19 PM, Matthew Malcomson wrote: >> - if (is_store && !param_asan_instrument_writes) >> + if (is_store >> + && (!param_asan_instrument_writes || !param_hwasan_instrument_writes)) >> return; >> - if (!is_store &a

[PATCH][AArch64] Enable CLI for Armv8.6-A f64mm

2020-01-13 Thread Matthew Malcomson
Matthew Malcomson * config/aarch64/aarch64-c.c (_ARM_FEATURE_MATMUL_FLOAT64): Introduce this ACLE specified predefined macro. * config/aarch64/aarch64-option-extensions.def (f64mm): New. (fp): Disabling this disables f64mm. (simd): Disabling this disables

Re: [Patch] [AArch64] [SVE] Implement svld1ro intrinsic.

2020-01-20 Thread Matthew Malcomson
On 20/01/2020 14:53, Christophe Lyon wrote: > On Thu, 9 Jan 2020 at 16:53, Matthew Malcomson > wrote: >> >> + (match_test "aarch64_sve_ld1ro_operand_p (op, DImode)"))) >> + > > >> (define_predicate "aarch64_sve_ldff1_operand" &

[AArch64] effective_target for aarch64 f64mm asm

2020-01-21 Thread Matthew Malcomson
read. Testing Done: Checked on a cross-compiler that: Tests running for binutils commit e264b5b7a are listed as UNSUPPORTED. Tests running for binutils commit 26916852e all pass. gcc/testsuite/ChangeLog: 2020-01-21 Matthew Malcomson * gcc.target/aarch64/sve/acle/asm/ld1ro_f16.c: Use re

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

2019-12-09 Thread Matthew Malcomson
Ah, apologies -- you're right. I'd already committed the patch this morning, so I'll update it with the obvious fix. Thanks for the catch, Matthew On 09/12/2019 12:48, Martin Liška wrote: > Hello. > > The patch triggers the following warning: > > In file included from /home/marxin/Programming

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

2019-12-09 Thread Matthew Malcomson
Ah, apologies -- you're right. I'd already committed the patch this morning, so I'll update it with the obvious fix. Thanks for the catch, Matthew On 09/12/2019 12:48, Martin Liška wrote: > Hello. > > The patch triggers the following warning: > > In file included from /home/marxin/Programming

Re: [PATCH] bring -Warray-bounds closer to -Wstringop-overflow (PR91647, 91463, 91679)

2019-12-09 Thread Matthew Malcomson
On 01/11/2019 21:09, Martin Sebor wrote: > diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c > index 53278168a59..d7c74a1865a 100644 > --- a/gcc/gimple-match-head.c > +++ b/gcc/gimple-match-head.c > @@ -837,8 +837,8 @@ try_conditional_simplification (internal_fn ifn, > gimple_match_op

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

2019-12-12 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-12-12 Matthew Malcomson * Makefile.am: Condition building hwasan directory. * Makefi

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

2019-12-12 Thread Matthew Malcomson
gcc/ChangeLog: 2019-12-12 Matthew Malcomson * common.opt (flag_sanitize_recover): Default for kernel hwaddress. (static-libhwasan): New cli option. * config/aarch64/aarch64.c (aarch64_can_tag_addresses): New. (TARGET_MEMTAG_CAN_TAG_ADDRESSES)

[Patch 0/X] HWASAN v3

2019-12-12 Thread Matthew Malcomson
Hello, I've gone through the suggestions Martin made and implemented the ones I think I can implement for GCC10. The two functionality changes in this version are: Added the --param's hwasan-instrument-reads, hwasan-instrument-writes, hwasan-instrument-allocas, hwasan-memintrin, options. I.e. T

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

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

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

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

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

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

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

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

[PATCH 7/X] [libsanitizer] Add tests

2019-12-12 Thread Matthew Malcomson
Adding hwasan tests. Only interesting thing here is that we have to make sure the tagging mechanism is deterministic to avoid flaky tests. gcc/testsuite/ChangeLog: 2019-12-12 Matthew Malcomson * c-c++-common/hwasan/aligned-alloc.c: New test. * c-c++-common/hwasan/alloca

Document --with-build-config=bootstrap-asan option.

2019-12-12 Thread Matthew Malcomson
eanly). gcc/ChangeLog: 2019-12-12 Matthew Malcomson * doc/install.texi: Document bootstrap-asan configuration option. ### commit 6e0bbe33120ad3f92e4266ecfe4ecb8ce8958865 Author: Matthew Malcomson Date: Wed Nov 6 12:48:08 2019 + Document bootstrap-asan compil

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

2019-12-12 Thread Matthew Malcomson
the HWASAN sanitizer when compiling libiberty and the lto-plugin. Also add a function to query whether -fsanitize=hwaddress has been passed. ChangeLog: 2019-08-29 Matthew Malcomson * configure: Regenerate. * configure.ac: Add --bootstrap-hwasan option. config/ChangeLog: 2019

Re: [PATCH 7/X] [libsanitizer] Add tests

2019-12-16 Thread Matthew Malcomson
is that we have to make sure the tagging mechanism is deterministic to avoid flaky tests. gcc/testsuite/ChangeLog: 2019-12-16 Matthew Malcomson * c-c++-common/hwasan/aligned-alloc.c: New test. * c-c++-common/hwasan/alloca-array-accessible.c: New test. * c-c++-common

Re: [Patch 0/X] HWASAN v3

2019-12-17 Thread Matthew Malcomson
es. I figure I should make this easy on anyone that wants to try the patch series out, so I'm attaching a compressed tarfile containing the entire patch series plus the additional documentation patch so it can all be applied at once with `git apply *`. It's attached. Matthew. On

[PING] Re: [Patch 0/X] HWASAN v3

2020-01-06 Thread Matthew Malcomson
Ping On 17/12/2019 14:11, Matthew Malcomson wrote: > I've noticed a few minor problems with this patch series after I sent it > out (mostly testcase stuff, one documentation tidy-up, but also that one > patch didn't bootstrap due to something fixed in a later patch). &g

Re: [Patch 0/X] HWASAN v3

2020-01-08 Thread Matthew Malcomson
peed then please just ask. Cheers, Matthew On 07/01/2020 15:14, Martin Liška wrote: > On 12/12/19 4:18 PM, Matthew Malcomson wrote: > > Hello. > > I've just sent few comments that are related to the v3 of the patch set. > Based on the HWASAN (limited) knowledge

gcc: docs: Fix documentation of two hooks

2024-04-08 Thread Matthew Malcomson
The `function_attribute_inlinable_p` hook documentation described it returning the value if it is OK to inline the provided fndecl into "the current function". AFAICS This hook is only called when `current_function_decl` is the same as the `fndecl` argument that the hook is given, hence asking whe

Re: [PATCH] arm: fix c23 0-named-args caller-side stdarg

2024-02-26 Thread Matthew Malcomson
Hi Alexandre, I don't have the ability to OK the patch, but I'm attempting to do a review in order to reduce the workload for any maintainer.  (Apologies for the slow response). I think you're right that the AAPCS32 requires all arguments to be passed in registers for this testcase. (Nit on th

Re: gcc: docs: Fix documentation of two hooks

2024-07-01 Thread Matthew Malcomson
t; in any way. On 4/8/24 11:34, Matthew Malcomson wrote: The `function_attribute_inlinable_p` hook documentation described it returning the value if it is OK to inline the provided fndecl into "the current function". AFAICS This hook is only called when `current_function_decl` is the

testsuite: Remove no_fsanitize_address install directory dependency

2024-07-10 Thread Matthew Malcomson
The current no_fsanitize_address effective target check (implemented in target-supports.exp rather than in asan.exp) has some problems with the link path. Because it is not called from in between asan_init and asan_finish the link paths of the compiler are not changed to point at the build directo

Re: testsuite: Remove no_fsanitize_address install directory dependency

2024-07-10 Thread Matthew Malcomson
property that uses a different name to cache under, given that this is testing something different than the original function. Have again tested that the problematic tests run without an install directory. On 7/10/24 13:19, Matthew Malcomson wrote: The current no_fsanitize_address effective

Re: testsuite: Remove no_fsanitize_address install directory dependency

2024-07-10 Thread Matthew Malcomson
On 7/10/24 13:42, Rainer Orth wrote: N.b. one alternative would be to remove this effective target and try to move all tests which currently use this into directories which run their tests between calls to `asan_finish` and `asan_init`. This seems like it might ensure a clearer division of "asan

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

2020-08-17 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: * Makefile.am: Condition building hwasan directory. * Makefile.in: Regenerate. * configure: Re

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

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

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

2020-08-17 Thread Matthew Malcomson
This is an analogous option to --bootstrap-asan to configure. It allows bootstrapping GCC using HWASAN. For the same reasons as for ASAN we have to avoid using the HWASAN sanitizer when compiling libiberty and the lto-plugin. Also add a function to query whether -fsanitize=hwaddress has been pas

[PATCH 7/X] libsanitizer: Add tests

2020-08-17 Thread Matthew Malcomson
Adding hwasan tests. Only interesting thing here is that we have to make sure the tagging mechanism is deterministic to avoid flaky tests. gcc/testsuite/ChangeLog: * c-c++-common/hwasan/aligned-alloc.c: New test. * c-c++-common/hwasan/alloca-array-accessible.c: New test.

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

2020-08-17 Thread Matthew Malcomson
Handling stack variables has three features. 1) Ensure HWASAN required alignment for stack variables When tagging shadow memory, we need to ensure that each tag granule is only used by one variable at a time. This is done by ensuring that each tagged variable is aligned to the tag granule repres

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

2020-08-17 Thread Matthew Malcomson
There are four main features to this change: 1) Check pointer tags match address tags. In the new `hwasan` pass we put HWASAN_CHECK internal functions before all memory accesses to check that tags in the pointer being used match the tag stored in shadow memory for the memory region being used. T

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

2020-08-17 Thread Matthew Malcomson
These flags 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. The -fsanitize=kernel-hwaddress option is for compiling targeting the kernel. This flag has defaults that allow compiling KASAN wi

[testsuite] Add @ lines to check-function-bodies fluff

2020-03-10 Thread Matthew Malcomson
o I'd like to remove such `@` lines automatically. gcc/testsuite/ChangeLog: 2020-03-10 Matthew Malcomson * lib/scanasm.exp (parse_function_bodies): Lines starting with '@' also counted as fluff. ### Attachment also inlined for ease of reply

Fwd: [testsuite] Add @ lines to check-function-bodies fluff

2020-03-10 Thread Matthew Malcomson
Cc'ing maintainers and original author of `check-function-bodies`. It looks like I missed that the first time around. Forwarded Message Subject: [testsuite] Add @ lines to check-function-bodies fluff Date: Tue, 10 Mar 2020 17:22:52 + From: Matthew Malcomson To

SLS Mitigation patches backported for GCC9

2020-07-21 Thread Matthew Malcomson
Hello, Eventually we will want to backport the SLS patches to older branches. When the GCC10 release is unfrozen we will work on getting the same patches already posted backported to that branch. The patches already posted on the mailing list apply cleanly to the current releases/gcc-10 branch.

aarch64: (GCC-9 Backport) Introduce SLS mitigation for RET and BR instructions

2020-07-21 Thread Matthew Malcomson
Instructions following RET or BR are not necessarily executed. In order to avoid speculation past RET and BR we can simply append a speculation barrier. Since these speculation barriers will not be architecturally executed, they are not expected to add a high performance penalty. The speculation

aarch64: (GCC-9 Backport) Mitigate SLS for BLR instruction

2020-07-21 Thread Matthew Malcomson
This patch introduces the mitigation for Straight Line Speculation past the BLR instruction. This mitigation replaces BLR instructions with a BL to a stub which uses a BR to jump to the original value. These function stubs are then appended with a speculation barrier to ensure no straight line sp

aarch64: (GCC-9 Backport) New Straight Line Speculation (SLS) mitigation flags

2020-07-21 Thread Matthew Malcomson
Here we introduce the flags that will be used for straight line speculation. The new flag introduced is `-mharden-sls=`. This flag can take arguments of `none`, `all`, or a comma seperated list of one or more of `retbr` or `blr`. `none` indicates no special mitigation of the straight line speculat

Re: SLS Mitigation patches backported for GCC9

2020-07-24 Thread Matthew Malcomson
On 24/07/2020 12:01, Kyrylo Tkachov wrote: Hi Matthew, -Original Message- From: Matthew Malcomson Sent: 21 July 2020 16:16 To: gcc-patches@gcc.gnu.org Cc: Richard Earnshaw ; Kyrylo Tkachov ; Ross Burton Subject: SLS Mitigation patches backported for GCC9 Hello, Eventually we will

[Arm] Implement CDE intrinsics for MVE registers.

2020-03-26 Thread Matthew Malcomson
by Dennis. https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542008.html Ok for trunk? gcc/ChangeLog: 2020-03-26 Matthew Malcomson * config.gcc (arm_mve_types.h): New extra_header for arm. * config/arm/arm-builtins.c (arm_resolve_overloaded_builtin): New

[Arm] Implement CDE predicated intrinsics for MVE registers

2020-04-07 Thread Matthew Malcomson
ug.cgi?id=94341 gcc/ChangeLog: 2020-04-07 Matthew Malcomson * config/arm/arm-builtins.c (CX_UNARY_UNONE_QUALIFIERS): New. (CX_BINARY_UNONE_QUALIFIERS): New. (CX_TERNARY_UNONE_QUALIFIERS): New. (arm_resolve_overloaded_builtin): Move to arm-c.c. (arm_expa

[Arm] Implement CDE intrinsics for MVE registers.

2020-04-08 Thread Matthew Malcomson
Ok for trunk? gcc/ChangeLog: 2020-04-08 Matthew Malcomson * config.gcc (arm_mve_types.h): New extra_header for arm. * config/arm/arm-builtins.c (arm_resolve_overloaded_builtin): New. (arm_init_cde_builtins): New. (arm_init_acle_builtins): Remove initialisation

[Arm] Implement CDE predicated intrinsics for MVE registers

2020-04-08 Thread Matthew Malcomson
pace between the mnemonic and the first argument, but in one case it just has a tab -- making all the same helps make test regexps simpler. Testing Done: Bootstrap and full regtest on arm-none-linux-gnueabihf Full regtest on arm-none-eabi gcc/ChangeLog: 2020-04-08 Matthew Malcomson

[PATCH] [Arm] Implement scalar Custom Datapath Extension intrinsics

2020-04-08 Thread Matthew Malcomson
with CDE -- this avoids faulty code generation for -Os when producing the cx*d instructions. Testing done: Bootstrapped and regtested for arm-none-linux-gnueabihf. gcc/ChangeLog: 2020-04-08 Matthew Malcomson * config/arm/arm.c (arm_hard_regno_mode_ok): DImode registers forced into

[PATCH] [Arm] Implement scalar Custom Datapath Extension intrinsics

2020-04-08 Thread Matthew Malcomson
generation for -Os when producing the cx*d instructions. Testing done: Bootstrapped and regtested for arm-none-linux-gnueabihf. gcc/ChangeLog: 2020-04-08 Matthew Malcomson * config/arm/arm.c (arm_hard_regno_mode_ok): DImode registers forced into even-odd register pairs for

[wwwdocs] [arm] Document CDE intrinsics from ACLE

2020-04-08 Thread Matthew Malcomson
New in GCC 10. ### Attachment also inlined for ease of reply### diff --git a/htdocs/gcc-10/changes.html b/htdocs/gcc-10/changes.html index 3d8e0ba989e860d307310378a2be99b32a27261f..389561d13c69b650528e8ed8859ebbb5760438c6 100644 --- a/htdocs/gcc-10/changes.html

[Arm] Allow the use of arm_cde.h for C++

2020-04-09 Thread Matthew Malcomson
thout name mangling. Hence all the function names are the same and we have many conflicting declarations. Testing Done: Regression tested for arm-none-eabi. gcc/ChangeLog: 2020-04-09 Matthew Malcomson * config/arm/arm_cde.h: Remove `extern "C"` when compiling for

[Arm] Disallow arm_movdi when targetting MVE

2020-04-15 Thread Matthew Malcomson
04-15 Matthew Malcomson * config/arm/arm.md (arm_movdi): Disallow for MVE. ### Attachment also inlined for ease of reply### diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 7bc55cce61b2e45e5875a233dd4546d5939

Re: [PATCH 1/2] testsuite: [arm/cde] Include arm_cde.h and arm_mve.h in arm_v8*m_main_cde*

2020-04-20 Thread Matthew Malcomson
On 20/04/2020 08:47, Christophe Lyon via Gcc-patches wrote: Since arm_cde.h includes stdint.h, its use requires the presence of the right gnu/stub-*.h, so make sure to include it when checking the arm_v8*m_main_cde* effective targets, otherwise we can decide CDE is supported while it's not really

[AArch64] (PR94383) Avoid C++17 empty base field checking for HVA/HFA

2020-04-21 Thread Matthew Malcomson
gcc/ChangeLog: 2020-04-21 Matthew Malcomson Jakub Jelinek PR target/94383 * config/aarch64/aarch64.c (enum cpp17empty_state): New. (aapcs_vfp_sub_candidate): Account for C++17 empty base class artificial fields. (aarch64_vfp_is_call_or_return_can

[AArch64] (PR94383) Avoid C++17 empty base field checking for HVA/HFA

2020-04-23 Thread Matthew Malcomson
: 2020-04-23 Matthew Malcomson Jakub Jelinek PR target/94383 * config/aarch64/aarch64.c (aapcs_vfp_sub_candidate): Account for C++17 empty base class artificial fields. (aarch64_vfp_is_call_or_return_candidate): Warn when ABI PCS decision is di

[Arm] Account for C++17 artificial field determining Homogeneous Aggregates

2020-04-27 Thread Matthew Malcomson
-April/544204.html Regression tested on arm-none-eabi. gcc/ChangeLog: 2020-04-27 Matthew Malcomson Jakub Jelinek PR target/94383 * config/arm/arm.c (aapcs_vfp_sub_candidate): Account for C++17 empty base class

Straight Line Speculation (SLS) mitigation.

2020-06-08 Thread Matthew Malcomson
Hi, A new speculative cache side-channel vulnerability has been published at the link below, named "straight-line speculation" (SLS in this patch series). https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability/downloads/straight-line-speculation This vulnerabili

[Patch 3/3] aarch64: Mitigate SLS for BLR instruction

2020-06-08 Thread Matthew Malcomson
ted by compiler. gcc/ChangeLog: 2020-06-08 Matthew Malcomson * config/aarch64/aarch64-protos.h (aarch64_indirect_call_asm): New declaration. * config/aarch64/aarch64.c (aarch64_use_return_insn_p): Return false if hardening BLR instructions. (aarch64_sl

[Patch 1/3] aarch64: New Straight Line Speculation (SLS) mitigation flags

2020-06-08 Thread Matthew Malcomson
. Setting this on a per-function basis using attributes or the like is not enabled, but may be in the future. gcc/ChangeLog: 2020-06-08 Matthew Malcomson * config/aarch64/aarch64-protos.h (aarch64_harden_sls_retbr_p): New. (aarch64_harden_sls_blr_p): New. * config

[Patch 2/3] aarch64: Introduce SLS mitigation for RET and BR instructions

2020-06-08 Thread Matthew Malcomson
every RET or BR is immediately followed by a speculation barrier. gcc/ChangeLog: 2020-06-08 Matthew Malcomson * config/aarch64/aarch64-protos.h (aarch64_sls_barrier): New. * config/aarch64/aarch64.c (aarch64_output_casesi): Emit speculation barrier after BR instruction

[Patch v2 3/3] aarch64: Mitigate SLS for BLR instruction

2020-06-23 Thread Matthew Malcomson
is immediately followed by a speculation barrier. b) No BLR instruction is emitted by compiler. gcc/ChangeLog: 2020-06-23 Matthew Malcomson * config/aarch64/aarch64-protos.h (aarch64_indirect_call_asm): New declaration. * config/aarch64/aarch64.c (aarch64_regno_regcla

  1   2   3   >