GNU Build System: Automake, Autoconf, Libtool

Reading Time: 4 minutes Brief GNU Build System: Automake, Autoconf, Libtool are a suite of programming tools used to make source code packages portable to many Unix-like systems. Why We Need Autotools: Autoconf: automatically generates configure script by scans of existing tree to find […]

Dynamic Linking Example

Reading Time: 4 minutes Following example covers API like dladdr, dlclose, dlerror, dlopen, dlsym and flags like RTLD_LAZY, RTLD_NOW, RTLD_GLOBAL, `RTLD_LOCAL, RTLD_NODELETE, RTLD_NOLOAD, RTLD_NEXT, RTLD_DEFAULT, etc. At First Sight, This Might Look Lengthy & Alien, But If You Spend 5 Min, You Might Get What You Looking […]

How Program Gets Run: Linux

Reading Time: 9 minutes I know it’s long, but please bear with me & have patience. How do we launch our programs? Do you know how programs get runs behind the screen when you double-click on it or you type ./a.out on shell As […]

How to hack C/C++ application using RTLD_NEXT with an easy example

Reading Time: 4 minutes While I was working as a core C library developer with my previous employer. I came across this RTLD_NEXT flag in dynamic linking which has the amazing capability and can be easily exploited or used for unethical purpose(Here I intend […]

Execute Threads Parallelly at Given Time: pthread_barrier_t

Reading Time: 2 minutes Why we need pthread_barrier_t? When multiple threads are working together, it might be required that the threads wait for each other at a certain event or point in the program before proceeding ahead. Let us say we have four threads, […]

Understand ELF file format

Reading Time: 8 minutes ELF is the file format used for object files (.os), binaries, shared libraries and core dumps in Linux. ELF has the same layout for all architectures, however endianness and word size can differ; relocation types, symbol types and the like […]

Unix Domain Socket

Reading Time: 3 minutes Brief A Unix domain socket or IPC socket is a data communications endpoint for exchanging data between processes executing on the same host operating system. The API for Unix domain sockets is similar to that of an Internet socket, but […]

A Bit About vfork

Reading Time: < 1 minutes What is vfork ? It’s a special case of a clone. It is used to create new processes without copying the page tables of the parent process. calling thread is suspended until the child call execve or _exit. Points To […]

Thread Conditional Wait with Mutex : pthread_cond_t

Reading Time: 2 minutes Brief Condition variables provide yet another way for threads to synchronize. While mutexes implement synchronization by controlling thread access to data, condition variables allow threads to synchronize based upon the actual value of data. Without condition variables, the programmer would […]

Error Handling : setjmp & longjmp

Reading Time: < 1 minutes Points To Catch As for the control flow: setjmp returns twice, and longjmp never returns. When you call setjmp for the first time, to store the environment, it returns zero, And then when you call longjmp, the control flow passes […]

Clone system call example

Reading Time: 2 minutes This is a quick article on Clone system call example without talking shit. So let’s see some pointers for the same : clone() creates a new process, in a manner similar to fork(). It is actually a library function layered on […]

Dealing with Multiple file descriptor : poll() system call

Reading Time: < 1 minutes Why use poll() ? Suppose you have to deal with multiple clients connected at the same time. A natural question, then, is: how can you read from multiple file descriptors (sockets) at once? Do you need to make some really […]

A Bit About mmap

Reading Time: 2 minutes Points to Catch mmap() is system call used to maps files or devices into memory Linux provides the mremap( ) system call for expanding or shrinking the size of a given mapping. POSIX defines the mprotect( ) interface to allow programs […]

Shared Memory IPC

Reading Time: 2 minutes Brief As the name suggests, shared memory is a memory that may be shared by multiple programs with an intent to provide communication among them or avoid redundant copies. Points To Catch shmget(): Creates a shared memory segment, The key argument could be […]

Signal Handling

Reading Time: 2 minutes Points To Catch Signals = software interrupts. The command kill -l on the bash would give us the following. Signals are also delivered to a process with the help of kill command. The manual page (man kill) of kill command says […]