Michael Meeks on Copyright Assignment

Michael Meeks published a though provoking essay called Some thoughts on Copyright Assignment. It is a must read when working with Free Software projects that request legal assignment of contributions to a corporation.

It contains sane recommendations both for individual contributors, project leaders and corporations seeking assignments.

Next step – SystemTap java hotspot jstack() support

Just checked in support for getting java backtraces from hotspot through systemtap. This is the next step in making not just the kernel and native programs observable, but also runtime based languages with SystemTap. And it is pretty powerful. It allows you to answer the question “How did I get here?” in combination with any of the SystemTap tapsets for VM level tracing, Java method entry/exit tracing, Native methods (JNI) tracing, or any other basic SystemTap function, statement or process probe that points into your java process. Just add one of the print_jstack() variants to your code (possibly including native frame and method signatures) and suddenly it is really easy to see what triggered a particular code path:

$ stap -e 'probe hotspot.jni.CallObjectMethod { log (probestr); print_jstack() }' -c 'java ModalTest'

CallObjectMethod(env=0x7f9d1000a1b8,obj=0x7f9d73efcaf8,methodid=0x7f9de4088b70)
sun/font/FontManager.getFont2D
sun/java2d/SunGraphics2D.checkFontInfo
sun/java2d/SunGraphics2D.getFontInfo
sun/java2d/pipe/GlyphListPipe.drawString
sun/java2d/SunGraphics2D.drawString
sun/swing/SwingUtilities2.drawString
sun/swing/SwingUtilities2.drawStringUnderlineCharAt
javax/swing/plaf/basic/BasicGraphicsUtils.drawStringUnderlineCharAt
sun/awt/X11/XButtonPeer.paintText
sun/awt/X11/XButtonPeer.paint
sun/awt/X11/XButtonPeer.paint
sun/awt/X11/XRepaintArea.paintComponent
sun/awt/RepaintArea.paint
sun/awt/X11/XComponentPeer.handleEvent
java/awt/Component.dispatchEventImpl
java/awt/Component.dispatchEvent
java/awt/EventQueue.dispatchEvent
java/awt/EventDispatchThread.pumpOneEventForFilters
java/awt/EventDispatchThread.pumpEventsForFilter
java/awt/EventDispatchThread.pumpEventsForFilter
java/awt/Dialog$1.run
java/awt/event/InvocationEvent.dispatch
java/awt/EventQueue.dispatchEvent
java/awt/EventDispatchThread.pumpOneEventForFilters
java/awt/EventDispatchThread.pumpEventsForFilter
java/awt/EventDispatchThread.pumpEventsForHierarchy
java/awt/EventDispatchThread.pumpEvents
java/awt/EventDispatchThread.pumpEvents
java/awt/EventDispatchThread.run

You currently need both IcedTea6 from mercurial and Systemtap from git to play with it. But both projects are planning new releases soon.

FudCon Success – Systemtap meets Python

At FudCon, David Malcolm, Jon VanAlten, Will Cohen and I sat down, had some fun and made tracing python methods through systemtap possible:

0 python(20122): => search_function in Lib/encodings/__init__.py:71
15 python(20122):  => normalize_encoding in Lib/encodings/__init__.py:49
37 python(20122):  <= normalize_encoding
170 python(20122):  => <module> in Lib/encodings/utf_8.py:8
193 python(20122):   => IncrementalEncoder in Lib/encodings/utf_8.py:18
206 python(20122):   <= IncrementalEncoder
251 python(20122):   => IncrementalDecoder in Lib/encodings/utf_8.py:22
264 python(20122):   <= IncrementalDecoder
310 python(20122):   => StreamWriter in Lib/encodings/utf_8.py:25
323 python(20122):   <= StreamWriter
340 python(20122):   => StreamReader in Lib/encodings/utf_8.py:28
353 python(20122):   <= StreamReader
367 python(20122):  <= <module>
391 python(20122):  => getregentry in Lib/encodings/utf_8.py:33
410 python(20122):   => __new__ in Lib/codecs.py:77
429 python(20122):   <= __new__
440 python(20122):  <= getregentry
462 python(20122): <= search_function

