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: <20220301234744.plggauzg4ka5p3tm@liuwe-devbox-debian-v2>
Date:   Tue, 1 Mar 2022 23:47:44 +0000
From:   Wei Liu <wei.liu@...nel.org>
To:     Iouri Tarassov <iourit@...ux.microsoft.com>
Cc:     kys@...rosoft.com, haiyangz@...rosoft.com, sthemmin@...rosoft.com,
        wei.liu@...nel.org, linux-hyperv@...r.kernel.org,
        linux-kernel@...r.kernel.org, spronovo@...rosoft.com,
        spronovo@...ux.microsoft.com, gregkh@...uxfoundation.org
Subject: Re: [PATCH v3 05/30] drivers: hv: dxgkrnl: Opening of /dev/dxg
 device and dxgprocess creation

On Tue, Mar 01, 2022 at 11:45:52AM -0800, Iouri Tarassov wrote:
> - Implement opening of the device (/dev/dxg) file object and creation of
> dxgprocess objects.
[...]
>  static int dxgk_open(struct inode *n, struct file *f)
>  {
> -	return 0;
> +	int ret = 0;
> +	struct dxgprocess *process;
> +
> +	pr_debug("%s %p %d %d",
> +		     __func__, f, current->pid, current->tgid);
> +
> +
> +	/* Find/create a dxgprocess structure for this process */
> +	process = dxgglobal_get_current_process();
> +
> +	if (process) {
> +		f->private_data = process;
> +	} else {
> +		pr_debug("cannot create dxgprocess for open\n");
> +		ret = -EBADF;
> +	}
> +
> +	pr_debug("%s end %x", __func__, ret);

I would normally remove pr_deubg's like this when submitting. It doesn't
provide much information.

> +	return ret;
>  }
>  
[...]
>  
> +int dxgvmb_send_create_process(struct dxgprocess *process)
> +{
> +	int ret;
> +	struct dxgkvmb_command_createprocess *command;
> +	struct dxgkvmb_command_createprocess_return result = { 0 };
> +	struct dxgvmbusmsg msg;
> +	char s[WIN_MAX_PATH];
> +	int i;
> +
> +	ret = init_message(&msg, NULL, process, sizeof(*command));
> +	if (ret)
> +		return ret;
> +	command = (void *)msg.msg;
> +
> +	ret = dxgglobal_acquire_channel_lock();
> +	if (ret < 0)
> +		goto cleanup;
> +
> +	command_vm_to_host_init1(&command->hdr, DXGK_VMBCOMMAND_CREATEPROCESS);
> +	command->process = process;
> +	command->process_id = process->process->pid;
> +	command->linux_process = 1;
> +	s[0] = 0;
> +	__get_task_comm(s, WIN_MAX_PATH, process->process);
> +	for (i = 0; i < WIN_MAX_PATH; i++) {
> +		command->process_name[i] = s[i];
> +		if (s[i] == 0)
> +			break;
> +	}

What's wrong with doing

  __get_task_comm(command->process_name, WIN_MAX_PATH, process->process);

here?

That saves you many bytes on stack.

[...]
> +static char *errorstr(int ret)
> +{
> +	return ret < 0 ? "err" : "";
> +}
> +

This is not used in this patch.

[...]
> diff --git a/drivers/hv/dxgkrnl/misc.h b/drivers/hv/dxgkrnl/misc.h
> index 1ff0c0e28332..433b59d3eb23 100644
> --- a/drivers/hv/dxgkrnl/misc.h
> +++ b/drivers/hv/dxgkrnl/misc.h
> @@ -31,7 +31,6 @@ extern const struct d3dkmthandle zerohandle;
>   * table_lock
>   * core_lock
>   * device_lock
> - * process->process_mutex

Why is this deleted?

Thanks,
Wei.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