mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sekhar Nori <nsekhar@ti.com>
To: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Kevin Hilman <khilman@kernel.org>,
	linux-media <linux-media@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] [media] davinci/dm644x: work around ccdc_update_raw_params trainwreck
Date: Tue, 27 Jun 2017 15:43:45 +0530	[thread overview]
Message-ID: <1b0671fa-fec7-11fa-6b91-0afad904c651@ti.com> (raw)
In-Reply-To: <CA+V-a8vFYtOc1tARPL1tH3XafXY30p0pAeJjy7qEzF0RkL9cNQ@mail.gmail.com>

On Tuesday 20 June 2017 06:36 PM, Lad, Prabhakar wrote:
> Hi Arnd,
> 
> Thanks for the patch.
> 
> On Fri, Jun 9, 2017 at 10:36 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> Now that the davinci drivers can be enabled in compile tests on other
>> architectures, I ran into this warning on a 64-bit build:
>>
>> drivers/media/platform/davinci/dm644x_ccdc.c: In function 'ccdc_update_raw_params':
>> drivers/media/platform/davinci/dm644x_ccdc.c:279:7: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>>
>> While that looks fairly harmless (it would be fine on 32-bit), it was
>> just the tip of the iceberg:
>>
>> - The function constantly mixes up pointers and phys_addr_t numbers
>> - This is part of a 'VPFE_CMD_S_CCDC_RAW_PARAMS' ioctl command that is
>>   described as an 'experimental ioctl that will change in future kernels',
>>   but if we have users that probably won't happen.
>> - The code to allocate the table never gets called after we copy_from_user
>>   the user input over the kernel settings, and then compare them
>>   for inequality.
>> - We then go on to use an address provided by user space as both the
>>   __user pointer for input and pass it through phys_to_virt to come up
>>   with a kernel pointer to copy the data to. This looks like a trivially
>>   exploitable root hole.
>>
>> This patch disables all the obviously broken code, by zeroing out the
>> sensitive data provided by user space. I also fix the type confusion
>> here. If we think the ioctl has no stable users, we could consider
>> just removing it instead.
>>
> I suspect there shouldn’t  be possible users of this IOCTL, better of  removing
> the IOCTL itself.
> 
> Sekhar your call, as the latest PSP releases for 644x use the media
> controller framework.

I do not have any personal experience with anyone using this support
with latest kernels. I too am okay with removing the broken support.

Since the header file that defines the ioctl is not in include/uapi/*, I
guess it cannot be considered stable userspace ABI? Also, there are
enough warnings about instability thrown in the comments surrounding the
ioctl in include/media/davinci/vpfe_capture.h.

Thanks,
Sekhar

  reply	other threads:[~2017-06-27 10:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09 21:36 Arnd Bergmann
2017-06-20 13:06 ` Lad, Prabhakar
2017-06-27 10:13   ` Sekhar Nori [this message]
2017-06-27 11:08     ` Arnd Bergmann
2017-06-30  9:37       ` Lad, Prabhakar

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=1b0671fa-fec7-11fa-6b91-0afad904c651@ti.com \
    --to=nsekhar@ti.com \
    --cc=arnd@arndb.de \
    --cc=khilman@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    /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

all inboxes | Powered by JetHome®