Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp809467lqz; Sat, 30 Mar 2024 23:21:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWkCv3C7THCBRL5puN64jjNMOpA+efKWzj0i3cinGi+s/A7y0UYzQeQ31mQOXuKXTUFDaRWSjwkEucybiw5n73x4DFDeMM+QWiC7KDMjQ== X-Google-Smtp-Source: AGHT+IEQB7krab/+27jHb/b3fO5mYOPqSXfKY6eyCAqbEVtImhV9TsAMJRuGxUkjJA6852GPp7EC X-Received: by 2002:a17:902:6542:b0:1e0:9964:76f4 with SMTP id d2-20020a170902654200b001e0996476f4mr7441976pln.14.1711866062807; Sat, 30 Mar 2024 23:21:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711866062; cv=pass; d=google.com; s=arc-20160816; b=Xb5eWRzDAQFJ7mqYNGVL9D0BzYpO2r53u5hjlTfqkZDSsYMGO/MyilK1CMWePCP3+s Rj84ietyZe7Usj6BMFHI5UDnudLYSMXMKCIunaIb3pRPMHXdjmjwbPatq7/11TuXA3bX Diu9LPTnpVTbM9aV0TfEQqu3kKM16oFKDXfL9HwZ+MlkMC2axYq0POBeWKMlWEs6akf5 4bOOZuZ+rueNnACzGgz6CV1ZdmGMnMJwUjcy42zQDgqKwa/xjKarROINd41qqMEB/Lyo q/yAtPydvj/c9jdP1YyV8gxhciSzozxSN199KOknbSZbGjRh71vqeLRqLSjGoanMp85m xeRg== 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=KHHC1VXLU3bwez9gaJ0zIkbaMPC25fF29fPtsQmn1Nw=; fh=Xyn9Xj2gdyr2uCX+sXQ868jhMHETD8rbs01IV60LLJ8=; b=PiidjaJgSnaw2uo6xcSuG8t4iGbTz0CjFQ6udskut2u7VB08led5RZZLcfmBpiPVPh ogS+9qD4pMwivpzJaZaEg6fSpqkyuvtZDghH+Cg3dZdDuEHjUCQfUPQjV+fTAvQw4k9Q jD9gqqA7U2Ri4shis7En3UNZw9ZPLd+SV0X5g2ClzHDqSqfMkJ2WmxWeR9MBK+wFKzrc 4I+KLjSVXtSiIRu9XKv+PUGrmAIgBs+WZdLFy/IaJuY5FSWs1jyxt2YfKBN0Tc2GemMx LG8wxOFkfc4dsCJuZ+Y86BhgI+BWVUoAzx9MTVR+TZxMsB2OSg0ZIaODi1et9PPil9Wa BekA==; 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-125966-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125966-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 k18-20020a170902761200b001e0b87e1885si6541398pll.213.2024.03.30.23.21.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Mar 2024 23:21:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125966-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-125966-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125966-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 7D05F28235A for ; Sun, 31 Mar 2024 06:21:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D18AC79DD; Sun, 31 Mar 2024 06:20:56 +0000 (UTC) Received: from mail115-171.sinamail.sina.com.cn (mail115-171.sinamail.sina.com.cn [218.30.115.171]) (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 539246FCC for ; Sun, 31 Mar 2024 06:20:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711866056; cv=none; b=ovmur2pM/PDcjoJNk+E6QHsmmU0MIrZNK3IB/dnSohhwxIVFW3kri21vCq246QXXrVcQsNU1NA/5r8360sFIOgBvJiwjMM6CR952C8SKYhoxK7lhjmy+mxC4FXmHBsgPBSJ5Z1/XfQXvET+il0t3cbWJQZYqTfQQEsXhNQxTAQc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711866056; c=relaxed/simple; bh=VqKv1cUOhZbzr+oAZDwA1oezSwzFV6yXqtR6U/dea/c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mmnoTXVG4a1wl6I0GQLg6I16mGe8MS5acD63myPVxUDBd4P9KqnJRA+vFGkLaklByBn+F8q4eXbSq9dCuhdU7Hfg4lDqRKwfCJP0pSBHuGTXL3NQ7FGn1aJhGmFCd8l7L9NAFWV2KSpop9gNCbyg/dpHmCT+HqftU+u2m/fTk1o= 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.171 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)([113.118.64.152]) by sina.com (172.16.235.25) with ESMTP id 6609009800003D91; Sun, 31 Mar 2024 14:20:10 +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: 44924034210201 X-SMAIL-UIID: 6924078F414540C5A10A825D4304B6C9-20240331-142010-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [bpf?] possible deadlock in kvfree_call_rcu Date: Sun, 31 Mar 2024 14:19:58 +0800 Message-Id: <20240331061958.3340-1-hdanton@sina.com> In-Reply-To: <000000000000716bb60614acbf37@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 Wed, 27 Mar 2024 16:27:19 -0700 > syzbot has found a reproducer for the following issue on: > > HEAD commit: 443574b03387 riscv, bpf: Fix kfunc parameters incompatibil.. > git tree: bpf > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16ca53c9180000 #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fe46a7dd189e --- x/kernel/rcu/tree.c +++ y/kernel/rcu/tree.c @@ -2957,7 +2957,8 @@ krc_this_cpu_lock(unsigned long *flags) local_irq_save(*flags); // For safely calling this_cpu_ptr(). krcp = this_cpu_ptr(&krc); - raw_spin_lock(&krcp->lock); + while (!raw_spin_trylock(&krcp->lock)) + ; return krcp; } --- x/kernel/bpf/lpm_trie.c +++ y/kernel/bpf/lpm_trie.c @@ -382,9 +382,10 @@ static long trie_update_elem(struct bpf_ trie->n_entries--; rcu_assign_pointer(*slot, new_node); - kfree_rcu(node, rcu); - goto out; + spin_unlock_irqrestore(&trie->lock, irq_flags); + kfree_rcu(node, rcu); + return 0; } /* If the new node matches the prefix completely, it must be inserted --