2023-09-15

Linux

Table of Contents

1. Greg Kroah Hartman on the Linux Kernel

1.1. Kernel moves really fast

per day (2007-2008): (YT)

  • 4.3k Lines added
  • 1.8k Lines removed
  • 1.5k Lines modified

And that change is proportional across all kernel parts:

  • 50-55% of Kernel code is drivers
  • 5% is core kernel

per day (2015): (YT)

  • 10.8k Lines added
  • 5.3k lines removed
  • 1.9k lines modified

1.2. There is no conventional test

https://youtu.be/L2SED6sewRw?si=xr2RwLyOMzrMcAjm&t=864 There is no test in the traditional/popular sense of test.

Kernel is tested by running it.

Developers test it. Because there are hundreds of permutations of configs and conditions to test.

Zero day test (https://youtu.be/vyenmLqJQjs?si=leZ1mJ60eKRJXkjA&t=1493)

  • Intel has 0-day bots that build the public linux kernel trees on different configurations and test a bunch of things

2. Articles

3. Server Setup

3.1. Starting web sever at port 80

Port 80 is previlage and a non root process can't open a port 80. There are few options: (https://superuser.com/a/892391)

  1. Start the server as root: very risky
  2. Using setcap give port binding capacity to the process: allows opening any port other than 80 too
  3. Use authbind: this is an extra program to install

Instead simply use iptables and setup port forwarding:

  • Start your server normally at any unprevilaged port (say 8000)
  • Then port forward port 80 to port 5000 using iptables

(From https://coderwall.com/p/plejka/forward-port-80-to-port-3000)

## Forward external requests to 80 towards 500
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5000

Note that this doesn't forward internal requests to port 80 towards port 5000. So if you try `curl localhost:80` it won't work. Either use port 5000 : `curl localhost:5000` or use public ip/domain name of your server: `curl public-ip-of-server:80`.


References

Backlinks


You can send your feedback, queries here