mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brent Casavant <bcasavan@sgi.com>
To: Gabor Gombas <gombasg@sztaki.hu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: O_NOLINK for open()
Date: Thu, 13 Sep 2007 11:05:28 -0500 (CDT)	[thread overview]
Message-ID: <20070913104609.K41932@pkunk.americas.sgi.com> (raw)
In-Reply-To: <20070913100803.GG11567@boogie.lpds.sztaki.hu>

On Thu, 13 Sep 2007, Gabor Gombas wrote:

> On Wed, Sep 12, 2007 at 03:37:44PM -0500, Brent Casavant wrote:
> 
> > System V shmem is right out because the IPC key is publicly
> > visible and there is no combination of permissions which
> > will allow sharing the segment with just one other process
> > (or at least just one other user).  To my knowledge Linux's
> > implementation doesn't provide ACLs for SysV shmem.  SGI's
> > proposed XPMEM suffers from the same problems for my purposes.
> 
> SYSV shared memory has the concept of separate creator and owner ID's,
> so you can share the shmem segment between exactly two users. Just use
> IPC_SET and set shm_perm.uid to the user ID of the peer process.

Hmm.  This will work as long as the peer process is running setuid
to it's own unique user.  Excellent idea!  Since I need to make the
program setuid to avoid non-priveleged ptrace attacks, this is a
terrific solution.

> I think your worries about permissions has been cleared by the other
> posts, but there is still a problem: the client may call ftruncate() on
> the file descriptor, and then your daemon will get a nice SIGBUS when it
> tries to access the shared memory. Handling that gracefully may not be
> trivial esp. if your daemon is multi-threaded. SYSV shmem is _much_
> nicer when you want shared memory between unrelated/untrusted processes.

I'm actually not so concerned about the client -- that code will be
trusted as well.  The problem I'm trying to solve is preventing any
non-priveleged code except the server and client from gaining access
to their shared memory area.  With the feedback I've received from
this thread I think a solid design is emerging, some of which will
need to be solved by system configuration by the sysadmin.

Thanks,
Brent

-- 
Brent Casavant                          All music is folk music.  I ain't
bcasavan@sgi.com                        never heard a horse sing a song.
Silicon Graphics, Inc.                    -- Louis Armstrong

  reply	other threads:[~2007-09-13 16:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-12 20:37 Brent Casavant
2007-09-12 21:07 ` H. Peter Anvin
2007-09-12 21:39   ` Brent Casavant
2007-09-12 21:46     ` H. Peter Anvin
2007-09-12 21:42 ` Andreas Schwab
2007-09-12 22:44   ` Brent Casavant
2007-09-12 22:49     ` Al Viro
2007-09-12 23:27       ` Brent Casavant
2007-09-12 23:48         ` Brent Casavant
2007-09-14 16:37         ` Goswin von Brederlow
2007-09-13 10:08 ` Gabor Gombas
2007-09-13 16:05   ` Brent Casavant [this message]
     [not found] <92Haf-7z7-5@gated-at.bofh.it>
2007-09-12 22:33 ` Bodo Eggert
2007-09-13  9:13   ` Jan Kara
2007-09-14  9:07     ` Bodo Eggert
     [not found] ` <92TO5-246-1@gated-at.bofh.it>
     [not found]   ` <92Zqu-2ur-1@gated-at.bofh.it>
2007-09-14 10:30     ` Bodo Eggert
2007-09-14 10:50       ` Andreas Schwab
2007-09-14 17:26         ` Bodo Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070913104609.K41932@pkunk.americas.sgi.com \
    --to=bcasavan@sgi.com \
    --cc=gombasg@sztaki.hu \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®