[PATCH] some NULL checks before free(3)

2020-04-07 Thread Geoff Hill
Ran a grep to find unneccessary NULL checks before free(3) and found some in dhclient(8) and makefs(8). Geoff Hill Index: sbin/dhclient/dhclient.c === RCS file: /cvs/src/sbin/dhclient/dhclient.c,v retrieving revision 1.659 diff -u

Re: bug: fifo kqfilter & FREAD|FWRITE

2020-04-07 Thread Todd C . Miller
On Tue, 07 Apr 2020 12:42:06 +0200, Martin Pieuchot wrote: > fifo_poll() honors FREAD and FWRITE. It doesn't return events > incompatible with the open flags. Diff below makes the kqfilters > behave like that as well. Looks good to me. Is there any reason you put "int a_fflag" in the middle

Re: fifo kqueue bug

2020-04-07 Thread Todd C . Miller
On Tue, 07 Apr 2020 12:08:35 +0200, Martin Pieuchot wrote: > The write socket should be passed to the write filter otherwise checks > are performed against the wrong socket. OK millert@ - todd

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Vitaliy Makkoveev
> On 7 Apr 2020, at 17:43, Martin Pieuchot wrote: > > On 07/04/20(Tue) 17:14, Vitaliy Makkoveev wrote: >> As Claudio Jeker noticed, NET_LOCK() can release KERNEL_LOCK(). pppx(4) >> code has some NET_LOCK() dances which make it unsafe. [...] > > The easiest way to fix that is to move

Re: FW: Add mprotect_ept ioctl to vmm(4)

2020-04-07 Thread Pratik Vyas
* Adam Steen [2020-04-07 08:18:19 +]: On Fri, Feb 07, 2020 at 01:25:38PM -0800, Mike Larkin wrote: > On Fri, Feb 07, 2020 at 04:20:16AM +, Adam Steen wrote: > > Hi > > > > Please see the attached patch to add an 'IOCTL handler to sets the access > > protections of the ept' > > > >

Re: Include /var/www/tmp into base install

2020-04-07 Thread Stefan Sperling
On Tue, Apr 07, 2020 at 06:13:12PM +0200, Stefan Sperling wrote: > For temp stuff we really need a separate space that can just be wiped > without consequences when it has run full. The way Got internally provides access to files in /tmp for every helper process is to pass one or more open file

Re: Include /var/www/tmp into base install

2020-04-07 Thread Andrew Grillet
For me, the "/var is full" problem can be adequately mitigated by mounting a separate partition as /var/tmp. More of an issue, although obviously not major - if there are a large number of tmp directories, is making sure that they are all routinely purged. Yes, I know this is down to careless

Re: Include /var/www/tmp into base install

2020-04-07 Thread Stefan Sperling
On Tue, Apr 07, 2020 at 05:05:08PM +0100, Stuart Henderson wrote: > On 2020/04/07 18:01, Stefan Sperling wrote: > > Yes, absolutely correct. Logs or tempfiles filling up /var are a problem, > > and in the gotweb application Tracey and I created it is indeed possible > > for requests to trigger

Re: Include /var/www/tmp into base install

2020-04-07 Thread Theo de Raadt
Stuart Henderson wrote: > On 2020/04/07 18:01, Stefan Sperling wrote: > > On Tue, Apr 07, 2020 at 09:51:15AM -0600, Theo de Raadt wrote: > > > Stefan Sperling wrote: > > > > > > > On Tue, Apr 07, 2020 at 09:37:02AM -0600, Theo de Raadt wrote: > > > > > > The idea was to have /var/www/tmp

Re: Include /var/www/tmp into base install

2020-04-07 Thread Theo de Raadt
Stefan Sperling wrote: > > A smaller secondary concern is if you can convince software using this > > space, > > from remote, to hog the space too much, and/or lose track of files in there. > > Which would also create the fallout problems of "/var is full". > > > > It's a matter of how other

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Vitaliy Makkoveev
On Tue, Apr 07, 2020 at 06:38:11PM +0300, Vitaliy Makkoveev wrote: > On Tue, Apr 07, 2020 at 04:43:55PM +0200, Martin Pieuchot wrote: > > On 07/04/20(Tue) 17:14, Vitaliy Makkoveev wrote: > > > As Claudio Jeker noticed, NET_LOCK() can release KERNEL_LOCK(). pppx(4) > > > code has some NET_LOCK()

Re: Include /var/www/tmp into base install

