Outils pour utilisateurs

Outils du site


blog

Diff image container

diffoci

Basic

diffoci diff --semantic alpine:3.18.2 alpine:3.18.3

Dump conflicting files to ~/diff

diffoci diff --semantic --report-dir=~/diff alpine:3.18.2 alpine:3.18.3

Compare local Docker images

diffoci diff --semantic docker://foo docker://bar
diffoci diff --platform=linux/amd64 podman://docker.io/library/centos:centos5 podman://registry.acme.local/ratpc-docker-release-local/centos:5.11

tar - brouillon

podman save 1ae98b2c895d | gzip > a.tar.gz
podman save b424fba01172 | gzip > b.tar.gz
 
pkgdiff -hide-unchanged a.tar.gz b.tar.gz

FIXME

2026/11/03 16:30 · Jean-Baptiste

Notes processus multi-thread

Source : https://stackoverflow.com/questions/17514771/ps-display-thread-name

th_name.c

#define _GNU_SOURCE
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
 
void *f1(void *arg) {
  (void)arg;
  printf("f1 : Starting sleep\n");
  sleep(30);
  printf("f1 : Done sleep\n");
  return NULL;
}
 
int main() {
  pthread_t f1_thread;
  pthread_create(&f1_thread, NULL, f1, NULL);
  pthread_setname_np(f1_thread, "f1_thread");
 
  printf("Main : Starting sleep\n");
  sleep(40);
  printf("Main : Done sleep\n");
  return 0;
}
$ ps -efLl | egrep "S UID|th_name"
F S UID          PID    PPID     LWP  C NLWP PRI  NI ADDR SZ WCHAN  STIME TTY          TIME CMD
0 S managem+   92168     599   92168  0    2  80   0 -  2741 hrtime 10:34 pts/2    00:00:00 ./th_name
1 S managem+   92168     599   92169  0    2  80   0 -  2741 hrtime 10:34 pts/2    00:00:00 ./th_name
0 S managem+   92176   64256   92176  0    1  80   0 -  1032 anon_p 10:34 pts/18   00:00:00 grep -E --color=auto S UID|th_name

$ ps -efTl | egrep "S UID|th_name"
F S UID          PID    SPID    PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY          TIME CMD
0 S managem+   92168   92168     599  0  80   0 -  2741 hrtime 10:34 pts/2    00:00:00 ./th_name
1 S managem+   92168   92169     599  0  80   0 -  2741 hrtime 10:34 pts/2    00:00:00 ./th_name
0 S managem+   92187   92187   64256  0  80   0 -  1032 anon_p 10:34 pts/18   00:00:00 grep -E --color=auto S UID|th_name

$ ps -C th_name -L -o nlwp,pid,lwp,comm,command
NLWP     PID     LWP COMMAND         COMMAND
   2   92418   92418 th_name         ./th_name
$ cat /proc/92465/task/92465/comm
th_name

$ cat /proc/92465/task/92466/comm
f1_thread
2026/11/03 10:59 · Jean-Baptiste

Trouver tous les process 32bits en cours d’exécution

plop.c

#include <unistd.h>
 
int main() {
  pause();
}

Compilation

gcc plop.c -o plop.x64
i686-linux-gnu-gcc plop.c -o plop.x86

Execution

