/r/lowlevel

Photograph via snooOG

Low level programming and hacking subreddit for Linux and Windows.

  • Kernel Exploits
  • Low level programming techniques
  • Interesting articles
  • Help
  • /r/lowlevel

    12,507 Subscribers

    6

    Why does setting CPU affinity increase cache misses for my single-threaded workload?

    I've been running some performance tests on a single-threaded workload using stress-ng and monitoring the results with perf stat. I noticed that binding the process to a specific CPU core using taskset results in significantly more cache misses compared to running it without setting CPU affinity. Example:

    Without affinity:

    • Migrations: 1
    • Context-switches: 1
    • Cache Misses: 10,010
    • Cache Miss Rate: 31.376%
    • Cycles: 1,796,855
    • Instructions: 2,385,959

    With taskset -c 20:

    • Migrations: 0
    • Contex-switches: 1
    • Cache Misses: 13,029
    • Cache Miss Rate: 65.840%
    • Cycles: 2,495,645
    • Instructions: 2,539,112

    Run script example:

    taskset -c 20 stress-ng --cpu 1 --cpu-load 100 --timeout 12s &
    PROCESS_PID=$!
    sudo perf stat -e migrations,context-switches,cache-misses,cycles,instructions,cache-references -p $PROCESS_PID

    The core 20 is aribrary (I checked others), free, not isolated.

    Any ideas why I get more cache misses when isolate workload? I'd expect rather less cache misses.

    OS: Ubuntu 20.04

    CPU: Intel Core i9-10980XE, no NUMA.

    Thanks!

    5 Comments
    2024/07/09
    11:51 UTC

    2

    Should I switch to emdedded programming?

    Hello,

    I graduated with a bachelor's and master's degree in computer science. I have been working as a professional backend developer for about 2 years. I work with Java and Spring boot at work. But what I have wanted to do since my childhood is to work with languages ​​such as C/C++/Assembly. Do you think I should or can I work as an embedded developer? I am 25 years old and I already have advanced knowledge of C and C++. Am I too late for such a domain change or is it right to switch to embedded development just to work in C? Thank you very much in advance for your answers.

    3 Comments
    2024/07/07
    13:48 UTC

    2

    Looking for DS-01 Compression Documentation

    Posting here to see if anyone knows of any documentation for the DS-01 compression algorithm. This is a legacy compression algorithm for DMSDOS compressed FAT filesystems.

    I have the emails from one "pali" who wrote the only DS-01 decompression implementation I can find.

    4 Comments
    2024/06/22
    08:40 UTC

    6

    Where can i find friends who likes low level programming?

    I really got no idea. Can you guys give me some discord servers, groups, etc.

    Or dm me if you want to :D

    4 Comments
    2024/06/01
    22:17 UTC

    5

    Reviewing a Filesystem I wrote with a friend to teach him the way

    1 Comment
    2024/05/25
    12:25 UTC

    11

    Building OS from scratch

    Being a CS student and after doing web dev for some time, I'm starting to realize how much abstraction the modern day programming and software dev in general provides. This is good in its own ways, no need to "reinvent the wheel" and it's good that software can be shipped fast without deep diving into low level stuffs.

    But I just can't help but just wanna know about how we got here, how the things that I use work underneath. How things are built ground up. I know a bit about hardware and I'll leave it to that. I'm more into the software part.

    So to get into low level programming and understanding a "Computer" better, I just decided to make an OS from scratch.

    I know some x86 and 8085 assembly, microprocessor and computer architecture basics, some C programming, and OS theories like process scheduling, paging, virtual memory.

    Am I qualified enough to be going down this path?

    Also, what would be the right approach to do it and what are some good resources that I could get online?

    I've checked out the OSdev wiki, and a youtube playlist from nanobyte so far.

    10 Comments
    2024/04/29
    21:21 UTC

    1

    Research paper on reverse engineering.

    So the IEEE club of my university offered me to do do a research and lead a research team on any subject. The common topic for research would be AI and ML but i have decent knowledge of reverse engineering and low level stuff so i wanted to work on this subject rather than AI and ML.

    So i am looking for suggestions on what unique thing I can explore and research in reverse engineering. I searched online and most of the stuff related to RE is related to malware analysis, I am also open for that idea but I first need to know my goal exactly so here I am asking for help from reddit gods. I have experience with exploring malicious stuff with volatility but again I want something unqiue with a good learning outcome so that the paper actually gets published.

    One idea that has been in my mind was on reverse engineering self modifying binaries, but just analysis binaries with a RE framework won't be enough so I wanted to extend this by adding some more things into it like if I have a binary that injects shellcode during runtime and then modifies that shellcode etc etc. So pls suggestions are welcomed.

    6 Comments
    2024/04/24
    12:57 UTC

    6

    The Apple M-Series GoFetch Attack

    3 Comments
    2024/03/27
    13:30 UTC

    2

    About how many times have you encountered "EXC_BAD_ACCESS" when developing a program?

    4 Comments
    2024/03/01
    07:09 UTC

    0

    Determine DLLs needed by EXE complete tutorial

    2 Comments
    2024/02/09
    16:54 UTC

    1

    Any way to convert yahoo raw messages to actual text?

    Trying to learn how this works, is it possible to decrypt it somehow and turn it back to text?

    Received: from 10.196.198.206
     by atlas104.sbc.mail.bf1.yahoo.com with HTTPS; Thu, 17 Mar 2022 11:53:52 +0000
    Return-Path: <*** Email address is removed for privacy ***>
    X-Originating-Ip: [52.234.172.104]
    Received-SPF: pass (domain of microsoft.com designates 52.234.172.104 as permitted sender)
    Authentication-Results: atlas104.sbc.mail.bf1.yahoo.com;
     dkim=pass header.i=@microsoft.com header.s=s1024;
     spf=pass smtp.mailfrom=microsoft.com;
     dmarc=pass(p=REJECT) header.from=microsoft.com;
    X-Apparently-To: *** Email address is removed for privacy ***; Thu, 17 Mar 2022 11:53:52 +0000
    X-YMailISG: ..0BlFQWLDsnrF59SLN_NDjh3FFmpir0aJBc.r7Sl.MEJL8F
     hjaHo80k0lMmKeBwRrHd9gwu3_jse2_Zk4B4XeDNCOxsFUFNIG9DsuzKrjpz
     bNxWDwNxlqT9FyilZDyrEoILG_UF8jeIzdTnlWMv6CIhTbQu7I8dhToGdCol
     dKWUgiRUXmRIY0JFM7BskQ2A3IhJ0ovVCXIRucwj6X66HcxryAFrGAOebAhz
     3agQI0wHhNevR8cNv7KG.ajqsxw7sYQDAR5dZf7Cfo2mjvLS66OTa9f96Zz5
     DEiu24xKi9bq6Iytv2b5Jw9bJo_Mjqhd9ysl6EHFu6qU0sUdFF96rFjAviH1
     oTy.6wpcbdEegPcP5IubsaRyWmTc6Sw3wQSPYf2jzI1DP7Apla.Wgh691lAD
     SgZiY89H9B.8vM4jeSyOWgejN1.EoAfn.Ua.mOoByCRwIgNju770AU2CU1Td
     PTvum3GW_9seAiVnoLopODiQqGowu71X2AheqRta0JBVXfflu9lwnt83mq1W
     MkLwEKxNK619ZbQPPSf3ULLAKEL6eB.X83EbVVQQoedSHUBj6J945Vrfm8f9
     Vhh1CS0yoGeraA53KfFn38DezBTGj4qDLVI2wYX7uajQ6JQWcocFmGddRonU
     OGRWom27vm92hw4y5aOsw7dP_OkPTqoHhDBBEG6.vpjps_z29Bj3xQDlp30u
     SeO8fAjQzf3DMidWQbNzyxmJAKEGpdZxtT.54aiB5MKqBpyjYaumqfZu_h_c
     Cv9dW5rv95XI1reQ9OJIOrdg1NZr7fYboP_DLMt51YAJTHeLx_oLlHyy6ZQz
     dA_O6GRGlKiq7rGWwdRVoKYEgjp3B.YDFWbLtf1UDBKzQbgDA.JUEpxzxa09
     vGeGSHEeGXgOpCvGY8g6ofDjM1xsphL3De2QFEgkHubcM0ndCweXjyZz_z06
     EaHnx4qyEvAiKpSpazCsjUzTnSFWDtWeDqov5_y_g4AxfGG1trlRbujZNRgW
     XR342GEmAqNbM_BafuiWgVj_hiRaWo63eRgb5zgyhAERsGZKPxjdh4RO1Lmb
     brHn4L.ifUxOhC.zQ814w4S23GwLxe1Jua2z7uriGhmXPaB3b1da4PEIvxMi
     jk4WRpHHpObwwCc.x56C97ra7N5WKQtsKRljczFgGaG3ja6e.bxaD7QyFq72
     XWc-
    3 Comments
    2023/09/28
    16:15 UTC

    0

    Lost my Microsoft USB mouse dongle, want to change the frequency of another dongle to match my mouse

    Hi,

    Do you know how I could possible take a different (but same) microsoft dongle, and change the frequency to match my mouse? and how do I even check that frequency?

    Even if not necessary and i can just buy a new one, this seems like a fun DIY project.

    Would love some help, thanks :)

    P.S. the mouse is the microsoft ergonomic sculpt mouse.

    5 Comments
    2023/09/26
    12:03 UTC

    1

    My nasm program crashes and I think I know how, but I don't know how

    My nasm program crashes

    So, I think I understand what's going on. The program after the call to main jumps to address 0, which is obviously invalid. Which tells that ret is popping 0 (the top of the stack) into rip. But how is 0 to the top of the stack in this instance?

    global _start
    
    section .text
    _start:
       call main
       
       xor  rdi, rdi
       xor  rsi, rsi
       mov  rax, 60
       syscall
       
    main:
        push    rbp
        mov     rbp,rsp
    
        mov     rdi, msg
        call    print
    
        mov     rsp, rbp
        pop     rbp
        ret
        
    print:
        push    rbp
        mov     rbp,rsp
        sub     rsp, 0x8
    
        mov     [rbp], rdi
        mov     rax, [rbp]
        mov     rsi, rax
        mov     rdi, 1
        mov     rbx, 7
        mov     rax, 1
        syscall
    
        mov     rsp, rbp
        pop     rbp
        ret
    
    section .data
        msg: db "aaaaa",100
    4 Comments
    2023/09/17
    02:34 UTC

    Back To Top