RSSAmplifier

Blog

home - SHRIK3 on SHRIK3

Recent content in home - SHRIK3 on SHRIK3

shrik3.comRSS feed ↗292 posts

Latest posts

I have no TEE, and I must attest

WIP side channels {meltdown, spectre}

This is WIP write-up. § praise LLM! While playing with spectre V2 side channel, I found an issue and LLM helped me to solve it in no time, that would otherwise cost me a lot of sanity. A shared memory between the victim and attacker processes is used as a probe array to exploit cache flush/reload timing attack I tried two differnet methods of creating it: a file-backed shared memory: int fd =…

checklist for learning programming language

§ the language keywords primitive types integer, float, string, array, slice, pointer… numerics boolean & operators composite types (class, struct …) control-flow: if, switch-case, while, for variable: type, allocation, mutability, lifetime, static, const, scope, atomic function declaration: type, inline, lambda… § the runtime garbage collection stacktrace § standard library…

Agentic Society and Its Future

§ Not a manifest A blunt reference, but I immediately thought about Kaczynski 1 when the idea randomly jumped into my mind. There is no doubt that coding agents lower the gate-keeping bar for making useful programs. They are powerful tools that tremendously boost the productivity for those who know what they are doing. Language models understand a legacy codebase better than the most experienced…

Synchronisationbegriffe - WIP

Entschuldigung für mein kaputtes Deutsch. :) Die Hauptfrage ist, was die Anforderungen für eine korrekte Synchronisationsimplementierung (z.B. eines Locks) sind? Es gilt die Regel, dass zwei Dinge erfüllt sind, nämlich Sicherheit und Lebendigkeit . Dass problem ist jedoch, dass diese Dinge oft mit unterschiedlichen Begriffen und Kategorisierungen difiniert werden, besonders whenn es darum geht,…

process, thread, task

§ general [2] Tanenbaum: A process is just an instance of an executing program, including the current values of the program counter, registers, and variables. Conceptually, each process has its own virtual CPU. § linux specific [1] § difference between process and thread § process group § reference [1] W. Mauerer, “Linux® Kernel Architecture”. [2] A. S. Tanenbaum and H. Bos, Modern operating…

The Nucleus of a Multiprogramming System

Per Brinch Hansen, The nucleus of a multiprogramming system. 1 ;pretty much the paper the started microkernels … but it’s not a microkernel itself Abstract: This paper describes the philosophy and structure of a multiprogramming system that can be extended with a hierarchy of operating systems to suit diverse requirements of program scheduling and resource allocation. The system…

GNU toolchains

§§ every damn single GNU toolchain binary NOTE: <m> - placeholder for machine tuple e.g. x86_64-linux-gnu <v> - placeholder for toolchain (gcc) version GCC, under /usr/bin ; Sometimes they are prefixed with machine tuples. Archlinux is x86_64 exclusive, therefore the prefixes are not necessary. And, gcc seemingly overlaps binutils. Some of those are wrappers (see below) From binutils: compile…

C Runtime

Mixing content from: Understanding the C Runtime: crt0, crt1, crti, and crtn https://www.inferara.com/en/blog/c-runtime/ Documentation from ulibc https://github.com/kraj/uClibc/blob/master/docs/crt.txt gcc docs http://gcc.gnu.org/onlinedocs/gccint/Initialization.html crt0.o / crt*.o the startup objects Historically crt0.o (C Runtime Zero). Modern toolchains split crt0 and use crt1.o (the primary…

container, k8s, docker, podman

§ podman Install https://https://podman.io/docs/installationodman.io/docs/installation

archlinux setup &#43; LUKS &#43; LVM

system setup: LUKS + LVM + (ext4) + archlinux. This is for experienced arch user. For detailed guide on arch installation please use archwiki and https://shrik3.com/post/archlinux/arch_setup_new/ partition overview overview NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS lsblk nvme0n1 259:0 0 953.9G 0 disk ├─nvme0n1p1 259:1 0 1G 0 part /boot └─nvme0n1p2 259:2 0 900G 0 part └─cryptlvm 253:0 0 900G 0 crypt…

nix 01 - Nix subsystem for arch

[BACK TO INDEX] With massive copy-paste from the Nix Pills . This post is under the same CC-BY-SA-4.0 . (Co-)Authors list . This post is intended to be a quick reference for arch-to-nix beginner (me). § Nix Subsystem for Arch I&rsquo;m learning and playing with nix to decide if I should hop to NixOS for my new work laptop. arch install # insteall `nix` for archlinux (native) pacman -S nix…

test

e i π + 1 = 0 e^{i \pi} + 1 = 0

Memory Jargons

