[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b0c82199-fb96-08a2-6158-cb1655b6ba3d@kernel.dk>
Date: Wed, 22 Feb 2023 11:30:15 -0700
From: Jens Axboe <axboe@...nel.dk>
To: Breno Leitao <leitao@...ian.org>, asml.silence@...il.com,
io-uring@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, gustavold@...a.com, leit@...a.com,
kasan-dev@...glegroups.com, Breno Leitao <leit@...com>
Subject: Re: [PATCH v2 2/2] io_uring: Add KASAN support for alloc_caches
On 2/22/23 11:00?AM, Breno Leitao wrote:
> -static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *cache)
> +static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *cache,
> + size_t size)
> {
> if (cache->list.next) {
> struct io_cache_entry *entry;
> entry = container_of(cache->list.next, struct io_cache_entry, node);
> + kasan_unpoison_range(entry, size);
> cache->list.next = cache->list.next->next;
> return entry;
> }
Does this generate the same code if KASAN isn't enabled? Since there's a
4-byte hole in struct io_alloc_cache(), might be cleaner to simply add
the 'size' argument to io_alloc_cache_init() and store it in the cache.
Then the above just becomes:
kasan_unpoison_range(entry, cache->elem_size);
instead and that'd definitely generate the same code as before if KASAN
isn't enabled.
--
Jens Axboe
Powered by blists - more mailing lists