From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796063573; b=aj7X74G/rd2bnu0jXPa68S5ubGD4aNmbzLe1r/Vq5EGDMDOnSMwHTA2maJ57CRKI4Ey8 fz2ptQePG1s8Fqlmw6XIsrh1oHrPr+++ZlIObLOqFspvSpcWYHVed1tn9lAslE7KTX9o7 JHCk0Afhh21wnGYuqJYWGFzhWxw5WdqIxCUn+86OBSf/JvRiBth3V/vZfIzXt5jkbsOJb tP2pKVS2dRcq6fhzA4JJxHgu4jYwfD1Nfz736Q9fmQXYeedicTKSJ2yVnkMc9azcaGuQS DsHVsPZQbYDtcf9fTbQpJJAzLJMmrlhcs0IvKhQIarBIu0Zo2hKrI44rk00mPk1NsoQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796063573; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received: X-Received:Received:Message-ID:Date:MIME-Version:User-Agent:Subject: To:Cc:References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=fRzLt2NOucwQu7VLQwgCYuCBqDO8UW202aoLD5/0unE=; b=mCSXcXkv26JHuxO+5i8QBOFTMbXD+aiBllYjYaOlVYHbk6rz3qUKWThER+2+uKtxXn84 7iQmizkFh9i5b48mZFt5Hi2LAz5LXEGet9u9xu1uOxX1qfj/g48e+TaFA3z0tNGVlZJCE siRCstKx2NJGY48GmQvQOgOsq5HxkMHA3/gw/pdqFUlT9lfoYL8Bo4cKULz5LM3am82ZG K8JzyOk/x+tkjuKgcgRcGajy015/xe2OKGreG29QA9nEHxN+fyxadVJsGqUX2zUXno3ws jTBdjejD/Q/cM1cxWSQgH5/0oISrv1iyTpBtxX6Elz7GQyyKzWMvSfTzBB+K7nhtMZg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KAKQxssu; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=oDM1i+c7; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B0F6606A320 for ; Mon, 30 Nov 2026 18:32:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3B0F6606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KAKQxssu; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=oDM1i+c7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796063572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fRzLt2NOucwQu7VLQwgCYuCBqDO8UW202aoLD5/0unE=; b=KAKQxssuBmRcLef479Y6LGIY30D5AvlanCk/9Ld+6nm/dK4caovgGNg+Qu6ITvlJQaGDbU 3uUnmFVn4PhiZGqP/ZOjwaHDFPAsMZNEJJocO3uzCBOZGiLqLNhIz0uuaXfrgDicDh0PCB WpRRw2nURKZGOv6tiGGIxYmMsLRmKE0= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-637-FM-XNw0TNLGSC9z-eTzsaw-1; Mon, 30 Nov 2026 18:32:50 +0000 X-MC-Unique: FM-XNw0TNLGSC9z-eTzsaw-1 X-Mimecast-MFC-AGG-ID: FM-XNw0TNLGSC9z-eTzsaw_1796063570 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4a1fdde384cso78736005e9.3 for ; Mon, 30 Nov 2026 10:32:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1796063569; x=1796668369; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=fRzLt2NOucwQu7VLQwgCYuCBqDO8UW202aoLD5/0unE=; b=oDM1i+c7J3fsLaJB8c4e6eO2ZoaFgGKS0btuerP2yihInGLrTnJwxxCKfH2lFmYYoX UKQYCaACKXLadPjutVHxEbi+NvT7hK4kYA6b3uOJ1cvnWE89GbYWcFQlNnguaSPbtTQe O4Qj+IxrK+vdRCpPqmgy9YbQUMygir8xxxLr/vNJu/5xYfASkx5bvxFD02frsBvovVtH 0KCP9tlGdHoT21ie/eUv1sukDbkVcy2NZslpx/wpjwMDA1wPM+WLA3mhSwDxwdseJe0B zqVxkYgbXirbqW8YkuWahYQsj9XSPdLgsIYD9KMbm3Wl2615/ZpAnIC8iPldbq/ycV6E vQ9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796063569; x=1796668369; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fRzLt2NOucwQu7VLQwgCYuCBqDO8UW202aoLD5/0unE=; b=WeUHd73n4DFpwKZnO2yUitIb/Ly6UlO7B6aFVLCL9q0W6vu98DEYdpOBcuB0iq/pSf Ld4FHjjS1yg1MBFbM+BVLQtBul90cPMZs5JL+98WdYbgEI4dX92bcb7H/VTMAiOX02XH nPNmVSs1PNzUsUK387O3T/e/NprYRr48HbALiFePsfL24cM07EG4irtDfOfJ+7hANmIR pzdyTcKrLrBb4aZPnT4kiRUfHzHKakluOYlfJeuC8Pokt21tAtPpXfIX7JDYyInZrcsR NAomdmZGBXqO0bqJdSmwVJl4treyf7aY2frqxSP9lv5CySqQ7V8mI5QRQJtknT1eidxD k0ow== X-Forwarded-Encrypted: i=1; AL+hErFP5foAKtc2j2GcvLxaQSNPSM51zFF0JxGvUsQ6g+1MLfruqIJc3mJ/4AgZm5m49XY8uQMyrfz5j/HyrOI=@vger.kernel.org X-Gm-Message-State: APuU4Z9hQxoxpQ5gpr6s2neDeFbyexoHWZ5gJEYxmKZ71JizZXzQKRNx Bfjsq+pmZHlzOftOEJMI1Qsms5WbpUeRPH28fYBQPCnpijVflUqRmDj3NxBUd1/fa2SpY4QH3Wm uOche0MmrUQ9GuFRjFKWzMqYC4FynTYb6xiRTSSQ2Gz2nPdug/n7YCrfxaaJsI0xkwA== X-Gm-Gg: AZFdTZdyvLpftK0/C2RVSEF6BoeGsHgldjdquzh+1bSqD5w7clN9zOf3W3asxquHhcq Icw0aeoIjx9yxTeOBb1a33ps9T4E7D0SeAm7Ksp2klKv3lKwRIpZnhCYr7/Hzbq1qoINJRAfK1N L1Pxey+v+hWRm38lzwNFpk60UoZm0f7kUVlbl5dT4Ax5Q+xpNfBdgy9qhITfF/gLQ8cZOD9AC7d bne4wgeYWfcN5xIWVUggbEQFK4XdNmzQAwGz2mjufnYA0WwmtUzUEWqbViHGT5AvnAM4FqGjrE4 iXRSQhTgOnExilzjzry06/OHQE3IF6qk4WIpNKfR0/mpA7HG9fPBSOQy9CmMRZz7PqOSv9eyV6W gxjZdv+i5E4+W4Ab3L8nf+6J76e5GpMAG/NTQF+JpTW8of5k3dVXxpM6Igd4WBAvmp5FLK0D8tl iXBgFtmsR6UgTjLlXJ5skC2dLw5pbBKz1E7GDmvY3TK5L+ X-Received: by 2002:a05:600c:840d:b0:4bb:6814:738c with SMTP id 5b1f17b1804b1-4bb88820cedmr720173695e9.22.1796063569590; Mon, 30 Nov 2026 10:32:49 -0800 (PST) X-Received: by 2002:a05:600c:840d:b0:4bb:6814:738c with SMTP id 5b1f17b1804b1-4bb88820cedmr720173145e9.22.1796063569102; Mon, 30 Nov 2026 10:32:49 -0800 (PST) Received: from [192.168.88.30] (ip231-128-192-82.pool-bba.aruba.it. [82.192.128.231]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab69bf685asm68210150f8f.20.2026.11.30.10.32.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2026 10:32:48 -0800 (PST) Message-ID: Date: Mon, 30 Nov 2026 19:32:47 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v3] net/sched: act_ife: return -EAGAIN after dropping rtnl_lock in load_metaops_and_vet() To: YanXin Li , Jamal Hadi Salim , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski Cc: Simon Horman , Stephen Hemminger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20261123-b4-02-act-ife-rtnl-uaf-v3-3e43796c4fc1-v3-1-93fa0f782cf4@pm.me> Content-Language: en-US From: Paolo Abeni In-Reply-To: <20261123-b4-02-act-ife-rtnl-uaf-v3-3e43796c4fc1-v3-1-93fa0f782cf4@pm.me> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/23/26 14:31, YanXin Li wrote: > load_metaops_and_vet() unlocks rtnl_lock() to invoke request_module() > when an IFE metadata provider module (such as act_meta_mark) is not > yet loaded, re-acquires rtnl_lock(), validates the metadata attribute, > and returns 0. > > Returning 0 after dropping rtnl_lock() breaks the RTNL serialization > relied on by filter-replacement paths in classifiers such as cls_basic, > cls_flow, cls_fw, cls_route, and cls_u32 (the existing-filter branch > in u32_change()), which hold an unrefcounted filter pointer across > tcf_exts_validate() -> tcf_ife_init(). In cls_basic, a concurrent > RTM_DELTFILTER can delete and RCU-free fold during the unlocked > request_module() window, after which basic_change() executes > list_replace_rcu(&fold->link, &fnew->link) and queues a second > deletion on the freed filter. Generic KASAN reports: > > BUG: KASAN: slab-use-after-free in basic_change+0xf4c/0x1220 > Read of size 8 at addr ffff88800e043c58 by task test_act_ife_rt/101 > ... > Allocated by task 101: > basic_change+0x1e0/0x1220 > Freed by task 57: > ... > Oops: general protection fault, probably for non-canonical address > KASAN: maybe wild-memory-access in range [0xdead000000000120-0xdead000000000127] > > Other TC module autoloaders that drop rtnl_lock() during filter > updates (tc_action_load_ops(), tcf_em_validate(), and em_text_change()) > return -EAGAIN so tc_new_tfilter() and tcf_action_add() unwind and > replay under a fresh RTNL critical section. (In cls_u32's new-key > path, the error unwind in u32_change() still accesses an unpinned > non-root hash table in idr_remove(&ht->handle_idr, handle); that is a > separate pre-existing cls_u32 issue also reachable via > tc_action_load_ops() and is not fixed here.) > > Manipulating TC filters requires CAP_NET_ADMIN in the target network > namespace, which is reachable by an unprivileged local user inside a > user and network namespace when CONFIG_USER_NS=y, CONFIG_MODULES=y, > CONFIG_NET_ACT_IFE is enabled, and an IFE metadata module is not yet > loaded. > > When load_metaops_and_vet() drops rtnl_lock() and loads the requested > metadata module, drop the module reference and return -EAGAIN so the > caller unwinds instead of continuing on the success path with stale > pointers. With this change, the same concurrent RTM_NEWTFILTER and > RTM_DELTFILTER sequence on cls_basic cleanly loads act_meta_mark, > replays without touching the deleted filter, and completes with rc=0 > and no KASAN or lockdep reports. A finite two-thread state-space > interleaving model of the cls_basic filter-replacement scenario found > the old use-after-free and no use-after-free, double-free, or deadlock > in its reachable states after the change. > > The vulnerable code is present in upstream mainline v7.4-rc3. > Runtime verification and fix validation were performed in an x86-64 > QEMU/KVM guest running mainline after v7.4-rc3 with Generic KASAN, > UBSAN, and lockdep. > > This issue was discovered through LLM-assisted code audit and manual > code inspection of net/sched/act_ife.c. > > Fixes: ef6980b6becb ("introduce IFE action") > Cc: stable@vger.kernel.org > Signed-off-by: YanXin Li Broken since the beginning. Most distros don't even build IFE, even less load it. Redirecting to net-next and dropping stable. /P