Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4553562pxj; Tue, 25 May 2021 10:30:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIDhV1fKpp2E2LeZmug7xkacFvJBgGyNk0Jabnb268mxgerTHe7FwsyXReIfZVUFNO6Tow X-Received: by 2002:a17:907:98c3:: with SMTP id kd3mr4920154ejc.154.1621963845984; Tue, 25 May 2021 10:30:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621963845; cv=none; d=google.com; s=arc-20160816; b=uwZ3ERBRrBYJOYHV4cX0HGCXmx3cdphI/GqActL5ZlHBQePZdAttRxSpynYEpEEdCP swX0J3SSrk32ES4XyL71f2VZkqIpAJ8Dbg6ShI86i9Go0IMwbJHGO84P9nqz/s/BtO1D mwHu0Gb6KiDrHsQ/nuPyIcOVlmd2An2IAdXVheLrubL3WqGysw7Hd8mMoR5O3o0+/65N mBbn3tcLawKOY58F8+YeSrWEJzsqZNQ4yQrLAI8sFyh7xLUabdHGowyBxt6YEgom2CxW Y0qSibyTg3E/pxg7Ea0OdtlEJsAe3bCt3dZ7RmqJApQEXLIdc55lFhCBXJJQP+lqGaeg ny1w== 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=OQv6TmXPL8R9PpLyyV10o10pyc+idpsWttCSOSU2vdw=; b=DsmbZSeUyCb5dK93k7m/+mwvXefimK+euLWDtlM3S4TpiPsyWB55S2SxfeQeJtEI8x i3FSHnYcSLH+mUBtptGNu79Uwat0Sp8raS/ssiE0b8bOpQwZ3DtVfKJzBUenZ0mCee6O Vz7+a+hvcODkJhylYytXN8VzCXJrp05f6edwhfhlY+TmMICNMy3DitWlCCMhrC8kWQjL IsswWGBtUsz1AelvpnicMVb3oq5XYQ9kpDHlVDm+dsJw05i3ju/nDLZKd30Rx27SICvj 6UvB6Umt3aXXbNyXItToxZwnqWs1jmyeWCy1z2Ni+IA3zCZUJG+I3oH/znVB4jni0lZ5 w4FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fWpGz4fQ; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d1si5435299ejd.480.2021.05.25.10.30.23; Tue, 25 May 2021 10:30:45 -0700 (PDT) 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=@suse.com header.s=susede1 header.b=fWpGz4fQ; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231173AbhEYPVK (ORCPT + 99 others); Tue, 25 May 2021 11:21:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:50280 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231416AbhEYPUw (ORCPT ); Tue, 25 May 2021 11:20:52 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1621955961; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OQv6TmXPL8R9PpLyyV10o10pyc+idpsWttCSOSU2vdw=; b=fWpGz4fQWAB0ROlMAjOgi3UA8rFJBd4elGoxjaNdC1Utp/Yq+j/Yl6KP+dhWiH+Tg1S+48 kEpGwvZDopboFXR8v0MEqNNkzOS28NPJtMs3/bUDyyHhMF3msNiYkKsul5Nu3kbUyXd8iJ cghrGE0GG7J2M836P0cyVNzi9qOcU24= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 01C9BAB71; Tue, 25 May 2021 15:19:21 +0000 (UTC) Date: Tue, 25 May 2021 17:19:20 +0200 From: Petr Mladek To: Andy Shevchenko Cc: Rasmus Villemoes , Chris Down , linux-kernel@vger.kernel.org, Jessica Yu , Sergey Senozhatsky , John Ogness , Steven Rostedt , Greg Kroah-Hartman , Johannes Weiner , Kees Cook , kernel-team@fb.com Subject: Re: [PATCH v6 3/4] printk: Userspace format indexing support Message-ID: References: <05d25c65d3f5149c1e8537f74041a7a46bd489d6.1621338324.git.chris@chrisdown.name> 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 Thu 2021-05-20 12:25:55, Andy Shevchenko wrote: > On Wed, May 19, 2021 at 08:59:06AM +0200, Rasmus Villemoes wrote: > > On 18/05/2021 18.00, Andy Shevchenko wrote: > > > On Tue, May 18, 2021 at 03:07:44PM +0100, Chris Down wrote: > > >>>> +static int __init pi_init(void) > > > > > >>> No __exit? (There is a corresponding call for exit) > > >> > > >> Hmm, can't printk only be built in to the kernel, so it can't be unloaded? > > >> At least it looks that way from Kconfig. Maybe I'm missing something and > > >> there's some other way that might be invoked? > > > > > > While it's true, it may help in these cases: > > > 1) getting things done in a clean way > > > > Huh? > > > > > 2) finding bugs during boot cycle > > > > What bugs would code that doesn't get executed find? > > > > > 3) (possibly) making better debugging in virtual environments > > > > How? > > > > > 4) (also possibly) clean up something which shouldn't be seen by the next > > > (unsecure) kernel, like kexec. > > > > Tearing down a few debugfs files wouldn't touch a lot of memory, the > > printk format strings are very unlikely to be sensitive, and I highly > > doubt __exit code is kept around and run at kexec time anyway. > > I admit that I'm on a learning curve in this area, and perhaps it was unclear > from the above that the list I gave is what I think may or might be relevant. > > > IOW, please do not bloat the kernel image with __exit code in things > > which cannot be built modular. > > Why we have exitcall in the code which can't be modular? Is somebody going to > clean that up? (Ex. `git grep -w __exitcall`) Most exit calls are in "um" arch code. AFAIK, it is a kernel that can be booted in userspace. And it is very special. Anyway, this functionality (printk index) do not need any special handling during suspend, reboot, halt, or other system state changes. It only has to be initialized during boot at the right time. It is after debugfs is initialized and before modules can be loaded. Best Regards, Petr