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: <52C700BC.1010200@samsung.com>
Date:	Fri, 03 Jan 2014 11:26:04 -0700
From:	Shuah Khan <shuah.kh@...sung.com>
To:	Joerg Roedel <joro@...tes.org>
Cc:	akpm@...ux-foundation.org, alexander.h.duyck@...el.com,
	linux-kernel@...r.kernel.org, shuahkhan@...il.com,
	Shuah Khan <shuah.kh@...sung.com>
Subject: Re: [PATCH v2] dma-debug: enhance dma_debug_device_change() to check
 for mapping errors

On 12/30/2013 07:15 AM, Joerg Roedel wrote:
> On Wed, Nov 13, 2013 at 01:56:08PM -0700, Shuah Khan wrote:
>> dma-debug checks to verify if driver validated the address returned by
>> dma mapping routines when driver does unmap. If a driver doesn't call
>> unmap, failure to check mapping errors isn't detected and reported.
>>
>> Enhancing existing bus notifier_call dma_debug_device_change() to check
>> for mapping errors at the same time it detects leaked dma buffers for
>> BUS_NOTIFY_UNBOUND_DRIVER event. It scans for mapping errors and if any
>> found, prints one warning message that includes mapping error count.
>>
>> Signed-off-by: Shuah Khan <shuah.kh@...sung.com>
>> ---
>>   lib/dma-debug.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/lib/dma-debug.c b/lib/dma-debug.c
>> index d87a17a..e34865e 100644
>> --- a/lib/dma-debug.c
>> +++ b/lib/dma-debug.c
>> @@ -717,6 +717,7 @@ static int device_dma_allocations(struct device *dev, struct dma_debug_entry **o
>>   	struct dma_debug_entry *entry;
>>   	unsigned long flags;
>>   	int count = 0, i;
>> +	int map_err_cnt = 0;
>>
>>   	local_irq_save(flags);
>>
>> @@ -724,6 +725,8 @@ static int device_dma_allocations(struct device *dev, struct dma_debug_entry **o
>>   		spin_lock(&dma_entry_hash[i].lock);
>>   		list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
>>   			if (entry->dev == dev) {
>> +				if (entry->map_err_type == MAP_ERR_NOT_CHECKED)
>> +					map_err_cnt += 1;
>>   				count += 1;
>>   				*out_entry = entry;
>
> I think it is better to check for this in a seperate function and use
> err_printk instead of dev_warn in the end to print the errors.
> The new function can then be called in the dma_debug_device_change
> callback like device_dma_allocations is.
>

I did explore separate function option and backed off from it since the 
new routine will have to duplicate what device_dma_allocations() does 
except that it checks for entry->map_err_type.

I still have the patch that does that saved away. If you still prefer 
that approach, I can rework the patch and send it.

-- Shuah


-- 
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
shuah.kh@...sung.com | (970) 672-0658
--
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