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=1796063574; b=Q6HkTKcWXc/w5j9l839Leu5GfMGbMMUkJ9CL1iic6qoF8CWy1XyQGvSyR2Qo1Rt7yJT3 JrGczwI/iolblzDZa4G4PRh0pkRQwN3HOP/jKTGfJeGPYkkYLams2yGMDqVm+Ny1no56M 1+X3u7VEpydWmg38jaer+Sq52ML9w9US7QptNTNhHwM0fNJ1BpRRkifOQWJKHLr2GfeWl MU2VURK9MOLEAQNndZbyj6GJNploSb31bDunn5szaxNDtG4Z/TRvJwio4CgVLnhiSnRwA wr5c0a+XLqXXnD9PN+46beNlKYLpKyXkrTpSb21Qe9oeIkOmPPsRnLmte/6GAG8C6bQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796063574; 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=w44bPrMUj52vOpM0moVU/WGlQpbhsE4NX4scFtqUhJEmtAvPXqEPxlq/FyYhEnRFHC/Y MrjsC6DhERH9krTItoOY2ABrT+P9SidiwOHooahqx4tytoPPNaiG5oHExuw6iPZDskxtx uLTD9ktmUtXXyBkWG6zPsovRbw69VaNCJbLEFwLP5m+tAXLJ3nILw2u4WZ3iQQY12rliw GPHiUouS1EtD4wyGOBrG8iVOwuH/lAf7J3/B37F/z2k14pEyrofEuRtHPDTSOyDK1SJMI RyaNUy4+ggbD7xsewNgVfhPrEFtluSv1H7OQOf9OeImko8eo6GbR67iYcF5ZMCw8OhQ== 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=Tbkd8WqR; 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 36B10606A338 for ; Mon, 30 Nov 2026 18:32:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 36B10606A338 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) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Tbkd8WqR; 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=1796063573; 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=Tbkd8WqRVpxkE7GDAr1V3BiPYbXuEDa6B9GIp6QmDnjdVlsBHXzVN20mlCKWz+gMAs8ZZf OEuwYe+usRaE2oFFojc4C8+XqvO6Sx2g6OTMopG+6Ni/dfoA7dVGD2XRXljFizfYY7uplG +sclv/kIztBUTtJMuai7dXDiOoWc0/U= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-311-l16sCzgzOdS1IMN3ssefGA-1; Mon, 30 Nov 2026 18:32:50 +0000 X-MC-Unique: l16sCzgzOdS1IMN3ssefGA-1 X-Mimecast-MFC-AGG-ID: l16sCzgzOdS1IMN3ssefGA_1796063570 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4bb680f0ac4so76889415e9.0 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=g3/RbOJ9AVYSdR+D6LOpEua+1gcZqm0hDShUd6XpsYPApvdcJz2LYsArH6mnL0knPP MZ+kPUcEpFzK/tmwg9PE/uTl5zHKh1ca2sAKssglfxTkUkaCrMRFfSeoaB0uJ9IFqcof KvLvPLHGiQyT2Qun5NLzBiTi64HRiTzo5xpTYoFXpZWgnMvR3iHXQKbQCZoApoSGFNR6 VtXFhwG91iFyanwIplCFSHEdOsJKfybMbjSSrs118/0zHPJqkEsiNQvMGevTntFqC6Gh 9Xi4WM4QZVhOrZKGQMUgysFwsx6RWnJpQ55WVqvlB+l8hBM9pz230msQYl+SxWZptz83 nkKg== X-Forwarded-Encrypted: i=1; AL+hErHe1Jy3Lo0c+VUqCLenLQ/FXsNwsWBv92D1gHztsGZRoR5hUzT2a5IzmeEGljWzI2UCfNzEbLw=@vger.kernel.org X-Gm-Message-State: APuU4Z8GACT/+JyPkxBk+kA78uISNlxvDQ5hfwcLcYUkMpV95NKXeSj7 l5yx5kQ+JBaXbviqvNlv2HPRqPaV8ZWEJtNi9JXCmB4g8OTbjtUU1A6gc5sBgbYvPRM1IdPbHgP pBjMtwQizkf3S124PB/iUcTBQVskq+5vMaM0cHqACeN9F+n58d+zFYtpKOA== X-Gm-Gg: AZFdTZci8HMEUj7KcO/GtCL5EFk2ApOAebVMzodTOUamu7JuOD+pun2UU0LUOmql7GU vfO8B8NBzS6IKNYy/JWRqmab4fQNuuVFNI4UYzGqIcN3aq5a4kidwN0NEXOhFSWGiptfU0IULaZ F0YznulWmZsVBp3yu6TkAt2pCSI2XL3EsuOZY1pet138wAvU4Mseqs8nZNjSE2DC8LRzYZ41QvS 8u3rHNwpjl7Omcpm7h/5oIKlrzAOEGKnfTuj8bxGiiaDsv+zlUJwypdNV5RBLgOKG05elpUa76x TOaJ8el3O+Im1fGvJtBmNUw9++QdaCP8U1/h21Gs2qdr0USN9lxzLcamQ3YZz37thV4NWE5j6je qIP6GR2/t7mEP/R2r7SRD3aMb4tLsDiRgSXWkK5UKSXCM/HxX+e8AfXDjEwKyEoPjfKYa76wGd7 AydBeRpoJ4VMkKkuAGOSjpOh4iq4uSq5PKMu4SD4hsrTGc X-Received: by 2002:a05:600c:840d:b0:4bb:6814:738c with SMTP id 5b1f17b1804b1-4bb88820cedmr720173705e9.22.1796063569598; 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: netdev@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