/proc/meminfo (free) $ man proc_meminfo MemTotal (total) total usable RAM i.e. total physical RAM minus reserved bits and kernel binary code. MemAvailable memory that can bed used if there is demand. Memory could be used for file caches by the kernel and still marked as availabe. MemFree (free) the &ldquo;free&rdquo; memory per se. Memory that is not used for ANY purpose. This is roughly…

RDMA 101 - libverbs APIs and hello world

Introduction to Programming Infiniband RDMA by Insu Jang https://insujang.github.io/2020-02-09/introduction-to-programming-infiniband/ Code https://github.com/Arlu/RDMA-Hello-World Copy-Verbatim, all rights belong to the original author(s)

RDMA 101 - basics

SRC: Netdev 0x16: RDMA Tutorial by Roland Dreier (Enfabrica) and Jason Gunthorpe (NVIDIA) https://netdevconf.info/0x16/slides/40/RDMA%20Tutorial.pdf Introduction to Programming Infiniband RDMA by Insu Jang https://insujang.github.io/2020-02-09/introduction-to-programming-infiniband/ Code https://github.com/linux-rdma/rdma-core Copy-Verbatim, all rights belong to the original author(s) Async…

statistic tools - 去海边整点统计工具

§ Mann-Kendall test for monotonic trend https://vsp.pnnl.gov/help/vsample/design_trend_mann_kendall.htm § Petri Nets Petri Nets fundamentals https://teaching.model.in.tum.de/2021ss/petri/material/petrinets.pdf' Stochastic Petri Nets https://pdv.cs.tu-berlin.de/PMFE-SS2007/StochasticPetriNets.pdf https://isgwww.cs.uni-magdeburg.de/~graham/sim2/lectures/09-PetriNets.pdf § odds ratio and relative…

The Art of Multiprocessor Programming - Notiz

The Art of Multiprocessor Programming - Maurice Herlihy and Nir Shavit Took a lecture that used this as the textbook &hellip; I think I should review it..

L4RE hands-on : build system

REFERENCE: https://l4re.org/doc/l4re_build_system.html L4 must be built out-of-tree make B=<builddir> # create build (object) dir make O=<builddir> # invoke make with specified object dir to include the builddir into the makefile (or local config) OBJ_BASE = <builddir> BID Makefile: if I understand correctly every level of subdir should have one Makefile. Specify the role: {project, subdir, prog,…

scams

logging some scams I see §§§ Fake &ldquo;undelivered email&rdquo; notice an email saying: Roundcube Found Several Undelivered Messages 6/26/2024 5:14:20 p.m. Undelivered emails for i@shrik3.com You have up to 6 hanging message on i@shrik3.com . Retreive the emails into your local folder by using the Read Undelivered Emails button Read Undelivered Email Gateway i@shrik3.com Microsoft Corporation…

ausland

TIMELINE RES.Status Stu.Status Contract.Status | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

hello

meow

Genode and Trusted Computing

some takeaways from Norman Feske presentation. operating system complexity is a disease .. define &ldquo;Trust&rdquo; in software I have to try this out&hellip; https://genode.org/documentation/genode-foundations/index

Wissen führen!

what it takes to be a scientist - Mietvertrag mit Nachweis über die Miethöhe; Bei Untermietvertrag Zustimmung des Eigentümers - vom Arbeitgeber ausgefülltes Formular >Erklärung zum Beschäftigungsverhältnis< - Stellenbeschreibung - Nachweis über einen deutschen oder ausländischen Hochschulabschluss inkl. Modulübersicht - Arbeitsvertrag zur Ausübung einer (hoch-)qualifizierten Beschäftigung -…

can I survive a month with 100 Euros for food?

A rough &ldquo;nutrition&rdquo; guideline. N Daily Month avg.price (kg) mix.avg ~SUM --------------------------------------------------------------------- grain 250g 7.5kg Rice 3.5 5.5 41.25 var. grains 7-10 lean 180g 5.5kg Schweine 10 50 meat Veg. 300g 9kg Gurke 0.6/stk 30 Salat 0.8/stk Aubergine 1/stk ktf 1.3 tmt 0.9 Zwiebel 2 Zucchini 1.4 Karotten 1.3 Rucola 8 Broccoli 3 Paprika 3.38 Fish 3kg…

VLIW archs

[V]ery [L]ong [I]ncoherent [W]riteup Historical context on Groq., Irrational Analysis, https://irrationalanalysis.substack.com/p/very-long-incoherent-writeup http://www.vliw.org/ Embedded Computing: A VLIW Approach to Architecture, Compilers and Tools, Buch von Josh Fisher

Diffie–Hellman key exchange

