Commit 47a11342 by Jakub Jelinek Committed by Jakub Jelinek

re PR sanitizer/80308 (asan crash on big-endian powerpc-linux target)

	PR sanitizer/80308
	* asan.c (asan_store_shadow_bytes): Fix location of last_chunk_value
	for big endian.

	* c-c++-common/asan/pr80308.c: New test.

Co-Authored-By: Bernd Edlinger <bernd.edlinger@hotmail.de>

From-SVN: r246703
parent 5f5c5e0f
2017-04-05 Jakub Jelinek <jakub@redhat.com>
Bernd Edlinger <bernd.edlinger@hotmail.de>
PR sanitizer/80308
* asan.c (asan_store_shadow_bytes): Fix location of last_chunk_value
for big endian.
2017-04-05 Eric Botcazou <ebotcazou@adacore.com>
PR target/78002
......
......@@ -2757,10 +2757,13 @@ asan_store_shadow_bytes (gimple_stmt_iterator *iter, location_t loc,
unsigned char c = (char) is_clobber ? ASAN_STACK_MAGIC_USE_AFTER_SCOPE : 0;
unsigned HOST_WIDE_INT val = 0;
unsigned last_pos = size;
if (last_chunk_size && !is_clobber)
last_pos = BYTES_BIG_ENDIAN ? 0 : size - 1;
for (unsigned i = 0; i < size; ++i)
{
unsigned char shadow_c = c;
if (i == size - 1 && last_chunk_size && !is_clobber)
if (i == last_pos)
shadow_c = last_chunk_size;
val |= (unsigned HOST_WIDE_INT) shadow_c << (BITS_PER_UNIT * i);
}
......
2017-04-05 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/80308
* c-c++-common/asan/pr80308.c: New test.
2017-04-05 Dominik Vogt <vogt@linux.vnet.ibm.com>
PR target/79890
......
/* PR sanitizer/80308 */
/* { dg-do run } */
__attribute__((noinline, noclone)) int
foo (char *a)
{
int i, j = 0;
asm volatile ("" : "+r" (a) : : "memory");
for (i = 0; i < 12; i++)
j += a[i];
return j;
}
int
main ()
{
int i, j = 0;
for (i = 0; i < 4; i++)
{
char a[12];
__builtin_memset (a, 0, sizeof (a));
j += foo (a);
}
return j;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment