lkml.org 
[lkml]   [2008]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] globmatch() helper function
From
Date
On Wed, 2008-12-17 at 14:28 +0100, Andi Kleen wrote:
> "George Spelvin" <linux@horizon.com> writes:
>
> Wow, finally a name.
>
> > break;
> > case '*':
> > if (pat[1] == '\0') /* Optimize trailing * case */
> > return true;
> > /* Recurse on each possible tail of str */
> > while (!globmatch(pat+1, str))
> > if (!*str++)
> > return false;
>
> I'm uneasy with the unbounded recursion. Sure currently all the users
> are controlled in kernel source code and expect to put in sane patterns.
> But if someone ever adds a user controlled glob in some way it will be
> trivial to crash/overwrite memory with the limited kernel stack.
> And with such a generalized function it's likely to be used more
> in the future.

ftrace has a globbing thing in there somewhere as well and that does
indeed take user input.

Using recursion in kernel code is indeed not recommended, what Andi said
we have tiny stacks.


\
 
 \ /
  Last update: 2008-12-17 16:21    [W:0.084 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site