Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp137737lqm; Tue, 30 Apr 2024 15:50:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV+JNPodhvDQdwqqfLccyoK1bloJePb3Vhk2JnRUb5jgeFoOoJm/ep1csyxU61+39V9h618f0ghD+HzjMrtqfhheS1VDSvbc4uACOwKuA== X-Google-Smtp-Source: AGHT+IHOWGSx1PVakAHDYwpKAU+6R3fGdFKhlPmXh/n6a4+3DOVNyiAW/J7Wpwh3euMVOYBXBXSC X-Received: by 2002:a17:903:1212:b0:1e8:b7fc:7f85 with SMTP id l18-20020a170903121200b001e8b7fc7f85mr967003plh.31.1714517421039; Tue, 30 Apr 2024 15:50:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714517421; cv=pass; d=google.com; s=arc-20160816; b=Vp9zqDUPheL0mJkBrNxbykLngseZLwK1caWc3RxuqKJHz2EywlJ0waC8IyPTjglryV Fzzhq1khrZ6ItffYEv546o34RFB/jXSMlCVno9A3z5SmXkmAqEi/M++RQjILIUFM6MkR fsD+wVvK19s9yJx94Ffzcynef/qb3YHr2x/JtU7U5TfUT6bAoxBKB+8H4NdzVrEbLS/m IoVhvODC583zk+QTnkLYW53BW4lGagxFL/9+ted+btH9dL1w0Rj8gcodvij0nnSza16L +pSvTxf4ulU+sxjbbSXE17IN00dF7GUrhiqfp+sGDtRwLcK9zs9Evr1FdZJSE4AgKU3O AaUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=PKP0T5JCt6ROoRM1uYcHmOOsoBsqYfOcV74GeHAWhWA=; fh=BoQqT2m/IeuHEyoaT1kPZlqyoykul3L+h8jesBk5Wt0=; b=SufrLh+aDbTITP52ODgWJozc8BsQoc/ZQJQds+TqfnNG5xom1hdKbM1rTIdqVMJvPa cUCCk+PdtSArVczVgqQ6gcDAYyMGftbZy7VitNY0uaPyksZ4qvmqqu1kuObLgSFmzhM3 yev2cGgAHYkkqcaBzlyK+rFFGDRxP7xIcwf/2/xC/QmsjDHiXbpQKcxBOT7E2ttFNWQ0 jsenK7GhMdclngseqUDzPCveJCBkIPIVrLCvCK4X+tcuoLRmCmw0OT9fPOdEJjqSdGG/ +tcrVMRVk0PsIQqZKDYDA7TTWgv7MnwLRTTNiPw7rbOtbsy2OSwQVKtdqApZloZ+YyRD ffdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-164778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164778-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p23-20020a1709027ed700b001eaf9b36a6bsi8730717plb.312.2024.04.30.15.50.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 15:50:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-164778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164778-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A46082811C0 for ; Tue, 30 Apr 2024 22:50:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD961171070; Tue, 30 Apr 2024 22:50:11 +0000 (UTC) Received: from mail115-95.sinamail.sina.com.cn (mail115-95.sinamail.sina.com.cn [218.30.115.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EDFA17C6A for ; Tue, 30 Apr 2024 22:50:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.95 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714517411; cv=none; b=CdaVWKSksWq/pbTVhpeQSLkwE16/GMiXR9ICNtPztutRVAl/od77YU90ujsKyd8OA1A1sW9OfDsJ/Pte0LxnV7lt5kFcwkHDDM/LqjMiPRQAJKHgM6ObUM/gIZ292jhJ27yVNdjidCKD1Lrp+cNCvIvYXFibRAFGuVEnZxYTrXw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714517411; c=relaxed/simple; bh=XEE2PEy3b5fcX0gLmxayUkBOW/4SKFDooMAEXPZlcsM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ewoC+eKChfW++l4KWk5bfbWW9dBN/K3rRf+0sF9WiQDvJ/lsIC4SeZKk1cVGUB6d5VzNzjrBnfsYlE2G2JAn4gE1bc8BwtQ1F9SASlLe0ornMuC/8GkT1IvjOsODZHxAUAQET4sFtDaMi3JqIKW9wCh+Zi+dO7kwVrjKQ3YOdVc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.115.95 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([116.24.11.115]) by sina.com (172.16.235.24) with ESMTP id 6631759800002F6E; Tue, 1 May 2024 06:50:02 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 23084445089376 X-SMAIL-UIID: 793AE464C04D4BCDA5E14DF8F1C4EC61-20240501-065002-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [net?] [virt?] [kvm?] KASAN: slab-use-after-free Read in vhost_task_fn Date: Wed, 1 May 2024 06:50:05 +0800 Message-Id: <20240430225005.4368-1-hdanton@sina.com> In-Reply-To: <000000000000a9613006174c1c4c@google.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Tue, 30 Apr 2024 01:25:26 -0700 > syzbot found the following issue on: > > HEAD commit: bb7a2467e6be Add linux-next specific files for 20240426 > git tree: linux-next > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16c30028980000 #syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git bb7a2467e6be --- x/kernel/vhost_task.c +++ y/kernel/vhost_task.c @@ -100,6 +100,8 @@ void vhost_task_stop(struct vhost_task * * freeing it below. */ wait_for_completion(&vtsk->exited); + mutex_lock(&vtsk->exit_mutex); + mutex_unlock(&vtsk->exit_mutex); kfree(vtsk); } EXPORT_SYMBOL_GPL(vhost_task_stop); --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -508,7 +508,7 @@ static inline bool lockdep_softirq_start(void) { return false; } static inline void lockdep_softirq_end(bool in_hardirq) { } #endif -asmlinkage __visible void __softirq_entry __do_softirq(void) +static void handle_softirqs(bool ksirqd) { unsigned long end = jiffies + MAX_SOFTIRQ_TIME; unsigned long old_flags = current->flags; @@ -563,8 +563,7 @@ restart: pending >>= softirq_bit; } - if (!IS_ENABLED(CONFIG_PREEMPT_RT) && - __this_cpu_read(ksoftirqd) == current) + if (!IS_ENABLED(CONFIG_PREEMPT_RT) && ksirqd) rcu_softirq_qs(); local_irq_disable(); @@ -584,6 +583,11 @@ restart: current_restore_flags(old_flags, PF_MEMALLOC); } +asmlinkage __visible void __softirq_entry __do_softirq(void) +{ + handle_softirqs(false); +} + /** * irq_enter_rcu - Enter an interrupt context with RCU watching */ @@ -921,7 +925,7 @@ static void run_ksoftirqd(unsigned int cpu) * We can safely run softirq on inline stack, as we are not deep * in the task stack here. */ - __do_softirq(); + handle_softirqs(true); ksoftirqd_run_end(); cond_resched(); return; --