summaryrefslogtreecommitdiff
path: root/sys/arch/luna88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2017-03-16 18:08:59 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2017-03-16 18:08:59 +0000
commit0cdef3d62dba818ada48bc7e35c227c6fde577c5 (patch)
tree70c1299ad1f6c7c846c79411439a0fe6785434e3 /sys/arch/luna88k
parent3ef993eb87dce92401b32ef6ac769e57a2c50d13 (diff)
Fix passing entropy from boot loader to the kernel:
- make sure the kernel has a PT_OPENBSD_RANDOMIZE phdr. - load /etc/random.conf in all cases, not only manual boot (oops). ok aoyama@
Diffstat (limited to 'sys/arch/luna88k')
-rw-r--r--sys/arch/luna88k/conf/ld.script20
-rw-r--r--sys/arch/luna88k/stand/boot/boot.c47
-rw-r--r--sys/arch/luna88k/stand/boot/init_main.c4
3 files changed, 42 insertions, 29 deletions
diff --git a/sys/arch/luna88k/conf/ld.script b/sys/arch/luna88k/conf/ld.script
index 468e22adba8..33e690a2258 100644
--- a/sys/arch/luna88k/conf/ld.script
+++ b/sys/arch/luna88k/conf/ld.script
@@ -1,4 +1,4 @@
-/* $OpenBSD: ld.script,v 1.4 2013/11/03 09:42:55 miod Exp $ */
+/* $OpenBSD: ld.script,v 1.5 2017/03/16 18:08:58 miod Exp $ */
/*
* Copyright (c) 2012 Miodrag Vallat.
@@ -19,6 +19,14 @@
OUTPUT_FORMAT("elf32-m88k")
OUTPUT_ARCH(m88k)
ENTRY(__start)
+
+PHDRS
+{
+ text PT_LOAD;
+ data PT_LOAD;
+ openbsd_randomize PT_OPENBSD_RANDOMIZE;
+}
+
SECTIONS
{
.text :
@@ -36,12 +44,16 @@ SECTIONS
.data :
{
*(.data)
- PROVIDE(edata = ABSOLUTE(.));
- }
+ } :data
+ .openbsd.randomdata :
+ {
+ *(.openbsd.randomdata)
+ } :data :openbsd_randomize
+ PROVIDE(edata = ABSOLUTE(.));
.bss :
{
*(.bss)
- }
+ } :data
PROVIDE(end = ABSOLUTE(.));
/DISCARD/ :
{
diff --git a/sys/arch/luna88k/stand/boot/boot.c b/sys/arch/luna88k/stand/boot/boot.c
index 51567f45694..14425846e76 100644
--- a/sys/arch/luna88k/stand/boot/boot.c
+++ b/sys/arch/luna88k/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.4 2014/02/23 20:01:04 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.5 2017/03/16 18:08:58 miod Exp $ */
/* $NetBSD: boot.c,v 1.3 2013/03/05 15:34:53 tsutsui Exp $ */
/*
@@ -145,9 +145,7 @@ error:
int
boot(int argc, char *argv[])
{
- char *line, *lparen, *rparen;
- char rndpath[MAXPATHLEN];
- static int rnd_loaded = 0;
+ char *line;
if (argc < 2)
line = default_file;
@@ -156,6 +154,28 @@ boot(int argc, char *argv[])
printf("Booting %s\n", line);
+ return bootunix(line);
+}
+
+int
+bootunix(char *line)
+{
+ int io;
+#if 0
+ int dev, unit, part;
+#endif
+ u_long marks[MARK_MAX];
+ char *lparen, *rparen;
+ char rndpath[MAXPATHLEN];
+ static int rnd_loaded = 0;
+
+#if 0
+ if (get_boot_device(line, &dev, &unit, &part) != 0) {
+ printf("Bad file name %s\n", line);
+ return ST_ERROR;
+ }
+#endif
+
/*
* Try and load randomness from the boot device.
*/
@@ -177,25 +197,6 @@ boot(int argc, char *argv[])
rnd_loaded = loadrandom(rndpath, rnddata, sizeof(rnddata));
}
- return bootunix(line);
-}
-
-int
-bootunix(char *line)
-{
- int io;
-#if 0
- int dev, unit, part;
-#endif
- u_long marks[MARK_MAX];
-
-#if 0
- if (get_boot_device(line, &dev, &unit, &part) != 0) {
- printf("Bad file name %s\n", line);
- return ST_ERROR;
- }
-#endif
-
/* Note marks[MARK_START] is passed as an load address offset */
memset(marks, 0, sizeof(marks));
diff --git a/sys/arch/luna88k/stand/boot/init_main.c b/sys/arch/luna88k/stand/boot/init_main.c
index f3d0a79793e..b3f64d3033a 100644
--- a/sys/arch/luna88k/stand/boot/init_main.c
+++ b/sys/arch/luna88k/stand/boot/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.6 2014/02/23 20:01:04 miod Exp $ */
+/* $OpenBSD: init_main.c,v 1.7 2017/03/16 18:08:58 miod Exp $ */
/* $NetBSD: init_main.c,v 1.6 2013/03/05 15:34:53 tsutsui Exp $ */
/*
@@ -181,7 +181,7 @@ main(void)
nplane = get_plane_numbers();
cninit();
- printf("\nOpenBSD/" MACHINE " (%s) boot 0.4\n\n", machstr);
+ printf("\nOpenBSD/" MACHINE " (%s) boot 0.5\n\n", machstr);
#ifdef SUPPORT_ETHERNET
try_bootp = 1;