Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all 6372 articles
Browse latest View live

modpost has source but didn't compile

$
0
0

I am building a module in yocto environment.

In local.conf of yocto, I have:

IMAGE_INSTALL_append += " kernel-modules kernel-devsrc kernel-dev"

When compiling the module, I see:

root@genericx86-64:/home/srmt-1.5.0/srmt-lkm# make
make -C /lib/modules/5.4.20-yocto-standard/build M=/home/srmt-1.5.0/srmt-lkm modules
make[1]: Entering directory '/lib/modules/5.4.20-yocto-standard/build'
  Building modules, stage 2.
  MODPOST 0 modules
/bin/sh: scripts/mod/modpost: No such file or directory
make[2]: *** [scripts/Makefile.modpost:94: __modpost] Error 127
make[1]: *** [Makefile:1609: modules] Error 2
make[1]: Leaving directory '/lib/modules/5.4.20-yocto-standard/build'
make: *** [Makefile:39: all] Error 2

I checked the folder, it has the source files but didn't compile.

root@genericx86-64:/usr/src/kernel/scripts/mod# ls -l
total 156
-rw-r--r-- 1 root root   826 Mar  9  2018 Makefile
-rw-r--r-- 1 root root  6645 Mar  9  2018 devicetable-offsets.c
-rw-r--r-- 1 root root    54 Mar  9  2018 empty.c
-rw-r--r-- 1 root root 43216 Mar  9  2018 file2alias.c
-rw-r--r-- 1 root root  1269 Mar  9  2018 mk_elfconfig.c
-rw-r--r-- 1 root root 71683 Mar  9  2018 modpost.c
-rw-r--r-- 1 root root  5228 Mar  9  2018 modpost.h
-rw-r--r-- 1 root root 11691 Mar  9  2018 sumversion.c

SIGSEGV raised by 32 bit application vs 64 bit applicationn

$
0
0

I've been learning buffer overflows and noticed something strange.

void vuln()
{
    char buf[180];

    gets(buf);
    puts(buf);

    return;
}

int main()
{
    __gid_t egid;

    setvbuf(stdout, 0x0, 2, 0);
    egid = getegid();
    setresgid(effective_gid, effective_gid, effective_gid);

    puts("You know who are 0xDiablos: ");
    vuln();
    return 0;
}

I compiled the code as 64 bit and 32 bit.

gcc test.c -fno-stack-protector -o 64bit.o
gcc test.c -fno-stack-protector -o 32bit.o -m32 

I than passed more than 180 A's as input on the 32bit application under strace.

--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x41414141} ---
+++ killed by SIGSEGV (core dumped) +++

I then performed the same test on the 64bit application under strace.

--- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=NULL} ---
+++ killed by SIGSEGV (core dumped) +++

Why does the 64 bit show that the invalid memory references was NULL, should't it be 0x41414141 like the 32bit SIGSEGV?

not sure if this matters but my kernel is 5.5.8.

Thorlabs Kinesis killing Jupyter kernel

$
0
0

I am trying to use a Python script in a Jupyter notebook to control a Thorlabs Kinesis Position Aligner. My colleague wrote the script and it works fine on their computer, but when I run it, the kernel dies and throws the error "The kernel appears to have died. It will restart automatically."

The part of the code in question is shown below. (It is sufficient to test problem if Kinesis is installed.) It requires having Thorlabs Kinesis software installed, which I do, and have checked that Kinesis runs the device properly. As far as I can tell all of the packages and permissions are the same on my computer as on my colleague's.

import clr #pip install pythonnet for this.
import sys
import time
import numpy as np

from System import String
from System import Decimal
from System.Collections import *

sys.path.append(r"C:\Program Files\Thorlabs\Kinesis") #double checked that this is correct location

# add .net reference and import so python can see .net
clr.AddReference("Thorlabs.MotionControl.Controls")
import Thorlabs.MotionControl.Controls   #this line kills the kernel

