Posts

Showing posts with the label linux-kernel

Accessing process stack pointer from kernel space

Image
Clash Royale CLAN TAG #URR8PPP Accessing process stack pointer from kernel space I was able to get task_struct from current macro and am wondering if there is a way to get the process stack pointer from my custom sys_call to return to userspace(as readonly value)?? You have to tell what your custom sys_call does? – LethalProgrammer 6 hours ago 1 Answer 1 It's easy to get it's value in assembly, so try using this: #include <stdint.h> uint64_t getsp(void) { uint64_t sp; asm("mov %%rsp, %0" : "=rm" (sp)); return sp; } By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that you...

Xen domu IO freezes

Image
Clash Royale CLAN TAG #URR8PPP Xen domu IO freezes I installed xen in the Centos 7.4.1708 following the Xen4CentOS guide. And then I installed 3 dom-U guest (2 CentOS7, and 1 Windows server) with full virtualization. After the initial testing when I made system production available, only the linux systems periodically hangs but Windows server system is running alright. The xen kernel is 4.9.63-29.el7.x86_64. The dom-U linux hosts are CentOS 7 (3.10.0-693.5.2.el7.x86_64), and the windows host is Windows Server 2012 R2. The linux kernel for dom-U hosts hangs with the following kernel hang message: > [ 3746.780097] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. > [ 3746.780223] INFO: task jbd2/xvdb6-8:8173 blocked for more than 120 seconds. The tasks in above message are different depending what was running at that moment. The logs end at some point until the new reboot. Sometimes it's still possible to log on to the system, but nothing...

Linux- Out of Memory

Image
Clash Royale CLAN TAG #URR8PPP Linux- Out of Memory I was trying to see the working of oom_kill by invoking manually. I allocated memory dynamically and tried to use them infinitely with while loop at first and then with the for loop to test out of memory. But in the first case where I used the while loop it threw segmentation fault without swap and became unresponsive with swap whereas with the for loop out of memory (oom_kill) was invoked. Sample codes of both: First case: while: int main (void) { char* p; while (1) { p=malloc(1<<20); memset (p, 0, (1<<20)); } } Second case : for : int main (void) { int i, n = 0; char *pp[N]; for (n = 0; n < N; n++) { pp[n] = malloc(1<<20); if (pp[n] == NULL) break; } printf("malloc failure after %d MiBn", n); for (i = 0; i < n; i++) { ...