1. 28 4月, 2014 1 次提交
    • R
      param: hand arguments after -- straight to init · 51e158c1
      Rusty Russell 提交于
      The kernel passes any args it doesn't need through to init, except it
      assumes anything containing '.' belongs to the kernel (for a module).
      This change means all users can clearly distinguish which arguments
      are for init.
      
      For example, the kernel uses debug ("dee-bug") to mean log everything to
      the console, where systemd uses the debug from the Scandinavian "day-boog"
      meaning "fail to boot".  If a future versions uses argv[] instead of
      reading /proc/cmdline, this confusion will be avoided.
      
      eg: test 'FOO="this is --foo"' -- 'systemd.debug="true true true"'
      
      Gives:
      argv[0] = '/debug-init'
      argv[1] = 'test'
      argv[2] = 'systemd.debug=true true true'
      envp[0] = 'HOME=/'
      envp[1] = 'TERM=linux'
      envp[2] = 'FOO=this is --foo'
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      51e158c1
  2. 24 3月, 2014 1 次提交
  3. 17 3月, 2014 1 次提交
    • M
      module: LLVMLinux: Remove unused function warning from __param_check macro · 0283f9a5
      Mark Charlebois 提交于
      This code makes a compile time type check that is optimized away. Clang
      complains that it generates an unused function:
      
      linux/kernel/panic.c:471:1: warning: unused function '__check_panic'
            [-Wunused-function]
      core_param(panic, panic_timeout, int, 0644);
      ^
      linux/moduleparam.h:283:2: note: expanded from macro
            'core_param'
              param_check_##type(name, &(var));                               \
              ^
      <scratch space>:87:1: note: expanded from here
      param_check_int
      ^
      linux/moduleparam.h:369:34: note: expanded from macro
            'param_check_int'
      #define param_check_int(name, p) __param_check(name, p, int)
                                       ^
      linux/moduleparam.h:349:22: note: expanded from macro
            '__param_check'
              static inline type *__check_##name(void) { return(p); }
                                  ^
      <scratch space>:88:1: note: expanded from here
      __check_panic
      
      GCC won't complain for a static inline function but would if it was just
      a static function.
      
      Adding the unused attribute to the function declaration removes the warning.
      Per request from Rusty Russell it is marked as __always_unused as the code
      is meant to be optimized away.
      
      This code works for both GCC and clang.
      Signed-off-by: NMark Charlebois <charlebm@gmail.com>
      Signed-off-by: NBehan Webster <behanw@converseincode.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      0283f9a5
  4. 20 8月, 2013 1 次提交
    • S
      module: Add flag to allow mod params to have no arguments · ab013c5f
      Steven Rostedt 提交于
      Currently the params.c code allows only two "set" functions to have
      no arguments. If a parameter does not have an argument, then it
      looks at the set function and tests if it is either param_set_bool()
      or param_set_bint(). If it is not one of these functions, then it
      fails the loading of the module.
      
      But there may be module parameters that have different set functions
      and still allow no arguments. But unless each of these cases adds
      their function to the if statement, it wont be allowed to have no
      arguments. This method gets rather messing and does not scale.
      
      Instead, introduce a flags field to the kernel_param_ops, where if
      the flag KERNEL_PARAM_FL_NOARG is set, the parameter will not fail
      if it does not contain an argument. It will be expected that the
      corresponding set function can handle a NULL pointer as "val".
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      ab013c5f
  5. 02 7月, 2013 1 次提交
  6. 14 12月, 2012 1 次提交
  7. 08 6月, 2012 1 次提交
    • R
      module_param: stop double-calling parameters. · ae82fdb1
      Rusty Russell 提交于
      Commit 026cee00 "params:
      <level>_initcall-like kernel parameters" set old-style module
      parameters to level 0.  And we call those level 0 calls where we used
      to, early in start_kernel().
      
      We also loop through the initcall levels and call the levelled
      module_params before the corresponding initcall.  Unfortunately level
      0 is early_init(), so we call the standard module_param calls twice.
      
      (Turns out most things don't care, but at least ubi.mtd does).
      
      Change the level to -1 for standard module_param calls.
      Reported-by: NBenoît Thébaudeau <benoit.thebaudeau@advansee.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: stable@kernel.org
      ae82fdb1
  8. 01 5月, 2012 1 次提交
    • J
      params: add 3rd arg to option handler callback signature · 9fb48c74
      Jim Cromie 提交于
      Add a 3rd arg, named "doing", to unknown-options callbacks invoked
      from parse_args(). The arg is passed as:
      
        "Booting kernel" from start_kernel(),
        initcall_level_names[i] from do_initcall_level(),
        mod->name from load_module(), via parse_args(), parse_one()
      
      parse_args() already has the "name" parameter, which is renamed to
      "doing" to better reflect current uses 1,2 above.  parse_args() passes
      it to an altered parse_one(), which now passes it down into the
      unknown option handler callbacks.
      
      The mod->name will be needed to handle dyndbg for loadable modules,
      since params passed by modprobe are not qualified (they do not have a
      "$modname." prefix), and by the time the unknown-param callback is
      called, the module name is not otherwise available.
      
      Minor tweaks:
      
      Add param-name to parse_one's pr_debug(), current message doesnt
      identify the param being handled, add it.
      
      Add a pr_info to print current level and level_name of the initcall,
      and number of registered initcalls at that level.  This adds 7 lines
      to dmesg output, like:
      
         initlevel:6=device, 172 registered initcalls
      
      Drop "parameters" from initcall_level_names[], its unhelpful in the
      pr_info() added above.  This array is passed into parse_args() by
      do_initcall_level().
      
      CC: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      Acked-by: NJason Baron <jbaron@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9fb48c74
  9. 26 3月, 2012 2 次提交
  10. 13 1月, 2012 3 次提交
    • R
      module_param: check that bool parameters really are bool. · 72db395f
      Rusty Russell 提交于
      module_param(bool) used to counter-intuitively take an int.  In
      fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
      trick.
      
      This tightens the check (you'll get a warning about incompatible
      return type) but still allows it.  Next kernel version, we'll remove
      it.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      72db395f
    • R
      module_param: avoid bool abuse, add bint for special cases. · 69116f27
      Rusty Russell 提交于
      For historical reasons, we allow module_param(bool) to take an int (or
      an unsigned int).  That's going away.
      
      A few drivers really want an int: they set it to -1 and a parameter
      will set it to 0 or 1.  This sucks: reading them from sysfs will give
      'Y' for both -1 and 1, but if we change it to an int, then the users
      might be broken (if they did "param" instead of "param=1").
      
      Use a new 'bint' parser for them.
      
      (ntfs has a different problem: it needs an int for debug_msgs because
      it's also exposed via sysctl.)
      
      Cc: Steve Glendinning <steve.glendinning@smsc.com>
      Cc: Jean Delvare <khali@linux-fr.org>
      Cc: Guenter Roeck <guenter.roeck@ericsson.com>
      Cc: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
      Cc: Christoph Raisch <raisch@de.ibm.com>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Sean Hefty <sean.hefty@intel.com>
      Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
      Cc: linux390@de.ibm.com
      Cc: Anton Altaparmakov <anton@tuxera.com>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: lm-sensors@lm-sensors.org
      Cc: linux-rdma@vger.kernel.org
      Cc: linux-s390@vger.kernel.org
      Cc: linux-ntfs-dev@lists.sourceforge.net
      Cc: alsa-devel@alsa-project.org
      Acked-by: Takashi Iwai <tiwai@suse.de> (For the sound part)
      Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> (For the hwmon driver)
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      69116f27
    • R
      module_param: check type correctness for module_param_array · bafeafea
      Rusty Russell 提交于
      module_param_array(), unlike its non-array cousins, didn't check the type
      of the variable.  Fixing this found two bugs.
      
      Cc: Luca Risolia <luca.risolia@studio.unibo.it>
      Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
      Cc: Eric Piel <eric.piel@tremplin-utc.net>
      Cc: linux-media@vger.kernel.org
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      bafeafea
  11. 31 10月, 2011 1 次提交
  12. 26 10月, 2011 1 次提交
  13. 19 5月, 2011 1 次提交
  14. 24 1月, 2011 1 次提交
  15. 27 10月, 2010 1 次提交
  16. 11 8月, 2010 6 次提交
  17. 29 10月, 2009 1 次提交
    • R
      param: fix lots of bugs with writing charp params from sysfs, by leaking mem. · 65afac7d
      Rusty Russell 提交于
      e180a6b7 "param: fix charp parameters set via sysfs" fixed the case
      where charp parameters written via sysfs were freed, leaving drivers
      accessing random memory.
      
      Unfortunately, storing a flag in the kparam struct was a bad idea: it's
      rodata so setting it causes an oops on some archs.  But that's not all:
      
      1) module_param_array() on charp doesn't work reliably, since we use an
         uninitialized temporary struct kernel_param.
      2) there's a fundamental race if a module uses this parameter and then
         it's changed: they will still access the old, freed, memory.
      
      The simplest fix (ie. for 2.6.32) is to never free the memory.  This
      prevents all these problems, at cost of a memory leak.  In practice, there
      are only 18 places where a charp is writable via sysfs, and all are
      root-only writable.
      Reported-by: NTakashi Iwai <tiwai@suse.de>
      Cc: Sitsofe Wheeler <sitsofe@yahoo.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Christof Schmitt <christof.schmitt@de.ibm.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: stable@kernel.org
      65afac7d
  18. 12 6月, 2009 3 次提交
  19. 31 3月, 2009 1 次提交
  20. 22 10月, 2008 2 次提交
    • R
      core_param() for genuinely core kernel parameters · 67e67cea
      Rusty Russell 提交于
      There are a lot of one-liner uses of __setup() in the kernel: they're
      cumbersome and not queryable (definitely not settable) via /sys.  Yet
      it's ugly to simplify them to module_param(), because by default that
      inserts a prefix of the module name (usually filename).
      
      So, introduce a "core_param".  The parameter gets no prefix, but
      appears in /sys/module/kernel/parameters/ (if non-zero perms arg).  I
      thought about using the name "core", but that's more common than
      "kernel".  And if you create a module called "kernel", you will die
      a horrible death.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      67e67cea
    • R
      module: check kernel param length at compile time, not runtime · 730b69d2
      Rusty Russell 提交于
      The kparam code tries to handle over-length parameter prefixes at
      runtime.  Not only would I bet this has never been tested, it's not
      clear that truncating names is a good idea either.
      
      So let's check at compile time.  We need to move the #define to
      moduleparam.h to do this, though.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      730b69d2
  21. 14 2月, 2008 1 次提交
  22. 29 1月, 2008 1 次提交
  23. 17 10月, 2007 1 次提交
  24. 18 2月, 2007 1 次提交
  25. 17 2月, 2007 1 次提交
  26. 08 12月, 2006 1 次提交
    • A
      [PATCH] Compile-time check re world-writeable module params · 9774a1f5
      Alexey Dobriyan 提交于
      One of the mistakes a module_param() user can make is to supply default
      value of module parameter as the last argument.  module_param() accepts
      permissions instead.  If default value is, say, 3 (-------wx), parameter
      becomes world-writeable.
      
      So far, the only remedy was to apply grep(1) and read drivers submitted
      to -mm. BTDT.
      
      With this patch applied, compiler will finally do some job.
      
      *) bounds checking on permissions
      *) world-writeable bit checking on permissions
      *) compile breakage if checks trigger
      
      First version of this check (only "& 2" part) directly caught 4 out of 7
      places during my last grep.
      
          Subject: Neverending module_param() bugs
          [X] drivers/acpi/sbs.c:101:module_param(capacity_mode, int, CAPACITY_UNIT);
          [X] drivers/acpi/sbs.c:102:module_param(update_mode, int, UPDATE_MODE);
          [ ] drivers/acpi/sbs.c:103:module_param(update_info_mode, int, UPDATE_INFO_MODE);
          [ ] drivers/acpi/sbs.c:104:module_param(update_time, int, UPDATE_TIME);
          [ ] drivers/acpi/sbs.c:105:module_param(update_time2, int, UPDATE_TIME2);
          [X] drivers/char/watchdog/sbc8360.c:203:module_param(timeout, int, 27);
          [X] drivers/media/video/tuner-simple.c:13:module_param(offset, int, 0666);
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9774a1f5
  27. 26 3月, 2006 1 次提交
  28. 07 1月, 2006 1 次提交
    • S
      kbuild: un-stringnify KBUILD_MODNAME · 367cb704
      Sam Ravnborg 提交于
      Now when kbuild passes KBUILD_MODNAME with "" do not __stringify it when
      used. Remove __stringnify for all users.
      This also fixes the output of:
      
      $ ls -l /sys/module/
      drwxr-xr-x 4 root root 0 2006-01-05 14:24 pcmcia
      drwxr-xr-x 4 root root 0 2006-01-05 14:24 pcmcia_core
      drwxr-xr-x 3 root root 0 2006-01-05 14:24 "processor"
      drwxr-xr-x 3 root root 0 2006-01-05 14:24 "psmouse"
      
      The quoting of the module names will be gone again.
      Thanks to GregKH + Kay Sievers for reproting this.
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      367cb704
  29. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4