Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp978814lqs; Wed, 6 Mar 2024 02:37:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWWp512qMCwcnw2pjDJvhzJH+4b/mDX4eR5bnyOR09l/5TiO1GXcvtPkpB/A7ThYUSkIwfWTirnAcA9nKuN1FD3lKvqND778GFWnX4rAw== X-Google-Smtp-Source: AGHT+IE0+RZcvH/e24MDxYRNV5MrkkyxEPy2KYDrTFGDTqRHwUf12TUO8WsotCYEHjtiW/8a0TWO X-Received: by 2002:a17:906:475a:b0:a40:4711:da20 with SMTP id j26-20020a170906475a00b00a404711da20mr10589981ejs.34.1709721455790; Wed, 06 Mar 2024 02:37:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709721455; cv=pass; d=google.com; s=arc-20160816; b=KpATB/BECdpm4BQcnIj8j56l3o0JRF4KSlfTE3BdhXIv3VKE+lC4RluTUSC5/f+/cm KWqXFPPezX4vn+zeKrc+SPDp4Nvd1dtUpwuthGYXQbQOhr9NdvADiOavMdrQ3GfIS7MG Cw1a4CJRXov25O6teV8zu5DFSXmSeZ0MouFs/4RHVsmu15syE9wq17z9qSOLRr0EUeIN UzXgu9aRFdyGKBllEeBMciLQraGJcr4Yivdyp3Y7KK+ejb62ejFvpNzUq8OSXyqC66+l wvuNO+B19GG+jTw1htkQeodH9d3NztQFGBzDGLGos++n9Ps+Zsk13KfiVKF2Y+fXHp84 6+2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:references:message-id:subject:cc:to:from:date; bh=Csgk2PD524oiltXdY8ONjcG2GRTyueheYJQ37AGQ0W8=; fh=5d3nbJx+euJQ7FlQJFOy8uHyZ2SFm/CYmi3wVRcF0pM=; b=fBai3AySPxUpyvI5YHULLu7+UvH6SoAVVUVqNGJTpluFn+Jk++9mU4lqpTYk9zllF2 YbSCcDEp4HwIA4kR0yk8oQJ/1jGZ2U0yss6E5WJmzIS7yK2aqaUUKFqpVBZ9RMcvngKb +cOTAgPKtP2exqnC8ooAFPWUf+OwsJ3X2hDXWxUZ8Pm87JqzXKC6ZD9ShB7mJtAsubIl 4fBGJlxlh1Vn4pbeV34SHkepYAlSUp8kbJXiRvjDqhaUZcFlqJnEK3wMHxcKw9DAfCY7 /NvapE4vz2aETXVJfwW1zcpw6VHIJR8p7Cy2Rf8NnWo81mf6Rd9ytWHrWI9egzaPUZX5 OFOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=strlen.de); spf=pass (google.com: domain of linux-kernel+bounces-93776-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93776-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o24-20020a17090611d800b00a45c012f66fsi241466eja.786.2024.03.06.02.37.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 02:37:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93776-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=strlen.de); spf=pass (google.com: domain of linux-kernel+bounces-93776-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93776-linux.lists.archive=gmail.com@vger.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 am.mirrors.kernel.org (Postfix) with ESMTPS id A62041F22C16 for ; Wed, 6 Mar 2024 10:36:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 194A8605AF; Wed, 6 Mar 2024 10:36:42 +0000 (UTC) Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30]) (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 77E22604D7; Wed, 6 Mar 2024 10:36:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.216.245.30 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721401; cv=none; b=vCeQ9ZY2sjOJe4l+E1R1zn84rr5e/3ARZ8EEZh/Hb7Lp2qK4rYl/haqGPT4yI/iqqzCt7i/xx9i/xfVwWcOf4YEMS+9zcjBRYI+Zoxcseix3VlRNGYgyeFquQou806Mw4NuZLWVd68CJ89t3vA3DDLsMdp6ZSEEfmQxVtpLw+Ek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721401; c=relaxed/simple; bh=N6jX8ADXXK5aXnOAfJU8uWTNWIUA6GVIw/zP4wxmiGQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mvi5KTf9l4mIYsfvkG37vw6JfpysY1raBQgOMe4z6KcH/Ow8VRS40Kixvs7PC8NOQqnfR7CnLL7NlP98Ldh0Ww0/RrjIckBg37ns1FwdOW0DctreJGDjiEHuJxrDZh4awBikJ4cL9gwc15Gxo2NfphUPqLU4AKIC88/6BnshDeM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de; spf=pass smtp.mailfrom=strlen.de; arc=none smtp.client-ip=91.216.245.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=strlen.de Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1rhodU-0005vI-29; Wed, 06 Mar 2024 11:36:32 +0100 Date: Wed, 6 Mar 2024 11:36:32 +0100 From: Florian Westphal To: Eric Dumazet Cc: xingwei lee , Florian Westphal , pabeni@redhat.com, davem@davemloft.net, kuba@kernel.org, linux-hams@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, ralf@linux-mips.org, syzkaller-bugs@googlegroups.com, samsun1006219@gmail.com Subject: Re: KASAN: slab-use-after-free Read in ip_finish_output Message-ID: <20240306103632.GC4420@breakpoint.cc> References: 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Eric Dumazet wrote: > On Wed, Mar 6, 2024 at 11:00 AM xingwei lee wrote: > > > > Hello, I found a new bug titled "KASAN: slab-use-after-free Read in > > ip_finish_output” or “KASAN: slab-use-after-free in sk_to_full_sk" and > > confirmed it in the latest net and net-next branch. After my simple > > analysis, it may be related to the net/rose or AF_PACKET/PF_PACKET > > socket. > > I already had a syzbot report for this issue, thanks. > > Adding Florian to the discussion. > The issue is cause by ip defrag layer, which calls skb_orphan() > These were my notes, I had little time to work on it so far. > Calling ip_defrag() in output path is also implying skb_orphan(), > which is buggy because output path relies on sk not disappearing. Ugh. Thanks for your annotations and notes, this is very helpful. ipvlan (and two spots in ip_output.c do): err = ip_local_out(net, skb->sk, skb); so skb->sk gets propagated down to __ip_finish_output(), long after connrack defrag has called skb_orphan(). No idea yet how to fix it,