clr.AddReference("Thorlabs.MotionControl.DeviceManagerCLI")
clr.AddReference("Thorlabs.MotionControl.GenericPiezoCLI")
clr.AddReference("Thorlabs.MotionControl.KCube.PositionAlignerCLI")
clr.AddReference("Thorlabs.MotionControl.KCube.PiezoCLI")

from Thorlabs.MotionControl.DeviceManagerCLI import *  #these three imports work fine
from Thorlabs.MotionControl.GenericPiezoCLI import *
from Thorlabs.MotionControl.KCube.PositionAlignerCLI import *

The line import Thorlabs.MotionControl.Controls seems to be the one killing the kernel. The other imports below it seem to work fine.

I have tried:

  • Updating numpy,
  • Updating Anaconda,
  • Uninstalling and reinstalling Anaconda as both local user and admin.

Help and suggestions greatly appreciated.

linux kernel check if process is still running

$
0
0

I'm working in kernel space and I want to find out when an application has stopped or crashed. When I receive an ioctl call, I can get the struct task_struct where I have a lot of information regarding the process of the application. My problem is that I want to periodically check if the process is still alive or better yet, to have some asynchronous call when the process is killed.

My test environment was on QEMU and after a while in the application I've run a system("kill -9 pid"). Meanwhile in the kernel I've had a periodical check on task_struct with:
volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
static inline int pid_alive(struct task_struct *p)

The problem is that my task_struct pointer seems to be unmodified. Normally I would say that each process has a task_struct and of course it is corespondent with the process state. Otherwise I don't see the point of "volatile long state"

What am I missing? Is it that I'm testing on QEMU, it is that I've tested checking the task_struct in a while(1) with an msleep of 100? Any help would be appreciated.

I would be partially happy if I could receive the pid of the application when the app is closing the file descriptor of the module ("/dev/driver").

Thanks!

Compiling AOSP Kernel with KASAN

$
0
0

I'm struggling to compile the Linux kernel for usage in AOSP with KASAN & KCOV enabled. I then intend to flash it to a Pixel 2 XL (taimen) and use Syzkaller to fuzz it.

This is what I did:

1. Build unmodified kernel (works)

My reference: https://source.android.com/setup/build/building-kernels

  • Determine branch... android-msm-wahoo-4.4-pie-qpr2
  • $ repo init -u https://android.googlesource.com/kernel/manifest -b android-msm-wahoo-4.4-pie-qpr2
  • $ repo sync -j8 -c
  • $ build/build.sh -j8
  • Connect phone via USB
  • $ adb reboot bootloader
  • $ fastboot boot out/android-msm-wahoo-4.4/dist/Image.lz4-dtb (Works fine)

2. Build kernel with KASAN & KCOV (fails)

POST_DEFCONFIG_CMDS="check_defconfig && update_debug_config"
function update_debug_config() {
    ${KERNEL_DIR}/scripts/config --file ${OUT_DIR}/.config \
         -d CONFIG_KERNEL_LZ4 \
         -e CONFIG_KASAN \
         -e CONFIG_KASAN_INLINE \
         -e CONFIG_KCOV \
         -e CONFIG_SLUB \
         -e CONFIG_SLUB_DEBUG \
         --set-val FRAME_WARN 0
    (cd ${OUT_DIR} && \
     make O=${OUT_DIR} $archsubarch CC=${CC} CROSS_COMPILE=${CROSS_COMPILE} olddefconfig)
}
  • $ build/build.sh -j8

But after CHK include/generated/compile.h I get many undefined reference errors to various asan-symbols, e.g. undefined reference to __asan_alloca_poison.

