> On Sat, May 07, 2016 at 06:48:58AM -0500, Edgar Pettijohn wrote:
> > > 
> > > else, if it isn't in xclock code, it could be a open(2) call in some
> > > X11R6 library.
> > > 
> > I looked all I found was access() which if I'm reading pledge correctly it 
> > doesn't need pledge. Is that right?
> > 
> 
> What I mean is the error code path in libX11 (for example).
> 
> After checking the code source:
>   - the default error handler (for not fatal) error is _XDefaultError 
> (xenocara/lib/libX11/src/XlibInt.c:1375)
>   - it calls _XPrintDefaultError (xenocara/lib/libX11/src/XlibInt.c:1263)
>   - it calls XGetErrorDatabaseText (xenocara/lib/libX11/src/ErrDes.c:139)
>   - it calls XrmGetFileDatabase (xenocara/lib/libX11/src/Xrm.c:1669)
>   - it calls ReadInFile (xenocara/lib/libX11/src/Xrm.c:1573)
>   - it calls _XOpenFile (xenocara/lib/libX11/src/XlibInt.c:1830)
>   - ... and _XOpenFile will do access(2) and open(2) on filename, and
>     kernel will kill it due to pledge.
> 
> I am still unsure if adding "rpath" is the good way to deal with that.
> 
> But the problem you saw could be related to some X11 error that trigger
> a access(2) or a open(2) for showing error message.

So, /usr/X11R6/share/X11/XErrorDB is the file in question?  That is
being parsed very late.  That is quite an outdated model... like, when
something has goes wrong, let's open a file and parse lots of strings!
Alas, that is the story of X.

Sigh.

However I've said it before, and I'll say it again.  pledge should
only be used in commands when the command is fully understood top to
bottom, and fully tested as well.  This command uses a library that
was not studied.  The result was not fully tested.  A bit of
optimism-driven-development is fine, but when the complexity is high
it cannot be the only foundation.

I am not really surprised to see the resulting failure.

The result is that xclock is broken in 5.9.  If a program does not
fully perform the actions it previously promised to do, then the
addition of pledge BROKE IT.

So the next optimism-driven development will be "add rpath".  Without
a full study of the large libraries it links against.  After rpath is
added, I expect more breakage in xclock will be found, because there
will be something else in the libraries.

I don't believe that xclock callpath & reach into libX11 has been
audited & verified to operate only using the POSIX-subset provided by
pledge "stdio".  Nor, do I believe the same for "stdio rpath".  It is
a lot of code, I just cannot be sure.

So I don't understand why pledge is being added here.  The addition of
pledge is breaking xclock.  A pledge addition should not break a
program (coredump) in any circumstance, it should only serve to secure
it in conditions of true & undetected misbehaviour.  Sure, pledge can
make programs safer, but only if they also keep working!!  Otherwise
this is very much throwing the baby out with the bathwater.

Reply via email to