From dd6f2f2c8db6f6b0def5142f024bc873b1151cdf Mon Sep 17 00:00:00 2001 From: kevans Date: Tue, 10 Apr 2018 19:18:16 +0000 Subject: [PATCH] Annotate geom modules with MODULE_VERSION GEOM ELI may double ask the password during boot. Once at loader time, and once at init time. This happens due a module loading bug. By default GEOM ELI caches the password in the kernel, but without the MODULE_VERSION annotation, the kernel loads over the kernel module, even if the GEOM ELI was compiled into the kernel. In this case, the newly loaded module purges/invalidates/overwrites the GEOM ELI's password cache, which causes the double asking. MFC Note: There's a pc98 component to the original submission that is omitted here due to pc98 removal in head. This part will need to be revived upon MFC. Reviewed by: imp Submitted by: op Obtained from: opBSD MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14992 --- sys/geom/bde/g_bde.c | 1 + sys/geom/cache/g_cache.c | 1 + sys/geom/concat/g_concat.c | 1 + sys/geom/eli/g_eli.c | 1 + sys/geom/gate/g_gate.c | 1 + sys/geom/geom_bsd.c | 1 + sys/geom/geom_ccd.c | 1 + sys/geom/geom_fox.c | 1 + sys/geom/geom_map.c | 1 + sys/geom/geom_mbr.c | 1 + sys/geom/geom_redboot.c | 1 + sys/geom/geom_sunlabel.c | 1 + sys/geom/geom_vol_ffs.c | 1 + sys/geom/journal/g_journal_ufs.c | 1 + sys/geom/label/g_label.c | 1 + sys/geom/linux_lvm/g_linux_lvm.c | 1 + sys/geom/mirror/g_mirror.c | 1 + sys/geom/mountver/g_mountver.c | 1 + sys/geom/multipath/g_multipath.c | 1 + sys/geom/nop/g_nop.c | 1 + sys/geom/part/g_part_apm.c | 1 + sys/geom/part/g_part_bsd.c | 1 + sys/geom/part/g_part_bsd64.c | 1 + sys/geom/part/g_part_ebr.c | 1 + sys/geom/part/g_part_gpt.c | 1 + sys/geom/part/g_part_ldm.c | 1 + sys/geom/part/g_part_mbr.c | 1 + sys/geom/part/g_part_vtoc8.c | 1 + sys/geom/raid3/g_raid3.c | 1 + sys/geom/shsec/g_shsec.c | 1 + sys/geom/stripe/g_stripe.c | 1 + sys/geom/uzip/g_uzip.c | 1 + sys/geom/vinum/geom_vinum.c | 1 + sys/geom/virstor/g_virstor.c | 1 + sys/geom/zero/g_zero.c | 1 + 35 files changed, 35 insertions(+) diff --git a/sys/geom/bde/g_bde.c b/sys/geom/bde/g_bde.c index 2811041a5e7..948f7fa6de7 100644 --- a/sys/geom/bde/g_bde.c +++ b/sys/geom/bde/g_bde.c @@ -292,3 +292,4 @@ static struct g_class g_bde_class = { }; DECLARE_GEOM_CLASS(g_bde_class, g_bde); +MODULE_VERSION(geom_bde, 0); diff --git a/sys/geom/cache/g_cache.c b/sys/geom/cache/g_cache.c index 38664dc6fea..6ea9606721c 100644 --- a/sys/geom/cache/g_cache.c +++ b/sys/geom/cache/g_cache.c @@ -1016,3 +1016,4 @@ g_cache_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, } DECLARE_GEOM_CLASS(g_cache_class, g_cache); +MODULE_VERSION(geom_cache, 0); diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c index e5f7bb0c941..8e1a5dd6069 100644 --- a/sys/geom/concat/g_concat.c +++ b/sys/geom/concat/g_concat.c @@ -993,3 +993,4 @@ g_concat_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, } DECLARE_GEOM_CLASS(g_concat_class, g_concat); +MODULE_VERSION(geom_concat, 0); diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c index 8b6ed5c0d46..d0f4f1d39fe 100644 --- a/sys/geom/eli/g_eli.c +++ b/sys/geom/eli/g_eli.c @@ -1333,3 +1333,4 @@ g_eli_fini(struct g_class *mp) DECLARE_GEOM_CLASS(g_eli_class, g_eli); MODULE_DEPEND(g_eli, crypto, 1, 1, 1); +MODULE_VERSION(geom_eli, 0); diff --git a/sys/geom/gate/g_gate.c b/sys/geom/gate/g_gate.c index d71abc22efc..0d6a193d0b3 100644 --- a/sys/geom/gate/g_gate.c +++ b/sys/geom/gate/g_gate.c @@ -964,3 +964,4 @@ static moduledata_t g_gate_module = { }; DECLARE_MODULE(geom_gate, g_gate_module, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); DECLARE_GEOM_CLASS(g_gate_class, g_gate); +MODULE_VERSION(geom_gate, 0); diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c index 3523bc87486..61e253687f6 100644 --- a/sys/geom/geom_bsd.c +++ b/sys/geom/geom_bsd.c @@ -614,3 +614,4 @@ static struct g_class g_bsd_class = { }; DECLARE_GEOM_CLASS(g_bsd_class, g_bsd); +MODULE_VERSION(geom_bsd, 0); diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index ce9a435fa9d..c113a20f091 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -936,3 +936,4 @@ static struct g_class g_ccd_class = { }; DECLARE_GEOM_CLASS(g_ccd_class, g_ccd); +MODULE_VERSION(geom_ccd, 0); diff --git a/sys/geom/geom_fox.c b/sys/geom/geom_fox.c index 968bf8f7e3e..1105ded9b34 100644 --- a/sys/geom/geom_fox.c +++ b/sys/geom/geom_fox.c @@ -485,3 +485,4 @@ static struct g_class g_fox_class = { }; DECLARE_GEOM_CLASS(g_fox_class, g_fox); +MODULE_VERSION(geom_fox, 0); diff --git a/sys/geom/geom_map.c b/sys/geom/geom_map.c index 8030010b589..fcdba38c805 100644 --- a/sys/geom/geom_map.c +++ b/sys/geom/geom_map.c @@ -407,3 +407,4 @@ static struct g_class g_map_class = { .ctlreq = g_map_config, }; DECLARE_GEOM_CLASS(g_map_class, g_map); +MODULE_VERSION(geom_map, 0); diff --git a/sys/geom/geom_mbr.c b/sys/geom/geom_mbr.c index b962d0caebe..e40f3b4cb3d 100644 --- a/sys/geom/geom_mbr.c +++ b/sys/geom/geom_mbr.c @@ -528,3 +528,4 @@ static struct g_class g_mbrext_class = { }; DECLARE_GEOM_CLASS(g_mbrext_class, g_mbrext); +MODULE_VERSION(geom_mbr, 0); diff --git a/sys/geom/geom_redboot.c b/sys/geom/geom_redboot.c index 7a5b3d361d3..029d105414f 100644 --- a/sys/geom/geom_redboot.c +++ b/sys/geom/geom_redboot.c @@ -357,3 +357,4 @@ static struct g_class g_redboot_class = { .ioctl = g_redboot_ioctl, }; DECLARE_GEOM_CLASS(g_redboot_class, g_redboot); +MODULE_VERSION(geom_redboot, 0); diff --git a/sys/geom/geom_sunlabel.c b/sys/geom/geom_sunlabel.c index e9697e19015..df35a4271bd 100644 --- a/sys/geom/geom_sunlabel.c +++ b/sys/geom/geom_sunlabel.c @@ -334,3 +334,4 @@ static struct g_class g_sunlabel_class = { }; DECLARE_GEOM_CLASS(g_sunlabel_class, g_sunlabel); +MODULE_VERSION(geom_sunlabel, 0); diff --git a/sys/geom/geom_vol_ffs.c b/sys/geom/geom_vol_ffs.c index 703b4bdbb62..82b8eaa8d8a 100644 --- a/sys/geom/geom_vol_ffs.c +++ b/sys/geom/geom_vol_ffs.c @@ -164,3 +164,4 @@ static struct g_class g_vol_ffs_class = { }; DECLARE_GEOM_CLASS(g_vol_ffs_class, g_vol_ffs); +MODULE_VERSION(geom_vol_ffs, 0); diff --git a/sys/geom/journal/g_journal_ufs.c b/sys/geom/journal/g_journal_ufs.c index d1de702ef3d..de0dbd83d48 100644 --- a/sys/geom/journal/g_journal_ufs.c +++ b/sys/geom/journal/g_journal_ufs.c @@ -101,3 +101,4 @@ const struct g_journal_desc g_journal_ufs = { }; MODULE_DEPEND(g_journal, ufs, 1, 1, 1); +MODULE_VERSION(geom_journal, 0); diff --git a/sys/geom/label/g_label.c b/sys/geom/label/g_label.c index c16afbdde3f..0ecea2f4ee3 100644 --- a/sys/geom/label/g_label.c +++ b/sys/geom/label/g_label.c @@ -556,3 +556,4 @@ g_label_config(struct gctl_req *req, struct g_class *mp, const char *verb) } DECLARE_GEOM_CLASS(g_label_class, g_label); +MODULE_VERSION(geom_label, 0); diff --git a/sys/geom/linux_lvm/g_linux_lvm.c b/sys/geom/linux_lvm/g_linux_lvm.c index 1b9f77f1910..06fdfbcf787 100644 --- a/sys/geom/linux_lvm/g_linux_lvm.c +++ b/sys/geom/linux_lvm/g_linux_lvm.c @@ -1190,3 +1190,4 @@ static struct g_class g_llvm_class = { }; DECLARE_GEOM_CLASS(g_llvm_class, g_linux_lvm); +MODULE_VERSION(geom_linux_lvm, 0); diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 536377d560d..4e9d2bafe1a 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -3492,3 +3492,4 @@ g_mirror_fini(struct g_class *mp) } DECLARE_GEOM_CLASS(g_mirror_class, g_mirror); +MODULE_VERSION(geom_mirror, 0); diff --git a/sys/geom/mountver/g_mountver.c b/sys/geom/mountver/g_mountver.c index 9b4fcbb47aa..c3d57e8f207 100644 --- a/sys/geom/mountver/g_mountver.c +++ b/sys/geom/mountver/g_mountver.c @@ -660,3 +660,4 @@ g_mountver_fini(struct g_class *mp) } DECLARE_GEOM_CLASS(g_mountver_class, g_mountver); +MODULE_VERSION(geom_mountver, 0); diff --git a/sys/geom/multipath/g_multipath.c b/sys/geom/multipath/g_multipath.c index 25566fbbfe1..ba2a2d413b2 100644 --- a/sys/geom/multipath/g_multipath.c +++ b/sys/geom/multipath/g_multipath.c @@ -1532,3 +1532,4 @@ g_multipath_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, } DECLARE_GEOM_CLASS(g_multipath_class, g_multipath); +MODULE_VERSION(geom_multipath, 0); diff --git a/sys/geom/nop/g_nop.c b/sys/geom/nop/g_nop.c index 549bb211020..23a06cda34f 100644 --- a/sys/geom/nop/g_nop.c +++ b/sys/geom/nop/g_nop.c @@ -717,3 +717,4 @@ g_nop_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, } DECLARE_GEOM_CLASS(g_nop_class, g_nop); +MODULE_VERSION(geom_nop, 0); diff --git a/sys/geom/part/g_part_apm.c b/sys/geom/part/g_part_apm.c index 525b8854f25..250983ef7fe 100644 --- a/sys/geom/part/g_part_apm.c +++ b/sys/geom/part/g_part_apm.c @@ -107,6 +107,7 @@ static struct g_part_scheme g_part_apm_scheme = { .gps_maxent = 4096, }; G_PART_SCHEME_DECLARE(g_part_apm); +MODULE_VERSION(geom_part_apm, 0); static void swab(char *buf, size_t bufsz) diff --git a/sys/geom/part/g_part_bsd.c b/sys/geom/part/g_part_bsd.c index deefb91b504..2432d191149 100644 --- a/sys/geom/part/g_part_bsd.c +++ b/sys/geom/part/g_part_bsd.c @@ -113,6 +113,7 @@ static struct g_part_scheme g_part_bsd_scheme = { .gps_bootcodesz = BBSIZE, }; G_PART_SCHEME_DECLARE(g_part_bsd); +MODULE_VERSION(geom_part_bsd, 0); static struct g_part_bsd_alias { uint8_t type; diff --git a/sys/geom/part/g_part_bsd64.c b/sys/geom/part/g_part_bsd64.c index d1a65e238a3..ff5d7ef6d05 100644 --- a/sys/geom/part/g_part_bsd64.c +++ b/sys/geom/part/g_part_bsd64.c @@ -165,6 +165,7 @@ static struct g_part_scheme g_part_bsd64_scheme = { .gps_maxent = MAXPARTITIONS64 }; G_PART_SCHEME_DECLARE(g_part_bsd64); +MODULE_VERSION(geom_part_bsd64, 0); #define EQUUID(a, b) (memcmp(a, b, sizeof(struct uuid)) == 0) static struct uuid bsd64_uuid_unused = GPT_ENT_TYPE_UNUSED; diff --git a/sys/geom/part/g_part_ebr.c b/sys/geom/part/g_part_ebr.c index 0a9f6ec4ae6..e086b159fb5 100644 --- a/sys/geom/part/g_part_ebr.c +++ b/sys/geom/part/g_part_ebr.c @@ -128,6 +128,7 @@ static struct g_part_scheme g_part_ebr_scheme = { .gps_maxent = INT_MAX, }; G_PART_SCHEME_DECLARE(g_part_ebr); +MODULE_VERSION(geom_part_ebr, 0); static struct g_part_ebr_alias { u_char typ; diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c index ad68d0165a4..5c93e8c67a7 100644 --- a/sys/geom/part/g_part_gpt.c +++ b/sys/geom/part/g_part_gpt.c @@ -146,6 +146,7 @@ static struct g_part_scheme g_part_gpt_scheme = { .gps_bootcodesz = MBRSIZE, }; G_PART_SCHEME_DECLARE(g_part_gpt); +MODULE_VERSION(geom_part_gpt, 0); static struct uuid gpt_uuid_apple_apfs = GPT_ENT_TYPE_APPLE_APFS; static struct uuid gpt_uuid_apple_boot = GPT_ENT_TYPE_APPLE_BOOT; diff --git a/sys/geom/part/g_part_ldm.c b/sys/geom/part/g_part_ldm.c index 582d703ce1a..f12ee5bf4ca 100644 --- a/sys/geom/part/g_part_ldm.c +++ b/sys/geom/part/g_part_ldm.c @@ -363,6 +363,7 @@ static struct g_part_scheme g_part_ldm_scheme = { .gps_entrysz = sizeof(struct g_part_ldm_entry) }; G_PART_SCHEME_DECLARE(g_part_ldm); +MODULE_VERSION(geom_part_ldm, 0); static struct g_part_ldm_alias { u_char typ; diff --git a/sys/geom/part/g_part_mbr.c b/sys/geom/part/g_part_mbr.c index 91d6d13cf32..f31d3cf8d17 100644 --- a/sys/geom/part/g_part_mbr.c +++ b/sys/geom/part/g_part_mbr.c @@ -121,6 +121,7 @@ static struct g_part_scheme g_part_mbr_scheme = { .gps_bootcodesz = MBRSIZE, }; G_PART_SCHEME_DECLARE(g_part_mbr); +MODULE_VERSION(geom_part_mbr, 0); static struct g_part_mbr_alias { u_char typ; diff --git a/sys/geom/part/g_part_vtoc8.c b/sys/geom/part/g_part_vtoc8.c index e465514e3c5..8f238a3a640 100644 --- a/sys/geom/part/g_part_vtoc8.c +++ b/sys/geom/part/g_part_vtoc8.c @@ -101,6 +101,7 @@ static struct g_part_scheme g_part_vtoc8_scheme = { .gps_maxent = VTOC8_NPARTS, }; G_PART_SCHEME_DECLARE(g_part_vtoc8); +MODULE_VERSION(geom_part_vtoc8, 0); static int vtoc8_parse_type(const char *type, uint16_t *tag) diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c index 6fcc543bcb8..68227234524 100644 --- a/sys/geom/raid3/g_raid3.c +++ b/sys/geom/raid3/g_raid3.c @@ -3583,3 +3583,4 @@ g_raid3_fini(struct g_class *mp) } DECLARE_GEOM_CLASS(g_raid3_class, g_raid3); +MODULE_VERSION(geom_raid3, 0); diff --git a/sys/geom/shsec/g_shsec.c b/sys/geom/shsec/g_shsec.c index d95b7690057..fedf2bb9105 100644 --- a/sys/geom/shsec/g_shsec.c +++ b/sys/geom/shsec/g_shsec.c @@ -836,3 +836,4 @@ g_shsec_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, } DECLARE_GEOM_CLASS(g_shsec_class, g_shsec); +MODULE_VERSION(geom_shsec, 0); diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c index a0965fafb4f..0ac90dd6152 100644 --- a/sys/geom/stripe/g_stripe.c +++ b/sys/geom/stripe/g_stripe.c @@ -1270,3 +1270,4 @@ g_stripe_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, } DECLARE_GEOM_CLASS(g_stripe_class, g_stripe); +MODULE_VERSION(geom_stripe, 0); diff --git a/sys/geom/uzip/g_uzip.c b/sys/geom/uzip/g_uzip.c index e9f9f448efc..ab38d18bd3f 100644 --- a/sys/geom/uzip/g_uzip.c +++ b/sys/geom/uzip/g_uzip.c @@ -922,3 +922,4 @@ static struct g_class g_uzip_class = { DECLARE_GEOM_CLASS(g_uzip_class, g_uzip); MODULE_DEPEND(g_uzip, zlib, 1, 1, 1); +MODULE_VERSION(geom_uzip, 0); diff --git a/sys/geom/vinum/geom_vinum.c b/sys/geom/vinum/geom_vinum.c index fa032cfecdc..76128de7251 100644 --- a/sys/geom/vinum/geom_vinum.c +++ b/sys/geom/vinum/geom_vinum.c @@ -1048,3 +1048,4 @@ static struct g_class g_vinum_class = { }; DECLARE_GEOM_CLASS(g_vinum_class, g_vinum); +MODULE_VERSION(geom_vinum, 0); diff --git a/sys/geom/virstor/g_virstor.c b/sys/geom/virstor/g_virstor.c index 2dd20aa9442..f9549dfd11e 100644 --- a/sys/geom/virstor/g_virstor.c +++ b/sys/geom/virstor/g_virstor.c @@ -1891,3 +1891,4 @@ invalid_call(void) } DECLARE_GEOM_CLASS(g_virstor_class, g_virstor); /* Let there be light */ +MODULE_VERSION(geom_virstor, 0); diff --git a/sys/geom/zero/g_zero.c b/sys/geom/zero/g_zero.c index c7ab0bb922e..ab8ca8d6b5b 100644 --- a/sys/geom/zero/g_zero.c +++ b/sys/geom/zero/g_zero.c @@ -143,3 +143,4 @@ static struct g_class g_zero_class = { }; DECLARE_GEOM_CLASS(g_zero_class, g_zero); +MODULE_VERSION(geom_zero, 0); -- 2.45.0