define an operation X that satisfies Associative: a X b X c = a X (b X c) Commutative: a X b = b X a No (or very difficult) reverse operation . e.g. If we know a and (a X b) , it&rsquo;s impossible to calculate b Key Exchange (very simplified) C : common knowledge, public a : secret bits, private to ALICE b : secret bits, private to BOB ALICE BOB + a + b | | | send A:= a X C |…

timer interrupt

docs: https://www.kernel.org/doc/Documentation/timers/NO_HZ.txt § TIMER INTERRUPT FREQUENCY $zcat /proc/config.gz | grep "HZ" CONFIG_NO_HZ_COMMON=y # CONFIG_HZ_PERIODIC is not set # CONFIG_NO_HZ_IDLE is not set CONFIG_NO_HZ_FULL=y CONFIG_NO_HZ=y # CONFIG_HZ_100 is not set # CONFIG_HZ_250 is not set CONFIG_HZ_300=y # CONFIG_HZ_1000 is not set CONFIG_HZ=300 CONFIG_MACHZ_WDT=m

learn lua (WIP)

resources: lua.org: programming in lua (first edition) § KEYWORDS DECLARACTION local function LOGIC and or not CONTROL for in repeat until while break do if else elseif then return end VALUE true false nil § tyles and values basic types nil type of a single value, non-exist, anything undeclared, or effectively &ldquo;deleted&rdquo; boolean 2 values true and false . conditionals consider false and…

SDRAM intro

Readings: DDR4 Tutorial - Understanding the Basics - via sv:io DDR4 SDRAM - Timing Parameters Cheat Sheet - via sv:io DDR4 memory organization and how it affects memory bandwidth, Xiaomin Shen CS698Y: Modern Memory Systems hosted by IIT Kanpur DDR4 Bank Groups in Embedded System Applications, Graham Allan Totu WATCH THIS! DRAM - by Open Logic (youtube) Executing Commands in Memory: DRAM Commands,…

L4RE hands-on : language quirks (WIP)

§ not quite C++ the fiasco microkernel uses some perl wichery called Preprocess . It&rsquo;s basically a C++ module system from 20 years ago that looked somewhat like modern rust. Preprocess author: Michael Hohmuth Preprocess is a preprocessor for C++ modules. With this tool, you write unit-style single-source-file modules in C++. Links Preprocess tool from fiasco tree Preprocess documentation or…

L4RE CODE READING : IPC, object, task, low-level

This note is taken away from the following sources. Re-distributions MUST preserve the attributions. L4RE documentations: https://l4re.org/doc/l4re_concepts_ipc.html From TU Dresden Lecture &ldquo;Microkernel-based Operating Systems&rdquo; &ldquo;Inter-Process Communication&rdquo;, Nils Asmussen, TU Dresden, 29.Okt.2024 § Task and thread ctrl Class inheritance kern/mem_space.cpp kern/obj_space.cpp…

L4RE hands-on : adding a package / service (WIP)

L4RE hands-on : hello world and boot ISO

REFS https://l4re.org/getting_started/make.html (CC-BY-SA 4.0, L4Re project members and individual contributors) Basically a plaintext note for my own reference. DEPS AND ENV pacman: base-devel dtc lib32-gcc-libs qemu qemu-ar aur: perl-git-repository perl-xml-mini perl-uri ham (include in $PATH) https://github.com/kernkonzept/ham.git prepare the sources with ham mkdir $PROJ_BASE cd $PROJ_BASE ham…

box drawing characters

UNICODE &ldquo;BOX DRAWING&rdquo; BLOCK (ALSO IN IBM PC CHARSET). THE MOSTLY SUPPORTED SET 0 1 2 3 4 5 6 7 8 9 A B C D E F U+250x ─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ┌ ┍ ┎ ┏ U+251x ┐ ┑ ┒ ┓ └ ┕ ┖ ┗ ┘ ┙ ┚ ┛ ├ ┝ ┞ ┟ U+252x ┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ ┬ ┭ ┮ ┯ U+253x ┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻ ┼ ┽ ┾ ┿ U+254x ╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋ ╌ ╍ ╎ ╏ U+255x ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ U+256x ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ ╭ ╮ ╯…

L/R values, reference, copy and move semantics

C++STD: https://en.cppreference.com/w/cpp/language/value_category https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2010/n3092.pdf SF ANSWER https://stackoverflow.com/questions/3601602/what-are-rvalues-lvalues-xvalues-glvalues-and-prvalues BLOGS TO READ https://blog.vero.site/post/rvalue-references https://www.internalpointers.com/post/c-rvalue-references-and-move-semantics-beginners…

C&#43;&#43; std string and string_view

