Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp417122lqt; Thu, 6 Jun 2024 07:26:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUo/lYq1Eb291jwnEyCMOj6nZAxaxz+f1FjMHvjaFKZmMDGf0GC9BWyCQayvUNVhIQvDnnALptaDUtbEqB0xSyn6WhqNSSBUfMiNwGyWw== X-Google-Smtp-Source: AGHT+IFa+C4PKo4gCx3cvImX/ruXe6WewWOzGYM++lyla1a0t2YpRQfn2ztWmWkuHDTfmR46Y6H6 X-Received: by 2002:a67:ed81:0:b0:48a:370c:deb6 with SMTP id ada2fe7eead31-48c0483db59mr5881404137.6.1717683981515; Thu, 06 Jun 2024 07:26:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717683981; cv=pass; d=google.com; s=arc-20160816; b=YYmSe1R/NKCau1WqEAEzDB40tYBmNAYT9WaKFo/N82VoGlBJ6uG7Mc2k5CHeuse76m OOe2NV1NGD2njCxDdQxaCwcD16EjJyqLWRX3MnEviqPD2g7MQ9GNm+P2Y25AFebs/sUE XgGIK3dyh1Kb/MXiGTzDdwXy0YezlayrruW9whDL5LLf+Z6YONOpZr6DxK70t0uKKM6R ficzG7UG1GzaoyFqb58OhchSSg8S2Pw9ltFjubKKme3piVq4jIx7njihyFmZkbgTzbjU pFC6lC13TG3W+NLgaVhw6J1lOfCMfiA7PI+MFA5QuC00aLWH9ryQFawLe7WU1SQr1snC LPDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:to:from:subject:message-id:in-reply-to :date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence; bh=MpKPMPp72E39a98DYqNubx0t6d1WZdls3EbkjhEyXDg=; fh=uOxEfs73UXnpmsgYZepGR6OauibfyleDeycBITvBwXs=; b=lPRNLSmblPswlLLY7vrnvbkllJOKxwG3yx/THJtl/3tbUz5bWUzMR0Uy2zdlfWptmO mjrFP/wYyD2WsyOjM89Js3Mta71jN5Exd02TFYF5iiG3+mKHI/+OD6Au7FozEhHkqrS4 AZPVoJPgXX6VyYOxqdEqkDi+CQFIdw4MZsZLq3Hux+qHoMWuQfCP/f/M7+iZrccFWX0u gK5M/cSWLQZu2D6o7OFJEaX3FULBxi1dypm7y8oGAiuRdDiAq0/pvV/tATfomdyrHP58 SjE1s3G6Ohb5rVD8LELd5CHlG1t98r0pM0HSpl5FdflmRi8PpA7IjYaLYCAAPkgYo39i vddA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=m3kw2wvrgufz5godrsrytgd7.apphosting.bounces.google.com); spf=pass (google.com: domain of linux-kernel+bounces-204429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204429-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ada2fe7eead31-48c1a1eabf4si300760137.345.2024.06.06.07.26.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 07:26:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=m3kw2wvrgufz5godrsrytgd7.apphosting.bounces.google.com); spf=pass (google.com: domain of linux-kernel+bounces-204429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204429-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3BAAC1C250D3 for ; Thu, 6 Jun 2024 14:26:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF9B11AB8EC; Thu, 6 Jun 2024 14:14:33 +0000 (UTC) Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5A6919A295 for ; Thu, 6 Jun 2024 14:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717683273; cv=none; b=cpzskNLyL2LDPN8ioAaWKXq15+a3BIvNWWjZHwx0sb7AMW1lZMzpjJsDHBhXUdfasyLp3IsB3SnTCVhPxTzKHANECl3OKLlHcejk+dS8Z0FQvMkgXZ1Ny8T2YSqWtGwjEES2rOV8JANotVg+jypgT68Jo1kP5DqQ7cegUtnnQTs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717683273; c=relaxed/simple; bh=Pwl+Ph8+3XYeth7wyt/AmydUz4nZL/6HcBeIPvZXsRE=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=bmWcvG/0igTzOH8FDQispcjar/K4pCQmk1oZ+iLQZhvBEC68Z1Sgli7XQhrY/py5OQQHKAmlV8uIrLMhxaXU/NI4mQMPurk99GGYeELYKq4OsDYP49MoFkofIWsdPALpM6cB/X+4/zic0ctipCuejI+hGPUfOXnIJZfNYcFvE8s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.166.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-il1-f198.google.com with SMTP id e9e14a558f8ab-374ad7fa4bbso10089955ab.2 for ; Thu, 06 Jun 2024 07:14:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717683270; x=1718288070; h=content-transfer-encoding:to:from:subject:message-id:in-reply-to :date:mime-version:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MpKPMPp72E39a98DYqNubx0t6d1WZdls3EbkjhEyXDg=; b=P20bFn4dV4et3KuzugVNoh9lvCXfYemVxQe82FvNwxQrlBda2NBKNHZ+lE8ICVE0EO 7SK7F2cTyuiEsTXGwrOb+giXROnOR+2lPuNIbTJM8Q2GaTd1ZtX0PumuqAW4RtURKN8a sRv9vol/2agXUS6vHyg4AnTsVLRwt4AiVZltjQxYdEGXPn0OojBRz4MDk91AcuTjq/Km MkwnaYrZk8LhgZ+NGOU9uYk6/k/dsbbxftaNh+itBtlVEaFC+qBIaz/q7Ay39tZQIB4E jTUpJ8ahg8MYmzEUoONyJcP875RKT6GCaxdxecPe1dQvi+YElQZzVU3JSZsKhckA81Ba 7F+w== X-Gm-Message-State: AOJu0YxMeI12qX4cpfUUDD+8z21jqBCI4nmTF9mNdl8Drsw1J4laVl77 Pj+ptgWFeDoMGX1qtFKBTWPTgGOX4XzN3JMDmOga5UkeYZgf8LbrVLLLA5He7jui+ID/mTPbYSr Dny7kuMFubvwx3Vkrg0hnofoT0PHkMbUvUvT4YMbJofgvRAspwU9b1io= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a92:c26b:0:b0:36c:5228:462 with SMTP id e9e14a558f8ab-374b1f56c81mr3614015ab.3.1717683270146; Thu, 06 Jun 2024 07:14:30 -0700 (PDT) Date: Thu, 06 Jun 2024 07:14:30 -0700 In-Reply-To: <000000000000adb08b061413919e@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <000000000000277099061a394d13@google.com> Subject: Re: [syzbot] possible deadlock in trie_delete_elem From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: possible deadlock in trie_delete_elem Author: norkam41@gmail.com #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.g= it c3f38fa61af77b49866b006939479069cd451173 Signed-off-by: Norbert Kami=C5=84ski --- kernel/trace/bpf_trace.c | 18 +++++++++++++++++- kernel/tracepoint.c | 15 +++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 6249dac61701..75fdb8e3abaa 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -2391,7 +2391,23 @@ void __bpf_trace_run(struct bpf_raw_tp_link *link, u= 64 *args) struct bpf_trace_run_ctx run_ctx; =20 cant_sleep(); - if (unlikely(this_cpu_inc_return(*(prog->active)) !=3D 1)) { + + // return if instrumentation disabled, see: bpf_disable_instrumentation + int instrumentation =3D unlikely(__this_cpu_read(bpf_prog_active)); + if (instrumentation) { + printk("SKIP FOR INSTRUMENTATION: %s > %s > %p /%i =3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D\n", + prog->aux->name, + link->btp->tp->name, prog, instrumentation); + bpf_prog_inc_misses_counter(prog); + return; + } + + int active =3D this_cpu_inc_return(*(prog->active)); + // printk("%s > %s > %p /%i\n", prog->aux->name, link->btp->tp->name, pro= g, active); + if (active !=3D 1) { + printk("SKIP FOR ACTIVE: %s > %s > %p /%i =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n", + prog->aux->name, + link->btp->tp->name, prog, active); bpf_prog_inc_misses_counter(prog); goto out; } diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index 8d1507dd0724..a0a0d8b16b41 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c @@ -168,12 +168,21 @@ static inline void release_probes(struct tracepoint_f= unc *old) static void debug_print_probes(struct tracepoint_func *funcs) { int i; + struct bpf_raw_tp_link *link; =20 if (!tracepoint_debug || !funcs) return; =20 - for (i =3D 0; funcs[i].func; i++) - printk(KERN_DEBUG "Probe %d : %p\n", i, funcs[i].func); + for (i =3D 0; funcs[i].func; i++) { + link =3D funcs[i].data; + int active =3D this_cpu_read(*(link->link.prog->active)); + printk("Probe %d : %p / %p: %s/%d / %i\n", i, + funcs[i].func, + link, + link->link.prog->aux->name, + active, + funcs[i].prio); + } } =20 static struct tracepoint_func * @@ -298,6 +307,8 @@ static enum tp_func_state nr_func_state(const struct tr= acepoint_func *tp_funcs) { if (!tp_funcs) return TP_FUNC_0; + if (!tp_funcs[0].func) + return TP_FUNC_0; if (!tp_funcs[1].func) return TP_FUNC_1; if (!tp_funcs[2].func) --=20 2.34.1