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:   Mon, 12 Sep 2022 15:29:30 +0800
From:   Ben Luo <luoben@...ux.alibaba.com>
To:     Hyeonggon Yoo <42.hyeyoo@...il.com>
Cc:     cl@...ux.com, penberg@...nel.org, rientjes@...gle.com,
        iamjoonsoo.kim@....com, akpm@...ux-foundation.org, vbabka@...e.cz,
        roman.gushchin@...ux.dev, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/slub: return 0 when object pointer is NULL

Hello Hyeonggon,

Thanks for replying :)

在 2022/9/12 15:18, Hyeonggon Yoo 写道:
> On Mon, Sep 12, 2022 at 01:59:39PM +0800, Ben Luo wrote:
>> NULL is definitly not a valid address
>>
>> Signed-off-by: Ben Luo <luoben@...ux.alibaba.com>
>> ---
>>   mm/slub.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/slub.c b/mm/slub.c
>> index 862dbd9..50fad18 100644
>> --- a/mm/slub.c
>> +++ b/mm/slub.c
>> @@ -674,7 +674,7 @@ static inline int check_valid_pointer(struct kmem_cache *s,
>>   	void *base;
>>   
>>   	if (!object)
>> -		return 1;
>> +		return 0;
>>   
>>   	base = slab_address(slab);
>>   	object = kasan_reset_tag(object);
>> -- 
>> 1.8.3.1
>>
> Hello Ben.
>
> The return value is used to check if the @object has valid pointer
> in @slab. (used for debugging) the return value is 0 if valid, 1 if invalid.
>
> It does not return a pointer. So changing it to 0 because 1 is invalid
> address does not make sense.

I know the meaning of this return value, but I think this function was 
expected by returning 0 if invalid ,1 if valid

Check this original code:

         if (object < base || object >= base + slab->objects * s->size ||
                 (object - base) % s->size) {
                 return 0;
         }

Object not in range of [base, base+length) is an invalid slab address, 
and it will return 0


--

Thanks,

Ben

>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