Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp442155pxj; Tue, 18 May 2021 06:54:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxI5KGSNSQrAdY1M6WofBp3jMk59pkdpd+EI2W9WjaQSfvwesN3T/Rg8IUhL6nyBwaKC7HG X-Received: by 2002:aa7:cd55:: with SMTP id v21mr7426238edw.344.1621346080030; Tue, 18 May 2021 06:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621346080; cv=none; d=google.com; s=arc-20160816; b=euosrBn7BWJrv1bP06W+xJJDF/M0fbbm6shjHBgcRJzuyzaYDPpRVN3Ox76ywXQ/+N 2H1J4lAbtFIF0zuklZ8N+aLKhWf7Jh/Itx9mi4T3m6Ae8jBAC6Czfhw8UNyS9BePKJjN 4hc3oiuYC6zBzbYzBs6uW2kWSZ1k8G0Y3fXRKx8DfmkrNinimAaeohj+dCT26IWYeUJq xH/ieY7sm/47ULw6d2w3wtUpIgUyC07QYvM0ye3v5ociQJTZ/31/D+gelNfW/VqidcoY jpFP6Xaa62AmRbokf6nATJdI66Cuqkr7mgeieaPgY3+hquwPkRtvCe9H6+Z8xvxS0x02 pNig== 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:subject:cc:to :from:dkim-signature; bh=4uyE4MCPN+gvcEQQwHtTaWXSjbgcYiMt2s9QGstOLz8=; b=ivanaKEOuOxGpGgS0Lv9Bv2JKWCyu+Qmibcylq4uGQe9lQvn1sd7qYfsC40WR93jGZ fAIp70A6k8Zd0NtjVeNnXV/saJMgsl5qRRkDAcIzW1CGRsB0MY53vDFdBuU2czT5ZTSN kdMEJ4DDNaZUHJcjStbztWnQNA6HdHZegXe5zap2i7xRpsgvU9/pkbmNSzsk8GBHIrci qmCfvcs/4yCmylzhHfvjGstD6bon4aSS2ZZkl50/j1/eD0hD/hNOs4E2LGtSDFsVL6BF zIImEZbKU12sEg9z2AQZDYFeFRo3Wf1xtHo6mo6KpJdsWXwULUibr/TAGEEuj3JEtuEk eGhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YfPQf+pS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o18si18276272edc.137.2021.05.18.06.54.13; Tue, 18 May 2021 06:54:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=YfPQf+pS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344027AbhEQPkL (ORCPT + 99 others); Mon, 17 May 2021 11:40:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:42054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245196AbhEQPZB (ORCPT ); Mon, 17 May 2021 11:25:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2493661CA4; Mon, 17 May 2021 14:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262162; bh=FUcW9cL+ma8G5ETjp4qp1VieJ8yztM3ooF02ijvjHYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YfPQf+pSkPg8CxFKvJ/s7V1Zfni603c2BZijx0VOMhCWgdGPwkjbBfusWLpIU0MrJ 4RezuKCCWRj8czRg7GsMQzs0x9ZIwT5sQZc1qyIcN7+CQUzRJQbKuiwhq09M+l9i8s tdHe6IlS6nApX9FE+KQ/Um+8HRkpcrQZLt12BabE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Trond Myklebust , Sasha Levin Subject: [PATCH 5.10 124/289] SUNRPC: Remove trace_xprt_transmit_queued Date: Mon, 17 May 2021 16:00:49 +0200 Message-Id: <20210517140309.333795277@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuck Lever [ Upstream commit 6cf23783f750634e10daeede48b0f5f5d64ebf3a ] This tracepoint can crash when dereferencing snd_task because when some transports connect, they put a cookie in that field instead of a pointer to an rpc_task. BUG: KASAN: use-after-free in trace_event_raw_event_xprt_writelock_event+0x141/0x18e [sunrpc] Read of size 2 at addr ffff8881a83bd3a0 by task git/331872 CPU: 11 PID: 331872 Comm: git Tainted: G S 5.12.0-rc2-00007-g3ab6e585a7f9 #1453 Hardware name: Supermicro SYS-6028R-T/X10DRi, BIOS 1.1a 10/16/2015 Call Trace: dump_stack+0x9c/0xcf print_address_description.constprop.0+0x18/0x239 kasan_report+0x174/0x1b0 trace_event_raw_event_xprt_writelock_event+0x141/0x18e [sunrpc] xprt_prepare_transmit+0x8e/0xc1 [sunrpc] call_transmit+0x4d/0xc6 [sunrpc] Fixes: 9ce07ae5eb1d ("SUNRPC: Replace dprintk() call site in xprt_prepare_transmit") Signed-off-by: Chuck Lever Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- include/trace/events/sunrpc.h | 1 - net/sunrpc/xprt.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h index 2a03263b5f9d..23db248a7fdb 100644 --- a/include/trace/events/sunrpc.h +++ b/include/trace/events/sunrpc.h @@ -1141,7 +1141,6 @@ DECLARE_EVENT_CLASS(xprt_writelock_event, DEFINE_WRITELOCK_EVENT(reserve_xprt); DEFINE_WRITELOCK_EVENT(release_xprt); -DEFINE_WRITELOCK_EVENT(transmit_queued); DECLARE_EVENT_CLASS(xprt_cong_event, TP_PROTO( diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 99d07513237e..586bc9d98de1 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -1441,8 +1441,6 @@ bool xprt_prepare_transmit(struct rpc_task *task) struct rpc_xprt *xprt = req->rq_xprt; if (!xprt_lock_write(xprt, task)) { - trace_xprt_transmit_queued(xprt, task); - /* Race breaker: someone may have transmitted us */ if (!test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) rpc_wake_up_queued_task_set_status(&xprt->sending, -- 2.30.2