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

Linux Kernel 6.2 issue #333

Closed
dedguy21 opened this issue Feb 27, 2023 · 30 comments
Closed

Linux Kernel 6.2 issue #333

dedguy21 opened this issue Feb 27, 2023 · 30 comments

Comments

@dedguy21
Copy link

dedguy21 commented Feb 27, 2023

OS: Arch Linux
Kernel: 6.2
Shell: Bash, Zsh, & Nushell
Terminal: Kitty & Wezterm
Mcfly ver: 0.7.1

I was updated to kernel 6.2 the other day, I noticed when using mcfly, though I could ctrl-r and make a selection, that selection wasn't carried through back to the terminal, so it wouldn't execute. Also, selection would not be carried over to be modified either. I checked the issue across three shells, and two different terminal to be sure.

Rolling back to kernel 6.1 fixed the issue for me. This is more of an FYI in case more people update to kernel 6.2

I haven't traced root issues beyond rolling back.

@cantino
Copy link
Owner

cantino commented Feb 28, 2023

Thanks @dedguy21. Maybe related to #212?

@dedguy21
Copy link
Author

More than likely, I'll test and get back to you. Thanks.

@Tealk
Copy link

Tealk commented Feb 28, 2023

I have the same behavior, where can I set this "CONFIG_LEGACY_TIOCSTI"?

@comio
Copy link

comio commented Mar 1, 2023

I have the same behavior, where can I set this "CONFIG_LEGACY_TIOCSTI"?

In your kernel .config file. You need to compile from sources.

@comio
Copy link

comio commented Mar 1, 2023

Thanks @dedguy21. Maybe related to #212?

Yes. This bug can be marked as duplicate of #212

@dedguy21
Copy link
Author

dedguy21 commented Mar 1, 2023

Should I close the issue since it is a repeat of #212?

@kjozsa
Copy link

kjozsa commented Mar 1, 2023

I had hit the same issue, also on arch, with kernel 6.2.1-arch1-1. Is this something what should get fixed in mcfly then or in the kernel?

MingcongBai added a commit to AOSC-Dev/aosc-os-abbs that referenced this issue Mar 2, 2023
- (all) Enable AppArmor by default.
- (all) Complete CONFIG_LSM by upstream template.
- (all) Run dev-sort-config.sh.
- (all) Enable CONFIG_LEGACY_TIOCSTI to fix issue with McFly. [1]

FIXME: CONFIG_LEGACY_TIOCSTI has a known security flaw and upstream recommends
disabling by default. [2] But this breaks userspace, which should enrage Linus
Torvalds, and possibly others. Make most of us happy.

Ref [1]: cantino/mcfly#333
Ref [2]: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=tiocsti
MingcongBai added a commit to AOSC-Dev/aosc-os-abbs that referenced this issue Mar 2, 2023
- (all) Enable AppArmor by default.
- (all) Complete CONFIG_LSM by upstream template.
- (all) Run dev-sort-config.sh.
- (all) Enable CONFIG_LEGACY_TIOCSTI to fix issue with McFly. [1]
- Bump zfs PKGBREAK to <= 2.2.0.

FIXME: CONFIG_LEGACY_TIOCSTI has a known security flaw and upstream recommends
disabling by default. [2] But this breaks userspace, which should enrage Linus
Torvalds, and possibly others. Make most of us happy.

Ref [1]: cantino/mcfly#333
Ref [2]: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=tiocsti
MingcongBai added a commit to AOSC-Dev/aosc-os-abbs that referenced this issue Mar 2, 2023
- (all) Enable AppArmor by default.
- (all) Complete CONFIG_LSM by upstream template.
- (all) Run dev-sort-config.sh.
- (all) Enable CONFIG_LEGACY_TIOCSTI to fix issue with McFly. [1]
- Bump zfs PKGBREAK to <= 2.2.0.

FIXME: CONFIG_LEGACY_TIOCSTI has a known security flaw and upstream recommends
disabling by default. [2] But this breaks userspace, which should enrage Linus
Torvalds, and possibly others. Make most of us happy.

Ref [1]: cantino/mcfly#333
Ref [2]: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=tiocsti
MingcongBai added a commit to AOSC-Dev/aosc-os-abbs that referenced this issue Mar 3, 2023
- (all) Enable AppArmor by default.
- (all) Complete CONFIG_LSM by upstream template.
- (all) Run dev-sort-config.sh.
- (all) Enable CONFIG_LEGACY_TIOCSTI to fix issue with McFly. [1]
- Bump zfs PKGBREAK to <= 2.2.0.

FIXME: CONFIG_LEGACY_TIOCSTI has a known security flaw and upstream recommends
disabling by default. [2] But this breaks userspace, which should enrage Linus
Torvalds, and possibly others. Make most of us happy.

Ref [1]: cantino/mcfly#333
Ref [2]: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=tiocsti
@somepaulo
Copy link

Just updated to 6.2.2-arch1-1, issue persists.

@dedguy21
Copy link
Author

dedguy21 commented Mar 5, 2023

FYI:
An arch maintainer advised me that they are definitely not going to make CONFIG_LEGACY_TIOCSTI available going forward as it poses a potential security risk.

@kauruus
Copy link

kauruus commented Mar 5, 2023

There is a bug in the kernel that prevents me to set dev.tty.legacy_tiocsti, so I make a simple kernel module to re-enable TIOCSTI.

@dedguy21
Copy link
Author

dedguy21 commented Mar 5, 2023

