On 2024-12-16 10:21, Christoph Schlameuss wrote:
> Prevent null pointer dereference when processing the
> KVM_DEV_FLIC_APF_ENABLE and KVM_DEV_FLIC_APF_DISABLE_WAIT ioctls in the
> interrupt controller.
>
> Fixes: 3c038e6be0e2 ("KVM: async_pf: Async page fault support on s390")
> Reported-by: Claudio Imbrenda <imbrenda(a)linux.ibm.com>
> Signed-off-by: Christoph Schlameuss <schlameuss(a)linux.ibm.com>
Tested-by: Hariharan Mari <hari55(a)linux.ibm.com>
> ---
> Documentation/virt/kvm/devices/s390_flic.rst | 4 ++++
> arch/s390/kvm/interrupt.c | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/Documentation/virt/kvm/devices/s390_flic.rst
> b/Documentation/virt/kvm/devices/s390_flic.rst
> index ea96559ba501..b784f8016748 100644
> --- a/Documentation/virt/kvm/devices/s390_flic.rst
> +++ b/Documentation/virt/kvm/devices/s390_flic.rst
> @@ -58,11 +58,15 @@ Groups:
> Enables async page faults for the guest. So in case of a major
> page fault
> the host is allowed to handle this async and continues the guest.
>
> + -EINVAL is returned when called on the FLIC of a ucontrol VM.
> +
> KVM_DEV_FLIC_APF_DISABLE_WAIT
> Disables async page faults for the guest and waits until already
> pending
> async page faults are done. This is necessary to trigger a
> completion interrupt
> for every init interrupt before migrating the interrupt list.
>
> + -EINVAL is returned when called on the FLIC of a ucontrol VM.
> +
> KVM_DEV_FLIC_ADAPTER_REGISTER
> Register an I/O adapter interrupt source. Takes a
> kvm_s390_io_adapter
> describing the adapter to register::
> diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
> index ea8dce299954..22d73c13e555 100644
> --- a/arch/s390/kvm/interrupt.c
> +++ b/arch/s390/kvm/interrupt.c
> @@ -2678,9 +2678,13 @@ static int flic_set_attr(struct kvm_device
> *dev, struct kvm_device_attr *attr)
> kvm_s390_clear_float_irqs(dev->kvm);
> break;
> case KVM_DEV_FLIC_APF_ENABLE:
> + if (kvm_is_ucontrol(dev->kvm))
> + return -EINVAL;
> dev->kvm->arch.gmap->pfault_enabled = 1;
> break;
> case KVM_DEV_FLIC_APF_DISABLE_WAIT:
> + if (kvm_is_ucontrol(dev->kvm))
> + return -EINVAL;
> dev->kvm->arch.gmap->pfault_enabled = 0;
> /*
> * Make sure no async faults are in transition when
Introduce a new helper function, `sk_set_prio_allowed`,
to centralize the logic for validating priority settings.
Add support for the `SO_PRIORITY` control message,
enabling user-space applications to set socket priority
via control messages (cmsg).
Patch Overview:
Patch 1/4: Introduce 'sk_set_prio_allowed' helper function.
Patch 2/4: Add support for setting SO_PRIORITY via control messages
Patch 3/4: Add test for SO_PRIORITY setting via control messages
Patch 4/4: Add new socket option, SO_RCVPRIORITY
v7:
- Carry Eric's and Willem's "Reviewed-by" tags from v3 to
patch 1/4 since that is resubmitted without changes.
- Carry Willem's "Reviewed-by" tag from v4 in patch 2/4,
as it is resubmitted without changes.
- Carry Willem's "Reviewed-by" tag from v5 in patch 4/4,
as it is resubmitted without changes.
- Carry Willem's "Reviewed-by" tag from v6
since it is resubmitted with minor cosmetic changes in
patch 3/4.
- Carry Willem's "Acked-by" tag from v5 on FILTER_COUNTER
(patch 3/4).
- Carry Ido's "Reviewed-by" and "Tested-by" tags from v6
since it is resubmitted with minor cosmetic changes in
patch 3/4.
- Align the code to the open parenthesis in cmsg_sender.c
(patch 3/4).
- Remove unnecessary blank line in cmsg_so_priority.sh
(patch 3/4).
- Remove unused delay variable from cmsg_so_priority.sh
(patch 3/4).
- Rebased on net-next.
v6:
https://lore.kernel.org/netdev/20241210191309.8681-1-annaemesenyiri@gmail.c…
- Carry Eric's and Willem's "Reviewed-by" tags from v3 to
patch 1/4 since that is resubmitted without changes.
- Carry Willem's "Reviewed-by" tag from v4 in patch 2/4,
as it is resubmitted without changes.
- Carry Willem's "Reviewed-by" tag from v5 in patch 4/4,
as it is resubmitted without changes.
- Use KSFT_SKIP in jq installation test and
add 'nodad' flag for IPv6 address in cmsg_so_priority.sh (patch 3/4).
- Rebased on net-next.
v5:
https://lore.kernel.org/netdev/20241205133112.17903-1-annaemesenyiri@gmail.…
- Carry Eric's and Willem's "Reviewed-by" tags from v3 to
patch 1/4 since that is resubmitted without changes.
- Carry Willem's "Reviewed-by" tag from v4 in patch 2/4,
as it is resubmitted without changes.
- Eliminate variable duplication, fix indentation, simplify cleanup,
verify dependencies, separate setsockopt and control message
priority testing, and modify namespace setup
in patch 3/4 cmsg_so_priority.sh.
- Add cmsg_so_priority.sh to tools/testing/selftests/net/Makefile.
- Remove the unused variable, rename priority_cmsg to priority,
and document the -P option in cmsg_sender.c in patch 3/4.
- New in v5: add new socket option, SO_RCVPRIORITY in patch 4/4.
- Rebased on net-next.
v4:
https://lore.kernel.org/netdev/20241118145147.56236-1-annaemesenyiri@gmail.…
- Carry Eric's and Willem's "Reviewed-by" tags from v3 to
patch 1/3 since that is resubmitted without changes.
- Updated description in patch 2/3.
- Missing ipc6.sockc.priority field added in ping_v6_sendmsg()
in patch 2/3.
- Update cmsg_so_priority.sh to test SO_PRIORITY sockopt and cmsg
setting with VLAN priority tagging in patch 3/3. (Ido Schimmel)
- Rebased on net-next.
v3:
https://lore.kernel.org/netdev/20241107132231.9271-1-annaemesenyiri@gmail.c…
- Updated cover letter text.
- Removed priority field from ipcm_cookie.
- Removed cork->tos value check from ip_setup_cork, so
cork->priority will now take its value from ipc->sockc.priority.
- Replaced ipc->priority with ipc->sockc.priority
in ip_cmsg_send().
- Modified the error handling for the SO_PRIORITY
case in __sock_cmsg_send().
- Added missing initialization for ipc6.sockc.priority.
- Introduced cmsg_so_priority.sh test script.
- Modified cmsg_sender.c to set priority via control message (cmsg).
- Rebased on net-next.
v2:
https://lore.kernel.org/netdev/20241102125136.5030-1-annaemesenyiri@gmail.c…
- Introduced sk_set_prio_allowed helper to check capability
for setting priority.
- Removed new fields and changed sockcm_cookie::priority
from char to u32 to align with sk_buff::priority.
- Moved the cork->tos value check for priority setting
from __ip_make_skb() to ip_setup_cork().
- Rebased on net-next.
v1:
https://lore.kernel.org/all/20241029144142.31382-1-annaemesenyiri@gmail.com/
Anna Emese Nyiri (4):
Introduce sk_set_prio_allowed helper function
support SO_PRIORITY cmsg
test SO_PRIORITY ancillary data with cmsg_sender
introduce SO_RCVPRIORITY socket option
arch/alpha/include/uapi/asm/socket.h | 2 +
arch/mips/include/uapi/asm/socket.h | 2 +
arch/parisc/include/uapi/asm/socket.h | 2 +
arch/sparc/include/uapi/asm/socket.h | 2 +
include/net/inet_sock.h | 2 +-
include/net/ip.h | 2 +-
include/net/sock.h | 8 +-
include/uapi/asm-generic/socket.h | 2 +
net/can/raw.c | 2 +-
net/core/sock.c | 26 ++-
net/ipv4/ip_output.c | 4 +-
net/ipv4/ip_sockglue.c | 2 +-
net/ipv4/raw.c | 2 +-
net/ipv6/ip6_output.c | 3 +-
net/ipv6/ping.c | 1 +
net/ipv6/raw.c | 3 +-
net/ipv6/udp.c | 1 +
net/packet/af_packet.c | 2 +-
net/socket.c | 11 ++
tools/include/uapi/asm-generic/socket.h | 2 +
tools/testing/selftests/net/Makefile | 1 +
tools/testing/selftests/net/cmsg_sender.c | 11 +-
.../testing/selftests/net/cmsg_so_priority.sh | 151 ++++++++++++++++++
23 files changed, 228 insertions(+), 16 deletions(-)
create mode 100755 tools/testing/selftests/net/cmsg_so_priority.sh
--
2.43.0
It's useful to build samples/* with UML and the only blocker is the
artificial incompatibility with CONFIG_HEADERS_INSTALL.
Allow the headers_install target with ARCH=um, which then allow building
samples (and tests using them) with UML too:
printf 'CONFIG_SAMPLES=y\nCONFIG_HEADERS_INSTALL=y\nCONFIG_SAMPLE_LANDLOCK=y\n' >.config
make ARCH=um olddefconfig headers_install
make ARCH=um samples/landlock/
Cc: Anton Ivanov <anton.ivanov(a)cambridgegreys.com>
Cc: Johannes Berg <johannes(a)sipsolutions.net>
Cc: Masahiro Yamada <masahiroy(a)kernel.org>
Cc: Nathan Chancellor <nathan(a)kernel.org>
Cc: Nicolas Schier <nicolas(a)fjasle.eu>
Cc: Richard Weinberger <richard(a)nod.at>
Fixes: 1b620d539ccc ("kbuild: disable header exports for UML in a straightforward way")
Signed-off-by: Mickaël Salaün <mic(a)digikod.net>
---
Makefile | 1 -
lib/Kconfig.debug | 1 -
2 files changed, 2 deletions(-)
diff --git a/Makefile b/Makefile
index e5b8a8832c0c..6e2cce16a2a3 100644
--- a/Makefile
+++ b/Makefile
@@ -1355,7 +1355,6 @@ hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
PHONY += headers
headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts
- $(if $(filter um, $(SRCARCH)), $(error Headers not exportable for UML))
$(Q)$(MAKE) $(hdr-inst)=include/uapi
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index f3d723705879..fac1208f48e4 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -473,7 +473,6 @@ config READABLE_ASM
config HEADERS_INSTALL
bool "Install uapi headers to usr/include"
- depends on !UML
help
This option will install uapi headers (headers exported to user-space)
into the usr/include directory for use during the kernel build.
--
2.47.1
Currently, when we run the BPF selftests with the following command:
'make -C tools/testing/selftests TARGETS=bpf SKIP_TARGETS=""'
The command generates untracked files and directories:
'''
Untracked files:
(use "git add <file>..." to include in what will be committed)
tools/testing/selftests/bpfFEATURE-DUMP.selftests
tools/testing/selftests/bpffeature/
'''
The core reason is our Makefile(tools/testing/selftests/bpf/Makefile)
was written like this:
'''
OUTPUT := $(OUTPUT)/
$(eval include ../../../build/Makefile.feature)
OUTPUT := $(patsubst %/,%,$(OUTPUT))
'''
This way of assigning values to OUTPUT will never be effective for the
variable OUTPUT provided via the command argument and sub makefile called
like this(tools/testing/selftests/Makefile):
'''
all:
...
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET
'''
As stated in the GNU make documentation:
'''
An argument that contains '=' specifies the value of a variable: 'v=x'
sets the value of the variable v to x. If you specify a value in this way,
all ordinary assignments of the same variable in the makefile are ignored;
we say they have been overridden by the command line argument.
'''
According to GNU make, we use override Directive to fix this issue:
'''
If you want to set the variable in the makefile even though it was set
with a command argument, you can use an override directive, which is a
line that looks like this:
override variable := value
Link: https://www.gnu.org/software/make/manual/make.html#Override-Directive
Fixes: dc3a8804d790 ("selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make")
Signed-off-by: Jiayuan Chen <mrpre(a)163.com>
---
tools/testing/selftests/bpf/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 9e870e519c30..eb4d21651aa7 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -202,9 +202,9 @@ ifeq ($(shell expr $(MAKE_VERSION) \>= 4.4), 1)
$(let OUTPUT,$(OUTPUT)/,\
$(eval include ../../../build/Makefile.feature))
else
-OUTPUT := $(OUTPUT)/
+override OUTPUT := $(OUTPUT)/
$(eval include ../../../build/Makefile.feature)
-OUTPUT := $(patsubst %/,%,$(OUTPUT))
+override OUTPUT := $(patsubst %/,%,$(OUTPUT))
endif
endif
base-commit: a7c205120d339b6ad2557fe3f33fdf20394f1a0f
--
2.43.5
In commit 03c7527e97f7 ("KVM: arm64: Do not allow ID_AA64MMFR0_EL1.ASIDbits
to be overridden") we made that bitfield in the ID registers unwritable
however the change neglected to make the corresponding update to set_id_regs
resulting in it failing:
# ok 56 ID_AA64MMFR0_EL1_BIGEND
# ==== Test Assertion Failure ====
# aarch64/set_id_regs.c:434: masks[idx] & ftr_bits[j].mask == ftr_bits[j].mask
# pid=5566 tid=5566 errno=22 - Invalid argument
# 1 0x00000000004034a7: test_vm_ftr_id_regs at set_id_regs.c:434
# 2 0x0000000000401b53: main at set_id_regs.c:684
# 3 0x0000ffff8e6b7543: ?? ??:0
# 4 0x0000ffff8e6b7617: ?? ??:0
# 5 0x0000000000401e6f: _start at ??:?
# 0 != 0xf0 (masks[idx] & ftr_bits[j].mask != ftr_bits[j].mask)
not ok 8 selftests: kvm: set_id_regs # exit=254
Remove ID_AA64MMFR1_EL1.ASIDBITS from the set of bitfields we test for
writeability.
Fixes: 03c7527e97f7 ("KVM: arm64: Do not allow ID_AA64MMFR0_EL1.ASIDbits to be overridden")
Signed-off-by: Mark Brown <broonie(a)kernel.org>
---
tools/testing/selftests/kvm/aarch64/set_id_regs.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/aarch64/set_id_regs.c b/tools/testing/selftests/kvm/aarch64/set_id_regs.c
index a79b7f18452d2ec336ae623b8aa5c9cf329b6b4e..3a97c160b5fec990aaf8dfaf100a907b913f057c 100644
--- a/tools/testing/selftests/kvm/aarch64/set_id_regs.c
+++ b/tools/testing/selftests/kvm/aarch64/set_id_regs.c
@@ -152,7 +152,6 @@ static const struct reg_ftr_bits ftr_id_aa64mmfr0_el1[] = {
REG_FTR_BITS(FTR_LOWER_SAFE, ID_AA64MMFR0_EL1, BIGENDEL0, 0),
REG_FTR_BITS(FTR_LOWER_SAFE, ID_AA64MMFR0_EL1, SNSMEM, 0),
REG_FTR_BITS(FTR_LOWER_SAFE, ID_AA64MMFR0_EL1, BIGEND, 0),
- REG_FTR_BITS(FTR_LOWER_SAFE, ID_AA64MMFR0_EL1, ASIDBITS, 0),
REG_FTR_BITS(FTR_LOWER_SAFE, ID_AA64MMFR0_EL1, PARANGE, 0),
REG_FTR_END,
};
---
base-commit: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8
change-id: 20241216-kvm-arm64-fix-set-id-asidbits-9bede25b7ad3
Best regards,
--
Mark Brown <broonie(a)kernel.org>
Hi All,
This patch-set aims to improve precision of BPF_MUL and add testcases
to illustrate precision gains using signed and unsigned bounds.
Thanks for taking the time to review and specifically for Eduard's feedback!
Best,
Matan
Changes from v1:
- Fixed typo made in patch
Changes from v2:
- Added signed multiplication to BPF_MUL
- Added test cases to exercise BPF_MUL
- Reordered patches in the series.
Matan Shachnai (2):
bpf, verifier: Improve precision of BPF_MUL
selftests/bpf: Add testcases for BPF_MUL
kernel/bpf/verifier.c | 72 +++++-----
.../selftests/bpf/progs/verifier_bounds.c | 134 ++++++++++++++++++
2 files changed, 166 insertions(+), 40 deletions(-)
--
2.25.1
If the selftest is not running as root, it should skip not
fail and give an appropriate warning to the user. This patch adds
ksft_exit_skip() if the test is not running as root.
Logs:
Before change:
TAP version 13
1..1
ok 1 # SKIP This test needs root to run!
After change:
TAP version 13
1..1
ok 2 # SKIP This test needs root to run!
Totals: pass:0 fail:0 xfail:0 xpass:0 skip:1 error:0
Signed-off-by: Shivam Chaudhary <cvam0000(a)gmail.com>
---
v1->v2 : Replace ksft_exit_fail_msg -> ksft_exit_skip
v1 : https://lore.kernel.org/all/20241115191721.621381-1-cvam0000@gmail.com/
tools/testing/selftests/acct/acct_syscall.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/acct/acct_syscall.c b/tools/testing/selftests/acct/acct_syscall.c
index e44e8fe1f4a3..87c044fb9293 100644
--- a/tools/testing/selftests/acct/acct_syscall.c
+++ b/tools/testing/selftests/acct/acct_syscall.c
@@ -24,7 +24,7 @@ int main(void)
// Check if test is run a root
if (geteuid()) {
- ksft_test_result_skip("This test needs root to run!\n");
+ ksft_exit_skip("This test needs root to run!\n");
return 1;
}
--
2.34.1