Re: recent malloc changes

2023-06-18 Thread Why 42? The lists account.


On Sun, Jun 18, 2023 at 04:46:46PM +0200, Why 42? The lists account. wrote:
> Jun 18 16:18:23 mjoelnir mdnsd: startup
> Jun 18 16:18:23 mjoelnir mdnsd: fatal: bind: Address already in use
> Jun 18 16:23:02 mjoelnir mdnsd: startup
> Jun 18 16:23:02 mjoelnir mdnsd: fatal: bind: Address already in use

So, this issue "Address in use" was because mdnsd and avahi-daemon were
fighting over the same port, likely 5353. My fault.

Once I stop the avahi daemon, I can start mdnsd OK (and vice versa).

Still seems that mdnsd exits with 0 when it fails to start e.g. when
given a nonexistant interface:

mjoelnir:robb 18.06 17:41:08 # mdnsd le0
mjoelnir:robb 18.06 17:41:12 # echo $?
0

mjoelnir:robb 18.06 17:41:18 # pgrep -l mdnsd
mjoelnir:robb 18.06 17:41:24 [$?==1]#

mjoelnir:robb 18.06 17:41:24 [$?==1]# grep mdnsd /var/log/daemon | tail -3
Jun 18 17:41:12 mjoelnir mdnsd: startup
Jun 18 17:41:12 mjoelnir mdnsd: Unknown interface le0
Jun 18 17:41:12 mjoelnir mdnsd: fatal: Couldn't find any interface

This then confuses the rcctl script.

So IMHO that would also be a potential improvement.

Cheers,
Robb.



Re: recent malloc changes

2023-06-18 Thread Why 42? The lists account.


On Sun, Jun 18, 2023 at 03:34:27PM +0200, Otto Moerbeek wrote:
> So what's in your malloc options?

Er, nothing:
mjoelnir:robb 18.06 15:57:29 [$?==1]# echo $MALLOC_OPTIONS

mjoelnir:robb 18.06 15:57:40 # echo $MALLOC_OPTIONS | cat -vet
$

mjoelnir:robb 18.06 15:59:25 [$?==1]# unset MALLOC_OPTIONS

mjoelnir:robb 18.06 15:59:30 # mdnsd -d
malloc() warning: unknown char in MALLOC_OPTIONS
malloc() warning: unknown char in MALLOC_OPTIONS


But I think that I now see how I managed to trigger this ...

I commented out the "mdnsd_flags" entry in /etc/rc.conf.local while
trying to debug the "simple-scan" application.