https://www.learncpp.com/cpp-tutorial/introduction-to-stdstring/ std::string can have flexible length, involves malloc, slower passing std::string by value causes a copy, so don&rsquo;t use std::string_view or const std::string& as parameter supports move semantics, return std::string by value is fine doesn&rsquo;t work well with constexpr (use string_view ) instead 1 2 3 4 5 6 7 8 9 10 11…

C&#43;&#43; std::thread (std <= 17)

Constructors thread() noexcept; thread( thead && other ) noexcept;

C&#43;&#43; lambda

MAIN REFERENCE: Modern C++ Features (Anthony Calandra), overview C++20/17/14/11 (MIT) QUICK NTOES c++ 11 (introduced) [<CAPTURE>] (<params>) -> <return type> {/* BODY */} [] no capture [=] and [&] : capture local objects in scope by value or reference. Can specify objects by name e.g. [a, &b] [this] : capture this by reference c++ 14 generic lambda expressions ( auto initializer) auto identity =…

spinlock impl

COPYRIGHT NOTICE: text and code copied or derived from git commit message, mailinglist, or codebase are subject to the linux kernel licensing rules documentations: Lock types and their rules https://docs.kernel.org/locking/locktypes.html Synchronization primitives in the Linux kernel. (from the Linux Inside blog series) https://0xax.gitbooks.io/linux-insides/content/SyncPrim/ MCS locks and…

CONFIG_DEBUG_SPINLOCK

bject to the [linux kernel licensing rules](https://www.kernel.org/doc/html/latest/process/license-rules.html) config flag helper text Say Y here and build SMP to catch missing spinlock initialization and certain other kinds of spinlock errors commonly made. This is best used in conjunction with the NMI watchdog so that spinlock deadlocks are also debuggable.

lockdep

COPYRIGHT NOTICE: text and code copied or derived from git commit message, mailinglist, or codebase are subject to the linux kernel licensing rules

R/W lock impl

COPYRIGHT NOTICE: text and code copied or derived from git commit message, mailinglist, or codebase are subject to the linux kernel licensing rules documentations: Lock types and their rules https://docs.kernel.org/locking/locktypes.html NOTE: this is based on the code reading for spinlocks rwlock_t Non- PREEMPT_RT kernels impl rwlock_t as spinning lock and the suffix rules of spinlock_t apply…

Reader/Writer Locks

Literature study and example implementations for Reader/Writer Locks Main reference (actually this one is a takeaway from) B. Reddy and R. Fields, “Techniques for Reader-Writer Lock Synchronization,” IJEEE, vol. 8, no. 4, pp. 63–73, Dec. 2020, doi: 10.18178/ijeee.8.4.63-73. 1 A second thought: this paper doesn&rsquo;t seem carefully written&hellip; There are many typos and inconsistencies. So…

C with class

linux futex (fast user-space locking)

§ RTFM : manpage for futex(2) NAME futex - fast user-space locking LIBRARY Standard C library (libc, -lc) SYNOPSIS #include <linux/futex.h> /* Definition of FUTEX_* constants */ #include <sys/syscall.h> /* Definition of SYS_* constants */ #include <unistd.h> long syscall(SYS_futex, uint32_t *uaddr, // points to futex word int futex_op, uint32_t val, const struct timespec *timeout, /* or: uint32_t…

ia32 instructions and micro-arch for locks

back to index PAUSE instruction Spin Loop Hint, give hint to processor that improves performance of spin-wait loops. Specifically, to transfer yield CPU to another hyperthread. The PAUSE instruction provides a hint to the processor that the code sequence is a spin-wait loop. The processor uses this hint to avoid the memory order violation in most situations, which greatly improves processor…

Machine Check Handling (AMD64)

This is meant to be a supplement to Machine check handling on Linux by Andi Kleen. References: https://www.halobates.de/ This page is under CC-BY-SA-4.0 , code snippets from the Linux project(s) are under GPL-2.0-only . The above note must be preserved. Takeaways from Andi Kleen paper Two types machine check machine check exceptions (MCEs) / uncorrectable error. It will cause interrupt w/ a…

some atomic memory operations

CMPXCHG - Comapre and Exchange [lock] cmpxchg reg, reg/mem ^ ^ ^ | | | prefix SRC DEST if al == dest: ZF <- 1 DEST <- SRC else: ZF <- 0 AX <- DEST e.g. mov $0, %al lock cmpxchg %edx, some_lock

linux kernel synchronization (WIP)

Main reference: Understanding the Linux Kernel 3rd Edition, Daniel P.Bovet and Marco Cesati. TODOs: preempt_count General Rule kernel preemption is disabled in critical region protected by spin locks § Quick facts spin locks kernel preemption is disabled in spin lock protected critical regions. for uniprocessor system, the spin lock simply disables/enables kernel preemption