Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2112081rwb; Sun, 15 Jan 2023 09:21:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXtJLCibTmLmd8P0VGLPUhT/WPYKQZkf8djSqn/J//HvgCr/b4xf5hjGZDQ0/YmbFc6KsbQd X-Received: by 2002:a05:6a21:3985:b0:b8:4c09:9df8 with SMTP id ad5-20020a056a21398500b000b84c099df8mr5509629pzc.22.1673803305453; Sun, 15 Jan 2023 09:21:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673803305; cv=none; d=google.com; s=arc-20160816; b=oHdpefSwyhWAMT88ekCj9hfezZPsup+my0qHKgKWrumQ8ZOxdSz9d998b4R/Udd06R xCMVnFgxoqCsZaHrwrwEShJEgRN5LyMj4wvAXWuAlxLPWcIYK+refbIJvKS9wmGfhKMP 80/SezS1xkXO901yPtutV41/8MAytSnqeD50J1LpHL6Sp34yCiIPY0hSMAzgj8ZPd0Cw L3+4ZhufBkwwA90YAeHKzLrIbYj8d/2jGMG0FH1w9M5qvYxJqh5xwbiVa4zmzA5eeBUP KS6uVVB+shxxAqnIZNCONkTohsO+CgyMiEeSblD7zurojgUd9sdDJ0LWx03XyAShmX4W 4BgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=VHHvic4OZu9mFcZIyA2F7LYeKmDJivoivmwwgAc78zc=; b=QHaYyApl6JaglEeXDbU2mbi54DdUi5QN7o9lVhk6DCKKjc9Tcgjm+gEBzo4FaV8VDQ KMWJ48x+zC1VFuTjIEhGWzBYaD2seOjKDr4dghk03L9PYuTRf/P9vj7lFc96Scf0Gwkw 7EPLxKrNnOqCkb+d+BiHx3scY2UFwKVcx43Q4iRPW6FxhkRN23cfqRXE5fIJ56uWbJka VnLfOi3VMsnlwcQyxq7WkSvmzUAfmKmiSLFTmMkjh3XdwgiJWCVcVVej+tv6PAKS18G+ JRg2yy3P6moGz1igjbhyoGN4cImvvxIWSwCcZfO8Csta9o9dm0zokvwE/v7IjlMct4wi jz9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="W5KxyYQ/"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020a635609000000b0046ae2a8ea9csi27380503pgb.733.2023.01.15.09.21.34; Sun, 15 Jan 2023 09:21:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="W5KxyYQ/"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231362AbjAORUx (ORCPT + 99 others); Sun, 15 Jan 2023 12:20:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230307AbjAORUw (ORCPT ); Sun, 15 Jan 2023 12:20:52 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25CD51041B; Sun, 15 Jan 2023 09:20:52 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id BE314B80B8A; Sun, 15 Jan 2023 17:20:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31592C433D2; Sun, 15 Jan 2023 17:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673803249; bh=iLOk2mzfLDhDe6T0N8hVevoNtHYi7+53BiAPbvsoYlk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=W5KxyYQ//anO7q2w8ZBJjprE1pFv6Kdb6EpkUkXiFsExfCs+3DpXCe5E+Io/hlIPJ Kq32LvQB2GYdHuFaQLtN2bmBo9TRx58rVSwBAWlCxtKP7b9bfqLtGC5HwMdCEZDlS7 K2bLLcP4pAVfM5QbdTlvIROyPHJnOSNzTFLm9ecUEoiEeavWcKk1zHq0Ov3+XwK2WE IeW7FhNkwSSXxDwrkVItsDhdMRq356phnYSo9TmBqHk3s9HsFPYffanJj4ghCpT59i 7QN0+ySO8p9gJT1c6gYM/6giiP9E3XoDDOp9DEzleAsl2LXaUwU/20n/3P2I6Qrci+ IXL7VOe5ls3tA== Subject: [PATCH v2 05/41] SUNRPC: Obscure Kerberos session key From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: dhowells@redhat.com, simo@redhat.com, linux-kselftest@vger.kernel.org Date: Sun, 15 Jan 2023 12:20:48 -0500 Message-ID: <167380324809.10651.4282783020942642184.stgit@bazille.1015granger.net> In-Reply-To: <167380196429.10651.4103075913257868035.stgit@bazille.1015granger.net> References: <167380196429.10651.4103075913257868035.stgit@bazille.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Chuck Lever ctx->Ksess is never used after import has completed. Obscure it immediately so it cannot be re-used or copied. Tested-by: Scott Mayhew Signed-off-by: Chuck Lever --- net/sunrpc/auth_gss/gss_krb5_mech.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c index 76a0d83fe500..b982c9d495f2 100644 --- a/net/sunrpc/auth_gss/gss_krb5_mech.c +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c @@ -550,6 +550,7 @@ gss_import_sec_context_kerberos(const void *p, size_t len, ret = gss_import_v1_context(p, end, ctx); else ret = gss_import_v2_context(p, end, ctx, gfp_mask); + memzero_explicit(&ctx->Ksess, sizeof(ctx->Ksess)); if (ret) { kfree(ctx); return ret;