Commit Graph

8656 Commits

Author SHA1 Message Date
Gavin Shan
cd9f96aa8f KVM: selftests: Fix target thread to be migrated in rseq_test
commit e923b0537d28e15c9d31ce8b38f810b325816903 upstream.

In rseq_test, there are two threads, which are vCPU thread and migration
worker separately. Unfortunately, the test has the wrong PID passed to
sched_setaffinity() in the migration worker. It forces migration on the
migration worker because zeroed PID represents the calling thread, which
is the migration worker itself. It means the vCPU thread is never enforced
to migration and it can migrate at any time, which eventually leads to
failure as the following logs show.

  host# uname -r
  5.19.0-rc6-gavin+
  host# # cat /proc/cpuinfo | grep processor | tail -n 1
  processor    : 223
  host# pwd
  /home/gavin/sandbox/linux.main/tools/testing/selftests/kvm
  host# for i in `seq 1 100`; do \
        echo "--------> $i"; ./rseq_test; done
  --------> 1
  --------> 2
  --------> 3
  --------> 4
  --------> 5
  --------> 6
  ==== Test Assertion Failure ====
    rseq_test.c:265: rseq_cpu == cpu
    pid=3925 tid=3925 errno=4 - Interrupted system call
       1  0x0000000000401963: main at rseq_test.c:265 (discriminator 2)
       2  0x0000ffffb044affb: ?? ??:0
       3  0x0000ffffb044b0c7: ?? ??:0
       4  0x0000000000401a6f: _start at ??:?
    rseq CPU = 4, sched CPU = 27

Fix the issue by passing correct parameter, TID of the vCPU thread, to
sched_setaffinity() in the migration worker.

Fixes: 61e52f1630 ("KVM: selftests: Add a test for KVM_RUN+rseq to detect task migration bugs")
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Message-Id: <20220719020830.3479482-1-gshan@redhat.com>
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-29 17:25:23 +02:00
Oleksandr Tymoshenko
0791309aa0 Revert "selftest/vm: verify mmap addr in mremap_test"
This reverts commit e8b9989597.

