From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D64FC433EF for ; Wed, 2 Mar 2022 20:27:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242650AbiCBU2H (ORCPT ); Wed, 2 Mar 2022 15:28:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239422AbiCBU2F (ORCPT ); Wed, 2 Mar 2022 15:28:05 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B00C748393 for ; Wed, 2 Mar 2022 12:27:20 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id w3so3866424edu.8 for ; Wed, 02 Mar 2022 12:27:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Uy+qIY61mUv01aVZ77KYqcI4VQ6CnEr5ehBFaIlKwdg=; b=Be+smD91jIehBxsphVP8GxPmG9fZ7UzsziFVI8sCcayH4ghcjVwFadN69qX3SSZZfA w/nKcppYscRVDTynDM99u+3Int1mDvzuW1vHPoDdJ+8JxYLDdH7+xaY9DZL7COnmW4q3 yEVm7FisHcBkdW7xwzBny/SyDipBoZU1ONqUc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Uy+qIY61mUv01aVZ77KYqcI4VQ6CnEr5ehBFaIlKwdg=; b=TwE7u4IjMXmG95RfFYhi6hwq1Ut3biQCScN3cHy43iQE8o72nRxIVcSvMw4iTUHxqJ SKU6+2c8ZASMBNf5L/vgti8wCcun5e2d4NwvrFt+rqYyXuRPELPXgVlZodNVTMrw0E0r 6RLxyBJ+67GDj7AABzOsZeANKs2Qwqsg0PaEr5288ZeFoP7mUE6DudGWFhPU6DEfPU/k eu2oYzBqhhoIwDkpbJEkz5oJS7NU1Pe6m4eYLNza8OcMH4naOVJ8S/uaDzUGq8xelJw2 BWxisJibsm8scHRrOXZnucjg2nnglPyxBeXYDBHs3HnnBxTboqIFXnc5Hw/WSoUcjBt7 P5aA== X-Gm-Message-State: AOAM533lxuHx1N0MdYqOYcpCTS/MYc112H3VmXwBo2XLRqgBBSYY85Ut 4s8JeCdamInUx5qjwAYJaGGLvOxIaSMafilFX58= X-Google-Smtp-Source: ABdhPJwmRRExf7+WbARjDGhOnMPFE7HhaFqbpTmN3PqMr7RZ1ngSY8t73DLxxFk9gOQLn0gQWn52Ag== X-Received: by 2002:a05:6402:42ca:b0:408:ed7:b011 with SMTP id i10-20020a05640242ca00b004080ed7b011mr30718837edc.6.1646252839108; Wed, 02 Mar 2022 12:27:19 -0800 (PST) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com. [209.85.221.47]) by smtp.gmail.com with ESMTPSA id a21-20020a1709062b1500b006da814b08c6sm464282ejg.94.2022.03.02.12.27.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Mar 2022 12:27:18 -0800 (PST) Received: by mail-wr1-f47.google.com with SMTP id t11so4603076wrm.5 for ; Wed, 02 Mar 2022 12:27:18 -0800 (PST) X-Received: by 2002:a2e:3013:0:b0:246:2ca9:365e with SMTP id w19-20020a2e3013000000b002462ca9365emr21092331ljw.291.1646252342192; Wed, 02 Mar 2022 12:19:02 -0800 (PST) MIME-Version: 1.0 References: <282f0f8d-f491-26fc-6ae0-604b367a5a1a@amd.com> <7D0C2A5D-500E-4F38-AD0C-A76E132A390E@kernel.org> <73fa82a20910c06784be2352a655acc59e9942ea.camel@HansenPartnership.com> <7dc860874d434d2288f36730d8ea3312@AcuMS.aculab.com> <0ced2b155b984882b39e895f0211037c@AcuMS.aculab.com> <78ccb184-405e-da93-1e02-078f90d2b9bc@rasmusvillemoes.dk> <202203021158.DB5204A0@keescook> In-Reply-To: <202203021158.DB5204A0@keescook> From: Linus Torvalds Date: Wed, 2 Mar 2022 12:18:45 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/6] treewide: remove using list iterator after loop body as a ptr To: Kees Cook Cc: Rasmus Villemoes , David Laight , James Bottomley , linux-wireless , "alsa-devel@alsa-project.org" , KVM list , "Gustavo A. R. Silva" , "linux-iio@vger.kernel.org" , "nouveau@lists.freedesktop.org" , dri-devel , Cristiano Giuffrida , "Bos, H.J." , "linux1394-devel@lists.sourceforge.net" , "drbd-dev@lists.linbit.com" , linux-arch , CIFS , "linux-aspeed@lists.ozlabs.org" , linux-scsi , linux-rdma , "linux-staging@lists.linux.dev" , amd-gfx list , Jason Gunthorpe , "intel-wired-lan@lists.osuosl.org" , "kgdb-bugreport@lists.sourceforge.net" , "bcm-kernel-feedback-list@broadcom.com" , Dan Carpenter , Linux Media Mailing List , Arnd Bergman , Linux PM , intel-gfx , Brian Johannesmeyer , Nathan Chancellor , dma , Christophe JAILLET , Jakob Koschel , "v9fs-developer@lists.sourceforge.net" , linux-tegra , Thomas Gleixner , Andy Shevchenko , Linux ARM , "linux-sgx@vger.kernel.org" , linux-block , Netdev , "linux-usb@vger.kernel.org" , "samba-technical@lists.samba.org" , Linux Kernel Mailing List , Linux F2FS Dev Mailing List , "tipc-discussion@lists.sourceforge.net" , Linux Crypto Mailing List , linux-fsdevel , "linux-mediatek@lists.infradead.org" , Andrew Morton , linuxppc-dev , =?UTF-8?Q?Christian_K=C3=B6nig?= , Mike Rapoport Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Mar 2, 2022 at 12:07 PM Kees Cook wrote: > > I've long wanted to change kfree() to explicitly set pointers to NULL on > free. https://github.com/KSPP/linux/issues/87 We've had this discussion with the gcc people in the past, and gcc actually has some support for it, but it's sadly tied to the actual function name (ie gcc has some special-casing for "free()") See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94527 for some of that discussion. Oh, and I see some patch actually got merged since I looked there last so that you can mark "deallocator" functions, but I think it's only for the context matching, not for actually killing accesses to the pointer afterwards. Linus