* Re: More better in mount(2)
[not found] ` <10101051340.ZM14895@wobbly.melbourne.sgi.com>
@ 2001-01-05 14:51 ` Daniel Phillips
2001-01-05 20:26 ` Andreas Dilger
2001-01-08 14:06 ` xfs mount opts (was: More better in mount(2)) Nathan Scott
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Phillips @ 2001-01-05 14:51 UTC (permalink / raw)
To: Nathan Scott, linux-kernel
Nathan Scott wrote:
> On Jan 5, 3:26am, Daniel Phillips wrote:
> > ...
> > This filesystem mount option parsing code is completely ad hoc, and uses
> > strtok which is horribly horribly broken. (Do man strtok and read the
> > 'Bugs' section.)
> >
> > It would be worth thinking about how to do this better.
>
> hmm ... can't claim I wrote this code, just looked at it.
> are you saying the kernel strtok is horribly broken or just
> the way its being used here? (and why?)
>From the man page:
BUGS Never use this function. If you do, note that:
This function modifies its first argument.
The identity of the delimiting character is lost.
This functions cannot be used on constant strings.
The strtok () function uses a static buffer while
parsing, so it's not thread safe. Use strtok_r ()
if this matters to
you.
--
Daniel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: More better in mount(2)
2001-01-05 14:51 ` More better in mount(2) Daniel Phillips
@ 2001-01-05 20:26 ` Andreas Dilger
2001-01-08 14:06 ` xfs mount opts (was: More better in mount(2)) Nathan Scott
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Dilger @ 2001-01-05 20:26 UTC (permalink / raw)
To: Daniel Phillips; +Cc: Nathan Scott, linux-kernel
Daniel writes:
> [re strtok for mount option parsing]
>
> BUGS Never use this function. If you do, note that:
> This function modifies its first argument.
> The identity of the delimiting character is lost.
> This functions cannot be used on constant strings.
> The strtok() function uses a static buffer while
> parsing, so it's not thread safe. Use strtok_r()
> if this matters to you.
Luckily, when mount(8) is trying to mount a filesystem, it passes the
mount options into the kernel each time, which does copy_from_user(),
so the fact that strtok() breaks the data is OK. The only time this
is bad is with Stephen's ext3 rootflags option...
Cheers, Andreas
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: xfs mount opts (was: More better in mount(2))
2001-01-05 14:51 ` More better in mount(2) Daniel Phillips
2001-01-05 20:26 ` Andreas Dilger
@ 2001-01-08 14:06 ` Nathan Scott
1 sibling, 0 replies; 3+ messages in thread
From: Nathan Scott @ 2001-01-08 14:06 UTC (permalink / raw)
To: Daniel Phillips, linux-kernel
hi,
On Jan 5, 3:51pm, Daniel Phillips wrote:
> Subject: Re: More better in mount(2)
> Nathan Scott wrote:
> > On Jan 5, 3:26am, Daniel Phillips wrote:
> > > ...
> > > This filesystem mount option parsing code is completely ad hoc, and uses
> > > strtok which is horribly horribly broken. (Do man strtok and read the
> > > 'Bugs' section.)
> > >
> > > It would be worth thinking about how to do this better.
> >
> > hmm ... can't claim I wrote this code, just looked at it.
> > are you saying the kernel strtok is horribly broken or just
> > the way its being used here? (and why?)
>
> >From the man page:
> ...
yup, I did see that. I've gone through the code and I can't
see anything wrong with it (tell me if I've missed something).
If the problem is simply that its using strtok, then this must
just be a perceived problem rather than an actual problem (the
data is copied, and noone uses it other than the parsing code,
afaict).
>From a look through how the other filesystems do this, it
seems most use strtok (including ext2).
cheers.
--
Nathan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-01-07 23:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <NBBBJGOOMDFADJDGDCPHIEPACJAA.law@sgi.com>
[not found] ` <10101051142.ZM11680@wobbly.melbourne.sgi.com>
[not found] ` <01010503292006.00477@gimli>
[not found] ` <10101051340.ZM14895@wobbly.melbourne.sgi.com>
2001-01-05 14:51 ` More better in mount(2) Daniel Phillips
2001-01-05 20:26 ` Andreas Dilger
2001-01-08 14:06 ` xfs mount opts (was: More better in mount(2)) Nathan Scott
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox