Bug 221213 - java/linux-oracle-jdk18: Does not work with NONE-ROOT user
Summary: java/linux-oracle-jdk18: Does not work with NONE-ROOT user
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-java (Nobody)
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2017-08-04 04:01 UTC by jinlong.hao
Modified: 2023-06-21 10:37 UTC (History)
5 users (show)

See Also:
koobs: maintainer-feedback? (java)
koobs: merge-quarterly?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jinlong.hao 2017-08-04 04:01:57 UTC
Hi, ALL:

For some reason, I have change openjdk to linux-oracle-jdk. I've install linux-oracle-jdk on FreeBSD-11(linux-c7 by pkg, linux-oracle-jdk18 by ports), and i find two problems with it:

1. After install linux-oracle-jdk, with root user, i type "java -version" command, and  the error msg appears: "libjli.so: cannot open shared object file: No such file or directory". I simply cp this file from jdk directory to  /compat/linux/lib, the problem is solved.

2. when i change user from root to common user,  the "java -version" seems does not work correctly,  and there is no response any more. Could anyone tell me what's the problem, and how to solve it?
Comment 1 Edward Tomasz Napierala freebsd_committer freebsd_triage 2020-01-13 12:43:36 UTC
Seems to work here, on 13-CURRENT:

trasz@v2:~ % java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
trasz@v2:~ % /usr/local/linux-oracle-jdk1.8.0/bin/java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)

Are you still able to reproduce this?
Comment 2 Petteri Valkonen 2020-10-18 10:08:31 UTC
(In reply to jinlong.hao from comment #0)

For what it's worth, I was experiencing the same symptoms, and allowing unprivileged processes to use process debugging facilities fixed the problem for me.

❯ sysctl security.bsd.unprivileged_proc_debug
security.bsd.unprivileged_proc_debug: 0
❯ /usr/local/linux-oracle-jdk1.8.0/bin/java -version # hangs
^C
❯ doas sysctl security.bsd.unprivileged_proc_debug=1
security.bsd.unprivileged_proc_debug: 0 -> 1
❯ /usr/local/linux-oracle-jdk1.8.0/bin/java -version
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)

truss(1) output for a non-priviledged user with 'security.bsd.unprivileged_proc_debug' set to 0 shows an endless loop of "Operation not permitted" errors when trying to open /proc/self/maps:

60130: linux_open("/proc/self/maps",0x0,0666)    = 3 (0x3)
60130: linux_newfstat(3,0x800729d80)             = 0 (0x0)
60130: linux_mmap2(0x0,0x1000,0x3,0x22,0xffffffffffffffff,0x0) = 34366181376 (0x800625000)
60130: read(3,0x800625000,4096)                  ERR#-1 'Operation not permitted'
60130: read(3,0x800625000,4096)                  ERR#-1 'Operation not permitted'
60130: read(3,0x800625000,4096)                  ERR#-1 'Operation not permitted'
60130: read(3,0x800625000,4096)                  ERR#-1 'Operation not permitted'
60130: read(3,0x800625000,4096)                  ERR#-1 'Operation not permitted'
...

With the variable set to 1, /proc/self/maps can be opened (and closed) successfully.

39570: linux_open("/proc/self/maps",0x0,0666)    = 3 (0x3)
39570: linux_newfstat(3,0x800729d80)             = 0 (0x0)
39570: linux_mmap2(0x0,0x1000,0x3,0x22,0xffffffffffffffff,0x0) = 34366181376 (0x800625000)
39570: read(3,"0000000000400000-000000000040100"...,4096) = 4096 (0x1000)
39570: read(3,"    /compat/linux/usr/lib64/libr"...,4096) = 1357 (0x54d)
39570: close(3)                                  = 0 (0x0)
Comment 3 salmawisoky 2023-06-21 10:37:58 UTC
Drift Boss best 3D level based racing game on PC. https://drift-boss.pro