Bug 33512 - shm_open doesn't work (w/ Linux 2.4.2)
shm_open doesn't work (w/ Linux 2.4.2)
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Aaron Brown
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-03-27 18:06 EST by Steve Lawler
Modified: 2016-11-24 10:07 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-12-15 09:34:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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 18:08 EST, Steve Lawler
no flags Details | Diff

  None (edit)
Description Steve Lawler 2001-03-27 18:06:00 EST
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>

int
main(int argc, char * const * argv)
{
    int fd;
    fd = shm_open("/blargh", O_RDWR|O_CREAT, 0644);
    if (fd < 0) {
        printf("ERRORERROR!\n");
        abort();
    } else {
        printf("YAY!\n");
        return 0;
    }
}
EOF
cc -D_GNU_SOURCE foo.c -lrt -o foo
./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 18:08:18 EST
Created attachment 13883 [details]
Fixes the problem hopefully.
Comment 2 Jakub Jelinek 2001-03-28 03:03:06 EST
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.