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] [day] [month] [year] [list]
Message-ID: <4ADF01E9.4030404@suse.de>
Date:	Wed, 21 Oct 2009 18:13:21 +0530
From:	Suresh Jayaraman <sjayaraman@...e.de>
To:	Hugh Dickins <hugh.dickins@...cali.co.uk>
CC:	Rafael Wysocki <rjw@...k.pl>, Jens Axboe <axboe@...nel.dk>,
	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] swapfile: avoid NULL pointer dereference in swapon when
 s_bdev is NULL

Suresh Jayaraman wrote:
> Hugh Dickins wrote:
>> On Thu, 1 Oct 2009, Suresh Jayaraman wrote:
>>> Hugh Dickins wrote:
>>>> On Thu, 1 Oct 2009, Suresh Jayaraman wrote:
>>>>> The call sequence is add_to_swap() -> get_swap_page() ->  scan_swap_map()
>>>>> -> discard_swap_cluster() -> blkdev_issue_discard().
>>>>>
>>>>> Wrapping the code around a NULL check fixes the Oops for me.
>>>> That's odd: scan_swap_map() should only discard_swap_cluster() if
>>>> SWP_DISCARDABLE got set, and your first patch made sure that it wasn't.
>>> I forgot to mention, this is not on loopback NFS mount but an remote NFS
>>> mount (so possibly s_bdev is not NULL) when doing swapon. The oops was
>>> triggered when memhog program tries to use the swap space on the newly
>>> created swapfile on NFS. I have not completely investigated the issue,
>>> perhaps s_bdev is not being set when it ought to be..
>> I'm happy to see your first patch already in 2.6.32-rc3, but still
>> suspicious of this second patch you sent afterwards.  A quick skim
>> through your patchset suggests 23/31 is probably responsible:
> 
> Thanks for skimming through those patches. I noticed this already during
> my review and thought I had already fixed this, but apparently I missed
> out. I'll test after fixing this and report.

Sorry about the delay. I tested by fixing SWP_FILE macro only now after
returning from vacation. I was not able to reproduce this. Please ignore
the second patch and it's no longer necessary as noted by Hugh already.

Thanks,


>> --- mmotm.orig/include/linux/swap.h
>> +++ mmotm/include/linux/swap.h
>> @@ -120,6 +120,7 @@ struct swap_extent {
>>  enum {
>>  	SWP_USED	= (1 << 0),	/* is slot in swap_info[] used? */
>>  	SWP_WRITEOK	= (1 << 1),	/* ok to write to this swap?	*/
>> +	SWP_FILE	= (1 << 2),	/* file swap area */
>>  	SWP_DISCARDABLE = (1 << 2),	/* blkdev supports discard */
>>  	SWP_DISCARDING	= (1 << 3),	/* now discarding a free cluster */
>>  	SWP_SOLIDSTATE	= (1 << 4),	/* blkdev seeks are cheap */
>>
>> Hugh
> 
> Thanks,
> 


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