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: <4CC19ACA.6060600@kernel.dk>
Date:	Fri, 22 Oct 2010 16:08:10 +0200
From:	Jens Axboe <axboe@...nel.dk>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	Boaz Harrosh <bharrosh@...asas.com>, Ted Ts'o <tytso@....edu>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>
Subject: Re: What am I doing wrong?  submit_bio() suddenly stops working...

On 2010-10-22 15:04, Peter Zijlstra wrote:
> On Thu, 2010-10-21 at 20:07 +0200, Jens Axboe wrote:
>>
>>>> +    do {
>>>> +            bio = bio_alloc(GFP_NOIO, nvecs);
>>>> +            nvecs >>= 1;
>>>> +    } while (bio == NULL);
>>>
>>> This is surly bad. bio_alloc must be allowed to fail
>>> (Specially with GFP_NOIO). You should only loop down to
>>> 1 and then prepare to return -ENOMEM from this function
>>> and handle it properly in callers. (Or schedule and wait
>>> like below)
>>
>> Since __GFP_WAIT is set, it'll never return NULL. And as long as you
>> don't allocate more than 1 before doing you submit_bio(), it should be
>> OK in this case. 
> 
> __GFP_WAIT can return NULL, on OOM and when the size is over a magic
> threshold.

The memory allocator, yes, but a mempool backed allocation with
__GFP_WAIT cannot. That's the difference.

> I find it bad form to rely on any allocation not failing.

On that we can agree, but it's not always easily doable. I bet you would
not like the block layer tossing IOs if it can't get a bio or request
structure :-)

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