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

secrets env cmd command causing segfaults when you try to CTRL + C on the subcommand on slow calls #307

Open
tegefaulkes opened this issue Oct 15, 2024 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@tegefaulkes
Copy link
Contributor

Describe the bug

During usage recently we've been experiencing segfaults while using the pk secrets env command. I haven't experienced this myself yet so I don't have the exact steps that cause this.

To Reproduce

People need to add details when they experience it.

Expected behavior

Running polykey secrets env should not cause a segfault.

Screenshots

Platform (please complete the following information)

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context

Notify maintainers

@tegefaulkes

@tegefaulkes tegefaulkes added the bug Something isn't working label Oct 15, 2024
@tegefaulkes tegefaulkes self-assigned this Oct 15, 2024
Copy link

linear bot commented Oct 15, 2024

@tegefaulkes
Copy link
Contributor Author

tegefaulkes commented Oct 15, 2024

I've created this to track the problem. @CMCDragonkai @brynblack if you run into it at all then please add some details about what happened and why.

Copy link
Member

Does this still happen? This hasn't been noticed for the past 2 months in almost regular usage.

@tegefaulkes
Copy link
Contributor Author

I've never seen it happen. @brynblack @CMCDragonkai Have you seen this happen recently?

@aryanjassal
Copy link
Member

Now that we are also using secrets env when launching the development shell, we still haven't noticed this issue. This means the issue could be already fixed. I'll be closing it now, and if the issue is encountered again, this can be re-opened with more information.

@CMCDragonkai
Copy link
Member

I saw it efore. This happens for when you run a subcommand under secrets env, so not seeing it while running secrets env is not sufficient for closing this issue. There needs to be more tests on subcommands, and specifically it occurs for when you try to CTRL + C the subcommand due to some long running call to secrets env cmd.

@CMCDragonkai CMCDragonkai reopened this Dec 15, 2024
@CMCDragonkai CMCDragonkai changed the title secrets env command causing segfaults secrets env cmd command causing segfaults Dec 15, 2024
@CMCDragonkai CMCDragonkai changed the title secrets env cmd command causing segfaults secrets env cmd command causing segfaults when you try to CTRL + C on the subcommand on slow calls Dec 15, 2024
Copy link
Member

Running a potentially long operation like du -h / in the command and immediately cancelling it does not throw a segfault, but I did run into a segfault if i let the command run.

...
e}\0\0\u{14}\0\0\0\0\0\0\0\0\0\0\0\0\0��\0\0word/webSettings.xmlPK\u{1}\u{2}-\0\u{14}\0\u{6}\0\u{8}\0\0\0!\0\u{8}�u�\u{12}\u{1}\0\0�\u{1}\0\0\u{18}\0\0\0\0\0\0\0\0\0\0\0\0\0��\0\0customXml/itemProps2.xmlPK\u{5}\u{6}\0\0\0\0!\0!\0�\u{8}\0\0d�\0\0\0\0"`: file name contained an unexpected NUL byte', library/std/src/env.rs:353:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
zsh: IOT instruction (core dumped)  pk secrets env vault -- 'du -h /'

So this might be related. If this was the exact error you were getting, then this would be useful to reproduce the issue.

@tegefaulkes
Copy link
Contributor Author

It ran into a null byte where it doesn't expect it. file name contained an unexpected NUL byte. is that the full output of the failure?

@aryanjassal
Copy link
Member

No, but there was a lot of junk. I piped the whole output into a file and got this. I was trying to export a .docx file as an environment variable, which ran into this error. So, the error I was getting is not related to this issue.

errlog.txt

@CMCDragonkai
Copy link
Member

Running a potentially long operation like du -h / in the command and immediately cancelling it does not throw a segfault, but I did run into a segfault if i let the command run.

...
e}\0\0\u{14}\0\0\0\0\0\0\0\0\0\0\0\0\0��\0\0word/webSettings.xmlPK\u{1}\u{2}-\0\u{14}\0\u{6}\0\u{8}\0\0\0!\0\u{8}�u�\u{12}\u{1}\0\0�\u{1}\0\0\u{18}\0\0\0\0\0\0\0\0\0\0\0\0\0��\0\0customXml/itemProps2.xmlPK\u{5}\u{6}\0\0\0\0!\0!\0�\u{8}\0\0d�\0\0\0\0"`: file name contained an unexpected NUL byte', library/std/src/env.rs:353:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
zsh: IOT instruction (core dumped)  pk secrets env vault -- 'du -h /'

So this might be related. If this was the exact error you were getting, then this would be useful to reproduce the issue.

Definitely had to do with the rust code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants