Skip to content
  1. Sep 24, 2014
    • Eric Dumazet's avatar
      icmp: add a global rate limitation · 4cdf507d
      Eric Dumazet authored
      Current ICMP rate limiting uses inetpeer cache, which is an RBL tree
      protected by a lock, meaning that hosts can be stuck hard if all cpus
      want to check ICMP limits.
      
      When say a DNS or NTP server process is restarted, inetpeer tree grows
      quick and machine comes to its knees.
      
      iptables can not help because the bottleneck happens before ICMP
      messages are even cooked and sent.
      
      This patch adds a new global limitation, using a token bucket filter,
      controlled by two new sysctl :
      
      icmp_msgs_per_sec - INTEGER
          Limit maximal number of ICMP packets sent per second from this host.
          Only messages whose type matches icmp_ratemask are
          controlled by this limit.
          Default: 1000
      
      icmp_msgs_burst - INTEGER
          icmp_msgs_per_sec controls number of ICMP packets sent per second,
          while icmp_msgs_burst controls the burst size of these packets.
          Default: 50
      
      Note that if we really want to send millions of ICMP messages per
      second, we might extend idea and infra added in commit 04ca6973
      
      
      ("ip: make IP identifiers less predictable") :
      add a token bucket in the ip_idents hash and no longer rely on inetpeer.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4cdf507d
    • Daniel Borkmann's avatar
      net: bpf: arm: make hole-faulting more robust · e8b56d55
      Daniel Borkmann authored
      Will Deacon pointed out, that the currently used opcode for filling holes,
      that is 0xe7ffffff, seems not robust enough ...
      
        $ echo 0xffffffe7 | xxd -r > test.bin
        $ arm-linux-gnueabihf-objdump -m arm -D -b binary test.bin
        ...
        0: e7ffffff     udf    #65535  ; 0xffff
      
      ... while for Thumb, it ends up as ...
      
        0: ffff e7ff    vqshl.u64  q15, <illegal reg q15.5>, #63
      
      ... which is a bit fragile. The ARM specification defines some *permanently*
      guaranteed undefined instruction (UDF) space, for example for ARM in ARMv7-AR,
      section A5.4 and for Thumb in ARMv7-M, section A5.2.6.
      
      Similarly, ptrace, kprobes, kgdb, bug and uprobes make use of such instruction
      as well to trap. Given mentioned section from the specification, we can find
      such a universe as (where 'x' denotes 'don't care'):
      
        ARM:    xxxx 0111 1111 xxxx xxxx xxxx 1111 xxxx
        Thumb:  1101 1110 xxxx xxxx
      
      We therefore should use a more robust opcode that fits both. Russell King
      suggested that we can even reuse a single 32-bit word, that is, 0xe7fddef1
      which will fault if executed in ARM *or* Thumb mode as done in f928d4f2
      
      
      ("ARM: poison the vectors page"). That will still hold our requirements:
      
        $ echo 0xf1defde7 | xxd -r > test.bin
        $ arm-unknown-linux-gnueabi-objdump -m arm -D -b binary test.bin
        ...
        0: e7fddef1     udf    #56801 ; 0xdde1
        $ echo 0xf1defde7f1defde7f1defde7 | xxd -r > test.bin
        $ arm-unknown-linux-gnueabi-objdump -marm -Mforce-thumb -D -b binary test.bin
        ...
        0: def1         udf    #241 ; 0xf1
        2: e7fd         b.n    0x0
        4: def1         udf    #241 ; 0xf1
        6: e7fd         b.n    0x4
        8: def1         udf    #241 ; 0xf1
        a: e7fd         b.n    0x8
      
      So on ARM 0xe7fddef1 conforms to the above UDF pattern, and the low 16 bit
      likewise correspond to UDF in Thumb case. The 0xe7fd part is an unconditional
      branch back to the UDF instruction.
      
      Signed-off-by: default avatarDaniel Borkmann <dborkman@redhat.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Mircea Gherzan <mgherzan@gmail.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8b56d55
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 1f6d8035
      David S. Miller authored
      
      
      Conflicts:
      	arch/mips/net/bpf_jit.c
      	drivers/net/can/flexcan.c
      
      Both the flexcan and MIPS bpf_jit conflicts were cases of simple
      overlapping changes.
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f6d8035
  2. Sep 23, 2014