./plop.x64 &
./plop.x86 &
$ cat /proc/$(pidof plop.x64)/maps
564b4a50a000-564b4a50b000 r--p 00000000 fd:05 4743                       /home/jean/tmp/plop.x64
564b4a50b000-564b4a50c000 r-xp 00001000 fd:05 4743                       /home/jean/tmp/plop.x64
564b4a50c000-564b4a50d000 r--p 00002000 fd:05 4743                       /home/jean/tmp/plop.x64
564b4a50d000-564b4a50e000 r--p 00002000 fd:05 4743                       /home/jean/tmp/plop.x64
564b4a50e000-564b4a50f000 rw-p 00003000 fd:05 4743                       /home/jean/tmp/plop.x64
7f55e7b0a000-7f55e7b0d000 rw-p 00000000 00:00 0
7f55e7b0d000-7f55e7b35000 r--p 00000000 fd:01 1310300                    /usr/lib/x86_64-linux-gnu/libc.so.6
7f55e7b35000-7f55e7c9d000 r-xp 00028000 fd:01 1310300                    /usr/lib/x86_64-linux-gnu/libc.so.6
7f55e7c9d000-7f55e7cf0000 r--p 00190000 fd:01 1310300                    /usr/lib/x86_64-linux-gnu/libc.so.6
7f55e7cf0000-7f55e7cf4000 r--p 001e3000 fd:01 1310300                    /usr/lib/x86_64-linux-gnu/libc.so.6
7f55e7cf4000-7f55e7cf6000 rw-p 001e7000 fd:01 1310300                    /usr/lib/x86_64-linux-gnu/libc.so.6
7f55e7cf6000-7f55e7d03000 rw-p 00000000 00:00 0
7f55e7d30000-7f55e7d32000 rw-p 00000000 00:00 0
7f55e7d32000-7f55e7d36000 r--p 00000000 00:00 0                          [vvar]
7f55e7d36000-7f55e7d38000 r--p 00000000 00:00 0                          [vvar_vclock]
7f55e7d38000-7f55e7d3a000 r-xp 00000000 00:00 0                          [vdso]
7f55e7d3a000-7f55e7d3b000 r--p 00000000 fd:01 1310115                    /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
7f55e7d3b000-7f55e7d64000 r-xp 00001000 fd:01 1310115                    /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
7f55e7d64000-7f55e7d6f000 r--p 0002a000 fd:01 1310115                    /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
7f55e7d6f000-7f55e7d71000 r--p 00035000 fd:01 1310115                    /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
7f55e7d71000-7f55e7d72000 rw-p 00037000 fd:01 1310115                    /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
7f55e7d72000-7f55e7d73000 rw-p 00000000 00:00 0
7ffce4b98000-7ffce4bba000 rw-p 00000000 00:00 0                          [stack]

$ cat /proc/$(pidof plop.x86)/maps
565c3000-565c4000 r--p 00000000 fd:05 4772                               /home/jean/tmp/plop.x86
565c4000-565c5000 r-xp 00001000 fd:05 4772                               /home/jean/tmp/plop.x86
565c5000-565c6000 r--p 00002000 fd:05 4772                               /home/jean/tmp/plop.x86
565c6000-565c7000 r--p 00002000 fd:05 4772                               /home/jean/tmp/plop.x86
565c7000-565c8000 rw-p 00003000 fd:05 4772                               /home/jean/tmp/plop.x86
f7d37000-f7d5b000 r--p 00000000 fd:01 1567244                            /usr/lib/i386-linux-gnu/libc.so.6
f7d5b000-f7ee4000 r-xp 00024000 fd:01 1567244                            /usr/lib/i386-linux-gnu/libc.so.6
f7ee4000-f7f68000 r--p 001ad000 fd:01 1567244                            /usr/lib/i386-linux-gnu/libc.so.6
f7f68000-f7f6a000 r--p 00230000 fd:01 1567244                            /usr/lib/i386-linux-gnu/libc.so.6
f7f6a000-f7f6b000 rw-p 00232000 fd:01 1567244                            /usr/lib/i386-linux-gnu/libc.so.6
f7f6b000-f7f75000 rw-p 00000000 00:00 0
f7fa2000-f7fa4000 rw-p 00000000 00:00 0
f7fa4000-f7fa8000 r--p 00000000 00:00 0                                  [vvar]
f7fa8000-f7faa000 r--p 00000000 00:00 0                                  [vvar_vclock]
f7faa000-f7fac000 r-xp 00000000 00:00 0                                  [vdso]
f7fac000-f7fad000 r--p 00000000 fd:01 1567019                            /usr/lib/i386-linux-gnu/ld-linux.so.2
f7fad000-f7fd2000 r-xp 00001000 fd:01 1567019                            /usr/lib/i386-linux-gnu/ld-linux.so.2
f7fd2000-f7fe1000 r--p 00026000 fd:01 1567019                            /usr/lib/i386-linux-gnu/ld-linux.so.2
f7fe1000-f7fe3000 r--p 00034000 fd:01 1567019                            /usr/lib/i386-linux-gnu/ld-linux.so.2
f7fe3000-f7fe4000 rw-p 00036000 fd:01 1567019                            /usr/lib/i386-linux-gnu/ld-linux.so.2
ffa39000-ffa5b000 rw-p 00000000 00:00 0                                  [stack]

