Re: getting permission denied with shmat() as non-root
Thanks Peter. That was the tip I needed for debugging the program on the Debian system. ipcs(1), when run as the same user as the program, did not show any shared memory being created. However, running ipcs(1) as root showed the memory being created by the non-root user with permissions of . Obviously, it should be 0660 or something similar, so I corrected the issue by or'ing the permissions with the create flags as the last argument to the function shmget(). Cheers. Timothy Stotts On Sun, 2011-08-28 at 21:11 +1000, Peter Miller wrote: On Sat, 2011-08-27 at 20:44 -0400, Timothy Stotts wrote: I am using ftok(), shmget(), shmat() to obtain a small quantity of shared memory for the application. As root, the shmat() function succeeds on the embedded system. However, on the Debian system the shmat() function returns -1 with an error code of EACCES, indicating permission denied. This means that the shared memory exists, or you would get EINVAL. The ipcs command may be used to list information about shared memory, and other ipc facilities. Try using ipcs(1) to see if there is a an owner and/or permissions mismatch for the shmid you are using. -- Peter Miller pmil...@opensource.org.au -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/1314656509.2359.5.camel@pedahzur
Re: getting permission denied with shmat() as non-root
On Sat, Aug 27, 2011 at 08:44:41PM -0400, Timothy Stotts wrote: /proc/config.gz reveals that SYSVIPC is indeed compiled into the Linux kernel of the Debian system. The Debian kernels don't include support for /proc/config.gz. How can I diagnose the program on the Debian system? strace. Also you may want to compile a minimal program that shows the error. I read on the Internet that this may have something to do with Linux Capabilities settings? Linux limits shared memory usage for non-root users. Not sure how exactly. Bastian -- You can't evaluate a man by logic alone. -- McCoy, I, Mudd, stardate 4513.3 -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20110828101049.ga22...@wavehammer.waldi.eu.org
Re: getting permission denied with shmat() as non-root
On Sat, 2011-08-27 at 20:44 -0400, Timothy Stotts wrote: I am using ftok(), shmget(), shmat() to obtain a small quantity of shared memory for the application. As root, the shmat() function succeeds on the embedded system. However, on the Debian system the shmat() function returns -1 with an error code of EACCES, indicating permission denied. This means that the shared memory exists, or you would get EINVAL. The ipcs command may be used to list information about shared memory, and other ipc facilities. Try using ipcs(1) to see if there is a an owner and/or permissions mismatch for the shmid you are using. -- Peter Miller pmil...@opensource.org.au -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/1314529860.2648.15.camel@hawk
Re: getting permission denied with shmat() as non-root
On Sat, Aug 27, 2011 at 08:44:41PM -0400, Timothy Stotts wrote: on the Debian system the shmat() function returns -1 with an error code of EACCES, indicating permission denied. The embedded system does not have shm_open(), otherwise I would use that. Other folks in this thread provided better ways to solve this, but if everything else fails, you can check the presence of shm_open() with autoconf (if not defined) or at runtime (if ENOSYS) and use one or the other in your program. -- 1KB // Yo momma uses IPv4! -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20110828130142.ga17...@angband.pl