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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A5E8C433EF for ; Tue, 21 Jun 2022 08:47:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A550B6B0072; Tue, 21 Jun 2022 04:47:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DDC96B0073; Tue, 21 Jun 2022 04:47:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87F496B0074; Tue, 21 Jun 2022 04:47:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 73EC16B0072 for ; Tue, 21 Jun 2022 04:47:27 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id EDBCD120B39 for ; Tue, 21 Jun 2022 08:47:26 +0000 (UTC) X-FDA: 79601614092.08.F74EE7C Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by imf17.hostedemail.com (Postfix) with ESMTP id 9563C400AE for ; Tue, 21 Jun 2022 08:47:26 +0000 (UTC) Received: by mail-lj1-f171.google.com with SMTP id e4so14616978ljl.1 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=yLmN3o1bq3VXjk+s0T3t5L0LiVLKgDzVvw9XvhEXUSIkhN0JvHLZr2N2PIIU6ndErB y4LX7KJNT5gmwWWWODHVbry24Jlq+eQcoH23lY+u5lGVl6BUxMAVY1o1BXFt8qVNLvEg yhzJhHW3LetlD5RHizLi6baKc9GtiBfqS8Cfk0jvibBsQNQn0a52CYVh/ncUJCkK8+Sf DVvviGRRO70sKI9ruBmXn4A5RM+OtzV0ECeGZV9dYK2EKXa6VNAkU6vg8kzUpF650bug y0cOrCyXKhXln5yEVcZQk0PR/9wQSRWAY2M9ZgMh4Ibh0UX/t+r4YqTHNtI3BQhCHpW4 kfQw== X-Gm-Message-State: AJIora/fZcYzNWSOUlvNCxS3IVrSqSL5YonxNLdSkReNKUKytcDLyVGn omjMX0n86M+J58LxWmri+OqyNO2EFA0Qxfe+ X-Google-Smtp-Source: AGRyM1tO+LjuM21Aq+uLF72weZdNrgOr4XfGu99LuzUOdAdShSSNsEmOlVEEI5kCXajkUOEiGxXbag== 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655801246; a=rsa-sha256; cv=none; b=zV4F1UbaW7vvlPOfEO6BB7nR88cr+HE6hjjAxqbRyCsQ2sHm81GpHrl9FU2jFqOpZlP/Ko /RTJRiwcrjDcqny+i0QKeV/mPxwmz+Wi7NHcB8TCRfQiVCrxtJc3B5FCL9XeutYwuT77t3 uoXvb+2W+BgpXwzPkZPDmxbkyOEhp+Q= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=rasmusvillemoes.dk header.s=google header.b=LqDbSkS9; spf=pass (imf17.hostedemail.com: domain of linux@rasmusvillemoes.dk designates 209.85.208.171 as permitted sender) smtp.mailfrom=linux@rasmusvillemoes.dk; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655801246; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zfcOaEapxaE9S9vGTGo2ekN6KOzKbUmzU3pXqQnWMdE=; b=NVWGO31RTf/YPxDFqh6HXwdgBW9Ypx5mvRWiSebdkfIqsmekhQJrxrn01GYgXfA9TvW5dC x/DPPPfmKyya0h+5nfuZOUHXD5jbfVjcSTHKFbvCljxQ7jJVbytYrnrkH4tkmgQd97qhyb j+ZhTPU3AFqlpM1BZ7pN61RfTdX1k0g= X-Stat-Signature: t6f5xysyoiyny3awmpynxskb8397ngy1 X-Rspamd-Queue-Id: 9563C400AE Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=rasmusvillemoes.dk header.s=google header.b=LqDbSkS9; spf=pass (imf17.hostedemail.com: domain of linux@rasmusvillemoes.dk designates 209.85.208.171 as permitted sender) smtp.mailfrom=linux@rasmusvillemoes.dk; dmarc=none X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1655801246-449646 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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