Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp504750ybt; Fri, 19 Jun 2020 07:04:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjyu0pVEUKNLZCqpm5c0Fd0aGOtIGsuTODOPNZiUTvkJHJncH4T0ZPz2CA0qTP0D7mNgwE X-Received: by 2002:a05:6402:b87:: with SMTP id cf7mr3687046edb.282.1592575489784; Fri, 19 Jun 2020 07:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592575489; cv=none; d=google.com; s=arc-20160816; b=tG/p7tChYXzz0JgQJotij09YP5j1uRCUjDjsXiWCdTFuPdcFZOHqmxkQMOg23G4IlA FLd7fg8hAnOyhdVEfMa2vgtmFB3pAPMyRS59d11nJELg1FcZ0ddASfmKNysVZAXeK3mR bVXk5H6gFYI4DGDRpCP0Y6jykQzv8/mSvuTMv+9PCsoBi2dKWAVKC8Q6C258Xn0PRrD+ RpIBU1wPLgXdLRhpOwJnuspt0j8o//saH7uPaKTBTvW+eMT3iV8peOwhtl8W51GZELbv pvISEefdmDqgj+U0ADDe4q75fTX0KIrZCNb6sa8Yy2O/rWWZi28CWigHBywB0ukMDTeY izuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=TS+ra4X/XbSRArOWf5DdyrPn86S5jf4jXvW/rJL5ZmM=; b=PeRf10twpfYa6TLFJe/OACIa2Zn8UqGuOCBfSbfq3I3Ke0tZsrvXXoInCIspPpWMyL CTTOa32Inu0iy9PdrsxK3OFWwdg+QSki9P2Tk8Mx8zYfx2IOzW6oAqmKEW6QQhNAjbCH grge9kGwdoPq78I5PYTzLOrKpa1AvKY4bMKLcgJwH5rOPtVcPyndkd1soY6i6TpXzSAT gP7UDgmCPV3CESfcoxsfixx2rMOt9rW0t4qSgHCGzFtggOUhSDDVjw1uRCOH10CC19tl eMkTAsx5InCsZlCjCjFNNf4+x881DrUVS/XkERuEfH5qY+zLJg0TdDycVjXmLPgD3erz fYOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZxO+IZbH; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr10si4344071ejc.204.2020.06.19.07.04.26; Fri, 19 Jun 2020 07:04:49 -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=@kernel.org header.s=default header.b=ZxO+IZbH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732461AbgFSOCL (ORCPT + 99 others); Fri, 19 Jun 2020 10:02:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:60232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725806AbgFSOCK (ORCPT ); Fri, 19 Jun 2020 10:02:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 56105207E8; Fri, 19 Jun 2020 14:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592575329; bh=gJzzZB7/IPivlAu1L2QO6aYOv9XFiWRSXkWULQj1ojM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZxO+IZbH+VtKny5dA4LoKDHP3cFZWC2M+d93WxoSHMmBFB2bXateTHCfRn1kNRTt+ TneX/HlmNh7IevONOCK4SQGDxtvzMm7JPuVTTsPRI40QQ6z9F8e1kbgol+Zm8YYfBw ehz6msbFKlfo+8G3URyAVEfR/InnfbMCPwXgnJPU= Date: Fri, 19 Jun 2020 16:02:06 +0200 From: Greg Kroah-Hartman To: Daniel Gutson Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Arnd Bergmann , Peter Zijlstra , "David S. Miller" , Rob Herring , Tony Luck , Rahul Tanwar , Xiaoyao Li , Sean Christopherson , Dave Hansen , linux-kernel@vger.kernel.org Subject: Re: [PATCH] Ability to read the MKTME status from userspace Message-ID: <20200619140206.GA1862477@kroah.com> References: <20200618210215.23602-1-daniel.gutson@eclypsium.com> <20200619072041.GA2795@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 19, 2020 at 10:51:32AM -0300, Daniel Gutson wrote: > > > +enum mktme_status_type get_mktme_status(void) > > > +{ > > > + return mktme_status; > > > +} > > > +EXPORT_SYMBOL_GPL(get_mktme_status); > > > > prefix of the subsystem first please: > > mktme_get_status > > > > OK. > > > Or, better yet, why not just export the variable directly? Why is this > > a function at all? > > Because I want this to be read only. read-only to who? > > > + > > > +/* Buffer to return: always 3 because of the following chars: > > > + * value \n \0 > > > + */ > > > +#define BUFFER_SIZE 3 > > > > Why a define? > > Do you suggest `static const int` instead? Why do you need it at all? > > > + > > > + sprintf(tmp, "%d\n", (int)get_mktme_status() & 1); > > > + return simple_read_from_buffer(buf, count, ppos, tmp, sizeof(tmp)); > > > +} > > > + > > > +static const struct file_operations mktme_status_ops = { > > > + .read = mktme_status_read, > > > +}; > > > + > > > +static int __init mod_init(void) > > > +{ > > > + mktme_dir = securityfs_create_dir("mktme", NULL); > > > + if (IS_ERR(mktme_dir)) { > > > + pr_err("Couldn't create mktme sysfs dir\n"); > > > + return -1; > > > > Don't make up random error numbers, use the EWHATEVER defines please. > > > > Could you please suggest one? Why not return the error given to you? Why throw that information away? > > Also no Documentation/ABI/ update for your new userspace api that you > > just created? > > > > should that be a comment in the .h? No, you need a description in Documentation/ABI/ about any sysfs/configfs/securityfs/whatever for new things you are creating. thanks, greg k-h