Code Monkey home page Code Monkey logo

Comments (15)

DUOLabs333 avatar DUOLabs333 commented on July 21, 2024

The device number, Blocks, and IO Blocks are also different.

from go-nfs.

willscott avatar willscott commented on July 21, 2024

that you can access files implies that the file handles provided by NFS are distinct. There is not a direct passing of an underlying filesystem inode over NFS, nor is the underlying filesystem layout of Blocks translated over the virtual file system.

from go-nfs.

willscott avatar willscott commented on July 21, 2024

link loaders are abstracted from the physical layout of data on disk, the inode/block information are at that layer, so should be distinct from issues loading linked libraries.

The immediate thing I wonder about is that libraries very often are linked using absolute paths, so depending on your mount point you may fail to open the expected data as the library will have been 'relocated' / mounted at a different absolute path from when the link was created.

from go-nfs.

DUOLabs333 avatar DUOLabs333 commented on July 21, 2024

In this case (bash), the libraries are linked with sonames, so this is not an/the issue. To completely rule this out, I tried sudo chroot mount bash -i, which still failed.

I think a problem is that the loader can't get version information, for some reason.

from go-nfs.

willscott avatar willscott commented on July 21, 2024

i'm guessing this is using https://github.com/DUOLabs333/overlay-nfs - can you provide an example of the code you're attempting to compile/link in the overlayfs so I can see if i can reproduce?

from go-nfs.

DUOLabs333 avatar DUOLabs333 commented on July 21, 2024

I exposed /usr/lib with overlay-nfs /=RO ~/test_mount. Then, I'm running bash with LD_LIBRARY_PATH=~/test_mount/usr/lib /bin/bash.

from go-nfs.

DUOLabs333 avatar DUOLabs333 commented on July 21, 2024

While diffing debug logs, I found that with LD_LIBRARY_PATH=~/test_mount/usr/lib /bin/bash, the linker finds /usr/lib/lib{c,ncursesw}.so, but skips them both (it doesn't do anything with them). libc has mbrtowc, but since it skips it, it says it's not found.

Of course, now the question is, why is it skipping the files.

from go-nfs.

willscott avatar willscott commented on July 21, 2024

do you happen to have selinux running? i wonder if it could be something like containers/podman#8985

from go-nfs.

DUOLabs333 avatar DUOLabs333 commented on July 21, 2024

No, but that wouldn't explain why some work and some don't (I would kind of get why libc wouldn't work, but why doesn't libncursesw work?)

from go-nfs.

DUOLabs333 avatar DUOLabs333 commented on July 21, 2024

I have also noticed that the readelf output of test_mount/usr/lib/libc.so.6 has extra tabs at the end vs. the output for /usr/lib/libc.so.6:

stapsdt              0x00000054       NT_STAPSDT (SystemTap probe descriptors)            Provider: libc
    Name: memory_mallopt_trim_threshold
    Location: 0x0000000000093014, Base: 0x000000000015e008, Semaphore: 0x0000000000000000
    Arguments: 8@x20 8@[x0] -4@[x0, 72]
  stapsdt              0x00000047       NT_STAPSDT (SystemTap probe descriptors)            Provider: libc
    Name: memory_mallopt_arena_max
    Location: 0x000000000009303c, Base: 0x000000000015e008, Semaphore: 0x0000000000000000
    Arguments: 8@x20 8@[x0, 32]
  stapsdt              0x00000058       NT_STAPSDT (SystemTap probe descriptors)            Provider: libc
    Name: memory_mallopt_mmap_threshold
    Location: 0x0000000000093054, Base: 0x000000000015e008, Semaphore: 0x0000000000000000
    Arguments: 8@x20 8@[x0, 16] -4@[x0, 72]
  stapsdt              0x00000046       NT_STAPSDT (SystemTap probe descriptors)            Provider: libc
    Name: memory_mallopt_perturb
    Location: 0x0000000000093070, Base: 0x000000000015e008, Semaphore: 0x0000000000000000
    Arguments: -4@x20 -4@[x0, 8]

vs.

stapsdt              0x00000054  NT_STAPSDT (SystemTap probe descriptors)     Provider: libc
    Name: memory_mallopt_trim_threshold
    Location: 0x0000000000093014, Base: 0x000000000015e008, Semaphore: 0x0000000000000000
    Arguments: 8@x20 8@[x0] -4@[x0, 72]
  stapsdt              0x00000047  NT_STAPSDT (SystemTap probe descriptors)     Provider: libc
    Name: memory_mallopt_arena_max
    Location: 0x000000000009303c, Base: 0x000000000015e008, Semaphore: 0x0000000000000000
    Arguments: 8@x20 8@[x0, 32]
  stapsdt              0x00000058  NT_STAPSDT (SystemTap probe descriptors)     Provider: libc
    Name: memory_mallopt_mmap_threshold
    Location: 0x0000000000093054, Base: 0x000000000015e008, Semaphore: 0x0000000000000000
    Arguments: 8@x20 8@[x0, 16] -4@[x0, 72]
  stapsdt              0x00000046  NT_STAPSDT (SystemTap probe descriptors)     Provider: libc
    Name: memory_mallopt_perturb
    Location: 0x0000000000093070, Base: 0x000000000015e008, Semaphore: 0x0000000000000000
    Arguments: -4@x20 -4@[x0, 8]

from go-nfs.

DUOLabs333 avatar DUOLabs333 commented on July 21, 2024

Even more interesting, I can force the loading of libraries with LD_PRELOAD and it will be loaded correctly.

from go-nfs.

willscott avatar willscott commented on July 21, 2024

This makes me think that it's more likely to be an issue with the configured "ld search path" and/or the linker cache, than an issue with enumerating or reading from the mounted filesystem.

from go-nfs.

DUOLabs333 avatar DUOLabs333 commented on July 21, 2024

It seems that only the first library gets loaded --- if I preload libc, libreadline no longer gets loaded. However, this only happens if I preload libc from the mounted directory.

from go-nfs.

DUOLabs333 avatar DUOLabs333 commented on July 21, 2024

I've been looking at the linker source code, and going back to the inode number issue, there are multiple checks to see if two inode numbers are the same --- it's possible that the loader sees that two files' inodes are 0, and assumes they're the same file, skipping them. This would explain why I can only load one library.

from go-nfs.

DUOLabs333 avatar DUOLabs333 commented on July 21, 2024

This fixed the issue --- by adding

stat, ok :=info.Sys().(*syscall.Stat_t)
if ok{
   f.Fileid=stat.Ino
}

to ToFileAttribute, I was able to load the libraries.

from go-nfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.