Saturday, July 20, 2013

The war against bugs is not lost!


Extracted from "Professional Linux Kernel Architecture" (Wolfgang Mauerer):


For comparision of the CPU quality, here is the check_bugs routine of S390, Alpha, Extensa, H8300, v850, FRV, Blackfin, Cris, PA-RISC, and PPC64:

static void check_bugs(void)

The S390 kernel is among the most confident ones, as you can see in the following code:

include/asm-s390/bugs.h

static inline void check_busgs(void)
{
  /* s390 has no bugs ... */
}


Saturday, April 6, 2013

Emscripten: From C to Javascript.

From the emscripten wiki:

Emscripten is an LLVM to JavaScript compiler. It takes LLVM bitcode (which can be generated from C/C++ using Clang, or any other language that can be converted into LLVM bitcode) and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run).

Using Emscripten, you can

  • Compile C and C++ code into JavaScript and run that on the web 
  • Run code in languages like Python as well, by compiling CPython from C to JavaScript and interpreting code in that on the web

The list of ported C/C-- software is impresive. Even complex OpenGL software ports looks no problem for Emscripten (by translating to the equivalent WebGL).

Basically that means we can know use static compiled languages to generate complex (millions of lines of code) Web pages.

¡¡¡ And this technology works now !!!

 

Thursday, August 2, 2012

Defining a bash prompt similar to:
PS1="\u@\h\ [\$(git branch 2>/dev/null | grep ^\* | sed 's/\*/branch:/')]:\w\$ "
(where the blue text is the added extension to the existing Prompt -PS1 variable-) will automatically show on the prompt the active branch we are working on. Ex.:
earizon@desktop[branch: master]:~/myGitRepo$ git branch
* master
  branch1
  branch2
  branch3
earizon@desktop[branch: master]:~/myGitRepo$ git checkout branch2
Switched to branch 'branch2'
earizon@desktop[branch: branch2]:~/myGitRepo$ cd .. # <- exit git repo directory
earizon@desktop[]:~$ 

Saturday, July 21, 2012

Executing Firefox/Chrome as a restricted user in Ubuntu

Next follows a quick guide (aka, chuletario) to execute Firefox as an isolated user in Ubuntu (Probably will work with minor or none modifications in Fedora, Mandriva or even MacOSX). Executing as an isolated user will allow to protect (even more) our system from the risks of the Internet. A potencially dangerous remote attack using a flaw in our browser (or a flaw in the plugins installed in our browser or the application used to read mail attachements) will be minimized. A virus/worm/"whatever" will be blocked unless it manages not only to break the browser, but simultaneosly scale privileges using a flaw in our OS kernel (remember the maximum principle of security, "NO SYSTEM IS SECURE"). To protect our system just follow the next instructions:
  1. Create a new user with a command similar to:
    adduser internetBrowsing
    
  2. Using you favorite text editor (gedit, vim/gvim, nano, ...) write a script similar to the next one:
     
    #!/bin/bash
    xhost local:
    su -c "firefox 1>/dev/null 2>&1 &" internetBrowsing 
    
    xhost local: will allow local users access to the X session.
    Change 'firefox' by the name of your favorite browser (chrome, chromium-browser, opera, ...). (But don't forget that firefox is best than your favorite browser in such case :) ).
  3. Save it and mark it as executable by executing in a terminal:
    chmod u+x launchBrowser.sh
    
  4. Add our new user to the audio group to allow it access to sound card. Edit the file '/etc/group' (in a terminal execute
    sudo gedit /etc/group
    and add the new user internetBrowsing to the audio group. The /etc/group file must look similar to:
    cat /etc/group | grep firefox
    ...
    ...
    audio:x:29:pulse,internetBrowsing
    ...
    ...
    
    (WARN: Do not delete anything in this file, just add internetBrowsing to the audio group)
  5. Finally just execute the script in a terminal by typing:
    ./launchBrowser.sh
    
    or create a launcher in the desktop.

Saturday, January 7, 2012

The circle of observability

Source: http://www.youtube.com/watch?v=l7aQWoTRqKw

   +----->  PROFILING -----+       
   |         -top          |
   |         -oprofile     |
   |         -perf         |
   |                       |
   |     +---------+       |
   |     |SystemTap|       |
   |     +---------+       |
   |                       |
   |                       v
 DEBUGGING <------------- TRACING
  -gdb                    -strace
                          -ltrace
                          -ftrace