🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #13

semaphore permissions

#13
From: Richard H Schwartz
Date: Wed, 28 Oct 1992 17:57
45 lines
2582 bytes
What do the permissions assigned to a semaphore really mean?  They look 
like ordinary file permissions: owner, group, others; so I've been assuming
that they refer to login name, and group.  All the documentation I've 
read seems to go along with this.

But I have been experiencing problems that are hinting to me that *process
group* has something to do with semaphore access, and I can't figure out
what (if any) the rules are...

This is on AIX 3.2 on an RS6000 Model 340:

I have a set of four processes:  A forks&execs B
                                 B does a setpgrp() and forks&execs C 
                                 C forks&execs D

Using a library of semaphore routines that I put together based on the 
sample code in Stevens "Unix Network Programming" section 3.10, C and D 
have no problems using three semaphore sets that C creates.  A is also 
able to use one of semaphore sets that C creates.  But D is unable to 
access a semaphore set that A creates, despite the fact that A's semget() 
specified 0666 | IPC_CREAT for the flag value.  I have verified that D is 
specifying the correct key, doing a successful semget(), but receiving 
EACCESS on a semop() call to decrement one member of the set.

The A, B, C and D process executables are all owned by the same user
and group, and the owner ran A from a shell script.  None of the files
involved has the setuid bit on.  Apart from the fact that B does the
setpgid() call, I can think of nothing to explain what is happening.
But it seems crazy: a child process in a different process group can't
access the parent process' semaphore, but the parent process can access
a semaphore created by a child in a different process group.

I have not tried disabling that setpgid() call.  That's near the top 
of my list of things to try.  But if anyone has any information that
could shed some light on this, I'd appreciate an e-mail reply.  I'll
be happy to summarize for the net once the true problem is revealed.

-rich


-- 
             Richard H. Schwartz, Scheduling Systems Inc.,
            1000 Massachusetts Avenue, Cambridge, MA  02138
                  (617) 864 8330; FAX (617) 864 8377
                          rhs@world.std.com
Technical Details
Message-ID: <BwuF84.LzF@world.std.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!sol.ctr.columbia.edu!eff!world!rhs

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!sol.ctr.columbia.edu!eff!world!rhs
From: rhs@world.std.com (Richard H Schwartz)
Subject: semaphore permissions
Message-ID: <BwuF84.LzF@world.std.com>
Organization: The World Public Access UNIX, Brookline, MA
Date: Wed, 28 Oct 1992 17:57:39 GMT
Lines: 45