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: <f0ed3589-3bab-48a7-a2aa-225b7f4c2dff@suse.cz>
Date: Fri, 24 Jan 2025 16:41:38 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Kevin Brodsky <kevin.brodsky@....com>,
 "Christoph Lameter (Ampere)" <cl@...two.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
 Pekka Enberg <penberg@...nel.org>, David Rientjes <rientjes@...gle.com>,
 Joonsoo Kim <iamjoonsoo.kim@....com>,
 Andrew Morton <akpm@...ux-foundation.org>,
 Roman Gushchin <roman.gushchin@...ux.dev>,
 Hyeonggon Yoo <42.hyeyoo@...il.com>
Subject: Re: [PATCH] mm/slab: simplify SLAB_* flag handling

On 1/21/25 11:46, Kevin Brodsky wrote:
> On 17/01/2025 23:13, Christoph Lameter (Ampere) wrote:
>> On Fri, 17 Jan 2025, Kevin Brodsky wrote:
>>
>>> index a29457bef626..3b07cdaac3ae 100644
>>> --- a/mm/slab_common.c
>>> +++ b/mm/slab_common.c
>>> @@ -305,18 +305,6 @@ struct kmem_cache *__kmem_cache_create_args(const char *name,
>>>  		goto out_unlock;
>>>  	}
>>>
>>> -	/* Refuse requests with allocator specific flags */
>>> -	if (flags & ~SLAB_FLAGS_PERMITTED) {
>>> -		err = -EINVAL;
>>> -		goto out_unlock;
>>> -	}
>> I think we should keep checking for invalid flags.
> 
> The commit that introduced this check [1] aimed to ensure that no
> allocator-specific flag is passed to kmem_cache_create(), so it seemed
> to me it was no longer needed now that allocator-specific flags are gone.
> 
> Having said that, we could keep it in order to reject flags that are not
> supposed to be passed to kmem_cache_create() (e.g. SLAB_SKIP_KFENCE).
> With that approach we'd just need to clear SLAB_DEBUG_FLAGS below if
> !CONFIG_SLUB_DEBUG (and get rid of CACHE_CREATE_MASK).

Sounds like a good plan to me, thanks!

> - Kevin
> 
> [1]
> https://lore.kernel.org/all/1478553075-120242-2-git-send-email-thgarnie@google.com/
> 
>>> -	/*
>>> -	 * Some allocators will constraint the set of valid flags to a subset
>>> -	 * of all flags. We expect them to define CACHE_CREATE_MASK in this
>>> -	 * case, and we'll just provide them with a sanitized version of the
>>> -	 * passed flags.
>>> -	 */
>>>  	flags &= CACHE_CREATE_MASK;
>> This would silently clear some flags instead of creating an error.
> 
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