Coder Social home page Coder Social logo

Log file size problem about shadow HOT 2 CLOSED

robgjansen avatar robgjansen commented on June 7, 2024
Log file size problem

from shadow.

Comments (2)

stevenengler avatar stevenengler commented on June 7, 2024

There seems to be millions of "mmap on fd X for Y bytes failed" warnings. I think this happens because the PR added a new check to make sure it wasn't a special file, and it turns out that tor does try to mmap one of these special files.

// make sure we don't open special files like /dev/urandom, /etc/localtime etc. in the
// plugin via mmap
if unsafe { c::regularfile_getType(file) } != c::_FileType_FILE_TYPE_REGULAR {
warn_once_then_debug!("Tried to mmap a non-regular-file");
return Err(());
}

This causes a warning further up in the calling code.

// this fd exists in the plugin and not shadow; make sure to close this before returning (no
// RAII)
let plugin_fd = file.map(|file| Self::open_plugin_file(ctx.objs, fd, file));
// the file is None for an anonymous mapping, or a non-null Some otherwise
let Ok(plugin_fd) = plugin_fd.transpose() else {
log::warn!("mmap on fd {fd} for {len} bytes failed");
return Err(Errno::EACCES.into());
};

[shadow_rs::host::syscall::handler::mman] (LOG_ONCE) Tried to mmap a non-regular-file
[shadow_rs::host::syscall::handler::mman] mmap on fd 3 for 118 bytes failed
[shadow_rs::host::syscall::handler::mman] mmap on fd 3 for 118 bytes failed
[shadow_rs::host::syscall::handler::mman] mmap on fd 3 for 118 bytes failed
[shadow_rs::host::syscall::handler::mman] mmap on fd 3 for 118 bytes failed
[shadow_rs::host::syscall::handler::mman] mmap on fd 3 for 118 bytes failed
[shadow_rs::host::syscall::handler::mman] mmap on fd 3 for 118 bytes failed
[shadow_rs::host::syscall::handler::mman] mmap on fd 3 for 118 bytes failed

I think I'll make this second warn log a debug log instead.

from shadow.

stevenengler avatar stevenengler commented on June 7, 2024

On my local machine, I only see these warnings for the "fileserver" host. On the benchmark runner, I see it for all tor hosts ("4uthority2", "relay33exitguard", "relay227exit", etc).

At least on my machine, the processes are trying to mmap an fd for "/etc/localtime".

00:00:01.000000000 [tid 1000] open("/etc/localtime", (empty), Mode(0x0)) = 3
00:00:01.000000000 [tid 1000] fstat() = 0
00:00:01.000000000 [tid 1000] mmap(0x0, 118, PROT_READ, MAP_PRIVATE, 3, 0) = 0xfffffffffffffff3 ((unknown errno 13))

We don't want to mmap the native "/etc/localhost" file, but by not doing this we make a lot of unnecessary extra syscalls. Every gettimeofday() call (which tor makes a lot of) results in several syscalls trying to mmap this file. This surprisingly doesn't seem to affect the benchmark results though, which is good.

00:03:15.000000000 [tid 1000] open("/etc/localtime", (empty), Mode(0x0)) = 7
00:03:15.000000000 [tid 1000] fstat() = 0
00:03:15.000000000 [tid 1000] mmap(0x0, 118, PROT_READ, MAP_PRIVATE, 7, 0) = 0xfffffffffffffff3 ((unknown errno 13))
00:03:15.000000000 [tid 1000] close(7) = 0
000000195000000000 [tid 1000] gettimeofday(...) = 0

from shadow.

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.