ld execstack option

November 25, 2015

Linux ELF binaries store a flag to indicate whether they want their stack to be executable or not. The Linux loader will check that flag and adjust appropriately the stack via an mprotect system call. But who decides about setting or resetting this flag when generating a binary? The answer is the linker. The linker checks all object files and decides based on them if it should make the stack executable or not.

The decision is based on the following algorithm:

  1. If one of the object files does not contain a section named .note.GNU-stack, then the stack of the generated ELF binary will be executable to maintain backward compatibility.
  2. If one of the object files contains a section named .note.GNU-stack which is marked as containing code, then the stack will be marked as executable.
  3. Otherwise (if all object files contain a section named .note.GNU-stack which is marked as not containing code) the stack will be marked as non executable.

Read the rest of this entry »


Troubleshooting “Error reading data from FastCGI server”

June 29, 2013

Recently, I have observed the following error message in Apache’s error.log:

[Thu Jun 27 19:27:50 2013] [warn] [client xxx.xxx.xxx.xxx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Thu Jun 27 19:27:50 2013] [error] [client xxx.xxx.xxx.xxx] Premature end of script headers: xxx.php

My setup consists of Apache 2.2.16 (with MPM worker), mod_fcgid 2.3.6 and PHP 5.3.3. The error message appeared only when the web server was serving requests at a rate of approximately 20-30 requests per second. Below, I will present the troubleshooting steps that I used in order to discover what was the problem. To cut a long story short (tl;dr) you can read the last paragraph titled Special PHP considerations here: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#examples.

Read the rest of this entry »

Σύγκριση κόστους μεταξύ των τηλεπικοινωνιακών παρόχων

September 4, 2012

Η σύγκριση τιμολογίων της υπηρεσίας ΟΤΕ e-bill μέχρι τώρα μπορούσε να λειτουργήσει μόνο σε συνδυασμό με την αντίστοιχη εφαρμογή ανάκτησης και αποθήκευσης των τηλεφωνικών κλήσεων της υπηρεσίας ΟΤΕ e-bill. Αυτό πλέον αλλάζει και η εφαρμογή υποστηρίζει την εισαγωγή εξωτερικών δεδομένων για τον υπολογισμό και τη σύγκριση του κόστους μεταξύ των τηλεπικοινωνιακών παρόχων.

Η εφαρμογή έχει εγκατασταθεί και είναι διαθέσιμη στο Google App Engine: ote-ebill. Ο πηγαίος κώδικας βρίσκεται στο GitHub: prekageo/ote-ebill.

Read the rest of this entry »

Notepad++ Explorer plugin: Snap Open mod

May 4, 2012

Update 2020/04/04: Remove dead links.

Notepad++ is a great text editor for the Windows operating system. It has a lot of great features and there are also many useful plugins for it. The Explorer plugin features an integrated file explorer inside the Notepad++ user interface which is pretty handy most of the time. But there is a specific feature missing: the ability to quickly search and open files under a specific root directory by typing part of their filename. This feature is available in other text editors. For example, there is the Snap Open Plugin for gedit. I have developed this feature and integrated it in the original Explorer plugin.

You can view the source code and download the plugin DLL from GitHub: npp-explorer.

Read the rest of this entry »

Adobe Flash (SWF) to SVG and PDF

December 26, 2011

Updated 2020/04/19: Uploaded source code on GitHub.

Recently, I found some documents exported as SWF. It would be certainly more convenient for me if I could read these documents in my PDF reader. So I needed a utility to convert content from Adobe Flash to PDF. For this reason, I’ve written a small Python program that utilizes the SWFTools in order to parse the SWF and exports output in SVG and PDF file formats.

Read the rest of this entry »

MySQL and character sets

September 5, 2011

Nowadays, it is common place to use UTF-8 when working with text data. Unfortunately, this is not the case when you deal with legacy software or old configuration. MySQL supports a lot of character sets. There are two places where a developer has to choose the character set.

  • Every column of type VARCHAR has an associated character set, which means that data in this column are stored in the specified character set.
  • For every connection, the client can negotiate the character set that wants to send and receive. It can do that by issuing a SET NAMES SQL statement.

MySQL handles conversion between character sets when necessary. It can actually get really messy if you do not use the same character set everywhere. To demonstrate this fact, I have written a Python utility that tries combinations of character sets and operations and produces a nice summary in HTML. You can find the summary here: MySQL – character sets comparison tables.

Read the rest of this entry »

HTTP Request Logger add-on for Mozilla Firefox

July 30, 2011

Sometimes it might be useful to log each and every URL that is accessed through your Mozilla Firefox web browser. It might be for security, auditing or other reasons that you want to log accessed URLs. I developed the HTTP Request Logger add-on in order to track and discover a malicious web page that triggered the CVE-2010-4452 vulnerability in Oracle Java through a specially crafted applet tag and a respective Java applet class. You can download and install the add-on from here: HTTP Request Logger. You can also view the project on GitHub: prekageo/http-request-logger.

Read the rest of this entry »

SQL table view extension for Yii PHP Framework

July 21, 2011

While developing a web application, sometimes it is useful to provide an interface for displaying and browsing SQL tables. I have created an extension for the Yii PHP Framework which accomplishes that. One more interesting fact about this extension is that it avoids counting all the table’s rows in order to increase performance.

You can download the extension and some other required extensions from here:

Enhanced Windows service manager

July 16, 2011

Update 2020-03-25: Uploaded source code on GitHub.

Are you tired of manually starting and stopping several Windows services at once? Do you want to disable a bunch of Windows service without going through each one of them? Here, I present an enhanced Windows services manager that provides features missing from the builtin services snap-in of Microsoft Management Console. The application is written in Python and you can download the source code from here: Enhanced Windows services manager.

Read the rest of this entry »

Windows XP: My monitor does not turn off for power saving

June 26, 2011

I had this problem for a long time in my Windows XP machine. I had set up my monitor to turn off after 3 minutes of inactivity for power saving reasons. I, also, had disabled the screensaver although the last time it was enabled it was set to appear after 1 minute of inactivity. This piece of information will become significant latter on.

The problem was that sometimes my monitor could not go into power saving mode. I had absolutely no idea why such a thing happened and I couldn’t correlate this problem with any user action I was performing each time the problem arose. I knew that I could fix this problem by just clicking Apply in the Power Options control panel applet and I, also, had figured out that the problem disappeared if I adjusted the inactivity period down to 1 minute.

If you don’t want to go into all the technical details that will follow, you may want to know that the cause for this problem is the Adobe Flash player. The problem happens after viewing a Flash video (e.g. YouTube) and there is a bug report for this issue: FP-5216. If you want to learn more please continue reading and/or watch the screen-cast: Part 1 and Part 2.

Read the rest of this entry »