2020-04-07 Thread Stuart Henderson
On 2020/04/07 18:01, Stefan Sperling wrote: > On Tue, Apr 07, 2020 at 09:51:15AM -0600, Theo de Raadt wrote: > > Stefan Sperling wrote: > > > > > On Tue, Apr 07, 2020 at 09:37:02AM -0600, Theo de Raadt wrote: > > > > > The idea was to have /var/www/tmp created by default, but with > > > > >

Re: Include /var/www/tmp into base install

2020-04-07 Thread Stefan Sperling
On Tue, Apr 07, 2020 at 09:51:15AM -0600, Theo de Raadt wrote: > Stefan Sperling wrote: > > > On Tue, Apr 07, 2020 at 09:37:02AM -0600, Theo de Raadt wrote: > > > > The idea was to have /var/www/tmp created by default, but with > > > > www:www ownership. > > > > > Create the directory. Now as

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Vitaliy Makkoveev
On Tue, Apr 07, 2020 at 04:43:55PM +0200, Martin Pieuchot wrote: > On 07/04/20(Tue) 17:14, Vitaliy Makkoveev wrote: > > As Claudio Jeker noticed, NET_LOCK() can release KERNEL_LOCK(). pppx(4) > > code has some NET_LOCK() dances which make it unsafe. [...] > > The easiest way to fix that is to

Re: fix wifi media: line during background scan

2020-04-07 Thread Paul Irofti
On Tue, Apr 07, 2020 at 01:42:48PM +0200, Stefan Sperling wrote: > I've noticed that wireless interfaces in 11n mode show a "media:" line > in ifconfig such as this while a background scan is in progress: > > media: IEEE802.11 autoselect (OFDM6) > > What is expected is a line showing active 11n

Re: Include /var/www/tmp into base install

2020-04-07 Thread Theo de Raadt
Stefan Sperling wrote: > On Tue, Apr 07, 2020 at 09:37:02AM -0600, Theo de Raadt wrote: > > > The idea was to have /var/www/tmp created by default, but with > > > www:www ownership. > > > Create the directory. Now as a user, completely fill it. > > The proposal is to create tmp with www:www

Re: Include /var/www/tmp into base install

2020-04-07 Thread Stefan Sperling
On Tue, Apr 07, 2020 at 09:37:02AM -0600, Theo de Raadt wrote: > > The idea was to have /var/www/tmp created by default, but with > > www:www ownership. > Create the directory. Now as a user, completely fill it. The proposal is to create tmp with www:www ownership, writable only for that user,

Re: Include /var/www/tmp into base install

2020-04-07 Thread Theo de Raadt
Stuart Henderson wrote: > On 2020/04/07 09:01, Theo de Raadt wrote: > > This is horrible, as a user can fill the /var filesystem. > > they already can with /var/www/logs. On my machines not running this software, they cannot cause any effect on that directory. The software utilization of 1%

Re: Include /var/www/tmp into base install

2020-04-07 Thread Theo de Raadt
Tracey Emery wrote: > On Tue, Apr 07, 2020 at 11:17:23AM -0400, Bryan Steele wrote: > > On Tue, Apr 07, 2020 at 04:56:31PM +0200, Martijn van Duren wrote: > > > This came up during u2k20 while discussing tempfiles for gotweb inside a > > > chroot. At the moment we don't include it by default and

Re: Include /var/www/tmp into base install

2020-04-07 Thread Stuart Henderson
On 2020/04/07 09:01, Theo de Raadt wrote: > This is horrible, as a user can fill the /var filesystem. they already can with /var/www/logs. On 2020/04/07 11:17, Bryan Steele wrote: > WIth FastCGI, perhaps I'm confused, but why do web applications need to > be inside the /var/www chroot? Can't

Re: Include /var/www/tmp into base install

2020-04-07 Thread Tracey Emery
On Tue, Apr 07, 2020 at 11:17:23AM -0400, Bryan Steele wrote: > On Tue, Apr 07, 2020 at 04:56:31PM +0200, Martijn van Duren wrote: > > This came up during u2k20 while discussing tempfiles for gotweb inside a > > chroot. At the moment we don't include it by default and ports have to > > create it

Re: Include /var/www/tmp into base install

2020-04-07 Thread Bryan Steele
On Tue, Apr 07, 2020 at 04:56:31PM +0200, Martijn van Duren wrote: > This came up during u2k20 while discussing tempfiles for gotweb inside a > chroot. At the moment we don't include it by default and ports have to > create it themselves. Since I assume we want web applications to run > inside a

Re: Include /var/www/tmp into base install