Trouver tous les process 32bits en cours d'execution

get_x86_pids.sh

#! /bin/bash
 
for fic in /proc/*/maps; do
    if grep -P -q '^[0-9a-f]{12}' "$fic" 2>/dev/null; then
        continue
    fi
    grep -qP '^[\x00-\xff]{8}-' "$fic" 2>/dev/null &&
        echo "${fic}" | awk -F'/' '{ print $3}'
done
$ ./get_x86_pids.sh | xargs ps -p
    PID TTY          TIME CMD
  15531 pts/4    00:00:00 plop.x86
2026/10/30 12:07 · Jean-Baptiste

Notes segmentation fault

Pour comprendre et analyser l'origine d'un tel plantage dans vos programmes, vous pouvez compiler avec les options de débogage de GCC (gcc -g) et utiliser un outil comme GDB ou AddressSanitizer (Coddy Tech).

Common Causes

  • Null or Uninitialized Pointers: Dereferencing a pointer that points to a random memory address instead of a valid allocation.
  • Buffer Overflow / Out-of-Bounds Access: Writing or reading past the end of an array or buffer.
  • Stack Overflow: Allocating too much memory on the stack (such as a massive local array) instead of the heap (using std::vector in C++ or dynamic allocation).
  • Use-After-Free: Accessing memory after it has already been freed or deleted.

How to Debug It

  • Use GDB: Run your program inside the GNU Debugger (gdb ./your_program) and type run, then backtrace (or bt) once it crashes to find the exact line of code causing the fault.
  • Check Memory with Valgrind: Run valgrind --leak-check=yes ./your_program to catch invalid reads, writes, and memory corruption.
  • Inspect Array and Stack Sizes: If working in C/C++, replace raw fixed-size arrays with safe containers like std::vector. If you want to troubleshoot further, let me know:
  • What programming language or tool are you running?
  • Can you share the code snippet or stack trace around where the crash happens?

Segmentation Fault - segmentation violation - address not mapped - invalid memory access

Code 11 / 139

L'erreur “Exited with code -11” (ou Code de sortie -11 / exit code -11) signifie presque toujours que votre programme a été arrêté brutalement par le système d'exploitation à cause d'une erreur de segmentation (Segmentation Fault / SIGSEGV). En informatique, le code de sortie d'un processus crashé par un signal Unix correspond souvent à - (le numéro du signal). Le signal 11 étant SIGSEGV (Invalid memory reference).

You didn't find a definitive answer because there isn't one. It's up to the author of the program to decide what exit codes they wish to use. Standard C only says that exit(0) or exit(EXIT_SUCCESS) indicate that the program is successful, and that exit(EXIT_FAILURE) indicates an error of some kind. (Returning a value from main is equivalent to calling exit with that value.) Most common operating systems including Windows, Linux, OSX, etc. use 0 for success and values from 1 to 255 to indicate errors; still choosing between error codes is up to the application writer, the value 11 isn't anything special.

Under Linux and most other Unix variants, the signal number 11 indicates a segmentation fault,… A segmentation fault happens when a program makes some kind of invalid memory access, so it's a plausible consequence of accessing an array out of bounds, or an error in pointer arithmetic, or trying to access a null pointer, or other pointer-related errors. Signal 11 is not the same thing as exit code 11: when a program dies due to a signal, it's marked as having been killed by a signal, rather than having exited normally. Unix shells report signals by reporting an exit code which is the signal number plus 128, so 139 for a segmentation fault.

Source https://stackoverflow.com/questions/31103254/meaning-of-exit-code-11-in-c/31104032#comment50221640_31103254

FIXME

2026/10/27 22:12 · Jean-Baptiste

Falsifier la date et l heure avec faketime

Lié à

  • libfaketime

Voir aussi :

apt-get -f install faketime

Exemples

$ faketime '2020-12-24 20:30:00' date
Thu Dec 24 20:30:00 CET 2020
faketime 2016-01-01 gpg --list-keys
2026/10/13 14:43 · Jean-Baptiste
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki