Home / Class/ NoexecVolumeDetector Class — netty Architecture

NoexecVolumeDetector Class — netty Architecture

Architecture documentation for the NoexecVolumeDetector class in NativeLibraryLoader.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  de042f19_4521_b2c5_59ac_95649b4bada4["NoexecVolumeDetector"]
  34c91fb2_20f7_cd47_7f1f_e75f1425f235["NativeLibraryLoader.java"]
  de042f19_4521_b2c5_59ac_95649b4bada4 -->|defined in| 34c91fb2_20f7_cd47_7f1f_e75f1425f235
  c99af081_4b91_92aa_6d30_6467f872c8bf["canExecuteExecutable()"]
  de042f19_4521_b2c5_59ac_95649b4bada4 -->|method| c99af081_4b91_92aa_6d30_6467f872c8bf
  59635322_0496_8ab2_dc45_b5d6ec7ab267["NoexecVolumeDetector()"]
  de042f19_4521_b2c5_59ac_95649b4bada4 -->|method| 59635322_0496_8ab2_dc45_b5d6ec7ab267

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java lines 514–544

    private static final class NoexecVolumeDetector {

        private static boolean canExecuteExecutable(File file) throws IOException {
            // If we can already execute, there is nothing to do.
            if (file.canExecute()) {
                return true;
            }

            // On volumes, with noexec set, even files with the executable POSIX permissions will fail to execute.
            // The File#canExecute() method honors this behavior, probaby via parsing the noexec flag when initializing
            // the UnixFileStore, though the flag is not exposed via a public API.  To find out if library is being
            // loaded off a volume with noexec, confirm or add executalbe permissions, then check File#canExecute().
            Set<PosixFilePermission> existingFilePermissions = Files.getPosixFilePermissions(file.toPath());
            Set<PosixFilePermission> executePermissions =
                    EnumSet.of(PosixFilePermission.OWNER_EXECUTE,
                            PosixFilePermission.GROUP_EXECUTE,
                            PosixFilePermission.OTHERS_EXECUTE);
            if (existingFilePermissions.containsAll(executePermissions)) {
                return false;
            }

            Set<PosixFilePermission> newPermissions = EnumSet.copyOf(existingFilePermissions);
            newPermissions.addAll(executePermissions);
            Files.setPosixFilePermissions(file.toPath(), newPermissions);
            return file.canExecute();
        }

        private NoexecVolumeDetector() {
            // Utility
        }
    }

Frequently Asked Questions

What is the NoexecVolumeDetector class?
NoexecVolumeDetector is a class in the netty codebase, defined in common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java.
Where is NoexecVolumeDetector defined?
NoexecVolumeDetector is defined in common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java at line 514.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free