[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Potential bug in openjdk-11 on mips64el



On Sat, Feb 13, 2021 at 8:56 PM Tiago Daitx <tiago.daitx@canonical.com> wrote:
>
> Hi,
>
> This particular exception is being thrown by the call to unlinkat [1]
> which calls native unlinkat. Man page for unlinkat describes EISDIR
> error [2] as:
> "EISDIR pathname refers to a directory, and AT_REMOVEDIR was not
> specified in flags."
>
> Assuming unlinkat is telling the truth and this is indeed a directory,
> it can be seen from the stacktrace that deleteRecursivelySecure is
> calling deleteFile [3] instead of deleteDir (deleteDir does set
> AT_REMOVERDIR).
>
> This seems to indicate that the isDirectory call [4] is getting wrong
> file attributes. Following the trail, those file attributes come from
> a fstatat call [5] which ultimately come from the native stack in
> UnixNativeDispatcher.c [6]. The actual way that fstatat is called
> depends on the build flags and defines from the arch, so somebody with
> better knowledge might want to take a look at UnixNativeDispatcher.c
> [6] and tell if OpenJDK is picking the right function to call for
> mips64el.
>
> References:
> [1] unlinkat call
> https://sources.debian.org/src/openjdk-11/11.0.10+9-1/src/java.base/unix/classes/sun/nio/fs/UnixSecureDirectoryStream.java/#L200
> [2] EISDIR in OpenJDK:
> https://sources.debian.org/src/openjdk-11/11.0.10+9-1/src/hotspot/share/runtime/os.cpp/#L1504
> [3] https://salsa.debian.org/java-team/guava-libraries/-/blob/master/guava/src/com/google/common/io/MoreFiles.java#L630
> [4] https://salsa.debian.org/java-team/guava-libraries/-/blob/master/guava/src/com/google/common/io/MoreFiles.java#L335
> [5] https://sources.debian.org/src/openjdk-11/11.0.10+9-1/src/java.base/unix/classes/sun/nio/fs/UnixFileAttributes.java/#L90

I missed the most important reference

[6] https://sources.debian.org/src/openjdk-11/11.0.10+9-1/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c/

-- 
Tiago Stürmer Daitx
Software Engineer
tiago.daitx@canonical.com

PGP Key: 4096R/F5B213BE (hkp://keyserver.ubuntu.com)
Fingerprint = 45D0 FE5A 8109 1E91 866E  8CA4 1931 8D5E F5B2 13BE


Reply to: