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] [day] [month] [year] [list]
Date:   Thu, 8 Sep 2022 17:39:32 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     cgel.zte@...il.com
Cc:     pbonzini@...hat.com, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, ye xingchen <ye.xingchen@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH linux-next] KVM:define vcpu_get_pid_fops with
 DEFINE_DEBUGFS_ATTRIBUTE

On Mon, Aug 15, 2022, cgel.zte@...il.com wrote:
> From: ye xingchen <ye.xingchen@....com.cn>
> 
> From the coccinelle check:
> ./virt/kvm/kvm_main.c line 3847
> WARNING  vcpu_get_pid_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
> 
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: ye xingchen <ye.xingchen@....com.cn>
> ---
>  virt/kvm/kvm_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 515dfe9d3bcf..a0817179f8e4 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -3844,7 +3844,7 @@ static int vcpu_get_pid(void *data, u64 *val)
>  	return 0;
>  }
>  
> -DEFINE_SIMPLE_ATTRIBUTE(vcpu_get_pid_fops, vcpu_get_pid, NULL, "%llu\n");
> +DEFINE_DEBUGFS_ATTRIBUTE(vcpu_get_pid_fops, vcpu_get_pid, NULL, "%llu\n");

Based on the comments in scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci,
it seems that using DEFINE_DEBUGFS_ATTRIBUTE is only beneficial if the file is
created with debugfs_create_file_unsafe().  IIUC, using DEFINE_DEBUGFS_ATTRIBUTE
without switching to debugfs_create_file_unsafe() will actually _add_ overhead.

	//# Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
	//# imposes some significant overhead as compared to
	//# DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Using DEFINE_DEBUGFS_ATTRIBUTE also effectively drops ->llseek() support.  I assume
that's not a problem?  But someone that knows how this is actually used should
chime in.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