public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, Daniel Mentz <danielmentz@google.com>
Subject: Re: [PATCHv2 00/13] v4l2-compat-ioctl32.c: remove set_fs(KERNEL_DS)
Date: Tue, 30 Jan 2018 16:41:50 +0200	[thread overview]
Message-ID: <2040102.b8zQ4JN7km@avalon> (raw)
In-Reply-To: <20180130102701.13664-1-hverkuil@xs4all.nl>

Hi Hans,

Thank you for the patches.

For patches 01/13 to 08/13 and 10/13 to 12/13,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

On Tuesday, 30 January 2018 12:26:48 EET Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
> 
> This patch series fixes a number of bugs and culminates in the removal
> of the set_fs(KERNEL_DS) call in v4l2-compat-ioctl32.c.
> 
> See
> http://people.canonical.com/~ubuntu-security/cve/2017/CVE-2017-13166.html
> for why this set_fs call is a bad idea.
> 
> In order to test this I used vivid and a 32-bit v4l2-compliance. The
> advantage of vivid is that it implements almost all ioctls, and those
> are all tested by v4l2-compliance. This ensures good test coverage.
> 
> Since I had to track down all failures that v4l2-compliance reported
> in order to verify whether those were introduced by the final patch
> or if those were pre-existing bugs, this series starts off with fixes
> for bugs that v4l2-compliance found, mostly in v4l2-compat-ioctl32.c.
> It is clear that v4l2-compat-ioctl32.c doesn't receive a lot of
> testing.
> 
> There are also three patches that just clean up v4l2-compat-ioctl32.c
> in order to simplify the final patch:
> 
>   v4l2-compat-ioctl32.c: fix the indentation
>   v4l2-compat-ioctl32.c: move 'helper' functions to __get/put_v4l2_format32
>   v4l2-compat-ioctl32.c: avoid sizeof(type)
> 
> No functional changes are introduced in these three patches.
> 
> Note the "fix ctrl_is_pointer" patch: we've discussed this in the past,
> but now I really had to fix this.
> 
> It would be really nice if the next time someone finds a security risk
> in V4L2 core code they would contact the V4L2 maintainers. We only heard
> about this last week, while all the information about this CVE has been
> out there for 6 months or so.
> 
> Backporting this will be a bit of a nightmare since v4l2-compat-ioctl32.c
> changes frequently, so assuming we'll only backport this to lts kernels
> then for each lts the patch series needs to be adapted. But let's get
> this upstream first before looking at that.
> 
> Please review!
> 
> Regards,
> 
> 	Hans
> 
> Changes since v1:
> - Incorporated all Sakari's comments
> - Added the 'v4l2-ioctl.c: don't copy back the result for -ENOTTY' patch
>   (suggested by Sakari).
> - Added back the "Reported-by" tag for the last patch.
> - Added "Co-Developed-by" tag for the last patch.
> - Added "Cc: <stable@vger.kernel.org>      # for v4.15 and up" tags to
>   this series.
> 
> Note: I prefer to backport the whole series to older kernels. Although it
> is just the last patch that is the real fix, it is very hard to verify
> without using v4l2-compliance and vivid. And that requires the other fixes.
> 
> Daniel Mentz (1):
>   v4l2-compat-ioctl32.c: refactor, fix security bug in compat ioctl32
> 
> Hans Verkuil (12):
>   vivid: fix module load error when enabling fb and no_error_inj=1
>   v4l2-ioctl.c: use check_fmt for enum/g/s/try_fmt
>   v4l2-ioctl.c: don't copy back the result for -ENOTTY
>   v4l2-compat-ioctl32.c: add missing VIDIOC_PREPARE_BUF
>   v4l2-compat-ioctl32.c: fix the indentation
>   v4l2-compat-ioctl32.c: move 'helper' functions to
>     __get/put_v4l2_format32
>   v4l2-compat-ioctl32.c: avoid sizeof(type)
>   v4l2-compat-ioctl32.c: copy m.userptr in put_v4l2_plane32
>   v4l2-compat-ioctl32.c: fix ctrl_is_pointer
>   v4l2-compat-ioctl32.c: copy clip list in put_v4l2_window32
>   v4l2-compat-ioctl32.c: drop pr_info for unknown buffer type
>   v4l2-compat-ioctl32.c: don't copy back the result for certain errors
> 
>  drivers/media/platform/vivid/vivid-core.h     |    1 +
>  drivers/media/platform/vivid/vivid-ctrls.c    |   35 +-
>  drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 1033
> +++++++++++++++---------- drivers/media/v4l2-core/v4l2-ioctl.c          | 
> 145 ++--
>  4 files changed, 696 insertions(+), 518 deletions(-)


-- 
Regards,

Laurent Pinchart

      parent reply	other threads:[~2018-01-30 14:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 10:26 [PATCHv2 00/13] v4l2-compat-ioctl32.c: remove set_fs(KERNEL_DS) Hans Verkuil
2018-01-30 10:26 ` [PATCHv2 01/13] vivid: fix module load error when enabling fb and no_error_inj=1 Hans Verkuil
2018-01-30 10:26 ` [PATCHv2 02/13] v4l2-ioctl.c: use check_fmt for enum/g/s/try_fmt Hans Verkuil
2018-01-30 10:26 ` [PATCHv2 03/13] v4l2-ioctl.c: don't copy back the result for -ENOTTY Hans Verkuil
2018-01-30 11:51   ` Sakari Ailus
2018-01-30 10:26 ` [PATCHv2 04/13] v4l2-compat-ioctl32.c: add missing VIDIOC_PREPARE_BUF Hans Verkuil
2018-01-30 10:26 ` [PATCHv2 05/13] v4l2-compat-ioctl32.c: fix the indentation Hans Verkuil
2018-01-30 10:26 ` [PATCHv2 06/13] v4l2-compat-ioctl32.c: move 'helper' functions to __get/put_v4l2_format32 Hans Verkuil
2018-01-30 10:26 ` [PATCHv2 07/13] v4l2-compat-ioctl32.c: avoid sizeof(type) Hans Verkuil
2018-01-30 10:26 ` [PATCHv2 08/13] v4l2-compat-ioctl32.c: copy m.userptr in put_v4l2_plane32 Hans Verkuil
2018-01-30 10:26 ` [PATCHv2 09/13] v4l2-compat-ioctl32.c: fix ctrl_is_pointer Hans Verkuil
2018-01-30 11:51   ` Sakari Ailus
2018-01-30 14:36   ` Laurent Pinchart
2018-01-30 10:26 ` [PATCHv2 10/13] v4l2-compat-ioctl32.c: copy clip list in put_v4l2_window32 Hans Verkuil
2018-01-30 11:50   ` Sakari Ailus
2018-01-30 14:28   ` Laurent Pinchart
2018-01-30 10:26 ` [PATCHv2 11/13] v4l2-compat-ioctl32.c: drop pr_info for unknown buffer type Hans Verkuil
2018-01-30 10:27 ` [PATCHv2 12/13] v4l2-compat-ioctl32.c: don't copy back the result for certain errors Hans Verkuil
2018-01-30 14:32   ` Laurent Pinchart
2018-01-30 14:37     ` Hans Verkuil
2018-01-30 10:27 ` [PATCHv2 13/13] v4l2-compat-ioctl32.c: refactor, fix security bug in compat ioctl32 Hans Verkuil
2018-01-30 11:46   ` Sakari Ailus
2018-01-30 11:53     ` Hans Verkuil
2018-01-30 14:41 ` Laurent Pinchart [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2040102.b8zQ4JN7km@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=danielmentz@google.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox