Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp539540rdb; Tue, 16 Jan 2024 08:04:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFAprDmmqKuLSAtkSECrj3Y3xsF+pW8ZxAOG8WLWAhSDkS5wUcAnOA3uZlhz72lZuNFtFn2 X-Received: by 2002:a05:622a:44b:b0:429:c719:a44 with SMTP id o11-20020a05622a044b00b00429c7190a44mr10179447qtx.105.1705421075176; Tue, 16 Jan 2024 08:04:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705421075; cv=none; d=google.com; s=arc-20160816; b=s86yolu5Yrpo35OwGA4wY158M83MAs5Dbm3FE9Z9lCnknEHsbBCpqPiZm/OVRt8/2R rl2Zii39U5nZTE9dg+47gAxn7WctoP4ISHCURovjaJPb2eRazo2g7ADCQzdrEEQqxcgy SwGvnZo1w04VXAcOLyOrKYtI+CZvSeMaF7xYDnItrt1HUUFrCv5RYWW0D3wCGbysxQjx TTJ20axhHibQJuSAKm26nhHVRiZBP/H1ydEqFqS5lF/6OWwLukAENHFrMT5qsStrDX29 w6GoAArwK/MKSdmFKevgqJ2JTBrfxLic7C3XJ4rC+z0GqU8zdV8cwswdJ+ypYlDfrHEQ VcVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pTBjJJiKU4ZQgoMzu6F6I7FE6reLoeIa2h9yh4twzkw=; fh=pBgq81n+jivY2r5OB5RQIvujhxYBaTuZgwa/DbDfA9I=; b=ndZDaIDzi2wVW4WZsRzBN/Fy8yvzOZQJ2JAJdDbnXt5PTcsv+QJ//eY4DOeVb6tJPQ oOrRKvfxiQm2cr2vOaf+8qtLY6HeBXFNG7twCjp6DHv1bwHhKIzHbOk0LMmiJ4i8JUjV mC/Mn4anI/JMIT/zHiAy6N11v7VwnbykEkTv7qgPfABZYigTlhkMLdyRcAV8F5ezTmqk Zb3S6weohzWzmCZIkQevy+5czRNWu2JTq9dyV3p06LSEUBYzggoOHwAetgoIM6vPlH6U ayFO2dIq3OzUPgaHvaTXJWqUOHu/LM4kkyCC2kye1JgfrzX7n0i4VMhxpeSrvRHhg7lx iBAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="clg/3LK8"; spf=pass (google.com: domain of linux-kernel+bounces-27558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27558-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z6-20020a05622a028600b0042a0a39808csi473519qtw.238.2024.01.16.08.04.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 08:04:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="clg/3LK8"; spf=pass (google.com: domain of linux-kernel+bounces-27558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27558-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E339B1C236C1 for ; Tue, 16 Jan 2024 16:04:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 864361CA8A; Tue, 16 Jan 2024 16:03:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="clg/3LK8" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ACBA11CD05; Tue, 16 Jan 2024 16:03:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5383C433F1; Tue, 16 Jan 2024 16:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705421015; bh=bHzyF8LGYsF06hfUsvNFRxL+Xu1Z5AeKaWGruhCzQhk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=clg/3LK86toiisIJI8OXUvyzpZk5vrEkPjyHd19PwvuGKwe5KUZxipo9cvRq9ayXw j21BDeja9CGey3UR4r2hGGMwS7sICpdxn1MwLKORq0EHdpmb8Gr3r+gFMeXlw9FLEA p522/2VNSbBCFW5A+XTpwtl9IoVnnH+jP6Zx7V2w+VeIyj565UppFza2Uz47TY92/l 82L1Ju9QzX4Z4vYj8QdBYGdW0TD/jJlVxnawkaml4daCZfQ1yQiJrPleCUQL5EzGP1 OandjRepUw6aG52NaXZISoMeOmjUm+IJkYicg0dTN/e2SQLfkO543sdlBGvleYgcRh eP2qzAn01YGPw== Date: Tue, 16 Jan 2024 16:03:29 +0000 From: Simon Horman To: Fedor Pchelkin Cc: Julian Anastasov , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Dwip Banerjee , netdev@vger.kernel.org, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kernel@vger.kernel.org, Alexey Khoroshilov , lvc-project@linuxtesting.org Subject: Re: [PATCH net] net: ipvs: avoid stat macros calls from preemptible context Message-ID: <20240116160329.GB588419@kernel.org> References: <20240115143923.31243-1-pchelkin@ispras.ru> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240115143923.31243-1-pchelkin@ispras.ru> On Mon, Jan 15, 2024 at 05:39:22PM +0300, Fedor Pchelkin wrote: > Inside decrement_ttl() upon discovering that the packet ttl has exceeded, > __IP_INC_STATS and __IP6_INC_STATS macros can be called from preemptible > context having the following backtrace: > > check_preemption_disabled: 48 callbacks suppressed > BUG: using __this_cpu_add() in preemptible [00000000] code: curl/1177 > caller is decrement_ttl+0x217/0x830 > CPU: 5 PID: 1177 Comm: curl Not tainted 6.7.0+ #34 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 04/01/2014 > Call Trace: > > dump_stack_lvl+0xbd/0xe0 > check_preemption_disabled+0xd1/0xe0 > decrement_ttl+0x217/0x830 > __ip_vs_get_out_rt+0x4e0/0x1ef0 > ip_vs_nat_xmit+0x205/0xcd0 > ip_vs_in_hook+0x9b1/0x26a0 > nf_hook_slow+0xc2/0x210 > nf_hook+0x1fb/0x770 > __ip_local_out+0x33b/0x640 > ip_local_out+0x2a/0x490 > __ip_queue_xmit+0x990/0x1d10 > __tcp_transmit_skb+0x288b/0x3d10 > tcp_connect+0x3466/0x5180 > tcp_v4_connect+0x1535/0x1bb0 > __inet_stream_connect+0x40d/0x1040 > inet_stream_connect+0x57/0xa0 > __sys_connect_file+0x162/0x1a0 > __sys_connect+0x137/0x160 > __x64_sys_connect+0x72/0xb0 > do_syscall_64+0x6f/0x140 > entry_SYSCALL_64_after_hwframe+0x6e/0x76 > RIP: 0033:0x7fe6dbbc34e0 > > Use the corresponding preemption-aware variants: IP_INC_STATS and > IP6_INC_STATS. > > Found by Linux Verification Center (linuxtesting.org). > > Fixes: 8d8e20e2d7bb ("ipvs: Decrement ttl") > Signed-off-by: Fedor Pchelkin Acked-by: Simon Horman