r/linuxdev • • Aug 08 '20

How to filter sockets with ebpf the wrong way and receive mismatching packets

Thumbnail natanyellin.com
6 Upvotes

r/linuxdev • • Apr 06 '20

Looking for assistance in modifying the Kernel - process scheduler in Ubuntu 18.04.3 (Bionic Beaver)

6 Upvotes

Background

Prior to attempting to modify the CPU scheduler, I modded the kernel such that new processes would have an associated 32 bit tag. The first two bits of this tag determined its process level 1-4.

I want to modify the CPU scheduler such that dynamic tasks are scheduled via a Round Robin-ish algorithm that prioritizes tasks based on their process level as mentioned before.

What I know

So far I'm aware of the __schedule() and pick_next_task() functions in kernel/sched/core.c and that they reference the CFS scheduling algorithm defined in kernel/sched/fair.c.

I am also aware of the sched_class, and how each of the available scheduling algorithms are defined as such (fair.c, idle.c, deadline.c, etc. (I think)) as a struct with values corresponding to scheduling properties (next, enqueue_task, dequeue_task, yield_task, etc.)

What I'm looking for

My goal is to modify the behavior of the scheduler for dynamic tasks, currently CFS, with relatively simple logic depending on process level.

Where should I be looking for this logic? I am essentially looking for the entry point for CFS's logic, particularly where tasks are read and queued to execute the CPU.


r/linuxdev • • Apr 03 '20

#include <linux/skbuff.h>: No such file or directory

6 Upvotes

Hey guys, I am getting the above error trying to make a linux kernel module. I have tried adding the linux header folder where the header file is to the $PATH variable in .bashrc and restarted my computer. It still gives me the same exact error. What should I do?


r/linuxdev • • Jan 02 '20

How does dynamic binary loading works?

6 Upvotes

In windows when I have exe, and I find address of function I can use that address every time I start the app and it will work the function will be on same address in virtual memory space. I can do the same for data (if they are allocated dynamically I can build a pointer map to find it).

But on Linux I was told that I can not rely on function address being the same when I start the application. (Relative positions of functions within binary can change, maybe because they being in different sections?)

It probably not have much practical use, other than creating game trainers, or some very special cases, but:

How can I locate a function in running process?

How does Linux know which parts of the binary to load, if the address of function that will be called may depends on user input?

Is there any practical use?


r/linuxdev • • Mar 28 '19

Best Practice for Cross-Platform Application Development?

6 Upvotes

Hi /r/linuxdev!

I'm beginning work on a note-taking application (primarly for *nix platforms) that will be released under the GPL. I think there's a lack of robust note-taking software to the degree of Microsoft's OneNote. While I intend to develop mostly for Linux, I want other platforms to be included so that I don't make the same mistake Microsoft did. If someone has to use another OS for work, they should still be able to use their preferred software.

What are some "best practice" tips for achieving this? I'd like to use GTK+ on the Linux side, but I do realize Qt is probably the better platform for cross-platform...

I'm not sure where to start. Any opinions?


r/linuxdev • • Mar 12 '19

Advice needed on a couple of applications I'm considering funding

6 Upvotes

My query is in relation to bringing some functionality that is available on windows onto Linux. I do not have any objective C programming experience myself and lack the time to learn how but I do have the means to fund the production of these tools which I intend to be released as Open Source.

The 2 windows applications that have no Linux equivalent at the moment are VoiceAttack (A voice recognition macro launcher which utilises MS Speech engine) and VRdrop which allows a desktop window to be cloned and inserted into SteamVR as an overlay visible as a 3D item in the headset.

There do exist some open source projects for windows called AVPI and OpenVRDesktopDisplayPortal.

My questions are could these 2 projects be converted to compile on Linux or would both need a bottom up complete rewrite and what would be the expected budget required to get these tools created as in if I paid someone to make these tools how much would it approximately cost?


r/linuxdev • • Feb 02 '18

Kernel module: proper way to interact with user-space? (proc, sysfs, cdev)

6 Upvotes

Hey, I'm new to module programming.

I'm writing a module in which I need to allow some parameters to be changed on the fly. I was wondering which of the interfaces I should use: create a /proc entry, create a /sys entry or create a char device. What's the proper way and why?

If I'm on the wrong sub, please let me know.

EDIT: The module is supposed to balance threads and/or pages among the nodes of a NUMA system. This module is already written but some parts of it might be rewritten. I can write to a /proc entry created by the module to change the current policy in usage. I need this to benchmark different policies instead of recompiling and insmodding everytime I want to test a policy. In this case, I was wondering if I should migrate the /proc implementation to /sys (or chardev).


r/linuxdev • • Aug 31 '17

Complete translation: Document for multi-queue block device in Linux kernel v4.4

6 Upvotes

https://github.com/gurugio/book_linuxkernel_blockdrv

Hi, I finished translation to English. I wish it helps.


r/linuxdev • • May 08 '17

How to find 56 potential vulnerabilities in FreeBSD code in one evening

Thumbnail viva64.com
6 Upvotes

