The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,117 other followers

Archive for the ‘gcc’ Category

LD_PRELOAD: preload a Linux library, for instance to obtain more information on a segmentation fault

Posted by jpluimers on 2020/06/11

Not being a proficient Linux programmer, I wondered what other means than learning gdb intrinsics I had to get more information about a segmentation fault.

A while back, pip list 2> /dev/null would cause a segmentation fault on my system (see [WayBack] Bug 1084812 – [aarch64] IPv4 DNS leading to segfaults).

It turns out that LD_PRELOAD was my friend (like TERM=xterm was a friend before):

LD_PRELOAD=libSegFault.so pip list 2> /dev/null

It indicated that the problem was in libc, which on opensuse is implemented by glibc.

This meant that the originally diagnosed problem was already accurately describing the symptoms.

Searching for glibc libSegFault.so didn’t reveal many useful links, so I’ve included the one making most sense to me here:

The cool thing: most of the links above come from [WayBack] segmentation fault – Can you get any program in Linux to print a stack trace if it segfaults? – Server Fault which I found when searching for linux find segmentation fault stack trace

That link explains both the LD_PRELOAD steps and gdb steps (:

An alternative is to use gdb directly: [WayBack] command line arguments – How do I run a program with commandline args using gdb within a bash script? – Stack Overflow:

gdb -ex=run --args pip list

–jeroen

Posted in *nix, C, Development, gcc, Linux, Power User, Software Development | Leave a Comment »

Bash on C steroids… Tavis Ormandy: Just when you thought we couldn’t take this any further…

Posted by jpluimers on 2016/11/12

Calling C libraries from bash with virtual automatic data conversion based on symbol info in the .so files.

Source: Tavis Ormandy: Just when you thought we couldn’t take this any further…

Via: From the I wish it was PHP Dept: Calling native C functions from arbitrary shared libraries, using auto-generated marshaling relying on implementation details of bash associative arrays for member order preservation. “There’s enough data in the compiler debugging data for us to reconstruct the original types, so we parse it and translate it into a format that can be used in bash – It’s surprising how well this works!” The surprising thing is that works at all. – Kristian Köhntopp – Google+

–jeroen

Posted in bash, C, Development, gcc, Scripting, Software Development | Leave a Comment »

Building and running upc_keys.c on Mac OS X

Posted by jpluimers on 2016/01/27

Even after the SpeedTouch password algorithms were disclosed 2008, ISPs keep using weak algorithms to generate their default WPA/WPA2 passwords in their routers:

A short while ago, blasty published code to generate the WPA2 passwords for UPC routers. Even though Ziggo now owns UPC, a lot of  this UPC equipment is still in use. I guess it won’t be for long that similar code for Ziggo routers will be published too.

The code at https://haxx.in/upc_keys.c is easy to download, build and run on a Mac OS X machine even when you don’t have Xcode installed (use the “xcode-select –install” trick):

wget https://haxx.in/upc_keys.c
gcc -O2 -o upc_keys upc_keys.c -lcrypto
./upc_keys UPC0053284 5
./upc_keys UPC0053284 24

–jeroen

Posted in *nix, *nix-tools, Apple, C, Development, gcc, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, Power User, Software Development | Leave a Comment »

 
%d bloggers like this: