lkml.org 
[lkml]   [2021]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/3] init/main.c: introduce function ramdisk_exec_exist()
    On Sat, May 22, 2021 at 07:31:53PM +0800, menglong8.dong@gmail.com wrote:
    > Introduce the function ramdisk_exec_exist, which is used to check
    > the exist of 'ramdisk_execute_command'.
    >
    > It can do absolute path and relative path check. For relative path,
    > it will ignore '/' and '.' in the start of
    > 'ramdisk_execute_command'.

    > --- a/init/main.c
    > +++ b/init/main.c
    > @@ -1522,6 +1522,21 @@ void __init console_on_rootfs(void)
    > fput(file);
    > }
    >
    > +bool __init ramdisk_exec_exist(bool absolute)
    > +{
    > + char *tmp_command = ramdisk_execute_command;
    > +
    > + if (!tmp_command)
    > + return false;
    > +
    > + if (!absolute) {
    > + while (*tmp_command == '/' || *tmp_command == '.')
    > + tmp_command++;

    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.

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

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