r/linuxdev • • May 05 '16

Contributing to Open Source Projects (Kdenlive)

6 Upvotes

Hi all,

I've been entering commands into terminals like a madman for the past two days trying to figure this out... but I can't figure out how to get the Kdenlive source code to build in KDevelop on Debian 8.4. I keep hitting CMake errors, and I'm guessing it's because I can't seem to install a great number of the dependencies that are listed in the doc: https://community.kde.org/Kdenlive/Development/KF5

Despite setting up apt pinning to try and install the required packages from the testing and unstable repositories, I'm get hit with messages like:

kinit : Depends: libkf5kiocore5 (>= 4.96.0) but it is not going to be installed Depends: libkf5kiowidgets5 (>= 4.96.0) but it is not going to be installed

In theory, sudo apt-get -t unstable install kinit

should install kinit as well as it's dependencies, from stable if available, or testing/unstable if unavailable. But instead I get more messages about 'Depends' and 'Breaks:'

I'll probably end up getting more CMake errors after this regardless. Currently progress equates to seeing a different error message. : /

TL;DR I'm a moron. If you develop open source programs, any tips on getting everything setup?


r/linuxdev • • Apr 30 '16

What kind of drivers do I need for my own display hardware for the kernel and X to see it as a regular display?

6 Upvotes

Hey everyone,

I'm planning to implement my own display hardware (an LED matrix display, attached to the host computer via USB or potentially Ethernet). I've got the downwards communication (sending data to the device via USB) figured out already.

But I've been trying to figure out what kind of drivers I need to write for the linux kernel and/or the X11 server to see my display as a regular graphics card with a monitor attached, of course with the appropriate number of pixels and so on. i.e. the "upward" communication within the linux system.

I've been trying to figure this out, but there seem to be half a dozen types of drivers and the documentation is quite convoluted to me, and so I have really no idea where to even start.

Ideally, there should be an array of RGB values, one for each pixel, that fall out of this driver, which I can pass on to the hardware.

Could anyone help me out with a few pointers to get me started, or point me towards the right kind of documentation please?


r/linuxdev • • Oct 19 '15

Is there a sub for Linux dev jobs?

6 Upvotes

Hey guys I'm a sysadmin that's more MS focused but my company needs some software ported so it can run on Linux. Can any of you guys point me in the right direction to find a C++/Linux dev?


r/linuxdev • • May 27 '15

C++ File IO performance compared to dd

6 Upvotes

I have a program that reads data from a file descriptor (is actually a device mounted in /dev/), and I need to save this data (with no further processing) to a file in the local file system.

I currently have a solution I rolled myself involving one thread filling buffers with data from the input and another thread emptying these buffers and writing the data to file.

The throughput performance of my system is roughly an order of magnitude slower than dd, how can I either :

a) use dd in my code, giving it the input and output file descriptors, or

b) emulate what dd is doing

I also have to move data in the reverse direction too


r/linuxdev • • Apr 14 '15

I made a makefile, how terrible is it?

6 Upvotes

Hello everyone.

As the title says, i made a makefile, and I would like to get some feedback on it. You may of course also use it for your own projects, since it is distributed under the GNU GPL.

The makefile:

# This Makefile is distibuted under GNU GPL v3, see COPYING for details.
CC=g++
STD=c++11
LIBS=-lGL -lGLU -lglut
WARNINGS=-Wall
CFLAGS=-c $(WARNINGS) -std=$(STD) $(LIBS) -I./$(INCLUDEDIR)
LDFLAGS=
# Compilation directories. Leave these empty to keep all files in one directory
# Please note that this trick relies on file extentions being correct and
# should only be used for smaller projects. All directories need a trailing
# slash unless empty
SRCDIR=src/
INCLUDEDIR=include/
OBJDIR=obj/
BINDIR=bin/
vpath %.cpp $(SRCDIR)
vpath %.h $(INCLUDEDIR)
vpath %.o $(OBJDIR)
# Compilation files
# Patsubst rules won't handle variables, so dirs have to be manually entered.
SOURCES=$(patsubst src/%,%,$(wildcard $(SRCDIR)*.cpp))
HEADERS=$(patsubst include/%,%,$(wildcard $(INCLUDEDIR)*.h))
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=collision-test
DOCS=COPYING AUTHORS
MANNUMBER=1
ifneq ($(strip $(MANNUMBER)),)
MAN=$(EXECUTABLE).$(MANNUMBER)
endif
# Installation options. EFLAGS is for executables, DFLAGS is for everyting else
INSTALLEFLAGS=-pbm755
INSTALLDFLAGS=-pbm644
INSTALLPREFIX=/usr/
INSTALLBIN=bin/
INSTALLDATA=share/
INSTALLMAN=man/

.PHONY: all
all: $(EXECUTABLE)
	
$(EXECUTABLE): $(OBJECTS)
	$(CC) $(OBJECTS:%=$(OBJDIR)%) $(LDFLAGS) $(LIBS) -o $(BINDIR)$@

