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]
Date:   Tue, 26 Nov 2019 16:19:21 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Hans Verkuil <hverkuil@...all.nl>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        Linux Media Mailing List <linux-media@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        y2038 Mailman List <y2038@...ts.linaro.org>
Subject: Re: [PATCH v4 5/8] media: v4l2-core: fix VIDIOC_DQEVENT for time64 ABI

On Tue, Nov 26, 2019 at 4:10 PM Hans Verkuil <hverkuil@...all.nl> wrote:
>
> On 11/26/19 3:43 PM, Arnd Bergmann wrote:
> > On Mon, Nov 25, 2019 at 3:40 PM Hans Verkuil <hverkuil@...all.nl> wrote:
> >> On 11/11/19 9:38 PM, Arnd Bergmann wrote:
> >                 struct v4l2_event *ev = parg;
> >                 struct v4l2_event_time32 ev32 = {
> >                         .type           = ev->type,
> >                         .pending        = ev->pending,
> >                         .sequence       = ev->sequence,
> >                         .timestamp.tv_sec  = ev->timestamp.tv_sec,
> >                         .timestamp.tv_nsec = ev->timestamp.tv_nsec,
> >                         .id             = ev->id,
> >                 };
> >
> >                 memcpy(ev32.u, ev->u, sizeof(ev->u));
> >                 memcpy(ev32.reserved, ev->reserved, sizeof(ev->reserved));
> >
> >                 if (copy_to_user(arg, &ev32, sizeof(ev32)))
> >                         return -EFAULT;
> >
> > Unfortunately this is a little uglier because it still requires the two
> > memcpy() for the arrays, but I think it's good enough.
>
> I agree.
>
> Hmm, can't you do .u = ev->u ? Or is that not allowed by this syntax?

No, that doesn't work here since the two unions are considered
different types despite being defined identically. It would work by
giving the union a name, but that name would also become visible
to user space without adding more hacks.

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