* [PATCH v2 0/4] Include zone in pstore_device_info
@ 2021-06-15 21:21 Kees Cook
2021-06-15 21:21 ` [PATCH v2 1/4] pstore/blk: Improve failure reporting Kees Cook
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Kees Cook @ 2021-06-15 21:21 UTC (permalink / raw)
To: linux-kernel
Cc: Kees Cook, Christoph Hellwig, Al Viro, gmpy.liaowx,
Anton Vorontsov, Colin Cross, Tony Luck, Jonathan Corbet,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
linux-doc, linux-mtd, linux-block, linux-fsdevel
Hi,
This fixes up pstore/blk to avoid touching block internals, and includes
additional fixes.
-Kees
v1: https://lore.kernel.org/lkml/20210614200421.2702002-1-keescook@chromium.org
Kees Cook (4):
pstore/blk: Improve failure reporting
pstore/blk: Use the normal block device I/O path
pstore/blk: Include zone in pstore_device_info
pstore/blk: Fix kerndoc and redundancy on blkdev param
Documentation/admin-guide/pstore-blk.rst | 14 +-
drivers/mtd/mtdpstore.c | 10 +-
fs/pstore/blk.c | 371 ++++++++---------------
include/linux/pstore_blk.h | 27 +-
4 files changed, 141 insertions(+), 281 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/4] pstore/blk: Improve failure reporting
2021-06-15 21:21 [PATCH v2 0/4] Include zone in pstore_device_info Kees Cook
@ 2021-06-15 21:21 ` Kees Cook
2021-06-16 3:51 ` Christoph Hellwig
2021-06-15 21:21 ` [PATCH v2 2/4] pstore/blk: Use the normal block device I/O path Kees Cook
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Kees Cook @ 2021-06-15 21:21 UTC (permalink / raw)
To: linux-kernel
Cc: Kees Cook, Christoph Hellwig, Al Viro, gmpy.liaowx,
Anton Vorontsov, Colin Cross, Tony Luck, Jonathan Corbet,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
linux-doc, linux-mtd, linux-block, linux-fsdevel
There was no feedback on bad registration attempts. Add details on the
failure cause.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
fs/pstore/blk.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c
index 4bb8a344957a..91d7a848c85b 100644
--- a/fs/pstore/blk.c
+++ b/fs/pstore/blk.c
@@ -114,8 +114,19 @@ static int __register_pstore_device(struct pstore_device_info *dev)
lockdep_assert_held(&pstore_blk_lock);
- if (!dev || !dev->total_size || !dev->read || !dev->write)
+ if (!dev || !dev->total_size || !dev->read || !dev->write) {
+ if (!dev)
+ pr_err("NULL device info\n");
+ else {
+ if (!dev->total_size)
+ pr_err("zero sized device\n");
+ if (!dev->read)
+ pr_err("no read handler for device\n");
+ if (!dev->write)
+ pr_err("no write handler for device\n");
+ }
return -EINVAL;
+ }
/* someone already registered before */
if (pstore_zone_info)
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/4] pstore/blk: Use the normal block device I/O path
2021-06-15 21:21 [PATCH v2 0/4] Include zone in pstore_device_info Kees Cook
2021-06-15 21:21 ` [PATCH v2 1/4] pstore/blk: Improve failure reporting Kees Cook
@ 2021-06-15 21:21 ` Kees Cook
2021-06-16 3:52 ` Christoph Hellwig
2021-06-15 21:21 ` [PATCH v2 3/4] pstore/blk: Include zone in pstore_device_info Kees Cook
2021-06-15 21:21 ` [PATCH v2 4/4] pstore/blk: Fix kerndoc and redundancy on blkdev param Kees Cook
3 siblings, 1 reply; 10+ messages in thread
From: Kees Cook @ 2021-06-15 21:21 UTC (permalink / raw)
To: linux-kernel
Cc: Kees Cook, Christoph Hellwig, Al Viro, gmpy.liaowx,
Anton Vorontsov, Colin Cross, Tony Luck, Jonathan Corbet,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
linux-doc, linux-mtd, linux-block, linux-fsdevel
Stop poking into block layer internals and just open the block device
file an use kernel_read and kernel_write on it. Note that this means
the transformation from name_to_dev_t can't be used anymore when
pstore_blk is loaded as a module: a full filesystem device path name
must be used instead.
Co-developed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
fs/pstore/blk.c | 261 +++++++++++++++---------------------------------
1 file changed, 80 insertions(+), 181 deletions(-)
diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c
index 91d7a848c85b..8f5bd656cc2d 100644
--- a/fs/pstore/blk.c
+++ b/fs/pstore/blk.c
@@ -8,15 +8,16 @@
#include <linux/kernel.h>
#include <linux/module.h>
-#include "../../block/blk.h"
#include <linux/blkdev.h>
#include <linux/string.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/pstore_blk.h>
+#include <linux/fs.h>
+#include <linux/file.h>
+#include <linux/init_syscalls.h>
#include <linux/mount.h>
-#include <linux/uio.h>
static long kmsg_size = CONFIG_PSTORE_BLK_KMSG_SIZE;
module_param(kmsg_size, long, 0400);
@@ -60,23 +61,25 @@ MODULE_PARM_DESC(best_effort, "use best effort to write (i.e. do not require sto
*
* Usually, this will be a partition of a block device.
*
- * blkdev accepts the following variants:
- * 1) <hex_major><hex_minor> device number in hexadecimal representation,
- * with no leading 0x, for example b302.
- * 2) /dev/<disk_name> represents the device number of disk
- * 3) /dev/<disk_name><decimal> represents the device number
+ * blkdev accepts the following variants, when built as a module:
+ * 1) /dev/<disk_name> represents the device number of disk
+ * 2) /dev/<disk_name><decimal> represents the device number
* of partition - device number of disk plus the partition number
- * 4) /dev/<disk_name>p<decimal> - same as the above, that form is
+ * 3) /dev/<disk_name>p<decimal> - same as the above, that form is
* used when disk name of partitioned disk ends on a digit.
- * 5) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the
+ *
+ * blkdev accepts the following variants when built into the kernel:
+ * 1) <hex_major><hex_minor> device number in hexadecimal representation,
+ * with no leading 0x, for example b302.
+ * 2) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the
* unique id of a partition if the partition table provides it.
* The UUID may be either an EFI/GPT UUID, or refer to an MSDOS
* partition using the format SSSSSSSS-PP, where SSSSSSSS is a zero-
* filled hex representation of the 32-bit "NT disk signature", and PP
* is a zero-filled hex representation of the 1-based partition number.
- * 6) PARTUUID=<UUID>/PARTNROFF=<int> to select a partition in relation to
+ * 3) PARTUUID=<UUID>/PARTNROFF=<int> to select a partition in relation to
* a partition with a known unique id.
- * 7) <major>:<minor> major and minor number of the device separated by
+ * 4) <major>:<minor> major and minor number of the device separated by
* a colon.
*/
static char blkdev[80] = CONFIG_PSTORE_BLK_BLKDEV;
@@ -88,15 +91,9 @@ MODULE_PARM_DESC(blkdev, "block device for pstore storage");
* during the register/unregister functions.
*/
static DEFINE_MUTEX(pstore_blk_lock);
-static struct block_device *psblk_bdev;
+static struct file *psblk_file;
static struct pstore_zone_info *pstore_zone_info;
-struct bdev_info {
- dev_t devt;
- sector_t nr_sects;
- sector_t start_sect;
-};
-
#define check_size(name, alignsize) ({ \
long _##name_ = (name); \
_##name_ = _##name_ <= 0 ? 0 : (_##name_ * 1024); \
@@ -216,203 +213,70 @@ void unregister_pstore_device(struct pstore_device_info *dev)
}
EXPORT_SYMBOL_GPL(unregister_pstore_device);
-/**
- * psblk_get_bdev() - open block device
- *
- * @holder: Exclusive holder identifier
- * @info: Information about bdev to fill in
- *
- * Return: pointer to block device on success and others on error.
- *
- * On success, the returned block_device has reference count of one.
- */
-static struct block_device *psblk_get_bdev(void *holder,
- struct bdev_info *info)
-{
- struct block_device *bdev = ERR_PTR(-ENODEV);
- fmode_t mode = FMODE_READ | FMODE_WRITE;
- sector_t nr_sects;
-
- lockdep_assert_held(&pstore_blk_lock);
-
- if (pstore_zone_info)
- return ERR_PTR(-EBUSY);
-
- if (!blkdev[0])
- return ERR_PTR(-ENODEV);
-
- if (holder)
- mode |= FMODE_EXCL;
- bdev = blkdev_get_by_path(blkdev, mode, holder);
- if (IS_ERR(bdev)) {
- dev_t devt;
-
- devt = name_to_dev_t(blkdev);
- if (devt == 0)
- return ERR_PTR(-ENODEV);
- bdev = blkdev_get_by_dev(devt, mode, holder);
- if (IS_ERR(bdev))
- return bdev;
- }
-
- nr_sects = bdev_nr_sectors(bdev);
- if (!nr_sects) {
- pr_err("not enough space for '%s'\n", blkdev);
- blkdev_put(bdev, mode);
- return ERR_PTR(-ENOSPC);
- }
-
- if (info) {
- info->devt = bdev->bd_dev;
- info->nr_sects = nr_sects;
- info->start_sect = get_start_sect(bdev);
- }
-
- return bdev;
-}
-
-static void psblk_put_bdev(struct block_device *bdev, void *holder)
-{
- fmode_t mode = FMODE_READ | FMODE_WRITE;
-
- lockdep_assert_held(&pstore_blk_lock);
-
- if (!bdev)
- return;
-
- if (holder)
- mode |= FMODE_EXCL;
- blkdev_put(bdev, mode);
-}
-
static ssize_t psblk_generic_blk_read(char *buf, size_t bytes, loff_t pos)
{
- struct block_device *bdev = psblk_bdev;
- struct file file;
- struct kiocb kiocb;
- struct iov_iter iter;
- struct kvec iov = {.iov_base = buf, .iov_len = bytes};
-
- if (!bdev)
- return -ENODEV;
-
- memset(&file, 0, sizeof(struct file));
- file.f_mapping = bdev->bd_inode->i_mapping;
- file.f_flags = O_DSYNC | __O_SYNC | O_NOATIME;
- file.f_inode = bdev->bd_inode;
- file_ra_state_init(&file.f_ra, file.f_mapping);
-
- init_sync_kiocb(&kiocb, &file);
- kiocb.ki_pos = pos;
- iov_iter_kvec(&iter, READ, &iov, 1, bytes);
-
- return generic_file_read_iter(&kiocb, &iter);
+ return kernel_read(psblk_file, buf, bytes, &pos);
}
static ssize_t psblk_generic_blk_write(const char *buf, size_t bytes,
loff_t pos)
{
- struct block_device *bdev = psblk_bdev;
- struct iov_iter iter;
- struct kiocb kiocb;
- struct file file;
- ssize_t ret;
- struct kvec iov = {.iov_base = (void *)buf, .iov_len = bytes};
-
- if (!bdev)
- return -ENODEV;
-
/* Console/Ftrace backend may handle buffer until flush dirty zones */
if (in_interrupt() || irqs_disabled())
return -EBUSY;
-
- memset(&file, 0, sizeof(struct file));
- file.f_mapping = bdev->bd_inode->i_mapping;
- file.f_flags = O_DSYNC | __O_SYNC | O_NOATIME;
- file.f_inode = bdev->bd_inode;
-
- init_sync_kiocb(&kiocb, &file);
- kiocb.ki_pos = pos;
- iov_iter_kvec(&iter, WRITE, &iov, 1, bytes);
-
- inode_lock(bdev->bd_inode);
- ret = generic_write_checks(&kiocb, &iter);
- if (ret > 0)
- ret = generic_perform_write(&file, &iter, pos);
- inode_unlock(bdev->bd_inode);
-
- if (likely(ret > 0)) {
- const struct file_operations f_op = {.fsync = blkdev_fsync};
-
- file.f_op = &f_op;
- kiocb.ki_pos += ret;
- ret = generic_write_sync(&kiocb, ret);
- }
- return ret;
+ return kernel_write(psblk_file, buf, bytes, &pos);
}
/*
* This takes its configuration only from the module parameters now.
- * See psblk_get_bdev() and blkdev.
*/
-static int __register_pstore_blk(void)
+static int __register_pstore_blk(const char *devpath)
{
- char bdev_name[BDEVNAME_SIZE];
- struct block_device *bdev;
- struct pstore_device_info dev;
- struct bdev_info binfo;
- void *holder = blkdev;
+ struct pstore_device_info dev = {
+ .read = psblk_generic_blk_read,
+ .write = psblk_generic_blk_write,
+ };
int ret = -ENODEV;
lockdep_assert_held(&pstore_blk_lock);
- /* hold bdev exclusively */
- memset(&binfo, 0, sizeof(binfo));
- bdev = psblk_get_bdev(holder, &binfo);
- if (IS_ERR(bdev)) {
- pr_err("failed to open '%s'!\n", blkdev);
- return PTR_ERR(bdev);
+ psblk_file = filp_open(devpath, O_RDWR | O_DSYNC | O_NOATIME | O_EXCL, 0);
+ if (IS_ERR(psblk_file)) {
+ ret = PTR_ERR(psblk_file);
+ pr_err("failed to open '%s': %d!\n", devpath, ret);
+ goto err;
}
- /* only allow driver matching the @blkdev */
- if (!binfo.devt) {
- pr_debug("no major\n");
- ret = -ENODEV;
- goto err_put_bdev;
+ if (!S_ISBLK(file_inode(psblk_file)->i_mode)) {
+ pr_err("'%s' is not block device!\n", devpath);
+ goto err_fput;
}
- /* psblk_bdev must be assigned before register to pstore/blk */
- psblk_bdev = bdev;
-
- memset(&dev, 0, sizeof(dev));
- dev.total_size = binfo.nr_sects << SECTOR_SHIFT;
- dev.read = psblk_generic_blk_read;
- dev.write = psblk_generic_blk_write;
+ dev.total_size = i_size_read(I_BDEV(psblk_file->f_mapping->host)->bd_inode);
ret = __register_pstore_device(&dev);
if (ret)
- goto err_put_bdev;
+ goto err_fput;
- bdevname(bdev, bdev_name);
- pr_info("attached %s (no dedicated panic_write!)\n", bdev_name);
return 0;
-err_put_bdev:
- psblk_bdev = NULL;
- psblk_put_bdev(bdev, holder);
+err_fput:
+ fput(psblk_file);
+err:
+ psblk_file = NULL;
+
return ret;
}
-static void __unregister_pstore_blk(unsigned int major)
+static void __unregister_pstore_blk(struct file *device)
{
struct pstore_device_info dev = { .read = psblk_generic_blk_read };
- void *holder = blkdev;
lockdep_assert_held(&pstore_blk_lock);
- if (psblk_bdev && MAJOR(psblk_bdev->bd_dev) == major) {
+ if (psblk_file && psblk_file == device) {
__unregister_pstore_device(&dev);
- psblk_put_bdev(psblk_bdev, holder);
- psblk_bdev = NULL;
+ fput(psblk_file);
+ psblk_file = NULL;
}
}
@@ -430,13 +294,48 @@ int pstore_blk_get_config(struct pstore_blk_config *info)
}
EXPORT_SYMBOL_GPL(pstore_blk_get_config);
+
+#ifndef MODULE
+static const char devname[] = "/dev/pstore-blk";
+static __init const char *early_boot_devpath(const char *initial_devname)
+{
+ /*
+ * During early boot the real root file system hasn't been
+ * mounted yet, and no device nodes are present yet. Use the
+ * same scheme to find the device that we use for mounting
+ * the root file system.
+ */
+ dev_t dev = name_to_dev_t(initial_devname);
+
+ if (!dev) {
+ pr_err("failed to resolve '%s'!\n", initial_devname);
+ return initial_devname;
+ }
+
+ init_unlink(devname);
+ init_mknod(devname, S_IFBLK | 0600, new_encode_dev(dev));
+
+ return devname;
+}
+#else
+static inline const char *early_boot_devpath(const char *initial_devname)
+{
+ return initial_devname;
+}
+#endif
+
static int __init pstore_blk_init(void)
{
int ret = 0;
mutex_lock(&pstore_blk_lock);
- if (!pstore_zone_info && best_effort && blkdev[0])
- ret = __register_pstore_blk();
+ if (!pstore_zone_info && best_effort && blkdev[0]) {
+ ret = __register_pstore_blk(early_boot_devpath(blkdev));
+ if (ret == 0 && pstore_zone_info)
+ pr_info("attached %s:%s (%zu) (no dedicated panic_write!)\n",
+ pstore_zone_info->name, blkdev,
+ pstore_zone_info->total_size);
+ }
mutex_unlock(&pstore_blk_lock);
return ret;
@@ -446,8 +345,8 @@ late_initcall(pstore_blk_init);
static void __exit pstore_blk_exit(void)
{
mutex_lock(&pstore_blk_lock);
- if (psblk_bdev)
- __unregister_pstore_blk(MAJOR(psblk_bdev->bd_dev));
+ if (psblk_file)
+ __unregister_pstore_blk(psblk_file);
else {
struct pstore_device_info dev = { };
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/4] pstore/blk: Include zone in pstore_device_info
2021-06-15 21:21 [PATCH v2 0/4] Include zone in pstore_device_info Kees Cook
2021-06-15 21:21 ` [PATCH v2 1/4] pstore/blk: Improve failure reporting Kees Cook
2021-06-15 21:21 ` [PATCH v2 2/4] pstore/blk: Use the normal block device I/O path Kees Cook
@ 2021-06-15 21:21 ` Kees Cook
2021-06-16 4:02 ` Christoph Hellwig
2021-06-15 21:21 ` [PATCH v2 4/4] pstore/blk: Fix kerndoc and redundancy on blkdev param Kees Cook
3 siblings, 1 reply; 10+ messages in thread
From: Kees Cook @ 2021-06-15 21:21 UTC (permalink / raw)
To: linux-kernel
Cc: Kees Cook, Christoph Hellwig, Al Viro, gmpy.liaowx,
Anton Vorontsov, Colin Cross, Tony Luck, Jonathan Corbet,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
linux-doc, linux-mtd, linux-block, linux-fsdevel
Information was redundant between struct pstore_zone_info and struct
pstore_device_info. Use struct pstore_zone_info, with member name "zone".
Additionally untangle the logic for the "best effort" block device
instance.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
drivers/mtd/mtdpstore.c | 10 +--
fs/pstore/blk.c | 141 ++++++++++++++++++-------------------
include/linux/pstore_blk.h | 27 +------
3 files changed, 75 insertions(+), 103 deletions(-)
diff --git a/drivers/mtd/mtdpstore.c b/drivers/mtd/mtdpstore.c
index a3ae8778f6a9..e13d42c0acb0 100644
--- a/drivers/mtd/mtdpstore.c
+++ b/drivers/mtd/mtdpstore.c
@@ -423,13 +423,13 @@ static void mtdpstore_notify_add(struct mtd_info *mtd)
longcnt = BITS_TO_LONGS(div_u64(mtd->size, mtd->erasesize));
cxt->badmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
- cxt->dev.total_size = mtd->size;
/* just support dmesg right now */
cxt->dev.flags = PSTORE_FLAGS_DMESG;
- cxt->dev.read = mtdpstore_read;
- cxt->dev.write = mtdpstore_write;
- cxt->dev.erase = mtdpstore_erase;
- cxt->dev.panic_write = mtdpstore_panic_write;
+ cxt->dev.zone.read = mtdpstore_read;
+ cxt->dev.zone.write = mtdpstore_write;
+ cxt->dev.zone.erase = mtdpstore_erase;
+ cxt->dev.zone.panic_write = mtdpstore_panic_write;
+ cxt->dev.zone.total_size = mtd->size;
ret = register_pstore_device(&cxt->dev);
if (ret) {
diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c
index 8f5bd656cc2d..e5ed118683b1 100644
--- a/fs/pstore/blk.c
+++ b/fs/pstore/blk.c
@@ -92,7 +92,7 @@ MODULE_PARM_DESC(blkdev, "block device for pstore storage");
*/
static DEFINE_MUTEX(pstore_blk_lock);
static struct file *psblk_file;
-static struct pstore_zone_info *pstore_zone_info;
+static struct pstore_device_info *pstore_device_info;
#define check_size(name, alignsize) ({ \
long _##name_ = (name); \
@@ -105,68 +105,60 @@ static struct pstore_zone_info *pstore_zone_info;
_##name_; \
})
+#define verify_size(name, alignsize, enabled) { \
+ long _##name_; \
+ if (enabled) \
+ _##name_ = check_size(name, alignsize); \
+ else \
+ _##name_ = 0; \
+ /* synchronize visible module parameters to result. */ \
+ name = _##name_ / 1024; \
+ dev->zone.name = _##name_; \
+ }
+
static int __register_pstore_device(struct pstore_device_info *dev)
{
int ret;
lockdep_assert_held(&pstore_blk_lock);
- if (!dev || !dev->total_size || !dev->read || !dev->write) {
+ if (!dev || !dev->zone.total_size || !dev->zone.read || !dev->zone.write) {
if (!dev)
- pr_err("NULL device info\n");
+ pr_err("NULL pstore_device_info\n");
else {
- if (!dev->total_size)
+ if (!dev->zone.total_size)
pr_err("zero sized device\n");
- if (!dev->read)
+ if (!dev->zone.read)
pr_err("no read handler for device\n");
- if (!dev->write)
+ if (!dev->zone.write)
pr_err("no write handler for device\n");
}
return -EINVAL;
}
/* someone already registered before */
- if (pstore_zone_info)
+ if (pstore_device_info)
return -EBUSY;
- pstore_zone_info = kzalloc(sizeof(struct pstore_zone_info), GFP_KERNEL);
- if (!pstore_zone_info)
- return -ENOMEM;
-
/* zero means not limit on which backends to attempt to store. */
if (!dev->flags)
dev->flags = UINT_MAX;
-#define verify_size(name, alignsize, enabled) { \
- long _##name_; \
- if (enabled) \
- _##name_ = check_size(name, alignsize); \
- else \
- _##name_ = 0; \
- name = _##name_ / 1024; \
- pstore_zone_info->name = _##name_; \
- }
-
+ /* Copy in module parameters. */
verify_size(kmsg_size, 4096, dev->flags & PSTORE_FLAGS_DMESG);
verify_size(pmsg_size, 4096, dev->flags & PSTORE_FLAGS_PMSG);
verify_size(console_size, 4096, dev->flags & PSTORE_FLAGS_CONSOLE);
verify_size(ftrace_size, 4096, dev->flags & PSTORE_FLAGS_FTRACE);
-#undef verify_size
-
- pstore_zone_info->total_size = dev->total_size;
- pstore_zone_info->max_reason = max_reason;
- pstore_zone_info->read = dev->read;
- pstore_zone_info->write = dev->write;
- pstore_zone_info->erase = dev->erase;
- pstore_zone_info->panic_write = dev->panic_write;
- pstore_zone_info->name = KBUILD_MODNAME;
- pstore_zone_info->owner = THIS_MODULE;
-
- ret = register_pstore_zone(pstore_zone_info);
- if (ret) {
- kfree(pstore_zone_info);
- pstore_zone_info = NULL;
- }
+ dev->zone.max_reason = max_reason;
+
+ /* Initialize required zone ownership details. */
+ dev->zone.name = KBUILD_MODNAME;
+ dev->zone.owner = THIS_MODULE;
+
+ ret = register_pstore_zone(&dev->zone);
+ if (ret == 0)
+ pstore_device_info = dev;
+
return ret;
}
/**
@@ -193,10 +185,9 @@ EXPORT_SYMBOL_GPL(register_pstore_device);
static void __unregister_pstore_device(struct pstore_device_info *dev)
{
lockdep_assert_held(&pstore_blk_lock);
- if (pstore_zone_info && pstore_zone_info->read == dev->read) {
- unregister_pstore_zone(pstore_zone_info);
- kfree(pstore_zone_info);
- pstore_zone_info = NULL;
+ if (pstore_device_info && pstore_device_info == dev) {
+ unregister_pstore_zone(&dev->zone);
+ pstore_device_info = NULL;
}
}
@@ -230,12 +221,9 @@ static ssize_t psblk_generic_blk_write(const char *buf, size_t bytes,
/*
* This takes its configuration only from the module parameters now.
*/
-static int __register_pstore_blk(const char *devpath)
+static int __register_pstore_blk(struct pstore_device_info *dev,
+ const char *devpath)
{
- struct pstore_device_info dev = {
- .read = psblk_generic_blk_read,
- .write = psblk_generic_blk_write,
- };
int ret = -ENODEV;
lockdep_assert_held(&pstore_blk_lock);
@@ -252,9 +240,9 @@ static int __register_pstore_blk(const char *devpath)
goto err_fput;
}
- dev.total_size = i_size_read(I_BDEV(psblk_file->f_mapping->host)->bd_inode);
+ dev->zone.total_size = i_size_read(I_BDEV(psblk_file->f_mapping->host)->bd_inode);
- ret = __register_pstore_device(&dev);
+ ret = __register_pstore_device(dev);
if (ret)
goto err_fput;
@@ -268,18 +256,6 @@ static int __register_pstore_blk(const char *devpath)
return ret;
}
-static void __unregister_pstore_blk(struct file *device)
-{
- struct pstore_device_info dev = { .read = psblk_generic_blk_read };
-
- lockdep_assert_held(&pstore_blk_lock);
- if (psblk_file && psblk_file == device) {
- __unregister_pstore_device(&dev);
- fput(psblk_file);
- psblk_file = NULL;
- }
-}
-
/* get information of pstore/blk */
int pstore_blk_get_config(struct pstore_blk_config *info)
{
@@ -329,13 +305,27 @@ static int __init pstore_blk_init(void)
int ret = 0;
mutex_lock(&pstore_blk_lock);
- if (!pstore_zone_info && best_effort && blkdev[0]) {
- ret = __register_pstore_blk(early_boot_devpath(blkdev));
- if (ret == 0 && pstore_zone_info)
- pr_info("attached %s:%s (%zu) (no dedicated panic_write!)\n",
- pstore_zone_info->name, blkdev,
- pstore_zone_info->total_size);
+ if (!pstore_device_info && best_effort && blkdev[0]) {
+ struct pstore_device_info *best_effort_dev;
+
+ best_effort_dev = kzalloc(sizeof(*best_effort_dev), GFP_KERNEL);
+ if (!best_effort) {
+ ret = -ENOMEM;
+ goto unlock;
+ }
+ best_effort_dev->zone.read = psblk_generic_blk_read;
+ best_effort_dev->zone.write = psblk_generic_blk_write;
+
+ ret = __register_pstore_blk(best_effort_dev,
+ early_boot_devpath(blkdev));
+ if (ret)
+ kfree(best_effort_dev);
+ else
+ pr_info("attached %s (%zu) (no dedicated panic_write!)\n",
+ blkdev, best_effort_dev->zone.total_size);
}
+
+unlock:
mutex_unlock(&pstore_blk_lock);
return ret;
@@ -345,15 +335,18 @@ late_initcall(pstore_blk_init);
static void __exit pstore_blk_exit(void)
{
mutex_lock(&pstore_blk_lock);
- if (psblk_file)
- __unregister_pstore_blk(psblk_file);
- else {
- struct pstore_device_info dev = { };
-
- if (pstore_zone_info)
- dev.read = pstore_zone_info->read;
- __unregister_pstore_device(&dev);
+ /* Unregister and free the best_effort device. */
+ if (psblk_file) {
+ struct pstore_device_info *dev = pstore_device_info;
+
+ __unregister_pstore_device(dev);
+ kfree(dev);
+ fput(psblk_file);
+ psblk_file = NULL;
}
+ /* If we've been asked to unload, unregister any registered device. */
+ if (pstore_device_info)
+ __unregister_pstore_device(pstore_device_info);
mutex_unlock(&pstore_blk_lock);
}
module_exit(pstore_blk_exit);
diff --git a/include/linux/pstore_blk.h b/include/linux/pstore_blk.h
index 99564f93d774..924ca07aafbd 100644
--- a/include/linux/pstore_blk.h
+++ b/include/linux/pstore_blk.h
@@ -10,36 +10,15 @@
/**
* struct pstore_device_info - back-end pstore/blk driver structure.
*
- * @total_size: The total size in bytes pstore/blk can use. It must be greater
- * than 4096 and be multiple of 4096.
* @flags: Refer to macro starting with PSTORE_FLAGS defined in
* linux/pstore.h. It means what front-ends this device support.
* Zero means all backends for compatible.
- * @read: The general read operation. Both of the function parameters
- * @size and @offset are relative value to bock device (not the
- * whole disk).
- * On success, the number of bytes should be returned, others
- * means error.
- * @write: The same as @read, but the following error number:
- * -EBUSY means try to write again later.
- * -ENOMSG means to try next zone.
- * @erase: The general erase operation for device with special removing
- * job. Both of the function parameters @size and @offset are
- * relative value to storage.
- * Return 0 on success and others on failure.
- * @panic_write:The write operation only used for panic case. It's optional
- * if you do not care panic log. The parameters are relative
- * value to storage.
- * On success, the number of bytes should be returned, others
- * excluding -ENOMSG mean error. -ENOMSG means to try next zone.
+ * @zone: The struct pstore_zone_info details.
+ *
*/
struct pstore_device_info {
- unsigned long total_size;
unsigned int flags;
- pstore_zone_read_op read;
- pstore_zone_write_op write;
- pstore_zone_erase_op erase;
- pstore_zone_write_op panic_write;
+ struct pstore_zone_info zone;
};
int register_pstore_device(struct pstore_device_info *dev);
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 4/4] pstore/blk: Fix kerndoc and redundancy on blkdev param
2021-06-15 21:21 [PATCH v2 0/4] Include zone in pstore_device_info Kees Cook
` (2 preceding siblings ...)
2021-06-15 21:21 ` [PATCH v2 3/4] pstore/blk: Include zone in pstore_device_info Kees Cook
@ 2021-06-15 21:21 ` Kees Cook
2021-06-16 3:53 ` Christoph Hellwig
3 siblings, 1 reply; 10+ messages in thread
From: Kees Cook @ 2021-06-15 21:21 UTC (permalink / raw)
To: linux-kernel
Cc: Kees Cook, Christoph Hellwig, Al Viro, gmpy.liaowx,
Anton Vorontsov, Colin Cross, Tony Luck, Jonathan Corbet,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
linux-doc, linux-mtd, linux-block, linux-fsdevel
Remove redundant details of blkdev and fix up resulting kerndoc.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Documentation/admin-guide/pstore-blk.rst | 14 +++++++-------
fs/pstore/blk.c | 24 +-----------------------
2 files changed, 8 insertions(+), 30 deletions(-)
diff --git a/Documentation/admin-guide/pstore-blk.rst b/Documentation/admin-guide/pstore-blk.rst
index 49d8149f8d32..2d22ead9520e 100644
--- a/Documentation/admin-guide/pstore-blk.rst
+++ b/Documentation/admin-guide/pstore-blk.rst
@@ -45,15 +45,18 @@ blkdev
The block device to use. Most of the time, it is a partition of block device.
It's required for pstore/blk. It is also used for MTD device.
-It accepts the following variants for block device:
+When pstore/blk is built as a module, "blkdev" accepts the following variants:
-1. <hex_major><hex_minor> device number in hexadecimal represents itself; no
- leading 0x, for example b302.
-#. /dev/<disk_name> represents the device number of disk
+1. /dev/<disk_name> represents the device number of disk
#. /dev/<disk_name><decimal> represents the device number of partition - device
number of disk plus the partition number
#. /dev/<disk_name>p<decimal> - same as the above; this form is used when disk
name of partitioned disk ends with a digit.
+
+When pstore/blk is built into the kernel, "blkdev" accepts the following variants:
+
+#. <hex_major><hex_minor> device number in hexadecimal representation,
+ with no leading 0x, for example b302.
#. PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF represents the unique id of
a partition if the partition table provides it. The UUID may be either an
EFI/GPT UUID, or refer to an MSDOS partition using the format SSSSSSSS-PP,
@@ -227,8 +230,5 @@ For developer reference, here are all the important structures and APIs:
.. kernel-doc:: include/linux/pstore_zone.h
:internal:
-.. kernel-doc:: fs/pstore/blk.c
- :internal:
-
.. kernel-doc:: include/linux/pstore_blk.h
:internal:
diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c
index e5ed118683b1..ccfb11ee4d50 100644
--- a/fs/pstore/blk.c
+++ b/fs/pstore/blk.c
@@ -58,29 +58,7 @@ MODULE_PARM_DESC(best_effort, "use best effort to write (i.e. do not require sto
/*
* blkdev - the block device to use for pstore storage
- *
- * Usually, this will be a partition of a block device.
- *
- * blkdev accepts the following variants, when built as a module:
- * 1) /dev/<disk_name> represents the device number of disk
- * 2) /dev/<disk_name><decimal> represents the device number
- * of partition - device number of disk plus the partition number
- * 3) /dev/<disk_name>p<decimal> - same as the above, that form is
- * used when disk name of partitioned disk ends on a digit.
- *
- * blkdev accepts the following variants when built into the kernel:
- * 1) <hex_major><hex_minor> device number in hexadecimal representation,
- * with no leading 0x, for example b302.
- * 2) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the
- * unique id of a partition if the partition table provides it.
- * The UUID may be either an EFI/GPT UUID, or refer to an MSDOS
- * partition using the format SSSSSSSS-PP, where SSSSSSSS is a zero-
- * filled hex representation of the 32-bit "NT disk signature", and PP
- * is a zero-filled hex representation of the 1-based partition number.
- * 3) PARTUUID=<UUID>/PARTNROFF=<int> to select a partition in relation to
- * a partition with a known unique id.
- * 4) <major>:<minor> major and minor number of the device separated by
- * a colon.
+ * See Documentation/admin-guide/pstore-blk.rst for details.
*/
static char blkdev[80] = CONFIG_PSTORE_BLK_BLKDEV;
module_param_string(blkdev, blkdev, 80, 0400);
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/4] pstore/blk: Improve failure reporting
2021-06-15 21:21 ` [PATCH v2 1/4] pstore/blk: Improve failure reporting Kees Cook
@ 2021-06-16 3:51 ` Christoph Hellwig
0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2021-06-16 3:51 UTC (permalink / raw)
To: Kees Cook
Cc: linux-kernel, Christoph Hellwig, Al Viro, gmpy.liaowx,
Anton Vorontsov, Colin Cross, Tony Luck, Jonathan Corbet,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
linux-doc, linux-mtd, linux-block, linux-fsdevel
On Tue, Jun 15, 2021 at 02:21:18PM -0700, Kees Cook wrote:
> - if (!dev || !dev->total_size || !dev->read || !dev->write)
> + if (!dev || !dev->total_size || !dev->read || !dev->write) {
> + if (!dev)
> + pr_err("NULL device info\n");
> + else {
> + if (!dev->total_size)
> + pr_err("zero sized device\n");
> + if (!dev->read)
> + pr_err("no read handler for device\n");
> + if (!dev->write)
> + pr_err("no write handler for device\n");
> + }
> return -EINVAL;
> + }
I still find this style of checks pretty strange..
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/4] pstore/blk: Use the normal block device I/O path
2021-06-15 21:21 ` [PATCH v2 2/4] pstore/blk: Use the normal block device I/O path Kees Cook
@ 2021-06-16 3:52 ` Christoph Hellwig
0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2021-06-16 3:52 UTC (permalink / raw)
To: Kees Cook
Cc: linux-kernel, Christoph Hellwig, Al Viro, gmpy.liaowx,
Anton Vorontsov, Colin Cross, Tony Luck, Jonathan Corbet,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
linux-doc, linux-mtd, linux-block, linux-fsdevel
Looks fine:
Reviewed-by: Christoph Hellwig <hch@lst.de>
(modulo the slightly annoying overly long lines)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/4] pstore/blk: Fix kerndoc and redundancy on blkdev param
2021-06-15 21:21 ` [PATCH v2 4/4] pstore/blk: Fix kerndoc and redundancy on blkdev param Kees Cook
@ 2021-06-16 3:53 ` Christoph Hellwig
0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2021-06-16 3:53 UTC (permalink / raw)
To: Kees Cook
Cc: linux-kernel, Christoph Hellwig, Al Viro, gmpy.liaowx,
Anton Vorontsov, Colin Cross, Tony Luck, Jonathan Corbet,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
linux-doc, linux-mtd, linux-block, linux-fsdevel
On Tue, Jun 15, 2021 at 02:21:21PM -0700, Kees Cook wrote:
> Remove redundant details of blkdev and fix up resulting kerndoc.
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/4] pstore/blk: Include zone in pstore_device_info
2021-06-15 21:21 ` [PATCH v2 3/4] pstore/blk: Include zone in pstore_device_info Kees Cook
@ 2021-06-16 4:02 ` Christoph Hellwig
2021-06-16 14:41 ` Kees Cook
0 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2021-06-16 4:02 UTC (permalink / raw)
To: Kees Cook
Cc: linux-kernel, Christoph Hellwig, Al Viro, gmpy.liaowx,
Anton Vorontsov, Colin Cross, Tony Luck, Jonathan Corbet,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
linux-doc, linux-mtd, linux-block, linux-fsdevel
> +#define verify_size(name, alignsize, enabled) { \
> + long _##name_; \
> + if (enabled) \
> + _##name_ = check_size(name, alignsize); \
> + else \
> + _##name_ = 0; \
> + /* synchronize visible module parameters to result. */ \
> + name = _##name_ / 1024; \
> + dev->zone.name = _##name_; \
> + }
The formatting here looks weird between the two-tab indent and the
opening brace on the macro definition line.
> - if (!dev || !dev->total_size || !dev->read || !dev->write) {
> + if (!dev || !dev->zone.total_size || !dev->zone.read || !dev->zone.write) {
> if (!dev)
> - pr_err("NULL device info\n");
> + pr_err("NULL pstore_device_info\n");
> else {
> - if (!dev->total_size)
> + if (!dev->zone.total_size)
> pr_err("zero sized device\n");
> - if (!dev->read)
> + if (!dev->zone.read)
> pr_err("no read handler for device\n");
> - if (!dev->write)
> + if (!dev->zone.write)
> pr_err("no write handler for device\n");
> }
This still looks odd to me. Why not the somewhat more verbose but
much more obvious:
if (!dev) {
pr_err("NULL pstore_device_info\n");
return -EINVAL;
}
if (!dev->zone.total_size) {
pr_err("zero sized device\n");
return -EINVAL;
}
...
> - dev.total_size = i_size_read(I_BDEV(psblk_file->f_mapping->host)->bd_inode);
> + dev->zone.total_size = i_size_read(I_BDEV(psblk_file->f_mapping->host)->bd_inode);
This is starting to be unreadable long. A local variable for the inode
might be nice, as that can also be used in the ISBLK check above.
> + if (!pstore_device_info && best_effort && blkdev[0]) {
> + struct pstore_device_info *best_effort_dev;
> +
> + best_effort_dev = kzalloc(sizeof(*best_effort_dev), GFP_KERNEL);
> + if (!best_effort) {
> + ret = -ENOMEM;
> + goto unlock;
> + }
> + best_effort_dev->zone.read = psblk_generic_blk_read;
> + best_effort_dev->zone.write = psblk_generic_blk_write;
> +
> + ret = __register_pstore_blk(best_effort_dev,
> + early_boot_devpath(blkdev));
> + if (ret)
> + kfree(best_effort_dev);
> + else
> + pr_info("attached %s (%zu) (no dedicated panic_write!)\n",
> + blkdev, best_effort_dev->zone.total_size);
Maybe split this into a little helper?
> + /* Unregister and free the best_effort device. */
> + if (psblk_file) {
> + struct pstore_device_info *dev = pstore_device_info;
> +
> + __unregister_pstore_device(dev);
> + kfree(dev);
> + fput(psblk_file);
> + psblk_file = NULL;
> }
Same.
> + /* If we've been asked to unload, unregister any registered device. */
> + if (pstore_device_info)
> + __unregister_pstore_device(pstore_device_info);
Won't this double unregister pstore_device_info?
> struct pstore_device_info {
> - unsigned long total_size;
> unsigned int flags;
> - pstore_zone_read_op read;
> - pstore_zone_write_op write;
> - pstore_zone_erase_op erase;
> - pstore_zone_write_op panic_write;
> + struct pstore_zone_info zone;
> };
Given that flags is only used inside of __register_pstore_device
why not kill this struct and just pass it explicitly?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/4] pstore/blk: Include zone in pstore_device_info
2021-06-16 4:02 ` Christoph Hellwig
@ 2021-06-16 14:41 ` Kees Cook
0 siblings, 0 replies; 10+ messages in thread
From: Kees Cook @ 2021-06-16 14:41 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-kernel, Al Viro, gmpy.liaowx, Anton Vorontsov, Colin Cross,
Tony Luck, Jonathan Corbet, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, linux-doc, linux-mtd, linux-block,
linux-fsdevel
On Wed, Jun 16, 2021 at 06:02:47AM +0200, Christoph Hellwig wrote:
> > +#define verify_size(name, alignsize, enabled) { \
> > + long _##name_; \
> > + if (enabled) \
> > + _##name_ = check_size(name, alignsize); \
> > + else \
> > + _##name_ = 0; \
> > + /* synchronize visible module parameters to result. */ \
> > + name = _##name_ / 1024; \
> > + dev->zone.name = _##name_; \
> > + }
>
> The formatting here looks weird between the two-tab indent and the
> opening brace on the macro definition line.
I can adjust that, sure.
>
> > - if (!dev || !dev->total_size || !dev->read || !dev->write) {
> > + if (!dev || !dev->zone.total_size || !dev->zone.read || !dev->zone.write) {
> > if (!dev)
> > - pr_err("NULL device info\n");
> > + pr_err("NULL pstore_device_info\n");
> > else {
> > - if (!dev->total_size)
> > + if (!dev->zone.total_size)
> > pr_err("zero sized device\n");
> > - if (!dev->read)
> > + if (!dev->zone.read)
> > pr_err("no read handler for device\n");
> > - if (!dev->write)
> > + if (!dev->zone.write)
> > pr_err("no write handler for device\n");
> > }
>
> This still looks odd to me. Why not the somewhat more verbose but
> much more obvious:
>
> if (!dev) {
> pr_err("NULL pstore_device_info\n");
> return -EINVAL;
> }
> if (!dev->zone.total_size) {
> pr_err("zero sized device\n");
> return -EINVAL;
> }
> ...
Will do.
> > - dev.total_size = i_size_read(I_BDEV(psblk_file->f_mapping->host)->bd_inode);
> > + dev->zone.total_size = i_size_read(I_BDEV(psblk_file->f_mapping->host)->bd_inode);
>
> This is starting to be unreadable long. A local variable for the inode
> might be nice, as that can also be used in the ISBLK check above.
Fair enough; will change.
> > + if (!pstore_device_info && best_effort && blkdev[0]) {
> > + struct pstore_device_info *best_effort_dev;
> > +
> > + best_effort_dev = kzalloc(sizeof(*best_effort_dev), GFP_KERNEL);
> > + if (!best_effort) {
> > + ret = -ENOMEM;
> > + goto unlock;
> > + }
> > + best_effort_dev->zone.read = psblk_generic_blk_read;
> > + best_effort_dev->zone.write = psblk_generic_blk_write;
> > +
> > + ret = __register_pstore_blk(best_effort_dev,
> > + early_boot_devpath(blkdev));
> > + if (ret)
> > + kfree(best_effort_dev);
> > + else
> > + pr_info("attached %s (%zu) (no dedicated panic_write!)\n",
> > + blkdev, best_effort_dev->zone.total_size);
>
> Maybe split this into a little helper?
>
> > + /* Unregister and free the best_effort device. */
> > + if (psblk_file) {
> > + struct pstore_device_info *dev = pstore_device_info;
> > +
> > + __unregister_pstore_device(dev);
> > + kfree(dev);
> > + fput(psblk_file);
> > + psblk_file = NULL;
> > }
>
> Same.
I guess? I don't feel strongly one way or another.
>
> > + /* If we've been asked to unload, unregister any registered device. */
> > + if (pstore_device_info)
> > + __unregister_pstore_device(pstore_device_info);
>
> Won't this double unregister pstore_device_info?
No, __unregister_pstore_device() will NULL pstore_device_info.
>
> > struct pstore_device_info {
> > - unsigned long total_size;
> > unsigned int flags;
> > - pstore_zone_read_op read;
> > - pstore_zone_write_op write;
> > - pstore_zone_erase_op erase;
> > - pstore_zone_write_op panic_write;
> > + struct pstore_zone_info zone;
> > };
>
> Given that flags is only used inside of __register_pstore_device
> why not kill this struct and just pass it explicitly?
Because of the mess pstore's internal APIs used to be. :) It's likely
other things will get added here in the future, and I don't want to
have to repeat the kind of argument passing games that used to exist in
this code.
--
Kees Cook
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-06-16 14:42 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 21:21 [PATCH v2 0/4] Include zone in pstore_device_info Kees Cook
2021-06-15 21:21 ` [PATCH v2 1/4] pstore/blk: Improve failure reporting Kees Cook
2021-06-16 3:51 ` Christoph Hellwig
2021-06-15 21:21 ` [PATCH v2 2/4] pstore/blk: Use the normal block device I/O path Kees Cook
2021-06-16 3:52 ` Christoph Hellwig
2021-06-15 21:21 ` [PATCH v2 3/4] pstore/blk: Include zone in pstore_device_info Kees Cook
2021-06-16 4:02 ` Christoph Hellwig
2021-06-16 14:41 ` Kees Cook
2021-06-15 21:21 ` [PATCH v2 4/4] pstore/blk: Fix kerndoc and redundancy on blkdev param Kees Cook
2021-06-16 3:53 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).