Commit Graph

306 Commits

Author SHA1 Message Date
Fuhai Wang 0f77c3ff8f scsi: smartpqi: compat for tk3
Signed-off-by: Fuhai Wang <fuhaiwang@tencent.com>
2021-07-29 23:14:54 +08:00
Fuhai Wang f1355f197a scsi: smartpqi: update driver version to v2.1.8-040
url: https://download.adaptec.com/raid/aac/linux/smartpqi_src_v2.1.8-040.tgz

Signed-off-by: Fuhai Wang <fuhaiwang@tencent.com>
2021-07-29 23:13:50 +08:00
Kaixu Xia 4766c86fd5 seq_file: disallow extremely large seq buffer allocations
There is no reasonable need for a buffer larger than this, and it avoids
int overflow pitfalls.

Fixes: 058504edd026 ("fs/seq_file: fallback to vmalloc allocation")
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Reported-by: Qualys Security Advisory <qsa@qualys.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-07-26 19:33:51 +08:00
Yang Shi 2f09e7ee6d mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct
mmap_sem is on the hot path of kernel, and it very contended, but it is
abused too.  It is used to protect arg_start|end and evn_start|end when
reading /proc/$PID/cmdline and /proc/$PID/environ, but it doesn't make
sense since those proc files just expect to read 4 values atomically and
not related to VM, they could be set to arbitrary values by C/R.

And, the mmap_sem contention may cause unexpected issue like below:

INFO: task ps:14018 blocked for more than 120 seconds.
       Tainted: G            E 4.9.79-009.ali3000.alios7.x86_64 #1
 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this
message.
 ps              D    0 14018      1 0x00000004
 Call Trace:
   schedule+0x36/0x80
   rwsem_down_read_failed+0xf0/0x150
   call_rwsem_down_read_failed+0x18/0x30
   down_read+0x20/0x40
   proc_pid_cmdline_read+0xd9/0x4e0
   __vfs_read+0x37/0x150
   vfs_read+0x96/0x130
   SyS_read+0x55/0xc0
   entry_SYSCALL_64_fastpath+0x1a/0xc5

Both Alexey Dobriyan and Michal Hocko suggested to use dedicated lock
for them to mitigate the abuse of mmap_sem.

So, introduce a new spinlock in mm_struct to protect the concurrent
access to arg_start|end, env_start|end and others, as well as replace
write map_sem to read to protect the race condition between prctl and
sys_brk which might break check_data_rlimit(), and makes prctl more
friendly to other VM operations.

This patch just eliminates the abuse of mmap_sem, but it can't resolve
the above hung task warning completely since the later
access_remote_vm() call needs acquire mmap_sem.  The mmap_sem
scalability issue will be solved in the future.

[yang.shi@linux.alibaba.com: add comment about mmap_sem and arg_lock]
  Link: http://lkml.kernel.org/r/1524077799-80690-1-git-send-email-yang.shi@linux.alibaba.com
Link: http://lkml.kernel.org/r/1523730291-109696-1-git-send-email-yang.shi@linux.alibaba.com
Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Mateusz Guzik <mguzik@redhat.com>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-07-26 16:13:08 +08:00
Florian Westphal b4977709b7 netfilter: x_tables: fix compat match/target pad out-of-bound write
upsteam: b29c457a6511435960115c0f548c4360d5f4801d

xt_compat_match/target_from_user doesn't check that zeroing the area
to start of next rule won't write past end of allocated ruleset blob.

Remove this code and zero the entire blob beforehand.

Fixes CVE: CVE-2021-22555

Reported-by: syzbot+cfc0247ac173f597aaaa@syzkaller.appspotmail.com
Reported-by: Andy Nguyen <theflow@google.com>
Fixes: 9fa492cdc160c ("[NETFILTER]: x_tables: simplify compat API")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2021-07-20 10:33:55 +00:00
Kaixu Xia 23e7bcb226 cgroup/memory: disable kmem limit by default
Disable kmem limit by default, and it can be enabled by kernel parameter.
2021-07-16 12:05:47 +08:00
shookliu a7777b0c29 mm/vmscan: fix infinite loop in drop_slab_node
We have observed that drop_caches can take a considerable amount of
time (<put data here>). Especially when there are many memcgs involved
because they are adding an additional overhead.

It is quite unfortunate that the operation cannot be interrupted by a
signal currently.  Add a check for fatal signals into the main loop so
that userspace can control early bailout.

There are two reasons:

1. We have too many memcgs, even though one object freed in one memcg,
   the sum of object is bigger than 10.

