NetBSD-Bugs archive

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

bin/53968: t_ubsan check broken on big endian



>Number:         53968
>Category:       bin
>Synopsis:       t_ubsan check broken on big endian
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 10 07:35:00 +0000 2019
>Originator:     Michael van Elst
>Release:        NetBSD 8.99.34
>Organization:
	
>Environment:
	
	
System: NetBSD dummy 8.99.34 NetBSD 8.99.34 (DUMMY) #51: Sat Feb 9 14:09:19 CET 2019 mlelstv@gossam:/home/netbsd-current/obj.amiga/home/netbsd-current/src/sys/arch/amiga/compile/DUMMY amiga
Architecture: m68k
Machine: amiga
>Description:

t_ubsan fails with

load_invalid_value_bool: [0.220474s] Failed: /home/netbsd-current/src/tests/lib/libc/misc/t_ubsan.c:99: buffer != 0 not met

The reason is that ubsan doesn't see an error, because the test is bogus.

static void
test_load_invalid_value_bool(void)
{
        volatile int a = atoi("10");
        volatile bool b = *(REINTERPRET_CAST(volatile bool *, &a));

        raise(b ? SIGSEGV : SIGBUS);
}

This reads the first byte of an integer variable and assigns it
to a bool variable. For bigendian platforms that first byte is
zero.

>How-To-Repeat:
Run atf tests on a big-endian arch.

>Fix:
Use a test value that has only invalid bytes. The same also helps
the load_invalid_value_enum test. The test value must use at least
as many bytes as a bool (or enum).

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index