Module Name:    src
Committed By:   mrg
Date:           Sun Jun  9 18:55:00 UTC 2024

Modified Files:
        src/crypto/external/bsd/openssl/lib/libcrypto: blake2.inc
        src/lib/libc/citrus: citrus_module.c
        src/lib/libc/stdlib: strsuftoll.c

Log Message:
m68k vs GCC 12: apply -fno-stack-protector to a few things.

i've looked at the C code here and i can't see any real problems,
and in at least the strsuftoll.c case, i'm convinced it is not a
real problem for the reported case, and indicates a GCC bug.

for strsuftoll.c, this fixes basic parsing of almost any input.
the simple test case is "dd count=1".  in my testing, it was only
the front-end strsuftoll() that needs the checking removed, the
sub-functions are fine.

for citrus_module.c, this fixes "env LC_CTYPE=en_US.UTF-8 locale",
and i was able to reduce to only _citrus_find_getops().

for blake2_prov.c, i chose to apply to the whole file to avoid
editing a 3rd-party source.

these issues and their source-file fixes were discovered by rin@.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
    src/crypto/external/bsd/openssl/lib/libcrypto/blake2.inc
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/citrus/citrus_module.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/stdlib/strsuftoll.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/blake2.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/blake2.inc:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/blake2.inc:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/blake2.inc:1.2	Sat May  6 17:07:22 2023
+++ src/crypto/external/bsd/openssl/lib/libcrypto/blake2.inc	Sun Jun  9 18:55:00 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: blake2.inc,v 1.2 2023/05/06 17:07:22 christos Exp $
+#	$NetBSD: blake2.inc,v 1.3 2024/06/09 18:55:00 mrg Exp $
 #
 #	@(#) Copyright (c) 1995 Simon J. Gerraty
 #
@@ -19,3 +19,7 @@ SRCS += ${BLAKE2_SRCS}
 .for cryptosrc in ${BLAKE2_SRCS}
 CPPFLAGS.${cryptosrc} = -I${OPENSSLSRC}/crypto/blake2
 .endfor
+
+.if ${MACHINE_ARCH} == "m68k"
+COPTS.blake2_prov.c += -fno-stack-protector
+.endif

Index: src/lib/libc/citrus/citrus_module.c
diff -u src/lib/libc/citrus/citrus_module.c:1.13 src/lib/libc/citrus/citrus_module.c:1.14
--- src/lib/libc/citrus/citrus_module.c:1.13	Thu Jan  4 20:57:28 2018
+++ src/lib/libc/citrus/citrus_module.c	Sun Jun  9 18:55:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: citrus_module.c,v 1.13 2018/01/04 20:57:28 kamil Exp $	*/
+/*	$NetBSD: citrus_module.c,v 1.14 2024/06/09 18:55:00 mrg Exp $	*/
 
 /*-
  * Copyright (c)1999, 2000, 2001, 2002 Citrus Project,
@@ -89,7 +89,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_module.c,v 1.13 2018/01/04 20:57:28 kamil Exp $");
+__RCSID("$NetBSD: citrus_module.c,v 1.14 2024/06/09 18:55:00 mrg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -275,6 +275,9 @@ _findshlib(char *name, int *majorp, int 
 	return path[0] ? path : NULL;
 }
 
+#ifdef __m68k__	/* See doc/HACKS. */
+__attribute((__optimize__("-fno-stack-protector")))
+#endif
 void *
 _citrus_find_getops(_citrus_module_t handle, const char *modname,
 		    const char *ifname)

Index: src/lib/libc/stdlib/strsuftoll.c
diff -u src/lib/libc/stdlib/strsuftoll.c:1.9 src/lib/libc/stdlib/strsuftoll.c:1.10
--- src/lib/libc/stdlib/strsuftoll.c:1.9	Sat Oct 22 22:08:47 2011
+++ src/lib/libc/stdlib/strsuftoll.c	Sun Jun  9 18:55:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: strsuftoll.c,v 1.9 2011/10/22 22:08:47 christos Exp $	*/
+/*	$NetBSD: strsuftoll.c,v 1.10 2024/06/09 18:55:00 mrg Exp $	*/
 /*-
  * Copyright (c) 2001-2002,2004 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -67,7 +67,7 @@
 #include <sys/cdefs.h>
 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strsuftoll.c,v 1.9 2011/10/22 22:08:47 christos Exp $");
+__RCSID("$NetBSD: strsuftoll.c,v 1.10 2024/06/09 18:55:00 mrg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef _LIBC
@@ -111,6 +111,9 @@ __weak_alias(strsuftollx, _strsuftollx)
  * appropriate error.
  * 
  */
+#ifdef __m68k__	/* See doc/HACKS. */
+__attribute((__optimize__("-fno-stack-protector")))
+#endif
 /* LONGLONG */
 long long
 strsuftoll(const char *desc, const char *val,

Reply via email to