2. We spend a lot of time in traverse memcg once.  So, the memcg who
   traversed at the first have been freed many objects.  Traverse memcg
   next time, the freed count bigger than 10 again.

We can get the following info through 'ps':

  root:~# ps -aux | grep drop
  root  357956 ... R    Aug25 21119854:55 echo 3 > /proc/sys/vm/drop_caches
  root 1771385 ... R    Aug16 21146421:17 echo 3 > /proc/sys/vm/drop_caches
  root 1986319 ... R    18:56 117:27 echo 3 > /proc/sys/vm/drop_caches
  root 2002148 ... R    Aug24 5720:39 echo 3 > /proc/sys/vm/drop_caches
  root 2564666 ... R    18:59 113:58 echo 3 > /proc/sys/vm/drop_caches
  root 2639347 ... R    Sep03 2383:39 echo 3 > /proc/sys/vm/drop_caches
  root 3904747 ... R    03:35 993:31 echo 3 > /proc/sys/vm/drop_caches
  root 4016780 ... R    Aug21 7882:18 echo 3 > /proc/sys/vm/drop_caches

Use bpftrace follow 'freed' value in drop_slab_node:

  root:~# bpftrace -e 'kprobe:drop_slab_node+70 {@ret=hist(reg("bp")); }'
  Attaching 1 probe...
  ^B^C

  @ret:
  [64, 128)        1 |                                                    |
  [128, 256)      28 |                                                    |
  [256, 512)     107 |@                                                   |
  [512, 1K)      298 |@@@                                                 |
  [1K, 2K)       613 |@@@@@@@                                             |
  [2K, 4K)      4435 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
  [4K, 8K)       442 |@@@@@                                               |
  [8K, 16K)      299 |@@@                                                 |
  [16K, 32K)     100 |@                                                   |
  [32K, 64K)     139 |@                                                   |
  [64K, 128K)     56 |                                                    |
  [128K, 256K)    26 |                                                    |
  [256K, 512K)     2 |                                                    |

In the while loop, we can check whether the TASK_KILLABLE signal is set,
if so, we should break the loop.

Signed-off-by: Chunxin Zang <zangchunxin@bytedance.com>
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Chris Down <chris@chrisdown.name>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Matthew Wilcox <willy@infradead.org>
Link: https://lkml.kernel.org/r/20200909152047.27905-1-zangchunxin@bytedance.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-06-16 14:27:59 +08:00
Honglin Li 21008e5ae6 driver: update bnxt_en driver to 1.10.1-216.1.192.4_Makefile
Signed-off-by: Honglin Li <honglinli@tencent.com>
2021-05-06 08:17:28 +00:00
Xiaoming Gao aedf71cbd7 mpt3sas: sort sas by slot before sas_attach
currently sas disk detected order is decided by the first interrupt
generated order, not by slot number, fix it by slot number.

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
2021-04-27 08:20:56 +00:00
Fuhai Wang 83cae9c63f driver: update mpt3sas from 32.00.00.00 to 37.00.00.00
Signed-off-by: Fuhai Wang <fuhaiwang@tencent.com>
2021-04-27 08:20:56 +00:00
MengEn 6a3d84a0e8 net: fix compile error in 9db1459215
there is a compile error in 9db1459215 fix it

Signed-off-by: mengensun<mengensun@tencent.com>
Reviewed-by: kaixuxia<kaixuxia@tencent.com>
2021-04-22 09:05:23 +00:00
MengEn 9db1459215 pv4: fix race condition between route lookup and
invalidation

[upstream commit] 5018c59607a511cdee743b629c76206d9c9e6d7b

ipv4: fix race condition between route lookup and invalidation

Jesse and Ido reported the following race condition:
<CPU A, t0> - Received packet A is forwarded and cached dst entry is
taken from the nexthop ('nhc->nhc_rth_input'). Calls skb_dst_set()