The coolest part is that it works through the existing patch to python for adding dtrace support. Some small tweaks to the autoconf detection was needed, but the rest was used as is.

If you want to learn how to add static user space probes to your program/package please see Will’s excellent guide. Adding User Space Probing to an Application: A simple example adding markers to a user-space application with SystemTap.

Going to FudCon

Currently stuck at heathrow airport… But I will make it to Canada somehow for FudCon. Hopefully with some nice systemtap jstack java hotspot backtrace examples.

They finally actually started to work. Weeee!

GPLed JDK 7 M5 + Jigsaw binary packages

After my somewhat cranky post about the JDK 7 M5 binaries being distributed under not very free and social terms. I was really happy to see Mark Reinhold’s announcement of the JDK 7 M5 + Jigsaw binary packages:

These binaries are licensed under the GPL (v2) with the Classpath Exception, plus the Assembly Exception.

Thank you Mark! Thank you Sun! You did make my day.

Trusting companies with your code…

Mark Reinhold announced JDK 7 Milestone 5 which is derived from OpenJDK7. Lots of people contributed to that. But sadly Sun decided they weren’t going to release this as Free Software. I wanted to research this JDK7 M5 and compare it to the work we did on OpenJDK and IcedTea, but apparently I am not allowed to…

Sun might have the right to do this given they only use contributions granted to them under their SCA terms. But the following clauses from the JDK7 license seem somewhat unfair given that we all contributed parts to OpenJDK.

  • “Licensed Software is “Confidential Information”. Licensee may not disclose or use Confidential Information”
  • “Licensee may not modify or create derivative works of the Licensed Software, or reverse engineer, disassemble or decompile binary portions of the Licensed Software, or otherwise attempt to derive the source code from such portions.”
  • “Licensee shall have no right to use the Licensed Software for productive or commercial use.”
  • “LICENSEE DUTIES Licensee agrees to evaluate and test the Software for use in Licensee’s software environment and provide feedback to Sun in a manner reasonably requested by Sun. Any and all test results, error data, reports or other information, feedback or materials made or provided by Licensee relating to Software (collectively, “Feedback”) are the exclusive property of Sun and Licensee here by assigns all Feedback to Sun at no cost to Sun.”
  • “This Agreement will commence on the date on which Licensee receives Licensed Software (the “Effective Date”) and will expire ninety (90) days from the Effective Date, unless terminated earlier as provided herein.”
  • “Upon termination or expiration of this Agreement, Licensee will immediately cease use of and destroy Licensed Software, any copies thereof.”
  • “It is understood and agreed that, notwithstanding any other provision of this Agreement, Licensee’s breach of this Agreement will cause Sun irreparable damage for which recovery of money damages would be inadequate…”

There is no reason for Sun to act in this anti-social way. There are free replacements for the previously encumbered binary blobs (thanks IcedTea!). So anybody that wants to can distribute a completely free version. And redistributing other peoples contributions under such draconian one-sided terms is totally unnecessary (and rude!). If someone wants to add the previously proprietary binary blobs one can do that under the terms of the OpenJDK Assembly Exception to the GPL that was specially drafted to allow this. So there is no need to not redistribute the free parts under the GPL as everybody else is doing.

Come on Sun, tear down this proprietary legal wall that divides users from the developers that contributed all this code to be free and open.

IcedTea and OpenJDK backups

Since the various OpenJDK servers are seeing major ongoing outages the last couple of days it might be good to point out that at least the source code from the master jdk6 and jdk7 mercurial forests do have backups: http://classpath.wildebeest.org/hg/. These are read-only of course. You will also find backups of the various IcedTea mercurial repos there. The IcedTea builds can currently fail if you don’t have openjdk.tar.gz and/or hotspot.tar.gz around in some configurations. You can also get those from the IcedTea autobuilder/tester (and then use configure --with-openjdk-src-zip and/or --with-hotspot-src-zip). Besides creating binaries and test reports, the autobuilder also keeps copies of all the sources used to create the latest successful build run around: http://icedtea.classpath.org/builds/.

GDB 7.0

