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

semctl09 broken on 32bit powerpc (and 64bit time) #1196

Open
andree182 opened this issue Sep 24, 2024 · 1 comment
Open

semctl09 broken on 32bit powerpc (and 64bit time) #1196

andree182 opened this issue Sep 24, 2024 · 1 comment

Comments

@andree182
Copy link

andree182 commented Sep 24, 2024

For some reason, semctl09 fails unless compiled with -O0.

semctl09.c:141: TINFO: Test SEM_STAT_ANY with nobody user
semctl09.c:163: TPASS: SEM_INFO returned valid index 10 to semid 10
semctl09.c:175: TFAIL: Counted used = 1, semuse = 0
semctl09.c:118: TFAIL: semusz = 0, expected 1
semctl09.c:125: TFAIL: semaem = 0, expected 2
semctl09.c:141: TINFO: Test SEM_STAT_ANY with root user
semctl09.c:163: TPASS: SEM_INFO returned valid index 10 to semid 10
semctl09.c:175: TFAIL: Counted used = 1, semuse = 0
semctl09.c:118: TFAIL: semusz = 0, expected 1
semctl09.c:125: TFAIL: semaem = 0, expected 2

It looks like __semctl64 is used for the actual call. With -O0, it seems to return the same structure that is returned in the kernel, with -O1 not, the structure gets mostly zeroed after the call

semid = do_semctl(TST_RET, 0, SEM_STAT_ANY);

Most likely semid_ds is not the right thing to put into the call to SEM_STAT_ANY (making it static confirms the issue by segfault).

E.g. char info[2048]; in do_semctl() fixes the issue.

@metan-ucw
Copy link
Member

metan-ucw commented Sep 24, 2024

I suppose that this is the same problem as shmctl, we are mixing the kernel syscall with the glibc structure layout. I suppose that we need the kernel structure layout for the raw syscall instead of the glibc layout.

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

No branches or pull requests

2 participants