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] [day] [month] [year] [list]
Message-ID: <CAHUa44GU5zWJOLGzQa06ZJO4eYitNFd+XkXL9gRXzt7zcbAd3A@mail.gmail.com>
Date:   Mon, 7 May 2018 10:24:18 +0200
From:   Jens Wiklander <jens.wiklander@...aro.org>
To:     Etienne Carriere <etienne.carriere@...aro.org>
Cc:     alexandre.jutras@....com,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tee: check shm references are consistent in offset/size

On Sun, Apr 29, 2018 at 2:22 PM, Etienne Carriere
<etienne.carriere@...aro.org> wrote:
> This change prevents userland from referencing TEE shared memory
> outside the area initially allocated by its owner. Prior this change an
> application could not reference or access memory it did not own but
> it could reference memory not explicitly allocated by owner but still
> allocated to the owner due to the memory allocation granule.
>
> Reported-by: Alexandre Jutras <alexandre.jutras@....com>
> Signed-off-by: Etienne Carriere <etienne.carriere@...aro.org>
> ---
>  drivers/tee/tee_core.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
> index 0124a91..dd46b75 100644
> --- a/drivers/tee/tee_core.c
> +++ b/drivers/tee/tee_core.c
> @@ -238,6 +238,17 @@ static int params_from_user(struct tee_context *ctx, struct tee_param *params,
>                         if (IS_ERR(shm))
>                                 return PTR_ERR(shm);
>
> +                       /*
> +                        * Ensure offset + size does not overflow offset
> +                        * and does not overflow the size of the referred
> +                        * shared memory object.
> +                        */
> +                       if ((ip.a + ip.b) < ip.a ||
> +                           (ip.a + ip.b) > shm->size) {
> +                               tee_shm_put(shm);
> +                               return -EINVAL;
> +                       }
> +
>                         params[n].u.memref.shm_offs = ip.a;
>                         params[n].u.memref.size = ip.b;
>                         params[n].u.memref.shm = shm;
> --
> 1.9.1
>

Looks good to me, I'll pick this up.

Thanks,
Jens

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