Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more LFS functions. #105399

Merged
merged 1 commit into from
Dec 14, 2022
Merged

Use more LFS functions. #105399

merged 1 commit into from
Dec 14, 2022

Conversation

mikebenfield
Copy link
Contributor

On Linux, use mmap64, open64, openat64, and sendfile64 in place of their non-LFS counterparts.

This is relevant to #94173.

With these changes (together with rust-lang/backtrace-rs#501), the simple binaries I produce with rustc seem to have no non-LFS functions, so maybe #94173 is fixed. But I can't be sure if I've missed something and maybe some non-LFS functions could sneak in somehow.

@rustbot
Copy link
Collaborator

rustbot commented Dec 6, 2022

r? @thomcc

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 6, 2022
@rustbot
Copy link
Collaborator

rustbot commented Dec 6, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@thomcc
Copy link
Member

thomcc commented Dec 7, 2022

Looks like this is still WIP. Please fix the CI failures, and use \at rustbot ready when you're done to push it back into my queue

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 7, 2022
@mikebenfield
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 7, 2022
@mikebenfield
Copy link
Contributor Author

oh whoops, I picked up some extra commits into this PR somehow. Hold on I'll get rid of them.

On Linux, use mmap64, open64, openat64, and sendfile64 in place of their
non-LFS counterparts.

This is relevant to rust-lang#94173.

With these changes (together with rust-lang/backtrace-rs#501), the
simple binaries I produce with rustc seem to have no non-LFS functions,
so maybe rust-lang#94173 is fixed. But I can't be sure if I've missed something
and maybe some non-LFS functions could sneak in somehow.
@thomcc
Copy link
Member

thomcc commented Dec 9, 2022

Just to check, have you verified that these are present in the version of Linux and glibc we support? It seems to be the case, but some evidence would speed up a review a bit (sorry!)

@mikebenfield
Copy link
Contributor Author

I'm not sure precisely what you're asking, but does this answer it? Non-LFS symbols are usually present in the Rust compiler; with my patch (+lfs) they are not.

~/lfs  [ mbenfield ]
% rustc +lfs main.rs -o mainlfs
~/lfs  [ mbenfield ]
% nm mainlfs | rg 'U (open|openat|sendfile|mmap)'
                 U mmap64@GLIBC_2.2.5
                 U open64@GLIBC_2.2.5
                 U openat64@GLIBC_2.4
                 U sendfile64@GLIBC_2.3
~/lfs  [ mbenfield ]
% rustc main.rs -o main
~/lfs  [ mbenfield ]
% nm main | rg 'U (open|openat|sendfile|mmap)'
                 U mmap@GLIBC_2.2.5
                 U open64@GLIBC_2.2.5
                 U openat@GLIBC_2.4
                 U open@GLIBC_2.2.5
                 U sendfile@GLIBC_2.2.5
~/lfs  [ mbenfield ]
% uname -rv
5.18.16-1rodete4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.16-1rodete4 (2022-10-21)
~/lfs  [ mbenfield ]
% cat main.rs
fn main() {
    ::std::fs::remove_dir_all("/some/fake/directory").unwrap();
    let mut f1 = ::std::fs::File::open("filename1").unwrap();
    let mut f2 = ::std::fs::File::create("filename2").unwrap();
    ::std::io::copy(&mut f2, &mut f1).unwrap();
}

@thomcc
Copy link
Member

thomcc commented Dec 13, 2022

I more meant if any of these functions need to be conditionally loaded due to being unavailable in Linux 3.2/glibc 2.17

@thomcc
Copy link
Member

thomcc commented Dec 13, 2022

That said, the versions are listed in your comment.

@thomcc
Copy link
Member

thomcc commented Dec 13, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Dec 13, 2022

📌 Commit 27011b4 has been approved by thomcc

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 13, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 14, 2022
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#105399 (Use more LFS functions.)
 - rust-lang#105578 (Fix transmutes between pointers in different address spaces (e.g. fn ptrs on AVR))
 - rust-lang#105598 (explain mem::forget(env_lock) in fork/exec)
 - rust-lang#105624 (Fix unsoundness in bootstrap cache code)
 - rust-lang#105630 (Add a test for rust-lang#92481)
 - rust-lang#105684 (Improve rustdoc markdown variable naming)
 - rust-lang#105697 (Remove fee1-dead from reviewers)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 35ff2cf into rust-lang:master Dec 14, 2022
@rustbot rustbot added this to the 1.68.0 milestone Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants