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

Fix alignment and structure size for 32-bit systems #281

Merged
merged 1 commit into from
Dec 12, 2020

Conversation

darktemplarbasealt
Copy link
Contributor

No description provided.

@darktemplarbasealt
Copy link
Contributor Author

Without such changes on 32-bit system (Linux i686) I'm getting following error:

# sadf
Invalid system activity file: /var/log/sa/sa10

On closer inspection I've found out that activity record has size 0x14 (20 bytes) on 32bit system since sizeof(unsigned long) is usually 4 bytes:

https://github.com/sysstat/sysstat/blob/master/rd_stats.h#L719

Hardcoded size of buffer is { 1, 3, 0 }:

https://github.com/sysstat/sysstat/blob/master/activity.c#L1894

Size is checked here:

https://github.com/sysstat/sysstat/blob/master/sa_common.c#L2058

Result of check is fail, since MAP_SIZE(1, 3, 0) = 1 * 8 + 3 * 8 + 0 * 4 = 32, but size of structure is 1 * 8 + 3 * 4 = 20.

https://github.com/sysstat/sysstat/blob/master/rd_stats.h#L91

This change fixes this issue by adding alignment for unsigned long members of new structures in rd_stats.h

Tested on sysstat v12.5.1.

@sysstat
Copy link
Owner

sysstat commented Dec 10, 2020

Thanks for this bug report! I will apply your patch ASAP.
BTW would it be possible to send me such a datafile (/var/log/sa/saDD) created on a 32-bit system please? (send it to sysstat at orange.fr)

@sysstat sysstat merged commit 70304c2 into sysstat:master Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants