[Pdbg] [PATCH] main: Run as root

Alistair Popple alistair at popple.id.au
Wed Mar 28 16:31:35 AEDT 2018


On Wednesday, 28 March 2018 4:00:33 PM AEDT Amitay Isaacs wrote:
> On Wed, 2018-03-28 at 15:19 +1100, Michael Neuling wrote:
> > Thanks Amitay,
> > 
> > There are some parts of pgdb that won't need root. Seems like we
> > should add
> > something like this when we actually try to open a device and get an
> > EPERM.  
> 
> What parts are those?  From my (non-existent) understanding of pdbg,
> all of it requires root privileges.

The fake backend is the most obvious example. What we need here is some better
error reporting when something that we expect to be there (or can't function
without) isn't.

What is happening is host_pib_probe() is failing but it isn't reported. This is
because we don't currently have a way of figuring out if the failure is critical
and should be reported as probing is allowed to fail (eg. because a piece of
hardware like a core may not exist on this computer).

Perhaps we should probably set/get the target status to figure out if a given
target is critical or not to the current operation.

- Alistair

> > 
> > Also a commit message as to why we need this would be nice here.
> > 
> > Mikey
> > 
> > 
> > > Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
> > > ---
> > >  src/main.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/src/main.c b/src/main.c
> > > index 121e4ad..878761c 100644
> > > --- a/src/main.c
> > > +++ b/src/main.c
> > > @@ -493,6 +493,11 @@ int main(int argc, char *argv[])
> > >  	if (target_select())
> > >  		return 1;
> > >  
> > > +	if (geteuid() != 0) {
> > > +		fprintf(stderr, "Run as root\n");
> > > +		return 1;
> > > +	}
> 
> Amitay.
> 




More information about the Pdbg mailing list