Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ipv6 utilities #185

Merged
2 commits merged into from
Aug 3, 2016
Merged

Add ipv6 utilities #185

2 commits merged into from
Aug 3, 2016

Conversation

liuyuan10
Copy link
Member

@liuyuan10 liuyuan10 commented Aug 3, 2016

Add ipv6 utilities to config ipv6 in LKL

Also has to pull in linux/netlink.h otherwise so many types have to be defined.


This change is Reviewable

@thehajime
Copy link
Member

Cool ! LGTM.

@ghost
Copy link

ghost commented Aug 3, 2016

Review status: 0 of 6 files reviewed at latest revision, 6 unresolved discussions.


tools/lkl/lib/net.c, line 146 [r2] (raw file):

}

struct lkl_in6_addr {

You can use the below patch to avoid redefining the uapi structures here:

diff --git a/arch/lkl/include/uapi/asm/syscalls.h b/arch/lkl/include/uapi/asm/syscalls.h
index 813ff42..a5d24cc 100644
--- a/arch/lkl/include/uapi/asm/syscalls.h
+++ b/arch/lkl/include/uapi/asm/syscalls.h
@@ -115,6 +115,13 @@ struct sockaddr {
#include <linux/virtio_blk.h>
#include <linux/virtio_net.h>
#include <linux/virtio_ring.h>
+#define __UAPI_DEF_IN6_ADDR 1
+#include <linux/in6.h>
+#include <linux/ipv6.h>
+#include <linux/ipv6_route.h>
+#include <linux/neighbour.h>
+#include <linux/rtnetlink.h>
+


tools/lkl/lib/net.c, line 150 [r2] (raw file):

};

struct lkl_in6_ifreq {

No need to redefine, see my previous comment.


tools/lkl/lib/net.c, line 177 [r2] (raw file):

}

struct lkl_in6_rtmsg {

No need to redefine, see my previous comment.


tools/lkl/lib/net.c, line 223 [r2] (raw file):

}

struct lkl_ndmsg {

No need to redefine, see my previous comment.


tools/lkl/lib/net.c, line 233 [r2] (raw file):

};

struct lkl_rtattr {

No need to redefine, see my previous comment.


tools/lkl/lib/net.c, line 238 [r2] (raw file):

};

#define LKL_MSG_TRUNC 0x20

No need to redefine, see my previous comment.


Comments from Reviewable

So we don't need to redefine them by ourselves when using netlink

Signed-off-by: Yuan Liu <liuyuan@google.com>
Add a list ot utilities to config ipv6 in lkl.

Signed-off-by: Yuan Liu <liuyuan@google.com>
@liuyuan10
Copy link
Member Author

Review status: 0 of 6 files reviewed at latest revision, 6 unresolved discussions.


tools/lkl/lib/net.c, line 146 [r2] (raw file):

Previously, opurdila (Octavian Purdila) wrote…

You can use the below patch to avoid redefining the uapi structures here:

diff --git a/arch/lkl/include/uapi/asm/syscalls.h b/arch/lkl/include/uapi/asm/syscalls.h
index 813ff42..a5d24cc 100644
--- a/arch/lkl/include/uapi/asm/syscalls.h
+++ b/arch/lkl/include/uapi/asm/syscalls.h
@@ -115,6 +115,13 @@ struct sockaddr {
#include <linux/virtio_blk.h>
#include <linux/virtio_net.h>
#include <linux/virtio_ring.h>
+#define __UAPI_DEF_IN6_ADDR 1
+#include <linux/in6.h>
+#include <linux/ipv6.h>
+#include <linux/ipv6_route.h>
+#include <linux/neighbour.h>
+#include <linux/rtnetlink.h>
+

Don't know how to see your patch. I added all the UAPI headers I need. I still need to define LKL_MSG_TRUNC which is in linux/socket.h and seems you don't want to pull it in.

tools/lkl/lib/net.c, line 150 [r2] (raw file):

Previously, opurdila (Octavian Purdila) wrote…

No need to redefine, see my previous comment.

Done.

tools/lkl/lib/net.c, line 177 [r2] (raw file):

Previously, opurdila (Octavian Purdila) wrote…

No need to redefine, see my previous comment.

Done.

tools/lkl/lib/net.c, line 223 [r2] (raw file):

Previously, opurdila (Octavian Purdila) wrote…

No need to redefine, see my previous comment.

Done.

tools/lkl/lib/net.c, line 233 [r2] (raw file):

Previously, opurdila (Octavian Purdila) wrote…

No need to redefine, see my previous comment.

Done.

tools/lkl/lib/net.c, line 238 [r2] (raw file):

Previously, opurdila (Octavian Purdila) wrote…

No need to redefine, see my previous comment.

Done.

Comments from Reviewable

@ghost
Copy link

ghost commented Aug 3, 2016

:lgtm:


Review status: 0 of 6 files reviewed at latest revision, 1 unresolved discussion.


tools/lkl/lib/net.c, line 146 [r2] (raw file):

Previously, liuyuan10 (Yuan Liu) wrote…

Don't know how to see your patch. I added all the UAPI headers I need. I still need to define LKL_MSG_TRUNC which is in linux/socket.h and seems you don't want to pull it in.

OK, sorry about that, not sure why the patch is not properly visible. MSG_TRUNC in not defined in uapi headers so we can't pull them in. What I usually do in this case is to manually add them to arch/lkl/uapi/asm/syscalls.h see this comment:

/* Define data structures used in system calls that are not defined in UAPI

  • headers */

I will merge the patch as it is, we can fix this in a subsequent patch.


Comments from Reviewable

@ghost
Copy link

ghost commented Aug 3, 2016

Reviewed 3 of 6 files at r1, 1 of 1 files at r2, 2 of 2 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@ghost ghost merged commit 11f0696 into lkl:master Aug 3, 2016
@liuyuan10 liuyuan10 deleted the ipv6 branch August 3, 2016 18:13
prp pushed a commit to lsds/lkl that referenced this pull request Sep 7, 2020
commit c92d30e upstream.

In commit f3b98e3 ("media: vsp1: Provide support for extended
command pools"), the vsp pointer used for referencing the VSP1 device
structure from a command pool during vsp1_dl_ext_cmd_pool_destroy() was
not populated.

Correctly assign the pointer to prevent the following
null-pointer-dereference when removing the device:

[*] h3ulcb-kf #>
echo fea28000.vsp > /sys/bus/platform/devices/fea28000.vsp/driver/unbind
 Unable to handle kernel NULL pointer dereference at virtual address 0000000000000028
 Mem abort info:
   ESR = 0x96000006
   EC = 0x25: DABT (current EL), IL = 32 bits
   SET = 0, FnV = 0
   EA = 0, S1PTW = 0
 Data abort info:
   ISV = 0, ISS = 0x00000006
   CM = 0, WnR = 0
 user pgtable: 4k pages, 48-bit VAs, pgdp=00000007318be000
 [0000000000000028] pgd=00000007333a1003, pud=00000007333a6003, pmd=0000000000000000
 Internal error: Oops: 96000006 [#1] PREEMPT SMP
 Modules linked in:
 CPU: 1 PID: 486 Comm: sh Not tainted 5.7.0-rc6-arm64-renesas-00118-ge644645abf47 lkl#185
 Hardware name: Renesas H3ULCB Kingfisher board based on r8a77951 (DT)
 pstate: 40000005 (nZcv daif -PAN -UAO)
 pc : vsp1_dlm_destroy+0xe4/0x11c
 lr : vsp1_dlm_destroy+0xc8/0x11c
 sp : ffff800012963b60
 x29: ffff800012963b60 x28: ffff0006f83fc440
 x27: 0000000000000000 x26: ffff0006f5e13e80
 x25: ffff0006f5e13ed0 x24: ffff0006f5e13ed0
 x23: ffff0006f5e13ed0 x22: dead000000000122
 x21: ffff0006f5e3a080 x20: ffff0006f5df2938
 x19: ffff0006f5df2980 x18: 0000000000000003
 x17: 0000000000000000 x16: 0000000000000016
 x15: 0000000000000003 x14: 00000000000393c0
 x13: ffff800011a5ec18 x12: ffff800011d8d000
 x11: ffff0006f83fcc68 x10: ffff800011a53d70
 x9 : ffff8000111f3000 x8 : 0000000000000000
 x7 : 0000000000210d00 x6 : 0000000000000000
 x5 : ffff800010872e60 x4 : 0000000000000004
 x3 : 0000000078068000 x2 : ffff800012781000
 x1 : 0000000000002c00 x0 : 0000000000000000
 Call trace:
  vsp1_dlm_destroy+0xe4/0x11c
  vsp1_wpf_destroy+0x10/0x20
  vsp1_entity_destroy+0x24/0x4c
  vsp1_destroy_entities+0x54/0x130
  vsp1_remove+0x1c/0x40
  platform_drv_remove+0x28/0x50
  __device_release_driver+0x178/0x220
  device_driver_detach+0x44/0xc0
  unbind_store+0xe0/0x104
  drv_attr_store+0x20/0x30
  sysfs_kf_write+0x48/0x70
  kernfs_fop_write+0x148/0x230
  __vfs_write+0x18/0x40
  vfs_write+0xdc/0x1c4
  ksys_write+0x68/0xf0
  __arm64_sys_write+0x18/0x20
  el0_svc_common.constprop.0+0x70/0x170
  do_el0_svc+0x20/0x80
  el0_sync_handler+0x134/0x1b0
  el0_sync+0x140/0x180
 Code: b40000c2 f9403a60 d2800084 a9400663 (f9401400)
 ---[ end trace 3875369841fb288a ]---

Fixes: f3b98e3 ("media: vsp1: Provide support for extended command pools")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
thehajime pushed a commit to thehajime/linux that referenced this pull request Aug 5, 2022
Calculate and check the full mmu_role when initializing the MMU context
for the nested MMU, where "full" means the bits and pieces of the role
that aren't handled by kvm_calc_mmu_role_common().  While the nested MMU
isn't used for shadow paging, things like the number of levels in the
guest's page tables are surprisingly important when walking the guest
page tables.  Failure to reinitialize the nested MMU context if L2's
paging mode changes can result in unexpected and/or missed page faults,
and likely other explosions.

E.g. if an L1 vCPU is running both a 32-bit PAE L2 and a 64-bit L2, the
"common" role calculation will yield the same role for both L2s.  If the
64-bit L2 is run after the 32-bit PAE L2, L0 will fail to reinitialize
the nested MMU context, ultimately resulting in a bad walk of L2's page
tables as the MMU will still have a guest root_level of PT32E_ROOT_LEVEL.

  WARNING: CPU: 4 PID: 167334 at arch/x86/kvm/vmx/vmx.c:3075 ept_save_pdptrs+0x15/0xe0 [kvm_intel]
  Modules linked in: kvm_intel]
  CPU: 4 PID: 167334 Comm: CPU 3/KVM Not tainted 5.13.0-rc1-d849817d5673-reqs lkl#185
  Hardware name: ASUS Q87M-E/Q87M-E, BIOS 1102 03/03/2014
  RIP: 0010:ept_save_pdptrs+0x15/0xe0 [kvm_intel]
  Code: <0f> 0b c3 f6 87 d8 02 00f
  RSP: 0018:ffffbba702dbba00 EFLAGS: 00010202
  RAX: 0000000000000011 RBX: 0000000000000002 RCX: ffffffff810a2c08
  RDX: ffff91d7bc30acc0 RSI: 0000000000000011 RDI: ffff91d7bc30a600
  RBP: ffff91d7bc30a600 R08: 0000000000000010 R09: 0000000000000007
  R10: 0000000000000000 R11: 0000000000000000 R12: ffff91d7bc30a600
  R13: ffff91d7bc30acc0 R14: ffff91d67c123460 R15: 0000000115d7e005
  FS:  00007fe8e9ffb700(0000) GS:ffff91d90fb00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000000000 CR3: 000000029f15a001 CR4: 00000000001726e0
  Call Trace:
   kvm_pdptr_read+0x3a/0x40 [kvm]
   paging64_walk_addr_generic+0x327/0x6a0 [kvm]
   paging64_gva_to_gpa_nested+0x3f/0xb0 [kvm]
   kvm_fetch_guest_virt+0x4c/0xb0 [kvm]
   __do_insn_fetch_bytes+0x11a/0x1f0 [kvm]
   x86_decode_insn+0x787/0x1490 [kvm]
   x86_decode_emulated_instruction+0x58/0x1e0 [kvm]
   x86_emulate_instruction+0x122/0x4f0 [kvm]
   vmx_handle_exit+0x120/0x660 [kvm_intel]
   kvm_arch_vcpu_ioctl_run+0xe25/0x1cb0 [kvm]
   kvm_vcpu_ioctl+0x211/0x5a0 [kvm]
   __x64_sys_ioctl+0x83/0xb0
   do_syscall_64+0x40/0xb0
   entry_SYSCALL_64_after_hwframe+0x44/0xae

Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: stable@vger.kernel.org
Fixes: bf627a9 ("x86/kvm/mmu: check if MMU reconfiguration is needed in init_kvm_nested_mmu()")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210610220026.1364486-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants