Skip to content
Advertisement

Tag: c++

Understanding the strcmp function of gnu libc

Here is the strcmp function that i found in the glibc: This is a pretty simple function where the body of while initiates c1 and c2 with the value of *s1 and *s2 and continues till either c1 is nul or the values of c1 and c2 are equal, then returns the difference between c1 and c2. What i didn’t

Finding mapped memory from inside a process

Setup: Ubuntu 18×64 x86_64 application Arbitrary code execution from inside the application I’m trying to write code which should be able to find structures in memory even with ASLR enabled. Sadly, I couldn’t find any static references to those regions, so I’m guessing I have to use the bruteforce way and scan the process memory. What I tried to do

Understanding read syscall

I’m reading man read manual page and discovered that it was possible to read less then the desired number of bytes passed in as a parameter: It is not an error if this number is smaller than the number of bytes requested; this may happen for example because fewer bytes are actually available right now (maybe because we were close

Timing/Clocks in the Linux Kernel

I am writing a device driver and want to benchmark a few pieces of code to get a feel for where I could be experiencing some bottlenecks. As a result, I want to time a few segments of code. In userspace, I’m used to using clock_gettime() with CLOCK_MONOTONIC. Looking at the kernel sources (note that I am running kernel 4.4,

Linux C program: How to find the library to which a function belongs

Say at runtime, I want to find out where a function “printf” is defined. How would I do this? My first attempt was to print out the address of “printf” and compare it against the virtual address mapping of the process: my program: output: However, this says the function is defined in my own program! Shouldnt it be a call

C – in recursive function remove() dont work

obviating if the recursive function is well constructed or not, when i call the function on a directory Folder/file.txt. this code should delete file.txt, but when it reaches to remove dont work, and i dont know for what… Answer Reading the man page on readdir, it returns in d_name a file name, not a complete path, but remove and rmdir

Advertisement