Skip to content

Instantly share code, notes, and snippets.

View 0xNULLderef's full-sized avatar

NULLderef 0xNULLderef

  • Poland
  • 02:47 (UTC +02:00)
View GitHub Profile
@0xNULLderef
0xNULLderef / mergepatch.c
Created December 11, 2022 18:09
Mergepatch bugfix
// compile with `gcc mergepatch.c -Wall -Werror -fPIC -ldl -shared -o mergepatch.so`
// usage: `LD_PRELOAD=./mergepatch.so nvidia-smi`
#define _GNU_SOURCE // for RTLD_NEXT
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
@0xNULLderef
0xNULLderef / mergepatch.c
Created December 11, 2022 15:43
Patch for nvidia-smi to display process information with a merged driver
#define _GNU_SOURCE // for RTLD_NEXT
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <dlfcn.h>
#include <link.h>
#include <sys/mman.h>