Re: [PATCH net] selftests: bonding: add missing build configs

2024-01-15 Thread Muhammad Usama Anjum
On 1/16/24 7:02 AM, Jakub Kicinski wrote: > bonding tests also try to create bridge, veth and dummy > interfaces. These are not currently listed in config. > > Fixes: bbb774d921e2 ("net: Add tests for bonding and team address list > management") > Fixes: c078290a2b76 ("selftests: include bonding

[PATCH v3 5/5] KVM: selftests: aarch64: Add invalid filter test in pmu_event_filter_test

2024-01-15 Thread Shaoqin Huang
Add the invalid filter test includes sets the filter beyond the event space and sets the invalid action to double check if the KVM_ARM_VCPU_PMU_V3_FILTER will return the expected error. Signed-off-by: Shaoqin Huang --- .../kvm/aarch64/pmu_event_filter_test.c | 36 +++ 1 fil

[PATCH v3 3/5] KVM: selftests: aarch64: Fix the buggy [enable|disable]_counter

2024-01-15 Thread Shaoqin Huang
In general, the set/clr registers should always be used in their write form, never in a RMW form (imagine an interrupt disabling a counter between the read and the write...). The current implementation of [enable|disable]_counter both use the RMW form, fix them by directly write to the set/clr reg

[PATCH v3 4/5] KVM: selftests: aarch64: Introduce pmu_event_filter_test

2024-01-15 Thread Shaoqin Huang
Introduce pmu_event_filter_test for arm64 platforms. The test configures PMUv3 for a vCPU, and sets different pmu event filters for the vCPU, and check if the guest can see those events which user allow and can't use those events which use deny. This test refactor the create_vpmu_vm() and make it

[PATCH v3 1/5] KVM: selftests: aarch64: Make the [create|destroy]_vpmu_vm() public

2024-01-15 Thread Shaoqin Huang
Move the implementation of [create|destroy]_vpmu_vm() into lib/aarch64/pmu.c and export their declaration in a header so they can be reused by other tests. The sync exception handler install is test specific so we move it out of the helper function. No functional change intended. Reviewed-by: Er

[PATCH v3 2/5] KVM: selftests: aarch64: Move pmu helper functions into vpmu.h

2024-01-15 Thread Shaoqin Huang
Move those pmu helper functions into include/aarch64/vpmu.h, thus it can be used by other pmu test. No functional change intended. Reviewed-by: Eric Auger Signed-off-by: Shaoqin Huang --- .../kvm/aarch64/vpmu_counter_access.c | 118 - .../selftests/kvm/include/aarch64/v

[PATCH v3 0/5] KVM: selftests: aarch64: Introduce pmu_event_filter_test

2024-01-15 Thread Shaoqin Huang
The test is inspired by the pmu_event_filter_test which implemented by x86. On the arm64 platform, there is the same ability to set the pmu_event_filter through the KVM_ARM_VCPU_PMU_V3_FILTER attribute. So add the test for arm64. The series first move some pmu common code from vpmu_counter_access

Re: [PATCH 6/6] of: Add KUnit test to confirm DTB is loaded

2024-01-15 Thread David Gow
On Sat, 13 Jan 2024 at 04:07, Stephen Boyd wrote: > > Add a KUnit test that confirms a DTB has been loaded, i.e. there is a > root node, and that the of_have_populated_dt() API works properly. > > Cc: Rob Herring > Cc: Frank Rowand > Cc: David Gow > Cc: Brendan Higgins > Signed-off-by: Stephen

回复: [PATCH] selftests/filesystems:fix build error in overlayfs

2024-01-15 Thread Huyadi
>On Fri, Jan 12, 2024 at 03:40:59PM +0800, Hu Yadi wrote: >> One build issue comes up due to both mount.h included dev_in_maps.c >> >> In file included from dev_in_maps.c:10: >> /usr/include/sys/mount.h:35:3: error: expected identifier before numeric >> constant >>35 | MS_RDONLY = 1, /*

RE: [PATCH v11 0/8] Add iommufd nesting (part 2/2)

2024-01-15 Thread Duan, Zhenzhong
>-Original Message- >From: Liu, Yi L >Subject: [PATCH v11 0/8] Add iommufd nesting (part 2/2) > >Nested translation is a hardware feature that is supported by many modern >IOMMU hardwares. It has two stages (stage-1, stage-2) address translation >to get access to the physical address. s

[PATCH net] selftests: bonding: add missing build configs

2024-01-15 Thread Jakub Kicinski
bonding tests also try to create bridge, veth and dummy interfaces. These are not currently listed in config. Fixes: bbb774d921e2 ("net: Add tests for bonding and team address list management") Fixes: c078290a2b76 ("selftests: include bonding tests into the kselftest infra") Signed-off-by: Jakub

RE: [PATCH 3/8] iommufd: Support attach/replace hwpt per pasid

2024-01-15 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Tuesday, January 16, 2024 1:25 AM > > On Sun, Nov 26, 2023 at 10:34:23PM -0800, Yi Liu wrote: > > +/** > > + * iommufd_device_pasid_detach - Disconnect a {device, pasid} to an > iommu_domain > > + * @idev: device to detach > > + * @pasid: pasid to detach > > + * >

[PATCH AUTOSEL 6.6 11/14] kunit: tool: fix parsing of test attributes

2024-01-15 Thread Sasha Levin
From: Rae Moar [ Upstream commit 8ae27bc7fff4ef467a7964821a6cedb34a05d3b2 ] Add parsing of attributes as diagnostic data. Fixes issue with test plan being parsed incorrectly as diagnostic data when located after suite-level attributes. Note that if there does not exist a test plan line, the dia

[PATCH AUTOSEL 6.6 09/14] selftests/nolibc: fix testcase status alignment

2024-01-15 Thread Sasha Levin
From: Thomas Weißschuh [ Upstream commit 07f679b50252dc9e3d0c19aca5801f82c230c527 ] Center-align all possible status reports. Before OK and FAIL were center-aligned in relation to each other but SKIPPED and FAILED would be left-aligned. Before: 7 environ_addr = <0x7fffef3e7c50>

[PATCH AUTOSEL 6.6 08/14] selftests/nolibc: use EFI -bios for LoongArch qemu

2024-01-15 Thread Sasha Levin
From: Thomas Weißschuh [ Upstream commit bdeeeaba83682225a7bf5f100fe8652a59590d33 ] qemu for LoongArch does not work properly with direct kernel boot. The kernel will panic during initialization and hang without any output. When booting in EFI mode everything work correctly. While users most l

[PATCH AUTOSEL 6.7 13/18] kunit: Reset test->priv after each param iteration

2024-01-15 Thread Sasha Levin
From: Michal Wajdeczko [ Upstream commit 342fb9789267ee3908959bfa136b82e88e2ce918 ] If we run parameterized test that uses test->priv to prepare some custom data, then value of test->priv will leak to the next param iteration and may be unexpected. This could be easily seen if we promote exampl

[PATCH AUTOSEL 6.7 12/18] kunit: tool: fix parsing of test attributes

2024-01-15 Thread Sasha Levin
From: Rae Moar [ Upstream commit 8ae27bc7fff4ef467a7964821a6cedb34a05d3b2 ] Add parsing of attributes as diagnostic data. Fixes issue with test plan being parsed incorrectly as diagnostic data when located after suite-level attributes. Note that if there does not exist a test plan line, the dia

[PATCH AUTOSEL 6.7 10/18] selftests/nolibc: fix testcase status alignment

2024-01-15 Thread Sasha Levin
From: Thomas Weißschuh [ Upstream commit 07f679b50252dc9e3d0c19aca5801f82c230c527 ] Center-align all possible status reports. Before OK and FAIL were center-aligned in relation to each other but SKIPPED and FAILED would be left-aligned. Before: 7 environ_addr = <0x7fffef3e7c50>

[PATCH AUTOSEL 6.7 09/18] selftests/nolibc: use EFI -bios for LoongArch qemu

2024-01-15 Thread Sasha Levin
From: Thomas Weißschuh [ Upstream commit bdeeeaba83682225a7bf5f100fe8652a59590d33 ] qemu for LoongArch does not work properly with direct kernel boot. The kernel will panic during initialization and hang without any output. When booting in EFI mode everything work correctly. While users most l

RE: [PATCH 12/12] selftests/net: Add TCP-AO key-management test

2024-01-15 Thread Nassiri, Mohammad
>> Shouldn't it be reversed instead? >> verify_counters(tst_name, false, true, begin, &end); The sk is an >> accept socket and the function is called by the server. > >Good catch! >Do you want to send a patch? :-) Yes, I would be glad to send the fix. :-) Thanks Mohammad

Re: [PATCH 4/6] of: Create of_root if no dtb provided by firmware

2024-01-15 Thread Rob Herring
On Fri, Jan 12, 2024 at 12:07:47PM -0800, Stephen Boyd wrote: > From: Frank Rowand > > When enabling CONFIG_OF on a platform where 'of_root' is not populated > by firmware, we end up without a root node. In order to apply overlays > and create subnodes of the root node, we need one. Create this r

Re: [PATCH v14] exec: Fix dead-lock in de_thread with ptrace_attach

2024-01-15 Thread Matthew Wilcox
On Mon, Jan 15, 2024 at 08:22:19PM +0100, Bernd Edlinger wrote: > This introduces signal->exec_bprm, which is used to > fix the case when at least one of the sibling threads > is traced, and therefore the trace process may dead-lock > in ptrace_attach, but de_thread will need to wait for the > trac

[PATCH v14] exec: Fix dead-lock in de_thread with ptrace_attach

2024-01-15 Thread Bernd Edlinger
This introduces signal->exec_bprm, which is used to fix the case when at least one of the sibling threads is traced, and therefore the trace process may dead-lock in ptrace_attach, but de_thread will need to wait for the tracer to continue execution. The problem happens when a tracer tries to ptra

Re: [PATCH v9 13/25] security: Introduce file_release hook

2024-01-15 Thread Al Viro
On Mon, Jan 15, 2024 at 07:17:57PM +0100, Roberto Sassu wrote: > From: Roberto Sassu > > In preparation for moving IMA and EVM to the LSM infrastructure, introduce > the file_release hook. > > IMA calculates at file close the new digest of the file content and writes > it to security.ima, so tha

[PATCH v9 13/25] security: Introduce file_release hook

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu In preparation for moving IMA and EVM to the LSM infrastructure, introduce the file_release hook. IMA calculates at file close the new digest of the file content and writes it to security.ima, so that appraisal at next file access succeeds. An LSM could implement an exclusiv

[PATCH v9 04/25] ima: Align ima_inode_removexattr() definition with LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Change ima_inode_removexattr() definition, so that it can be registered as implementation of the inode_removexattr hook. Signed-off-by: Roberto Sassu Reviewed-by: Stefan Berger Reviewed-by: Casey Schaufler Reviewed-by: Mimi Zohar --- include/linux/ima.h

[PATCH v9 25/25] integrity: Remove LSM

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Since now IMA and EVM use their own integrity metadata, it is safe to remove the 'integrity' LSM, with its management of integrity metadata. Keep the iint.c file only for loading IMA and EVM keys at boot, and for creating the integrity directory in securityfs (we need to keep

[PATCH v9 24/25] ima: Make it independent from 'integrity' LSM

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Make the 'ima' LSM independent from the 'integrity' LSM by introducing IMA own integrity metadata (ima_iint_cache structure, with IMA-specific fields from the integrity_iint_cache structure), and by managing it directly from the 'ima' LSM. Create ima_iint.c and introduce the

[PATCH v9 23/25] evm: Make it independent from 'integrity' LSM

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Define a new structure for EVM-specific metadata, called evm_iint_cache, and embed it in the inode security blob. Introduce evm_iint_inode() to retrieve metadata, and register evm_inode_alloc_security() for the inode_alloc_security LSM hook, to initialize the structure (before

[PATCH v9 22/25] evm: Move to LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu As for IMA, move hardcoded EVM function calls from various places in the kernel to the LSM infrastructure, by introducing a new LSM named 'evm' (last and always enabled like 'ima'). The order in the Makefile ensures that 'evm' hooks are executed after 'ima' ones. Make EVM fun

[PATCH v9 21/25] ima: Move IMA-Appraisal to LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu A few additional IMA hooks are needed to reset the cached appraisal status, causing the file's integrity to be re-evaluated on next access. Register these IMA-appraisal only functions separately from the rest of IMA functions, as appraisal is a separate feature not necessarily

[PATCH v9 20/25] ima: Move to LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Move hardcoded IMA function calls (not appraisal-specific functions) from various places in the kernel to the LSM infrastructure, by introducing a new LSM named 'ima' (at the end of the LSM list and always enabled like 'integrity'). Having IMA before EVM in the Makefile is su

[PATCH v9 19/25] integrity: Move integrity_kernel_module_request() to IMA

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu In preparation for removing the 'integrity' LSM, move integrity_kernel_module_request() to IMA, and rename it to ima_kernel_module_request(). Compile it conditionally if CONFIG_INTEGRITY_ASYMMETRIC_KEYS is enabled, and call it from security.c (removed afterwards with the move

[PATCH v9 18/25] security: Introduce key_post_create_or_update hook

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu In preparation for moving IMA and EVM to the LSM infrastructure, introduce the key_post_create_or_update hook. Depending on policy, IMA measures the key content after creation or update, so that remote verifiers are aware of the operation. Other LSMs could similarly take som

[PATCH v9 17/25] security: Introduce inode_post_remove_acl hook

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu In preparation for moving IMA and EVM to the LSM infrastructure, introduce the inode_post_remove_acl hook. At inode_remove_acl hook, EVM verifies the file's existing HMAC value. At inode_post_remove_acl, EVM re-calculates the file's HMAC with the passed POSIX ACL removed and

[PATCH v9 16/25] security: Introduce inode_post_set_acl hook

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu In preparation for moving IMA and EVM to the LSM infrastructure, introduce the inode_post_set_acl hook. At inode_set_acl hook, EVM verifies the file's existing HMAC value. At inode_post_set_acl, EVM re-calculates the file's HMAC based on the modified POSIX ACL and other file

[PATCH v9 15/25] security: Introduce inode_post_create_tmpfile hook

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu In preparation for moving IMA and EVM to the LSM infrastructure, introduce the inode_post_create_tmpfile hook. As temp files can be made persistent, treat new temp files like other new files, so that the file hash is calculated and stored in the security xattr. LSMs could al

[PATCH v9 14/25] security: Introduce path_post_mknod hook

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu In preparation for moving IMA and EVM to the LSM infrastructure, introduce the path_post_mknod hook. IMA-appraisal requires all existing files in policy to have a file hash/signature stored in security.ima. An exception is made for empty files created by mknod, by tagging the

[PATCH v9 12/25] security: Introduce file_post_open hook

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu In preparation to move IMA and EVM to the LSM infrastructure, introduce the file_post_open hook. Also, export security_file_post_open() for NFS. Based on policy, IMA calculates the digest of the file content and extends the TPM with the digest, verifies the file's integrity b

[PATCH v9 11/25] security: Introduce inode_post_removexattr hook

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu In preparation for moving IMA and EVM to the LSM infrastructure, introduce the inode_post_removexattr hook. At inode_removexattr hook, EVM verifies the file's existing HMAC value. At inode_post_removexattr, EVM re-calculates the file's HMAC with the passed xattr removed and o

[PATCH v9 10/25] security: Introduce inode_post_setattr hook

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu In preparation for moving IMA and EVM to the LSM infrastructure, introduce the inode_post_setattr hook. At inode_setattr hook, EVM verifies the file's existing HMAC value. At inode_post_setattr, EVM re-calculates the file's HMAC based on the modified file attributes and other

[PATCH v9 09/25] security: Align inode_setattr hook definition with EVM

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Add the idmap parameter to the definition, so that evm_inode_setattr() can be registered as this hook implementation. Signed-off-by: Roberto Sassu Reviewed-by: Stefan Berger Acked-by: Casey Schaufler Reviewed-by: Mimi Zohar --- include/linux/lsm_hook_defs.h | 3 ++- secu

[PATCH v9 08/25] evm: Align evm_inode_post_setxattr() definition with LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Change evm_inode_post_setxattr() definition, so that it can be registered as implementation of the inode_post_setxattr hook. Signed-off-by: Roberto Sassu Reviewed-by: Stefan Berger Reviewed-by: Mimi Zohar Reviewed-by: Casey Schaufler --- include/linux/evm.h

[PATCH v9 07/25] evm: Align evm_inode_setxattr() definition with LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Change evm_inode_setxattr() definition, so that it can be registered as implementation of the inode_setxattr hook. Signed-off-by: Roberto Sassu Reviewed-by: Stefan Berger Reviewed-by: Mimi Zohar Reviewed-by: Casey Schaufler --- include/linux/evm.h | 4 ++--

[PATCH v9 06/25] evm: Align evm_inode_post_setattr() definition with LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Change evm_inode_post_setattr() definition, so that it can be registered as implementation of the inode_post_setattr hook (to be introduced). Signed-off-by: Roberto Sassu Reviewed-by: Stefan Berger Reviewed-by: Casey Schaufler Reviewed-by: Mimi Zohar --- fs/attr.c

[PATCH v9 05/25] ima: Align ima_post_read_file() definition with LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Change ima_post_read_file() definition, by making "void *buf" a "char *buf", so that it can be registered as implementation of the post_read_file hook. Signed-off-by: Roberto Sassu Reviewed-by: Stefan Berger Reviewed-by: Mimi Zohar Reviewed-by: Casey Schaufler --- includ

[PATCH v9 03/25] ima: Align ima_inode_setxattr() definition with LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Change ima_inode_setxattr() definition, so that it can be registered as implementation of the inode_setxattr hook. Signed-off-by: Roberto Sassu Reviewed-by: Stefan Berger Reviewed-by: Mimi Zohar Reviewed-by: Casey Schaufler --- include/linux/ima.h | 11

[PATCH v9 02/25] ima: Align ima_file_mprotect() definition with LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Change ima_file_mprotect() definition, so that it can be registered as implementation of the file_mprotect hook. Signed-off-by: Roberto Sassu Reviewed-by: Stefan Berger Reviewed-by: Casey Schaufler Reviewed-by: Mimi Zohar --- include/linux/ima.h | 5 +++--

[PATCH v9 01/25] ima: Align ima_inode_post_setattr() definition with LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu Change ima_inode_post_setattr() definition, so that it can be registered as implementation of the inode_post_setattr hook (to be introduced). Signed-off-by: Roberto Sassu Reviewed-by: Stefan Berger Reviewed-by: Casey Schaufler Reviewed-by: Mimi Zohar --- fs/attr.c

[PATCH v9 00/25] security: Move IMA and EVM to the LSM infrastructure

2024-01-15 Thread Roberto Sassu
From: Roberto Sassu IMA and EVM are not effectively LSMs, especially due to the fact that in the past they could not provide a security blob while there is another LSM active. That changed in the recent years, the LSM stacking feature now makes it possible to stack together multiple LSMs, and al

Re: [PATCH 12/12] selftests/net: Add TCP-AO key-management test

2024-01-15 Thread Dmitry Safonov
Hi Mohammad, On 1/12/24 18:57, Nassiri, Mohammad wrote: >> -Original Message- >> From: Dmitry Safonov >> Sent: Thursday, December 14, 2023 9:36 PM > >> + >> +static void end_server(const char *tst_name, int sk, >> + struct tcp_ao_counters *begin) { >> +struct tcp_ao

Re: [PATCH v2 4/6] iommufd: Deliver fault messages to user space

2024-01-15 Thread Jason Gunthorpe
On Mon, Jan 15, 2024 at 05:44:13PM +, Shameerali Kolothum Thodi wrote: > > If it is valid when userspace does read() then it should be valid when > > userspace does write() too. > > > > It is the only way the kernel can actually match request and response > > here. > > The kernel currently c

Re: [PATCH 1/6] arm64: Unconditionally call unflatten_device_tree()

2024-01-15 Thread Rob Herring
On Fri, Jan 12, 2024 at 12:07:44PM -0800, Stephen Boyd wrote: > Call this function unconditionally so that we can populate an empty DTB > on platforms that don't boot with a firmware provided or builtin DTB. > There's no harm in calling unflatten_device_tree() unconditionally. If > there isn't a va

RE: [PATCH v2 4/6] iommufd: Deliver fault messages to user space

2024-01-15 Thread Shameerali Kolothum Thodi
> -Original Message- > From: Jason Gunthorpe > Sent: Monday, January 15, 2024 4:47 PM > To: Shameerali Kolothum Thodi > Cc: Lu Baolu ; Kevin Tian ; > Joerg Roedel ; Will Deacon ; Robin > Murphy ; Jean-Philippe Brucker phili...@linaro.org>; Nicolin Chen ; Yi Liu > ; Jacob Pan ; > io...

Re: [PATCH 3/8] iommufd: Support attach/replace hwpt per pasid

2024-01-15 Thread Jason Gunthorpe
On Sun, Nov 26, 2023 at 10:34:23PM -0800, Yi Liu wrote: > @@ -534,7 +537,17 @@ iommufd_device_do_replace(struct iommufd_device *idev, > static struct iommufd_hw_pagetable *do_attach(struct iommufd_device *idev, > struct iommufd_hw_pagetable *hwpt, struct attach_data *data) > { > -

Re: [PATCH 8/8] iommu/vt-d: Add set_dev_pasid callback for nested domain

2024-01-15 Thread Jason Gunthorpe
On Sun, Nov 26, 2023 at 10:34:28PM -0800, Yi Liu wrote: > +static int intel_nested_set_dev_pasid(struct iommu_domain *domain, > + struct device *dev, ioasid_t pasid) > +{ > + struct device_domain_info *info = dev_iommu_priv_get(dev); > + struct dmar_domain

Re: [PATCH 1/8] iommu: Introduce a replace API for device pasid

2024-01-15 Thread Jason Gunthorpe
On Sun, Nov 26, 2023 at 10:34:21PM -0800, Yi Liu wrote: > +int iommu_replace_device_pasid(struct iommu_domain *domain, > +struct device *dev, ioasid_t pasid) > +{ > + struct iommu_group *group = dev->iommu_group; > + struct iommu_domain *old_domain; > + int r

Re: [PATCH 1/3] vfio-iommufd: Support pasid [at|de]tach for physical VFIO devices

2024-01-15 Thread Jason Gunthorpe
On Sun, Nov 26, 2023 at 10:39:07PM -0800, Yi Liu wrote: > @@ -168,6 +180,42 @@ void vfio_iommufd_physical_detach_ioas(struct > vfio_device *vdev) > } > EXPORT_SYMBOL_GPL(vfio_iommufd_physical_detach_ioas); > > +int vfio_iommufd_physical_pasid_attach_ioas(struct vfio_device *vdev, > +

Re: [PATCH v2 4/6] iommufd: Deliver fault messages to user space

2024-01-15 Thread Jason Gunthorpe
On Fri, Jan 12, 2024 at 05:46:13PM +, Shameerali Kolothum Thodi wrote: > > > > -Original Message- > > From: Lu Baolu > > Sent: Thursday, October 26, 2023 3:49 AM > > To: Jason Gunthorpe ; Kevin Tian ; > > Joerg > > Roedel ; Will Deacon ; Robin Murphy > > ; Jean-Philippe Brucker ; >

Re: [PATCH 15/15] KVM: riscv: selftests: Add Zfa extension to get-reg-list test

2024-01-15 Thread Andrew Jones
On Tue, Nov 28, 2023 at 08:23:57PM +0530, Anup Patel wrote: > The KVM RISC-V allows Zfa extension for Guest/VM so let us > add this extension to get-reg-list test. > > Signed-off-by: Anup Patel > --- > tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 > 1 file changed, 4 insertions(+) >

Re: [PATCH 14/15] RISC-V: KVM: Allow Zfa extension for Guest/VM

2024-01-15 Thread Andrew Jones
On Tue, Nov 28, 2023 at 08:23:56PM +0530, Anup Patel wrote: > We extend the KVM ISA extension ONE_REG interface to allow KVM > user space to detect and enable Zfa extension for Guest/VM. > > Signed-off-by: Anup Patel > --- > arch/riscv/include/uapi/asm/kvm.h | 1 + > arch/riscv/kvm/vcpu_onereg.c

Re: [PATCH 13/15] KVM: riscv: selftests: Add Zvfh[min] extensions to get-reg-list test

2024-01-15 Thread Andrew Jones
On Tue, Nov 28, 2023 at 08:23:55PM +0530, Anup Patel wrote: > The KVM RISC-V allows Zvfh[min] extensions for Guest/VM so let us > add these extensions to get-reg-list test. > > Signed-off-by: Anup Patel > --- > tools/testing/selftests/kvm/riscv/get-reg-list.c | 8 > 1 file changed, 8 in

Re: [PATCH 12/15] RISC-V: KVM: Allow Zvfh[min] extensions for Guest/VM

2024-01-15 Thread Andrew Jones
On Tue, Nov 28, 2023 at 08:23:54PM +0530, Anup Patel wrote: > We extend the KVM ISA extension ONE_REG interface to allow KVM > user space to detect and enable Zvfh[min] extensions for Guest/VM. > > Signed-off-by: Anup Patel > --- > arch/riscv/include/uapi/asm/kvm.h | 2 ++ > arch/riscv/kvm/vcpu_

Re: [PATCH 11/15] KVM: riscv: selftests: Add Zihintntl extension to get-reg-list test

2024-01-15 Thread Andrew Jones
On Tue, Nov 28, 2023 at 08:23:53PM +0530, Anup Patel wrote: > The KVM RISC-V allows Zihintntl extension for Guest/VM so let us > add this extension to get-reg-list test. > > Signed-off-by: Anup Patel > --- > tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 > 1 file changed, 4 insertion

Re: [PATCH 10/15] RISC-V: KVM: Allow Zihintntl extension for Guest/VM

2024-01-15 Thread Andrew Jones
On Tue, Nov 28, 2023 at 08:23:52PM +0530, Anup Patel wrote: > We extend the KVM ISA extension ONE_REG interface to allow KVM > user space to detect and enable Zihintntl extension for Guest/VM. > > Signed-off-by: Anup Patel > --- > arch/riscv/include/uapi/asm/kvm.h | 1 + > arch/riscv/kvm/vcpu_on

Re: [PATCH 09/15] KVM: riscv: selftests: Add Zfh[min] extensions to get-reg-list test

2024-01-15 Thread Andrew Jones
On Tue, Nov 28, 2023 at 08:23:51PM +0530, Anup Patel wrote: > The KVM RISC-V allows Zfh[min] extensions for Guest/VM so let us > add these extensions to get-reg-list test. > > Signed-off-by: Anup Patel > --- > tools/testing/selftests/kvm/riscv/get-reg-list.c | 8 > 1 file changed, 8 ins

Re: [PATCH 08/15] RISC-V: KVM: Allow Zfh[min] extensions for Guest/VM

2024-01-15 Thread Andrew Jones
On Tue, Nov 28, 2023 at 08:23:50PM +0530, Anup Patel wrote: > We extend the KVM ISA extension ONE_REG interface to allow KVM > user space to detect and enable Zfh[min] extensions for Guest/VM. > > Signed-off-by: Anup Patel > --- > arch/riscv/include/uapi/asm/kvm.h | 2 ++ > arch/riscv/kvm/vcpu_o

Re: [PATCH 07/15] KVM: riscv: selftests: Add vector crypto extensions to get-reg-list test

2024-01-15 Thread Andrew Jones
On Tue, Nov 28, 2023 at 08:23:49PM +0530, Anup Patel wrote: > The KVM RISC-V allows vector crypto extensions for Guest/VM so let us > add these extensions to get-reg-list test. This includes extensions > Zvbb, Zvbc, Zvkb, Zvkg, Zvkned, Zvknha, Zvknhb, Zvksed, Zvksh, and Zvkt. > > Signed-off-by: An

Re: [PATCH 06/15] RISC-V: KVM: Allow vector crypto extensions for Guest/VM

2024-01-15 Thread Andrew Jones
On Tue, Nov 28, 2023 at 08:23:48PM +0530, Anup Patel wrote: > We extend the KVM ISA extension ONE_REG interface to allow KVM > user space to detect and enable vector crypto extensions for > Guest/VM. This includes extensions Zvbb, Zvbc, Zvkb, Zvkg, > Zvkned, Zvknha, Zvknhb, Zvksed, Zvksh, and Zvkt.

Re: [PATCH 05/15] KVM: riscv: selftests: Add scaler crypto extensions to get-reg-list test

2024-01-15 Thread Andrew Jones
On Tue, Nov 28, 2023 at 08:23:47PM +0530, Anup Patel wrote: > The KVM RISC-V allows scaler crypto extensions for Guest/VM so let us > add these extensions to get-reg-list test. This includes extensions > Zbkb, Zbkc, Zbkx, Zknd, Zkne, Zknh, Zkr, Zksed, Zksh, and Zkt. > > Signed-off-by: Anup Patel

Re: [PATCH] selftests/filesystems:fix build error in overlayfs

2024-01-15 Thread Günther Noack
Hello! On Fri, Jan 12, 2024 at 03:40:59PM +0800, Hu Yadi wrote: > One build issue comes up due to both mount.h included dev_in_maps.c > > In file included from dev_in_maps.c:10: > /usr/include/sys/mount.h:35:3: error: expected identifier before numeric > constant >35 | MS_RDONLY = 1, /* M

Re: [PATCH net] selftests: netdevsim: sprinkle more udevadm settle

2024-01-15 Thread Simon Horman
On Sun, Jan 14, 2024 at 02:47:26PM -0800, Jakub Kicinski wrote: > Number of tests are failing when netdev renaming is active > on the system. Add udevadm settle in logic determining > the names. > > Fixes: 242aaf03dc9b ("selftests: add a test for ethtool pause stats") > Signed-off-by: Jakub Kicins

[PATCH bpf-next] bpf: Allow setting SO_TIMESTAMPING* with bpf_setsockopt()

2024-01-15 Thread Jörn-Thorben Hinz
A BPF application, e.g., a TCP congestion control, might benefit from or even require precise (=hardware) packet timestamps. These timestamps are already available through __sk_buff.hwtstamp and bpf_sock_ops.skb_hwtstamp, but could not be requested: BPF programs were not allowed to set SO_TIMESTAMP

[PATCH v12 04/20] KVM: pfncache: add a mark-dirty helper

2024-01-15 Thread Paul Durrant
From: Paul Durrant At the moment pages are marked dirty by open-coded calls to mark_page_dirty_in_slot(), directly deferefencing the gpa and memslot from the cache. After a subsequent patch these may not always be set so add a helper now so that caller will protected from the need to know about t

[PATCH v12 00/20] KVM: xen: update shared_info and vcpu_info handling

2024-01-15 Thread Paul Durrant
From: Paul Durrant This series has one small fix to what was in v11 [1]: * KVM: xen: re-initialize shared_info if guest (32/64-bit) mode is set The v11 patch failed to set the return code of the ioctl if the mode was not actually changed, leading to a spurious failure. This version of the seri

[PATCH v12 02/20] KVM: pfncache: remove unnecessary exports

2024-01-15 Thread Paul Durrant
From: Paul Durrant There is no need for the existing kvm_gpc_XXX() functions to be exported. Clean up now before additional functions are added in subsequent patches. Signed-off-by: Paul Durrant Reviewed-by: David Woodhouse --- Cc: Sean Christopherson Cc: David Woodhouse Cc: Paolo Bonzini

[PATCH v12 03/20] KVM: xen: mark guest pages dirty with the pfncache lock held

2024-01-15 Thread Paul Durrant
From: Paul Durrant Sampling gpa and memslot from an unlocked pfncache may yield inconsistent values so, since there is no problem with calling mark_page_dirty_in_slot() with the pfncache lock held, relocate the calls in kvm_xen_update_runstate_guest() and kvm_xen_inject_pending_events() according

[PATCH v12 06/20] KVM: pfncache: stop open-coding offset_in_page()

2024-01-15 Thread Paul Durrant
From: Paul Durrant Some code in pfncache uses offset_in_page() but in other places it is open- coded. Use offset_in_page() consistently everywhere. Signed-off-by: Paul Durrant Reviewed-by: David Woodhouse --- Cc: Sean Christopherson Cc: Paolo Bonzini Cc: David Woodhouse v8: - New in this

[PATCH v12 07/20] KVM: pfncache: include page offset in uhva and use it consistently

2024-01-15 Thread Paul Durrant
From: Paul Durrant Currently the pfncache page offset is sometimes determined using the gpa and sometimes the khva, whilst the uhva is always page-aligned. After a subsequent patch is applied the gpa will not always be valid so adjust the code to include the page offset in the uhva and use it con

[PATCH v12 05/20] KVM: pfncache: remove KVM_GUEST_USES_PFN usage

2024-01-15 Thread Paul Durrant
From: Paul Durrant As noted in [1] the KVM_GUEST_USES_PFN usage flag is never set by any callers of kvm_gpc_init(), which also makes the 'vcpu' argument redundant. Moreover, all existing callers specify KVM_HOST_USES_PFN so the usage check in hva_to_pfn_retry() and hence the 'usage' argument to k

[PATCH v12 01/20] KVM: pfncache: Add a map helper function

2024-01-15 Thread Paul Durrant
From: Paul Durrant There is a pfncache unmap helper but mapping is open-coded. Arguably this is fine because mapping is done in only one place, hva_to_pfn_retry(), but adding the helper does make that function more readable. No functional change intended. Signed-off-by: Paul Durrant Reviewed-b

[PATCH v12 20/20] KVM: pfncache: rework __kvm_gpc_refresh() to fix locking issues

2024-01-15 Thread Paul Durrant
From: David Woodhouse This function can race with kvm_gpc_deactivate(), which does not take the ->refresh_lock. This means kvm_gpc_deactivate() can wipe the ->pfn and ->khva fields, and unmap the latter, while hva_to_pfn_retry() has temporarily dropped its write lock on gpc->lock. Then if hva_to

[PATCH v12 11/20] KVM: xen: allow shared_info to be mapped by fixed HVA

2024-01-15 Thread Paul Durrant
From: Paul Durrant The shared_info page is not guest memory as such. It is a dedicated page allocated by the VMM and overlaid onto guest memory in a GFN chosen by the guest and specified in the XENMEM_add_to_physmap hypercall. The guest may even request that shared_info be moved from one GFN to a

[PATCH v12 12/20] KVM: xen: allow vcpu_info to be mapped by fixed HVA

2024-01-15 Thread Paul Durrant
From: Paul Durrant If the guest does not explicitly set the GPA of vcpu_info structure in memory then, for guests with 32 vCPUs or fewer, the vcpu_info embedded in the shared_info page may be used. As described in a previous commit, the shared_info page is an overlay at a fixed HVA within the VMM

[PATCH v12 16/20] KVM: xen: split up kvm_xen_set_evtchn_fast()

2024-01-15 Thread Paul Durrant
From: Paul Durrant The implementation of kvm_xen_set_evtchn_fast() is a rather lengthy piece of code that performs two operations: updating of the shared_info evtchn_pending mask, and updating of the vcpu_info evtchn_pending_sel mask. Introduce a separate function to perform each of those operati

[PATCH v12 17/20] KVM: xen: don't block on pfncache locks in kvm_xen_set_evtchn_fast()

2024-01-15 Thread Paul Durrant
From: Paul Durrant As described in [1] compiling with CONFIG_PROVE_RAW_LOCK_NESTING shows that kvm_xen_set_evtchn_fast() is blocking on pfncache locks in IRQ context. There is only actually blocking with PREEMPT_RT because the locks will turned into mutexes. There is no 'raw' version of rwlock_t

[PATCH v12 18/20] KVM: pfncache: check the need for invalidation under read lock first

2024-01-15 Thread Paul Durrant
From: Paul Durrant Taking a write lock on a pfncache will be disruptive if the cache is heavily used (which only requires a read lock). Hence, in the MMU notifier callback, take read locks on caches to check for a match; only taking a write lock to actually perform an invalidation (after a anothe

[PATCH v12 10/20] KVM: xen: re-initialize shared_info if guest (32/64-bit) mode is set

2024-01-15 Thread Paul Durrant
From: Paul Durrant If the shared_info PFN cache has already been initialized then the content of the shared_info page needs to be re-initialized whenever the guest mode is (re)set. Setting the guest mode is either done explicitly by the VMM via the KVM_XEN_ATTR_TYPE_LONG_MODE attribute, or implic

[PATCH v12 14/20] KVM: selftests / xen: re-map vcpu_info using HVA rather than GPA

2024-01-15 Thread Paul Durrant
From: Paul Durrant If the relevant capability (KVM_XEN_HVM_CONFIG_SHARED_INFO_HVA) is present then re-map vcpu_info using the HVA part way through the tests to make sure then there is no functional change. Signed-off-by: Paul Durrant Reviewed-by: David Woodhouse --- Cc: Sean Christopherson Cc

[PATCH v12 19/20] KVM: xen: allow vcpu_info content to be 'safely' copied

2024-01-15 Thread Paul Durrant
From: Paul Durrant If the guest sets an explicit vcpu_info GPA then, for any of the first 32 vCPUs, the content of the default vcpu_info in the shared_info page must be copied into the new location. Because this copy may race with event delivery (which updates the 'evtchn_pending_sel' field in vc

[PATCH v12 15/20] KVM: xen: advertize the KVM_XEN_HVM_CONFIG_SHARED_INFO_HVA capability

2024-01-15 Thread Paul Durrant
From: Paul Durrant Now that all relevant kernel changes and selftests are in place, enable the new capability. Signed-off-by: Paul Durrant Reviewed-by: David Woodhouse --- Cc: Sean Christopherson Cc: Paolo Bonzini Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc

[PATCH v12 13/20] KVM: selftests / xen: map shared_info using HVA rather than GFN

2024-01-15 Thread Paul Durrant
From: Paul Durrant Using the HVA of the shared_info page is more efficient, so if the capability (KVM_XEN_HVM_CONFIG_SHARED_INFO_HVA) is present use that method to do the mapping. NOTE: Have the juggle_shinfo_state() thread map and unmap using both GFN and HVA, to make sure the older mecha

[PATCH v12 09/20] KVM: xen: separate initialization of shared_info cache and content

2024-01-15 Thread Paul Durrant
From: Paul Durrant A subsequent patch will allow shared_info to be initialized using either a GPA or a user-space (i.e. VMM) HVA. To make that patch cleaner, separate the initialization of the shared_info content from the activation of the pfncache. Signed-off-by: Paul Durrant Reviewed-by: Davi

[PATCH v12 08/20] KVM: pfncache: allow a cache to be activated with a fixed (userspace) HVA

2024-01-15 Thread Paul Durrant
From: Paul Durrant Some pfncache pages may actually be overlays on guest memory that have a fixed HVA within the VMM. It's pointless to invalidate such cached mappings if the overlay is moved so allow a cache to be activated directly with the HVA to cater for such cases. A subsequent patch will m

回复: [PATCH v3] selftests/landlock:Fix two build issues

2024-01-15 Thread Huyadi
s a W=1 build): >(https://download.01.org/0day-ci/archive/20240115/202401151147.t1s11ihj-...@intel.com/reproduce) > >If you fix the issue in a separate patch/commit (i.e. not just a new version >of the same patch/commit), kindly add following tags >| Reported-by: kernel test robot &

[PATCH v4] selftests/landlock:Fix two build issues

2024-01-15 Thread Hu Yadi
From: "Hu.Yadi" Two issues comes up while building selftest/landlock on my side (gcc 7.3/glibc-2.28/kernel-4.19) the first one is as to gettid net_test.c: In function ‘set_service’: net_test.c:91:45: warning: implicit declaration of function ‘gettid’; [-Wimplicit-function-declaration] "_se

Re: [PATCH 3/3] vfio: Report PASID capability via VFIO_DEVICE_FEATURE ioctl

2024-01-15 Thread Yi Liu
On 2023/12/12 23:35, Jason Gunthorpe wrote: On Mon, Dec 11, 2023 at 11:49:49AM -0700, Alex Williamson wrote: On Mon, 11 Dec 2023 14:10:28 -0400 Jason Gunthorpe wrote: On Mon, Dec 11, 2023 at 11:03:45AM -0700, Alex Williamson wrote: On Sun, 26 Nov 2023 22:39:09 -0800 Yi Liu wrote: the

Re: [PATCH 3/3] vfio: Report PASID capability via VFIO_DEVICE_FEATURE ioctl

2024-01-15 Thread Yi Liu
On 2023/12/12 23:27, Jason Gunthorpe wrote: On Mon, Dec 11, 2023 at 08:39:46PM -0700, Alex Williamson wrote: So how do we keep up with PCIe spec updates relative to the PASID capability with this proposal? Would it make more sense to report the raw capability register and capability version ra