bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH gnumach] x86_64: Support 8 byte inlined port rights to avoid


From: Samuel Thibault
Subject: Re: [PATCH gnumach] x86_64: Support 8 byte inlined port rights to avoid message resizing.
Date: Wed, 29 Nov 2023 00:19:41 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Hello,

Flavio Cruz, le ven. 24 nov. 2023 16:30:41 -0500, a ecrit:
> +#ifdef USER32
> +                  assert(size == 
> bytes_to_descsize(sizeof(mach_port_name_t)));
>                    if ((usaddr + sizeof(mach_port_name_t)*number) > ueaddr)
>                      return 1;
>                    adjust_msg_type_size(ktaddr, sizeof(mach_port_t) - 
> sizeof(mach_port_name_t));
> @@ -433,6 +453,16 @@ int copyinmsg (const void *userbuf, void *kernelbuf, 
> const size_t usize, const s
>                        ksaddr += sizeof(mach_port_t);
>                        usaddr += sizeof(mach_port_name_t);
>                      }
> +#else
> +                  assert(size == 
> bytes_to_descsize(sizeof(mach_port_name_inlined_t)));
[...]
> +              if (MACH_MSG_TYPE_PORT_ANY(name)) {
> +                assert(size == bytes_to_descsize(sizeof(mach_port_name_t)));


size is coming from userland, we don't want to assert here, but return
an error.

I'm hitting the last assertion, not sure exactly where it is coming from yet.

> @@ -470,6 +503,9 @@ int copyinmsg (const void *userbuf, void *kernelbuf, 
> const size_t usize, const s
>  
>    kmsg->msgh_size = sizeof(mach_msg_header_t) + ksaddr - (vm_offset_t)(kmsg 
> + 1);
>    assert(kmsg->msgh_size <= ksize);
> +#ifndef USER32
> +  assert(kmsg->msgh_size == usize);
> +#endif
>    return 0;
>  }
>  

ditto with usize.

> @@ -526,10 +563,17 @@ int copyoutmsg (const void *kernelbuf, void *userbuf, 
> const size_t ksize)
>                        ksaddr += sizeof(mach_port_t);
>                        usaddr += sizeof(mach_port_name_t);
>                      }
> +#else
> +                  assert(size == 
> bytes_to_descsize(sizeof(mach_port_name_inlined_t)));


> @@ -554,6 +598,9 @@ int copyoutmsg (const void *kernelbuf, void *userbuf, 
> const size_t ksize)
>    usize = sizeof(mach_msg_user_header_t) + usaddr - (vm_offset_t)(umsg + 1);
>    if (copyout(&usize, &umsg->msgh_size, sizeof(umsg->msgh_size)))
>      return 1;
> +#ifndef USER32
> +  assert(usize == ksize);
> +#endif
>  
>    return 0;

and there as well.

Samuel



reply via email to

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