lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20231223163612.GG201037@kernel.org> Date: Sat, 23 Dec 2023 16:36:12 +0000 From: Simon Horman <horms@...nel.org> To: David Howells <dhowells@...hat.com> Cc: Markus Suvanto <markus.suvanto@...il.com>, Marc Dionne <marc.dionne@...istor.com>, linux-afs@...ts.infradead.org, keyrings@...r.kernel.org, linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org, Wang Lei <wang840925@...il.com>, Jeff Layton <jlayton@...hat.com>, Steve French <sfrench@...ibm.com>, Jarkko Sakkinen <jarkko@...nel.org>, "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, linux-cifs@...r.kernel.org, linux-nfs@...r.kernel.org, ceph-devel@...r.kernel.org, netdev@...r.kernel.org, Edward Adam Davis <eadavis@...com> Subject: Re: [PATCH v4 3/3] keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry + Edward Adam Davis On Thu, Dec 21, 2023 at 01:45:30PM +0000, David Howells wrote: > If a key has an expiration time, then when that time passes, the key is > left around for a certain amount of time before being collected (5 mins by > default) so that EKEYEXPIRED can be returned instead of ENOKEY. This is a > problem for DNS keys because we want to redo the DNS lookup immediately at > that point. > > Fix this by allowing key types to be marked such that keys of that type > don't have this extra period, but are reclaimed as soon as they expire and > turn this on for dns_resolver-type keys. To make this easier to handle, > key->expiry is changed to be permanent if TIME64_MAX rather than 0. > > Furthermore, give such new-style negative DNS results a 1s default expiry > if no other expiry time is set rather than allowing it to stick around > indefinitely. This shouldn't be zero as ls will follow a failing stat call > immediately with a second with AT_SYMLINK_NOFOLLOW added. > > Fixes: 1a4240f4764a ("DNS: Separate out CIFS DNS Resolver code") > Signed-off-by: David Howells <dhowells@...hat.com> > Tested-by: Markus Suvanto <markus.suvanto@...il.com> ... > diff --git a/net/dns_resolver/dns_key.c b/net/dns_resolver/dns_key.c > index 01e54b46ae0b..2a6d363763a2 100644 > --- a/net/dns_resolver/dns_key.c > +++ b/net/dns_resolver/dns_key.c > @@ -91,6 +91,7 @@ const struct cred *dns_resolver_cache; > static int > dns_resolver_preparse(struct key_preparsed_payload *prep) > { > + const struct dns_server_list_v1_header *v1; > const struct dns_payload_header *bin; > struct user_key_payload *upayload; > unsigned long derrno; > @@ -122,6 +123,13 @@ dns_resolver_preparse(struct key_preparsed_payload *prep) > return -EINVAL; > } > > + v1 = (const struct dns_server_list_v1_header *)bin; > + if ((v1->status != DNS_LOOKUP_GOOD && > + v1->status != DNS_LOOKUP_GOOD_WITH_BAD)) { > + if (prep->expiry == TIME64_MAX) > + prep->expiry = ktime_get_real_seconds() + 1; > + } > + > result_len = datalen; > goto store_result; > } Hi David, As has been pointed out by Edward Adam Davis, this may result in a buffer overrun. Just above this hunk the following length check occurs: if (datalen <= sizeof(*bin)) return -EINVAL; But the new code above reads beyond the end of sizeof(*bin). Link: https://lore.kernel.org/netdev/tencent_7D663C8936BA96F837124A4474AF76ED6709@qq.com/ ...
Powered by blists - more mailing lists