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]
Date:	Tue, 19 Oct 2010 13:55:08 +0200
From:	Jens Axboe <axboe@...nel.dk>
To:	Vivek Goyal <vgoyal@...hat.com>
CC:	Andi Kleen <andi@...stfloor.org>, torvalds@...ux-foundation.org,
	linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] Fix array overflow in CFQ

On 2010-10-19 13:49, Vivek Goyal wrote:
> On Tue, Oct 19, 2010 at 12:01:40PM +0200, Jens Axboe wrote:
>> On 2010-10-19 11:10, Andi Kleen wrote:
>>> From: Andi Kleen <ak@...ux.intel.com>
>>>
>>> gcc 4.5 complains when compiling a recent rc with
>>>
>>> linux/block/cfq-iosched.c: In function ‘cfq_dispatch_requests’:
>>> linux/block/cfq-iosched.c:2156:3: warning: array subscript is above array bounds
>>>
>>> and it is right:
>>>
>>>  slice = group_slice * count /
>>>                 max_t(unsigned, cfqg->busy_queues_avg[cfqd->serving_prio],
>>>                       cfq_group_busy_queues_wl(cfqd->serving_prio, cfqd, cfqg));
>>>
>>> busy_queues_avg can be indexed by this enum
>>>
>>> enum wl_prio_t {
>>>         BE_WORKLOAD = 0,
>>>         RT_WORKLOAD = 1,
>>>         IDLE_WORKLOAD = 2,
>>> };
>>>
>>> in cfqd->serving_prio, but is only declared as
>>>
>>> unsigned int busy_queues_avg[2];
>>>
>>> which is clearly off by one. Fix this here.
>>
>> Indeed, that is definitely buggy. ->service_trees[][] looks buggy, too.
>> WTF?!
> 
> Hi Jens,
> 
> busy_queues_avg[] definitely looks buggy. Looks like I introduced this bug
> while converting corrado's logic to group logic. I will fix it in a while.
> Sorry for the goof up here.
> 
> ->service_trees[][] is not buggy. We maintain workload subclassification
> only for RT and BE class. For IDLE class, there are no ASYNC_WORKLOAD,
> SYNC_NOIDLE_WORKLOAD or SYNC_WORKLOAD. All the type of idle queues
> go onto a separate service tree, service_tree_idle.

Right, that one looks convoluted (but correct). Ugh:

#define for_each_cfqg_st(cfqg, i, j, st) \
        for (i = 0; i <= IDLE_WORKLOAD; i++) \
                for (j = 0, st = i < IDLE_WORKLOAD ?  &cfqg->service_trees[i][j]\
                        : &cfqg->service_tree_idle; \
                        (i < IDLE_WORKLOAD && j <= SYNC_WORKLOAD) || \
                        (i == IDLE_WORKLOAD && j == 0); \
                        j++, st = i < IDLE_WORKLOAD ? \
                        &cfqg->service_trees[i][j]: NULL) \

-- 
Jens Axboe

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