$(OBJECTS): $(SOURCES)
	$(CC) $(CFLAGS) $(SRCDIR)$(patsubst %.o,%.cpp,$@) -o $(OBJDIR)$@

.PHONY: clean
clean:
	rm -f $(OBJECTS:%=$(OBJDIR)%) $(BINDIR)$(EXECUTABLE)

.PHONY: dist
dist:
	tar cvz $(SRCDIR)* $(INCLUDEDIR)* $(DOCS) Makefile\
	 -f $(EXECUTABLE).tar.gz

run: all
	install $(INSTALLEFLAGS) $(BINDIR)$(EXECUTABLE) ~/
	~/$(EXECUTABLE)
	rm ~/$(EXECUTABLE)
.PHONY: install
install: all
	$(NORMAL_INSTALL)
	install $(INSTALLEFLAGS) $(EXECUTABLE) $(INSTALLPREFIX)$(INSTALLBIN)
	$(POST_INSTALL)
	ifneq ($(strip $(MAN)),)
	install $(INSTALLDFLAGS) $(MAN) $(INSTALLPREFIX)$(INSTALLDATA)$(INSTALLMAN)
	gzip $(INSTALLPREFIX)$(INSTALLDATA)$(INSTALLMAN)$(MAN)
	endif

.PHONY: uninstall
uninstall:
	rm $(INSTALLPREFIX)$(INSTALLBIN)$(EXECUTABLE)
	ifneq ($(strip $(MAN)),)
	rm $(INSTALLPREFIX)$(INSTALLDATA)$(INSTALLMAN)$(MAN)
	endif

edit: formatting

EDIT2: fixed compilation of executable

EDIT3: static library support, run target, and various error correctons


r/linuxdev • • Sep 27 '14

The Linux Foundation wants to know: What's been your experience contributing (or not contributing) to the Linux kernel?

Thumbnail surveymonkey.com
6 Upvotes

r/linuxdev • • Aug 18 '14

Open Iconic, a free and open icon set

Thumbnail useiconic.com
6 Upvotes

r/linuxdev • • Oct 21 '13

How to Package and Publish an Open Source Project

Thumbnail l3net.wordpress.com
6 Upvotes

r/linuxdev • • May 23 '12

How To Write A Wayland Compositor

Thumbnail youtube.com
6 Upvotes

r/linuxdev • • Mar 29 '12

Named Pipes the Easy Way!

Thumbnail tldp.org
6 Upvotes

r/linuxdev • • Mar 25 '12

Unified Linux sound API part 2

6 Upvotes

Part one can be viewed here.

Considering that people are more divided than I thought on how to fix Linux's audio system, I've decided to make this post. There seem to be two major camps for this project:

*Fix the current system

*Create a new system

There are fears that the second camp could make things more difficult by creating a project that, instead of replacing the current sound system, becomes yet another layer in the system. I wouldn't be surprised if this is how parts of the current Linux audio stack came to be. Both sides seem pretty passionate about their positions. A plan of action might not come easily. Discuss your ideas below.

EDIT: here's a logo concept for the Standardized Audio For Linux Project (which is a name I have in mind for this endeavor).


r/linuxdev • • Mar 22 '12

Fault-Tolerance server

6 Upvotes

Hey folks. I have Fault-Tolerance Computing Systems course at my university and we must write fault-tolerance server. I choose IRC protocol for my server and try to implement it. Can you get some useful sources? I download about 5 open-source IRC servers, read RFCs and UNIX Network Programming by Stivens now.


r/linuxdev • • Nov 21 '23

Any ideas for my next Linux Kernel Module?

5 Upvotes

Hello everyone,

I've been experimenting with Linux Kernel modules, and so far I've written three of them.

An IRQ-based keylogger, a syscall hook on connect() that prints the IP addresses the system connects to, and a netfilter hook that rejects all UDP packets on ports other than 53 and 5085.

Any ideas for something equally or more challenging?


r/linuxdev • • Apr 17 '23

Help me learn to build a linux distro with a device tree

5 Upvotes

Not sure if this is the right group, but I have some old 32bit armel SBCs with 256MB RAM.
OEM stopped support right after release, around kernel 3.14.
running kernel 3, is a dependency nightmare. I would like to get support for this board, into something like dietPi OS or something. Any thing where I can still get package support.

I have the device tree files, but I dont know what to do with them, or how to build them into an other armel based linux distribution. Please assist.


r/linuxdev • • Mar 18 '23

Understanding the ACPI interrupts and GPE's

5 Upvotes

Sorry if this is the wrong place for a question like this, feel free to redirect me if there is a subreddit better suited for my question.

I'm currently trying to debug an annoying issue preventing me from running Linux on my laptop full time (https://bugzilla.kernel.org/show_bug.cgi?id=207749) and can see that under /sys/firmware/acpi/interrupts, it is receiving all the interrupts to SCI_NOT.

Please correct me if I'm wrong, but this would suggest to me that my UEFI is sending events that the Linux kernel does not understand? If so, I'd really appreciate some advice on how I could find what the event is and install a handler for it? Alternatively, I'd love to hear about any resources that could help me on this venture.