NetBSD-Users archive

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

Re: firefox52 core dump on RPI2 NetBSD9.1



On Fri, Nov 27, 2020 at 11:29:13PM -0500, Jeffrey Walton wrote:
> > Concerning the core dumps, there is another thing to look at:
> > _FORTIFY_SOURCE. There are checks about the use of strings functions
> > that can cause an abort even if the actual use is probably, with
> > a classic C implementation, safe---I hit it with a strcpy() that was
> > removing a prefix simply shifting bytes left in a buffer; it didn't
> > cause any harm before 9.* and now aborts because src and dst overlap.
> 
> Off-topic, but that's undefined behavior. You should use memmove in
> the case when src and dest overlap.

This is very important. While there are lots of undefined behaviours
where we *know* the concrete behaviour (for all architectures) on
NetBSD is OK (so we could choose to ignore the issue), this example is
one that breaks in subtle ways (depending on architecture and alignemnt
of the string buffer) with some assembler implementations of the string
operation.

The "it didn't cause any harm before 9.*" is due to limited testing, small
selection of architectures, or just plain luck in this case.

Martin


Home | Main Index | Thread Index | Old Index