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: <1346855696.2589.7.camel@lorien2>
Date:	Wed, 05 Sep 2012 08:34:56 -0600
From:	Shuah Khan <shuah.khan@...com>
To:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc:	joerg.roedel@....com, paul.gortmaker@...driver.com, kubakici@...pl,
	stern@...land.harvard.edu, dan.carpenter@...cle.com,
	rob@...dley.net, linux-doc@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>, shuahkhan@...il.com
Subject: Re: [PATCH] dma-debug: Add dma map/unmap error tracking support

On Wed, 2012-09-05 at 07:57 -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, Sep 04, 2012 at 04:57:56PM -0600, Shuah Khan wrote:
> > On Tue, 2012-09-04 at 17:05 -0400, Konrad Rzeszutek Wilk wrote:
> > > On Sun, Sep 02, 2012 at 08:14:17AM -0600, Shuah Khan wrote:
> > > > A recent dma mapping error analysis effort showed that a large precentage
> > > > of dma_map_single() and dma_map_page() returns are not checked for mapping
> > > > errors. Reference: https://lkml.org/lkml/2012/8/10/326
> > > > 
> > > 
> > > So were you able to catch some naughty drivers with this?
> > 
> > I did compile a complete list of drivers that don't check dma mapping
> > errors from my analysis. Are you interested in seeing the full analysis?
> 
> Yes, plus the authors of the drivers are probably interested in it as
> well.
> ..snip..

I compiled very detailed information on the nature of problems with dma
mapping error checking, ranging from not checking mapping errors to not
unmapping etc. I would like to share this information in such a way that
others can leverage the research I already did. One good way to
communicate this information would be on one of the kernel wikis. Ideas,
suggestions?

> > > I was initially thinking that this patch would contain a state for the driver
> > > of whether after map it has called dma_mapping_error. So this function would
> > > increment some internal state, and if dma_mapping_error on that specific dma_addr
> > > it would decrement it. If it never occured, then we would print on the unmap
> > > that the device never had called dma_mapping_error on said dma_addr?
> > 
> > That is a good idea. Let me see if I understand what you are saying
> > correctly. Add a new field to dma_debug_entry structure and keep state
> > and clear it if dma_mapping_error() is called. This will require adding
> > a debug interface for dma_mapping_error() which is not hard to do. Is
> > this close to what you are thinking?
> 
> Right. It is more complex than this patch but it should provide a nicer
> "trap" mechanism to alert driver writers that they are not checking DMA
> addresses properly.

I will go back and work on improving this patch. I will have to think
about how to track overflow buffer triggers as well without impacting
the production kernel. That is a separate effort.

-- Shuah


--
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