tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Usage of strncpy in the kernel



On Tue, 7 Jan 2025, Martin Husemann wrote:

On Tue, Jan 07, 2025 at 07:58:11PM +0000, nia wrote:
On Mon, Jan 06, 2025 at 03:23:45PM -0500, Mouse wrote:
No, that's not all.  It also fills the rest, if any, of the destination
space with more NULs.  (This can be useful to, for example, prevent
leaking kernel stack trash to userland.)

Unfortunately modern compilers no longer guarantee this is true.

What are you refereing to?


Over-aggressive dead store elimination (DSE) by compilers, I think. But, I
would categorize these as bugs if they change strncpy() semantics.

-RVP


Home | Main Index | Thread Index | Old Index