Re: int overflow in io_getevents

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

 



On Thu, Jan 7, 2016 at 4:31 PM, Benjamin LaHaise <bcrl@xxxxxxxxx> wrote:
> On Thu, Jan 07, 2016 at 10:12:02AM +0100, Dmitry Vyukov wrote:
> ...
>> Sorry, but the following program still prints -9223372036562067969. I
>> think timespec_valid check will do.
>
> Ah, right.  Yes, using timespec_valid() instead of  timespec_valid_strict()
> as initially proposed will address my concerns.  Updated commit below.
>
>                 -ben
> --
> "Thought is the essence of where you are now."
>
> commit 3a55c535cf3836257434518bd6bc11464c493492
> Author: Benjamin LaHaise <bcrl@xxxxxxxxx>
> Date:   Thu Jan 7 10:25:44 2016 -0500
>
>     aio: handle integer overflow in io_getevents() timespec usage
>
>     Dmitry Vyukov reported an integer overflow in io_getevents() when
>     running a fuzzer.  Upon investigation, the triggers appears to be that
>     an invalid value for the tv_sec or tv_nsec was passed in which is not
>     handled by timespec_to_ktime().  This patch fixes that by making
>     io_getevents() return -EINVAL when timespec_valid() checks fail.  We
>     use timespec_valid() instead of timespec_valid_strict() to avoid issues
>     caused by userspace not knowing the cutoff for KTIME_SEC_MAX.
>
>     Reported-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
>     Signed-off-by: Benjamin LaHaise <bcrl@xxxxxxxxx>
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 155f842..d161a2f 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -1269,6 +1269,8 @@ static long read_events(struct kioctx *ctx, long min_nr, long nr,
>
>                 if (unlikely(copy_from_user(&ts, timeout, sizeof(ts))))
>                         return -EFAULT;
> +               if (!timespec_valid())

pass ts to the function

> +                       return -EINVAL;
>
>                 until = timespec_to_ktime(ts);
>         }
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux