All of lore.kernel.org
 help / color / mirror / Atom feed
From: KELEMEN Peter <Peter.Kelemen@cern.ch>
To: linux-scsi@vger.kernel.org
Subject: Re: SG_IO permissions
Date: Thu, 3 Jul 2008 19:57:55 +0200	[thread overview]
Message-ID: <20080703175755.GB1513@luba> (raw)
In-Reply-To: <E7F3663B89B60B478C6997C0A0671F8B0D58AB@cernxchg45.cern.ch>

* Arne Wiebalck (arne.wiebalck@cern.ch) [20080702 20:40]:

> The user process in my case is forked by another process which
> runs as root. But since this process does not have CAP_SETPCAP
> it cannot set the child's capabilities (which is how I naively
> thought one could implement this).

There is no need.  Your problem is that setuid() clears the
permissible capability set.  This should do the trick:

	/* ...in child after fork()... */
	prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
	setuid(...);
	cap_set_proc(cap_from_text("cap_sys_rawio+ep"));

HTH,
Peter

-- 
    .+'''+.         .+'''+.         .+'''+.         .+'''+.         .+''
 Kelemen Péter     /       \       /       \     Peter.Kelemen@cern.ch
.+'         `+...+'         `+...+'         `+...+'         `+...+'
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-07-03 18:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-02 13:20 SG_IO permissions Arne Wiebalck
2008-07-02 14:51 ` James Bottomley
2008-07-02 18:00   ` Arne Wiebalck
2008-07-02 18:40     ` Arne Wiebalck
2008-07-02 20:28       ` James Bottomley
2008-07-03  9:15         ` Arne Wiebalck
2008-07-03 15:06           ` James Bottomley
2008-07-03 17:57       ` KELEMEN Peter [this message]
2008-07-04  8:13       ` Arne Wiebalck

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=20080703175755.GB1513@luba \
    --to=peter.kelemen@cern.ch \
    --cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.