Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2777420pxb; Mon, 19 Apr 2021 13:45:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn4g7G8OCQAEvlpu44DDwKqQKkfC9VT9FvS+mX9L2SJ/Db4wJtnkKTP38FJkqrRTErj8Kd X-Received: by 2002:a65:6184:: with SMTP id c4mr13512517pgv.200.1618865100699; Mon, 19 Apr 2021 13:45:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618865100; cv=none; d=google.com; s=arc-20160816; b=ASM070ZhPM6PEf2pikX9/fh8abTkJnRTBUs8t35DkzIeZOKt9SjRiiuiLmVct1MMpi VwF1RBuyYWwYJdYeTTaVgdMuj1xGH6+q1sa18gA3eBgbA3N5IkTRw2yBicAZh7lk05ND ZUIzNyN4q2BLd4lNoqjNhkH5gGNjmTC9ux91qsQhWzxlIPGo+2k9KGkYyaQ6SPO2p6KZ jMp6WyXQZNM8btFYV7cFedIwQbMSPoiqeOZUFvwzEEB9TyC9eaikY/EVCm3laCspLjsg XtY+onzowTzKvprYSA9RWcdVfi7is/qnmDHnszErAVOMNukrH2hcrf+OJwpLtVMtgBkM m+Nw== 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; bh=DRQCerGZypeoO6P+AIW0fdGo71808nUsrCcKtj8cZF0=; b=Jn/USY6n1p/ja0eybMwbOt096JbCmZChTF+t2aH5GKZi6vxbrFFHEFwRrn1KOTgTDW aAHY9b+cfsXELN65ivvVOf8gOD/iUZ4Rv4C+1/54VzeVkM99YdzgwmQTAMLWvVqkwxZA I4s20Cu7gk69Fz9C5mz9mRlAikpjoawbNsu6llkPJdHJ38d0Qsl3aZbkJCEPTtFljQp1 CPwu2AW2aRIlsm+3cjXUzs3n//tcSiPRJb0vUp34j4ip+1qQ3cnOFaF+4WsH9JmbTFn2 AWH0U3V3lWYfOLQPJcTrLsYzmN5SG4Nk/oOChrFuy2VTBzaIa/ezHa0K5R1dilVNZXnC W+SA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 15si18575759pfo.147.2021.04.19.13.44.47; Mon, 19 Apr 2021 13:45:00 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240455AbhDSSCW (ORCPT + 99 others); Mon, 19 Apr 2021 14:02:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:40806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240433AbhDSSCW (ORCPT ); Mon, 19 Apr 2021 14:02:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E621861001; Mon, 19 Apr 2021 18:01:51 +0000 (UTC) Subject: [PATCH v3 02/26] SUNRPC: Remove trace_xprt_transmit_queued From: Chuck Lever To: trondmy@hammerspace.com Cc: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 19 Apr 2021 14:01:51 -0400 Message-ID: <161885531111.38598.2643815043255340463.stgit@manet.1015granger.net> In-Reply-To: <161885481568.38598.16682844600209775665.stgit@manet.1015granger.net> References: <161885481568.38598.16682844600209775665.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- 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 036eb1f5c133..2f01314de73a 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 d616b93751d8..11ebe8a127b8 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -1469,8 +1469,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,