Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Failed to allocate closure when SELinux is enabled and non-root user is used

オープン
#1,505 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
java

調査の方向性

まず、SELinux を有効にした Amazon Linux 2 上で、root ではないユーザーとして、JNA 5.13.0 と提供された Lazysodium の例を使用して障害を再現します。com.sun.jna.Native.registerMethod から Native.register まで障害を追跡し、この環境で closure の割り当てが異なる理由を特定します。影響を受ける非 root 構成で、SELinux の保護を弱めることなくネイティブライブラリが正常にロードされれば完了です。

索引モデルが issue の本文から書いたものです。

説明

JNA fails to load a native library if SELinux is enabled and I run my code as a non-root user. I tested with Lazysodium for Java, but I don't think that this issue is specific to this particular library only.

Changing the SELinux mode to the permissive doesn't help and there is no record in /var/log/audit/audit.log.

If I run my code as root, the error won't occur. If I disable SELinux and I run my code as a non-root, the error won't occur either.

OS: Amazon Linux 2
System architecture: x86_64
Java: OpenJDK Runtime Environment (build 1.8.0_352-b08)
JNA version: 5.13.0

Stacktrace

Exception in thread "main" java.lang.UnsupportedOperationException: Failed to allocate closure
        at com.sun.jna.Native.registerMethod(Native Method)
        at com.sun.jna.Native.register(Native.java:1906)
        at com.sun.jna.Native.register(Native.java:1775)
        at com.goterl.resourceloader.SharedLibraryLoader.registerLibraryWithClasses(SharedLibraryLoader.java:81)
        at com.goterl.resourceloader.SharedLibraryLoader.load(SharedLibraryLoader.java:58)
        at com.goterl.lazysodium.utils.LibraryLoader.loadBundledLibrary(LibraryLoader.java:134)
        at com.goterl.lazysodium.utils.LibraryLoader.loadLibrary(LibraryLoader.java:95)
        at com.goterl.lazysodium.SodiumJava.<init>(SodiumJava.java:34)
        at com.goterl.lazysodium.SodiumJava.<init>(SodiumJava.java:23)

Steps to reproduce:

import com.goterl.lazysodium.SodiumJava;

public class JnaTest {

    public static void main(String[] args) {
        SodiumJava sodiumJava = new SodiumJava();
    }

}

Dependencies:

<dependency>
    <groupId>net.java.dev.jna</groupId>
    <artifactId>jna</artifactId>
    <version>5.13.0</version>
</dependency>
<dependency>
    <groupId>com.goterl</groupId>
    <artifactId>lazysodium-java</artifactId>
    <version>5.1.4</version>
</dependency>
主要言語
Java
スター
8.9k
フォーク
1.7k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

java-native-access/jna のほかの issue

java-native-access/jna の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。