Inverted assertion in __poll_chk
Bugzilla ID | 341 |
Reporter | Magne Hov |
Assignee | A. Wilcox (awilfox) |
Reported | 2020-08-05 13:11:25 -0500 |
Modified | 2020-08-10 19:17:02 -0500 |
Status | RESOLVED FIXED |
Version | 0.2.0 |
Hardware | Adélie Linux / Intel x86 (64-bit) |
Importance | --- / normal |
URL | https://code.foxkit.us/adelie/gcompat/commit/2d75993 |
Description
Created attachment 35
Reproducer program
When compiling the attached reproducer with gcc -D_FORTIFY_SOURCE=1 -O1 reproducer.c, I get the following failure when running it in a paleozogt/adelie docker image:
./a.out
Assertion failed: (fdslen / sizeof(*fds)) < nfds (libgcompat/socket.c: __poll_chk: 52)
This assertion seems bogus to me:
https://code.foxkit.us/adelie/gcompat/-/blob/715b50e/libgcompat/socket.c#L52
The expression is identical to that in glibc, but the logic is inverted:
https://sourceware.org/git/?p=glibc.git;a=blob;f=debug/poll_chk.c;hb=07ed32f920f0bcb1ddb400e4ed606104756dee32#l24
Reproducer compiled on Ubuntu 19.10 with gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008.
apk list | grep gcompat
gcompat-0.4.0-r0 x86_64 {gcompat} (UoI-NCSA) [installed]