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: <20251128121919.521ec9bf@robin>
Date: Fri, 28 Nov 2025 12:19:19 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Kees Cook <kees@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
 linux-hardening@...r.kernel.org, Linux Trace Kernel
 <linux-trace-kernel@...r.kernel.org>, Masami Hiramatsu
 <mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
 "Gustavo A. R. Silva" <gustavoars@...nel.org>
Subject: Re: [PATCH] overflow: Introduce struct_offset() to get offset of
 member

On Thu, 27 Nov 2025 21:35:35 -0800
Linus Torvalds <torvalds@...ux-foundation.org> wrote:

> So that 'xyz_t()' version then gets used for things where you
> explicitly state the type, and it all looks fairly obvious, eg:
> 
>         len = struct_size_t(struct pid, numbers, level + 1);
> 
> doesn't get that "WHAA?!??!" kind of reaction.
> 
> [ And so I actually think it's good that it only takes an explicit
> type - if you really have an instance, I think it's better to use just
> "struct_size(&instance, ...)" even if we _could_ easily make syntax
> like "struct_size_t(instance, ...)" work. ]

I was thinking about adding a struct_offset_t() but then I noticed that
struct_size_t() requires adding the type as it is for just getting the
size of the struct without using a variable. Whereas, I would have
preferred the struct_offset_t() to use a variable that's not a pointer
where typeof() is used.

But for my use cases, I can just add a '&' to struct_offset(), as if
struct_offset_t() were to take a type, it is no different than
offsetof().

-- Steve



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