← Back to team overview

kernel-packages team mailing list archive

[Bug 1267062] Re: LTP sigaltstack02 test failure -- MINSIGSTKSZ in userspace missmatches kernel (was: sigaltstack system call unable to send proper return code (error12))

 

Here is my analysis with a small code:

Summary:
If we include signal.h from usr/include: MINSIGSTKSZ -----> 4096 ###TC  FAIL
If we explicitly include signal.h from    "/usr/include/asm-powerpc/signal.h" : MINSIGSTKSZ -----> 2048 ###TC case PASS

In my opinion glibc should be taken care to point to right signal.h when
an appln includes signal.h, I'm not sure which signal.h to use if we
include explicitely from #include "/usr/include/asm-powerpc/signal.h"
Test case works fine.

Conclusion: It does not seems to be a test case issue.

root@ubuntuk60:~# cat s1.c
/*
 * TC1:
 * sigaltstack() should fails and sets errno to ENOMEM when the size of alternate
 * stack area is less than MINSIGSTKSZ.
*/
#include <stdio.h>
//#include <signal.h>
#include "/usr/include/asm-powerpc/signal.h"
#include <errno.h>

int main()
{
 stack_t sigstk; /* signal stack storing struct. */
 int rc;

 sigstk.ss_size = MINSIGSTKSZ - 1;
 sigstk.ss_flags = 0;

 printf ("MINSTKSZ = %d\n", MINSIGSTKSZ);
 /* Verify sigaltstack() fails and sets errno */
 rc = sigaltstack(&sigstk, (stack_t *) 0);
 if (rc < 0)
 {
  // TC pass if rc < 0
  printf ("FAILED: rc = %d, errono = %d\n", rc, errno);
 }
 else {
  printf ("PASS: rc = %d, errono = %d\n", rc, errno);
 }
}

output TC PASS: used with #include "/usr/include/asm-powerpc/signal.h"
root@ubuntuk60:~# ./a.out
MINSTKSZ = 2048
FAILED: rc = -1, errono = 12 

output TC FAILED: used with #include <signal.h>
root@ubuntuk60:~# ./a.out
MINSTKSZ = 4096
PASS: rc = 0, errono = 0


The same behavior on LE Ubuntu as well.

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

Title:
  LTP sigaltstack02 test failure -- MINSIGSTKSZ in userspace missmatches
  kernel (was: sigaltstack system call unable to send proper return code
  (error12))

Status in “eglibc” package in Ubuntu:
  New
Status in “linux” package in Ubuntu:
  Confirmed

Bug description:
  9.3.189.114 (root/.pasroot) (Host Machine)
  Run the follwoing command to go to the guest victim machine from (/var/lib/libvirt/images/jagan/new_ubuntu_alpha1)

  qemu-system-ppc64 -enable-kvm -M pseries -cpu POWER8 -smp 1 -m 10G
  -nographic -nodefaults -monitor stdio -serial pty -append
  "root=/dev/sda" -kernel trusty-server-cloudimg-ppc64el-vmlinuz-generic
  -device spapr-vscsi -device spapr-
  vlan,netdev=net0,mac=6c:ae:8b:69:16:15 -netdev
  bridge,br=virbr0,id=net0 -drive file=trusty-server-cloudimg-
  ppc64el.img.qcow2

  after this command you will get the screen number.
  example:

  QEMU 1.6.0 monitor - type 'help' for more information
  (qemu) char device redirected to /dev/pts/16 (label serial0)

  Then open another host session and execute the below command

  # screen /dev/pts/16
  (qemu)

  Here the screen number is  /dev/pts/16

  -->>Then you will get a blank screen so press ENTER key.

  The guest machine login: ubuntu/passw0rd

  Then do --->sudo -i

  Environment:
  ===========
  Host: Power8
  Guest : ubuntu hosted on Power8
  The issue:
  ======
  sigaltstack system call unable send proper return value.

  
  How to run :
  ========
  -->cd /root/ltp-full-20130904/testcases/kernel/syscalls/sigaltstack

  --> ./sigaltstack02  ==> Getting the below error

  sigaltstack02    1  TPASS  :  stgaltstack() fails, Invalid Flag value, errno:22
  sigaltstack02    2  TFAIL  :  sigaltstack() returned 0, expected -1, errno:12 =====>> FAIL

  <<<test_start>>>
  tag=sigaltstack02 stime=1386653793
  cmdline="sigaltstack02"
  contacts=""
  analysis=exit
  <<<test_output>>>
  sigaltstack02    1  TPASS  :  stgaltstack() fails, Invalid Flag value, errno:22
  sigaltstack02    2  TFAIL  :  sigaltstack() returned 0, expected -1, errno:12
  <<<execution_status>>>
  initiation_status="ok"
  duration=0 termination_type=exited termination_id=1 corefile=no
  cutime=0 cstime=0
  <<<test_end>>>

  sigaltstack() should fail and set errno to ENOMEM when the size of alternate stack area is less than MINSIGSTKSZ.
  But here its sigaltstack() is returning 0.

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


References