(simple-scan starts but doesn't do anything and I noticed that I had
previously (2021) left myself a hint in that file: "Reverted to avahid
since scanner not detected with mdnsd")

I would have probably done better to have changed that line to say "=NO"
instead.

Still doesn't start though ... Now I see this log message:
mjoelnir:robb 18.06 16:23:21 # grep mdnsd /var/log/daemon
...
Jun 18 16:18:23 mjoelnir mdnsd: startup
Jun 18 16:18:23 mjoelnir mdnsd: fatal: bind: Address already in use
Jun 18 16:23:02 mjoelnir mdnsd: startup
Jun 18 16:23:02 mjoelnir mdnsd: fatal: bind: Address already in use

Interesting that the startup script returns OK:
mjoelnir:robb 18.06 16:32:43 [$?==1]# rcctl start mdnsd
mdnsd(ok)

Log file:
Jun 18 16:32:45 mjoelnir mdnsd: startup
Jun 18 16:32:45 mjoelnir mdnsd: fatal: bind: Address already in use

mjoelnir:robb 18.06 16:34:21 # pgrep -l dns
mjoelnir:robb 18.06 16:34:26 [$?==1]#

Maybe the daemon isn't returning a bad exit status?

I tried "ktrace -di mdnsd" but couldn't spot any obvious error. It would
be nice if the error message included the bind address, i mean the port
number.

I'll try a reboot ...

Cheers,
Robb.



Re: recent malloc changes

2023-06-18 Thread Otto Moerbeek
On Sun, Jun 18, 2023 at 03:51:20PM +0200, Theo Buehler wrote:

> > So what's in your malloc options?
> 
> mdnsd -d must have thrown this warning for nearly 7 years. With d, it sets
> 'malloc_options = "AFGJPX";'. You removed A and P end of october 2016.

Sigh should be "S". 

I take care to make sure that S always has the meaning: all flags that
enable extra strict checking or otherwise enhance securiy but cannot
be enabled always for performance reasons. 

All other flag are subject to change.

-Otto



Re: recent malloc changes

2023-06-18 Thread Theo Buehler
> So what's in your malloc options?

mdnsd -d must have thrown this warning for nearly 7 years. With d, it sets
'malloc_options = "AFGJPX";'. You removed A and P end of october 2016.



Re: recent malloc changes

2023-06-18 Thread Otto Moerbeek
On Sun, Jun 18, 2023 at 03:24:17PM +0200, Why 42? The lists account. wrote:

> 
> On Sun, Jun 04, 2023 at 01:03:14PM +0200, Otto Moerbeek wrote:
> > Hello,
> > 
> > In the last few weeks a series of mallocs diff have been committed.
> > The last one today. That one allows malloc to detect more cases of
> > write-after-free. While that is a good thing, it might uncover latent
> > bugs in appliations. 
> > 
> > So if you are running current or snapshots, please keep an eye out for
> > issues reported by malloc. If we get too many reports of issues I
> > might change things so the extra write-after-free detetecion is ony
> > enabled when malloc option S is active.
> 
> Well, I don't know if this related, but I just noticed this:
> mjoelnir:robb 18.06 15:17:30 # rcctl check mdnsd
> mdnsd(failed)
> 
> mjoelnir:robb 18.06 15:17:32 [$?==1]# rcctl restart mdnsd
> mdnsd(ok)
> 
> mjoelnir:robb 18.06 15:17:37 # rcctl check mdnsd
> mdnsd(failed)
> 
> mjoelnir:robb 18.06 15:17:39 [$?==1]# pgrep -l mdnsd
> mjoelnir:robb 18.06 15:18:06 [$?==1]#
> 
> mjoelnir:robb 18.06 15:18:07 [$?==1]# mdnsd -h
> mdnsd: unknown option -- h
> usage: mdnsd [-dw] ifname [ifnames...]
> usage: mdnsd -v
> 
> mjoelnir:robb 18.06 15:18:22 [$?==1]# mdnsd -dv
> malloc() warning: unknown char in MALLOC_OPTIONS
> malloc() warning: unknown char in MALLOC_OPTIONS

So what's in your malloc options?

-Otto

> OpenMdns Daemon 0.7 (2017-03-10)
> Copyright (C) 2010-2014 Christiano F. Haesbaert
> mjoelnir:robb 18.06 15:18:30 #
> 
> mjoelnir:robb 18.06 15:18:33 # pgrep -l mdnsd
> mjoelnir:robb 18.06 15:18:36 [$?==1]# mdnsd -d
> malloc() warning: unknown char in MALLOC_OPTIONS
> malloc() warning: unknown char in MALLOC_OPTIONS
> usage: mdnsd [-dw] ifname [ifnames...]
> usage: mdnsd -v
> 
> This is with a 7.3 snapshot from about a week ago:
> mjoelnir:robb 18.06 15:22:22 # ls -ltr /bsd*
> -rwx--  1 root  wheel  25245701 Jun 11 13:42 /bsd.sp
> -rw---  1 root  wheel   4674809 Jun 11 13:42 /bsd.rd
> -rwx--  1 root  wheel  25364480 Jun 11 13:44 /bsd.booted
> -rwx--  1 root  wheel  25375272 Jun 11 13:56 /bsd
> 
> mjoelnir:robb 18.06 15:21:53 # uname -a
> OpenBSD mjoelnir.fritz.box 7.3 GENERIC.MP#1230 amd64
> 



Re: recent malloc changes

2023-06-18 Thread Why 42? The lists account.


On Sun, Jun 04, 2023 at 01:03:14PM +0200, Otto Moerbeek wrote:
> Hello,
> 
> In the last few weeks a series of mallocs diff have been committed.
> The last one today. That one allows malloc to detect more cases of
> write-after-free. While that is a good thing, it might uncover latent
> bugs in appliations. 
> 
> So if you are running current or snapshots, please keep an eye out for
> issues reported by malloc. If we get too many reports of issues I
> might change things so the extra write-after-free detetecion is ony
> enabled when malloc option S is active.

Well, I don't know if this related, but I just noticed this:
mjoelnir:robb 18.06 15:17:30 # rcctl check mdnsd
mdnsd(failed)

mjoelnir:robb 18.06 15:17:32 [$?==1]# rcctl restart mdnsd
mdnsd(ok)

mjoelnir:robb 18.06 15:17:37 # rcctl check mdnsd
mdnsd(failed)

mjoelnir:robb 18.06 15:17:39 [$?==1]# pgrep -l mdnsd
mjoelnir:robb 18.06 15:18:06 [$?==1]#

mjoelnir:robb 18.06 15:18:07 [$?==1]# mdnsd -h
mdnsd: unknown option -- h
usage: mdnsd [-dw] ifname [ifnames...]
usage: mdnsd -v

mjoelnir:robb 18.06 15:18:22 [$?==1]# mdnsd -dv
malloc() warning: unknown char in MALLOC_OPTIONS
malloc() warning: unknown char in MALLOC_OPTIONS
OpenMdns Daemon 0.7 (2017-03-10)
Copyright (C) 2010-2014 Christiano F. Haesbaert
mjoelnir:robb 18.06 15:18:30 #

mjoelnir:robb 18.06 15:18:33 # pgrep -l mdnsd
mjoelnir:robb 18.06 15:18:36 [$?==1]# mdnsd -d
malloc() warning: unknown char in MALLOC_OPTIONS
malloc() warning: unknown char in MALLOC_OPTIONS
usage: mdnsd [-dw] ifname [ifnames...]
usage: mdnsd -v

This is with a 7.3 snapshot from about a week ago:
mjoelnir:robb 18.06 15:22:22 # ls -ltr /bsd*
-rwx--  1 root  wheel  25245701 Jun 11 13:42 /bsd.sp
-rw---  1 root  wheel   4674809 Jun 11 13:42 /bsd.rd
-rwx--  1 root  wheel  25364480 Jun 11 13:44 /bsd.booted
-rwx--  1 root  wheel  25375272 Jun 11 13:56 /bsd

mjoelnir:robb 18.06 15:21:53 # uname -a
OpenBSD mjoelnir.fritz.box 7.3 GENERIC.MP#1230 amd64



recent malloc changes

2023-06-04 Thread Otto Moerbeek
Hello,

In the last few weeks a series of mallocs diff have been committed.
The last one today. That one allows malloc to detect more cases of
write-after-free. While that is a good thing, it might uncover latent
bugs in appliations. 

So if you are running current or snapshots, please keep an eye out for
issues reported by malloc. If we get too many reports of issues I
might change things so the extra write-after-free detetecion is ony
enabled when malloc option S is active.

-Otto