Bug 202497 - binfmt_script no longer works with strings over 128 bytes long, breaks NixOS
Summary: binfmt_script no longer works with strings over 128 bytes long, breaks NixOS
Status: NEW
Alias: None
Product: File System
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 blocking
Assignee: fs_other
Depends on:
Reported: 2019-02-02 17:56 UTC by las
Modified: 2019-02-18 12:59 UTC (History)
6 users (show)

See Also:
Kernel Version: 5.0
Tree: Mainline
Regression: Yes


Description las 2019-02-02 17:56:13 UTC
In 5.0rc1, NixOS scripts began not working, bug report on GitHub: https://github.com/NixOS/nixpkgs/issues/53672.

User dorianr666 found out that this was because of the 128 byte limit being enforced properly now.

This bug makes NixOS unusable on 5.0rc1 and later, whereas it works perfectly fine on 4.20 and older.
Comment 1 aszlig 2019-02-03 00:06:40 UTC
I've bisected this and the commit that introduces the regression is 8099b047ecc431518b9bb6bdbba3549bbecdc343 (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8099b047ecc431518b9bb6bdbba3549bbecdc343).

Given that for example Perl implements its own parsing of the shebang (https://perl5.git.perl.org/perl.git/blob/04db542212fdad3a62f13afe741c99028f4bf799:/toke.c#l5524) to get around the length and single argument limitation, I'd say this not only affects NixOS. When digging around the Perl source code I found that it is expecting this behavior (silently truncating the shebang line) even on other Unices.
Comment 2 Graham Christensen 2019-02-13 15:16:32 UTC
The patch which has broken this userspace behavior was applied to 4.19.21.
Comment 3 Paul Menzel 2019-02-18 12:59:22 UTC
Thank you for reporting this issue.

See the LKML discussion [1]. It looks like this subsystem does not use the bug tracker, and the mailing list is preferred.

Linux 5.0-rc7 and the stable releases should be fixed now, and this issue can be closed.

[1]: https://lkml.org/lkml/2019/2/15/708

Note You need to log in before you can comment on or make changes to this bug.