Bug 33512 - shm_open doesn't work (w/ Linux 2.4.2)
Summary: shm_open doesn't work (w/ Linux 2.4.2)
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc   
(Show other bugs)
Version: 7.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Aaron Brown
Keywords: FutureFeature
Depends On:
TreeView+ depends on / blocked
Reported: 2001-03-27 23:06 UTC by Steve Lawler
Modified: 2016-11-24 15:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-12-15 14:34:04 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Fixes the problem hopefully. (588 bytes, patch)
2001-03-27 23:08 UTC, Steve Lawler
no flags Details | Diff

Description Steve Lawler 2001-03-27 23:06:00 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.72 [en] (X11; U; Linux 2.2.14-5.0 i686)

shm_open does not work w/ glibc 2.2 and Linux 2.4.2 (presumably any 2.4.x
series).  The problem is in
glibc-2.2.2/sysdeps/unix/sysv/linux/linux_fsinfo.h, which defines
SHMEM_SUPER_MAGIC to be 0x02011994.  linux-2.4.2/fs/shmem.c defines
SHMEM_MAGIC to be 0x01021994.  Thus the fix is pretty simple.

I guess this isn't really a RH7.0 problem since it doesn't ship with the
2.4.x kernels, but it is a glibc problem for the current batch of kernels. 
Thus I'm filing it under "enhancement" since this perhaps is just a fix
applicable for the next release of RedHat.

Reproducible: Always
Steps to Reproduce:
Write a simple program:

cat << EOF > foo.c
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>

main(int argc, char * const * argv)
    int fd;
    fd = shm_open("/blargh", O_RDWR|O_CREAT, 0644);
    if (fd < 0) {
    } else {
        return 0;
cc -D_GNU_SOURCE foo.c -lrt -o foo

Actual Results:  Prints the error message and dumps core.

Expected Results:  Should have printed yay and returned with 0 exit status.

Also a good idea to add a "none /dev/shm shm defaults 0 0" entry to
/etc/fstab upon installation of a 2.4.x kernel, and mkdir /dev/shm.

Comment 1 Steve Lawler 2001-03-27 23:08:18 UTC
Created attachment 13883 [details]
Fixes the problem hopefully.

Comment 2 Jakub Jelinek 2001-03-28 08:03:06 UTC
Guess what is in glibc-2.2.2-4 and above.
As for why is the shm line missing in /etc/fstab, I'll check out.

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