The upstream commit 9c85a9bae267 ("selftest/vm: verify mmap addr in
mremap_test") was backported as commit a17404fcbf ("selftest/vm:
verify mmap addr in mremap_test"). Repeated backport introduced the
duplicate of function get_mmap_min_addr to the file breakign the vm
selftest build.

Fixes: e8b9989597 ("selftest/vm: verify mmap addr in mremap_test")
Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-29 17:25:06 +02:00
Oleksandr Tymoshenko
cfd3a9be0a Revert "selftest/vm: verify remap destination address in mremap_test"
This reverts commit 0b4e16093e.

The upstream commit 18d609daa546 ("selftest/vm: verify remap destination
address in mremap_test") was backported as commit 2688d967ec
("selftest/vm: verify remap destination address in mremap_test").
Repeated backport introduced the duplicate of function
is_remap_region_valid to the file breakign the vm selftest build.

Fixes: 0b4e16093e ("selftest/vm: verify remap destination address in mremap_test")
Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-29 17:25:06 +02:00
Hangbin Liu
c0c041a60c selftests/net: fix section name when using xdp_dummy.o
commit d28b25a62a47a8c8aa19bd543863aab6717e68c9 upstream.

Since commit 8fffa0e3451a ("selftests/bpf: Normalize XDP section names in
selftests") the xdp_dummy.o's section name has changed to xdp. But some
tests are still using "section xdp_dummy", which make the tests failed.
Fix them by updating to the new section name.

Fixes: 8fffa0e3451a ("selftests/bpf: Normalize XDP section names in selftests")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20220630062228.3453016-1-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-12 16:35:19 +02:00
Vladimir Oltean
3abec0b381 selftests: forwarding: fix error message in learning_test
[ Upstream commit 83844aacab2015da1dba1df0cc61fc4b4c4e8076 ]

When packets are not received, they aren't received on $host1_if, so the
message talking about the second host not receiving them is incorrect.
Fix it.

Fixes: d4deb01467 ("selftests: forwarding: Add a test for FDB learning")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-07-12 16:35:16 +02:00
Vladimir Oltean
1b74fe2e8f selftests: forwarding: fix learning_test when h1 supports IFF_UNICAST_FLT
[ Upstream commit 1a635d3e1c80626237fdae47a5545b6655d8d81c ]

The first host interface has by default no interest in receiving packets
MAC DA de:ad:be:ef:13:37, so it might drop them before they hit the tc
filter and this might confuse the selftest.

Enable promiscuous mode such that the filter properly counts received
packets.

Fixes: d4deb01467 ("selftests: forwarding: Add a test for FDB learning")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-07-12 16:35:16 +02:00
Vladimir Oltean
8e5fcfecd9 selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT
[ Upstream commit b8e629b05f5d23f9649c901bef09fab8b0c2e4b9 ]

As mentioned in the blamed commit, flood_unicast_test() works by
checking the match count on a tc filter placed on the receiving
interface.

But the second host interface (host2_if) has no interest in receiving a
packet with MAC DA de:ad:be:ef:13:37, so its RX filter drops it even
before the ingress tc filter gets to be executed. So we will incorrectly
get the message "Packet was not flooded when should", when in fact, the
packet was flooded as expected but dropped due to an unrelated reason,
at some other layer on the receiving side.

Force h2 to accept this packet by temporarily placing it in promiscuous
mode. Alternatively we could either deliver to its MAC address or use
tcpdump_start, but this has the fewest complications.

This fixes the "flooding" test from bridge_vlan_aware.sh and
bridge_vlan_unaware.sh, which calls flood_test from the lib.

Fixes: 236dd50bf6 ("selftests: forwarding: Add a test for flooded traffic")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-07-12 16:35:16 +02:00
Po-Hsu Lin
e63b94b8dd Revert "selftests/bpf: Add test for bpf_timer overwriting crash"
This reverts commit b0028e1cc1 which is
commit a7e75016a0753c24d6c995bc02501ae35368e333 upstream.

It will break the bpf self-tests build with:
progs/timer_crash.c:8:19: error: field has incomplete type 'struct bpf_timer'
        struct bpf_timer timer;
                         ^
/home/ubuntu/linux/tools/testing/selftests/bpf/tools/include/bpf/bpf_helper_defs.h:39:8:
note: forward declaration of 'struct bpf_timer'
struct bpf_timer;
       ^
1 error generated.

This test can only be built with 5.17 and newer kernels.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-12 16:34:47 +02:00
Mathieu Desnoyers
472863c7b5 selftests/rseq: Change type of rseq_offset to ptrdiff_t
commit 889c5d60fbcf332c8b6ab7054d45f2768914a375 upstream.

Just before the 2.35 release of glibc, the __rseq_offset userspace ABI
was changed from int to ptrdiff_t.

Adapt to this change in the kernel selftests.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://sourceware.org/pipermail/libc-alpha/2022-February/136024.html
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:31 +02:00
Mathieu Desnoyers
df2e933a53 selftests/rseq: x86-32: use %gs segment selector for accessing rseq thread area
commit 127b6429d235ab7c358223bbfd8a8b8d8cc799b6 upstream.

Rather than use rseq_get_abi() and pass its result through a register to
the inline assembler, directly access the per-thread rseq area through a
memory reference combining the %gs segment selector, the constant offset
of the field in struct rseq, and the rseq_offset value (in a register).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-16-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:31 +02:00
Mathieu Desnoyers
f5a656b4ab selftests/rseq: x86-64: use %fs segment selector for accessing rseq thread area
commit 4e15bb766b6c6e963a4d33629034d0ec3b7637df upstream.

Rather than use rseq_get_abi() and pass its result through a register to
the inline assembler, directly access the per-thread rseq area through a
memory reference combining the %fs segment selector, the constant offset
of the field in struct rseq, and the rseq_offset value (in a register).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-15-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:31 +02:00
Mathieu Desnoyers
4633aa6fad selftests/rseq: Fix: work-around asm goto compiler bugs
commit b53823fb2ef854222853be164f3b1e815f315144 upstream.

gcc and clang each have their own compiler bugs with respect to asm
goto. Implement a work-around for compiler versions known to have those
bugs.

gcc prior to 4.8.2 miscompiles asm goto.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670

gcc prior to 8.1.0 miscompiles asm goto at O1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103908

clang prior to version 13.0.1 miscompiles asm goto at O2.
https://github.com/llvm/llvm-project/issues/52735

Work around these issues by adding a volatile inline asm with
memory clobber in the fallthrough after the asm goto and at each
label target.  Emit this for all compilers in case other similar
issues are found in the future.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-14-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:31 +02:00
Mathieu Desnoyers
786bd35119 selftests/rseq: Remove arm/mips asm goto compiler work-around
commit 94c5cf2a0e193afffef8de48ddc42de6df7cac93 upstream.

The arm and mips work-around for asm goto size guess issues are not
properly documented, and lack reference to specific compiler versions,
upstream compiler bug tracker entry, and reproducer.

I can only find a loosely documented patch in my original LKML rseq post
refering to gcc < 7 on ARM, but it does not appear to be sufficient to
track the exact issue. Also, I am not sure MIPS really has the same
limitation.

Therefore, remove the work-around until we can properly document this.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/lkml/20171121141900.18471-17-mathieu.desnoyers@efficios.com/
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:31 +02:00
Mathieu Desnoyers
33307f2afd selftests/rseq: Fix warnings about #if checks of undefined tokens
commit d7ed99ade3e62b755584eea07b4e499e79240527 upstream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-12-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:31 +02:00
Mathieu Desnoyers
21199d9042 selftests/rseq: Fix ppc32 offsets by using long rather than off_t
commit 26dc8a6d8e11552f3b797b5aafe01071ca32d692 upstream.

The semantic of off_t is for file offsets. We mean to use it as an
offset from a pointer. We really expect it to fit in a single register,
and not use a 64-bit type on 32-bit architectures.

Fix runtime issues on ppc32 where the offset is always 0 due to
inconsistency between the argument type (off_t -> 64-bit) and type
expected by the inline assembler (32-bit).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-11-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:31 +02:00
Mathieu Desnoyers
56cbd6e40e selftests/rseq: Fix ppc32 missing instruction selection "u" and "x" for load/store
commit de6b52a21420a18dc8a36438d581efd1313d5fe3 upstream.

Building the rseq basic test  with
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
Target: powerpc-linux-gnu

leads to these errors:

/tmp/ccieEWxU.s: Assembler messages:
/tmp/ccieEWxU.s:118: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:118: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:121: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:121: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:626: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:626: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:629: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:629: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:735: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:735: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:738: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:738: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:741: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:741: Error: junk at end of line: `,8'
Makefile:581: recipe for target 'basic_percpu_ops_test.o' failed

Based on discussion with Linux powerpc maintainers and review of
the use of the "m" operand in powerpc kernel code, add the missing
%Un%Xn (where n is operand number) to the lwz, stw, ld, and std
instructions when used with "m" operands.

Using "WORD" to mean either a 32-bit or 64-bit type depending on
the architecture is misleading. The term "WORD" really means a
32-bit type in both 32-bit and 64-bit powerpc assembler. The intent
here is to wrap load/store to intptr_t into common macros for both
32-bit and 64-bit.

Rename the macros with a RSEQ_ prefix, and use the terms "INT"
for always 32-bit type, and "LONG" for architecture bitness-sized
type.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-10-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:30 +02:00
Mathieu Desnoyers
1969c5eff9 selftests/rseq: Fix ppc32: wrong rseq_cs 32-bit field pointer on big endian
commit 24d1136a29da5953de5c0cbc6c83eb62a1e0bf14 upstream.

ppc32 incorrectly uses padding as rseq_cs pointer field. Fix this by
using the rseq_cs.arch.ptr field.

Use this field across all architectures.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-9-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:30 +02:00
Mathieu Desnoyers
b9a8ebe296 selftests/rseq: Uplift rseq selftests for compatibility with glibc-2.35
commit 233e667e1ae3e348686bd9dd0172e62a09d852e1 upstream.

glibc-2.35 (upcoming release date 2022-02-01) exposes the rseq per-thread
data in the TCB, accessible at an offset from the thread pointer, rather
than through an actual Thread-Local Storage (TLS) variable, as the
Linux kernel selftests initially expected.

The __rseq_abi TLS and glibc-2.35's ABI for per-thread data cannot
actively coexist in a process, because the kernel supports only a single
rseq registration per thread.

Here is the scheme introduced to ensure selftests can work both with an
older glibc and with glibc-2.35+:

- librseq exposes its own "rseq_offset, rseq_size, rseq_flags" ABI.

- librseq queries for glibc rseq ABI (__rseq_offset, __rseq_size,
  __rseq_flags) using dlsym() in a librseq library constructor. If those
  are found, copy their values into rseq_offset, rseq_size, and
  rseq_flags.

- Else, if those glibc symbols are not found, handle rseq registration
  from librseq and use its own IE-model TLS to implement the rseq ABI
  per-thread storage.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-8-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:30 +02:00
Mathieu Desnoyers
e49d1c413d selftests/rseq: Introduce thread pointer getters
commit 886ddfba933f5ce9d76c278165d834d114ba4ffc upstream.

This is done in preparation for the selftest uplift to become compatible
with glibc-2.35.

glibc-2.35 exposes the rseq per-thread data in the TCB, accessible
at an offset from the thread pointer.

The toolchains do not implement accessing the thread pointer on all
architectures. Provide thread pointer getters for ppc and x86 which
lack (or lacked until recently) toolchain support.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-7-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:30 +02:00
Mathieu Desnoyers
d471088d07 selftests/rseq: Introduce rseq_get_abi() helper
commit e546cd48ccc456074ddb8920732aef4af65d7ca7 upstream.

This is done in preparation for the selftest uplift to become compatible
with glibc-2.35.

glibc-2.35 exposes the rseq per-thread data in the TCB, accessible
at an offset from the thread pointer, rather than through an actual
Thread-Local Storage (TLS) variable, as the kernel selftests initially
expected.

Introduce a rseq_get_abi() helper, initially using the __rseq_abi
TLS variable, in preparation for changing this userspace ABI for one
which is compatible with glibc-2.35.

Note that the __rseq_abi TLS and glibc-2.35's ABI for per-thread data
cannot actively coexist in a process, because the kernel supports only
a single rseq registration per thread.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-6-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:30 +02:00
Mathieu Desnoyers
c9a96b4231 selftests/rseq: Remove volatile from __rseq_abi
commit 94b80a19ebfe347a01301d750040a61c38200e2b upstream.

This is done in preparation for the selftest uplift to become compatible
with glibc-2.35.

All accesses to the __rseq_abi fields are volatile, but remove the
volatile from the TLS variable declaration, otherwise we are stuck with
volatile for the upcoming rseq_get_abi() helper.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-5-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:30 +02:00
Mathieu Desnoyers
3c35d9cbd9 selftests/rseq: Remove useless assignment to cpu variable
commit 930378d056eac2c96407b02aafe4938d0ac9cc37 upstream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-4-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:30 +02:00
Mathieu Desnoyers
94a913fe62 selftests/rseq: introduce own copy of rseq uapi header
commit 5c105d55a9dc9e01535116ccfc26e703168a574f upstream.

The Linux kernel rseq uapi header has a broken layout for the
rseq_cs.ptr field on 32-bit little endian architectures. The entire
rseq_cs.ptr field is planned for removal, leaving only the 64-bit
rseq_cs.ptr64 field available.

Both glibc and librseq use their own copy of the Linux kernel uapi
header, where they introduce proper union fields to access to the 32-bit
low order bits of the rseq_cs pointer on 32-bit architectures.

Introduce a copy of the Linux kernel uapi headers in the Linux kernel
selftests.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-2-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:30 +02:00
Shuah Khan
58f64962a6 selftests/rseq: remove ARRAY_SIZE define from individual tests
commit 07ad4f7629d4802ff0d962b0ac23ea6445964e2a upstream.

ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.

Remove ARRAY_SIZE from rseq tests and pickup the one defined in
kselftest.h.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:30 +02:00
Kumar Kartikeya Dwivedi
34ec62bc44 selftests/bpf: Add test_verifier support to fixup kfunc call insns
commit 0201b80772ac2b712bbbfe783cdb731fdfb4247e upstream.

This allows us to add tests (esp. negative tests) where we only want to
ensure the program doesn't pass through the verifier, and also verify
the error. The next commit will add the tests making use of this.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220114163953.1455836-9-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
[PHLin: backport due to lack of fixup_map_timer]
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:29 +02:00
Paolo Abeni
0b842b9e84 selftests: mptcp: more stable diag tests
commit 42fb6cddec3b306c9f6ef136b6438e0de1836431 upstream.

The mentioned test-case still use an hard-coded-len sleep to
wait for a relative large number of connection to be established.

On very slow VM and with debug build such timeout could be exceeded,
causing failures in our CI.

Address the issue polling for the expected condition several times,
up to an unreasonable high amount of time. On reasonably fast system
the self-tests will be faster then before, on very slow one we will
still catch the correct condition.

Fixes: df62f2ec3d ("selftests/mptcp: add diag interface tests")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:26 +02:00
Dimitris Michailidis
cc38c1eaa2 selftests/net: pass ipv6_args to udpgso_bench's IPv6 TCP test
commit b968080808f7f28b89aa495b7402ba48eb17ee93 upstream.

udpgso_bench.sh has been running its IPv6 TCP test with IPv4 arguments
since its initial conmit. Looks like a typo.

Fixes: 3a687bef14 ("selftests: udp gso benchmark")
Cc: willemb@google.com
Signed-off-by: Dimitris Michailidis <dmichail@fungible.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20220623000234.61774-1-dmichail@fungible.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:53:25 +02:00
Jie2x Zhou
0315bd8ad0 selftests: netfilter: correct PKTGEN_SCRIPT_PATHS in nft_concat_range.sh
[ Upstream commit 5d79d8af8dec58bf709b3124d09d9572edd9c617 ]

Before change:
make -C netfilter
 TEST: performance
   net,port                                                      [SKIP]
   perf not supported
   port,net                                                      [SKIP]
   perf not supported
   net6,port                                                     [SKIP]
   perf not supported
   port,proto                                                    [SKIP]
   perf not supported
   net6,port,mac                                                 [SKIP]
   perf not supported
   net6,port,mac,proto                                           [SKIP]
   perf not supported
   net,mac                                                       [SKIP]
   perf not supported

After change:
   net,mac                                                       [ OK ]
     baseline (drop from netdev hook):               2061098pps
     baseline hash (non-ranged entries):             1606741pps
     baseline rbtree (match on first field only):    1191607pps
     set with  1000 full, ranged entries:            1639119pps
ok 8 selftests: netfilter: nft_concat_range.sh

Fixes: 611973c1e0 ("selftests: netfilter: Introduce tests for sets with range concatenation")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Jie2x Zhou <jie2x.zhou@intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-29 09:03:24 +02:00
Toke Høiland-Jørgensen
8e57da591f selftests/bpf: Add selftest for calling global functions from freplace
commit 2cf7b7ffdae519b284f1406012b52e2282fa36bf upstream.

Add a selftest that calls a global function with a context object parameter
from an freplace function to check that the program context type is
correctly converted to the freplace target when fetching the context type
from the kernel BTF.

v2:
- Trim includes
- Get rid of global function
- Use __noinline

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/r/20220606075253.28422-2-toke@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
[ backport: fix conflict because tests were not serialised ]
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-25 15:18:40 +02:00
Greg Kroah-Hartman
fdae29a28f Merge branch 'android13-5.15' into 'android13-5.15-lts'
Sync up with android13-5.15 for the following commits now that the ABI
is frozen:

e31981896d ANDROID: ABI: Update symbols to unisoc whitelist for the drm
f1bf82c3da ANDROID: Enable GKI Dr. No Enforcement
3456f4eeee ANDROID: GKI: 6/17/2022 KMI update
a047de7997 ANDROID: GKI: add PG_oem_reserved in enum pageflags
b7a7765d8a ANDROID: power: Add ANDROID_OEM_DATA_ARRAY in freq_qos_request.
d1faa010ca FROMGIT: cgroup: Use separate src/dst nodes when preloading css_sets for migration
dfdd57b019 ANDROID: vendor_hooks: export hooks of mem_cgroup subsystem
04bb2779c9 ANDROID: vendor_hooks: add a field in pglist_data
59e1e26589 ANDROID: Allow vendor module to reclaim a memcg
326983dc9c ANDROID: Export memcg functions to allow module to add new files
f50ef59058 ANDROID: vendor_hooks: add hooks in mem_cgroup subsystem
6575ef0cd7 ANDROID: ASoC: core- Add vendor data fields to support  hostless DAI
8255004dae ANDROID: GKI: Add ANDROID_OEM_DATA_ARRAY() in struct ufs_hba
1c450d2d9e ANDROID: gic-v3: Update vendor hook to set affinity in GIC v3
d13008eb9f ANDROID: GKI: add ANDROID_OEM_DATA in struct bio
6abf3c5ef2 BACKPORT: FROMLIST: cfg80211: Indicate MLO connection info in connect and roam callbacks
29356dc0a2 BACKPORT: FROMGIT: wifi: cfg80211: add optional link add/remove callbacks
becbedacf9 BACKPORT: FROMGIT: wifi: cfg80211: sort trace.h
e1913fb476 BACKPORT: FROMGIT: wifi: nl80211: update add/remove link command
3f048cd911 BACKPORT: FROMGIT: wifi: nl80211: support MLO in auth/assoc
9af03657fb BACKPORT: FROMGIT: wifi: cfg80211: simplify cfg80211_mlme_auth() prototype
27f48acb1b BACKPORT: FROMGIT: wifi: ieee80211: add definitions for multi-link element
10f80b7397 BACKPORT: FROMGIT: wifi: nl80211: refactor BSS lookup in nl80211_associate()
442c68f14f BACKPORT: FROMGIT: wifi: cfg80211: mlme: get BSS entry outside cfg80211_mlme_assoc()
d975927513 BACKPORT: FROMGIT: wifi: cfg80211: do some rework towards MLO link APIs
af34adaa6a BACKPORT: FROMLIST: cfg80211: Increase akm_suites array size in cfg80211_crypto_settings
bee631cec5 ANDROID: nl80211/cfg80211: Add support to do API changes after GKI freeze
3dc56c75d2 ANDROID: Add macros to create reserved data fields to backport upstream changes
10f3543124 UPSTREAM: wil6210: remove 'freq' debugfs
d14ea158d6 ANDROID: GKI: Add ANDROID_OEM_DATA() in struct queue_limits
d534eb259e FROMLIST: ALSA: control: Use xarray for faster  lookups
bcef255e59 ANDROID: vendor_hooks: add a field in mem_cgroup
efc7473371 FROMGIT: PCI: dwc: Fix MSI msi_msg dma mapping
99af01f2b7 Revert "ANDROID: PCI: dwc: revert dwc 32-bit DMA mask for MSI address requirement"
7b26719a77 ANDROID: GKI: use internal type definitions in vendor hooks
d5f809c84d ANDROID: GKI: use public type definitions in vendor hooks
6b7259073e ANDROID: GKI: add ANDROID_OEM_DATA() in struct request_queue
7a43f1f694 ANDROID: vendor_hooks: add hook and OEM data for slab shrink
cbd20786b6 FROMLIST: scsi: ufs: Export regulator functions
df17a9b985 ANDROID: GKI: timer.h: add Android ABI padding to a structure
706766bc6c ANDROID: GKI: USB: add Android ABI padding to some structures
a61964fc70 ANDROID: GKI: sched.h: add Android ABI padding to some structures
6a79d5b96b ANDROID: GKI: module.h: add Android ABI padding to some structures
09c51db0d2 ANDROID: GKI: sock.h: add Android ABI padding to some structures
0b82194ecb ANDROID: GKI: sched: add Android ABI padding to some structures
da717c3ce1 ANDROID: GKI: mount.h: add Android ABI padding to some structures
98042d19ad ANDROID: GKI: mm: add Android ABI padding to some structures
b89d56cc81 ANDROID: GKI: add some padding to some driver core structures
5940799827 ANDROID: GKI: add padding to struct hid_device
936b0da47b ANDROID: GKI: USB: XHCI: add Android ABI padding to lots of xhci structures
db2b68eb63 ANDROID: GKI: dwc3: add Android ABI padding to some structures
e5fd26ff2d ANDROID: GKI: sound/usb/card.h: add Android ABI padding to struct snd_usb_endpoint
0e6d2288f0 ANDROID: GKI: user_namespace.h: add Android ABI padding to a structure
55f5cb7439 ANDROID: GKI: quota.h: add Android ABI padding to some structures
8137f1d169 ANDROID: GKI: mmu_notifier.h: add Android ABI padding to some structures
30d36e31c5 ANDROID: GKI: mm.h: add Android ABI padding to a structure
c57f9e1d48 ANDROID: GKI: kobject.h: add Android ABI padding to some structures
4a30d8ecf0 ANDROID: GKI: kernfs.h: add Android ABI padding to some structures
7426a5b28c ANDROID: GKI: irqdomain.h: add Android ABI padding to a structure
abc5541f4c ANDROID: GKI: ioport.h: add Android ABI padding to a structure
80b63f2f01 ANDROID: GKI: iomap.h: add Android ABI padding to a structure
2ca1ba50e6 ANDROID: GKI: hrtimer.h: add Android ABI padding to a structure
f25b001302 ANDROID: GKI: genhd.h: add Android ABI padding to some structures
5988e691de ANDROID: GKI: ethtool.h: add Android ABI padding to a structure
5d4e30d9b9 ANDROID: GKI: dma-mapping.h: add Android ABI padding to a structure
bd3b9b13ef ANDROID: GKI: networking: add Android ABI padding to a lot of networking structures
c422535706 ANDROID: GKI: blk_types.h: add Android ABI padding to a structure
94e58fdb6e ANDROID: GKI: scsi.h: add Android ABI padding to a structure
804026210f ANDROID: GKI: pci: add Android ABI padding to some structures
4e079c929f ANDROID: GKI: add Android ABI padding to struct nf_conn
5e65f67ae0 ANDROID: abi_gki_aarch64_qcom: Add rproc and rpmsg helpers
111cae8473 FROMLIST: rpmsg: core: Introduce rproc_mem_entry_free
9eed2acb93 FROMLIST: remoteproc: core: Add helper to remove carveouts
6ac966ab47 UPSTREAM: remoteproc: move rproc_da_to_va declaration to remoteproc.h
76801c2626 FROMLIST: rpmsg: char: Add support to use rpmsg_rx_done
a4f64634ad FROMLIST: rpmsg: core: Add rx done hooks
60a6ad4211 FROMLIST: mmc: sdhci-msm: Enable force hw reset during cqe recovery
024f778bbb FROMLIST: mmc: core: Introduce new flag to force hardware reset
74e6357176 ANDROID: GKI: Add ANDROID_OEM_DATA in struct ufs_dev_info
9662426af3 ANDROID: sched: Add oem data in struct rq
d6f34bc835 FROMLIST: drivers/thermal/thermal_of: Add critical/hot ops support for thermal_of sensor
50bca2f782 Revert "Revert "ANDROID: GKI: enable CONFIG_BLK_CGROUP_IOCOST""
dc3e85677b Revert "Revert "ANDROID: GKI: Add ANDROID_OEM_DATA in struct blk_mq_tags""
90e5d9e303 Revert "Revert "ANDROID: GKI: Add ANDROID_OEM_DATA in struct blk_mq_ctx""
071859b45a ANDROID: mmc: Add vendor hooks
22c62839a1 ANDROID: scsi: ufs: Enable CONFIG_SCSI_UFS_HPB
1ef6a91031 FROMGIT: drivers/thermal/thermal_of: Add change_mode ops support for thermal_of sensor
377ef18ed6 FROMGIT: mmc: cqhci: Capture eMMC and SD card errors
232df716fb FROMGIT: mmc: debugfs: Add debug fs error state entry for mmc driver
a70d301048 FROMGIT: mmc: debugfs: Add debug fs entry for mmc driver
6f0f720466 FROMGIT: mmc: sdhci: Capture eMMC and SD card errors
7ace0d462a FROMGIT: mmc: core: Capture eMMC and SD card errors
45850948d1 ANDROID: GKI: Add OEM data to mutex/rwsem
1dc9f51423 ANDROID: GKI: net: add vendor hooks for 'struct sock' lifecycle
72c4b4cdad ANDROID: GKI: net: add vendor hooks for 'struct nf_conn' lifecycle
7948b5ff64 ANDROID: GKI: add vendor padding variable in struct sock
889670d815 ANDROID: GKI: add vendor padding variable in struct nf_conn
2d9a4bfb7b FROMLIST: dma-buf: Move sysfs work out of DMA-BUF export path
ebc5cf22b4 ANDROID: Add vendor hook for MemcgV2 optimization
dbb4320c14 UPSTREAM: scsi: ufs: core: Probe for temperature notification support
8ee9980737 ANDROID: scsi: ufs: Support Multi-Circular Queue
b528c7889d UPSTREAM: mmc: core: Add host specific tuning support for eMMC HS400 mode
6b6ee4548a UPSTREAM: mmc: mtk-sd: Add HS400 online tuning support
9a63e4dcc0 UPSTREAM: dt-bindings: mmc: mtk-sd: Add hs400 dly3 setting
6551a55c4d ANDROID: powerpc/mm: protect vm_file during speculative page fault handling
4fc18576ca ANDROID: x86/mm: protect vm_file during speculative page fault handling
0f4ea1e593 ANDROID: arm64/mm: protect vm_file during speculative page fault handling
a3fe25d923 ANDROID: add vma->file_ref_count to synchronize vma->vm_file destruction
a16e169d36 Revert "ANDROID: Use the notifier lock to perform file-backed vma teardown"
f25e13c1bc Revert "ANDROID: Fix build errors caused by missing mmu_notifier_lock definition"
9a526b9527 UPSTREAM: xfrm: fix "disable_policy" flag use when arriving from different devices
6508a3753c UPSTREAM: xfrm: rework default policy structure
3ae9599990 UPSTREAM: net: fix dev_fill_forward_path with pppoe + bridge
75cd98366d UPSTREAM: btrfs: fallback to blocking mode when doing async dio over multiple extents
a5070df850 UPSTREAM: btrfs: fix deadlock due to page faults during direct IO reads and writes
3446e643b7 UPSTREAM: mm: gup: make fault_in_safe_writeable() use fixup_user_fault()
ee1ecd7ea5 UPSTREAM: gfs2: Fix mmap + page fault deadlocks for direct I/O
127a8ed2d3 UPSTREAM: iov_iter: Introduce nofault flag to disable page faults
ccf74d1eca UPSTREAM: selftests/bpf: Add test for reg2btf_ids out of bounds access
83e7514f57 UPSTREAM: bpf: Fix crash due to out of bounds access into reg2btf_ids.
2f53e2190d UPSTREAM: bpf/selftests: Test PTR_TO_RDONLY_MEM
8f07caaddc UPSTREAM: bpf: Add MEM_RDONLY for helper args that are pointers to rdonly mem.
e1714bff1c UPSTREAM: bpf: Make per_cpu_ptr return rdonly PTR_TO_MEM.
d7ebee8df3 UPSTREAM: bpf: Convert PTR_TO_MEM_OR_NULL to composable types.
1cd4928129 UPSTREAM: bpf: Introduce MEM_RDONLY flag
13fc6550b0 UPSTREAM: bpf: Replace PTR_TO_XXX_OR_NULL with PTR_TO_XXX | PTR_MAYBE_NULL
f5a45f25bf UPSTREAM: bpf: Replace RET_XXX_OR_NULL with RET_XXX | PTR_MAYBE_NULL
cc6305f056 UPSTREAM: bpf: Replace ARG_XXX_OR_NULL with ARG_XXX | PTR_MAYBE_NULL
cc3b22bead UPSTREAM: bpf: Introduce composable reg, ret and arg types.
3f1805c930 ANDROID: Update symbol list for mtk
536083a4ce ANDROID: GKI: add symbol list file for honor
4993f5a6dd ANDROID: GKI: Update symbol list for Exynos SoC
546461d83f ANDROID: KVM: arm64: Prevent kmemleak from accessing .hyp.data
4a006e6d47 FROMGIT: KVM: arm64: Prevent kmemleak from accessing pKVM memory
3882af1c70 ANDROID: ABI: Update symbols to unisoc whitelist for the scheduler 4st
7754d28433 ANDROID: GKI: Update symbols to symbol list
4ee2f8b56d FROMLIST: iommu/mediatek: Allow page table PA up to 35bit
0b6600b792 FROMLIST: iommu/io-pgtable-arm-v7s: Add a quirk to allow pgtable PA up to 35bit
4f746c15d7 ANDROID: Add vendor hooks to signal.
fd2e5c65ed ANDROID: ashmem: Export is_ashmem_file
348b1456e9 ANDROID: vendor_hooks: bypass shrink slab
e53e6edb46 FROMLIST: devcoredump : Serialize devcd_del work
ab7e76f60c ANDROID: GKI: Update symbols list for vivo
f58e5166c0 ANDROID: ABI: Update symbols used by the unisoc filesystem whitelist for the 1st
f5ba378e89 FROMLIST: of: of_reserved_mem: Increase limit for reserved_mem regions
648e73245b ANDROID: GKI: Add symbol list file for vivo
64a4e77c86 ANDROID: Revert "tracing: Disable "other" permission bits in the tracefs files"
c8a2e13615 ANDROID: vendor_hooks: Add hook for binder
38d8fefb73 ANDROID: GKI: Update abi_gki_aarch64_qcom for devm_of_clk_del_provider
4a0a0fef25 Revert "ANDROID: umh: Enable usermode helper for required use cases"
43c339540b ANDROID: GKI: update module list for fips140 build
b5b6394e25 BACKPORT: mm: khugepaged: recalculate min_free_kbytes after stopping khugepaged
368cd63a4a ANDROID: fault: Add vendor hook for TLB conflict
56b51fac38 BACKPORT: FROMLIST: block/bfq: Enable I/O statistics
933eddd126 ANDROID: Adding Image.gz and boot-gz.img
f28cdbf9ee ANDROID: usb: dwc3: export tracepoint for dwc3 read/write
7a0c3689e0 ANDROID: usb: add EXPORT_TRACE_SYMBOL to export tracepoint
d03bf01b43 UPSTREAM: usb: dwc3: core: Add error log when core soft reset failed
435a42a0b4 ANDROID: GKI: Update symbols to abi_gki_aarch64_oplus
1502f0ea7c ANDROID: Add hook to show vendor info for transactions
15a32b46ee ANDROID: GKI: Update abi_gki_aarch64_qcom for partial init tracepoint
e8b5afb658 ANDROID: vendor_hooks: Add hook for partial_init
854f840411 ANDROID: mutex: Add vendor hook to init mutex oem data.
7c82ee91c2 FROMLIST: scsi: ufs-mediatek: Introduce workaround for power mode change
0b0ceacf04 FROMLIST: scsi: ufs: Fix ADAPT logic for HS-G5
97d940cfa3 FROMLIST: scsi: ufs: Export ufshcd_uic_change_pwr_mode()
57388a13ab ANDROID: Update symbol list for mtk
2d18a97422 BACKPORT: FROMGIT: usb: dwc3: add power down scale setting
08a1879c87 ANDROID: GKI: remove info print for header generation
5452f089f9 UPSTREAM: gup: Introduce FOLL_NOFAULT flag to disable page faults
18e16d6365 UPSTREAM: iomap: Support partial direct I/O on user copy failures
89f91db7ae UPSTREAM: iomap: Fix iomap_dio_rw return value for user copies
9d16bdb659 UPSTREAM: gfs2: Fix mmap + page fault deadlocks for buffered I/O
64ef40ba87 UPSTREAM: gfs2: Eliminate ip->i_gh
f0a127f84b UPSTREAM: gfs2: Move the inode glock locking to gfs2_file_buffered_write
4e70d7c309 UPSTREAM: gfs2: Introduce flag for glock holder auto-demotion
d0e98c116d UPSTREAM: gfs2: Clean up function may_grant
3b46c843f2 UPSTREAM: gfs2: Add wrapper for iomap_file_buffered_write
6603584106 UPSTREAM: iov_iter: Introduce fault_in_iov_iter_writeable
e1c331f4ec UPSTREAM: iov_iter: Turn iov_iter_fault_in_readable into fault_in_iov_iter_readable
d9fb814064 UPSTREAM: gup: Turn fault_in_pages_{readable,writeable} into fault_in_{readable,writeable}
4d242c3433 ANDROID: vendor_hooks: tune reclaim swappiness or scan type
113b63538c FROMLIST: power_supply: Register cooling device outside of probe
e4e3aadd01 ANDROID: vendor_hooks: Add hooks to tcp/udp send/recv msg functions.
cabca1b98e ANDROID: GKI: Add vendor hook to binder transaction
d1367b5473 ANDROID: binder: fix race in priority restore
e8fcc17a57 ANDROID: binder: switch task argument for binder_thread
16c04a2732 ANDROID: binder: pass desired priority by reference
7da5987f5d ANDROID: binder: fold common setup of node_prio
6fbdd5a252 ANDROID: vendor_hooks: Add hooks for account process tick
0902cc73b7 ANDROID: vendor_hooks: Add hooks for rwsem and mutex
3e3677f8f1 UPSTREAM: usb: gadget: f_mass_storage: Make CD-ROM emulation work with Mac OS-X
e0a580025c ANDROID: Update symbol list for mtk
9a7732c0b2 ANDROID: input: Add vendor hook for __pass_event in evdev.c
c555553a40 ANDROID: umh: Enable usermode helper for required use cases
50a2b178c5 ANDROID: vendor_hooks: Add hooks to dup_task_struct
d450a89aa1 ANDROID: GKI: add symbol list file for xiaomi
bfda92e572 ANDROID: ABI: Update symbols to unisoc whitelist for the 7th
dd4c3a3bc9 ANDROID: GKI: Update abi_gki_aarch64_qcom for pm flag set tracepoint
596dcf7986 ANDROID: vendor_hooks: Add hook in wakeup functionality
388f95c620 ANDROID: gki_defconfig: enable CONFIG_KFENCE_STATIC_KEYS
53df1b822d ANDROID: vendor_hooks: Add hooks for account irqtime process tick
825d9968d9 ANDROID: abi_gki_aarch64_qcom: Update qcom abi symbol list
862fbb8517 FROMGIT: mmc: core: Set reset done after hw reset
b9029542be ANDROID: KVM: arm64: Don't update IOMMUs unnecessarily
39e9847ef0 ANDROID: Creating boot.img for x86_64 GKI
3071eda198 ANDROID: abi_gki_aarch64_qcom: Update symbol list with usb_role_string
1ac270abbd ANDROID: gki_defconfig: Enable RCU_BOOST config
af6c1477c3 ANDROID: abi_gki_aarch64_qcom: Add android_vh_disable_thermal_cooling_stats
f6e47fd00f ANDROID: thermal: vendor hook to disable thermal cooling stats
2baf6bfef4 UPSTREAM: usb: gadget: f_mass_storage: Disable eps during disconnect
c1993b4cbc ANDROID: Update symbols list and ABI for qcom
03b512f716 UPSTREAM: media: uvcvideo: Add UVC_GUID_FORMAT_H265
d1b6bd094b ANDROID: vendor_hooks: Add hook in shrink_node_memcgs
120823bf95 UPSTREAM: usb: dwc3: gadget: Change to dev_dbg() when queuing to inactive gadget/ep
7bfb6542ae ANDROID: Add several symbol lists for unisoc
78d6de7863 ANDROID: Fix the CONFIG_ANDROID_VENDOR_OEM_DATA=n build
45a91f3011 ANDROID: abi_gki_aarch64_qcom: Add kobject_get
842137671f Revert "ANDROID: GKI: Add ANDROID_OEM_DATA in struct request_queue"
443c11e0b1 Revert "ANDROID: GKI: Add ANDROID_OEM_DATA in struct blk_mq_ctx"
b982f17e13 Revert "ANDROID: GKI: Add ANDROID_OEM_DATA in struct blk_mq_tags"
3062974bf9 Revert "ANDROID: GKI: enable CONFIG_BLK_CGROUP_IOCOST"
f0b29dd9e3 ANDROID: lib: Export show_mem() for vendor module usage
50e4cd9df7 ANDROID: vendor_hooks: Add hooks for memory when debug
5a70133feb ANDROID: vendor_hooks: Add hook in try_to_unmap_one()
73c9d4a9d5 ANDROID: vendor_hooks: Add hook in mmap_region()
caaafb7005 FROMGIT: cfi: Fix __cfi_slowpath_diag RCU usage with cpuidle
49ad57e915 ANDROID: mm/memory_hotplug: Don't special case memory_block_size_bytes
6b6c4a7373 ANDROID: abi_gki_aarch64_qcom: Add android_vh_ufs_clock_scaling
3ff9481aad ANDROID: scsi: ufs: Add hook to influence the UFS clock scaling policy
442d3a107b ANDROID: Update symbol list for mtk
f85e3d9101 ANDROID: scheduler: export task_sched_runtime
aa0e7ec774 ANDROID: GKI: enable CONFIG_BLK_CGROUP_IOCOST
9123d4dfe5 ANDROID: GKI: Add ANDROID_OEM_DATA in struct blk_mq_tags
7f6e518e43 ANDROID: GKI: Add ANDROID_OEM_DATA in struct blk_mq_ctx
f4e36db507 ANDROID: GKI: Add ANDROID_OEM_DATA in struct request_queue
7e54032750 ANDROID: Update mtktv symbol list
c6b53b7aac ANDROID: abi_gki_aarch64_qcom: Update qcom abi symbol list
3c55aa6ffe ANDROID: GKI: add vendor padding variable in struct skb_shared_info
f45d12df24 ANDROID: GKI: Enable DM_INIT
149474c544 FROMLIST: power_supply: Use of-thermal cdev registration API
291dfda577 ANDROID: init_task: Init android vendor and oem data
afd403d142 ANDROID: qcom: Add flush_delayed_fput to ABI
6976d861b5 ANDROID: GKI: build damon reclaim
11bc7e6f8e FROMLIST: mm/damon/reclaim: Fix the timer always stays active
71da156123 BACKPORT: treewide: Add missing includes masked by cgroup -> bpf dependency
caffd17b02 UPSTREAM: mm/damon: modify damon_rand() macro to static inline function
802a5dc657 UPSTREAM: mm/damon: add 'age' of region tracepoint support
7019f96d3f UPSTREAM: mm/damon: hide kernel pointer from tracepoint event
c5bf6f61a3 UPSTREAM: mm/damon/vaddr: hide kernel pointer from damon_va_three_regions() failure log
d7cbb8dc2a UPSTREAM: mm/damon/vaddr: use pr_debug() for damon_va_three_regions() failure logging
2d1227b126 UPSTREAM: mm/damon/dbgfs: remove an unnecessary variable
2861a7ee7f UPSTREAM: mm/damon: move the implementation of damon_insert_region to damon.h
508a322b77 UPSTREAM: mm/damon: add access checking for hugetlb pages
6fdce9a014 UPSTREAM: mm/damon/dbgfs: support all DAMOS stats
86a0f3958c UPSTREAM: mm/damon/reclaim: provide reclamation statistics
168c5dc29f UPSTREAM: mm/damon/schemes: account how many times quota limit has exceeded
9818aed77f UPSTREAM: mm/damon/schemes: account scheme actions that successfully applied
82b9795ec7 UPSTREAM: mm/damon: convert macro functions to static inline functions
f92ba978fa UPSTREAM: mm/damon: move damon_rand() definition into damon.h
6e04c85054 UPSTREAM: mm/damon/schemes: add the validity judgment of thresholds
548424cefd UPSTREAM: mm/damon/vaddr: remove swap_ranges() and replace it with swap()
428792a841 UPSTREAM: mm/damon: remove some unneeded function definitions in damon.h
38e43af06a UPSTREAM: mm/damon/core: use abs() instead of diff_of()
cd8dce3046 UPSTREAM: mm/damon: unified access_check function naming rules
bdf02a7f4e UPSTREAM: mm/damon/vaddr-test: remove unnecessary variables
a5bd0713be UPSTREAM: mm/damon/vaddr-test: split a test function having >1024 bytes frame size
2f0229c408 UPSTREAM: mm/damon/vaddr: remove an unnecessary warning message
999d83f120 UPSTREAM: mm/damon/core: remove unnecessary error messages
49de2cb8a5 UPSTREAM: mm/damon/dbgfs: remove an unnecessary error message
e5a2bdfb0a BACKPORT: mm/damon/core: use better timer mechanisms selection threshold
d49b62ccfd BACKPORT: mm/damon/dbgfs: fix missed use of damon_dbgfs_lock
4c2134830a UPSTREAM: mm/damon: remove return value from before_terminate callback
db9b97b547 UPSTREAM: mm/damon: fix a few spelling mistakes in comments and a pr_debug message
c91a782b6f UPSTREAM: mm/damon: simplify stop mechanism
fe6bcb8dd4 UPSTREAM: mm/damon/dbgfs: add adaptive_targets list check before enable monitor_on
ae3795eb00 UPSTREAM: mm/damon: remove unnecessary variable initialization
1a5e255ce9 UPSTREAM: mm/damon: introduce DAMON-based Reclamation (DAMON_RECLAIM)
97567267f7 UPSTREAM: selftests/damon: support watermarks
ffaa746d7c UPSTREAM: mm/damon/dbgfs: support watermarks
c70ef2a367 BACKPORT: mm/damon/schemes: activate schemes based on a watermarks mechanism
defd69e678 UPSTREAM: tools/selftests/damon: update for regions prioritization of schemes
875ca13d08 UPSTREAM: mm/damon/dbgfs: support prioritization weights
4cfed5d5b1 UPSTREAM: mm/damon/vaddr,paddr: support pageout prioritization
6662408061 UPSTREAM: mm/damon/schemes: prioritize regions within the quotas
ddd1df8526 UPSTREAM: mm/damon/selftests: support schemes quotas
5f680e394a UPSTREAM: mm/damon/dbgfs: support quotas of schemes
b4aefd1c72 UPSTREAM: mm/damon/schemes: implement time quota
f80ebb9d5d UPSTREAM: mm/damon/schemes: skip already charged targets and regions
80d2863f9e UPSTREAM: mm/damon/schemes: implement size quota for schemes application speed control
41d98d4c47 UPSTREAM: mm/damon/paddr: support the pageout scheme
8d5c271cff UPSTREAM: mm/damon/dbgfs: remove unnecessary variables
8168da37a5 UPSTREAM: mm/damon/vaddr: constify static mm_walk_ops
fc0bae05e1 UPSTREAM: mm/damon/dbgfs: support physical memory monitoring
ae84fa2e25 UPSTREAM: mm/damon: implement primitives for physical address space monitoring
80990f467b UPSTREAM: mm/damon/vaddr: separate commonly usable functions
12c21e91e4 UPSTREAM: mm/damon/dbgfs-test: add a unit test case for 'init_regions'
efc9721c40 UPSTREAM: mm/damon/dbgfs: allow users to set initial monitoring target regions
70ebdef092 UPSTREAM: selftests/damon: add 'schemes' debugfs tests
a48740173e UPSTREAM: mm/damon/schemes: implement statistics feature
fd5ed35b71 UPSTREAM: mm/damon/dbgfs: support DAMON-based Operation Schemes
573fab31a5 UPSTREAM: mm/damon/vaddr: support DAMON-based Operation Schemes
b35e82062a UPSTREAM: mm/damon/core: implement DAMON-based Operation Schemes (DAMOS)
41e99990b8 UPSTREAM: mm/damon/core: account age of target regions
aaa3878862 UPSTREAM: mm/damon/core: nullify pointer ctx->kdamond with a NULL
340c92bec2 UPSTREAM: mm/damon: needn't hold kdamond_lock to print pid of kdamond
2df0d2dbd1 UPSTREAM: mm/damon: remove unnecessary do_exit() from kdamond
ec9618400e UPSTREAM: mm/damon/core: print kdamond start log in debug mode only
4680f26136 UPSTREAM: include/linux/damon.h: fix kernel-doc comments for 'damon_callback'
f840a4de99 UPSTREAM: mm/damon: grammar s/works/work/
a41c70ee0b ANDROID: vendor_hooks: add vendor hook in blk_mq_rq_ctx_init()
1c6391dd7a ANDROID: vendor_hooks: add vendor hook in blk_mq_alloc_rqs()

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iefbbab398942ad769576399accd3ffcd24e41e93
2022-06-21 15:05:01 +02:00
Kumar Kartikeya Dwivedi
ccf74d1eca UPSTREAM: selftests/bpf: Add test for reg2btf_ids out of bounds access
commit 13c6a37d409db9abc9c0bfc6d0a2f07bf0fff60e upstream.

This test tries to pass a PTR_TO_BTF_ID_OR_NULL to the release function,
which would trigger a out of bounds access without the fix in commit
45ce4b4f9009 ("bpf: Fix crash due to out of bounds access into reg2btf_ids.")
but after the fix, it should only index using base_type(reg->type),
which should be less than __BPF_REG_TYPE_MAX, and also not permit any
type flags to be set for the reg->type.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220220023138.2224652-1-memxor@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f59e6886ca)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ia75c39dc8b826f7e55c326eeb906e2dd9f353ab9
2022-06-18 18:28:45 +00:00
Hao Luo
2f53e2190d UPSTREAM: bpf/selftests: Test PTR_TO_RDONLY_MEM
commit 9497c458c10b049438ef6e6ddda898edbc3ec6a8 upstream.

This test verifies that a ksym of non-struct can not be directly
updated.

Signed-off-by: Hao Luo <haoluo@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211217003152.48334-10-haoluo@google.com
Cc: stable@vger.kernel.org # 5.15.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 379382b347)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I26242631ce9076fcb19fcb8bd387e9bdae9b8c73
2022-06-18 18:28:45 +00:00
Davide Caratti
42c0160d27 net/sched: act_police: more accurate MTU policing
commit 4ddc844eb81da59bfb816d8d52089aba4e59e269 upstream.

in current Linux, MTU policing does not take into account that packets at
the TC ingress have the L2 header pulled. Thus, the same TC police action
(with the same value of tcfp_mtu) behaves differently for ingress/egress.
In addition, the full GSO size is compared to tcfp_mtu: as a consequence,
the policer drops GSO packets even when individual segments have the L2 +
L3 + L4 + payload length below the configured valued of tcfp_mtu.

Improve the accuracy of MTU policing as follows:
 - account for mac_len for non-GSO packets at TC ingress.
 - compare MTU threshold with the segmented size for GSO packets.
Also, add a kselftest that verifies the correct behavior.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-14 18:36:28 +02:00
Florian Westphal
bf65364cd7 netfilter: nat: really support inet nat without l3 address
[ Upstream commit 282e5f8fe907dc3f2fbf9f2103b0e62ffc3a68a5 ]

When no l3 address is given, priv->family is set to NFPROTO_INET and
the evaluation function isn't called.

Call it too so l4-only rewrite can work.
Also add a test case for this.

Fixes: a33f387ecd ("netfilter: nft_nat: allow to specify layer 4 protocol NAT only")
Reported-by: Yi Chen <yiche@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-14 18:36:16 +02:00
Song Liu
d03edc02a7 selftests/bpf: fix stacktrace_build_id with missing kprobe/urandom_read
[ Upstream commit 59ed76fe2f981bccde37bdddb465f260a96a2404 ]

Kernel function urandom_read is replaced with urandom_read_iter.
Therefore, kprobe on urandom_read is not working any more:

[root@eth50-1 bpf]# ./test_progs -n 161
test_stacktrace_build_id:PASS:skel_open_and_load 0 nsec
libbpf: kprobe perf_event_open() failed: No such file or directory
libbpf: prog 'oncpu': failed to create kprobe 'urandom_read+0x0' \
        perf event: No such file or directory
libbpf: prog 'oncpu': failed to auto-attach: -2
test_stacktrace_build_id:FAIL:attach_tp err -2
161     stacktrace_build_id:FAIL

Fix this by replacing urandom_read with urandom_read_iter in the test.

Fixes: 1b388e7765f2 ("random: convert to using fops->read_iter()")
Reported-by: Mykola Lysenko <mykolal@fb.com>
Signed-off-by: Song Liu <song@kernel.org>
Acked-by: David Vernet <void@manifault.com>
Link: https://lore.kernel.org/r/20220526191608.2364049-1-song@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-14 18:36:11 +02:00
Andrii Nakryiko
8969c3b105 selftests/bpf: fix selftest after random: Urandom_read tracepoint removal
[ Upstream commit 99dea2c664d7bc7e4f6f6947182d0d365165a998 ]

14c174633f34 ("random: remove unused tracepoints") removed all the
tracepoints from drivers/char/random.c, one of which,
random:urandom_read, was used by stacktrace_build_id selftest to trigger
stack trace capture.

Fix breakage by switching to kprobing urandom_read() function.

Suggested-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20220325225643.2606-1-andrii@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-14 18:36:10 +02:00
Waiman Long
85a2806c40 kseltest/cgroup: Make test_stress.sh work if run interactively
commit 213adc63dfbcdff9a0c19ec1f2681fda9c05cf6d upstream.

Commit 54de76c01239 ("kselftest/cgroup: fix test_stress.sh to use OUTPUT
dir") changes the test_core command path from . to $OUTPUT. However,
variable OUTPUT may not be defined if the command is run interactively.
Fix that by using ${OUTPUT:-.} to cover both cases.

Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:30 +02:00
Mickaël Salaün
f55f9e7ce6 landlock: Fix same-layer rule unions
commit 8ba0005ff418ec356e176b26eaa04a6ac755d05b upstream.

The original behavior was to check if the full set of requested accesses
was allowed by at least a rule of every relevant layer.  This didn't
take into account requests for multiple accesses and same-layer rules
allowing the union of these accesses in a complementary way.  As a
result, multiple accesses requested on a file hierarchy matching rules
that, together, allowed these accesses, but without a unique rule
allowing all of them, was illegitimately denied.  This case should be
rare in practice and it can only be triggered by the path_rename or
file_open hook implementations.

For instance, if, for the same layer, a rule allows execution
beneath /a/b and another rule allows read beneath /a, requesting access
to read and execute at the same time for /a/b should be allowed for this
layer.

This was an inconsistency because the union of same-layer rule accesses
was already allowed if requested once at a time anyway.

This fix changes the way allowed accesses are gathered over a path walk.
To take into account all these rule accesses, we store in a matrix all
layer granting the set of requested accesses, according to the handled
accesses.  To avoid heap allocation, we use an array on the stack which
is 2*13 bytes.  A following commit bringing the LANDLOCK_ACCESS_FS_REFER
access right will increase this size to reach 112 bytes (2*14*4) in case
of link or rename actions.

Add a new layout1.layer_rule_unions test to check that accesses from
different rules pertaining to the same layer are ORed in a file
hierarchy.  Also test that it is not the case for rules from different
layers.

Reviewed-by: Paul Moore <paul@paul-moore.com>
Link: https://lore.kernel.org/r/20220506161102.525323-5-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:24 +02:00
Mickaël Salaün
f7d62cb59f landlock: Reduce the maximum number of layers to 16
commit 75c542d6c6cc48720376862d5496d51509160dfd upstream.

The maximum number of nested Landlock domains is currently 64.  Because
of the following fix and to help reduce the stack size, let's reduce it
to 16.  This seems large enough for a lot of use cases (e.g. sandboxed
init service, spawning a sandboxed SSH service, in nested sandboxed
containers).  Reducing the number of nested domains may also help to
discover misuse of Landlock (e.g. creating a domain per rule).

Add and use a dedicated layer_mask_t typedef to fit with the number of
layers.  This might be useful when changing it and to keep it consistent
with the maximum number of layers.

Reviewed-by: Paul Moore <paul@paul-moore.com>
Link: https://lore.kernel.org/r/20220506161102.525323-3-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:24 +02:00
Mickaël Salaün
90136f20a3 selftests/landlock: Test landlock_create_ruleset(2) argument check ordering
commit 6533d0c3a86ee1cc74ff37ac92ca597deb87015c upstream.

Add inval_create_ruleset_arguments, extension of
inval_create_ruleset_flags, to also check error ordering for
landlock_create_ruleset(2).

This is similar to the previous commit checking landlock_add_rule(2).

Test coverage for security/landlock is 94.4% of 504 lines accorging to
gcc/gcov-11.

Link: https://lore.kernel.org/r/20220506160820.524344-11-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:24 +02:00
Mickaël Salaün
c1d9c0d0c7 landlock: Change landlock_restrict_self(2) check ordering
commit eba39ca4b155c54adf471a69e91799cc1727873f upstream.

According to the Landlock goal to be a security feature available to
unprivileges processes, it makes more sense to first check for
no_new_privs before checking anything else (i.e. syscall arguments).

Merge inval_fd_enforce and unpriv_enforce_without_no_new_privs tests
into the new restrict_self_checks_ordering.  This is similar to the
previous commit checking other syscalls.

Link: https://lore.kernel.org/r/20220506160820.524344-10-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:24 +02:00
Mickaël Salaün
1707df9eda landlock: Change landlock_add_rule(2) argument check ordering
commit 589172e5636c4d16c40b90e87543d43defe2d968 upstream.

This makes more sense to first check the ruleset FD and then the rule
attribute.  It will be useful to factor out code for other rule types.

Add inval_add_rule_arguments tests, extension of empty_path_beneath_attr
tests, to also check error ordering for landlock_add_rule(2).

Link: https://lore.kernel.org/r/20220506160820.524344-9-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:23 +02:00
Mickaël Salaün
bb416965db selftests/landlock: Add tests for O_PATH
commit d1788ad990874734341b05ab8ccb6448c09c6422 upstream.

The O_PATH flag is currently not handled by Landlock.  Let's make sure
this behavior will remain consistent with the same ruleset over time.

Cc: Shuah Khan <shuah@kernel.org>
Link: https://lore.kernel.org/r/20220506160820.524344-8-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:23 +02:00
Mickaël Salaün
e3e10606ba selftests/landlock: Fully test file rename with "remove" access
commit 6a1bdd4a0bfc30fa4fa2b3a979e6525f28996db9 upstream.

These tests were missing to check the check_access_path() call with all
combinations of maybe_remove(old_dentry) and maybe_remove(new_dentry).

Extend layout1.link with a new complementary test and check that
REMOVE_FILE is not required to link a file.

Cc: Shuah Khan <shuah@kernel.org>
Link: https://lore.kernel.org/r/20220506160820.524344-7-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:23 +02:00
Mickaël Salaün
df2af378bc selftests/landlock: Extend access right tests to directories
commit d18955d094d09a220cf8f533f5e896a2fe31575a upstream.

Make sure that all filesystem access rights can be tied to directories.

Rename layout1.file_access_rights to layout1.file_and_dir_access_rights
to reflect this change.

Cc: Shuah Khan <shuah@kernel.org>
Link: https://lore.kernel.org/r/20220506160820.524344-6-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:23 +02:00
Mickaël Salaün
1d6722353b selftests/landlock: Add tests for unknown access rights
commit c56b3bf566da5a0dd3b58ad97a614b0928b06ebf upstream.

Make sure that trying to use unknown access rights returns an error.

Cc: Shuah Khan <shuah@kernel.org>
Link: https://lore.kernel.org/r/20220506160820.524344-5-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:23 +02:00
Mickaël Salaün
d709e275a0 selftests/landlock: Extend tests for minimal valid attribute size
commit 291865bd7e8bb4b4033d341fa02dafa728e6378c upstream.

This might be useful when the struct landlock_ruleset_attr will get more
fields.

Cc: Shuah Khan <shuah@kernel.org>
Link: https://lore.kernel.org/r/20220506160820.524344-4-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:23 +02:00
Mickaël Salaün
a6d127b869 selftests/landlock: Make tests build with old libc
commit 87129ef13603ae46c82bcd09eed948acf0506dbb upstream.

Replace SYS_<syscall> with __NR_<syscall>.  Using the __NR_<syscall>
notation, provided by UAPI, is useful to build tests on systems without
the SYS_<syscall> definitions.

Replace SYS_pivot_root with __NR_pivot_root, and SYS_move_mount with
__NR_move_mount.

Define renameat2() and RENAME_EXCHANGE if they are unknown to old build
systems.

Cc: Shuah Khan <shuah@kernel.org>
Link: https://lore.kernel.org/r/20220506160820.524344-3-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:23 +02:00
Mickaël Salaün
de7a39e845 selftests/landlock: Format with clang-format
commit 371183fa578a4cf56b3ae12e54b7f01a4249add1 upstream.

Let's follow a consistent and documented coding style.  Everything may
not be to our liking but it is better than tacit knowledge.  Moreover,
this will help maintain style consistency between different developers.

This contains only whitespace changes.

Automatically formatted with:
clang-format-14 -i tools/testing/selftests/landlock/*.[ch]

Link: https://lore.kernel.org/r/20220506160513.523257-6-mic@digikod.net
Cc: stable@vger.kernel.org
[mic: Update style according to
https://lore.kernel.org/r/02494cb8-2aa5-1769-f28d-d7206f284e5a@digikod.net]
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:22 +02:00
Mickaël Salaün
43c3014c6f selftests/landlock: Normalize array assignment
commit 135464f9d29c5b306d7201220f1d00dab30fea89 upstream.

Add a comma after each array value to make clang-format keep the
current array formatting.  See the following commit.

Automatically modified with:
sed -i 's/\t\({}\|NULL\)$/\0,/' tools/testing/selftests/landlock/fs_test.c

Link: https://lore.kernel.org/r/20220506160513.523257-5-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:23:22 +02:00