Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2533541pxb; Fri, 5 Feb 2021 23:18:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMd7ae8w7E5qR6BtX2A2b/wI6C96k+g4lnqtgyUnd4JW6R40DJ7yptkFk1jweDewfcdkz4 X-Received: by 2002:a05:6402:1c0f:: with SMTP id ck15mr5909164edb.16.1612595905442; Fri, 05 Feb 2021 23:18:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612595905; cv=none; d=google.com; s=arc-20160816; b=yvP82ylsGTH2rvYtHboEnnPK31q2Il3/Ou3KoXcbGzIfrUGGIBJHc2fy3vRd5Fohzc i5uewBbb07WJiAHpSwLmhUGGdojqTl8fjd1cGYhkHqHXPC/t1HGRFHoN/rIBCPvAgl/9 nzcpy88Nbi/5xVd19tmxFv5AkxW/3jqXxQN/Ah5OxUYcjBha1sQC9bCcRsdTqcDPMjki 7QUpEMT5JJU3e6g0QKY0JHYZhuL5mUh8uPIYvYRt3VPrPdaxNtELPbBSKCz9nGtFtyNn R1uZk5+4SjV4+Coj+zdVuJ4kPCwOYsMNgfph8X4WksxDoTr5uDvt6iKSq/AXbCzf8Ao5 IGfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=T09gISfgvCrrwtlimprT5aWSXzcVp8Ktq92cEGyZG5A=; b=qK4chJYZc5g30dY41Qpbr/4iBk45Kzbcl4OmGr4O5VgbX48ZQOswE2hz5bqJbTOkqz A8+c3k7n8hiXCfWbQ4COd7xzvlAxiWrZxp7c+zT2ODaLqx4D8eED98uhudRdIo3REwAT NU0hRB8Y+0irblylRd8vDQrQwP/R6fsEIPPUh7oSKNZcRp19VPYjkX3EDsMWx2xvcDf6 cIE+TriApHNhXHXGtHlBYIgFyjXU9R0I/w3szjCFBsLCdcQ+CTQZ8e0Zqru8sFby7uaD 7sGzMRWvh95WVRL/rMWqZgEeaj2Q+auR7jbTbdVNb8UcdVMvaPbuwKwjuoEDwJGO+sUF MpnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bfdy8GGA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si7179661edt.118.2021.02.05.23.18.01; Fri, 05 Feb 2021 23:18:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bfdy8GGA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbhBFHOm (ORCPT + 99 others); Sat, 6 Feb 2021 02:14:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:50242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbhBFHOj (ORCPT ); Sat, 6 Feb 2021 02:14:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C94FB64F9B; Sat, 6 Feb 2021 07:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612595638; bh=nuSHRF9OudOjXsyAgzF1fbrlfgZwD78OhCatWB6lMhg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bfdy8GGAvV1JvU8U8TipoZKPpm+FV/xETSJFvJVGOnp9jQ04zVIPC7tfY4/0Dtpx5 rr0Wdc6jhXyMWnS95gt4Wc0D3QTOXQ6LA+4tD0Jc5KvcELwoYJLlEJc70W4iduGJG2 pyiOCZFOJJcBGG2jUQ+axSw270/h4fj4jq62kGiM= Date: Sat, 6 Feb 2021 08:13:55 +0100 From: Greg Kroah-Hartman To: Chris Down Cc: Steven Rostedt , Petr Mladek , linux-kernel@vger.kernel.org, Sergey Senozhatsky , John Ogness , Johannes Weiner , Andrew Morton , kernel-team@fb.com, Alexey Dobriyan , Jason Baron , Kees Cook , linux-api@vger.kernel.org Subject: Re: [PATCH] printk: Userspace format enumeration support Message-ID: References: <20210205124748.4af2d406@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 05, 2021 at 10:45:19PM +0000, Chris Down wrote: > Hi Steven, > > Steven Rostedt writes: > > Interesting, because when I was looking at the original patch (looked at > > the lore link before reading your reply), I thought to myself "this looks > > exactly like what I did for trace_printk formats", which the above file is > > where it is shown. I'm curious if this work was inspired by that? > > The double __builtin_constant_p() trick was suggested by Johannes based on > prior art in trace_puts() just prior to patch submission. Other than that, > it seems we came up with basically the same solution independently. :-) > > > > Anyway, there is something wrong at the moment. The output looks fine > > > with cat. But "less" says that it is a binary format and the output > > > is a bit messy: > > > > Hmm, that's usually the case when lseek gets messed up. Not sure how that > > happened. > > It looks as intended to me -- none of the newlines, nulls, or other control > sequences are escaped currently, since I didn't immediately see a reason to > do that. If that's a blocker though, I'm happy to change it. > > > > $> less /proc/printk_formats > > > "/proc/printk_formats" may be a binary file. See it anyway? > > > vmlinux,^A3Warning: unable to open an initial console. > > > ^@vmlinux,^A3Failed to execute %s (error %d) > > > ^@vmlinux,^A6Kernel memory protection disabled. > > > ^@vmlinux,^A3Starting init: %s exists but couldn't execute it (error %d) > > > > > > > > > That is for now. I still have to think about it. And I am also curious > > > about what others thing about this idea. > > > > > > > I'm not against the idea. I don't think it belongs in /proc. Perhaps > > debugfs is a better place to put it. > > Any location is fine with me, as long as it gets to userspace. How does > /printk/formats or /printk/formats/ sound to you? That's fine with me, but I'd like to see the patch with this in it first before approving it :) thanks, greg k-h