Creating debugfs files

debugfs debugfs is a pseudo-filesystem used for kernel debugging. It is usually mounted at /sys/kernel/debug. debugfs contains files that allow us to read debugging information. By default, only the root user can cd into the /sys/kernel/debug directory. To change it to allow the current user to cd into debugfs, we can remount it with uid set to the current user’s uid. sudo umount /sys/kernel/debug sudo mount -t debugfs none /sys/kernel/debug -o uid=`echo $UID` cd /sys/kernel/debug Creating debugfs entries Creating debugfs files is similar to creating character device files.

Misc character devices

Character Devices, Major and Minor numbers Based on granularity of access, there are two classes of devices: Character devices are accessed as a stream of bytes. Eg: Keyboards Block devices are accessed in blocks. For instance, hard disks transfer data in blocks of multiple bytes at a time. The kernel uses major and minor numbers to identify the attached hardware devices. Major number usually tells us the type of device. Minor numbers are used to differentiate two or more devices with the same major number.

Updating vulnerable Python dependencies

Finding vulnerable dependencies Safety-db is a database that keeps track of vulnerable python packages and version information. It is updated once a month. They also provide a tool called safety, that checks if the installed packages or packages in requirements.txt are identified as vulnerable using the safety-db. Install safety pip install safety Use safety to check all packages in the current virtual enviroment safety check Use safety to only check the dependencies listed in requirements.

Eudyptula Challenge task 5

In this post, I want to share what I learnt by doing task 5 of the Eudyptula challenge. The Eudyptula Challenge is a set of 20 tasks designed to help people get started with Linux kernel development. Task 5 of the challenge is to make a hello world kernel module get loaded automatically when a USB keyboard is plugged in. Loadable kernel modules Linux kernel allows us to load modules to the kernel while the kernel is running.

Backing up files with RSync

You need a backup When was the last time you took a backup of your files? Thanks to technology, today, we can store thousands of photos and videos in a single pen drive. Digital files are easy to store, but they are also easy to lose. And that is why we all need to take regular backup of our files. 3-2-1 Backup Strategy 3-2-1 Backup strategy is a general rule of thumb that says it is better to have atleast 3 copies of our files.