CVS commit: [netbsd-9] src/sys/lib/libsa

2023-06-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  3 14:35:18 UTC 2023

Modified Files:
src/sys/lib/libsa [netbsd-9]: subr_prf.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #1636):

sys/lib/libsa/subr_prf.c: revision 1.30

libsa/printf: Do not fetch long va_arg as long long.

This does real harm iff all of the following conditions are satisfied:
(1) On ILP32 architectures.
(2) Both LIBSA_PRINTF_LONGLONG_SUPPORT and LIBSA_PRINTF_WIDTH_SUPPORT
compile-time options are enabled.
(3) Width field is used with 'l' modifier.

This is an implicit-fallthrough bug, but unfortunately, GCC 10.4 cannot
find this out somehow...


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.4.1 src/sys/lib/libsa/subr_prf.c

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

Modified files:

Index: src/sys/lib/libsa/subr_prf.c
diff -u src/sys/lib/libsa/subr_prf.c:1.28 src/sys/lib/libsa/subr_prf.c:1.28.4.1
--- src/sys/lib/libsa/subr_prf.c:1.28	Sun Feb  3 11:59:43 2019
+++ src/sys/lib/libsa/subr_prf.c	Sat Jun  3 14:35:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.28 2019/02/03 11:59:43 mrg Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.28.4.1 2023/06/03 14:35:18 martin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -202,6 +202,7 @@ reswitch:
 	break;
 ++fmt;
 			}
+			goto reswitch;
 #endif
 		case 'l':
 #ifdef LIBSA_PRINTF_LONGLONG_SUPPORT



CVS commit: [netbsd-9] src/sys/lib/libsa

2023-06-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  3 14:35:18 UTC 2023

Modified Files:
src/sys/lib/libsa [netbsd-9]: subr_prf.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #1636):

sys/lib/libsa/subr_prf.c: revision 1.30

libsa/printf: Do not fetch long va_arg as long long.

This does real harm iff all of the following conditions are satisfied:
(1) On ILP32 architectures.
(2) Both LIBSA_PRINTF_LONGLONG_SUPPORT and LIBSA_PRINTF_WIDTH_SUPPORT
compile-time options are enabled.
(3) Width field is used with 'l' modifier.

This is an implicit-fallthrough bug, but unfortunately, GCC 10.4 cannot
find this out somehow...


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.4.1 src/sys/lib/libsa/subr_prf.c

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



CVS commit: [netbsd-9] src/sys/lib/libsa

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 19:17:15 UTC 2019

Modified Files:
src/sys/lib/libsa [netbsd-9]: loadfile_elf32.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #361):

sys/lib/libsa/loadfile_elf32.c: revision 1.56

Make sure we're dealing with a static binary. Otherwise we could crash if
the user mistakenly tries to boot a KASLR kernel with 'boot' instead of
'pkboot'. Now we fail cleanly. Reported by cryo@.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.2.1 src/sys/lib/libsa/loadfile_elf32.c

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

Modified files:

Index: src/sys/lib/libsa/loadfile_elf32.c
diff -u src/sys/lib/libsa/loadfile_elf32.c:1.55 src/sys/lib/libsa/loadfile_elf32.c:1.55.2.1
--- src/sys/lib/libsa/loadfile_elf32.c:1.55	Sun Jul 21 16:53:17 2019
+++ src/sys/lib/libsa/loadfile_elf32.c	Wed Oct 23 19:17:15 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.55 2019/07/21 16:53:17 rin Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.55.2.1 2019/10/23 19:17:15 martin Exp $ */
 
 /*
  * Copyright (c) 1997, 2008, 2017 The NetBSD Foundation, Inc.
@@ -699,6 +699,11 @@ ELFNAMEEND(loadfile_static)(int fd, Elf_
 
 	internalize_ehdr(elf->e_ident[EI_DATA], elf);
 
+	if (elf->e_type != ET_EXEC) {
+		errno = EINVAL;
+		return 1;
+	}
+
 	sz = elf->e_phnum * sizeof(Elf_Phdr);
 	phdr = ALLOC(sz);
 	ret = ELFNAMEEND(readfile_local)(fd, elf->e_phoff, phdr, sz);



CVS commit: [netbsd-9] src/sys/lib/libsa

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 19:17:15 UTC 2019

Modified Files:
src/sys/lib/libsa [netbsd-9]: loadfile_elf32.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #361):

sys/lib/libsa/loadfile_elf32.c: revision 1.56

Make sure we're dealing with a static binary. Otherwise we could crash if
the user mistakenly tries to boot a KASLR kernel with 'boot' instead of
'pkboot'. Now we fail cleanly. Reported by cryo@.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.2.1 src/sys/lib/libsa/loadfile_elf32.c

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