2007-01-23 18:32:20

by Xin Zhao

[permalink] [raw]
Subject: Is it possible to directly call do_path_lookup() in kernel?

Hi,

I tried to call the following code in a kernel module:

error = do_path_lookup(AT_FDCWD, "/etc/profile.d/glib2.csh",
LOOKUP_PARENT, &nd);

I exported the function do_path_lookup() using
"EXPORT_SYMBOL_GPL(do_path_lookup);"

But do_path_lookup() caused the "general protection fault: 0000 [#1]"
kernel error.

I thought it could be the problem of protection error, so I used the
following codes to enclose the code that calls do_path_lookup(), but
still got the same error.

fs = get_fs (); /* save previous value */
set_fs (KERNEL_DS); /* use kernel limit */
......
set_fs(fs);

Any idea on this?

Thanks a lot!

-x


2007-01-24 07:33:06

by Xin Zhao

[permalink] [raw]
Subject: Re: Is it possible to directly call do_path_lookup() in kernel?

I just successfully called do_path_lookup() in my kernel module. I
just removed the "fastcall" from the declaration of do_path_lookup(),
then the problem disappeared. I don't quite understand "fastcall"
though.

Can someone explain it?

Thanks,
-x

On 1/23/07, Xin Zhao <[email protected]> wrote:
> Hi,
>
> I tried to call the following code in a kernel module:
>
> error = do_path_lookup(AT_FDCWD, "/etc/profile.d/glib2.csh",
> LOOKUP_PARENT, &nd);
>
> I exported the function do_path_lookup() using
> "EXPORT_SYMBOL_GPL(do_path_lookup);"
>
> But do_path_lookup() caused the "general protection fault: 0000 [#1]"
> kernel error.
>
> I thought it could be the problem of protection error, so I used the
> following codes to enclose the code that calls do_path_lookup(), but
> still got the same error.
>
> fs = get_fs (); /* save previous value */
> set_fs (KERNEL_DS); /* use kernel limit */
> ......
> set_fs(fs);
>
> Any idea on this?
>
> Thanks a lot!
>
> -x
>