<t1> - Given Jesse has busy routers ("ingesting full BGP routing tables
from multiple ISPs"), route is added / deleted and rt_cache_flush() is
called

<CPU B, t2> - Received packet B tries to use the same cached dst entry
from t0, but rt_cache_valid() is no longer true and it is replaced in
rt_cache_route() by the newer one. This calls dst_dev_put() on the
original dst entry which assigns the blackhole netdev to 'dst->dev'

<CPU A, t3> - dst_input(skb) is called on packet A and it is dropped due
to 'dst->dev' being the blackhole netdev

There are 2 issues in the v4 routing code:
1. A per-netns counter is used to do the validation of the route. That
means whenever a route is changed in the netns, users of all routes in
the netns needs to redo lookup. v6 has an implementation of only
updating fn_sernum for routes that are affected.
2. When rt_cache_valid() returns false, rt_cache_route() is called to
throw away the current cache, and create a new one. This seems
unnecessary because as long as this route does not change, the route
cache does not need to be recreated.

To fully solve the above 2 issues, it probably needs quite some code
changes and requires careful testing, and does not suite for net branch.

So this patch only tries to add the deleted cached rt into the uncached
list, so user could still be able to use it to receive packets until
it's done.

Fixes: 95c47f9cf5e0 ("ipv4: call dst_dev_put() properly")
Signed-off-by: Wei Wang <weiwan@google.com>
Reported-by: Ido Schimmel <idosch@idosch.org>
Reported-by: Jesse Hathaway <jesse@mbuki-mvuki.org>
Tested-by: Jesse Hathaway <jesse@mbuki-mvuki.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Cc: David Ahern <dsahern@gmail.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-04-21 06:23:05 +00:00
MengEn eff5c3174b netfilter: x_tables: Use correct memory barriers.
[upstream commit]: 175e476b8cdf2a4de7432583b49c871345e4f8a1
[upstream commit]: cc00bcaa589914096edef7fb87ca5cee4a166b5c
[upstream commit]: d3d40f237480abf3268956daf18cdc56edd32834

When a new table value was assigned, it was followed by a write memory
barrier. This ensured that all writes before this point would complete
before any writes after this point. However, to determine whether the
rules are unused, the sequence counter is read. To ensure that all
writes have been done before these reads, a full memory barrier is
needed, not just a write memory barrier. The same argument applies when
incrementing the counter, before the rules are read.

Changing to using smp_mb() instead of smp_wmb() fixes the kernel panic
reported in cc00bcaa5899 (which is still present), while still
maintaining the same speed of replacing tables.

The smb_mb() barriers potentially slow the packet path, however testing
has shown no measurable change in performance on a 4-core MIPS64
platform.

Fixes: 7f5c6d4f665b ("netfilter: get rid of atomic ops in fast path")
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2021-04-19 06:16:11 +00:00
MengEn 9d1c23eb89 netfilter: x_tables: don't use seqlock when fetching old counters
[upstream commit]: d13e7b2e65f6dfbe97b845d75741a970181b9fec

netfilter: x_tables: don't use seqlock when fetching old counters

after previous commit xt_replace_table will wait until all cpus
had even seqcount (i.e., no cpu is accessing old ruleset).

Add a 'old' counter retrival version that doesn't synchronize counters.
Its not needed, the old counters are not in use anymore at this point.

This speeds up table replacement on busy systems with large tables
(and many cores).

Cc: Dan Williams <dcbw@redhat.com>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2021-04-19 06:16:11 +00:00
MengEn ccdeb257e0 x_tables: make xt_replace_table wait until old rules are
not used anymore

[upstream commit] 80055dab5de0c8677bc148c4717ddfc753a9148e

xt_replace_table relies on table replacement counter retrieval (which
uses xt_recseq to synchronize pcpu counters).

This is fine, however with large rule set get_counters() can take
a very long time -- it needs to synchronize all counters because
it has to assume concurrent modifications can occur.

Make xt_replace_table synchronize by itself by waiting until all cpus
had an even seqcount.

This allows a followup patch to copy the counters of the old ruleset
without any synchonization after xt_replace_table has completed.

Cc: Dan Williams <dcbw@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2021-04-19 06:16:11 +00:00
yongduan 985a0aad22 backport wake affine upstream optimization
[upstream]
7332dec0 sched/fair: Only immediately migrate tasks due to interrupts
         if prev and target CPUs share cache
806486c3 sched/fair: Do not migrate if the prev_cpu is idle
082f764a sched/fair: Do not migrate on wake_affine_weight() if weights
         are equal
d8fcb81f sched/fair: Check for idle core in wake_affine

Signed-off-by: yongduan <yongduan@tencent.com>
2021-03-17 17:00:12 +08:00
Kaixu Xia 207a58f198 scsi: smartpqi: update driver version to 1.2.4-070 2021-03-16 14:13:34 +08:00
kaixuxiakx f45a183605
Merge pull request #52 from duanery/enable_squashfs_zlib
squashfs: enable CONFIG_SQUASHFS_ZLIB
2021-01-25 04:38:47 +00:00
yongduan 40b567175e squashfs: enable CONFIG_SQUASHFS_ZLIB
Refer to the config of centos 8

Signed-off-by: yongduan <yongduan@tencent.com>
2021-01-19 20:32:08 +08:00
kaixuxiakx d0c5d33465
Merge pull request #45 from silenceshell/patch-1
fix a typo
2021-01-11 04:50:50 +00:00
kaixuxiakx 7a3176fd51
Merge pull request #49 from Tencent/lennychen-virtblk
virtblk: fix io hang in hotplug scenario
2021-01-11 03:33:38 +00:00
kaixuxiakx 5d30195b1f
Merge pull request #47 from duanery/enable_cachefiles
enable CONFIG_CACHEFILES
2021-01-11 03:13:06 +00:00
Lei Chen b5d85c9684 PCI: Probe bridge window attributes once at enumeration-time
upstream: 51c48b310183ab6ba5419edfc6a8de889cc04521

pci_bridge_check_ranges() determines whether a bridge supports the optional
I/O and prefetchable memory windows and sets the flag bits in the bridge
resources.  This *could* be done once during enumeration except that the
resource allocation code completely clears the flag bits, e.g., in the
pci_assign_unassigned_bridge_resources() path.

The problem with pci_bridge_check_ranges() in the resource allocation path
is that we may allocate resources after devices have been claimed by
drivers, and pci_bridge_check_ranges() *changes* the window registers to
determine whether they're writable.  This may break concurrent accesses to
devices behind the bridge.

Add a new pci_read_bridge_windows() to determine whether a bridge supports
the optional windows, call it once during enumeration, remember the
results, and change pci_bridge_check_ranges() so it doesn't touch the
bridge windows but sets the flag bits based on those remembered results.

Signed-off-by: Lei Chen <lennychen@tencent.com>
2020-12-25 15:38:45 +08:00
Lei Chen 8cc9daaef1 virtblk: print useful info for timeout scenario
Signed-off-by: Lei Chen <lennychen@tencent.com>
2020-12-25 15:38:30 +08:00
herberthbli fcc70b0ae7
Merge pull request #46 from Tencent/herberthbli
acpi: disable AMD ghes timer
2020-12-15 09:27:33 +08:00
yongduan 15b0aa0d7f enable CONFIG_CACHEFILES
Signed-off-by: yongduan <yongduan@tencent.com>
2020-12-14 20:27:03 +08:00
Hongbo Li 585426ae3f acpi: disable AMD ghes timer
This timer will cause big schedule latency and network delay
on AMD machine.

Signed-off-by: Hongbo Li <herberthbli@tencent.com>
2020-12-14 09:56:58 +08:00
silenceshell 399d595926
fix a typo 2020-12-08 00:17:28 +08:00
gxm-newtonf b0ddb0c1b1
Merge pull request #43 from duanery/rps_using_pvipi
Rps using pvipi
2020-12-02 11:02:46 +08:00
herberthbli 0a971cab83
Merge pull request #41 from Tencent/herberthbli
netfilter: add ip6tables nat support
2020-12-01 17:43:24 +08:00
cquyx 40778f99ce
Merge pull request #44 from Tencent/fix-sysctl_conn_reuse_old_conntrack
bugfix: since a01a9445c0, ipvs sysctl have been missing sysctl swi…
2020-12-01 11:33:51 +08:00
YangYuxi 5415d2c6c6 bugfix: since a01a9445c0, ipvs sysctl have been missing sysctl switch 'conn_reuse_old_conntrack', that lead a switch dislocation
Signed-off-by: YangYuxi <yx.atom1@gmail.com>
2020-12-01 10:40:04 +08:00
yongduan 772d6366c7 net: rps using pvipi
In the virtualization scenario, you can use pvipi to optimize the sending of
IPI interrupts and reduce the number of vmexit.

rps_using_pvipi test
Test guest: 32 core, 64G memory, virtio-net 8 queues, rss interrupt is bound
to 24-31 core. Observe the number of vmexit of 31 cores.

1. 1000000pps
100 iperf instances, 10000pps per instance.
disable rps_using_pvipi  68077 vmexit/s
enable  rps_using_pvipi  21138 vmexit/s

2. 2000000pps
1000 iperf instances, 2000pps per instance.
disable rps_using_pvipi  40879 vmexit/s
enable  rps_using_pvipi  9195  vmexit/s

3. 2000000pps
2000 iperf instances, 1000pps per instance.
disable rps_using_pvipi  24746 vmexit/s
enable  rps_using_pvipi  7292  vmexit/s

Enabling rps_using_pvipi can greatly reduce the number of vmexit.

Signed-off-by: yongduan <yongduan@tencent.com>
2020-12-01 10:36:20 +08:00
yongduan 3853775fa6 smp: smp_call_function_many_async
Run an asynchronous function on a many cpus.
smp_call_function_many_async_begin
for_each_csd
        smp_call_function_many_async
smp_call_function_many_async_end

Signed-off-by: yongduan <yongduan@tencent.com>
2020-12-01 10:34:56 +08:00
Hongbo Li 16d1c13cad netfilter: add ip6tables nat support
Open CONFIG_IP6_NF_NAT

Signed-off-by: Hongbo Li <herberthbli@tencent.com>
2020-11-30 11:24:43 +08:00
heddchen 9c2652e3d8
Merge pull request #37 from Tencent/zgpeng
proc: fix the display error of the processes field in /proc/stat
2020-11-12 15:49:13 +08:00
zgpeng 8cbbd36a38 proc: fix the display error of the processes field in /proc/stat
Signed-off-by: zhiguang peng <zgpeng@tencent.com>
2020-11-12 14:39:06 +08:00
He Chen 94dd9ddb7e sched: fix offline task inheritance issue
Signed-off-by: heddchen <heddchen@tencent.com>
2020-11-10 17:47:17 +08:00
gxm-newtonf 49d407b7ec
Merge pull request #36 from kenieevan/master
fix regression bug cause by ipvs_mode=2 patch
2020-10-28 11:41:50 +08:00
gxm-newtonf a26f554ca5
Merge pull request #35 from charliecgxu/softirq
softirq: enhance network latency
2020-10-28 11:16:06 +08:00
jianmingfan dd5565b819 fix regression bug cause by ipvs_mode=2 patch
reason: in ipvs_mode ==1 , skb_rtable is ip_vs_nat_xmit is null.
Test case: test bpf mode nodeport ok!

Signed-off-by: jianmingfan <jianmingfan@tencent.com>
2020-10-26 18:53:40 +08:00
gxm-newtonf 55bfc23121
Merge pull request #34 from charliecgxu/memcg
memcg: add scheduling point while showing memcg usage
2020-10-20 14:06:00 +08:00
charliecgxu f7860a5c86 softirq: enhance network latency
Enhance network tail latency by directly handling softirq
when detecting long scheduling latency of ksoftirqd.

Signed-off-by: yongduan <yongduan@tencent.com>
Signed-off-by: charliecgxu <charliecgxu@tencent.com>
2020-10-16 11:55:22 +08:00
charliecgxu 61219f7c16 memcg: add scheduling point while showing memcg usage
Without preemption, if syscall excutes too long it will significantly
affect performance of other important processes. So add a shceduling
point when showing root memcg usage.

Signed-off-by: yongduan <yongduan@tencent.com>
Signed-off-by: charliecgxu <charliecgxu@tencent.com>
2020-10-13 10:13:59 +08:00
Xiaoming Gao 58236eda44 config: fix silent config
Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
2020-09-23 19:20:03 +08:00
gxm-newtonf 524899fd2b
Merge pull request #25 from donhui/patch-1
doc: images use relative paths
2020-09-23 19:14:45 +08:00
gxm-newtonf e753cb606a
Merge pull request #31 from oilbeater/config-geneve
config: enable geneve
2020-09-23 19:10:50 +08:00
Or Cohen 1a66a0ddc2 net/packet: fix overflow in tpacket_rcv
upstream: acf69c9

Using tp_reserve to calculate netoff can overflow as
tp_reserve is unsigned int and netoff is unsigned short.

This may lead to macoff receiving a smaller value then
sizeof(struct virtio_net_hdr), and if po->has_vnet_hdr
is set, an out-of-bounds write will occur when
calling virtio_net_hdr_from_skb.

The bug is fixed by converting netoff to unsigned int
and checking if it exceeds USHRT_MAX.

This addresses CVE-2020-14386

Fixes: 8913336a7e8d ("packet: add PACKET_RESERVE sockopt")
Signed-off-by: Or Cohen <orcohen@paloaltonetworks.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Fuhai Wang <fuhaiwang@tencent.com>
2020-09-23 19:07:29 +08:00
Fuhai Wang 1508b30ad8 inet: unconstify ipv6_mapped and tcp_request_sock_ipv4/6_ops
Signed-off-by: Fuhai Wang <fuhaiwang@tencent.com>
2020-09-23 19:07:10 +08:00
fuhaiwang d4619cc0fc
Merge pull request #24 from kenieevan/master
introduce ipvs_mode to share ipvs service and connection between network namespace
2020-09-23 19:02:00 +08:00