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]
Message-ID: <AANLkTim6kkxV8Bts=CNQqWmCgT+NUi4YoxZYPGCX7ttD@mail.gmail.com>
Date:	Wed, 29 Dec 2010 11:51:34 +0200
From:	Ohad Ben-Cohen <ohad@...ery.com>
To:	Felipe Contreras <felipe.contreras@...il.com>
Cc:	Felipe Contreras <felipe.contreras@...ia.com>,
	linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org,
	greg@...ah.com, omar.ramirez@...com, fernando.lugo@...com,
	nm@...com, ameya.palande@...ia.com, h-kanigeri2@...com
Subject: Re: [PATCH v2] staging: tidspbridge: protect dmm_map properly

On Wed, Dec 29, 2010 at 11:42 AM, Felipe Contreras
<felipe.contreras@...il.com> wrote:
> On Tue, Dec 28, 2010 at 4:48 PM, Ohad Ben-Cohen <ohad@...ery.com> wrote:
>> On Tue, Dec 28, 2010 at 2:12 PM, Felipe Contreras
>> <felipe.contreras@...il.com> wrote:
>>> On Tue, Dec 28, 2010 at 12:56 PM, Ohad Ben-Cohen <ohad@...ery.com> wrote:
>>>> I still don't know how exactly you triggered the bug: is gst-dsp
>>>> multithreaded ? and one of its threads invoked proc_un_map() while
>>>> another thread called proc_begin_dma() ?
>>>
>>> I haven't investigated why that happens
>>
>> Btw, I still think you should look into this.
>>
>> The kernel panic will be solved, but you may still have a race there
>> that can lead to data corruption: if proc_un_map will be fast enough,
>> it will acquire the proc_lock mutex before proc_begin_dma(), and then
>> you will miss a cache operation.
>
> Aquiring the lock is the first thing done; if proc_un_map() aquires
> the lock first, it's because it was run first

Not true.

Again, we have two threads:

T1 - called proc_begin_dma()

T2 - called proc_un_map()

Let's say T1 called proc_begin_dma() first, but it still didn't
acquire the lock.

At this point the scheduler let T2 run. It calls proc_un_map() and
acquire the lock, and free all map_obj's.

Then the scheduler let T1 continue to execute, but it can't find any
map_obj, and the required cache operation is not performed.

Of course the kernel has nothing to do with this, and don't care really.

That's why I said it's a user space race - you need to make sure T2
will not call proc_un_map() before T1 (or any other thread you have)
completed executing all DMA operations (that you care about).

>, and thus a problem for
> user-space. If user-space wants the cache operation, it must run
> proc_begin_dma() first, there's nothing kernel-space can do to fix
> that.
>
> --
> Felipe Contreras
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