2020-04-07 Thread Theo de Raadt
This is horrible, as a user can fill the /var filesystem. That is why we got rid of /var/tmp before, and tried to reduce the risk on /tmp. Now you want to bring the problem back. Martijn van Duren wrote: > This came up during u2k20 while discussing tempfiles for gotweb inside a > chroot. At

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Vitaliy Makkoveev
Forgot to release lock in pppx_del_session() error case... Index: sys/net/if_pppx.c === RCS file: /cvs/src/sys/net/if_pppx.c,v retrieving revision 1.81 diff -u -p -r1.81 if_pppx.c --- sys/net/if_pppx.c 7 Apr 2020 07:11:22 -

Include /var/www/tmp into base install

2020-04-07 Thread Martijn van Duren
This came up during u2k20 while discussing tempfiles for gotweb inside a chroot. At the moment we don't include it by default and ports have to create it themselves. Since I assume we want web applications to run inside a /var/www chroot as much as possible and even some libc functions depend on

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Martin Pieuchot
On 07/04/20(Tue) 17:14, Vitaliy Makkoveev wrote: > As Claudio Jeker noticed, NET_LOCK() can release KERNEL_LOCK(). pppx(4) > code has some NET_LOCK() dances which make it unsafe. [...] The easiest way to fix that is to move if_detach() out of pppx_if_destroy(). It generally makes sense to call

pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Vitaliy Makkoveev
As Claudio Jeker noticed, NET_LOCK() can release KERNEL_LOCK(). pppx(4) code has some NET_LOCK() dances which make it unsafe. Concurent thread can receive CPU and enter to pppx_if_destroy() while we dance with NET_LOCK(). The idea is to deny access to pxi at destruction stage. If pxi_if is removed

[PATCH 0/5] gost: add support for magma and kuznyechik ciphers

2020-04-07 Thread Dmitry Baryshkov
Russian standards body has issues a standard GOST R 34.12-2015 defining two block ciphers: magma and kuznyechik. English descriptions of these ciphers are defined in draft-dolmatov-magma (in RFC editor queue) and RFC 7801 respectively. These patches add support for basic constructions using these

[PATCH 1/5] modes: add functions implementing common code for 64-bit ciphers

2020-04-07 Thread Dmitry Baryshkov
64-bit ciphers are old, but it would be good to use common code for their implementations. Signed-off-by: Dmitry Baryshkov --- src/lib/libcrypto/modes/cbc64.c | 202 src/lib/libcrypto/modes/cfb64.c | 169 ++

[PATCH 3/5] gost: use key_meshing for specifying section size

2020-04-07 Thread Dmitry Baryshkov
In preparation to adding ACPKM support, switch key_meshing to be a section size rather than just a flag. Signed-off-by: Dmitry Baryshkov --- src/lib/libcrypto/gost/gost.h | 2 +- src/lib/libcrypto/gost/gost2814789.c | 8 src/lib/libcrypto/gost/gost89_params.c | 2 +- 3 files

[PATCH 2/5] gost: drop key_len from Gost28147_set_key

2020-04-07 Thread Dmitry Baryshkov
There is no point in specifying key length to Gost28147_set_key, everybody just passes 256 (or 32 * 8) no matter what. Signed-off-by: Dmitry Baryshkov --- src/lib/libcrypto/evp/e_gost2814789.c | 4 +++- src/lib/libcrypto/evp/m_gost2814789.c | 3 ++- src/lib/libcrypto/gost/gost.h

[PATCH 4/5] gost: add support for magma cipher

2020-04-07 Thread Dmitry Baryshkov
GOST R 34.12-2015 defines Magma cipher (a variant of GOST 28147-89 with fixed S-BOX and endianness change), see draft-dolmatov-magma. Sponsored by ROSA Linux Signed-off-by: Dmitry Baryshkov --- src/lib/libcrypto/Symbols.list | 5 + src/lib/libcrypto/evp/c_all.c | 5

[PATCH 3/3] pkcs12: add support for GOST PFX files

2020-04-07 Thread Dmitry Baryshkov
Russian standard body has changed the way MAC key is calculated for PKCS12 files. Generate proper keys depending on the digest type used for MAC generation. Sponsored by ROSA Linux Signed-off-by: Dmitry Baryshkov --- src/lib/libcrypto/pkcs12/p12_key.c | 18 ++

[PATCH 1/3] Add OIDs for GOST R 34.11-2012 HMAC functions

2020-04-07 Thread Dmitry Baryshkov
Add OIDs for HMAC using Streebog (GOST R 34.11-2012) hash function. Sponsored by ROSA Linux Signed-off-by: Dmitry Baryshkov --- src/lib/libcrypto/objects/obj_mac.num | 2 ++ src/lib/libcrypto/objects/objects.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git