I did some research and read about adding -fsantitize=address and -shared-libasan (or -shared-libsan) to CFLAGS AND LDFLAGS. I did that (for which I had to hard-code it into build/build.sh, isn't there a more convenient way?), but to no avail:

I ended up with aarch64-linux-android-ld: -f may not be used without -shared.

So I tried reading up on ld's -shared flag and adding it to LDFLAGS (more like a guess really). Resulted in aarch64-linux-android-ld: -r and -shared may not be used together.

Really don't know where to go from here and what's going wrong in general?

Any help really appreciated!


Update: At first it seemed that using gcc instead of clang seemed to resolve the issue. The phone boots up fine, buttons work, but the touchscreen does not respond. I am looking into the reasons...

C pointers casting

$
0
0

I am trying to print the first byte if a function in the Kernel. The function I want to print is 'filldir'. I found it in the kernel using /proc/kallsyms

it's code is (address is ffffffff812e6020) -

    ffffffff812e6020:       e8 0b b9 91 00          callq  0xffffffff81c01930
    ffffffff812e6025:       55                      push   %rbp
    ffffffff812e6026:       48 89 e5                mov    %rsp,%rbp
    ffffffff812e6029:       41 57                   push   %r15

I found the same address (I think so) using this code in my kernel module -

    typedef unsigned long psize;
    (psize *) filldir;

    filldir= (void *)kallsyms_lookup_name("filldir");
    printk("rooty: sys_call_table found at %p\n", filldir);

and got - 000000001663973a, I don't know why there is a difference, I tried casting it to long and unsigned long but the result is same.

so my first question is, why there is a difference ? I am pretty sure that it's the same address that is just printed in different way ... how can I get the right value ?

My second question, I am trying to print the first byte of the function (e8), but I have no idea how to do that.

i tried these options -

    printk("%x", *filldir);
    printk("%x", *(unsigned char*)filldir); 
    printk("%x", (unsigned char*)filldir[0]); 

but none of them worked, never got e8.

How can I print the first byte of a function when I have the pointer to the function?

ImportError: No module named 'Kernel'

$
0
0

I'm using windows 10 and working on a chatbot project and use aiml integrated with python I got this error

import aiml
File"C:\Python34\lib\site-packages\aiml\__init__.py", line 4, in <module>  
from Kernel import Kernel  
ImportError: No module named 'Kernel'

when running the integration code here

 import aiml

    # Create the kernel and learn AIML files 
      kernel = aiml.Kernel() 
      kernel.learn("std-startup.xml") 
      kernel.respond("load aiml b")    
    # Press CTRL-C to break this loop while True:
      print (kernel.respond(raw_input("Enter your message >> ")))

and my aiml directory contains the file__init__.py here's it's content

__all__ = []

# The Kernel class is the only class most implementations should need. 
  from Kernel import Kernel

also file Kernel exists .. so what is the problem ?

kernel Write Protection difference between 4.15 and 5.3

$
0
0

I am writing a simple rootkit (just to learn how the kernel works ;)) that is hooking the filldir function in the kernel.

I am using the inline hook method - writing a JMP opcode in the beginning of the function.

the function looks like -

    struct sym_hook *sa;
    unsigned char o_code[HIJACK_SIZE], n_code[HIJACK_SIZE];

    unsigned long o_cr0;

    // mov rax, $addr; jmp rax
    memcpy(n_code, "\x48\xb8\x00\x00\x00\x00\x00\x00\x00\x00\xff\xe0", HIJACK_SIZE);
    *(unsigned long *)&n_code[2] = (unsigned long)new;

    printk("Hooking function 0x%p with 0x%p\n", target, new);

    memcpy(o_code, target, HIJACK_SIZE);

    write_cr0(read_cr0() & (~ 0x10000));
    memcpy(target, n_code, HIJACK_SIZE);
    write_cr0(read_cr0() | 0x10000);

While compiling and testing on Ubuntu 16.04 (kernel 4.15) everything works just fine, but when using Ubuntu 19.10 (Kernel 5.3) - I get a crash every-time I insmod.

the crash is because of permissions when writing to protected memory - that means (I think so) that the write protection disabling line is not working (write_cr0(read_cr0() & (~ 0x10000));).

I didn't found any documentation explaining why it's not working on the new Kernel version, is it really a related to the kernel version? or I am doing something wrong ? My guess is that there was added some new protection method in the new version and the 'old' protection disabling is not working any more ...

also, if it's really kernel version issue, is there a way to disable that protection in the new kernel version?

btw, tried also disabling using this code -

  unsigned long cr0 = read_cr0();
  clear_bit(16, &cr0);
  asm volatile("mov %0,%%cr0" : "+r"(cr0), "+m"(__force_order));

