Marcus Folkesson

Embedded Linux Artist

The Shelf - a searchable index of my board games

The Shelf - a searchable index of my board games We have a shelf in the living room that is full of board games. The number of board games is growing for every month and has done so for the last couple of years. This has not always been the case. Actually, it took me 35 years to stop hating board games and start enjoying them. As I, like most of you probably, have a history of Monopoly, Risk and other horrible, horrible lucky based games that just drain the life out of you. cover

Electricity price on an e-Paper display

Electricity price on an e-Paper display I've written before about how much the electricity price varies here in Sweden during the day [1]. It's usually cheapest at night and most expensive in the morning and evening, but "usually" is doing a lot of work in that sentence - some days it's the exact opposite, and every now and then a price spike will make an hour or two absurdly expensive. cover

Making coffee difficult

Making coffee difficult Let's start this post with a video I found on Instagram [1]: I found this video incredibly fun as it reminds me of my own discussions about coffee. Me & Coffee A bit of my history I have been drinking coffee since even before I started elementary school. That's how it is growing up in a farming community; coffee and buns at 1PM for everyone. Then back to work for another 10 hours. cover

memtrack and memview - tracking down memory leaks with LD_PRELOAD

memtrack and memview - tracking down memory leaks with LD_PRELOAD This time I want to share a neat application I wrote to track down memory leaks in long-running, multithreaded applications without having to recompile or relink them. It consists of two parts: memtrack, an LD_PRELOAD library that logs every allocation and free, and memview, a curses-based viewer that lets you browse the log and find leaks. The problem A memory leak rarely announces itself. cover

How to track down a file descriptor leak?

How to track down a file descriptor leak? I was troubleshooting an application that crashed with "Too many open files" error. The cause is clear - the application is leaking file descriptors. But how do I find out where the leak is happening? Number of open file descriptors The default limitation of open file descriptors is set to 1024 on most Linux systems. It is set as a resource limit [1] and can be set from the terminal using the ulimit command: cover

Rooting a VMC2040 security camera part 7: Conclusion and summary

Rooting a VMC2040 security camera part 7: Conclusion and summary Brief In this part we are going to give some thoughts about the security of the camera and what to do to prevent this kind of attack. The other parts of the series are: Part1: Basic examination Part2: Extract the firmware Part3: Analyse the boot sequence Part4: Deeper analysis Part5: What didn't work Part6: What did work Part7: Conclusion and summary Let's talk a bit about security Often when I talk with my clients about security of their products, I urge them to analyze what threat they want to protect against. cover

Rooting a VMC2040 security camera part 6: What did work

Rooting a VMC2040 security camera part 6: What did work Brief In this part I will show how I finally got root access to the camera. The other parts of the series are: Part1: Basic examination Part2: Extract the firmware Part3: Analyse the boot sequence Part4: Deeper analysis Part5: What didn't work Part6: What did work Part7: Conclusion and summary What about those symlinks in /config? startSPARROW creates three symlinks that points to an executable binary in the rootfs: cover

Rooting a VMC2040 security camera part 5: What didn't work

Rooting a VMC2040 security camera part 5: What didn't work Brief In this part I will write down the things I tried that didn't work. The other parts of the series are: Part1: Basic examination Part2: Extract the firmware Part3: Analyse the boot sequence Part4: Deeper analysis Part5: What didn't work Part6: What did work Part7: Conclusion and summary U-Boot Environment The first thing I tried was to modify the U-Boot environment variables as those were not verified against any signature. cover

Rooting a VMC2040 security camera part 4: Deeper analysis

Rooting a VMC2040 security camera part 4: Deeper analysis Brief This part will focus on gathering as much information as possible about the system. As I in this stage don't know what I'm looking for, I will just try to document everything I find interesting. The other parts of the series are: Part1: Basic examination Part2: Extract the firmware Part3: Analyse the boot sequence Part4: Deeper analysis Part5: What didn't work Part6: What did work Part7: Conclusion and summary U-Boot environment I used dd to extract the U-Boot environment from the NAND dump. cover

Rooting a VMC2040 security camera part 3: Analyze the boot sequence

Rooting a VMC2040 security camera part 3: Analyze the boot sequence Brief In this part we will go through the init script to see what (and how!) services are started during the boot. The other parts of the series are: Part1: Basic examination Part2: Extract the firmware Part3: Analyse the boot sequence Part4: Deeper analysis Part5: What didn't work Part6: What did work Part7: Conclusion and summary Boot sequence I've tried to summarize the boot sequence in the diagram below. cover