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: <20200828102559.GA1470435@kroah.com>
Date:   Fri, 28 Aug 2020 12:25:59 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     shuo.a.liu@...el.com
Cc:     linux-kernel@...r.kernel.org, "H . Peter Anvin" <hpa@...or.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        Yu Wang <yu1.wang@...el.com>,
        Reinette Chatre <reinette.chatre@...el.com>, x86@...nel.org,
        Dave Hansen <dave.hansen@...el.com>,
        Zhi Wang <zhi.a.wang@...el.com>,
        Zhenyu Wang <zhenyuw@...ux.intel.com>
Subject: Re: [PATCH 05/17] virt: acrn: Introduce ACRN HSM basic driver

On Tue, Aug 25, 2020 at 10:45:05AM +0800, shuo.a.liu@...el.com wrote:
> +static long acrn_dev_ioctl(struct file *filp, unsigned int cmd,
> +			   unsigned long ioctl_param)
> +{
> +	if (cmd == ACRN_IOCTL_GET_API_VERSION) {
> +		if (copy_to_user((void __user *)ioctl_param,
> +				 &api_version, sizeof(api_version)))
> +			return -EFAULT;

Why are you versioning your api?  Shouldn't that not be a thing and you
either support an ioctl or you do not?



> +	}
> +
> +	return 0;
> +}
> +
> +static int acrn_dev_release(struct inode *inode, struct file *filp)
> +{
> +	struct acrn_vm *vm = filp->private_data;
> +
> +	kfree(vm);
> +	return 0;
> +}
> +
> +static const struct file_operations acrn_fops = {
> +	.owner		= THIS_MODULE,
> +	.open		= acrn_dev_open,
> +	.release	= acrn_dev_release,
> +	.unlocked_ioctl	= acrn_dev_ioctl,
> +};
> +
> +static struct miscdevice acrn_dev = {
> +	.minor	= MISC_DYNAMIC_MINOR,
> +	.name	= "acrn_hsm",
> +	.fops	= &acrn_fops,
> +};
> +
> +static int __init hsm_init(void)
> +{
> +	int ret;
> +
> +	if (x86_hyper_type != X86_HYPER_ACRN)
> +		return -ENODEV;
> +
> +	if (!acrn_is_privileged_vm())
> +		return -EPERM;
> +
> +	ret = hcall_get_api_version(slow_virt_to_phys(&api_version));
> +	if (ret < 0) {
> +		pr_err("Failed to get API version from hypervisor!\n");
> +		return ret;
> +	}
> +
> +	pr_info("API version is %u.%u\n",
> +		api_version.major_version, api_version.minor_version);

Shouldn't drivers be quiet when they load and all goes well?  pr_dbg()?

And can't you defer the "read the version" call until open happens?
Does it have to happen at module load time, increasing boot time for no
good reason if there is not a user?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