All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Antill <james.antill@redhat.com>
To: Jim Meyering <jim@meyering.net>
Cc: Joshua Brindle <jbrindle@tresys.com>,
	"Christopher J. PeBenito" <cpebenito@tresys.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	Karl MacMillan <kmacmillan@mentalrootkit.com>,
	selinux@tycho.nsa.gov
Subject: Re: justifying --context=CTX (-Z) for upstream coreutils, like mkdir
Date: Tue, 22 Aug 2006 20:27:27 -0400	[thread overview]
Message-ID: <1156292847.8627.25.camel@code.and.org> (raw)
In-Reply-To: <87k6506682.fsf@rho.meyering.net>

[-- Attachment #1: Type: text/plain, Size: 3230 bytes --]

On Tue, 2006-08-22 at 19:16 +0200, Jim Meyering wrote:

> >> I think there's a deeper difference in our understanding of how
> >> this hypothetical fscon program would work.  I expect that fscon
> >> would call some new function to request that a specified fscreate
> >> context be applied (as the default) to the next exec call.
> >> When I first read the descriptions of setexeccon and setfscreatecon,
> >> I thought the latter would do just what I wanted.  Unfortunately,
> >> its semantics aren't analogous to those of setexeccon.
> >
> > setexeccon sets the context for the next execution, not the context for
> > the next execution of the next execution, these are not in any way
> > comparable.
> 
> Sorry, I can't parse that.
> I'll rephrase the part I understand:
>   setexeccon sets the execution context for the next execve call
> 
> I would like fscon to set the default fscreate context to take effect
> for the next execve call -- then it performs that execve call.

 I think their argument is, that atm. you have:

        setexeccon
        [...stuff which isn't exec...]
        exec <-- affects this.
        
        setfscreatecon
        [...stuff which isn't open(O_CREAT)...]
        open(O_CREAT) <-- affects this.
        
...and you want:

        setfspostexeccon
        [...stuff which isn't exec...]
        exec
        [...stuff which isn't open(O_CREAT)...]
        open(O_CREAT) <-- affects this.


> It's more of the one task, one tool Unix approach to problem solving.

 Personally I don't believe this has been the case for decades, but
anyway...

> Another program that works this way: setarch.

 It doesn't work that way, setarch calls the personality() syscall. This
is basically a global variable inside the kernel. For instance:

% cat ~/personality.c
#include <sys/personality.h>

int main(void)
{
        personality(-1);
        return 0;
}
% gcc -Wall -W -o ~/personality ~/personality.c
% strace -e trace=personality setarch i386 ~/personality
personality(PER_LINUX32)                = 0
personality(0xffffffff /* PER_??? */)   = 8
Process 9009 detached
% strace -e trace=personality setarch i386 sh -c ~/personality
personality(PER_LINUX32)                = 0
personality(0xffffffff /* PER_??? */)   = 8
Process 9013 detached

> Both were mentioned in my earlier posts.
> 
> In principle, what I'm suggesting is no more unusual than what the
> setarch program does nor what the setexeccon function does.
[...]
> The patch program (which I also mentioned) is a better example.

 As someone else said, I think people want -Z (and/or matchpathcon) on
commands that have -m and preservation on commands that have
owner/mode/etc. preservation. Patch doesn't do either of those.
 mknod/mkfifo/mkdir do have -m, so it seems natural to have -Z (and
setting umask before could have worked, but having -m options was deemed
to be better).

 You would never want -Z in tar to do what you said, AFAICS.

-- 
James Antill - <james.antill@redhat.com>
setsockopt(fd, IPPROTO_TCP, TCP_CONGESTION, ...);
setsockopt(fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, ...);
setsockopt(fd, SOL_SOCKET,  SO_ATTACH_FILTER, ...);


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2006-08-23  0:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-11 13:58 justifying --context=CTX (-Z) for upstream coreutils, like mkdir Jim Meyering
2006-08-11 14:58 ` Karl MacMillan
2006-08-11 15:23   ` Stephen Smalley
2006-08-11 15:46   ` Casey Schaufler
2006-08-11 16:45   ` Jim Meyering
2006-08-12 17:43     ` Daniel J Walsh
2006-08-18 10:37       ` install vs. matchpathcon(8) [Re: justifying --context=CTX (-Z) Jim Meyering
2006-08-28 19:14         ` Stephen Smalley
2006-08-14 14:56     ` justifying --context=CTX (-Z) for upstream coreutils, like mkdir Karl MacMillan
2006-08-14 15:53       ` Jim Meyering
2006-08-14 16:02         ` Karl MacMillan
2006-08-14 17:18           ` Jim Meyering
     [not found]             ` <1155581090.28766.217.camel@moss-spartans.epoch.ncsc.mil>
2006-08-21 15:58               ` Jim Meyering
2006-08-21 17:40                 ` Christopher J. PeBenito
2006-08-21 21:31                   ` Jim Meyering
2006-08-22 13:12                     ` Joshua Brindle
2006-08-22 16:03                       ` Jim Meyering
2006-08-22 16:23                         ` Joshua Brindle
2006-08-22 17:16                           ` Jim Meyering
2006-08-23  0:27                             ` James Antill [this message]
2006-08-23 10:43                               ` Jim Meyering
2006-08-28 12:23                                 ` Joshua Brindle
2006-08-28 20:24                                   ` Stephen Smalley
2006-08-29 19:11                                     ` Stephen Smalley
2006-08-28 19:05                                 ` Stephen Smalley
2006-08-23 11:52                               ` Joshua Brindle
2006-08-21 17:58                 ` Karl MacMillan
2006-08-21 21:15                   ` Jim Meyering
2006-08-16 17:05 ` James Antill
2006-08-16 21:18   ` Jim Meyering
2006-08-28 20:00     ` Stephen Smalley
2006-08-28 20:10       ` Stephen Smalley

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=1156292847.8627.25.camel@code.and.org \
    --to=james.antill@redhat.com \
    --cc=cpebenito@tresys.com \
    --cc=jbrindle@tresys.com \
    --cc=jim@meyering.net \
    --cc=kmacmillan@mentalrootkit.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /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.