Not detecting Device Tree, Kernel and Vendor in AOSP Source Project

$
0
0

So, I'm trying to build AOSP Android OS for my device Vivo Y51L and i've downloaded the source code from source.android.com (Version - Android 9 PI). I've also downloaded the device's source code which is :-

Device tree:https://github.com/kumajaya/android_device_vivo_pd1510

Kernel source:https://github.com/kumajaya/android_kernel_vivo_msm8916

Vendor blobs:https://github.com/kumajaya/proprietary_vendor_vivo

I've found this device source code from here : https://forum.xda-developers.com/android/development/gift-vivo-y51-developer-t3880213

I'm trying to build OS for my device and I've placed the kernel source in ~/aosp/kernel/vivo/

vendor in ~/aosp/vendor/vivo/

device tree in ~/aosp/device/vivo/

I was building the default aosp_arm-eng and it builts successfully and ran in emulator successfully, and now i want to build the OS for vivo y51l and after adding this device source and created the local_manifests in .repo folder, and did repo sync.

But still it is not showing the option for vivo device in lunch command to build the OS for vivo y51l and i did tried to look some kernel compiling in aosp but they're no help, because they have already build script but this one has not.

Please take a look in the Vivo Y51L device source code and please tell how can i compile the device tree, kernel and vendor.

I'm hoping someone will reply to my question.

Platform I'm using to build the OS: Ubuntu 18.04 LTS

How I can retrieve encryption keys for my IPsec/L2TP session?

$
0
0

I'm investigating IPsec protocols stack with wireshark. If I need to decrypt tunnel's traffic, I use ip xfrm state command, which returns all needed stuff. During ip source code investigation, I discovered that encryption keys are retrieved from kernel via NETLINK. So, I was wondering if there is any other way to get this info from kernel bypassing the NETLINK? Perhaps, there is some ioctl to do this. I would like to know where in the kernel code these keys are stored.

Lower IRQL to PASSIVE_LEVEL without previous call to KeRaiseIrql in DriverEntry

$
0
0

I am writing a driver for Windows NT, which is being loaded via the turluda driver loader TDL. The loader loads the driver image, manually maps it in kernel memory, and executes the entry point after resolving the imports.

My problem is DriverEntry is being called at DISPATCH_LEVEL. I need to lower it to PASSIVE_LEVEL so I can use functions like PsCreateSystemThread. How can I lower it? I can't use KeLowerIrql as it needs a previous IRQL value passed in from any of the KeRaise* functions.

Understand kernel panic ( RHEL with kernel (2.6.32-754.23.1.el6.x86_64) )

$
0
0

I am a beginner w.r.t analyzing kernel panics i would like to know if i am missing anything in my analysis Following is part of the dump generated during Panic

