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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61719C433F5 for ; Tue, 12 Oct 2021 09:55:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ADEB261040 for ; Tue, 12 Oct 2021 09:55:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ADEB261040 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 399FA900002; Tue, 12 Oct 2021 05:55:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 349F66B0071; Tue, 12 Oct 2021 05:55:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EAB7900002; Tue, 12 Oct 2021 05:55:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0070.hostedemail.com [216.40.44.70]) by kanga.kvack.org (Postfix) with ESMTP id 0BB786B006C for ; Tue, 12 Oct 2021 05:55:54 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BA9D1181CA75F for ; Tue, 12 Oct 2021 09:55:53 +0000 (UTC) X-FDA: 78687328986.28.8F27DA1 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by imf08.hostedemail.com (Postfix) with ESMTP id 2744530000A0 for ; Tue, 12 Oct 2021 09:55:53 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id i24so83540020lfj.13 for ; Tue, 12 Oct 2021 02:55:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=HSIt69mqAZvpGyGaQQGtM8pTYMZz2BE+p9Ayk8LzL4Q=; b=ioVVsow9IIzcRU4SHB5qjWK15eUKCBaL2kR2LHmJ2F0BeDeU9V6z7wD5oz99g23s96 cPuhODgjSmy5iMS9skdHqnt7goz0H3tpcdvhJbbWI4flSZNeXvxgIKLWdp1n6+srton+ 4rqOuY8WsG9LXsiv3t29m1znMaShmSb+H4pCY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HSIt69mqAZvpGyGaQQGtM8pTYMZz2BE+p9Ayk8LzL4Q=; b=umE0lXUshhJNnDk8x1y9pGM+ngoeCNZ1pVivH0+CFuqbjaSOGsWAmEOxRfSYtnsuM6 gajrN11jxlBDDanE8DE6NtkTfJ/vBatRzij8y3tj6ARkbp2t6TtvfcWdkHt0NlB3YTBw V2dHMtVc5yMAmjJmT3AotD8GfpvoR0m/Ov5JlJGZxJS/8V8d3SoHljyEcNegUW4PB4ra hACZhX/DIMORCEm5u7UGj0AJYkstE5/uC6/1aqh1tUwJsjIlgNJco1wLo4IBuhvLc/zG HHAu0pq7W3nc2LReCUxgXC3LVMuNUbmDI7NNK5rQFimjWgZdDNJO5PQ0JnKuZ0RCTsQ8 3T5A== X-Gm-Message-State: AOAM5335VjPbZMefYHyhFHZasuyP9G9iNoWz0UKvAtSdMOj0Wi+IoOZ9 EPPOV7Zr0VVJKL0DXTEiwKD/Gw== X-Google-Smtp-Source: ABdhPJxWuc6ixQqup+Qn18fZe9fyharnKbhO/pR0ILaCiXOG26dYw95x7rMxkp0gSoYXJ89zfFzqxg== X-Received: by 2002:a2e:9c92:: with SMTP id x18mr1341587lji.445.1634032551248; Tue, 12 Oct 2021 02:55:51 -0700 (PDT) Received: from [172.16.11.1] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id 8sm1115158ljr.10.2021.10.12.02.55.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Oct 2021 02:55:50 -0700 (PDT) Subject: Re: [PATCH] vsprintf: Make %pGp print the hex value To: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Vlastimil Babka References: <20211008193829.849532-1-willy@infradead.org> From: Rasmus Villemoes Message-ID: <1093c8db-5d96-18ff-cb27-e74cddb757a4@rasmusvillemoes.dk> Date: Tue, 12 Oct 2021 11:55:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211008193829.849532-1-willy@infradead.org> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=rasmusvillemoes.dk header.s=google header.b=ioVVsow9; spf=pass (imf08.hostedemail.com: domain of linux@rasmusvillemoes.dk designates 209.85.167.50 as permitted sender) smtp.mailfrom=linux@rasmusvillemoes.dk; dmarc=none X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2744530000A0 X-Stat-Signature: dr7y4jtdrdphoxhxs9mckdycimsf5gpz X-HE-Tag: 1634032553-722394 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 08/10/2021 21.38, Matthew Wilcox (Oracle) wrote: > All existing users of %pGp want the hex value as well as the decoded > flag names. This looks awkward (passing the same parameter to printf > twice), so move that functionality into the core. If we want, we > can make that optional with flag arguments to %pGp in the future. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > lib/test_printf.c | 2 ++ > lib/vsprintf.c | 8 ++++++++ > mm/debug.c | 2 +- > mm/memory-failure.c | 8 ++++---- > mm/page_owner.c | 4 ++-- > mm/slub.c | 4 ++-- > 6 files changed, 19 insertions(+), 9 deletions(-) > > diff --git a/lib/test_printf.c b/lib/test_printf.c > index 55082432f37e..32d748d1ae02 100644 > --- a/lib/test_printf.c > +++ b/lib/test_printf.c > @@ -614,6 +614,7 @@ page_flags_test(int section, int node, int zone, int last_cpupid, > bool append = false; > int i; > > + snprintf(cmp_buf + size, BUF_SIZE - size, "%x(", flags); This generates the hex value without leading 0x, however... > flags &= PAGEFLAGS_MASK; > if (flags) { > page_flags |= flags; > @@ -648,6 +649,7 @@ page_flags_test(int section, int node, int zone, int last_cpupid, > size = strlen(cmp_buf); > append = true; > } > + snprintf(cmp_buf + size, BUF_SIZE - size, ")"); > > test(cmp_buf, "%pGp", &page_flags); > } > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > index d7ad44f2c8f5..214098248610 100644 > --- a/lib/vsprintf.c > +++ b/lib/vsprintf.c > @@ -2023,6 +2023,11 @@ char *format_page_flags(char *buf, char *end, unsigned long flags) > bool append = false; > int i; > > + buf = number(buf, end, flags, default_flag_spec); ...default_flag_spec has '.flags = SPECIAL | SMALL,', i.e. what one would get from %#x . I'm guessing that's what upsets 0-day. Geez it would be nice if 0day actually reported the "Expected foo, but bar was emitted to the buffer". Rasmus