From: Arnd Bergmann <arnd@arndb.de>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] udev callout for reading filesystem labels
Date: Thu, 06 May 2004 09:30:23 +0000 [thread overview]
Message-ID: <200405061130.26733.arnd@arndb.de> (raw)
In-Reply-To: <20040429210446.GA9836@vrfy.org>
[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]
On Thursday 29 April 2004 23:04, Kay Sievers wrote:
> Hi,
> here is a small udev toy, which enables udev to name partitions by
> its filesystem label or uuid's.
>
> The following udev rule:
>
> KERNEL="sd*", PROGRAM="/sbin/udev_volume_id -M%M -m%m -u", SYMLINK="%c"
>
> creates a symlink with the uuid read from the filesystem. If no label or
> uuid is found the program exits with nonzero and the rule will fail.
Cool. I've tried to do something similar for dasd device labels before
but not come up with a working solution yet.
Do you think that udev_volume_id can be extended so that it can also
read disk labels and not just partition labels? The method for
detecting and reading a dasd label is the same as for fs labels,
and I have the necessary parsing code here.
The trouble is that the label is stored in the partition table, not
in the partition itself, so I would need to pass the minor number
from e.g. block/dasda/dev instead of block/dasda/dasda{1,2,3}/dev
to udev_volume_id.
> +/* open volume by major/minor */
> +struct volume_id *volume_id_open_dev_t(dev_t devt)
> +{
> + struct volume_id *id;
> + char tmp_node[VOLUME_ID_PATH_MAX];
> +
> + snprintf(tmp_node, VOLUME_ID_PATH_MAX,
> + "/tmp/volume-%u-%u", major(devt), minor(devt));
> + tmp_node[VOLUME_ID_PATH_MAX] = '\0';
This looks like a malicious user can easily prevent it from working
by creating files in /tmp. You might need to use something similar
to tmpfile(3) here.
Arnd <><
[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2004-05-06 9:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-29 21:04 [PATCH] udev callout for reading filesystem labels Kay Sievers
2004-04-30 13:35 ` Kevin P. Fleming
2004-04-30 14:36 ` Oliver Neukum
2004-04-30 22:29 ` Greg KH
2004-05-05 1:14 ` Kay Sievers
2004-05-05 21:24 ` Greg KH
2004-05-06 9:30 ` Arnd Bergmann [this message]
2004-05-06 20:18 ` Kay Sievers
2004-05-06 22:59 ` Kay Sievers
2004-05-07 14:02 ` Kay Sievers
2004-05-07 18:25 ` Arnd Bergmann
2004-05-07 21:52 ` Kay Sievers
2004-05-08 11:29 ` Kay Sievers
-- strict thread matches above, loose matches on Subject: below --
2004-05-08 16:52 arndb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200405061130.26733.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.