<6>generic-usb 0003:14E1:3500.0062: input,hidraw3: USB HID v1.10 Device [PenMount PM1302] on usb-0000:00:1d.0-1.6.1/input0
<6>CPUFREQ: ondemand sampling_rate_max sysfs file is deprecated - used by: sosreport
<6>CPUFREQ: Per core ondemand sysfs interface is deprecated - sampling_rate_max
<6>CPUFREQ: Per core ondemand sysfs interface is deprecated - sampling_rate_min
<6>CPUFREQ: Per core ondemand sysfs interface is deprecated - sampling_rate
<6>CPUFREQ: Per core ondemand sysfs interface is deprecated - up_threshold
<6>CPUFREQ: Per core ondemand sysfs interface is deprecated - ignore_nice_load
<6>CPUFREQ: Per core ondemand sysfs interface is deprecated - powersave_bias
<6>warning: `turbostat' uses 32-bit capabilities (legacy support in use)
<4>FileAccess module was removed successfully. Version is - 10.6.0.201
<1>BUG: unable to handle kernel paging request at ffffffffa01f1b24
<1>IP: [<ffffffffa01f1b24>] 0xffffffffa01f1b24
<4>Kernel PGD 1a91067 PUD 1a95063 PMD 81caa6067 PTE 0
<4>User   PGD 82e362067 PUD 82e365067 PMD 0 
<4>Oops: 0010 [#1] SMP 
<4>last sysfs file: /sys/devices/system/cpu/online
<4>CPU 2 
<4>Modules linked in: snd_seq_dummy nfs lockd fscache auth_rpcgss nfs_acl sunrpc i915 nvidia_modeset(P)(U) ip6table_mangle ip6table_filter ip6_tables coretemp cpufreq_ondemand acpi_cpufreq freq_table mperf ipv6 ipt_LOG xt_limit nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack iptable_filter iptable_mangle ip_tables microcode iTCO_wdt iTCO_vendor_support sg joydev serio_raw i2c_i801 lpc_ich mfd_core shpchp snd_hda_codec_hdmi snd_hda_codec_realtek e1000e ptp snd_hda_codec_generic pps_core snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc nvidia_drm(P)(U) nvidia(P)(U) ipmi_msghandler ext4 jbd2 mbcache sr_mod cdrom sd_mod crc_t10dif ahci xhci_hcd drm_kms_helper drm i2c_algo_bit i2c_core video output dm_mirror dm_region_hash dm_log dm_mod [last unloaded: fileaccess_mod_100600201]
<4>
<4>Pid: 15740, comm: python Tainted: P           -- ------------    2.6.32-754.23.1.el6.x86_64 #1 Advantech AxisPC/MAHOBAY
<4>RIP: 0010:[<ffffffffa01f1b24>]  [<ffffffffa01f1b24>] 0xffffffffa01f1b24
<4>RSP: 0018:ffff88051b4afef8  EFLAGS: 00010202
<4>RAX: 0000000000000005 RBX: 0000000000000000 RCX: 0000000000000002
<4>RDX: ffff880822f2d198 RSI: ffff880686ea0280 RDI: ffff880587a41000
<4>RBP: ffff88051b4aff48 R08: 0000000000000000 R09: 0000000000000000
<4>R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000241
<4>R13: 0000000000e2f940 R14: 00000000000001b6 R15: 0000000000000000
<4>FS:  00007f972d53d700(0000) GS:ffff88002c300000(0000) knlGS:0000000000000000
<4>CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
<4>CR2: ffffffffa01f1b24 CR3: 000000056067e000 CR4: 00000000001607e0
<4>DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
<4>DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
<4>Process python (pid: 15740, threadinfo ffff88051b4ac000, task ffff880576372ab0)
<4>Stack:
<4> ffffffff815642c2 ffffffff815642ce ffffffff815642c2 ffffffff815642ce
<4><d> ffffffff815642c2 0000000000000000 0000000000000000 0000000000000000
<4><d> 0000000000000000 0000000000000000 0000000000000000 ffffffff815643a7
<4>Call Trace:
<4> [<ffffffff815642c2>] ? system_call_after_swapgs+0xa2/0x152
<4> [<ffffffff815642ce>] ? system_call_after_swapgs+0xae/0x152
<4> [<ffffffff815642c2>] ? system_call_after_swapgs+0xa2/0x152
<4> [<ffffffff815642ce>] ? system_call_after_swapgs+0xae/0x152
<4> [<ffffffff815642c2>] ? system_call_after_swapgs+0xa2/0x152
<4> [<ffffffff815643a7>] system_call_fastpath+0x35/0x3a
<4> [<ffffffff815642ce>] ? system_call_after_swapgs+0xae/0x152
<4>Code:  Bad RIP value.
<1>RIP  [<ffffffffa01f1b24>] 0xffffffffa01f1b24
<4> RSP <ffff88051b4afef8>
<4>CR2: ffffffffa01f1b24

as far as i understand the panic is caused because of

<4>FileAccess module was removed successfully. Version is - 10.6.0.201
<1>BUG: unable to handle kernel paging request at ffffffffa01f1b24

How does one enable Intel Processor Tracing (IPT) in a virtualized environment?

$
0
0

I am attempting to run Alex Ionescu's WinIPT interface in a virtual machine, and having no success. (This is a Windows 10 Pro host running a Windows 10 VM and both are the 18363 update)

I have successfully built and run Intel's driver as well as Alex's toolchain on the host, and processed the trace with ptxed. I have also run Intel's cpuid utility, and verified that the INTEL_PROCESSOR_TRACE feature is active on the host. However, when I run the utility in a VM, it does not display the INTEL_PROCESSOR_TRACE flag, and indeed, the driver returns an error that the feature is not enabled.

I've attempted to run the same setup in several different virtual environments, including the latest versions of VirtualBox, VMWare Workstation, and Hyper-V.

When I enable the Hyper-V Platform, it silently disables the INTEL_PROCESSOR_TRACE feature on the host.

VMWare Workstation doesn't disable it directly, but when I tried to run my trace tool again on the host after starting the VM, it threw a BSoD, so I don't have high hopes there.

VirtualBox at least didn't take away any functionality, but even when I enabled the VT-x passthrough option, it still didn't have the flag set to enable IPT.

According to Microsoft, a process theoretically exists to enable this in Hyper-V, though I run into the aforementioned problem where it ends up disabled on my host:

Enabling performance monitoring components in a virtual machine

Has anyone gotten this to work? I'd prefer a solution in my current environment (Windows VM on Windows host), but I'd appreciate any insights using perf on Linux or any other approaches. I've also found some posts and questions from 2017 indicating IPT wasn't supported 'yet', but nothing within the past year or so. The technology and architecture seem to still be evolving, so really I'd like to know if anyone has had success in any form, as well as any insights on what to do or avoid.

Other resources:

Background on Intel Processor Tracing: Processor Tracing

Edited to add (2/10/2020)

Looking at the Microsoft instructions more carefully, they mention that you need "An Intel processor that supports IPT and the PT2GPA feature" to enable IPT in a virtual machine. According to Intel, the only architecture they have listed as supporting PT2GPA is Ice Lake.

The computer I'm currently working with is running an earlier microarchitectutre (Coffee Lake), which may explain the behavior I'm seeing where IPT is fine on the host. Can anyone confirm that they have it working on a more recent processor?

how to get physical memory including reserved memory from linux kernel?

$
0
0

From linux's proc.txt:

MemTotal: Total usable ram (i.e. physical ram minus a few reserved

But how to get the whole physical ram including reserved memory from linux kernel?

Spyder: Kernel not loading and shows error

$
0
0

I have uninstalled and reinstalled different versions of Anaconda but unable to start the kernel. I have attached the error log that shows up in the kernel.

Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site‑packages\spyder\plugins\ipythonconsole\plugin.py", line 1209, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\manager.py", line 301, in start_kernel
kernel_cmd, kw = self.pre_start_kernel(**kw)
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\manager.py", line 248, in pre_start_kernel
self.write_connection_file()
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py", line 474, in write_connection_file
kernel_name=self.kernel_name
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py", line 138, in write_connection_file
with secure_write(fname) as f:
File "C:\ProgramData\Anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_core\paths.py", line 424, in secure_write
win32_restrict_file_to_user(fname)
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_core\paths.py", line 359, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed: The specified procedure could not be found.````

How to "fix" localversion in Kernel menuconfig?

$
0
0

I'm building Kernel for my embedded ARM-based system (system is a ARM7 VARISCITE DART6UL). Since I need to build Kernel appending my local version to it, I read it's possible to edit (using make menuconfig) the right local version I need, writing in General setup->"Local version - append to kernel release". Commands I execute to edit .config kernel are the following:

make mrproper make imx6ul-var-dart_defconfig make menuconfig

My question is: why my kernel release that I appended in the graphical kernel menu config file doesn't still remain saved? Everytime I enter in menuconfig it disappear: Is there a way to fixed it, avoiding the need to rewrite each time?

Regards

Paolo

How to create a patch or recipe to change kernel config

$
0
0

We can change kernel config manually by

bitbake -c menuconfig virtual/kernel

How to create a patch or recipe ( or other ways ) to modify kernel config automatically?

How to set a custom R installation for using rpy2 in Jupyter?

$
0
0

I have a conda environment which I made available as a kernel to my Jupyter instance by running: python -m ipykernel install --user --name my-env-name --display-name "Python (my-env-name)"

With this environment I wanted to use R in Jupyter taking advantage of rpy2's %load_ext rpy2.ipython command to enable the %%R magic. However, rpy2 is employing my global R and not the one installed in my conda environment. I checked my R home via:

%%R
R.home()

(With rpy2< 3.0.0 you can also check via %run -m rpy2.situation in my Jupyter notebook (source), however this seems to be broken in rpy2>=3.1.0 ... at least for me throwing UnboundLocalError: local variable 'rpy2' referenced before assignment).

How can I make my Jupyter notebook load the R installation from my conda environment?

How to change kernel security level from 0 to 1 after `sysctl kern.securelevel`

$
0
0

When I run sysctl kern.securelevel on my Mac, it gives me a value of 0.

I'd like to increase the kernel security level on my computer. I want it to give me a 1.

Can I do that?

Kernel crash - general protection fault: 0000 1 PREEMPT SMP

$
0
0
WARNING: cannot access module kallsyms
crash: inconsistent active task indications for CPU 7:
runqueue: ffff88880f540b80 "in:imuxsock" (default)
current_task: ffff888810361700 "systemd-journal"
SYSTEM MAP: /root/System.map-4.19.81-nn14-server
DEBUG KERNEL: /root/dbg/usr/lib/debug/boot/vmlinux-4.19.81-nn14-server (4.19.81-nn14-server)
DUMPFILE: dump.202003222047
CPUS: 8
DATE: Sun Mar 22 13:46:50 2020
UPTIME: 20:17:04
LOAD AVERAGE: 4.21, 4.26, 4.28
TASKS: 1386
NODENAME: edge3
RELEASE: 4.19.81-nn14-server
VERSION: #nn14 SMP PREEMPT Fri Mar 6 06:43:38 PST 2020
MACHINE: x86_64 (2194 Mhz)
MEMORY: 32 GB
PANIC: "general protection fault: 0000 1 PREEMPT SMP"
PID: 3959
COMMAND: "dp-ipc18"
TASK: ffff8883f9c60000  [THREAD_INFO: ffff8883f9c60000]
CPU: 6
STATE: TASK_RUNNING (PANIC)

crash> bt
PID: 3959 TASK: ffff8883f9c60000 CPU: 6 COMMAND: "dp-ipc18"
#0 [ffffc90004253b00] machine_kexec at ffffffff81055d8d
#1 [ffffc90004253b60] __crash_kexec at ffffffff811159ea
#2 [ffffc90004253c28] crash_kexec at ffffffff811171fe
#3 [ffffc90004253c50] oops_end at ffffffff81029ce4
#4 [ffffc90004253c70] general_protection at ffffffff810020ce
[exception RIP: no symbolic reference]
RIP: ffffffffb0364373 RSP: ffffc90004253d28 RFLAGS: 00010206
RAX: 0006000800000000 RBX: ffff88804664e8c0 RCX: 00000000000000c1
RDX: 000065af80000000 RSI: 0005888800000000 RDI: 0000000000000001
RBP: ffff88804664f278 R8: 000000000000001f R9: 0000000000000020
R10: ffff88804664f2d8 R11: ffff88804664f378 R12: ffff8887b29f9840
R13: 0000000000000020 R14: ffff8887b2a05cc0 R15: ffff888000000000
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
#5 [ffffc90004253de0] do_vfs_ioctl at ffffffff81242d23
#6 [ffffc90004253e00] ksys_ioctl at ffffffff812430c7
#7 [ffffc90004253e30] __x64_sys_ioctl at ffffffff81243111
#8 [ffffc90004253e38] do_syscall_64 at ffffffff81007576
#9 [ffffc90004253e50] entry_SYSCALL_64_after_hwframe at ffffffff8100112b
[exception RIP: unknown or invalid address]
RIP: 000000000000002b RSP: 0000000000000000 RFLAGS: 0000002b
RAX: 000065bbf063b4bd RBX: 000065bbf063b4bd RCX: 0000000000000033
RDX: 0000000000000293 RSI: 000065bbd8e62370 RDI: 000000000000002b
RBP: 0000000000000001 R8: 0000000000000001 R9: 000000000000004b
R10: 0000146ecaf84801 R11: 0000000000000001 R12: 0000146ecb4ed5a0
R13: 0000146ecb4ee240 R14: 000065b75403ba40 R15: 000000000000002b
ORIG_RAX: 000065bbd8e62270 CS: 65bbd8e62250 SS: 0000
bt: WARNING: possibly bogus exception frame
crash> sym ffffffffb0364373
sym: invalid address: ffffffffb0364373

dmesg example log:

[291180.979739] CPU: 6 PID: 3959 Comm: dp-ipc18 Kdump: loaded Tainted: G U OE 4.19.81-nn14- 
server #nn14
[291180.979878] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference 
Platform, BIOS 6.00 12/12/2018
[291180.980030] RIP: 0010:[<ffffffffb0364373>] kni_fifo_trans_pa2va+0x83/0x120 [rte_kni]
[291180.980141] Code: 46 d0 4c 89 f7 e8 9d fc ff ff 85 c0 41 89 c5 0f 84 98 00 00 00 8d 40 
ff 49 89 ea 4c 8d 9c c3 c0 09 00 00 49 8b 02 4a 8d 34 38 <48> 8b 16 48 2b 56 08 48 01 d0 49 
89 82 00 01 00 00 0f b7 7e 14 85
[291180.980382] RSP: 0018:ffffc90004253d28 EFLAGS: 00010206
[291180.980462] RAX: 0006000800000000 RBX: ffff88804664e8c0 RCX: 00000000000000c1
[291180.980564] RDX: 000065af80000000 RSI: 0005888800000000 RDI: 0000000000000001
[291180.980665] RBP: ffff88804664f278 R08: 000000000000001f R09: 0000000000000020
[291180.980767] R10: ffff88804664f2d8 R11: ffff88804664f378 R12: ffff8887b29f9840
[291180.980868] R13: 0000000000000020 R14: ffff8887b2a05cc0 R15: ffff888000000000
[291180.980970] FS: 000065bbd8e63700(0000) GS:ffff88881fb80000(0000) knlGS:0000000000000000
[291180.981090] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[291180.981181] CR2: 000055a41a203018 CR3: 0000000001d88002 CR4: 00000000003606f0 shadow 
CR4: 00000000003606f0
[291180.981354] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[291180.981465] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[291180.981576] Call Trace:
[291180.981631] [<ffffffffb0365278>] kni_net_release_fifo_phy+0x48/0x60 [rte_kni]
[291180.981745] [<ffffffffb03630ce>] kni_dev_remove+0x2e/0x50 [rte_kni]
[291180.981865] [<ffffffffb0363e35>] kni_ioctl_release+0x235/0x290 [rte_kni]
[291180.981973] [<ffffffffb0363eb7>] kni_ioctl+0x27/0x50 [rte_kni]
[291180.982081] [<ffffffff81242d23>] do_vfs_ioctl+0x93/0x3d0
[291180.982192] [<ffffffff812430c7>] ksys_ioctl+0x67/0x80
[291180.982280] [<ffffffff81243111>] __x64_sys_ioctl+0x11/0x20
[291180.982376] [<ffffffff81007576>] do_syscall_64+0x56/0x130
[291180.982468] [<ffffffff8100112b>] entry_SYSCALL_64_after_hwframe+0x44/0xa7

You can see here that the backtrace using crash utility and dmesg log are totally different. In dmesg log it shows that the crash happened due to function calls in a dynamic loadable kernel module but in crash utility there is no sign of it

I even used 'mod -s rte_kni ./rte_kni.o' - compiled version of kernel module with debug symbols but still crash utility shows the RIP as invalid address and there is no symbolic reference.

It is quite hard debugging what exactly lead to crash , please help in debugging this kernel crash

Viewing all 6372 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>