If this works on zsh as long as zsh is the login, then I'll make the switch.

Thanks. I'll close this dup issue.

@dedguy21 dedguy21 closed this as completed Mar 5, 2023
@cantino
Copy link
Owner

cantino commented Mar 6, 2023

It might be worth leaving this open for other people to find.

@cantino cantino reopened this Mar 6, 2023
@kjozsa
Copy link

kjozsa commented Mar 6, 2023

I don't even see how this issue will get resolved. Will bash work around the new kernel limitation? Will mcfly adapt and change the way bash is being used? Will the kernel come up with something which allows again things to work as intented?

Meanwhile, I made the switch to fish, to be able to use the latest kernel while keeping mcfly - so far I'm grateful for getting pushed into this direction.

@a-dekker
Copy link

https://github.com/dvorka/hstr/ is also affected by this, see dvorka/hstr#478.
https://github.com/junegunn/fzf is not affected.

I can confirm using kauruus kernel module does help (#333 (comment)).
And in dvorka/hstr#478 (comment) an attempt is made to fix hstr in a "fzf way".

But so far I did not see McFly having this issue addressed, so in the mean time we need workarounds like the kernel module or alternative tools/shells.

@comio
Copy link

comio commented Mar 12, 2023

I suggest this workaround modifying the bind script:

  • Create a temp file
  • Pass the filename to mcfly executable via a proper option
  • Store the search result to the provided temporary file;
  • source the file and update READLINE_LINE variable accordantly
  • Remove the temporary file

McFly should support a special option to pass and store the search result.

my 2EurCents.

ciao

luigi

@a-dekker
Copy link

The bug that the parameter CONFIG_LEGACY_TIOCSTI cannot be set has been fixed in recent 6.2 kernel releases dvorka/hstr#478 (comment)

@dedguy21
Copy link
Author

The bug that the parameter CONFIG_LEGACY_TIOCSTI cannot be set has been fixed in recent 6.2 kernel releases dvorka/hstr#478 (comment)

I ran the "# sysctl -w dev.tty.legacy_tiocsti=1 " and it works, but rookie question, where do we put the command so we don't have to run it manually every start up?

Not /etc/environment, and the local .bash_profile doesn't have permisson either. What is a good way to automate the process without getting permission failures?

@darthShadow
Copy link

Any sysctl parameters generally go in a custom file in /etc/sysctl.d

@dedguy21
Copy link
Author

Any sysctl parameters generally go in a custom file in /etc/sysctl.d

Works like a charm. Thanks 🙏

@jkseppan
Copy link

jkseppan commented Apr 2, 2023

@comio wrote:

I suggest this workaround modifying the bind script:

  • Create a temp file
  • Pass the filename to mcfly executable via a proper option
  • Store the search result to the provided temporary file;
  • source the file and update READLINE_LINE variable accordantly
  • Remove the temporary file

Here's a patch that implements something like this, but only for replacing the edit buffer. What I couldn't get to work was running the command properly. You could insert it into history with history -s, echo the prompt and command to make it look like you ran it, and write it into a file and source the file, but even then any error status returned by the command does not get conveyed to the shell. I guess this is because it gets called through a readline binding, so it looks to the shell like an editing operation instead of executing a command.

There are various hacks in the answers to this Unix & Linux Stackexchange question that might be adapted. Personally I'm fine with pressing Enter another time after choosing the command.

mcfly.bash.patch

@RHOOPH
Copy link

RHOOPH commented Apr 20, 2023

@dedguy21 @darthShadow Can you please explain the steps to put custom file in etc/sysctl.d and have it run on boot.

@dedguy21
Copy link
Author

@RHOOPH

You should have a directory:
/etc/sysctl.d/

In that directory is where you save your file.

Example:

vim 10_legacy_tiocsti.conf

Then write

legacy_tiocsti=1 in the file

Save to /etc/sysctl.d/10_legacy_tiocsti.conf

@somepaulo
Copy link

Then write

legacy_tiocsti=1 in the file

This should read dev.tty.legacy_tiocsti=1 actually.

@cantino cantino pinned this issue Jun 3, 2023
@benyaminl
Copy link

benyaminl commented Jun 7, 2023

@somepaulo for somereason, /etc/sysctl.d seems doesn't work on new kernel 6.3.x, are they dropping it? Manual set using

sudo sysctl -w dev.tty.legacy_tiocsti=1

Still work, but not the boot .conf file.

any idea why ? Or it's specific to fedora only?

@Dlinuigh
Copy link

@somepaulo for somereason, /etc/sysctl.d seems doesn't work on new kernel 6.3.x, are they dropping it? Manual set using

sudo sysctl -w dev.tty.legacy_tiocsti=1

Still work, but not the boot .conf file.

any idea why ? Or it's specific to fedora only?

Work on arch, with kernel 6.8.1.

@cantino
Copy link
Owner

cantino commented Apr 28, 2024

I'm open to PRs that fix this if anyone sees a path forward.

@cantino
Copy link
Owner

cantino commented May 26, 2024

It'd be great if bash users could test #416

@digikata
Copy link

building and using #416 works for me on a linux 6.8 kernel that was broken w/ bash on the stable release.

@cantino
Copy link
Owner

cantino commented Jun 1, 2024

Should hopefully be fixed by #416 and https://github.com/cantino/mcfly/releases/tag/v0.9.0.

@cantino
Copy link
Owner

cantino commented Jun 3, 2024

I believe this is fixed! Please re-open if not.

@cantino cantino closed this as completed Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests