This is an archive of the discontinued LLVM Phabricator instance.

SafeStack: Fix thread liveness check on *BSD
ClosedPublic

Authored by vlad.tsyrklevich on Aug 28 2018, 10:28 AM.

Details

Summary

The Linux/BSD system call interfaces report errors differently, use the
internal_iserror() function to correctly check errors on either.

Event Timeline

Herald added subscribers: Restricted Project, llvm-commits, delcypher. · View Herald TranscriptAug 28 2018, 10:28 AM
This revision is now accepted and ready to land.Aug 28 2018, 11:00 AM

I'm going to test NetBSD soon.

[100%] Running the SafeStack tests
-- Testing: 9 tests, 8 threads --
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Testing Time: 0.61s
  Expected Passes    : 8
  Unsupported Tests  : 1
[100%] Built target check-safestack
$ uname -a
NetBSD chieftec 8.99.24 NetBSD 8.99.24 (GENERIC) #2: Thu Aug 16 13:44:34 CEST 2018  root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64
[100%] Running the SafeStack tests
-- Testing: 9 tests, 8 threads --
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Testing Time: 0.61s
  Expected Passes    : 8
  Unsupported Tests  : 1
[100%] Built target check-safestack
$ uname -a
NetBSD chieftec 8.99.24 NetBSD 8.99.24 (GENERIC) #2: Thu Aug 16 13:44:34 CEST 2018  root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64

I don't have time to spin up a NetBSD VM to look at this; however, this failure is most likely related to this TgKill() call. If you can print the TgKill/errno return values that could indicate what's happening.

NetBSD is fixed, as I was observing previously:

$ check-safestack

********************
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Testing Time: 0.56s
********************
Failing Tests (1):
    SafeStack :: pthread-cleanup.c

  Expected Passes    : 7
  Unsupported Tests  : 1
  Unexpected Failures: 1

The failure is gone with this patch.

NetBSD is fixed, as I was observing previously:

$ check-safestack

********************
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Testing Time: 0.56s
********************
Failing Tests (1):
    SafeStack :: pthread-cleanup.c

  Expected Passes    : 7
  Unsupported Tests  : 1
  Unexpected Failures: 1

The failure is gone with this patch.

Doh, skimmed too quickly and read Unsupported Tests as failures.

This revision was automatically updated to reflect the committed changes.