Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcef.so: ELF load command alignment not page-aligned #366

Open
mayl0415 opened this issue Apr 22, 2024 · 4 comments
Open

libcef.so: ELF load command alignment not page-aligned #366

mayl0415 opened this issue Apr 22, 2024 · 4 comments

Comments

@mayl0415
Copy link

I'm encountering the following error when trying to load libcef.so:

"libcef.so: ELF load command alignment not page-aligned"

getconf PAGESIZE

65536

readelf -l /myl/jbr_jcef-17.0.6-aarch64-b469/lib/libcef.so

Elf file type is DYN (Shared object file)
Entry point 0x0
There are 11 program headers, starting at offset 64

Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
PHDR 0x0000000000000040 0x0000000000000040 0x0000000000000040
0x0000000000000268 0x0000000000000268 R 0x8
LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000001e83d44 0x0000000001e83d44 R 0x1000
LOAD 0x0000000001e83d80 0x0000000001e84d80 0x0000000001e84d80
0x0000000007cd2540 0x0000000007cd2540 R E 0x1000
LOAD 0x0000000009b562c0 0x0000000009b582c0 0x0000000009b582c0
0x000000000077cd70 0x000000000077cd70 RW 0x1000
LOAD 0x000000000a2d3030 0x000000000a2d6030 0x000000000a2d6030
0x000000000009a620 0x00000000002b3e01 RW 0x1000
TLS 0x0000000009b562c0 0x0000000009b582c0 0x0000000009b582c0
0x0000000000000038 0x0000000000000160 R 0x8
DYNAMIC 0x000000000a2a1720 0x000000000a2a3720 0x000000000a2a3720
0x00000000000003a0 0x00000000000003a0 RW 0x8
GNU_RELRO 0x0000000009b562c0 0x0000000009b582c0 0x0000000009b582c0
0x000000000077dd40 0x000000000077dd40 R 0x1
GNU_EH_FRAME 0x0000000001e7b5dc 0x0000000001e7b5dc 0x0000000001e7b5dc
0x0000000000001874 0x0000000000001874 R 0x4
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RW 0x0
NOTE 0x00000000000002a8 0x00000000000002a8 0x00000000000002a8
0x0000000000000044 0x0000000000000044 R 0x4

Section to Segment mapping:
Segment Sections...
00
01 .note.crashpad.info .note.gnu.build-id .dynsym .gnu.version .gnu.version_r .gnu.hash .dynstr .rela.dyn .rela.plt .rodata .gcc_except_table .eh_frame_hdr .eh_frame
02 .text .init .fini malloc_hook .plt
03 .tdata .fini_array .init_array .data.rel.ro .dynamic .got .got.plt
04 .tm_clone_table .data .bss
05 .tdata .tbss
06 .dynamic
07 .tdata .fini_array .init_array .data.rel.ro .dynamic .got .got.plt
08 .eh_frame_hdr
09
10 .note.crashpad.info .note.gnu.build-id

@mkartashev
Copy link
Collaborator

The message seems accurate, LOAD segment's addresses are not page-aligned. Could you please clarify how exactly did you encounter the error message?

@mayl0415
Copy link
Author

The message seems accurate, LOAD segment's addresses are not page-aligned. Could you please clarify how exactly did you encounter the error message?

My system is Linux arm64, and I have configured IDEA-IC with JBR-JCEF. After installing a JCEF-supported plugin, the plugin reports an error when starting IDEA

@mkartashev
Copy link
Collaborator

Can you give instructions on how to reproduce the problem? The name and version of the plugin, etc.

@bc-lee
Copy link

bc-lee commented Aug 3, 2024

Here is what I tested on an Arm64 system with a 64K page size. It seems all shared libraries have a 64K page size, and IntelliJ IDEA works as expected, though I didn't test all features.

Since I don't have an Arm64 system, I tested on an AWS EC2 Arm64 instance. Here is what I did:

  1. Start an RHEL 9 Arm64 instance on AWS EC2
  2. Connect to the RHEL 9 Arm64 instance
  3. Install the 64K kernel following the instructions at https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/automatically_installing_rhel/installing-kernel-64k-on-arm-using-the-command-line_rhel-installer#installing-kernel-64k-on-arm-using-the-command-line_rhel-installer
    3.1. Install the 64K kernel:
    $ sudo dnf install kernel-64k
    3.2. Set the 64K kernel as the default:
