kernel

Bidirectional message passing between 2 processes within an OS

ぃ、小莉子 提交于 2019-12-25 03:21:40
问题 PIPES are unidirectional and can be synchronous or asynchronous in communication. But how to create a Bidirectional Named pipe with one endpoint on one process and the other endpoint on other process both processes sharing the same memory and is present within the same operating system and communicating asynchronously. Is there a way to do it ? 回答1: On Linux you must use two pipes if you want full duplex communication. Solaris however has full duplex pipes. It sounds like a Unix-domain socket

Why ebpf program inside samples/bpf doesn't work?

时光毁灭记忆、已成空白 提交于 2019-12-24 18:31:20
问题 GOAL: write a new ebpf example within samples/bpf directory in the kernel source tree of 4.18.0, compile and execute it. PROBLEM: after compiling it when I run sudo ./mine it just terminates. mine_kern.c #include <uapi/linux/bpf.h> #include <uapi/linux/if_ether.h> #include <uapi/linux/ip.h> #include <linux/in.h> #include <linux/if_packet.h> #include "bpf_helpers.h" int icmp_filter(struct __sk_buff *skb){ int proto = load_byte(skb, ETH_HLEN + offsetof(struct iphdr, protocol)); if(proto ==

Retrieving session Id in linux kernel (Kernel Space)

前提是你 提交于 2019-12-24 16:22:25
问题 I want to retrieve the sessionid of the current process in linux kernel (Kernel Space). I saw task_struct has a field sessionid but it is defined only when the macro CONFIG_AUDITSYSCALL is ON. So i tried to build the kernel with this macro ON but still i was not getting the result. Also I tried getting its value from function with CONFIG_AUDITSYSCALL on audit_get_sessionid(current) but was getting either -1 or junk value ( different from getsid(0) method in user space). I am struck at this

uboot学习之五-----uboot如何启动Linux内核

风流意气都作罢 提交于 2019-12-24 12:58:13
uboot和内核到底是什么? uboot实质就是一个复杂的裸机程序;uboot可以被配置也可以做移植; 操作系统内核本身就是一个裸机程序,和我们学的uboot和其他裸机程序没有本质的区别;区别就是我们操作系统运行起来后可以分为应用层和内核层,分层后,两层的权限不同,内存访问和设备操作的管理上更加精细(内核可以随便方位各种硬件,而应用程序只能被限制的访问硬件和内存地址) 直观来看:uboot的镜像是u-boot.bin,Linux系统的镜像是zImage,这两个东西其实都是两个裸机程序镜像。从系统启动的角度来讲的。内核和uboot就是裸机程序; 部署在SD卡中特定分区内 (1)一个完整的软件+硬件的嵌入式系统,静止时(未上电)bootloader、kernel、rootfs等必须的软件都以镜像的形式存储在启动介质中(x210中是inand/SD卡);运行时都是在DDR内存中运行的,与存储介质无关。上面两个状态都是稳定状态的,第三个状态是动态过程,即从静止态到运行态的过程,也就是启动过程。也就是这整个过程。 (2)动态启动过程就是从SD卡逐步搬移到DDR内存,并且运行启动代码进行相关硬件初始化和软件架构的建立,最终达到运行时稳定状态。 (3)静止时u-boot.bin zImage rootfs都在SD卡中,他们不可能随意存在SD卡的任意位置,因此我们需要对SD卡进行一个分区

Linux user space L2 control protocols

試著忘記壹切 提交于 2019-12-24 12:44:33
问题 I have a network device where a port of an Ethernet switch chip is connected to a CPU's network controller. The switch chip forwards packets from other ports to the CPU port with special header added (before MAC header) containing such information as ingress port etc. I can strip the header when receiving the packets in the network controller driver, so the Linux network stack can communicate with the switch in a normal way. My goal, however, is to pass some information in the special headers

How to make the process ignore some signal(like SIGHUP,SIGABRT,SIGABORT,SIGINT etc..)

末鹿安然 提交于 2019-12-24 12:01:30
问题 I am a newbie and have basic understanding of linux. Whenever the kernel encounters a signal for a particular process, first it checks the signal handler table in the process control block(PCB) of the particular process. If the signal handler is registered it calls the function. if the flag is SIG_DEFAULT then it calls the signal handler registered in the global signal table of kernel. If the flag is SIG_IGNORE then kernel just ignores the signal for the particular process. All signals have

Unknown symbol flush_tlb_all (err 0)

霸气de小男生 提交于 2019-12-24 09:16:01
问题 I tried to make a simple kernel module invalidating all tlb entries through user-level ioctl. Below is my example code [flush_tlb.c] /* * flush_tlb.c */ #include <linux/uaccess.h> #include <linux/fs.h> #include <linux/miscdevice.h> #include <linux/module.h> #include <linux/mm.h> #include <asm/tlbflush.h> #include <asm/tlb.h> #include "flush_tlb.h" MODULE_LICENSE("GPL"); static long flush_tlb_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { int ret = 0; unsigned int size = _IOC

Run command at gdb breakpoint, neither c or cont works

柔情痞子 提交于 2019-12-24 08:17:41
问题 I'm trying to run a command that prints information when a breakpoint is hit: (gdb) break XXX (gdb) command > printf "xx=%p, yy=%d\n", p1, p2 > end It seems to work, I see lots of outputs. But suddenly it stopped working, and I saw a line says: ---Type <return> to continue, or q <return> to quit--- Am I missing something? I don't need to see anything on the screen now, 'cause I already enabled logging in gdb. 回答1: But suddenly it stopped working, and I saw a line says: Try run set pagination

Why Does Jupyter Notebook Crashes?

可紊 提交于 2019-12-24 08:12:06
问题 I am using Python 2.7 on Windows 10 (64) computer. Whenever I work with Jupyter notebook, it dies for no reason. Sometimes it dies while I am using it, sometimes when it is idle. I receive below error messages. Error message screenshot When I check the command line, the error says: Assertion failed: Connection reset by peer (bundled\zeromq\src\signaler.cpp:181) I'd appreciate any help on how to fix this problem. Thanks 来源: https://stackoverflow.com/questions/37083950/why-does-jupyter-notebook

x86 ASM: DD Being Used as an “Instruction”?

非 Y 不嫁゛ 提交于 2019-12-24 07:49:43
问题 In the following x86 assembly code: dd 0x1BADB002 dd 0x00 dd - (0x1BADB002+0x00) The values don't seem to be assigned to any variables. So what does this snippet of code do? I've heard something about it being stored in memory, but where exactly? 回答1: dd is a "pseudo-instruction" that assembles 4-byte constants into the output, the same way that add eax,eax assembles 0x01 0xc0 into the output. The NASM manual section 3.2 Pseudo-Instructions describes db / dw / dd and so on. In this case, as