lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210407155636.GG25319@zn.tnic>
Date:   Wed, 7 Apr 2021 17:56:36 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Jarkko Sakkinen <jarkko@...nel.org>
Cc:     linux-sgx@...r.kernel.org,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
        "H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] x86/sgx: Add sgx_nr_{all, free}_pages to the
 debugfs

On Tue, Apr 06, 2021 at 02:26:53AM +0300, Jarkko Sakkinen wrote:
> Add two debugs attributes:
> 
> * /sys/kernel/debug/x86/sgx_nr_all_pages
> * /sys/kernel/debug/x86/sgx_nr_free_pages

Definitely under /sys/kernel/debug/x86/sgx/...
				      ^^^^^^

> These provide useful statistics for testing purposes.

Testing what exactly?

Also, if those are EPC pages, why isn't "epc" in the name?

> E.g. on a NUC7CJYH2, when no enclaves are running, and EPC set to 32 MB:
> 
> $ sudo cat /sys/kernel/debug/x86/sgx_nr_all_pages
> 5632
> 
> $ sudo cat /sys/kernel/debug/x86/sgx_nr_free_pages
> 5632

I have no clue what that is useful for. You want to account how many of
the EPC pages on all nodes are in use? What for?

Are those globally useful for people? If so, they need to go to sysfs
along with documentation what they do.

If not, you can keep this patch in your tree for your own testing.

> Signed-off-by: Jarkko Sakkinen <jarkko@...nel.org>
> ---
> 
> v2:
> * Use debugfs_create_ulong():
>   https://lore.kernel.org/linux-sgx/57c18e08-3e36-b5b3-aaba-9a21b75a1613@intel.com/
> 
>  arch/x86/kernel/cpu/sgx/main.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
> index 7df7048cb1c9..07bad864c531 100644
> --- a/arch/x86/kernel/cpu/sgx/main.c
> +++ b/arch/x86/kernel/cpu/sgx/main.c
> @@ -1,6 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /*  Copyright(c) 2016-20 Intel Corporation. */
>  
> +#include <linux/debugfs.h>
>  #include <linux/freezer.h>
>  #include <linux/highmem.h>
>  #include <linux/kthread.h>
> @@ -25,7 +26,10 @@ static DECLARE_WAIT_QUEUE_HEAD(ksgxd_waitq);
>  static LIST_HEAD(sgx_active_page_list);
>  static DEFINE_SPINLOCK(sgx_reclaimer_lock);
>  
> -/* The free page list lock protected variables prepend the lock. */
> +/* The number of EPC pages in total in all nodes. */
> +static unsigned long sgx_nr_all_pages;
> +
> +/* The number of free EPC pages in all nodes. */
>  static unsigned long sgx_nr_free_pages;

Ok, you're fixing the comment here. Good.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