Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp420239pxu; Tue, 5 Jan 2021 15:09:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJznOVvWDysejGvsbX3LF3G7gq6CXzS5SIyYN4kEg4wvnjYDlCFgBF5rbeFeJY0/ZRFIVtFI X-Received: by 2002:a17:906:da08:: with SMTP id fi8mr1089507ejb.517.1609888147029; Tue, 05 Jan 2021 15:09:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609888147; cv=none; d=google.com; s=arc-20160816; b=wr3k05QUq8ucjAThQeaDrb9tcY3vYZAlQ7S8ttxr4+AyU9z7TDxQ75qsRdkd2OoApd PcWARLUfS4+IH+ob6cDQ+fQ6lynA6Qe4FFGa9uKi7zyfwLy8qLb8ORtq4j62YCMT/OY4 hPNv/1TfEqCxN7RYcTpJdAKT5Ii7MnxakEddswdm7GogV4z7L6OElR0EGdgisxqEQYVQ ObcSPBjuiyxY4bie/uQ4IxugG/p5saNxMp0n1Na810ayCtEk1tN0L43oEmuEZfSPupT1 NMb46Qb2UU8yxYORCeuO/GqZEXb9Lyacwb+xiSz6kjEj6SKzoxX3aKFaIxDqZWWR4wvx g55g== 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 :message-id:date:subject:to:from:dkim-signature; bh=xAoxDXMsPZj/qMTI5eu+lcfOwwdoSBWw9N6hHhAbBv4=; b=n5vyWHCOB3wblLkjtAMGyXNkonewFGoMJRdv5fD75wTa7U0f2famTXI5we84tdGqqF hQMbGwyHwQzSQQbZEyVUYGWpYO5uxbv1BOf4hpZSs7SoWA076LsYt5PuxA5w7d0DDuLm MP+SSEx+y3Vyop/1IRRezYus5nSqztWBIH1f5U9CsRi6IxoE57FWc8zn8ShBF2zaBZo/ R+Eyd0OhU7t6VTtZc37Njkxk5K1vyvbOvuLMMTKEM4i6ttxNDaficu7VYsZEgS3bK3xJ xPm5YsGNp+F0U3yjlmjO65/KLGJsYrOamKLrwz26j+JYbCLP7lHXjgInhdCeaY2uHe5I U/tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AQl1xbfy; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h17si227469eds.404.2021.01.05.15.08.47; Tue, 05 Jan 2021 15:09:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AQl1xbfy; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731698AbhAEWIE (ORCPT + 99 others); Tue, 5 Jan 2021 17:08:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39559 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731697AbhAEWIE (ORCPT ); Tue, 5 Jan 2021 17:08:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609884397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=xAoxDXMsPZj/qMTI5eu+lcfOwwdoSBWw9N6hHhAbBv4=; b=AQl1xbfy8DbZiJhNZPuAn5XVfYHgNUv1ES1A7a1euEXYnO6sMOYWkFz6C4Y7qHuCawcOfm WQPk8GqW9EwzrcdoujgMtY7Y/YutPdo8k/7s8RTVcTxIrjY3sTDqfdecxHl3nGVwG5DIYw YUmcb4LSydMGBV3xADOAB+UyUEvF1Fc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-329-cCeW_ydFPlm8WKZWhnIJUQ-1; Tue, 05 Jan 2021 17:06:35 -0500 X-MC-Unique: cCeW_ydFPlm8WKZWhnIJUQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C35CC59 for ; Tue, 5 Jan 2021 22:06:34 +0000 (UTC) Received: from f31-node1.dwysocha.net (dhcp145-42.rdu.redhat.com [10.13.145.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F13C271A9 for ; Tue, 5 Jan 2021 22:06:34 +0000 (UTC) From: Dave Wysochanski To: linux-nfs@vger.kernel.org Subject: [PATCH 0/2] Fix crash in trace_rpcgss_context due to 0-length acceptor Date: Tue, 5 Jan 2021 17:06:32 -0500 Message-Id: <20210105220634.27910-1-dwysocha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This small patchset fixes a kernel crash when the rpcgss_context trace event is enabled and IO is in flight when a kerberos ticket expires. The crash occurs because the acceptor name may be 0 bytes long and the gss_fill_context() function does not handle it properly. This causes the ctx->gc_acceptor.data to be ZERO_SIZE_PTR which is not properly recognized by the tracepoint code. The first patch is a simple refactor and eliminates duplicate helper functions related to the crash. The second patch is the actual fix inside one of the helper functions due to the definition of an opaque XDR object. This object is defined in RFC 4506 (see section 4.10), where 'length' is an integer in a range including 0. Reproducer # Enable the tracepoint and mount the share trace-cmd start -e rpcgss:* mount -osec=krb5 nfs-server:/export /mnt/nfs # Obtain a kerberos ticket # Set ticket lifetime to something small like 20 seconds su test -c "kinit -l 20 test" # Sleep for a portion of the ticket lifetime so we are writing while the ticket expires sleep 10 # Now run some IO long enough that the ticket expires midway dd if=/dev/urandom of=/mnt/nfs/file bs=1M count=100 Dave Wysochanski (2): SUNRPC: Move simple_get_bytes and simple_get_netobj into xdr.h SUNRPC: Handle 0 length opaque XDR object data properly include/linux/sunrpc/xdr.h | 33 +++++++++++++++++++++++++++-- net/sunrpc/auth_gss/auth_gss.c | 29 ------------------------- net/sunrpc/auth_gss/gss_krb5_mech.c | 29 ------------------------- 3 files changed, 31 insertions(+), 60 deletions(-) -- 2.25.2