Bug 25066 - FAIL: nptl/tst-tls1 on hppa
Summary: FAIL: nptl/tst-tls1 on hppa
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: nptl (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: 2.31
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-05 22:39 UTC by John David Anglin
Modified: 2020-07-08 16:46 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
Patch to check stack alignment in clone (431 bytes, patch)
2019-10-05 22:39 UTC, John David Anglin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2019-10-05 22:39:46 UTC
Created attachment 12022 [details]
Patch to check stack alignment in clone

The nptl/tst-tls1 test calls pthread_create with a misaligned stack:

  /* Also check the alignment of the tls variables if a misaligned stack is
     specified.  */
  pthread_t th;
  void *thr_stack = NULL;
  thr_stack = xposix_memalign (0x200, STACK_SIZE + 1);
  xpthread_attr_setstack (&a, thr_stack + 1, STACK_SIZE);
  th = xpthread_create (&a, tf, NULL);
  xpthread_join (th);
  free (thr_stack);

This fails on hppa because the stack needs to be at least word aligned in syscalls.

One possible fix is to check the stack alignment in clone.  But this doesn't fix test.  However, as far as I can tell, it seem legit to reject a misaligned stack.
Comment 1 Sourceware Commits 2019-11-03 21:30:25 UTC
The master branch has been updated by John David Anglin <danglin@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e4c23a029a54c8c7788eff9ca771a01cccaaa0ce

commit e4c23a029a54c8c7788eff9ca771a01cccaaa0ce
Author: John David Anglin <danglin@gcc.gnu.org>
Date:   Sun Nov 3 16:28:01 2019 -0500

    hppa: Align __clone stack argument to 8 bytes (Bug 25066)
    
    The hppa architecture requires strict alignment for loads and stores.
    As a result, the minimum stack alignment that will work is 8 bytes.
    This patch adjusts __clone() to align the stack argument passed to it.
    It also adjusts slightly some formatting.
    
    This fixes the nptl/tst-tls1 test.
Comment 2 John David Anglin 2019-11-03 21:33:07 UTC
Fixed on master.
Comment 3 Sourceware Commits 2020-02-05 21:14:55 UTC
The release/2.30/master branch has been updated by Aurelien Jarno <aurel32@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=43598ef6e2b1a8226db9f83dac9e93224306e242

commit 43598ef6e2b1a8226db9f83dac9e93224306e242
Author: John David Anglin <danglin@gcc.gnu.org>
Date:   Sun Nov 3 16:28:01 2019 -0500

    hppa: Align __clone stack argument to 8 bytes (Bug 25066)
    
    The hppa architecture requires strict alignment for loads and stores.
    As a result, the minimum stack alignment that will work is 8 bytes.
    This patch adjusts __clone() to align the stack argument passed to it.
    It also adjusts slightly some formatting.
    
    This fixes the nptl/tst-tls1 test.
    
    (cherry picked from commit e4c23a029a54c8c7788eff9ca771a01cccaaa0ce)