bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fakeroot-hurd bug or not?


From: Justus Winter
Subject: Re: fakeroot-hurd bug or not?
Date: Thu, 08 Oct 2015 12:56:20 +0200
User-agent: alot/0.3.5

Hi,

Quoting Samuel Thibault (2015-09-23 19:08:15)
> All that being said, we should probably not let the programs inside
> fakeroot believe they can write to /

I'm not so sure.  In my mind, fakeroot should fake as much as
possible, and fail at the latest point possible.

The test program only does stat and access, and never actually tries
to write to /.  And I agree with fakeroot lying to it.  If
fakeroot-tcp does something different, I'd consider that a bug.

> (because they may then try to, while they can't actually).

We could make that possible ofc.

> > The attached patch makes the behaviour the same as on Linux and
> > fakeroot-tcp. The question is which behaviour is the expected one.
> 
> It is indeed tempting do do this change.
> 
> > Index: hurd-0.6.git20150704/trans/fakeroot.c
> > ===================================================================
> > --- hurd-0.6.git20150704.orig/trans/fakeroot.c
> > +++ hurd-0.6.git20150704/trans/fakeroot.c
> > @@ -785,11 +785,7 @@ error_t
> >  netfs_report_access (struct iouser *cred, struct node *np, int *types)
> >  {
> >    struct netnode *nn = netfs_node_netnode (np);
> > -  if (!(nn->faked & FAKE_MODE))
> > -    return file_check_access (nn->file, types);
> > -  else
> > -    *types = O_RDWR|O_EXEC;
> > -  return 0;
> > +  return = file_check_access (nn->file, types);
> >  }

I disagree.  netfs_report_access is used to implement
file_check_access, which explicitly says:

/* Find out what kind of access this file permits the current user
   (regardless of the current open modes for this port).  ALLOWED is a
   bitwise OR of O_READ, O_WRITE, and O_EXEC.  This is not necessarily the
   same as what an open or exec would allow; O_EXEC is set for root even if
   no executable bits are on (in which case file_exec should fail) and
   O_WRITE is set a directory can be modified, even though it can't be
   written directly.  */
routine file_check_access (
        file: file_t;
        RPT
        out allowed: int);

So according to this it is ok to return writable even if it is not
writable from this rpc.

Cheers,
Justus

Attachment: signature.asc
Description: signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]