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:
 <SN6PR02MB4157DC938A00F0B57780A117D488A@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Wed, 7 May 2025 15:47:02 +0000
From: Michael Kelley <mhklinux@...look.com>
To: "longli@...uxonhyperv.com" <longli@...uxonhyperv.com>, "K. Y. Srinivasan"
	<kys@...rosoft.com>, Haiyang Zhang <haiyangz@...rosoft.com>, Wei Liu
	<wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>, Greg Kroah-Hartman
	<gregkh@...uxfoundation.org>, "linux-hyperv@...r.kernel.org"
	<linux-hyperv@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
CC: Long Li <longli@...rosoft.com>, "stable@...r.kernel.org"
	<stable@...r.kernel.org>
Subject: RE: [Patch v3 1/5] Drivers: hv: Allocate interrupt and monitor pages
 aligned to system page boundary

From: longli@...uxonhyperv.com <longli@...uxonhyperv.com> Sent: Monday, May 5, 2025 5:57 PM
> 
> There are use cases that interrupt and monitor pages are mapped to
> user-mode through UIO, so they need to be system page aligned. Some
> Hyper-V allocation APIs introduced earlier broke those requirements.
> 
> Fix this by using page allocation functions directly for interrupt
> and monitor pages.
> 
> Cc: stable@...r.kernel.org
> Fixes: ca48739e59df ("Drivers: hv: vmbus: Move Hyper-V page allocator to arch neutral code")
> Signed-off-by: Long Li <longli@...rosoft.com>
> ---
>  drivers/hv/connection.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
> index 8351360bba16..be490c598785 100644
> --- a/drivers/hv/connection.c
> +++ b/drivers/hv/connection.c
> @@ -206,11 +206,20 @@ int vmbus_connect(void)
>  	INIT_LIST_HEAD(&vmbus_connection.chn_list);
>  	mutex_init(&vmbus_connection.channel_mutex);
> 
> +	/*
> +	 * The following Hyper-V interrupt and monitor pages can be used by
> +	 * UIO for mapping to user-space, so they should always be allocated on
> +	 * system page boundaries. The system page size must be >= the Hyper-V
> +	 * page size.
> +	 */
> +	BUILD_BUG_ON(PAGE_SIZE < HV_HYP_PAGE_SIZE);
> +
>  	/*
>  	 * Setup the vmbus event connection for channel interrupt
>  	 * abstraction stuff
>  	 */
> -	vmbus_connection.int_page = hv_alloc_hyperv_zeroed_page();
> +	vmbus_connection.int_page =
> +		(void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
>  	if (vmbus_connection.int_page == NULL) {
>  		ret = -ENOMEM;
>  		goto cleanup;
> @@ -225,8 +234,8 @@ int vmbus_connect(void)
>  	 * Setup the monitor notification facility. The 1st page for
>  	 * parent->child and the 2nd page for child->parent
>  	 */
> -	vmbus_connection.monitor_pages[0] = hv_alloc_hyperv_page();
> -	vmbus_connection.monitor_pages[1] = hv_alloc_hyperv_page();
> +	vmbus_connection.monitor_pages[0] = (void *)__get_free_page(GFP_KERNEL);
> +	vmbus_connection.monitor_pages[1] = (void *)__get_free_page(GFP_KERNEL);
>  	if ((vmbus_connection.monitor_pages[0] == NULL) ||
>  	    (vmbus_connection.monitor_pages[1] == NULL)) {
>  		ret = -ENOMEM;
> @@ -342,21 +351,23 @@ void vmbus_disconnect(void)
>  		destroy_workqueue(vmbus_connection.work_queue);
> 
>  	if (vmbus_connection.int_page) {
> -		hv_free_hyperv_page(vmbus_connection.int_page);
> +		free_page((unsigned long)vmbus_connection.int_page);
>  		vmbus_connection.int_page = NULL;
>  	}
> 
>  	if (vmbus_connection.monitor_pages[0]) {
>  		if (!set_memory_encrypted(
>  			(unsigned long)vmbus_connection.monitor_pages[0], 1))
> -			hv_free_hyperv_page(vmbus_connection.monitor_pages[0]);
> +			free_page((unsigned long)
> +				vmbus_connection.monitor_pages[0]);
>  		vmbus_connection.monitor_pages[0] = NULL;
>  	}
> 
>  	if (vmbus_connection.monitor_pages[1]) {
>  		if (!set_memory_encrypted(
>  			(unsigned long)vmbus_connection.monitor_pages[1], 1))
> -			hv_free_hyperv_page(vmbus_connection.monitor_pages[1]);
> +			free_page((unsigned long)
> +				vmbus_connection.monitor_pages[1]);
>  		vmbus_connection.monitor_pages[1] = NULL;
>  	}
>  }
> --
> 2.34.1
> 

Reviewed-by: Michael Kelley <mhklinux@...look.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