Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2421833pxb; Fri, 5 Feb 2021 18:35:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAx5PdaS8rQZFPmx32TAnwKue59k/uaD15zpQo7qWDFKh17pa+pW1JBBfYqfUI5UG/6i7J X-Received: by 2002:a17:906:3101:: with SMTP id 1mr6974953ejx.115.1612578907969; Fri, 05 Feb 2021 18:35:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612578907; cv=none; d=google.com; s=arc-20160816; b=JvmIp91I6WRHI2VyWuiUzixcvuD8vz9Os4BoI8PaVSc30Fde9lT+u10D9OZ6HOMIHC Dwhn8Kr/JBfPgQdvxz5KaP+u22wBTsREzSNZL0e8fBSFVfhoCTMKD4dcLKM1YZiO4zO/ XLdyDRW95M8D9pwOeLjnAAdTfrW15XFm7ealE4x+92jgRCnN3072GwI6W2UUa7p8NESF 9atry6Erc/1E519uAb9fH+up+bvmAjpOJf59oPe5/fCI+cg4EGAb3dxZUdwh+flk1VUW bl7+l/gT2Y5WYAHwJnQT88wFDTwCaAtvcDa1Fdfr65q/ODGEQ5YI/gCnZlFQEE3u3IyX ch+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=tI1f4i4ziW/Ximd5HKHu71YFTC8v8qUtKb681+ALp0o=; b=DUQ/RjRormaCQxZSOsl0lFIbEUMx6sWT9kU0S4rkaiH3PrzMfUJLcwDC9mtCCmj8hM IgNJhtFol7Oeq8PvjYd2XycM54Pw+a1bEomjHxXHwh78HhJp6CkNUEcKGY9pI6VnwhFV wl7oXXX4QsCiPy1XdmR6FHWXFVkvNAbEsHGLgK8osuYHid2X1HYYOe4ZoQzHb4UeYh4/ UNC+veA6yYx7zjSUSET2blUqLrxQtaCS6cAVoP0bS620WxPEQ5p0NNNerzuX+BITAbVO GvjI6olxiN5+RouRJa5LAjVWEbqEgixxi7/xJopVQRc78/b6TnyEp3Wca5mcTHR3U/fE VvcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=YZdenX0Q; 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=chrisdown.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si6914267edj.442.2021.02.05.18.34.43; Fri, 05 Feb 2021 18:35:07 -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=@chrisdown.name header.s=google header.b=YZdenX0Q; 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=chrisdown.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230094AbhBFCcS (ORCPT + 99 others); Fri, 5 Feb 2021 21:32:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbhBFCcD (ORCPT ); Fri, 5 Feb 2021 21:32:03 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9996BC08ECB0 for ; Fri, 5 Feb 2021 14:45:21 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id q2so10837778edi.4 for ; Fri, 05 Feb 2021 14:45:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tI1f4i4ziW/Ximd5HKHu71YFTC8v8qUtKb681+ALp0o=; b=YZdenX0Q9zk0V+QGiih7o/6iLs3mnbotXB87u469aXGFh8TPPwu5nPQD6MAlrqDm9b V8qg2QBHm1+ncL5H95h1Kz8bFfws38DJF9HtFKz5WAyAs2VmQRN0wUJiKHKyS6giqYI5 MklliWJw3bOuhQLEIorHi0QMOpnHWKi0gTFk0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tI1f4i4ziW/Ximd5HKHu71YFTC8v8qUtKb681+ALp0o=; b=Cm//aNYV2pho8XnGmOcEOY95HChN3nlqruE/rQf0nCNEP7xWkYyOzrQXBtN1oAFZNx 0rmgW1Agkcwdme9ZacysHlVj9nfoNXnYHe98xvA8aErXqiQYJhkp7V0/xDVLhqrFt0J5 5+DK8fGsyN67XCSFlZbro7MU9QZ6ujfQK4QGtIgsdenGtZ5Fjdf4x51iWH9BurZJr9Va 1bFZqwEgKFAxhlVJ/EuZxvfNC2pXonIAexvlsHh3DA0CKDgL5Arg9uwJ+ETzK08pC78A yWDXrCCM/XDYIP7sKW8yrtVzHvB/gVfQjBZ/XmAXGDnAdaGeDvoq2EU00Fv7RoJJQtGe 6wFA== X-Gm-Message-State: AOAM531ptihKMemCS56f4fBw7B5ksmUwuvI4QUfOgRgZCtY8pAnVWUAF Q0UkErvTrIw/m/jpfwZ738ghPw== X-Received: by 2002:aa7:d6c2:: with SMTP id x2mr5765469edr.225.1612565120194; Fri, 05 Feb 2021 14:45:20 -0800 (PST) Received: from localhost ([2620:10d:c093:400::4:66bb]) by smtp.gmail.com with ESMTPSA id o4sm4656387edw.78.2021.02.05.14.45.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 14:45:19 -0800 (PST) Date: Fri, 5 Feb 2021 22:45:19 +0000 From: Chris Down To: Steven Rostedt Cc: Petr Mladek , linux-kernel@vger.kernel.org, Sergey Senozhatsky , John Ogness , Johannes Weiner , Andrew Morton , kernel-team@fb.com, Alexey Dobriyan , Greg Kroah-Hartman , 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; format=flowed Content-Disposition: inline In-Reply-To: <20210205124748.4af2d406@gandalf.local.home> User-Agent: Mutt/2.0.5 (da5e3282) (2021-01-21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Thanks, Chris