# k=$(echo /boot/vmlinuz*64k)
# grubby --set-default=$k \
           --update-kernel=$k \
           --args="crashkernel=2G-:640M"
  1. Restart the instance
    Before restarting:
$ getconf PAGESIZE
4096
$ uname -a
Linux redacted.ap-northeast-2.compute.internal 5.14.0-427.13.1.el9_4.aarch64 #1 SMP PREEMPT_DYNAMIC Wed Apr 10 16:35:39 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

After restarting:

$ getconf PAGESIZE
65536
$ uname -a
Linux redacted.ap-northeast-2.compute.internal 5.14.0-427.28.1.el9_4.aarch64+64k #1 SMP PREEMPT_DYNAMIC Fri Jul 19 18:58:37 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
  1. Install GUI:
    $ sudo dnf groupinstall "Server with GUI"
  2. Configure X11 Forwarding:
    $ sudo vi /etc/ssh/sshd_config
    Add the following lines:
X11Forwarding yes
X11UseLocalhost yes

Restart sshd:
$ sudo systemctl restart sshd
On the host, configure X11 Forwarding:

$ vi ~/.ssh/config
Host redacted.ap-northeast-2.compute.amazonaws.com
   ForwardX11 yes
   ForwardX11Trusted yes
  1. Reconnect via ssh and test X11 Forwarding:
    $ firefox
    (Note that xclock does not exist in RHEL 9)

  2. Install IntelliJ IDEA 2024.2:

$ curl -OL https://download.jetbrains.com/idea/ideaIC-242.20224.159-aarch64.tar.gz
$ tar -xf ideaIC-242.20224.159-aarch64.tar.gz
$ idea-IC-242.20224.159jbr/bin/java -version
openjdk version "21.0.3" 2024-04-16
OpenJDK Runtime Environment JBR-21.0.3+13-509.4-jcef (build 21.0.3+13-b509.4)
OpenJDK 64-Bit Server VM JBR-21.0.3+13-509.4-jcef (build 21.0.3+13-b509.4, mixed mode)
  1. Test the page size of the shared libraries:
$ sudo dnf install python3-pyelftools
$ curl -OL https://gist.githubusercontent.com/bc-lee/a0b3e9b44d92db6f9ab6ca5d0784a836/raw/54cd91eb953f5d378dbe3007ee6ab24185b5e46f/check_elf_page_size.py
$ chmod +x check_elf_page_size.py
$ ./check_elf_page_size.py $(find idea-IC-242.20224.159 -type f -name "*.so")
failed to parse file: idea-IC-242.20224.159/plugins/maven/lib/maven3/lib/jansi-native/Windows/arm64/libjansi.so: Magic number does not match
Page Size of idea-IC-242.20224.159/plugins/cwm-plugin/quiche-native/linux-aarch64/libquiche.so: 65536
Page Size of idea-IC-242.20224.159/lib/native/linux-aarch64/libsqliteij.so: 65536
Page Size of idea-IC-242.20224.159/lib/jna/aarch64/libjnidispatch.so: 65536
Page Size of idea-IC-242.20224.159/lib/pty4j/linux/aarch64/libpty.so: 65536
Page Size of idea-IC-242.20224.159/bin/libdbm.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libjsig.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libfontmanager_xawt.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libsyslookup.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libnio.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libcef.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libattach.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libsctp.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libawt_xawt.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libsplashscreen.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libj2pcsc.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libmanagement_agent.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libawt.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libjawt.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libshared_mem_helper.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libawt_wlawt.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libjcef.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libnet.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/server/libjsig.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/server/libjvm.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libjaas.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libj2pkcs11.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libEGL.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libextnet.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libjava.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libGLESv2.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libinstrument.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libjdwp.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libverify.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/librmi.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libdt_socket.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libjli.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libmanagement.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libjavajpeg.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/liblcms.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libawt_headless.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libsaproc.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libzip.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libprefs.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libj2gss.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libjsound.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libmlib_image.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libfontmanager.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libvk_swiftshader.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libjimage.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libmanagement_ext.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/lible.so: 65536
Page Size of idea-IC-242.20224.159/jbr/lib/libwlsplashscreen.so: 65536

As you can see, all shared libraries have a 64K page size.

  1. Test if IntelliJ IDEA works as expected:
    $ idea-IC-242.20224.159jbr/bin/idea

At least opening a file works as expected. However, previewing an HTML file in IntelliJ IDEA doesn't work as expected. I'm not sure if it is an issue with JCEF or just an issue with my environment.

I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants