1. 29 1月, 2008 12 次提交
  2. 15 12月, 2007 1 次提交
    • P
      [NETFILTER]: ip_tables: fix compat copy race · a18aa31b
      Patrick McHardy 提交于
      When copying entries to user, the kernel makes two passes through the
      data, first copying all the entries, then fixing up names and counters.
      On the second pass it copies the kernel and match data from userspace
      to the kernel again to find the corresponding structures, expecting
      that kernel pointers contained in the data are still valid.
      
      This is obviously broken, fix by avoiding the second pass completely
      and fixing names and counters while dumping the ruleset, using the
      kernel-internal data structures.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a18aa31b
  3. 16 10月, 2007 1 次提交
  4. 11 9月, 2007 1 次提交
    • N
      [NETFILTER]: Fix/improve deadlock condition on module removal netfilter · 16fcec35
      Neil Horman 提交于
      So I've had a deadlock reported to me.  I've found that the sequence of
      events goes like this:
      
      1) process A (modprobe) runs to remove ip_tables.ko
      
      2) process B (iptables-restore) runs and calls setsockopt on a netfilter socket,
      increasing the ip_tables socket_ops use count
      
      3) process A acquires a file lock on the file ip_tables.ko, calls remove_module
      in the kernel, which in turn executes the ip_tables module cleanup routine,
      which calls nf_unregister_sockopt
      
      4) nf_unregister_sockopt, seeing that the use count is non-zero, puts the
      calling process into uninterruptible sleep, expecting the process using the
      socket option code to wake it up when it exits the kernel
      
      4) the user of the socket option code (process B) in do_ipt_get_ctl, calls
      ipt_find_table_lock, which in this case calls request_module to load
      ip_tables_nat.ko
      
      5) request_module forks a copy of modprobe (process C) to load the module and
      blocks until modprobe exits.
      
      6) Process C. forked by request_module process the dependencies of
      ip_tables_nat.ko, of which ip_tables.ko is one.
      
      7) Process C attempts to lock the request module and all its dependencies, it
      blocks when it attempts to lock ip_tables.ko (which was previously locked in
      step 3)
      
      Theres not really any great permanent solution to this that I can see, but I've
      developed a two part solution that corrects the problem
      
      Part 1) Modifies the nf_sockopt registration code so that, instead of using a
      use counter internal to the nf_sockopt_ops structure, we instead use a pointer
      to the registering modules owner to do module reference counting when nf_sockopt
      calls a modules set/get routine.  This prevents the deadlock by preventing set 4
      from happening.
      
      Part 2) Enhances the modprobe utilty so that by default it preforms non-blocking
      remove operations (the same way rmmod does), and add an option to explicity
      request blocking operation.  So if you select blocking operation in modprobe you
      can still cause the above deadlock, but only if you explicity try (and since
      root can do any old stupid thing it would like....  :)  ).
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      16fcec35
  5. 11 7月, 2007 6 次提交
  6. 08 6月, 2007 1 次提交
    • D
      [NETFILTER]: ip_tables: fix compat related crash · 4c1b52bc
      Dmitry Mishin 提交于
      check_compat_entry_size_and_hooks iterates over the matches and calls
      compat_check_calc_match, which loads the match and calculates the
      compat offsets, but unlike the non-compat version, doesn't call
      ->checkentry yet. On error however it calls cleanup_matches, which in
      turn calls ->destroy, which can result in crashes if the destroy
      function (validly) expects to only get called after the checkentry
      function.
      
      Add a compat_release_match function that only drops the module reference
      on error and rename compat_check_calc_match to compat_find_calc_match to
      reflect the fact that it doesn't call the checkentry function.
      
      Reported by Jan Engelhardt <jengelh@linux01.gwdg.de>
      Signed-off-by: NDmitry Mishin <dim@openvz.org>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4c1b52bc
  7. 26 4月, 2007 3 次提交
  8. 11 2月, 2007 1 次提交
  9. 09 2月, 2007 2 次提交
  10. 05 1月, 2007 1 次提交
  11. 14 12月, 2006 2 次提交
  12. 07 12月, 2006 2 次提交
  13. 31 10月, 2006 3 次提交
  14. 20 10月, 2006 1 次提交
  15. 25 9月, 2006 1 次提交
  16. 23 9月, 2006 2 次提交