On Tue, May 13, 2025 at 03:15:21PM +0200, Kirill A. Korinsky wrote:
> Just tested an idea from
> https://marc.info/?l=openbsd-misc&m=170525185806712&w=2
> 
> The test was:
>  1. Install a new kernel with inlined diff.
>  2. Reboot device.
>  3. Confirm that date is accurate.
>  4. Disable ntpd.
>  5. Reboot device again.
> 
> Result?
> 
> It has date 9th May which is matched the used snapshot date.
> 
> Index: sys/ufs/ffs/ffs_vfsops.c
> ===================================================================
> RCS file: /home/cvs/src/sys/ufs/ffs/ffs_vfsops.c,v
> diff -u -p -r1.198 ffs_vfsops.c
> --- sys/ufs/ffs/ffs_vfsops.c  3 Feb 2024 18:51:58 -0000       1.198
> +++ sys/ufs/ffs/ffs_vfsops.c  13 May 2025 09:03:15 -0000
> @@ -1362,6 +1362,13 @@ ffs_sbupdate(struct ufsmount *mp, int wa
>       caddr_t space;
>       int i, size, error, allerror = 0;
> 
> +/*
> + * Avoid update of a superblock when masquerading as a bootloader.
> + */
> +#ifdef BOOT_QUIET
> +     return 0;
> +#endif
> +
>       /*
>        * First write back the summary information.
>        */

I think the boot kernel should skip just the mount timestamp update.
However, this should not be tied to BOOT_QUIET in case someone wants
to enable boot kernel printouts for debugging.

The powerpc64 boot kernel probably does not need this but maybe it
should behave in the same way nevertheless.

Index: arch/octeon/conf/BOOT
===================================================================
RCS file: src/sys/arch/octeon/conf/BOOT,v
diff -u -p -r1.13 BOOT
--- arch/octeon/conf/BOOT       11 Jan 2023 03:28:42 -0000      1.13
+++ arch/octeon/conf/BOOT       13 May 2025 17:21:02 -0000
@@ -3,6 +3,7 @@
 machine                octeon mips64
 maxusers       4
 
+option         BOOT_KERNEL
 option         BOOT_QUIET
 
 option         SMALL_KERNEL
Index: arch/powerpc64/conf/BOOT
===================================================================
RCS file: src/sys/arch/powerpc64/conf/BOOT,v
diff -u -p -r1.9 BOOT
--- arch/powerpc64/conf/BOOT    8 Jan 2022 05:40:19 -0000       1.9
+++ arch/powerpc64/conf/BOOT    13 May 2025 17:21:02 -0000
@@ -3,6 +3,7 @@
 machine                powerpc64
 maxusers       4
 
+option         BOOT_KERNEL
 option         BOOT_QUIET
 
 option         SMALL_KERNEL
Index: ufs/ffs/ffs_vfsops.c
===================================================================
RCS file: src/sys/ufs/ffs/ffs_vfsops.c,v
diff -u -p -r1.198 ffs_vfsops.c
--- ufs/ffs/ffs_vfsops.c        3 Feb 2024 18:51:58 -0000       1.198
+++ ufs/ffs/ffs_vfsops.c        13 May 2025 17:21:02 -0000
@@ -1394,7 +1394,9 @@ ffs_sbupdate(struct ufsmount *mp, int wa
            fs->fs_sblockloc >> (fs->fs_fshift - fs->fs_fsbtodb),
            (int)fs->fs_sbsize, 0, INFSLP);
        fs->fs_fmod = 0;
+#ifndef BOOT_KERNEL
        fs->fs_time = gettime();
+#endif
        memcpy(bp->b_data, fs, fs->fs_sbsize);
        /* Restore compatibility to old file systems.              XXX */
        dfs = (struct fs *)bp->b_data;                          /* XXX */

Reply via email to