[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKYAXd9ihJRoY0yzS9mANHBQGM7zPRsSMzo4784bKLqj0MzGMQ@mail.gmail.com>
Date: Sat, 28 Sep 2024 09:53:30 +0900
From: Namjae Jeon <linkinjeon@...nel.org>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Steve French <sfrench@...ba.org>, Sergey Senozhatsky <senozhatsky@...omium.org>,
Tom Talpey <tom@...pey.com>, Kees Cook <kees@...nel.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>, linux-cifs@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2] ksmbd: Annotate struct copychunk_ioctl_req with __counted_by_le()
On Wed, Sep 25, 2024 at 6:10 PM Thorsten Blum <thorsten.blum@...ux.dev> wrote:
>
> Add the __counted_by_le compiler attribute to the flexible array member
> Chunks to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> CONFIG_FORTIFY_SOURCE.
>
> Change the data type of the flexible array member Chunks from __u8[] to
> struct srv_copychunk[] for ChunkCount to match the number of elements in
> the Chunks array. (With __u8[], each srv_copychunk would occupy 24 array
> entries and the __counted_by compiler attribute wouldn't be applicable.)
>
> Use struct_size() to calculate the size of the copychunk_ioctl_req.
>
> Read Chunks[0] after checking that ChunkCount is not 0.
>
> Compile-tested only.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
Applied it to #ksmbd-for-next-next.
Thanks!
Powered by blists - more mailing lists