On Tue, May 25, 2021 at 9:02 AM Josh Triplett <josh@xxxxxxxxxxxxxxxx> 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