[PATCH 2/3] Populate PBE table with GOST R 34.11-2012 HMAC ids

2020-04-07 Thread Dmitry Baryshkov
Allow using GOST R 34.11-2012 in PBE/PBKDF2/PKCS#5. Sponsored by ROSA Linux Signed-off-by: Dmitry Baryshkov --- src/lib/libcrypto/evp/evp_pbe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c index

Re: pppx(4): kill forgotten splx(9) stuff

2020-04-07 Thread Vitaliy Makkoveev
On Tue, Apr 07, 2020 at 01:51:45PM +0300, Vitaliy Makkoveev wrote: > On Tue, Apr 07, 2020 at 11:54:01AM +0200, Claudio Jeker wrote: > > Unsure about this one here. I would prefer if the panic remained for now > > (mainly because of the XXXSMP NET_UNLOCK() dance just above). I wonder if > > the >

fix wifi media: line during background scan

2020-04-07 Thread Stefan Sperling
I've noticed that wireless interfaces in 11n mode show a "media:" line in ifconfig such as this while a background scan is in progress: media: IEEE802.11 autoselect (OFDM6) What is expected is a line showing active 11n mode, such as: media: IEEE802.11 autoselect (HT-MCS0 mode 11n) This

Re: pppx(4): kill forgotten splx(9) stuff

2020-04-07 Thread Vitaliy Makkoveev
On Tue, Apr 07, 2020 at 11:54:01AM +0200, Claudio Jeker wrote: > Unsure about this one here. I would prefer if the panic remained for now > (mainly because of the XXXSMP NET_UNLOCK() dance just above). I wonder if the > order of this could not be modified so that the NET_LOCK is released after >

bug: fifo kqfilter & FREAD|FWRITE

2020-04-07 Thread Martin Pieuchot
fifo_poll() honors FREAD and FWRITE. It doesn't return events incompatible with the open flags. Diff below makes the kqfilters behave like that as well. ok? Index: kern/tty_tty.c === RCS file: /cvs/src/sys/kern/tty_tty.c,v

fifo kqueue bug

2020-04-07 Thread Martin Pieuchot
The write socket should be passed to the write filter otherwise checks are performed against the wrong socket. ok? Index: miscfs/fifofs/fifo_vnops.c === RCS file: /cvs/src/sys/miscfs/fifofs/fifo_vnops.c,v retrieving revision 1.73

Re: pppx(4): kill forgotten splx(9) stuff

2020-04-07 Thread Claudio Jeker
On Tue, Apr 07, 2020 at 12:36:29PM +0300, Vitaliy Makkoveev wrote: > pppx_if containing tree and per pppx_dev list are protected by rwlock so > these splx(9) related dances and commentaries are not actual. > Also pxd_svcq protected by NET_LOCK(). > > Index: sys/net/if_pppx.c >

pppx(4): kill forgotten splx(9) stuff

2020-04-07 Thread Vitaliy Makkoveev
pppx_if containing tree and per pppx_dev list are protected by rwlock so these splx(9) related dances and commentaries are not actual. Also pxd_svcq protected by NET_LOCK(). Index: sys/net/if_pppx.c === RCS file:

Re: iked(8): simplify data in sc_sock4 and sc_sock6

2020-04-07 Thread Tobias Heider
Hi, thank you, most of this diff looks good to me. I left some comments inline. On Sun, Apr 05, 2020 at 01:58:04AM +0900, Wataru Ashihara wrote: > The data wich sc_sock4 has is a little bit complicated: > > >

FW: Add mprotect_ept ioctl to vmm(4)

2020-04-07 Thread Adam Steen
> On Fri, Feb 07, 2020 at 01:25:38PM -0800, Mike Larkin wrote: > > On Fri, Feb 07, 2020 at 04:20:16AM +, Adam Steen wrote: > > > Hi > > > > > > Please see the attached patch to add an 'IOCTL handler to sets the access > > > protections of the ept' > > > > > > vmd(8) does not make use of this

Re: pipex(4) fix: check session existence before creation

2020-04-07 Thread YASUOKA Masahiko
ok yasuoka On Mon, 6 Apr 2020 19:54:20 +0300 Vitaliy Makkoveev wrote: > Deny to create pipex_session which is already exist. Newly created > session will be placed to list head so the caller of > pipex_*_lookup_session() will receive wrong session. > > Index: sys/net/if_pppx.c >