From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 BDF6D5234 for ; Tue, 11 Mar 2025 00:35:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741653358; cv=none; b=VSp/KpDnSOWHcrJTsCEvDletc7k3dNbN493PJFT9kAo1CSuP7Bi40KGwl7Yg44kRPh/phChOwDt0SWsrtTHZ96Nmg+yfBll8NQrMPtIu8JDnDBo4CdhzPjdLoleqhx09o33PCgquFlHkTLHJMvBeXifofUoXpFXA8oruPfAewTs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741653358; c=relaxed/simple; bh=ok9fQkjTAJT8maHeXtQN58QU2aGw86+f2bDLzty8qRg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NSisTD5GuTGBuZ0ikTuVv0MRqquN1b/MfzpLGExJIdsYCShi3k16T2/O9yWWkhjRA9ZjXVsWXn0F2DZh9o59H65ybU5y3FskpvXchTjcs7sLa0oVsIbig1hvcvj4Twe08V96C3UOJDDXdxleDi4DPF9vqZmpvO2nm1ouv0N4jNM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=NkzqL8m/; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="NkzqL8m/" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=i+tciCSY+qLhnWHcqp4RtdeinAR7d+E6IEhacthVhOg=; b=NkzqL8m/fNT1SrziU4OYXXSiVw OM/WY+f/+pAm/rMsaZAGr5ddqzg7KI0Xjy2RBBtj8Q0u0n88N3L4TiYxnZh4fmQ8oVgLIPnF7v6qD XOSfllDC2TACwUB0VK3LDqSQWut52VxvQjaTBS7vD2jHINgs25u7Bl56Q1uPeT6UrnqYbdfgBfSow rTTYUP39SVJPQw5m9wbODYpOIMkMSjRO1l8pFubOHshYi6oIVYS73dArwuxumwM9QGkUyTGMp4dlC vwl5Zr1W8ajlqv/JCOYH+ztOcRUQr33iEMyNwRDntDJEWW+ZiPX/0lUGCkz79YrQ+6EX2xp+2yyKh fYDblx+w==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1trnb8-00000002xHy-0erI; Tue, 11 Mar 2025 00:35:54 +0000 Date: Tue, 11 Mar 2025 00:35:54 +0000 From: Al Viro To: Amit Cc: linux-kernel@vger.kernel.org Subject: Re: Catching use-after-free easily in linux kernel. Message-ID: <20250311003554.GN2023217@ZenIV> 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=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro On Mon, Mar 10, 2025 at 01:24:54PM +0530, Amit wrote: > Hi, > > We can catch use-after-free easily if we do the following: > > kfree(x); > (x) = NULL; > > Now, if someone uses 'x' again then the kernel will crash and we will know where > the use-after-free is happening and then we can fix it. That assumes that no pointer is ever stored in more than one place. Which is very clearly false.