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: <bcb88692-a384-4da8-b2b9-a116ecb17530@embeddedor.com>
Date: Wed, 7 Aug 2024 09:29:09 -0600
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Thorsten Blum <thorsten.blum@...lux.com>, paulmck@...nel.org,
 frederic@...nel.org, neeraj.upadhyay@...nel.org, joel@...lfernandes.org,
 josh@...htriplett.org, boqun.feng@...il.com, urezki@...il.com,
 rostedt@...dmis.org, mathieu.desnoyers@...icios.com, jiangshanlai@...il.com,
 qiang.zhang1211@...il.com, kees@...nel.org, gustavoars@...nel.org
Cc: rcu@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-hardening@...r.kernel.org
Subject: Re: [PATCH] rcu: Annotate struct kvfree_rcu_bulk_data with
 __counted_by()



On 07/08/24 03:55, Thorsten Blum wrote:
> Add the __counted_by compiler attribute to the flexible array member
> records to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> CONFIG_FORTIFY_SOURCE.
> 
> Increment nr_records before adding a new pointer to the records array.
> 

Looks good.

> Signed-off-by: Thorsten Blum <thorsten.blum@...lux.com>

Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>

Thanks
--
Gustavo

> ---
>   kernel/rcu/tree.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index e641cc681901..76d8d75dd8b3 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3227,7 +3227,7 @@ struct kvfree_rcu_bulk_data {
>   	struct list_head list;
>   	struct rcu_gp_oldstate gp_snap;
>   	unsigned long nr_records;
> -	void *records[];
> +	void *records[] __counted_by(nr_records);
>   };
>   
>   /*
> @@ -3767,7 +3767,8 @@ add_ptr_to_bulk_krc_lock(struct kfree_rcu_cpu **krcp,
>   	}
>   
>   	// Finally insert and update the GP for this page.
> -	bnode->records[bnode->nr_records++] = ptr;
> +	bnode->nr_records++;
> +	bnode->records[bnode->nr_records - 1] = ptr;
>   	get_state_synchronize_rcu_full(&bnode->gp_snap);
>   	atomic_inc(&(*krcp)->bulk_count[idx]);
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