bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 hurd] pci-arbiter: Fix long standing bug with PCI access


From: Samuel Thibault
Subject: Re: [PATCH v2 hurd] pci-arbiter: Fix long standing bug with PCI access
Date: Sun, 29 Dec 2024 01:45:09 +0100

Applied, thanks!

Damien Zammit via Bug reports for the GNU Hurd, le sam. 28 déc. 2024 07:35:52 
+0000, a ecrit:
> Proxied memory was not rounded up to page size, causing
> error with vm_map'ing  the underlying memory.
> 
> WARNING: Assumes pci memory resources are at least page aligned.
> If not, this will expose part of next resource to userspace.
> 
> ---
>  pci-arbiter/netfs_impl.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/pci-arbiter/netfs_impl.c b/pci-arbiter/netfs_impl.c
> index 4bb5c97a..82e618a7 100644
> --- a/pci-arbiter/netfs_impl.c
> +++ b/pci-arbiter/netfs_impl.c
> @@ -577,6 +577,7 @@ get_filemap_region (struct node *node, vm_prot_t prot)
>    vm_prot_t max_prot;
>    size_t reg_num;
>    struct pci_mem_region *region;
> +  size_t rounded_size;
>  
>    /* Get region info */
>    reg_num =
> @@ -592,12 +593,17 @@ get_filemap_region (struct node *node, vm_prot_t prot)
>    if (err)
>      goto error;
>  
> +  /* WARNING: this rounds up the proxied region to a whole page.
> +   * This may be a security risk, but is the only way to provide access
> +   * to the final page of the memory region */
> +  rounded_size = round_page (region->size);
> +
>    /* Create a new memory object proxy with the required protection */
>    max_prot = (VM_PROT_READ | VM_PROT_WRITE) & prot;
>    err =
>      vm_region_create_proxy (mach_task_self (),
>                           (vm_address_t) node->nn->ln->region_maps[reg_num],
> -                         max_prot, region->size, &proxy);
> +                         max_prot, rounded_size, &proxy);
>    if (err)
>      goto error;
>  
> -- 
> 2.45.2
> 
> 
> 

-- 
Samuel
...
<rv_> et Ctrl alt F2 pour aller sous console
<rv_> mais c koi pour passer d'un bureau a un autre !
<rv_> au fait c koi le raccourci pour passer d'un bureau a un autre 'question 
stupide"
<cycyx> ça dépend du window manager et de ta conf
<Firebird> ce qui fonctionne toujours c'est CTRL-ALT-BCKSP
-:- SignOff rv_: #linuxfr (Read error: EOF from client)
-:- rv_ [~rv@217.11.166.169] has joined #linuxfr
<rv_> Firebird: MEURT...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]