Blog:Memory Leak


Jump to: navigation, search
A memory leak is unnecessary memory consumption by a computer program. The most common manifestion is the failure to release unused memory that has been allocated. A memory leak occurs when the program either loses the ability to free the memory or simply neglects to free memory it no longer needs. (source: Wikipedia, The Free Encyclopedia.)



Search for wikilog posts

Simple KDE4 fan control widget


My motherboard comes equipped with a W83627EHF sensor chip, which is supported by Linux via the w83627ehf module. It was automatically detected and configured by lm-sensors. The chip has an adjustable PWM output that allows the user to control system fan speeds. The Linux kernel module exports these controls through pwm* files under /sys/class/hwmon/hwmon0/device/. Writing an integer in the 0-255 range to any of these files changes the PWM output of that fan, altering its rotation.

I usually don't bother with system fan speeds, but my current CPU fan produces a particularly annoying noise at ~3300 RPM and above. Sometimes I want to manually adjust it in order to reduce the noise.

I decided to create this widget for two reasons: to have a nice and easy way to adjust the CPU fan speed, without having to manually issue commands every time; and to have a quick look on how it is to develop Plasma widgets (Plasmoids), specially through its Python bindings.

→ continue reading...

From Fedora to Kubuntu

When KDE 4.0 was released, I quickly realized that it would be better to wait for a "stable" release. I don't have a lot of spare time to deal with my computer, so KDE 4.0 would be a problem to handle in my situation. I'm a long-time RedHat/Fedora user, since the old RedHat 5.2 back in 1998, and I was somewhat satisfied with it.

So, I had to stay with Fedora 8 for some time, since Fedora 9 and further were pushing for the newer "unstable" versions of KDE... until Fedora 8 stopped being supported and KDE 4.2 was released. So, I decided to try Fedora 11.

→ continue reading...

Understanding the Linux load average

I've seen many people (Computer Science majors) using Linux load average incorrectly when evaluating the performance of a Linux system or cluster. There are some misconceptions about what means and how are calculated the values reported by the /proc/loadavg pseudo-file. The most common misconception is that those values are percentages of how much the system is loaded. In this post, I'll try to summarize what these values actually mean, and how they should be used from a scientific point-of-view.

→ continue reading...

Another port knocking solution

Port knocking is a mechanism that allows sensitive services provided by a server to be kept hidden and protected by a firewall until a specific sequence of requests are made to some other selected ports. This sequence of requests is called knocking. Which ports and the order that they must be knocked are a secret shared only to those authorized to access that service externally. After a successful knocking, the firewall opens the sensitive service port to the knocking host for a short time, so that a connection can be established.

Although not infallible (it was never intended to be), port knocking is a good mechanism to conceal sensitive services running on a server, like, for example, secure shell (SSH). Many people conceal their SSH service by changing the port it listens for new connections to something other than the default (TCP/22). This provides very little additional security and it is not enough when used alone.

There are daemon/tool-based solutions for port knocking, like knockd and The Doorman, but they have some inherent problems:

  • They are a single point of failure of the system: if the daemon dies or fails to load for whatever reason, you are locked out.
  • Not all networks allow egress TCP or UDP packets to arbitrary ports: it is a good security practice to only allow outgoing packets to known service ports, which the SSH port is usually included, but the other ports used for port knocking aren't.
  • Knocking a sequence of ports in a short time is not very easy: you either need a tool for that (usually provided with the port knocking solution), or you have to make it work with the available tools (usually netcat or telnet) and some scripting.

There is this iptables-only solution, which fixes the first problem. It uses only iptables and so is controlled directly from the firewall; you have no extra daemon running, which is a good thing. I decided to improve on that solution.

→ continue reading...

Logitech G9 Laser Mouse

Logitech G9 Laser Mouse

I just got my hands on a new mouse, a Logitech G9 Laser Mouse. For sure, this is one of the best pieces of hardware I've seen in the last ten years, really worth its cost.

As usual, just plugging it on Linux and it is promptly recognized and enabled. The mouse appears to the system as a keyboard+mouse composite USB device. Probably the keyboard part is used for the macros and other functions (zoom in/out, etc) you may program in it.

But the mouse part is a little non-standard, and not all the buttons were generating the correct events. Xorg's default "mouse" driver had the horizontal scroll messed. Some Google searches showed that more people had problems with this mouse on Xorg and different, diverging configurations suggested:

I tried the "evdev" driver, it really did a better job getting all the buttons recognized, but unfortunately none of the suggestions correctly mapped the buttons to the correct events, so that I could tilt the wheel to scroll horizontally.

→ continue reading...

Linux, KDE: Mapping functions to extra keys


My laptop (an HP/Compaq nx6110 notebook) has this extra non-standard special function key that is (normally) only available on Windows, through a special driver installed. Pressing it while running Linux does nothing but generate these messages on syslog:

kernel: atkbd.c: Unknown key pressed (translated set 2, code 0x89 on isa0060/serio0).
kernel: atkbd.c: Use 'setkeycodes e009 <keycode>' to make it known.
kernel: atkbd.c: Unknown key released (translated set 2, code 0x89 on isa0060/serio0).
kernel: atkbd.c: Use 'setkeycodes e009 <keycode>' to make it known.

No events are registered on X. I was bothered and decided to make it useful on Linux too.

→ continue reading...

Bridges and tunnels in Fedora

Tunnel Example.png

Fedora Linux supports setting bridges and tunnels through its startup network configuration scripts, even though the frontend (system-config-network) doesn't allow their creation or management.

Of course, it is possible to set bridges and tunnels by issuing the appropriate commands in /etc/rc.local, but this solution is not optimal since it bypasses the network scripts, making it harder to manage connections (i.e. no ifup and ifdown support). Keep reading to learn how to do it using Fedora's own network configuration scripts.

→ continue reading...