Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3611966iog; Tue, 21 Jun 2022 02:17:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uMX1lxO4V8wCikcA+S4AZstnu/SxvVZIJJVEker07PvThNCqTvCMJF93OIxo00L3AdAtKw X-Received: by 2002:a17:90b:508f:b0:1ec:a212:1e41 with SMTP id rt15-20020a17090b508f00b001eca2121e41mr12121849pjb.226.1655803036786; Tue, 21 Jun 2022 02:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655803036; cv=none; d=google.com; s=arc-20160816; b=kWkISDMMOqrIYXChgRmJosZICqEXYTm1Qliy4kvkSEY/kWJSqicGUxtq9MbN4my6iM tm10S14mWL4Yo0z0sUMjTpGL15gvapZa6nc/2CgkAdOygkS6gJ08pUIdLBrScqZB9akh M5woa8ydhZJL4PBQt2u2bxhQrgBqquGboRcY6V0brhZ66AENPYgqDDvWdzd3NetKjXQ/ XJ4B6uV/apDylzVgWt1nkannACUSCNOm7jgCc6Mv1g+FrMzl2rRlGgK1AM2fe9tKL0nz J1c+yiDvKDvOVwvAqodQYa/j7EwOHHT+QOh0ggateSwhYQTH9MyUc2NlUS6JjVTSuqDU zpwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=zfcOaEapxaE9S9vGTGo2ekN6KOzKbUmzU3pXqQnWMdE=; b=amh4M5w9B9W252WeJ/r+682P4xogVwwm9rQzMLaqFUM/sHeMYZjZIjGiy8/H8yvY+2 k4WHAjjhxWBrZWZez5Mtme+KRVk1btm/eOhTZIJNCgKSvaBWT8V5K8dsSBvXONb2X6jo krJGAVkO0I/FdYCzAMwoQCSYsl0qmXmkfy7YGvuOVhcRDhRYuGGMIYjQSxKD55D5V/7e 3qGMO6gbzNoNfAK8vgEgk/k5Ej2nlJsSVg/FW4QOqMAOiayyC8dFktP6HQ0TI0PSGskV T3TH2vfYjBzIfN9+BEHs2uae/VJ0EPaH2jhNtOmoZiY304bBuKBFkVHuLXBeghOzWzjq c3Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=LqDbSkS9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a170902e80500b0015d29ba7843si21126578plg.262.2022.06.21.02.17.00; Tue, 21 Jun 2022 02:17:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=LqDbSkS9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348406AbiFUIr2 (ORCPT + 99 others); Tue, 21 Jun 2022 04:47:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbiFUIr1 (ORCPT ); Tue, 21 Jun 2022 04:47:27 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A78B52610D for ; Tue, 21 Jun 2022 01:47:26 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id k20so8205658ljg.2 for ; Tue, 21 Jun 2022 01:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=zfcOaEapxaE9S9vGTGo2ekN6KOzKbUmzU3pXqQnWMdE=; b=LqDbSkS9NFzOkFGxfenpQv+DkPMsaj+d7E6D7gghLD52dzHu7LPrKJntN0xJuGtI5x Rc+SgNDXG8zJx+Y4mTYngrQl8PRNAV/DdDQlPxhODumpGxmQINJEVV6Lbg4s2iVP2xZb mZbW9rjb9c0cpNXlBKSxbO+6rlAUifh0y1RFk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=zfcOaEapxaE9S9vGTGo2ekN6KOzKbUmzU3pXqQnWMdE=; b=xkhuv/MgYoRRVlyPl9uB6GKOh4sF70ykI67bRdncHlfRxS2ApzVZn++Dou/fpuR6qt CSbDtppfyQQXLvUFzJBW80WPgP5G3NiqJNYP1i3qlPfkkpxX75wKnRNHvYgPyu0gMosp 8NkUdvVvS6arwMUvtRGzTzapZhbbSvQ8zy2Kard+4Y3/F0XpUb1cGSlFjZSb+aC3Ebq1 w0JcR+THorJYLSOdEXyZP4Dj5n54GAOfmw2BaEHAgG9pE50yyldrfyJa4ekzaQS396pp otO1wCRNze6rAYoExj89RCmC/X00sODHqEz9VdRVGaFsrVt3w8M719DGXRgBOnC9a5x2 vJ0Q== X-Gm-Message-State: AJIora8N/pI2ntWs3yqFbYyNi6tuwitWuv9s9q4G4LlVXIV3e5C+ZqeW h89gLNih7SZZnQWyaVU1kaEGFQ== X-Received: by 2002:a2e:3516:0:b0:25a:6505:4d12 with SMTP id z22-20020a2e3516000000b0025a65054d12mr7118972ljz.83.1655801245030; Tue, 21 Jun 2022 01:47:25 -0700 (PDT) Received: from [172.16.11.74] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id j17-20020a2e8511000000b0025a724f2935sm494272lji.137.2022.06.21.01.47.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Jun 2022 01:47:24 -0700 (PDT) Message-ID: Date: Tue, 21 Jun 2022 10:47:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v4 05/34] vsprintf: %pf(%p) Content-Language: en-US To: Kent Overstreet Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, pmladek@suse.com, rostedt@goodmis.org, enozhatsky@chromium.org, willy@infradead.org References: <20220620004233.3805-1-kent.overstreet@gmail.com> <20220620004233.3805-6-kent.overstreet@gmail.com> <20220621075159.m67qzftqulvphivw@moria.home.lan> From: Rasmus Villemoes In-Reply-To: <20220621075159.m67qzftqulvphivw@moria.home.lan> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/06/2022 09.51, Kent Overstreet wrote: >>> struct printf_spec { >>> @@ -2520,7 +2521,16 @@ int format_decode(const char *fmt, struct printf_spec *spec) >>> return ++fmt - start; >>> >>> case 'p': >>> - spec->type = FORMAT_TYPE_PTR; >>> + fmt++; >>> + if (fmt[0] == 'f' && >>> + fmt[1] == '(') { >>> + fmt += 2; >>> + spec->type = FORMAT_TYPE_FN; >>> + } else >>> + spec->type = FORMAT_TYPE_PTR; >>> + return fmt - start; >>> + case '(': >>> + spec->type = FORMAT_TYPE_FN; >>> return ++fmt - start; >> >> NAK. Don't implement something that will never be tested nor used. >> There's not a snowball's chance in hell that we'll ever build the kernel >> without -Wformat. > > We're not stopping here. Matthew is taking this to WG14 and I'll be working on > adding this functionality to glibc next, and %() is the syntax we intend to take > to the working group. > > But the working group is naturally going to want to see that a working > implementation of it exists. OK. But implementation in glibc, musl and/or the kernel is much much less interesting than support in gcc and clang for accepting %( in the first place, and preferably also for not just treating %( as a synonym for %p but actually checking that the argument is a function pointer and that its signature matches the arguments between (). Once _that_ has landed in gcc 24 and the kernel requirements have been bumped to that can we consider adding "%(" format strings (and the necessary support). Yes, I appreciate the chicken-and-egg situation. No, I don't think the mainline kernel is a suitable place for proof-of-concept and highly experimental code. Rasmus