Java-Based x86 Emulator
jaavaaguru writes "Researchers at Oxford University have produced a Java-based x86 emulator that they hope will be useful in testing applications and learning about viruses without damaging the host, utilizing the robust sandboxing that Java provides. They have an online demo available that boots DOS and has some games to play. Being purely Java, this emulator should be able to run on almost anything, including cell phones." The code is not yet available outside the Oxford community; the developers are said to be working on a suitable general license. In the meantime the code can be licensed on a case-by-case basis.
I can only imagine that this will make even Bochs look fast in comparison!
Still, I'd love to tinker with this from a 'gee whiz' standpoint.
Wow, x86 on my phone? Finally I can run linux on it! Probably dead slow though. Still cool.
...why. With several high-quality emulators already in existence, why is this interesting?
... now we should say: "x86 assembler: write once, run everywhere (slow as molasses in January)" ?
Whilst this looks like a really interesting project, I'm failing to see how it's useful generally due to the limitations of writing it in Java and making it cross-platform. You would lose a lot of those possible (processor- or platform-specific) optimisations that make the leaders in the virtualisation market as fast as they are.
On, say, a mobile phone (which is mentioned by the site as a possible use) would there be enough processing grunt to do anything useful? I know Java's not as slow as some people would have you believe, but virtualisation requires as much speed to be squeezed out as possible to be usable.
On a desktop, what advantage does this have over the existing virtualisation options which don't have to deal with the Java environment?
How does it compare to Qemu or Bochs, both open-source x86 emulators?
Talk about gilding the lily!
What's next? A Windows emulator written in Intercal?
What's wrong with virtualisation? Yes, you can't run it on a phone's ARM processor but you wouldn't do that in the first place.
Global symbol "$deity" requires explicit package name at line 2. - If only $scripture started "use strict;"
Java only: snail speed
Java+DOS: Snail with ball and chain
Java+DOS on non x86: Snail nailed to the table
CDE open sourced! https://sourceforge.net/projects/cdesktopenv/
But can it run Linux. . .?
Why did they use Java? It would have been faster in C++.
I for one welcome our new old x86 overlords.
Did I miss any?
If you are about to mod me down, keep in mind that this post was most likely sarcastic.
It will take some work to port.
But still cool though.
http://saveie6.com/
I was playing around with DEBUG.COM and ran "OUT 20, AX"...and now it's apparently dead. A lot of things don't seem to work - e.g. "mode 80,20". Even "dir c:" when the current drive is "a:" seems to hang. I wonder how complete the hardware emulation is. Can you run Windows 3.1 on this? How about programs that probe for a joystick?
My server
For one this will let you run X86 DOS applications on a SPARC for example.
I'd like you to point me to the support page for VMWare on SPARC... oh wait that's cause there isn't one. QEMU can't even run most applications on a SPARC.
And forget about ARM.
I think this is great. Java is not as slow as people seem to think it is. One thing Java 5 (and 6) have that actually benefits virtualization is dynamic recompilation... the JVM knows the instruction sdequences better than the original author, and in theory can optimize the code paths in ways writing a virtualizer in assembly or C++ can not.
if the emulator itself runs on x86 then the just in time compiler of the Java runtime may optimize the code enough that we get back almost the original assembly code... but without any buffer overflows and other security problems - theoretically.
I accidentally formated my virtual floppy and hard drive.
not that slow if there's enough of it!
"Researchers at Oxford have built an x86 emulator that runs purely on Java, making it ideal for security researchers who want to analyze and archive viruses, host honeypots and defend themselves against buggy or malicious software without hosing their machines"
a tor/
From TheRegister:
http://www.theregister.co.uk/2007/03/23/java_emul
Yeah yeah yeah, it's sort of slow, if you screw around with the debugger it dies, but...
They've got Commander Keen!
Now granted, I'm pretty sure that not all of /. would run warm for this and therefor I'm convinced that the /. effect will be of a lesser degree then you'd get with the hotter topics. BUT, having said that...
/. demo could very well demonstrate the robustness which Java can deliver? If this webapp. survives a lot of geeks messing and hacking about in that virtual machine I'd be very tempted to label this as a very interesting experience when it comes to the Java robustness factor.
I know I'm biased when it comes to Java since I consider this to be a very flexible and fantastic programming language. But would I be too far off when I say that this
So what about it? Has anyone already experienced glitches or....
It's not bad - admittedly it's running DOS - but Prince of Persia seems to run nicely.
BlackNova Traders
If it can be spread across a beowulf cluster, install Windows and have it appear to be a single processor to it, load the latest game of interest or your favorite FPS, connect to the internet and start stress testing. Should have some type of "gee whiz" moment soon. This might make for an interesting honeypot design too. It might be interesting to try the same with a main frame, have it make all the processors count as one x86. Of course if such emulation is made possible by this, the "per processor fee" corporations are going to howl and I don't think their response will quite be "gee whiz".
THe next question would be: can you run java in the x86 emulator that runs an other emulator that runs java, that runs an other emulator.
Just like the old days when you ran windows real mode under a windows 386 mode windows.
The first ten reactions are about how slow Java is. Wake up! It's 2007, NOT 1997. The world has changed. Don't you keep your knowledge up to date? Are you amateurs? And no, a benchmark from 2001 doesn't count too.
Me
Imagine a Beowulf cluster of these...
Since when did emulators become news on slashdot? Its still buggy too. No mouse support (makes playing Lemmings a pain), graphic corruption in some places in Lemmings, arrow keys get effed up when playing Prince of Persia, no sound support, and, well, its kinda slow. Some lagging in Prince of Persia, and I am on a p4. Now, did the original post say that they wanted to use this to test viruses? Please tell me they are not planning on installing windows on this thing.
Although I would smile if they installed Windows 3.1 and the thing dropped into dosshell when you exited. Of course many licensing things there. I guess there is no licensing issues showing off a product you are trying to license with shareware titles, is there?
In soviet Russia x86 emulates Java.
Well.. maybe. Or Maybe not. But Definitely not sort of.
Java isn't really slow when you consider that it is an emulator. As emulators go, Java is down right zippy. Of course everyone seems to forget that it IS an emulator.
The first thing I typed at the prompt was "keyb sf" and it hangs... Great...
I can use the US layout, that's not it, but I prefer to see the letters on my keyboard when I type.
Ahhh...the great dumpster continuum. Many a free computer will be found there. -- sowth (748135)
You're missing something here. Sure, Java is faster than some languages like Python or Ruby or PHP, but that doesn't necessarily put it in the realm of languages that are a good choice for implementing hardware emulators. There are many other languages that would be faster and, at the same time, more high-level than Java. (The ML family comes to mind.) The Java sandbox argument they use in this case is rather bogus - if you're writing an emulator, you can easily build sandbox functionality into it. In short, the choice of Java for this project is nowhere near as rational as the authors would have you believe. They probably chose it because that's what they were familiar with, or because it helped them get funding.
There are at least 2 solutions doing a similar thing. The open source binarytranslator.org/PearColator offers x86 and PowerPC emulation:
http://binarytranslator.org/
There are attempts to integrate this into the JNode open source Java OS to make a JNode/GNU stack.
There is also the VEELS/JXEmu system:
http://nil.ics.uci.edu/~gal/?page=VEELS
which appears not to be publicly available.
An interpreted language being used to write an opcode interpreter.
For an encore, perhaps they can write a JVM in BASIC.
WARNING: Performance implosion imminent due to recursive interpretation.
Do me a favor and don't pimp software until we can be sure it is non-proprietary.
Phillip
Bah... I have them all beat.
I have an x86 emulator written in BASIC with a JavaScript interpreter for extra security, utilizing Firefox's excellent sandboxing and BASIC's general lack of usefulness to ensure that no malware can get through. If malware does slip through, it will give researchers plenty of time to stop it.
but does it run linux? does it eventually??
I can get Simics for free if I am an academic and Simics gives over 300 MIPS on 2GHz AMD64s (and probaly a lot more on the Core 2 CPU). I really fail to see the use of something that probably is dog slow, written in Java, and probably cannot do reverse execution. Oh, btw, Simics does x86, x86-64, SPARC V8/V9, PPC32/64, MIPS32/64, ARM and perhaps some more.
Can someone explain the advantages of the Java based x86-emu in TFA over something like Simics?
via my Firefox on Kubuntu using the Java 1.5 plugin.
The demo started up okay, booting and getting to an A: prompt. But it wouldn't accept keyboard focus so I couldn't enter any instructions to run any of the games.
I contacted the project to let them know. They responded that I probably need to upgrade to Java 1.6 to insure keyboard focus. It's also possible that one of my Firefox extensions might have interfered. They said they have tested JPC with Firefox and Linux but not with Kubuntu specifically.
I was surprised that the startup worked fairly well. There is a very long delay while the Java applet loads and I thought Firefox had frozen, but eventually it started up rather well.
Richard Steven Hack - This sig is TOO GODDAMN SHORT TO DO ANYTHING USEFUL WITH! MORONS!
I don't. What does Java has to offer that some standard C emulator doesn't ?
Some of the current emulators provides special hooks so the emulated code can ask the emulator to perform some task for acceleration (like some emulators provide special graphic and network drivers for the emulated Windows).
But if you cut them, there are no differences between the emulator and a real machine from the virus' point of view.
If the emulator is well done enough there won't be any exploit that the virus could use to make the emulators's host run arbitrary code.
Or are they using Java just because they want not to need to do extra efforts to be sure the virus won't easily escalate out of the emulator ?
"Sufficiently advanced satire is indistinguishable from reality." - [Tips: 1DrYakQDKCQ6y52z6QbnkxHXAocMZJE61o ]
[1995] When I was at university on Java 1.0, we were taught operating systems on emulated Minix. It was fine then, no reason x86 won't be fine now.
Just give this project time. Everybody is queuing up to knock it down, but it should be fine. They're not planning to put Vista on it, just emulate some DOS data entry applications.
[% slash_sig_val.text %]
First of all, what you're suggesting is complete bunk. If you knew even the slightest thing about JIT code generation or the optimizations that the JVM performs, you'd know how completely incorrect you are. Furthermore, your ignorance concerning emulator construction is even more pathetic. In this case, the Java code would get coverted to machine code by the JIT compiler. But that code will in no way be anywhere close to the machine code you're running on the emulator.
Remember, the emulator is virtualizing the x86 hardware. The operation it eventually performs may indeed be similar to that of the machine code being executed. But then there's the overhead of maintaining the virtualized processor state. This includes updating the flags upon each instruction. This also includes the overhead associated with maintaining the various page tables needed when using virtual memory. Then there's the complex address translation that also has to be emulated. Interrupts must be implemented separately, as the actual interrupt mechanism of the underlying x86 processor cannt be used.
Second of all, there is no such thing as a "good Java runtime". Even those put out by the top talent at Sun and IBM are rather terrible. That's basically just because a high-performance Java virtual machine is a difficult beast to construct, especially if you want to make it portable and reliable. For years we've heard about the optimization possibilities associated with JIT compiled code. But we've only seen a mere fraction of what is possible, mainly because hardware advances so quickly these days. It's just not economically feasible to implement such optimizations.
Sorry, but I don't get the point.
Viruses also need OS system calls to do the job. Unless there's also a full Windows emulation in Java (including the Windows bugs and vulnerabilities viruses depend on), how could this be used to analyze how viruses are working? And even if it was the case, what would be the point over QEmu?
If you need to understand what some piece of code is doing, there are tools called debuggers.
{{.sig}}
"Since when did emulators become news on slashdot?"
Sadly it's not just slashdot. I seem to encounter lots of sensational sounding studies by nonspecific "researchers at [Cambridge|Oxford]" performing miraculously mundane feats in the news. In scotland it's also fairly bad with the BBC local news often reporting about research at Glasgow University which is often, quite frankly, fucking laughable.
How much of the x86 instruction set has patents attached to it?
You probably wouldn't see the likes of Intel suing x86 emulators running on x86 (e.g. virtual machines), but it might be a different story if people start using x86 emulators on other CPU architectures through a Java VM because that cuts into their business.
Uhh.. can't we just e-mail the virus to a windows user as we always have? Real panic is more fun than emulated panic.
Bringing liberty to the masses. - http://freetalklive.com/
Then, everything else just works.
Weaselmancer
rediculous.
I tried it out. It's reasonably fast. Seems quite a bit faster than Bochs. Of course an 8086 is easier to emulate than a Pentium-class CPU. All of you saying how slow Java is, well, in this case it isn't.
One example of how Java isn't too slow for this kind of thing: At this years Java One two guys presented their Playstation (1) emulator that was written in Java. It did on the fly compiling from machine code into java classes, and it was able to run PS1 games at full speed.
- 06.php
http://www.lombardisoftware.com/press-release_5-9
It doesn't seem to emulate everything well. I tried running the "Debug" command and it froze up when trying to executing INT 21 (a common DOS interrupt): > Debug -A MOV AH, 2A INT 21 JMP 100 -R -T (crashes at this point) this interrupt basically gets the system time, so there's no reason for it to freeze up like that.
Slow by definition. I wonder if you can use JIT techniques with java at all, but in the end, it still would have to be converted to native code.
Also, for something that's is apparently non-FOSS, they seem to be using both the BOCHS BIOS and the VGA ROM BIOS.... Now the VGA code is AFAIK LGPLd, so they should be okay unless they modified it (a possibility) but I'm pretty sure they had to modify the stock Bochs BIOS, unless they emulated Bochs. In either case, the Bochs BIOS is GPLd.
I was able to run it manually, outside of the applet framework, by doing the following:
r "
(1) Download jar from "http://www.physics.ox.ac.uk/jpc/JPCAppletObfs.ja
(2) Execute using the following java command line:
> java -classpath JPCAppletObfs.jar org.jpc.j2se.PCMonitor
Also the jar archive contains the floppy and HD images, so you can replace them with your own:
> unzip -l JPCAppletObfs.jar
. . .
38400 03-16-07 16:07 vgabios.bin
65536 03-16-07 16:07 bios.bin
10485760 03-16-07 16:07 dosgames.img
1474560 03-16-07 16:07 floppy.img
. . .
13756027 285 files
I tried replacing the floppy.img with a freesco.org linux image, but it failed to boot complaining about missing instructions. I'm guessing it only does the 8086 ISA.
I can also think of a lot of applications that are *not* appropriate for virtual machines because of CPU performance demands. The right tool for the job and all that.
Ok i now need a faster processor, but this is definitely cool. Why? Because it means that, as long as there is Hardware executing Java around, Dos programs can be used. Could make the transition and archiving of existing data easier.
Renders my entering : as a > character (German system). Any other way to change to the c: volume?
The next step will be for Microsoft to embrace-extend-exterminate the design for .NET, then use it to run legacy applications on a new OS that locks out native code and unsigned code.
(This is cynicism - I'm not being too serious.)
"Screw Sun, cross-platform will never work. Let's move on and steal the Java language." - Visual J++ Product Manager
Because this means non-X86 systems can finally run X86 code. Even if it is slow, it is better than not running X86 code at all. I assume it is a virtual X86 CPU in much the same way that MAME and MESS emulate CPUs via software.
I understand that until they are able to fully emulate certain hardware than this could be limited to just DOS programs. I think they at least out to be able to emulate a S3 Virge video card, Sound Blaster 16, Intel Chipset network card, and maybe serial ports with a Hayes compatible modem in order to run some older Windows operating systems in it using a virtual hard drive. Yet until they can at least do some of the GeForce or ATI Radeon virtual graphics cards, it will be hard to do XP and Vista and modern video games.
Just like the old Mac OS (Pre OSX) emulated a 680X0 CPU in software it took a while before PowerMac hardware caught up to allow the 680X0 emulation to be at a decent speed. A pity the same cannot be done to Intel Macs to emulate PowerPC and 680X0 cpus in software because of the big-endian little-endian differences. Although ARDI tried the 680X0 software CPU emulation in Executor they found that trying to do the same for a PowerPC CPU emulation was not as fast.
Still a Java based X86 emulator opens up a lot of possibilities, due to the fact that Java uses a sandbox and if the Java X86 virtual machine gets infected, chances are the host OS won't get infected even if it is a X86 system itself. It could be a good way to study viruses, without risking the host machine.
Remember, Slashdot does not have a -1 disagree moderation, and no, troll, flamebait, and overrated are not substitutes.
> It would have been faster in C++
C++ is not necessarily "always" faster than Java. Java bytecodes get translated to machine codes. Dynamic runtime optimizations and translations based on the platform it's running on, is something that's available in Java and not in C++.
Run a few simple loops with some math and arrays in C++ and in Java, and you'll see that the Java version often runs at about the same speed. Sometimes faster, sometimes slower.
All you people saying how Java is slow may find it pretty amusing that this emulator in fact runs faster than DOSBOX on my G4 Mac Mini. Haven't tried it on a PC yet, though.
Is the sumbitter part of the group that worked on this emulator or something? Waxes on about it like it brings something new to the table even though there's a laundry list of x86 emulators that have long done this one's claim to fame is. Lame. It's not even the first java x86 emulator: http://www.xs4all.nl/~rjoris/retro/
Well there's a good catchphrase for an ad:
"Use Java (TM) on your next performance-intensive software project!
It's not that bad any more!"
Was playing mario and space invaders, at normal speed as if I had an early 80s PC in front of me. Impressive demo.
I happen to use Palm OS, so yes, I could.
And I don't see the point of running a x86 emulator on a phone.
- It's not a useful platform for debugging/analyzing code.
- It's not good for playing old skool DOS games (most smart phone lack the screen resolution)
"Sufficiently advanced satire is indistinguishable from reality." - [Tips: 1DrYakQDKCQ6y52z6QbnkxHXAocMZJE61o ]
in theory something that could revolutionise WebOSes. Instead of using a fixed OS system, users could install whatever OS they want, customise it to their heart's content, and be able to access it anywhere.
Those using pirated Tinysoft signatures(TM) are a real threat to society and should all be thrown in jail.
Wow an x86 emulator written in java, mind you they don't say WHICH variant of the x86 series. May I suggest it's an 80x86? Why, it's written in JAVA after all :)
To get that 'true' 80x86 feel, why not run the JAVA based emulator, on a java interpreter, written in java.
Another toy, written in a toy programming language, seems fair. This does NOTHING that either VMWARE and a good debugger could do, or even BOCHS, QEMU, Etc, and mind you, they can do it far better.
You know something is seriously wrong with Flash when an X86 emulator running within Java outperforms Flash.
Hey mod, I'm serious and I'm making a serious point.
Porting the JVM somewhere is about as much effort as porting a word processor, or any other 100 meg application. But if you port the JVM, all the applications you have in Java are ported by proxy. It's a one-time task.
So if your 100 meg word processor is in Java, once you port the JVM you get the word processor for free. And all of your other Java applications. You don't have to port them seperately. It's one porting task and then you're done.
And now that the JVM is open source, you can expect that to happen more often. It's part of the beauty of running VM based languages.
Weaselmancer
rediculous.
I am also working on a licence that allows me to distribute commecial video games for fee. Do we really think that Sony considers Lemmings abandonware? - cool work though.
I don't know what they are talking about. It's 1000 times slower.
I see this as being useful under one condition only. When you ABSOLUTLY MUST have x86 emulation on a non-x86 platform for whatever reason. Like sparc or power. Much cheaper than those drop-in cards sun sells that let you run windows. (At least I assume it will be) Probably a lot slower though.
"the developers are said to be working on a suitable general license"
So as usual, if it hasn't been fiddled with by Oxonians, it doesn't exist yet... but then they write their own dictionary too, you know.
Now what's really interesting is if they can make a Cell-machine boot using Java boot-strapped.
Running x86 under a PS3 would definately be interesting.
Oxford particle physicists are confusing Space Invaders with particle physics.
This is abuse of tax payers money.
... which is like violence; If it doesn't solve the problem, use more.
http://outcampaign.org/
time since Java used a reference counting GC (if indeed it ever has).