BinDiffHelper icon indicating copy to clipboard operation
BinDiffHelper copied to clipboard

java 'binexport tried to access method' when non default settingsdir set in launch.properties

Open bukowa opened this issue 11 months ago • 4 comments

class com.google.security.zynamics.BinExport$BinExport2 tried to access method 'com.google.protobuf.LazyStringArrayList com.google.protobuf.LazyStringArrayList.emptyList()' (com.google.security.zynamics.BinExport$BinExport2 and com.google.protobuf.LazyStringArrayList are in unnamed module of loader ghidra.GhidraClassLoader @3aa9e816)
java.lang.IllegalAccessError: class com.google.security.zynamics.BinExport$BinExport2 tried to access method 'com.google.protobuf.LazyStringArrayList com.google.protobuf.LazyStringArrayList.emptyList()' (com.google.security.zynamics.BinExport$BinExport2 and com.google.protobuf.LazyStringArrayList are in unnamed module of loader ghidra.GhidraClassLoader @3aa9e816)
	at com.google.security.zynamics.BinExport$BinExport2.<init>(BinExport.java:19352)
	at com.google.security.zynamics.BinExport$BinExport2.<clinit>(BinExport.java:25089)
	at com.google.security.binexport.BinExport2Builder.<init>(BinExport2Builder.java:81)
	at com.google.security.binexport.BinExportExporter.export(BinExportExporter.java:92)
	at bindiffhelper.BinDiffHelperPlugin.binExportDomainFile(BinDiffHelperPlugin.java:131)
	at bindiffhelper.BinDiffHelperPlugin.lambda$callBinDiff$0(BinDiffHelperPlugin.java:164)
	at java.base/java.lang.Thread.run(Thread.java:1583)

---------------------------------------------------
Build Date: 2025-Feb-05 1536 EST
Ghidra Version: 11.3
Java Home: C:\ghidra\ghidra_11.3\Contrib\jdk-21.0.6+7
JVM Version: Eclipse Adoptium 21.0.6
OS: Windows 10 10.0 amd64

bindiff 8 bindiff 7 ghidra 11.3

I don't know what happened but reverting back to v0.6.1 doesn't help...

Edit: doesn't happen with fresh install of ghidra

Edit: I can reproduce if you change these settings to non defaults (set to any dir but must be full path)

# ghidra_11.3_PUBLIC\support\launch.properties
VMARGS=-Dapplication.settingsdir=
VMARGS=-Dapplication.cachedir=

bukowa avatar Feb 12 '25 23:02 bukowa

You can land on this issue

  • https://github.com/google/binexport/issues/137#issuecomment-2403875077
  • https://github.com/google/binexport/issues/144#issuecomment-2643127368

Note the comment near these settings

Overridden values
# are required to be absolute paths. The current user name may be incorporated into the settings
# directory's name if the settings directory lives outside of the user's home directory.

Indeed the paths differ as this is the default path:

Image

This is changed path (*note the username added as comment mentions)

VMARGS=-Dapplication.settingsdir=C:\ghidra\ghidra_11.3\Contrib\APPDATA

Image

This may be some upstream stuff I don't know.

bukowa avatar Feb 12 '25 23:02 bukowa

I'm using nix derivation which has all of those set to defaults.

$ cat /nix/store/j1sq5aa24fbmd5m8r40bz5s9x4dy8b9g-ghidra-11.2.1/lib/ghidra/support/launch.properties  | grep VMARGS | grep appli
VMARGS_MACOS=-Dapple.awt.application.appearance=system
#VMARGS=-Dapplication.settingsdir=
#VMARGS=-Dapplication.cachedir=
#VMARGS=-Dapplication.tempdir=

BonusPlay avatar Feb 13 '25 21:02 BonusPlay

Just to confirm, it happens for me only when this setting is set:

#VMARGS=-Dapplication.settingsdir=

Edit:

INFO  Searching for classes...   (ClassSearcher.java:409) 
INFO  Ignoring class 'com.google.security.binexport.BinExportExporter' from 

'C:\Users\buk\AppData\Roaming\ghidra\ghidra_11.4_DEV_location_IdeaProjects\Extensions\BinExport\lib\BinExport.jar'. 
Already found at 

'C:\Users\buk\AppData\Roaming\ghidra\ghidra_11.4_DEV_location_IdeaProjects\Extensions\BinDiffHelper\lib\BinExport.jar'.   (ClassSearcher.java:452) 

bukowa avatar Feb 14 '25 01:02 bukowa

These are all the non-commented lines in my launch.properties

JAVA_HOME_OVERRIDE=
VMARGS=-Djava.system.class.loader=ghidra.GhidraClassLoader
VMARGS=-Dfile.encoding=UTF8
VMARGS=-Duser.country=US
VMARGS=-Duser.language=en
VMARGS=-Duser.variant=
VMARGS=-Dsun.java2d.opengl=false
VMARGS_LINUX=-Dsun.java2d.pmoffscreen=false
VMARGS_LINUX=-Dsun.java2d.xrender=true
VMARGS_LINUX=-Dsun.java2d.uiScale=1
VMARGS_LINUX=-Dawt.useSystemAAFontSettings=on
VMARGS_WINDOWS=-Dsun.java2d.d3d=false
VMARGS=-Djdk.tls.client.protocols=TLSv1.2,TLSv1.3
VMARGS=-Dcpu.core.limit=
VMARGS=-Dcpu.core.override=
VMARGS=-Dfont.size.override=
VMARGS=-Dpython.console.encoding=UTF-8
VMARGS_MACOS=-Declipse.filelock.disable=true
VMARGS_MACOS=-Dapple.laf.useScreenMenuBar=false
VMARGS_MACOS=-Dapple.awt.application.appearance=system
VMARGS_WINDOWS=-Dlog4j.skipJansi=true
VMARGS=-Xshare:off

and I"m getting this issue

BonusPlay avatar Feb 16 '25 15:02 BonusPlay