Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCB size calculated in ThreadDescriptorSize() is wrong for glibc-2.14 #966

Open
marxin opened this issue Jun 4, 2018 · 5 comments
Open

TCB size calculated in ThreadDescriptorSize() is wrong for glibc-2.14 #966

marxin opened this issue Jun 4, 2018 · 5 comments

Comments

@marxin
Copy link

@marxin marxin commented Jun 4, 2018

Copy of GCC bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86022

In ThreadDescriptorSize(), I currently see:

  else if (minor <= 13)
    val = FIRST_32_SECOND_64(1168, 2304);
  else
    val = FIRST_32_SECOND_64(1216, 2304);

This leads to assertion failure on glibc-2.14, with the same message as in bug 60038. Actual values for glibc 2.14 are the same as for 2.13: 1168 for i386 and 2304 for x86_64.

I checked this by appending the following to glibc-2.14.1/nptl/descr.h:

typedef int TCB_SIZE_2304[sizeof(struct pthread)==2304 ? -1 : 1];
typedef int TCB_SIZE_1168[sizeof(struct pthread)==1168 ? -1 : 1];

and getting corresponding error when compiling glibc on a 32-bit and on a 64-bit x86 Kubuntu machines.

I suppose the fix should be to change "minor <= 13" to "minor <= 14".

Can please anybody confirm the change for glibc? If so, I can create review request?

@kcc
Copy link
Contributor

@kcc kcc commented Jun 5, 2018

Can please anybody confirm the change for glibc?

Do you mean to ask some one else from the glibc team?
I am not sure if anyone is listening here.

If you apply the patch like this, I'm afraid we won't have any way to test it.

@marxin
Copy link
Author

@marxin marxin commented Jun 7, 2018

Do you mean to ask some one else from the glibc team?
I am not sure if anyone is listening here.

I sent the link at glibc mailing list.

If you apply the patch like this, I'm afraid we won't have any way to test it.

Sure, unfortunately due to broken configure script I can't build the release on my local machine.

@marxin
Copy link
Author

@marxin marxin commented Jul 26, 2018

Ok, so I was now able to verify that:

typedef int TCB_SIZE_2304[sizeof(struct pthread)==1168? 1 : -1];

survives on glibc-2.14 with -m32.
@kcc: Is it enough for you to accept the patch if I send it?

@kcc
Copy link
Contributor

@kcc kcc commented Jul 30, 2018

yes, please send a patch

@marxin
Copy link
Author

@marxin marxin commented Aug 1, 2018

yes, please send a patch

Done: https://reviews.llvm.org/D50131

dtzWill pushed a commit to llvm-mirror/compiler-rt that referenced this issue Aug 1, 2018
Summary: Fixes: google/sanitizers#966

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D50131

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@338606 91177308-0d34-0410-b5e6-96231b3b80d8
chapuni pushed a commit to llvm-project/llvm-project-20170507 that referenced this issue Aug 1, 2018
Summary: Fixes: google/sanitizers#966

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D50131
chapuni pushed a commit to llvm-project/llvm-project-submodule that referenced this issue Aug 1, 2018
Summary: Fixes: google/sanitizers#966

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D50131
chapuni pushed a commit to llvm-project/compiler-rt that referenced this issue Aug 2, 2018
------------------------------------------------------------------------
r338606 | kcc | 2018-08-01 20:29:51 +0200 (Wed, 01 Aug 2018) | 11 lines

Fix sizeof(struct pthread) in glibc 2.14.

Summary: Fixes: google/sanitizers#966

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D50131
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_70@338691 91177308-0d34-0410-b5e6-96231b3b80d8
chapuni pushed a commit to llvm-project/llvm-project-20170507 that referenced this issue Aug 2, 2018
------------------------------------------------------------------------
r338606 | kcc | 2018-08-01 20:29:51 +0200 (Wed, 01 Aug 2018) | 11 lines

Fix sizeof(struct pthread) in glibc 2.14.

Summary: Fixes: google/sanitizers#966

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D50131
------------------------------------------------------------------------
chapuni pushed a commit to llvm-project/llvm-project-submodule that referenced this issue Aug 2, 2018
------------------------------------------------------------------------
r338606 | kcc | 2018-08-01 20:29:51 +0200 (Wed, 01 Aug 2018) | 11 lines

Fix sizeof(struct pthread) in glibc 2.14.

Summary: Fixes: google/sanitizers#966

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D50131
------------------------------------------------------------------------
ilovepi added a commit to ilovepi/llvm-project-20170507 that referenced this issue Aug 14, 2018
Summary: Fixes: google/sanitizers#966

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D50131
MaxDesiatov added a commit to MaxDesiatov/swift-compiler-rt that referenced this issue Oct 6, 2018
------------------------------------------------------------------------
r338606 | kcc | 2018-08-01 20:29:51 +0200 (Wed, 01 Aug 2018) | 11 lines

Fix sizeof(struct pthread) in glibc 2.14.

Summary: Fixes: google/sanitizers#966

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D50131
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_70@338691 91177308-0d34-0410-b5e6-96231b3b80d8
MaxDesiatov added a commit to MaxDesiatov/swift-compiler-rt that referenced this issue Oct 28, 2018
------------------------------------------------------------------------
r338606 | kcc | 2018-08-01 20:29:51 +0200 (Wed, 01 Aug 2018) | 11 lines

Fix sizeof(struct pthread) in glibc 2.14.

Summary: Fixes: google/sanitizers#966

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D50131
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_70@338691 91177308-0d34-0410-b5e6-96231b3b80d8
llvm-git-migration pushed a commit to llvm-git-prototype/llvm that referenced this issue Nov 6, 2018
------------------------------------------------------------------------
r338606 | kcc | 2018-08-01 20:29:51 +0200 (Wed, 01 Aug 2018) | 11 lines

Fix sizeof(struct pthread) in glibc 2.14.

Summary: Fixes: google/sanitizers#966

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D50131
------------------------------------------------------------------------

llvm-svn=338691
llvm-git-migration pushed a commit to llvm-git-prototype/llvm that referenced this issue Jan 4, 2019
------------------------------------------------------------------------
r338606 | kcc | 2018-08-01 20:29:51 +0200 (Wed, 01 Aug 2018) | 11 lines

Fix sizeof(struct pthread) in glibc 2.14.

Summary: Fixes: google/sanitizers#966

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D50131
------------------------------------------------------------------------

llvm-svn: 338691
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants