1. 01 2月, 2008 3 次提交
  2. 29 1月, 2008 17 次提交
  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. 15 7月, 2007 1 次提交
  6. 11 7月, 2007 5 次提交
  7. 26 4月, 2007 3 次提交
  8. 11 2月, 2007 1 次提交
  9. 09 2月, 2007 1 次提交
  10. 14 12月, 2006 1 次提交
  11. 07 12月, 2006 1 次提交
    • D
      [NETFILTER]: Fix {ip,ip6,arp}_tables hook validation · 74c9c0c1
      Dmitry Mishin 提交于
      Commit 590bdf7f introduced a regression
      in match/target hook validation. mark_source_chains builds a bitmask
      for each rule representing the hooks it can be reached from, which is
      then used by the matches and targets to make sure they are only called
      from valid hooks. The patch moved the match/target specific validation
      before the mark_source_chains call, at which point the mask is always zero.
      
      This patch returns back to the old order and moves the standard checks
      to mark_source_chains. This allows to get rid of a special case for
      standard targets as a nice side-effect.
      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>
      74c9c0c1
  12. 03 12月, 2006 1 次提交
  13. 16 11月, 2006 1 次提交
  14. 31 10月, 2006 1 次提交
    • D
      [NETFILTER]: Missed and reordered checks in {arp,ip,ip6}_tables · 590bdf7f
      Dmitry Mishin 提交于
      There is a number of issues in parsing user-provided table in
      translate_table(). Malicious user with CAP_NET_ADMIN may crash system by
      passing special-crafted table to the *_tables.
      
      The first issue is that mark_source_chains() function is called before entry
      content checks. In case of standard target, mark_source_chains() function
      uses t->verdict field in order to determine new position. But the check, that
      this field leads no further, than the table end, is in check_entry(), which
      is called later, than mark_source_chains().
      
      The second issue, that there is no check that target_offset points inside
      entry. If so, *_ITERATE_MATCH macro will follow further, than the entry
      ends. As a result, we'll have oops or memory disclosure.
      
      And the third issue, that there is no check that the target is completely
      inside entry. Results are the same, as in previous issue.
      Signed-off-by: NDmitry Mishin <dim@openvz.org>
      Acked-by: NKirill Korotaev <dev@openvz.org>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      590bdf7f
  15. 25 10月, 2006 2 次提交
    • P
      [NETFILTER]: Fix ip6_tables extension header bypass bug · 6d381634
      Patrick McHardy 提交于
      As reported by Mark Dowd <Mark_Dowd@McAfee.com>, ip6_tables is susceptible
      to a fragmentation attack causing false negatives on extension header matches.
      
      When extension headers occur in the non-first fragment after the fragment
      header (possibly with an incorrect nexthdr value in the fragment header)
      a rule looking for this extension header will never match.
      
      Drop fragments that are at offset 0 and don't contain the final protocol
      header regardless of the ruleset, since this should not happen normally.
      Since all extension headers are before the protocol header this makes sure
      an extension header is either not present or in the first fragment, where
      we can properly parse it.
      
      With help from Yasuyuki KOZAKAI <yasuyuki.kozakai@toshiba.co.jp>.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6d381634
    • P
      [NETFILTER]: Fix ip6_tables protocol bypass bug · 51d8b1a6
      Patrick McHardy 提交于
      As reported by Mark Dowd <Mark_Dowd@McAfee.com>, ip6_tables is susceptible
      to a fragmentation attack causing false negatives on protocol matches.
      
      When the protocol header doesn't follow the fragment header immediately,
      the fragment header contains the protocol number of the next extension
      header. When the extension header and the protocol header are sent in
      a second fragment a rule like "ip6tables .. -p udp -j DROP" will never
      match.
      
      Drop fragments that are at offset 0 and don't contain the final protocol
      header regardless of the ruleset, since this should not happen normally.
      
      With help from Yasuyuki KOZAKAI <yasuyuki.kozakai@toshiba.co.jp>.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      51d8b1a6