lkml.org 
[lkml]   [2021]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/3] init/main.c: introduce function ramdisk_exec_exist()
On Tue, May 25, 2021 at 9:02 AM Josh Triplett <josh@joshtriplett.org> wrote:
>
......
>
> As far as I can tell, this will break if the user wants to use
> ".mybinary" or ".mydir/mybinary" as the name of their init program.
>
> For that matter, it would break "...prog" or "...somedir/prog", which
> would be strange but not something the kernel should prevent.
>

Wow, seems I didn't give enough thought to it.

> I don't think this code should be attempting to recreate
> relative-to-absolute filename resolution.

Trust me, I don't want to do it either. However, I need to check if
ramdisk_execute_command exist before chroot while the cpio is unpacked
to '/root'.

Maybe I can check it after chroot, but I need to chroot back if it not
exist. Can I chroot back in a nice way?

I tried to move the mount on '/root' to '/' before I do this check in
absolute path, but seems '/' is special, the lookup of '/init' never
follow the mount on '/' and it can't be found. However, if I lookup
'/../init', it can be found!

Is there any one have a good idea? Or I have to dig into the code
of 'kern_path()' and figure out the reason.

Thanks!
Menglong Dong

\
 
 \ /
  Last update: 2021-05-25 05:44    [W:0.042 / U:1.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site