Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4862903rdb; Fri, 15 Sep 2023 15:00:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+U0Wh/ie07GVL1XY6Mh7JR9+WvaBfDJOaL1Evxmxe51QXXPWWkeSndUU7jubWBTMckVZo X-Received: by 2002:a05:6a20:7f9e:b0:149:602e:9239 with SMTP id d30-20020a056a207f9e00b00149602e9239mr3937417pzj.21.1694815223242; Fri, 15 Sep 2023 15:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694815223; cv=none; d=google.com; s=arc-20160816; b=Dq6k9wr9dhLy9ftU2aB+DvkBU63Kp1lzDx6hYrGLCuBGpKn1M0TskT/RZA+nldLH/u OFrblyVdxo+CRC/RenN59zPNrZ0COoDYrYqMRnwuE6tjDbYEl6H2JD8NHNbKozjULRlU iKRXztQeYvJ8kCoYzcSNrbj//6oXJbLLfw2cO+81nQ5ng0s5g8v1jIbzpJXk80NdnsIa fGwL0RY4u8DmpfZtRBU8JCHYNCs/3ZhzyaQbcDcgYBW0E061qxRq5rd7iWhe7QjgEiJ6 g4lwTu1c7RGtdX0yueqaClfCqv1gfA6PSQ5o0tRvropwYTSjnQqLthvBVevGF9jAvUgW hvNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=g2RWBQs5T7WlFgpSGFhWkY3V6/ADmjD9odSx9zwtedk=; fh=XLWKiPDrZGhiEM+hOXfSQBOlYEOnArDa/BCmgDziCUk=; b=iGQajGCPI7Pg1DykmyODfbJEjW9YdrFntnBYdgC9vkDxTS7UCE1y8Su+MXpYY6lj8O sa0tDQLXwvGXjofsucgy1L29MEikzghqwj7dKfwaWjZrOyBvRrGm1Lhd5rOzTrEkN7og 5UlqnLsowJub1HHyXjjR0ZX8FagzxzDpFrBn52OzQD5llgaIykjncrYQQtRD90TPLtbj MputXduwwb6JbxxAMfi0epEnVE4IvTO0nNMCCVW9D4sSo2ZWqLVsWc53pn91j+NfoD8F L3EfAV6oKiJuOlsfWXrBqTRIsnmxdZgY6KLZvE36MEyKD+babPtoTbJi4wHU/pa1RUqt mYpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BKqeG12R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id t17-20020a63d251000000b0056c55eb251csi3782533pgi.123.2023.09.15.15.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 15:00:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BKqeG12R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id CCAED8080EF9; Fri, 15 Sep 2023 10:23:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235526AbjIORXP (ORCPT + 99 others); Fri, 15 Sep 2023 13:23:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235812AbjIORW7 (ORCPT ); Fri, 15 Sep 2023 13:22:59 -0400 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7B9BC1 for ; Fri, 15 Sep 2023 10:22:53 -0700 (PDT) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-59bbed7353aso33433767b3.0 for ; Fri, 15 Sep 2023 10:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694798573; x=1695403373; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=g2RWBQs5T7WlFgpSGFhWkY3V6/ADmjD9odSx9zwtedk=; b=BKqeG12RUC2P6P27TdIGj2kcFAKtz0V1WMD4fw7YQBhg6a/ISIfhIPexmxFw8KtxUO FKfAanKwp4kZ35JtRWlbeeMojHCzExkqVHirUC9qwtB9eVu0HAFecunUZQuWEHACHCbL 8Asnl8Is0LpZ9TrT8hwoPVziChX8/1e4d5uxzuTc7DuJfOnZ9kwRVg7dwqOufMyknRyK VczGBgRiUFM6O7eZVVmXlJKzBFcI4kiKw8Vp3d/VRJqp5ppDsDan+LI5kkpzGhl7DVDN KqGTb+vVZCX1qwlAuixGVY1l2/CvXSRCeWDnZcDmKUXSowL/+60hL/ZUWPAPYpPqpZs7 dctg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694798573; x=1695403373; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=g2RWBQs5T7WlFgpSGFhWkY3V6/ADmjD9odSx9zwtedk=; b=Jk9Jsr2oQplxnvPnqGfHooT4eUZkLPeLjSCrveB39Rr8KYevGf/n4P0cv8zgEE7TMU Jjt1ahg/OnvCUtJAGemSuyN5FL+M7m9Rsx2cZAbscQmfF9IDo34Qjiy31754AhE9Lvt7 eikEzF7T4OrXT0pmDDzn6rCgjkh4HxFMx6T/kd+qaFiBr8WpXfnOlkwasKo0ATkEi07x e1CY0L/arJB8C396VPZFQPTO5pTN5TGiYFVxLbEROHHVOXHYNArJNH0O3OxVfSzCELyd BC7FogYjXRq0lm/OQ+jGTPXp8GJ7yxj+hq23eymSqWFuaD4FuB7HNt6Heh+q7uqwO817 vIjQ== X-Gm-Message-State: AOJu0YzBPiu4MWntBnETgYIbN7efperBqS5HJb7U6PWsz77QTQjRm/Eb iySRP9RTmkqPwdM31iiipO3dFCU/2zjjm8UFQcqJJ+fW95R9I349 X-Received: by 2002:a0d:d653:0:b0:59b:cf74:ee8d with SMTP id y80-20020a0dd653000000b0059bcf74ee8dmr5997877ywd.10.1694798573063; Fri, 15 Sep 2023 10:22:53 -0700 (PDT) MIME-Version: 1.0 References: <07c32bf1-6c1a-49d9-b97d-f0ae4a2b42ab@p183> In-Reply-To: From: Bartosz Golaszewski Date: Fri, 15 Sep 2023 19:22:42 +0200 Message-ID: Subject: Re: Buggy __free(kfree) usage pattern already in tree To: Linus Torvalds Cc: Alexey Dobriyan , Peter Zijlstra , linux-kernel@vger.kernel.org, Linus Walleij , akpm@linux-foundation.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 10:23:49 -0700 (PDT) On Fri, 15 Sept 2023 at 19:04, Linus Torvalds wrote: > > On Fri, 15 Sept 2023 at 02:56, Alexey Dobriyan wrote: > > > > __free() got some usage and some of the usage is buggy: > > Yeah, that's sad. > > I think the '__free(kfree)' thing should *only* be used in the form > > struct obj *p __free(kfree) = kmalloc(...); > > which is what our docs mention. Anything else is simply buggy. > > But how do we *notice* this? > > I do want to stress how I was unhappy about this conversion to begin with > > https://lore.kernel.org/lkml/CAHk-=wigZt6kVkY0HU1j_LJ5H1KzwPiYnwwk6CbqXqT=sGenjg@mail.gmail.com/ > > but I reacted to the wrong issue. > > This stuff needs to be done *way* more carefully. > > Linus This is why I started with a *testing* driver. It's got "simulator" in the name for a reason. It doesn't deal with real HW and is mostly run in VMs anyway. Few people even build it at all so it makes for good testing grounds for experimental features. IMO this feature has much more potential at fixing existing memory leaks than introducing new ones. I agree, I should have been more careful, but I wouldn't exaggerate the issue. It's a bug, I sent a fix, it'll be fine in a few days. I hope it won't be seen as an argument against __free(). It just needs some time to mature. Bartosz