From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] udev callout for reading filesystem labels
Date: Thu, 06 May 2004 20:18:41 +0000 [thread overview]
Message-ID: <20040506201841.GA661@vrfy.org> (raw)
In-Reply-To: <20040429210446.GA9836@vrfy.org>
On Thu, May 06, 2004 at 11:30:23AM +0200, Arnd Bergmann wrote:
> 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.
Sure, we can do this. How much code do we need, for the parsing?
> 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.
Hmm, I really like to be able to compile with klibc and it doesn't
support tmpfile(). What about simply unlinking it, before creating the node?
thanks,
Kay
-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
next prev parent reply other threads:[~2004-05-06 20:18 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
2004-05-06 20:18 ` Kay Sievers [this message]
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=20040506201841.GA661@vrfy.org \
--to=kay.sievers@vrfy.org \
--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.