My trivial Linux kernel module in Rust

Couple of weeks ago had a chance to participate in a small gig at work that offered a chance to try Rust as a language for wringing Linux kernel module. It was a steep learning experience which made it super fun. Huge shout out to folks behind linux-kernel-module-rust framework without whom nothing would be possible.

Below is the result:

Posted on February 12, 2020 at 10:56 am by sergeyt · Permalink · Leave a comment
In: Linux, Programming

Time to learn something OSX new

Received Volume I and II back in December 2019 and before that had been craving to own them for quite a while. The catalyst that finally motivated me to buy one was the final call or, more correctly, a tweet. I’ve quickly gleaned through the books and the depth of the material was impressive and intimidating at the same time. But for lifelong leaner like me this is the reason I bought them in the first place.

Posted on February 2, 2020 at 12:39 pm by sergeyt · Permalink · Leave a comment
In: Apple, OSX

Finished “Permanent Record”

Just turned the final page of Permanent Record and, not taking into account that I haven’t read a real physical book for quite a while, must say this one was thrillingly riveting. The world would’ve been undoubtedly a better place had we had more Snowdens among us.

Posted on February 1, 2020 at 5:25 pm by sergeyt · Permalink · Leave a comment
In: Life

python-bpfcc on Ubuntu 19.10 misses PerfEventArray due to an outdated bpfcc-tools

If you, like me, follow bcc Python Developer Tutorial, to sharpen bpf skills you might hit the same snag as I did when I was trying to implement a solution for lesson 8:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 315, in 'calling callback function'
  File "/usr/lib/python2.7/dist-packages/bcc/table.py", line 572, in raw_cb_
    callback(cpu, data, size)
  File "./sync_perf_output.py.py", line 69, in print_event
    event = b["events"].event(data)
AttributeError: 'PerfEventArray' object has no attribute 'event'

Lesson 7 doesn’t work and fails with the same error.
Originally, one had to use ctypes to define the event data structure in Python but this PR changed that. So now perf event data structure in Python is auto-generated. The code for leasson 8 has been updated accordingly as well

However bpf which is shipped with Ubuntu 19.10 is outdated, version 0.8.0-4 versus 0.12.0 as of this writing, and the only way around is to keep using ctypes, or build the tool chain from source due to a known bug

Posted on January 13, 2020 at 4:35 pm by sergeyt · Permalink · Leave a comment
In: BPF, Linux

Thumbs up to creators of algoexpert.io

First of all – I’m not a shill but just an ordinary satisfied user of the service. Wonder if all stoogy sponsored testimonial starts like this ;-)
Anyway, recently, I’ve been trying to improve my coding skills and found that just doing exercises on leetcode.com was not enough for me. I was definitely missing some bigger picture and had unstructured way of thinking.
Luckily for me I came across algoexpert.io that, to be honest, hasn’t solved all my problems and hasn’t yet helped to land my dream job but nevertheless has greatly improved my overall apprehension and allowed to improve self-confidence. What attracts me the most is that with algoexpert you don’t only have the questions and the answers but also the concise and at the same time highly details conceptual explanation of every problem. That helps to build fundamental knowledge which is essential for the coding interview.
I’d highly encourage to check out some free questions on their website to see it for yourself.
Good luck!

Posted on January 4, 2020 at 4:12 pm by sergeyt · Permalink · Leave a comment
In: Life

Checkout a single file from Git repo

This one going to be quick and putting here just for future reference.

Task
Checkout a single file from Git without cloning whole repo

Solution

git archive --prefix=config/ --remote=git@git.example.com:/app.git HEAD:app/config/ config.yaml | (cd /usr/local/app && tar xf -)
Posted on September 6, 2019 at 7:20 am by sergeyt · Permalink · Leave a comment
In: Git

Clawfinger memories 2018

This is from 25 years DDB show in Alkmaar, Netherlands.

Posted on December 25, 2018 at 8:57 pm by sergeyt · Permalink · Leave a comment
In: Life

ROP interactive guide for beginners by Vetle Økland

Just yesterday came on a post on reddit that pointed me to an amazing “Interactive Beginner’s Guide to ROP”. It’s nicely worded and has a couple of puzzles which I, as a total newbie, found very exciting. Leaving the solutions below for a later me…

\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x55\x00\x00\x00\x00\x00\x00\x00\x39\x00\x00\x00\x00\x00\x00\x00\x0e
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x55\x00\x00\x00\x00\x00\x00\x00\x39\x00\x00\x00\x00\x00\x00\x00\x0e
Posted on December 19, 2018 at 10:44 am by sergeyt · Permalink · Leave a comment
In: Security

Where GREP came from – Brian Kernighan

Posted on July 6, 2018 at 10:27 pm by sergeyt · Permalink · Leave a comment
In: Apple, FreeBSD, HP-UX, Linux, Solaris

When the past meets the future

The subject says it all.

Posted on June 9, 2018 at 6:24 pm by sergeyt · Permalink · Leave a comment
In: Life