diff options
author | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2017-07-21 01:21:43 +0000 |
---|---|---|
committer | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2017-07-21 01:21:43 +0000 |
commit | 1831fdde88d9698666e8dd2690878810445e11ff (patch) | |
tree | 7592d1c56d6d44182ea7c71c324884c6210e9b46 /sys/arch/amd64 | |
parent | 7c0da4f96e489e1be816f59e353cae08a73481a0 (diff) |
Check the hibernation signature for softraid disks and select valid bsd
for unhibernation. reported by Natasha Kerensikova. tested by Theo Buehler.
ok deraadt
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/stand/efiboot/efidev.c | 3 | ||||
-rw-r--r-- | sys/arch/amd64/stand/libsa/biosdev.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/libsa/disk.h | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/libsa/diskprobe.c | 12 |
4 files changed, 12 insertions, 11 deletions
diff --git a/sys/arch/amd64/stand/efiboot/efidev.c b/sys/arch/amd64/stand/efiboot/efidev.c index b224c267ecd..d3e69088446 100644 --- a/sys/arch/amd64/stand/efiboot/efidev.c +++ b/sys/arch/amd64/stand/efiboot/efidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efidev.c,v 1.26 2017/05/16 02:56:23 yasuoka Exp $ */ +/* $OpenBSD: efidev.c,v 1.27 2017/07/21 01:21:42 yasuoka Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -625,6 +625,7 @@ efiopen(struct open_file *f, ...) if (sr_getdisklabel(bv, &dip->disklabel)) return ERDLAB; dip->bios_info.flags &= ~BDI_BADLABEL; + check_hibernate(dip); } bv->sbv_part = part + 'a'; diff --git a/sys/arch/amd64/stand/libsa/biosdev.c b/sys/arch/amd64/stand/libsa/biosdev.c index 766a2e29dbf..b9018b623b1 100644 --- a/sys/arch/amd64/stand/libsa/biosdev.c +++ b/sys/arch/amd64/stand/libsa/biosdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.c,v 1.30 2016/09/18 15:13:10 jsing Exp $ */ +/* $OpenBSD: biosdev.c,v 1.31 2017/07/21 01:21:42 yasuoka Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -535,6 +535,7 @@ biosopen(struct open_file *f, ...) if (bv->sbv_diskinfo == NULL) { dip = alloc(sizeof(struct diskinfo)); bzero(dip, sizeof(*dip)); + dip->strategy = biosstrategy; bv->sbv_diskinfo = dip; dip->sr_vol = bv; dip->bios_info.flags |= BDI_BADLABEL; @@ -548,6 +549,7 @@ biosopen(struct open_file *f, ...) if (sr_getdisklabel(bv, &dip->disklabel)) return ERDLAB; dip->bios_info.flags &= ~BDI_BADLABEL; + check_hibernate(dip); } bv->sbv_part = part + 'a'; diff --git a/sys/arch/amd64/stand/libsa/disk.h b/sys/arch/amd64/stand/libsa/disk.h index 4c0a219d0ba..ea73630254d 100644 --- a/sys/arch/amd64/stand/libsa/disk.h +++ b/sys/arch/amd64/stand/libsa/disk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.h,v 1.5 2015/09/02 01:52:26 yasuoka Exp $ */ +/* $OpenBSD: disk.h,v 1.6 2017/07/21 01:21:42 yasuoka Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -59,4 +59,6 @@ extern struct disklist_lh disklist; void dump_diskinfo(void); +void check_hibernate(struct diskinfo *); + #endif /* _DISK_H */ diff --git a/sys/arch/amd64/stand/libsa/diskprobe.c b/sys/arch/amd64/stand/libsa/diskprobe.c index 507bca661c9..3575d592624 100644 --- a/sys/arch/amd64/stand/libsa/diskprobe.c +++ b/sys/arch/amd64/stand/libsa/diskprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diskprobe.c,v 1.19 2017/06/22 01:26:28 deraadt Exp $ */ +/* $OpenBSD: diskprobe.c,v 1.20 2017/07/21 01:21:42 yasuoka Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -55,7 +55,6 @@ /* Local Prototypes */ static int disksum(int); -static void check_hibernate(struct diskinfo *); int bootdev_has_hibernate(void); /* export for loadfile() */ @@ -472,7 +471,7 @@ bootdev_has_hibernate(void) return ((bootdev_dip->bios_info.flags & BDI_HIBVALID)? 1 : 0); } -static void +void check_hibernate(struct diskinfo *dip) { daddr_t sec; @@ -489,9 +488,6 @@ check_hibernate(struct diskinfo *dip) (sizeof(union hibernate_info) / DEV_BSIZE); error = dip->strategy(dip, F_READ, (daddr32_t)sec, sizeof hib, &hib, NULL); - if (error == 0 && hib.magic == HIBERNATE_MAGIC) { - /* Hibernate present */ - dip->bios_info.flags |= BDI_HIBVALID; - printf("&"); - } + if (error == 0 && hib.magic == HIBERNATE_MAGIC) + dip->bios_info.flags |= BDI_HIBVALID; /* Hibernate present */ } |