From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2957EC6FD1C for ; Tue, 14 Mar 2023 11:08:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230520AbjCNLIS (ORCPT ); Tue, 14 Mar 2023 07:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230450AbjCNLIE (ORCPT ); Tue, 14 Mar 2023 07:08:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3CC4911FC for ; Tue, 14 Mar 2023 04:07:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6C9861718 for ; Tue, 14 Mar 2023 11:07:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE98AC433D2; Tue, 14 Mar 2023 11:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678792051; bh=tUteAbpXh1Jkxij7yMkG8qg/HuzbcNHqmBVbzp/JnKY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QtfwLekHZs8ZyQgh7rULUMf0G7M8SNunItNAJfCpUYVmKFLOnZ2LATLE90AAWvZQf fb2J6oNmL6doYIIB7ZyHdYJ2WFC+Mi8rI1rvMKrtGAwMHi4Y08RHVSGM5DBcPMu9XK 2OE+nYKtdUACvDZ3s/b9LSd6NGGzj/0mbaGPVyOSRvf08qEIkdANaBp2uv75iGLpIN /e18TMVmor4OerTo/n97WhTwnY6+tiYBzpsWaWlsdS9+G/0OC9kunHpfyVmAiNp1QK dsTz8Fq+iwyAQq7FsGQP2apzI1lk0sNLDpfIn1zeFa6tIOiJ8ev0AXUrYKI12d8cAk 8JINqlMUteLmQ== Date: Tue, 14 Mar 2023 13:07:13 +0200 From: Jarkko Sakkinen To: Bharath SM Cc: David Howells , keyrings@vger.kernel.org, Bharath S M , Shyam Prasad N , Steve French Subject: Re: [PATCH] KEYS: Do not cache key in task struct if key is requested from kernel thread Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org On Mon, Mar 13, 2023 at 10:48:29AM +0530, Bharath SM wrote: > Linux kernel cifs module uses dns_resolver for dns resolution and > dns_resolver will use kernel keys infrastructure for key management. > Cifs module calls dns_query during reconnect for dns resolution, we noticed > an issue with dns resolution requests during reconnect operations from cifs. > Where the dns_query was failing by returning EKEYEXPIRED to cifs. And > this issue was > happening only when CONFIG_KEYS_REQUEST_CACHE was enabled. > Further debugging the keys subsystem and discussing with david howells revealed > this issue in keys subsystem. > > To reproduce the issue mount a few SMB shares on device with > nosharesock mount option and try disconnecting connections a few times > using "ss -K src dport 445". > > Logs from dns_resolver: > Notice that 2nd time, we can see dns_query returning -127(EKEYEXPIRED) > > Disconnected first time and got right response for dns_query: > > [Mon Mar 13 05:05:23 2023] [cifsd ] ==> > dns_query((null),storagesouthcus1.file.core.windows.net,38,(null)) > [Mon Mar 13 05:05:23 2023] [cifsd ] call > request_key(,storagesouthcus1.file.core.windows.net,) > [Mon Mar 13 05:05:23 2023] [cifsd ] ==> > dns_query((null),storagesouthcus1.file.core.windows.net,38,(null)) > [Mon Mar 13 05:05:23 2023] [cifsd ] call > request_key(,storagesouthcus1.file.core.windows.net,) > [Mon Mar 13 05:05:23 2023] [cifsd ] ==> > dns_resolver_cmp(storagesouthcus1.file.core.windows.net,storagesouthcus1.file.core.windows.net) > [Mon Mar 13 05:05:23 2023] [cifsd ] <== dns_resolver_cmp() = 1 > [Mon Mar 13 05:05:23 2023] [key.dn] ==> dns_resolver_preparse(' > 20.150.20.136',14) > [Mon Mar 13 05:05:23 2023] [key.dn] no options > [Mon Mar 13 05:05:23 2023] [key.dn] store result > [Mon Mar 13 05:05:23 2023] [key.dn] <== dns_resolver_preparse() = 0 > [Mon Mar 13 05:05:23 2023] [cifsd ] <== dns_query() = 13 > [Mon Mar 13 05:05:23 2023] [cifsd ] <== dns_query() = 13 > > Disconnected second time, but this time we can see one of the > dns_query request is failing with -127 > > [Mon Mar 13 05:05:30 2023] [cifsd ] ==> > dns_query((null),storagesouthcus1.file.core.windows.net,38,(null)) > [Mon Mar 13 05:05:30 2023] [cifsd ] call > request_key(,storagesouthcus1.file.core.windows.net,) > [Mon Mar 13 05:05:30 2023] [cifsd ] ==> > dns_query((null),storagesouthcus1.file.core.windows.net,38,(null)) > [Mon Mar 13 05:05:30 2023] [cifsd ] call > request_key(,storagesouthcus1.file.core.windows.net,) > [Mon Mar 13 05:05:30 2023] [cifsd ] ==> > dns_resolver_cmp(storagesouthcus1.file.core.windows.net,storagesouthcus1.file.core.windows.net) > [Mon Mar 13 05:05:30 2023] [cifsd ] <== dns_resolver_cmp() = 1 > [Mon Mar 13 05:05:30 2023] [cifsd ] <== dns_query() = -127 > [Mon Mar 13 05:05:30 2023] [key.dn] ==> dns_resolver_preparse(' > 20.150.20.136',14) > [Mon Mar 13 05:05:30 2023] [key.dn] no options > [Mon Mar 13 05:05:30 2023] [key.dn] store result > [Mon Mar 13 05:05:30 2023] [key.dn] <== dns_resolver_preparse() = 0 > [Mon Mar 13 05:05:30 2023] [cifsd ] <== dns_query() = 13 Please summarize this to the commit message it is useful stuff. With this report included the patch could should also have a fixes tag. BR, Jarkko