Re: [PATCH 3/5] Makefile: add helper for compiling with -fsanitize

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 10, 2017 at 09:02:24PM +0100, Ramsay Jones wrote:

> After a quick look at the ./t0000-basic.sh test, I managed to get
> the test to complete (with 15 tests failing), with the following
> patch applied:
> 
> -- >8 --
> diff --git a/Makefile b/Makefile
> index 3c341b2a6..8e6433738 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1016,7 +1016,7 @@ ifdef SANITIZE
>  BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
>  BASIC_CFLAGS += -fno-omit-frame-pointer
>  ifeq ($(SANITIZE),undefined)
> -BASIC_CFLAGS += -DNO_UNALIGNED_LOADS
> +BASIC_CFLAGS += -DNO_UNALIGNED_LOADS -DSHA1DC_FORCE_ALIGNED_ACCESS
>  endif
>  endif

Thanks, I forgot to mention SHA1DC. When I had originally tested with
"undefined", it was before we had SHA1DC. I hacked around it earlier
today by just using OPENSSL_SHA1. ;)

I agree if we can ask it to avoid unaligned access that is even better.

> diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c
> index 25eded139..3baddc636 100644
> --- a/sha1dc/sha1.c
> +++ b/sha1dc/sha1.c
> @@ -118,6 +118,10 @@
>  #define SHA1DC_ALLOW_UNALIGNED_ACCESS
>  #endif /*UNALIGNMENT DETECTION*/
>  
> +#if defined(SHA1DC_ALLOW_UNALIGNED_ACCESS) && defined(SHA1DC_FORCE_ALIGNED_ACCESS)
> +#undef SHA1DC_ALLOW_UNALIGNED_ACCESS
> +#endif

I think our current strategy is to avoid touching sha1.c as much as
possible. I think we'd prefer a patch to the upstream project to support
FORCE_ALIGNED_ACCESS (unfortunately I do not see a way to tweak it using
only external defines.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux