Use the first 8 bytes of GPT gh_guid as the default d_uid. gh_guid is
authorkrw <krw@openbsd.org>
Fri, 11 Nov 2022 12:14:01 +0000 (12:14 +0000)
committerkrw <krw@openbsd.org>
Fri, 11 Nov 2022 12:14:01 +0000 (12:14 +0000)
initialized with arc4random().

sys/kern/subr_disk.c

index b208bc6..fddab8a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: subr_disk.c,v 1.268 2022/11/10 16:12:05 krw Exp $     */
+/*     $OpenBSD: subr_disk.c,v 1.269 2022/11/11 12:14:01 krw Exp $     */
 /*     $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $  */
 
 /*
@@ -688,6 +688,7 @@ spoofgpt(struct buf *bp, void (*strat)(struct buf *), const uint8_t *dosbb,
        }
 
        lp->d_magic = DISKMAGIC;
+       memcpy(lp->d_uid, (char *)&gh.gh_guid, sizeof(lp->d_uid));
        *partoffp = partoff;
        free(gp, M_DEVBUF, gpbytes);