RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1978412 - glibc doesn't add IPC_64 flag to shmctl(SHM_STAT_ANY, ...) calls on ppc64/ppc64le
Summary: glibc doesn't add IPC_64 flag to shmctl(SHM_STAT_ANY, ...) calls on ppc64/ppc...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: glibc
Version: 7.9
Hardware: ppc64
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: glibc team
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-01 18:20 UTC by Eugene Syromiatnikov
Modified: 2022-11-10 13:27 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-07-05 03:54:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1592475 1 None None None 2021-07-01 18:50:03 UTC
Red Hat Bugzilla 1912670 1 low CLOSED semctl SEM_STAT_ANY fails to pass the buffer specified by the caller to the kernel 2023-09-02 14:23:27 UTC
Red Hat Bugzilla 2141685 0 unspecified CLOSED glibc: Restore IPC_64 support in sysvipc *ctl functions [rhel-9.2.0] 2023-10-13 06:41:37 UTC
Sourceware 26637 0 P2 RESOLVED semctl SEM_STAT_ANY fails to pass the buffer specified by the caller to the kernel 2021-07-01 18:50:03 UTC
Sourceware 29771 0 P2 ASSIGNED Restore IPC_64 support in sysvipc *ctl functions 2022-11-10 10:36:54 UTC

Internal Links: 2141685

Description Eugene Syromiatnikov 2021-07-01 18:20:24 UTC
Description of problem:
glibc doesn't add IPC_64 flag to SHM_STAT_ANY shmctl calls, which leads to incorrect results on ppc64/ppc64le.

Version-Release number of selected component (if applicable):
glibc-2.17-317.el7.ppc64, glibc-2.17-324.el7.ppc64
glibc-2.17-317.el7.ppc64le

How reproducible:
Easily and consistently, after some initial effort

Steps to Reproduce:
Reproducer:
---8<---
#include <assert.h>
#include <errno.h>
#include <stdio.h>

#include <sys/ipc.h>
#include <sys/shm.h>

int main()
{
	struct shmid_ds ds;
	struct shmid_ds ds_any;
	int id;
	
	id = shmget(IPC_PRIVATE, 4096, IPC_CREAT | 0600);
	if (id < 0) {
		perror("shmget");
		return 2;
	}

	if (shmctl(id, SHM_STAT, &ds) < 0) {
		perror("shmctl(SHM_STAT)");
		return 3;
	}

	printf("SHM_STAT shm_cpid:  %#x\n", ds.shm_cpid);
	printf("SHM_STAT shm_atime: %#llx\n", (unsigned long long) ds.shm_atime);
	printf("SHM_STAT shm_dtime: %#llx\n", (unsigned long long) ds.shm_dtime);
	printf("SHM_STAT shm_ctime: %#llx\n", (unsigned long long) ds.shm_ctime);
	printf("\n");

	if (shmctl(id, SHM_STAT_ANY|0x100, &ds_any) < 0) {
		perror("shmctl(SHM_STAT_ANY)");
		return 4;
	}

	printf("SHM_STAT_ANY|IPC_64 shm_cpid:  %#x\n", ds_any.shm_cpid);
	printf("SHM_STAT_ANY|IPC_64 shm_atime: %#llx\n", (unsigned long long) ds_any.shm_atime);
	printf("SHM_STAT_ANY|IPC_64 shm_dtime: %#llx\n", (unsigned long long) ds_any.shm_dtime);
	printf("SHM_STAT_ANY|IPC_64 shm_ctime: %#llx\n", (unsigned long long) ds_any.shm_ctime);
	printf("\n");

	if (shmctl(id, SHM_STAT_ANY, &ds_any) < 0) {
		perror("shmctl(SHM_STAT_ANY)");
		return 4;
	}

	printf("SHM_STAT_ANY shm_cpid:  %#x\n", ds_any.shm_cpid);
	printf("SHM_STAT_ANY shm_atime: %#llx\n", (unsigned long long) ds_any.shm_atime);
	printf("SHM_STAT_ANY shm_dtime: %#llx\n", (unsigned long long) ds_any.shm_dtime);
	printf("SHM_STAT_ANY shm_ctime: %#llx\n", (unsigned long long) ds_any.shm_ctime);
	printf("\n");

	assert(ds.shm_cpid == ds_any.shm_cpid);
	assert(ds.shm_atime == ds_any.shm_atime);
	assert(ds.shm_ctime == ds_any.shm_ctime);
	assert(ds.shm_dtime == ds_any.shm_dtime);

	if (shmctl(id, IPC_RMID, NULL) < 0)
		perror("shmctl(IPC_RMID)");

	return 0;
}
--->8---
Compile:
gcc -D_GNU_SOURCE=1 -std=c99 -Wall -Wextra -Werror ipc_repro.c -o ipc_repro
Run:
./ipc_repro

Actual results:
Reproducer exits with exit code 0.

Expected results:
Reproducer aborts on the first assertion:
---8<---
ipc_repro: ipc_repro.c:53: main: Assertion `ds.shm_cpid == ds_any.shm_cpid' failed.
Aborted
--->8---

Additional info:
Discovered by strace test suite, ipc_shm test.
The same issue might occur with MSG_STAT_ANY and SEM_STAT_ANY.

Comment 3 Florian Weimer 2021-07-01 18:50:03 UTC
I believe this is caused by incomplete SHM_STAT_ANY enablement in bug 1592475. Upstream had the same issue.

Comment 4 Eugene Syromiatnikov 2021-07-01 23:10:42 UTC
ipc_msg strace test has also caught the similar issue with MSG_STAT_ANY on ppc64le.  SEM_STAT_ANY is likely needs fixing as well, but it seems to have slipped away from the test suite.

Comment 5 Carlos O'Donell 2021-07-05 03:54:07 UTC
Red Hat Enterprise Linux 7 is in Maintenance Support 2 Phase and as such we won't be adjusting the semaphore, message, or sysv ipc interfaces to support additional flags. If we have a direct customer issue or workload that is being impacted we could reconsider this decision, but that would be on a case-by-case basis (we would want to understand the exact use case). This is the same issue as bug 1912670 where this is in the progress of being fixed for Red Hat Enterprise Linux 8.5.0.

I'm marking this as CLOSED/WONTFIX.

Comment 6 Florian Weimer 2022-11-10 10:53:35 UTC
Applications have started to pass IPC_64 explicitly in the command argument, but this is not compatible with current glibc. I filed an upstream bug:

Restore IPC_64 support in sysvipc *ctl functions
https://sourceware.org/bugzilla/show_bug.cgi?id=29771

(A potential backport of the upstream bug needs to be handled in a different downstream bug.)


Note You need to log in before you can comment on or make changes to this bug.