Sunday, April 26, 2009

Synopsys Innovator and Designware System Level Library

THESE PROGRAMS ARE DEFINITELY 32 BIT

SystemC is perfectly happy on x86_64 however the pre-compiled libraries shipped inside the Designware System Library are not. Ah-ha, you say, "I shall compile them in 32 bit mode". However there is a problem: they depend on qt-devel.i386 which can't be installed on the same system as qt-devel.x86_64. So there.

Another word of warning for the clever:

THE BUILD SCRIPTS WILL WORK, BUT GENERATE EXECUTABLES THAT SEGFAULT.

Make/g++ don't quit on the qt linking error. Several hours of condensed hacking wasted as I didn't spot it. Another reason to use virtual machines to avoid these kinds of problems when using CAD tools. [see above for more details on the segfault issues]

DATE2009

What a great conference. I attended the workshop on Embedded Multicore computing as well as a similar tutorial.

Lots of very good people here with good ideas. Got the chance to get some real IC architecting off the ground and acquired a lot of good material for the SystemC based architecture course.

Wednesday, April 8, 2009

Installing Synopsys Synthesis and IC Compiler in the same directory

These are also known as syn and icc and include the all important executables and libraries to run dc_shell and icc_shell. These are part of the Galaxy platform. Synthesis provides tools for turning HDL into PDK specific netlists and IC Compiler for place and routing.

You can install Synthesis and IC Compiler for different operating systems into the same directory
  • As they are part of the same system (Galaxy) they can be installed into the same directory to save space and simplify installations scripts.
  • Be sure to get the same release and service pack from EST into the same directory.
  • Retrieve the common files and all the OS/Architecture specific parts you want (for example linux and amd64)
  • Run the installer on the directory and you will be able to select syn and icc and subsequently the architecture specific versions.
Hope this helps keep things simple.

Saturday, February 7, 2009

The Buffalo Linkstation Live (v2) - Unbricking

I just managed to get my Buffalo Linkstation (running Debian based Freelink) to brick in a new way: it would pull the kernel and initrd by tftp over and over again or it would appear to have loaded them but simply stop.

After trawling the forums I have salvaged the situation by mounting the HDD on a linux system and erasing and rebuilding the default /dev/sda1 partition.

I have also recorded how to do it in the relevant wiki article like a good boy:

http://buffalo.nas-central.org/wiki/Revive_your_arm9_box_from_scratch#Troubleshooting

Linkstations and similar Linux based NAS devices make fantastic home servers - mine draws ~13W under load providing daap, DHCP, NTP, apache, NFS, samba and AFS. Beats the hell out of an always on home Intel server.

Tuesday, January 27, 2009

How can I allow users to run a script as root?

I am glad you asked me that question!

In this case I need a user to nuke a process related to themself but executing as 'nx'. So to kill it they would have to be root (or nx). Killing the process and the related cleanup requires a script to automate it so I need to make a script run as root.

I can do that by making the scripting language interpreter (e.g. perl, python, etc) always run as root ("setuid"). This means that all scripts executed by that interpreter run as root.... oops. Ok bad idea as anyone can run any script they write as root. I know, I shall make the kill command always run as root. Anyone can now kill any process .... oops. Ok bad idea, slightly less a security risk though.

The solution to the above class of problems is called a 'shim' after small bits of metal. Go look the reference up if you care. The solution is make a tiny C program that when executed by a user runs as root ("setuid") and then executes the script, sanitising and passing any necessary arguments.

So here is a trivial C program to execute a single script (nxclean.c):

#define PATH "/usr/local/sbin/nxclean"
#define BUF_SIZE 10000

#include <stdio.h>
#include <unistd.h>
#include <sys.h>

int main(void)
{
uid_t user;
char user_str[BUF_SIZE] = {'\0'};

// printf("My UID is: %d\n", getuid());
// printf("My EUID is: %d\n", geteuid());
user = getuid();
snprintf(user_str, BUF_SIZE, "%d", user);
// printf("My UID is: %s\n", user_str);
setuid(geteuid());
// printf("My UID now is: %d\n", getuid());

execl(PATH, PATH, user_str, (char *) 0);
}

So what is going on here? Firstly a couple of #DEFINE's to save typing. Note that the buffer sizing and the initialisation of the whole buffer to '\0'. Remember this is a program that is going to run as root. It takes no command line arguments, simplifying things, but it is taking things from the underlying OS so be sure to be safe. If you are taking command line arguments then check them every which way, run regex's, size checks, the works. Otherwise kiss your security goodbye.

In this case it stores the UID of the current user as it needs it later, makes itself root via the setuid(geteuid()); line and then executes the script (now as root) passing arguments created from the UID collected earlier.

Note this only works if you have set the little executable this compiles into to run as root. Google "setuid".

Friday, November 7, 2008

DATE09 TPC finished and went well - linksys WRT54GLs are awesome!

Arrived at the IET on the evening of Wednesday with my team this week and immediately got the benefit of the IET's professional staff. Within 1 hour I had the server running a custom software package crafted specifically for DATE to manage the submissions.

Imagine trying to manage 900 submissions on paper + email? Impossible.

In the initial hour I also deployed 4 wifi routers, all linksys WRT54GL's to manage the 190 members who review the papers in groups organised by topics.

On Thursday under peak load the WRT54GL's were handling 43 WPA encrypted connections simultaneously (note that the SPI was disabled and also note a CPU monitor would be very helpful to gauge the CPU load).

They worked all day with only 5 laptops unable to connect, and considering the fact that wifi with encryption isn't a very well adhered to standard (lots of bugs) that is just noise. Even that was resolved with a driver update to a 2200BG card from Intel.

It all had to work, and it all came together.

Sunday, November 2, 2008

Synopsys Babbage Grant Proposal In!

It has been a most incredible slog getting the grant proposal out of the door. But now it is all done and I am really thankful. DATE2008 TPC here I come.

Laird Tpcm 7250 is as good as Honeywell PTM7950 as thermal paste / interface for PC

[This is not very scientific, however it is notable. At 7.5W/m-K vs the installed SYY-157 at 15.7 W/m-K it performed better in real world lo...