[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADxym3asj97wATjGthOyMzosg=dHY-bfk5pqLPYLSCa2Sub73Q@mail.gmail.com>
Date: Tue, 25 May 2021 11:43:31 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: Josh Triplett <josh@...htriplett.org>
Cc: Luis Chamberlain <mcgrof@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Kees Cook <keescook@...omium.org>,
Sami Tolvanen <samitolvanen@...gle.com>, johan@...nel.org,
ojeda@...nel.org, jeyu@...nel.org, joe@...ches.com,
Menglong Dong <dong.menglong@....com.cn>, masahiroy@...nel.org,
Jan Kara <jack@...e.cz>, Jens Axboe <axboe@...nel.dk>,
hare@...e.de, gregkh@...uxfoundation.org, tj@...nel.org,
song@...nel.org, NeilBrown <neilb@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Barret Rhoden <brho@...gle.com>, f.fainelli@...il.com,
wangkefeng.wang@...wei.com, arnd@...db.de,
Rasmus Villemoes <linux@...musvillemoes.dk>,
mhiramat@...nel.org, Steven Rostedt <rostedt@...dmis.org>,
vbabka@...e.cz, Alexander Potapenko <glider@...gle.com>,
pmladek@...e.com, ebiederm@...ssion.com, jojing64@...il.com,
linux-fsdevel@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] init/main.c: introduce function ramdisk_exec_exist()
On Tue, May 25, 2021 at 9:02 AM Josh Triplett <josh@...htriplett.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
Powered by blists - more mailing lists