Wow, just wow! Look at all those new features in the just released GNU Debugger 7.0:

  • Python scripting support
  • Reverse debugging, Process record and replay
  • Non-stop debugging
  • Multi-architecture debugging
  • Multi-inferior, multi-process debugging
  • GDB now has an interface for JIT compilation
  • Tracepoints may now be conditional
  • Multi-byte and wide character set support
  • New /r and /m modifiers for the “disassemble” command
  • Automatic retrieval of shared library files from remote targets
  • Inlined functions are now supported
  • New remote protocal packets
  • GDB is now able to read compressed debug sections
  • Thread switching is now supported on Tru64
  • Ada task switching is now supported
  • New features in gdbserver, the GDB remote stub
  • New command to stop execution when a system call is made

Of course no surprises if you have been following Nick Clifton’s GNU Toolchain Updates and some of these features (python scripting, better C++ support and disassemble /m are my personal favourites) have been backported to the Fedora GDB packages already. But it is really nice to see them all together now in a fresh GDB release. Congrats to the GDB hackers. This is really a must have update!

SystemTap 1.0

Josh announced SystemTap 1.0

Experimental support for unprivileged users, cross-compiling for foreign architectures, matching C++ class and namespace scopes, reduced runtime memory consumption, reduced dormant overhead in userspace markers, bug fixes, and more…

I am happy this is finally out the door. Designating something with 1.0 is always special. And it is always hard to decide when to cross that magical barrier. But after 0.9.9 it was hard to not just do it!

I love it when a plan comes together – systemtap meets java!

With the recent releases of Systemtap 0.9.9 and IcedTea7 1.11 some pieces of the systemtap whole system observability picture come together. On top of the “meta-probes” in hotspot (for garbage collection, monitors, object allocation, threads, etc.) we now also see the java language level tracing coming to life.

Always wondered what really was going on when your “simple” Hello world java program was running…

$ stap -e \
'probe hotspot.method_entry {log(thread_indent(1) . "=> " . class . "." . method . sig)}
probe hotspot.method_return {log(thread_indent(-1) . "<= " . class . "." . method . sig)}' \
-c 'java -XX:+ExtendedDTraceProbes Hello'
[...]
   0 java(26933):=> Hello.main([Ljava/lang/String;)V
   9 java(26933): => java/lang/ClassLoader.checkPackageAccess(Ljava/lang/Class;Ljava/security/ProtectionDomain;)V
  16 java(26933):  => java/lang/System.getSecurityManager()Ljava/lang/SecurityManager;
  23 java(26933):  <= java/lang/System.getSecurityManager()Ljava/lang/SecurityManager;
  30 java(26933):  => java/util/HashSet.add(Ljava/lang/Object;)Z
  37 java(26933):   => java/util/HashMap.put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
  43 java(26933):    => java/lang/Object.hashCode()I
  50 java(26933):    <= java/lang/Object.hashCode()I
  56 java(26933):    => java/util/HashMap.hash(I)I
  63 java(26933):    <= java/util/HashMap.hash(I)I
  69 java(26933):    => java/util/HashMap.indexFor(II)I
  76 java(26933):    <= java/util/HashMap.indexFor(II)I
  83 java(26933):   <= java/util/HashMap.put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
  89 java(26933):  <= java/util/HashSet.add(Ljava/lang/Object;)Z
  96 java(26933): <= java/lang/ClassLoader.checkPackageAccess(Ljava/lang/Class;Ljava/security/ProtectionDomain;)V
[...]
2611 java(26933):     => java/io/BufferedOutputStream.flush()V
2617 java(26933):      => java/io/BufferedOutputStream.flushBuffer()V
2624 java(26933):       <= java/io/BufferedOutputStream.flushBuffer()V
2630 java(26933):   <= java/io/BufferedOutputStream.flush()V
2636 java(26933):  <= java/io/PrintStream.newLine()V
2643 java(26933): <= java/io/PrintStream.println(Ljava/lang/String;)V
2649 java(26933):<= Hello.main([Ljava/lang/String;)V


The needed changes have also been added to IcedTea6 so expect them in a GNU/Linux distro near you soon.