From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 8AD8480068 for ; Mon, 30 Nov 2026 18:49:55 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AUImfk8031118; Mon, 30 Nov 2026 21:48:42 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AUImfk8031118 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="Q9jTgHhV" Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AUImXqp031062 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 30 Nov 2026 21:48:33 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AUImXqp031062 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-c504991a35eso172929966b.3 for ; Mon, 30 Nov 2026 10:48:33 -0800 (PST) X-Gm-Message-State: APuU4Z/bxlvdfxarJqHiS6NLklunsjmXbLEhCNxI/MSlAkctpUwfPeTE hxYsEil9RE75LW9XMnTe01d4V+jW15et83Ya5YSaUrWk8wzkiT/eSHaVKoHXbZNbS7FfA8Q/rCc /x3z5EcWo5hCNWOMdrSr8dFBFW5FqvYiDtQ+sCnEaD9TEWxqgQBDI4A== X-Gm-Gg: AZFdTZerW5OoHqUzvh9D85h04/Az9mvI/UVEPBSKGX3MLh2CL0cWmxJ8OCEQmWTE3Mp RZNoTADncKzxtv1tS6tXj32i1AMrzR67QMitkCaJgNSYePyKBsU/SbCU2fCPKJzprbBIixKIpb4 p3gJdgcO7U/im82nNPIHFzNaETvJEnrwfEz5iPUk2hav/onBnq53gr2WpSPWbYzzMKGmMICrMzR 1XeIJkdVri1NhJ2DuWHESPmMpoyXVU0bwfKZXqc/IqK8ROcp7BVXF72dB/eUAKyXllaVh09YC0l Eb24mCqb1EjT43IdajUiNsxIZpcXtt6uFzFLNjMevy7wi0FicC4wIRk5i46PC7Pvzqs5gAfMjLR rCZp1KtO3FXIOz2BFlonqYllT1w== X-Received: by 2002:a17:906:7c2:b0:c50:f0fe:438a with SMTP id a640c23a62f3a-c513a5e2526mr2324101866b.8.1796064512839; Mon, 30 Nov 2026 10:48:32 -0800 (PST) X-Received: by 2002:a17:906:7c2:b0:c50:f0fe:438a with SMTP id a640c23a62f3a-c513a5e2526mr2324100166b.8.1796064512278; Mon, 30 Nov 2026 10:48:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1796064512; cv=none; d=google.com; s=arc-20260327; b=h5zBXkyKBry2FM2BHAeGmYgn10TK1rK30ufH6k1hi76jJ9xL4wjjPECl1/Vb9FIlf7 KH3tWfA1zm2oxKkBG1ndW+Y/5QpQDsESP9NmtUtR2j49lvil3ZvZcR0wN3LZLuNxhwvm 8DLF+JmgmarEOOLEfDXAtP0PL16LANhVtdYDc2BPlkx+Y09VdrMw28cHZ+X2+h+W/vfy DNVA4JOhJfOvcIOt21i1R4MePYQCYq51s2UzepSlxE+3/PIrKUP1MGkYBTH/4Ru7lQMu 6bq3janha5iDxfTbW0YgVWtaYRVryVVv9EJ/PFiUfG7BTz0sdqQ2ttSffAb18OnERQYq 7Iow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=+44l4EuyDlu4wJy7xkpPbhXOvNQ50A/R0D+rt1NzFlA=; fh=/QSWnKFFIPNLStgUoDwCQRaXnWcMIG7fyKJgHY+VEpU=; b=HI4nO2dZI6NonWtQ9XhMQPrn9CrZLsxxwSIH6FwJVh6ZvPorqYrPPJ+eN0mF0LzK2E RMa8VN7dEIBzF1+3NLBRG8AvYgsOCi7DbH71rWrS6lDsnoFYnJjAwRQtHzXUYm+PsGsM gH4gP8AiVei+PvGaBTYjwyJPJaCLivO8+Jfh0CcdhSAiRP5/cpVAd6tj3C05mYXKpas/ bzVyW1hSiFr4nhPCabkEpwIo2FIRj7Mc/rf/cX5NxI4AUqFgbGMWdLyvs6vRHaHrJYmC gUFp+qnae/zQbktx2aAStCdJda36YPDs4qKAUPYlSJajbGXeGWGno2CQ+LwxqdWlmvwB qgtA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=Q9jTgHhV; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id a640c23a62f3a-c513afe4f2dsi2203508466b.109.2026.11.30.10.48.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 10:48:32 -0800 (PST) Received-SPF: pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=Q9jTgHhV; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=+44l4EuyDlu4wJy7xkpPbhXOvNQ50A/R0D+rt1NzFlA=; b=Q9jTgHhVZ4VD aYi5sM/ZMciP6vChs0V26sgjxfrRL2EnbeRrRszadMT/dmCO5Xk8IrC4YkZ2PLApdHetxs5tv37Xr 6rFXvC5e8hnS84JdrQGgE8oiTTKjHXuV96uAwzxUV1Z7CiHw+TKX2ifNAvswQNDs64e60L4veUla6 8M6jwbVsC24AzIBnN2MxQSTe4DBHFE8oQo0jXkQ/DxQH+qE5wjEzkNQTEgRb53vc47oNH14KGVKZE yKMVE01YQViiUp5X4vcL+BEjJqdw09TvgscezdTJrX/7Ac4aP6z/7hqI6M5qki62vNlzlg18YzUnP yPYhHAFff72AOmLByoCk+Q==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=LekKit-T14) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xY6Q8-001tKJ-29; Mon, 30 Nov 2026 19:48:23 +0100 From: Eva Kurchatova To: khorenko@virtuozzo.com, vladimir.riabchun@virtuozzo.com Date: Mon, 30 Nov 2026 20:45:47 +0200 Message-ID: <20261130184822.2743885-3-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261130184822.2743885-1-eva.kurchatova@virtuozzo.com> References: <20261130184822.2743885-1-eva.kurchatova@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 2/8] ms/tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org From: Jiayuan Chen [ Upstream commit eaab8cab451b9502ce224cd202550375b894a467 ] bpf_sock_destroy() runs from the tcp iterator, under rcu_read_lock(). If the sock is a listener that still has children in its accept queue, tcp_abort() ends up in inet_csk_listen_stop() and the cond_resched() there trips the debug check: BUG: sleeping function called from invalid context at net/ipv4/inet_connection_sock.c:1523 in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 628, name: test_progs preempt_count: 0, expected: 0 RCU nest depth: 1, expected: 0 locks held by test_progs/628: 3, last CPU#3: #0: ffff8881158cee18 (&p->lock){+.+.}-{4:4}, at: bpf_seq_read+0x56/0x1210 #1: ffff8881106bb858 (sk_lock-AF_INET6){+.+.}-{0:0}, at: bpf_iter_tcp_seq_show+0x32b/0x4b0 #2: ffffffffb435af20 (rcu_read_lock){....}-{1:3}, at: bpf_iter_run_prog+0x46b/0xde0 CPU: 3 UID: 0 PID: 628 Comm: test_progs Tainted: G W 7.2.0+ #65 PREEMPT Tainted: [W]=WARN Call Trace: dump_stack_lvl+0xc1/0xf0 dump_stack+0x10/0x20 __might_resched+0x3d2/0x610 inet_csk_listen_stop+0x7b/0xbf0 tcp_abort+0x23b/0x3b0 bpf_sock_destroy+0xfc/0x140 bpf_prog_448133d24601754f_iter_tcp6_server+0x81/0x8a bpf_iter_run_prog+0x538/0xde0 bpf_iter_tcp_seq_show+0x26b/0x4b0 bpf_seq_read+0x424/0x1210 vfs_read+0x197/0xe40 ksys_read+0x119/0x240 __x64_sys_read+0x72/0xc0 x64_sys_call+0x647/0x27e0 do_syscall_64+0xe5/0x610 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7fad39b28aca RSP: 002b:00007ffc381c61c0 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 00007ffc381c6a88 RCX: 00007fad39b28aca RDX: 0000000000000032 RSI: 00007ffc381c6250 RDI: 0000000000000014 RBP: 00007ffc381c61e0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003 R13: 0000000000000000 R14: 000055f077c1bbb0 R15: 00007fad3a0f3000 The commit that added the kfunc already guards lock_sock() in tcp_abort() and udp_abort() with has_current_bpf_ctx(), but missed the listener path. Do the same for the cond_resched(). The loop runs inside the iterator's rcu_read_lock(), it must not reschedule or report a quiescent state there. Fixes: 4ddbcb886268 ("bpf: Add bpf_sock_destroy kfunc") Signed-off-by: Jiayuan Chen Link: https://lore.kernel.org/r/20260910112736.153710-1-jiayuan.chen@linux.dev Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin (cherry picked from commit 5b52417c6196e05618a3b5d9753dbed9adef0166) https://virtuozzo.atlassian.net/browse/VSTOR-157577 Feature: fix ms/net Signed-off-by: Eva Kurchatova --- net/ipv4/inet_connection_sock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 936b0435cfc1..156467ab4384 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -1508,7 +1508,8 @@ void inet_csk_listen_stop(struct sock *sk) local_bh_enable(); sock_put(child); - cond_resched(); + if (!has_current_bpf_ctx()) + cond_resched(); } if (queue->fastopenq.rskq_rst_head) { /* Free all the reqs queued in rskq_rst_head. */ -- 2.56.1 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel