[PATCH] init: allow to preserve init's command-line

walter harms wharms at bfs.de
Wed Feb 3 12:31:06 UTC 2016



Am 03.02.2016 13:02, schrieb Daniel Thompson:
> On 01/02/16 18:09, Nicolas CARRIER wrote:
>> Thank you for all your comments.
>> Please find a new version attached.
> 
>> +//config:config FEATURE_PRESERVE_CMDLINE
>> +//config:    bool "Prevent init from altering its command-line after
>> parsing"
>> +//config:    default n
>> +//config:    depends on INIT
>> +//config:    help
>> +//config:      When launched as PID 1 and after parsing its
>> arguments, init
>> +//config:      wipes all the arguments but argv[0] and rewrites
>> argv[0] to
>> +//config:      contain only "init", so that its command-line appears
>> solely as
>> +//config:      "init" in tools such as ps.
>> +//config:      If you set this option to Y, all the arguments
>> including argv[0]
>> +//config:      will be preserved, be they parsed or ignored by init.
>> +//config:      The original command-line used to launch init can then be
>> +//config:      retrieved in /proc/1/cmdline on Linux, for example.
> 
> Having reviewed the thread I read FEATURE_PRESERVE_CMDLINE like a
> double-negative.
> 
> The feature is not preserving the cmdline; the feature is scrubbing the
> command line. It would be *much* easier to document the feature when we
> can say what is does do (i.e. increase compatibility with legacy unix
> environments) than by saying what it doesn't do.

granted

> 
> I also think keeping scrubbing on by default is rather conservative. Why
> not be brave and default to smaller code size!
> 

Default is the "expected" behavior. If you are sure it does not break anything
you can enable that option. The problem is that init starts the system and if you
break here, you are lost. So it pays the be conservative here.

re,
 wh





More information about the busybox mailing list