← Back to team overview

kernel-packages team mailing list archive

[Bug 1557967] Re: Semaphore tests are getting failed by signal

 

The testsuite you're running is segfaulting.  This is not a bug in
Ubuntu, it's a bug in that testsuite.  When you build the testsuite
binaries using Ubuntu's hardening-by-default compiler, buffer overflow
detection is enabled, which traps program execution immediately with
SIGSEGV.

The code of the testsuite you've pointed to has obvious and trivial
buffer overflows.  The stack trace included in this report points to a
sprintf() call in conformance/interfaces/sem_unlink/1-1.c:

#define TEST "1-1"
#define FUNCTION "sem_unlink"

[...]
int main() {
[...]
        char semname[20];

        sprintf(semname, "/" FUNCTION "_" TEST "_%d", getpid());
[...]

The constant part of this string is '/sem_unlink_1-1_', which is 16
characters.  Your target array has room for 19 characters (not counting
the terminating NUL), leaving only 3 characters for the PID.

There is absolutely no guarantee that the PID of the processes in the
test suite will fit in 3 characters.  This "POSIX" test suite therefore
has undefined behavior according to the C language, which Ubuntu handles
by raising SIGSEGV.

** Changed in: linux (Ubuntu)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1557967

Title:
  Semaphore tests are getting failed by signal

Status in linux package in Ubuntu:
  Invalid

Bug description:
  Problem Description
  =================================
  Semaphore tests are getting failed by signal

  ---uname output---
  Linux powerkvm5 4.2.0-22-generic #27~14.04.1-Ubuntu SMP Fri Dec 18 10:56:52 UTC 2015 ppc64le ppc64le ppc64le GNU/Linux

  ---Steps to Reproduce---
  Install Tuleta Baremetal with Ubuntu14.04.4.Then  download the posixtest suite. 

  root@powerkvm5:~#wget
  http://downloads.sourceforge.net/project/posixtest/posixtest/posixtestsuite-1.5.2/posixtestsuite-1.5.2.tar.gz?r=&ts=1452148604&use_mirror=liquidtelecom

  untar the downloaded file:
  root@powerkvm5:~# tar xvfz posixtestsuite-1.5.2.tar.gz?r=

  root@powerkvm5:~/posixtestsuite# make

  root@powerkvm5:~/posixtestsuite# ./run_tests SEM

  Executing semaphores tests
  conformance/interfaces/sem_close/3-2: build: FAILED 
  conformance/interfaces/sem_close/2-1: link: FAILED 
  conformance/interfaces/sem_close/1-1: link: FAILED 
  conformance/interfaces/sem_close/3-1: link: FAILED 
  conformance/interfaces/sem_close/3-2: build: FAILED 
  conformance/interfaces/sem_close/2-1: link: FAILED 
  conformance/interfaces/sem_close/1-1: link: FAILED 
  conformance/interfaces/sem_close/3-1: link: FAILED 
  conformance/interfaces/sem_destroy/4-1: link: FAILED 
  conformance/interfaces/sem_destroy/3-1: link: FAILED 
  conformance/interfaces/sem_destroy/4-1: link: FAILED 
  conformance/interfaces/sem_destroy/3-1: link: FAILED 
  conformance/interfaces/sem_getvalue/5-1: link: FAILED 
  conformance/interfaces/sem_getvalue/2-1: link: FAILED 
  conformance/interfaces/sem_getvalue/4-1: link: FAILED 
  conformance/interfaces/sem_getvalue/1-1: link: FAILED 
  conformance/interfaces/sem_getvalue/2-2: build: FAILED 
  conformance/interfaces/sem_getvalue/5-1: link: FAILED 
  conformance/interfaces/sem_getvalue/2-1: link: FAILED 
  conformance/interfaces/sem_getvalue/4-1: link: FAILED 
  conformance/interfaces/sem_getvalue/1-1: link: FAILED 
  conformance/interfaces/sem_getvalue/2-2: build: FAILED 
  conformance/interfaces/sem_init/5-1: link: FAILED 
  conformance/interfaces/sem_init/3-2: build: FAILED 
  conformance/interfaces/sem_init/2-1: link: FAILED 
  conformance/interfaces/sem_init/1-1: link: FAILED 
  conformance/interfaces/sem_init/2-2: link: FAILED 
  conformance/interfaces/sem_init/3-1: link: FAILED 
  conformance/interfaces/sem_init/7-1: build: FAILED 
  conformance/interfaces/sem_init/5-2: link: FAILED 
  conformance/interfaces/sem_init/3-3: build: FAILED 
  conformance/interfaces/sem_init/5-1: link: FAILED 
  conformance/interfaces/sem_init/3-2: build: FAILED 
  conformance/interfaces/sem_init/6-1: execution: PASS
  conformance/interfaces/sem_init/2-1: link: FAILED 
  conformance/interfaces/sem_init/1-1: link: FAILED 
  conformance/interfaces/sem_init/2-2: link: FAILED 
  conformance/interfaces/sem_init/3-1: link: FAILED 
  conformance/interfaces/sem_init/7-1: build: FAILED 
  conformance/interfaces/sem_init/5-2: link: FAILED 
  conformance/interfaces/sem_init/3-3: build: FAILED 
  conformance/interfaces/sem_open/1-3: link: FAILED 
  conformance/interfaces/sem_open/1-2: build: FAILED 
  conformance/interfaces/sem_open/10-1: link: FAILED 
  conformance/interfaces/sem_open/6-1: link: FAILED 
  conformance/interfaces/sem_open/2-1: link: FAILED 
  conformance/interfaces/sem_open/4-1: link: FAILED 
  conformance/interfaces/sem_open/15-1: build: FAILED 
  conformance/interfaces/sem_open/1-1: link: FAILED 
  conformance/interfaces/sem_open/2-2: link: FAILED 
  conformance/interfaces/sem_open/3-1: link: FAILED 
  conformance/interfaces/sem_open/1-4: link: FAILED 
  conformance/interfaces/sem_open/1-3: link: FAILED 
  conformance/interfaces/sem_open/5-1: execution: PASS
  conformance/interfaces/sem_open/1-2: build: FAILED 
  conformance/interfaces/sem_open/10-1: link: FAILED 
  conformance/interfaces/sem_open/6-1: link: FAILED 
  conformance/interfaces/sem_open/2-1: link: FAILED 
  conformance/interfaces/sem_open/4-1: link: FAILED 
  conformance/interfaces/sem_open/15-1: build: FAILED 
  conformance/interfaces/sem_open/1-1: link: FAILED 
  conformance/interfaces/sem_open/2-2: link: FAILED 
  conformance/interfaces/sem_open/3-1: link: FAILED 
  conformance/interfaces/sem_open/1-4: link: FAILED 
  conformance/interfaces/sem_post/5-1: link: FAILED 
  conformance/interfaces/sem_post/8-1: link: FAILED 
  conformance/interfaces/sem_post/1-2: link: FAILED 
  conformance/interfaces/sem_post/6-1: link: FAILED 
  conformance/interfaces/sem_post/2-1: link: FAILED 
  conformance/interfaces/sem_post/4-1: link: FAILED 
  conformance/interfaces/sem_post/1-1: link: FAILED 
  conformance/interfaces/sem_post/5-1: link: FAILED 
  conformance/interfaces/sem_post/8-1: link: FAILED 
  conformance/interfaces/sem_post/1-2: link: FAILED 
  conformance/interfaces/sem_post/6-1: link: FAILED 
  conformance/interfaces/sem_post/2-1: link: FAILED 
  conformance/interfaces/sem_post/4-1: link: FAILED 
  conformance/interfaces/sem_post/1-1: link: FAILED 
  conformance/interfaces/sem_timedwait/9-1: build: FAILED 
  conformance/interfaces/sem_timedwait/10-1: link: FAILED 
  conformance/interfaces/sem_timedwait/6-1: link: FAILED 
  conformance/interfaces/sem_timedwait/2-1: link: FAILED 
  conformance/interfaces/sem_timedwait/11-1: link: FAILED 
  conformance/interfaces/sem_timedwait/4-1: link: FAILED 
  conformance/interfaces/sem_timedwait/6-2: link: FAILED 
  conformance/interfaces/sem_timedwait/1-1: link: FAILED 
  conformance/interfaces/sem_timedwait/2-2: link: FAILED 
  conformance/interfaces/sem_timedwait/3-1: link: FAILED 
  conformance/interfaces/sem_timedwait/7-1: link: FAILED 
  conformance/interfaces/sem_timedwait/9-1: build: FAILED 
  conformance/interfaces/sem_timedwait/10-1: link: FAILED 
  conformance/interfaces/sem_timedwait/6-1: link: FAILED 
  conformance/interfaces/sem_timedwait/2-1: link: FAILED 
  conformance/interfaces/sem_timedwait/11-1: link: FAILED 
  conformance/interfaces/sem_timedwait/4-1: link: FAILED 
  conformance/interfaces/sem_timedwait/6-2: link: FAILED 
  conformance/interfaces/sem_timedwait/1-1: link: FAILED 
  conformance/interfaces/sem_timedwait/2-2: link: FAILED 
  conformance/interfaces/sem_timedwait/3-1: link: FAILED 
  conformance/interfaces/sem_timedwait/7-1: link: FAILED 
  conformance/interfaces/sem_unlink/5-1: build: FAILED 
  conformance/interfaces/sem_unlink/9-1: build: FAILED 
  conformance/interfaces/sem_unlink/6-1: build: FAILED 
  conformance/interfaces/sem_unlink/2-1: link: FAILED 
  conformance/interfaces/sem_unlink/4-1: link: FAILED 
  conformance/interfaces/sem_unlink/4-2: build: FAILED 
  conformance/interfaces/sem_unlink/1-1: link: FAILED 
  conformance/interfaces/sem_unlink/2-2: build: FAILED 
  conformance/interfaces/sem_unlink/3-1: build: FAILED 
  conformance/interfaces/sem_unlink/7-1: build: FAILED 
  conformance/interfaces/sem_unlink/5-1: build: FAILED 
  conformance/interfaces/sem_unlink/9-1: build: FAILED 
  conformance/interfaces/sem_unlink/6-1: build: FAILED 
  conformance/interfaces/sem_unlink/2-1: link: FAILED 
  conformance/interfaces/sem_unlink/4-1: link: FAILED 
  conformance/interfaces/sem_unlink/4-2: build: FAILED 
  conformance/interfaces/sem_unlink/1-1: link: FAILED 
  conformance/interfaces/sem_unlink/2-2: build: FAILED 
  conformance/interfaces/sem_unlink/3-1: build: FAILED 
  conformance/interfaces/sem_unlink/7-1: build: FAILED 
  conformance/interfaces/sem_wait/5-1: link: FAILED 
  conformance/interfaces/sem_wait/1-2: link: FAILED 
  conformance/interfaces/sem_wait/11-1: link: FAILED 
  conformance/interfaces/sem_wait/13-1: build: FAILED 
  conformance/interfaces/sem_wait/1-1: link: FAILED 
  conformance/interfaces/sem_wait/3-1: link: FAILED 
  conformance/interfaces/sem_wait/12-1: link: FAILED 
  conformance/interfaces/sem_wait/7-1: build: FAILED 
  conformance/interfaces/sem_wait/5-1: link: FAILED 
  conformance/interfaces/sem_wait/1-2: link: FAILED 
  conformance/interfaces/sem_wait/11-1: link: FAILED 
  conformance/interfaces/sem_wait/13-1: build: FAILED 
  conformance/interfaces/sem_wait/1-1: link: FAILED 
  conformance/interfaces/sem_wait/3-1: link: FAILED 
  conformance/interfaces/sem_wait/12-1: link: FAILED 
  conformance/interfaces/sem_wait/7-1: build: FAILED 
  ****Tests Complete****

  The dmesg ouptut is showing that some tests are getting killed by
  signals.

  root@powerkvm5:/home/ubuntu/pooja/posixtestsuite# dmesg
  [69825.398502] sysrq: SysRq : HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) show-blocked-tasks(w) xmon(x) dump-ftrace-buffer(z) 
  [69826.183851] sysrq: SysRq : HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) show-blocked-tasks(w) xmon(x) dump-ftrace-buffer(z) 
  [69834.574957] sysrq: SysRq : HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) show-blocked-tasks(w) xmon(x) dump-ftrace-buffer(z) 
  [69837.502070] sysrq: SysRq : HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) show-blocked-tasks(w) xmon(x) dump-ftrace-buffer(z) 
  [69861.267010] sysrq: SysRq : HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) show-blocked-tasks(w) xmon(x) dump-ftrace-buffer(z) 
  [72359.566019] 6-1.test[47168]: unhandled signal 11 at 0000100000070000 nip 00000000100009c4 lr 00000000100009ac code 30002
  [72359.584716] 6-2.test[47204]: unhandled signal 11 at 0000100000070000 nip 0000000010000af8 lr 0000000010000aec code 30002
  [72361.678098] 6-3.test[47285]: unhandled signal 11 at 0000100000070000 nip 0000000010000a04 lr 00000000100009ec code 30002
  [77011.111521] 6-1.test[113462]: unhandled signal 11 at 0000100000070000 nip 00000000100009c4 lr 00000000100009ac code 30002
  [77011.129970] 6-2.test[113497]: unhandled signal 11 at 0000100000070000 nip 0000000010000af8 lr 0000000010000aec code 30002
  [77013.216000] 6-3.test[113578]: unhandled signal 11 at 0000100000070000 nip 0000000010000a04 lr 0000000010000

  
  == Comment: #4 - PAVITHRA R. PRAKASH <pavrampu@xxxxxxxxxx> - 2016-02-19 03:56:34 ==
  Same behaviour is observed in Ubuntu 16.04.

  Logs
  -------

  *** stack smashing detected ***: conformance/interfaces/strftime/2-1.test terminated
  *** buffer overflow detected ***: conformance/interfaces/sem_unlink/1-1.test terminated
  ======= Backtrace: =========
  /lib/powerpc64le-linux-gnu/libc.so.6(+0x89a44)[0x3fffb74f9a44]
  /lib/powerpc64le-linux-gnu/libc.so.6(__fortify_fail+0x80)[0x3fffb75b5a20]
  /lib/powerpc64le-linux-gnu/libc.so.6(__chk_fail+0x20)[0x3fffb75b2380]
  /lib/powerpc64le-linux-gnu/libc.so.6(+0x141388)[0x3fffb75b1388]
  /lib/powerpc64le-linux-gnu/libc.so.6(_IO_default_xsputn+0xc8)[0x3fffb74ff2a8]
  /lib/powerpc64le-linux-gnu/libc.so.6(_IO_vfprintf+0x1c14)[0x3fffb74ca2c4]
  /lib/powerpc64le-linux-gnu/libc.so.6(__vsprintf_chk+0xb8)[0x3fffb75b1458]
  /lib/powerpc64le-linux-gnu/libc.so.6(__sprintf_chk+0x2c)[0x3fffb75b134c]
  conformance/interfaces/sem_unlink/1-1.test[0x10000718]
  /lib/powerpc64le-linux-gnu/libc.so.6(+0x23500)[0x3fffb7493500]
  /lib/powerpc64le-linux-gnu/libc.so.6(__libc_start_main+0xb4)[0x3fffb7493734]
  ======= Memory map: ========
  10000000-10010000 r-xp 00000000 08:15 7081082                            /root/powerkvm-autotest/client/tmp/posixtest/src/conformance/interfaces/sem_unlink/1-1.test
  10010000-10020000 r--p 00000000 08:15 7081082                            /root/powerkvm-autotest/client/tmp/posixtest/src/conformance/interfaces/sem_unlink/1-1.test
  10020000-10030000 rw-p 00010000 08:15 7081082                            /root/powerkvm-autotest/client/tmp/posixtest/src/conformance/interfaces/sem_unlink/1-1.test
  3fffb7470000-3fffb7630000 r-xp 00000000 08:15 4456490                    /lib/powerpc64le-linux-gnu/libc-2.21.so
  3fffb7630000-3fffb7640000 r--p 001b0000 08:15 4456490                    /lib/powerpc64le-linux-gnu/libc-2.21.so
  3fffb7640000-3fffb7650000 rw-p 001c0000 08:15 4456490                    /lib/powerpc64le-linux-gnu/libc-2.21.so
  3fffb7650000-3fffb7670000 r-xp 00000000 08:15 4456481                    /lib/powerpc64le-linux-gnu/libpthread-2.21.so
  3fffb7670000-3fffb7680000 r--p 00010000 08:15 4456481                    /lib/powerpc64le-linux-gnu/libpthread-2.21.so
  3fffb7680000-3fffb7690000 rw-p 00020000 08:15 4456481                    /lib/powerpc64le-linux-gnu/libpthread-2.21.so
  3fffb7690000-3fffb76a0000 rw-p 00000000 00:00 0 
  3fffb76a0000-3fffb76c0000 r-xp 00000000 00:00 0                          [vdso]
  3fffb76c0000-3fffb7700000 r-xp 00000000 08:15 4456482                    /lib/powerpc64le-linux-gnu/ld-2.21.so
  3fffb7700000-3fffb7710000 r--p 00030000 08:15 4456482                    /lib/powerpc64le-linux-gnu/ld-2.21.so
  3fffb7710000-3fffb7720000 rw-p 00040000 08:15 4456482                    /lib/powerpc64le-linux-gnu/ld-2.21.so
  3ffffb910000-3ffffb940000 rw-p 00000000 00:00 0                          [stack]

  Mirroring this bugzilla for Canonical's awareness as we have the
  Ubuntu kernel failing for semaphore tests.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1557967/+subscriptions