-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
prog: some bitfields are laid out incorrectly #1542
Labels
Comments
dvyukov
added a commit
that referenced
this issue
Dec 13, 2019
Add tests for issue #1542 The correct results are obtained with the following program: struct foo { unsigned char f0; unsigned int f1:4; unsigned short f2:4; }; struct bar { char f0; struct foo foo; }; int main() { struct bar y; memset(&y, 0, sizeof(y)); y.f0 = 0x12; y.foo.f0 = 0x34; y.foo.f1 = 0x56; y.foo.f2 = 0x78; int i; for (i = 0; i < sizeof(y); i++) printf("%02x", ((unsigned char*)&y)[i]); printf("\n"); }
dvyukov
added a commit
to dvyukov/syzkaller
that referenced
this issue
Dec 17, 2019
syz-check parses vmlinux dwarf, extracts struct descriptions, compares them with what we have (size, fields, alignment, etc) and produces .warn files. This is first raw version, it can be improved in a number of ways. But it already helped to identify a critical issue google#1542 and shows some wrong struct descriptions. Update google#590
dvyukov
added a commit
that referenced
this issue
Dec 17, 2019
syz-check parses vmlinux dwarf, extracts struct descriptions, compares them with what we have (size, fields, alignment, etc) and produces .warn files. This is first raw version, it can be improved in a number of ways. But it already helped to identify a critical issue #1542 and shows some wrong struct descriptions. Update #590
dvyukov
added a commit
that referenced
this issue
Dec 18, 2019
dvyukov
added a commit
that referenced
this issue
Dec 19, 2019
Just trying to get my head around it (and fix this in tests). Update #1542
dvyukov
added a commit
that referenced
this issue
Dec 20, 2019
Combine markBitfields and addAlignment functions. Fixing #1542 will require doing both at the same time, they are not really independent. Also remove the special case for packed structs, pad them as part of the common procedure. No functional changes.
dvyukov
added a commit
that referenced
this issue
Dec 20, 2019
Just trying to get my head around it (and fix this in tests). Update #1542
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See a5c1ab0. We lay out all these bitfields incorrectly and there are precedents in linux descriptions where such bitfields are used.
The text was updated successfully, but these errors were encountered: