Re: Document that openlog's first paramater must continue to point to valid data

2020-02-05 Thread Ingo Schwarze
Hi, Laurence Tratt wrote on Wed, Feb 05, 2020 at 09:38:28AM +: > On Mon, Feb 03, 2020 at 09:28:15PM +0100, Ingo Schwarze wrote: >> The parameter >> .Fa ident >> -is a string that will be prepended to every message. >> +points to a string that will be prepended to every message; >> +its stor

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-05 Thread Laurence Tratt
On Mon, Feb 03, 2020 at 09:28:15PM +0100, Ingo Schwarze wrote: Hello Ingo, > The parameter > .Fa ident > -is a string that will be prepended to every message. > +points to a string that will be prepended to every message; > +its storage must persist until > +.Fn closelog > +or the corresponding

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-04 Thread Ossi Herrala
On Sun, Feb 02, 2020 at 11:37:12PM +, Laurence Tratt wrote: > While writing a daemon in Rust, I discovered that, AFAICT, one doesn't have > sensible access to __progname and has to figure out the executable name > dynamically (AFAICT), so it ends up in malloc'd storage. > You probably should

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-03 Thread Todd C . Miller
On Mon, 03 Feb 2020 21:28:15 +0100, Ingo Schwarze wrote: > Given that our implementation chooses to use-after-free (as it is > permitted to) if the memory becomes invalid, i prefer the Theo's > strong wording "must persist" to the possibly less discouraging > "unspecified" - foremost, we are docum

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-03 Thread Theo de Raadt
> +If the content of the string is changed, behaviour is unspecified. I like that. Since it is unspecified whether openlog stores the pointer or the string, it should discourage people from trying to be clever.

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-03 Thread Jason McIntyre
On Mon, Feb 03, 2020 at 09:53:39PM +, Stuart Henderson wrote: > On 2020/02/03 21:40, Jason McIntyre wrote: > > On Mon, Feb 03, 2020 at 09:28:15PM +0100, Ingo Schwarze wrote: > > > Hi, > > > > > > since our manual page doesn't explain the details of how openlog(3) > > > uses *ident, it seems re

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-03 Thread Stuart Henderson
On 2020/02/03 21:40, Jason McIntyre wrote: > On Mon, Feb 03, 2020 at 09:28:15PM +0100, Ingo Schwarze wrote: > > Hi, > > > > since our manual page doesn't explain the details of how openlog(3) > > uses *ident, it seems reasonable for users to conclude that it is > > safest to neither free nor modif

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-03 Thread Jason McIntyre
On Mon, Feb 03, 2020 at 09:28:15PM +0100, Ingo Schwarze wrote: > Hi, > > since our manual page doesn't explain the details of how openlog(3) > uses *ident, it seems reasonable for users to conclude that it is > safest to neither free nor modify it. > > Then again, given that in our implementation

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-03 Thread Ingo Schwarze
Hi Andreas, Andreas Kusalananda wrote on Mon, Feb 03, 2020 at 09:56:22PM +0100: > Related: https://www.austingroupbugs.net/view.php?id=1244 > > A proposal seems to have been accepted (if I'm reading it correctly) in > November of last year to change the wording in POSIX from > > The ide

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-03 Thread Andreas Kusalananda Kähäri
On Mon, Feb 03, 2020 at 09:28:15PM +0100, Ingo Schwarze wrote: > Hi, > > since our manual page doesn't explain the details of how openlog(3) > uses *ident, it seems reasonable for users to conclude that it is > safest to neither free nor modify it. > > Then again, given that in our implementation

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-03 Thread Ingo Schwarze
Hi, since our manual page doesn't explain the details of how openlog(3) uses *ident, it seems reasonable for users to conclude that it is safest to neither free nor modify it. Then again, given that in our implementation, freeing it may even pose a security hazard, i might seem friendly to give m

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-03 Thread Laurence Tratt
On Sun, Feb 02, 2020 at 04:45:53PM -0700, Theo de Raadt wrote: Hello Theo, >> When I passed that to openlog, and later called syslog, well, I was >> confused. I then distilled the example down to C. The Debian & GNU man >> pages suggest that I'm not the first person to try doing this. > That woul

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-02 Thread Theo de Raadt
Laurence Tratt wrote: > On Sun, Feb 02, 2020 at 04:20:13PM -0700, Theo de Raadt wrote: > > Hello Theo, > > > What is the difference between storage and contents > > You can't free() the backing memory *and* (according to GNU's man page, at > least) you can't safely change the string contents e

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-02 Thread Laurence Tratt
On Sun, Feb 02, 2020 at 04:20:13PM -0700, Theo de Raadt wrote: Hello Theo, > What is the difference between storage and contents You can't free() the backing memory *and* (according to GNU's man page, at least) you can't safely change the string contents either on some OSs. I've tried something

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-02 Thread Theo de Raadt
Laurence Tratt wrote: > On Sun, Feb 02, 2020 at 03:22:12PM -0700, Theo de Raadt wrote: > > Hello Theo, > > >> OpenBSD's documentation for openlog's first paramater 'ident' is less > >> clear than Debian [1] or GNU [2] that the memory pointed to must remain > >> valid for as long as syslog is ca

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-02 Thread Laurence Tratt
On Sun, Feb 02, 2020 at 03:22:12PM -0700, Theo de Raadt wrote: Hello Theo, >> OpenBSD's documentation for openlog's first paramater 'ident' is less >> clear than Debian [1] or GNU [2] that the memory pointed to must remain >> valid for as long as syslog is called (which I'm assuming without hard

Re: Document that openlog's first paramater must continue to point to valid data

2020-02-02 Thread Theo de Raadt
>OpenBSD's documentation for openlog's first paramater 'ident' is less clear >than Debian [1] or GNU [2] that the memory pointed to must remain valid for >as long as syslog is called (which I'm assuming without hard evidence is >equivalent to "until closelog is called"). > >Although this isn't spec

Document that openlog's first paramater must continue to point to valid data

2020-02-02 Thread Laurence Tratt
OpenBSD's documentation for openlog's first paramater 'ident' is less clear than Debian [1] or GNU [2] that the memory pointed to must remain valid for as long as syslog is called (which I'm assuming without hard evidence is equivalent to "until closelog is called"). Although this isn't specified