Skip to content

readline: add patch to fix crash when readline is started with an invalid locale specification#12903

Merged
christopherco merged 1 commit into3.0-devfrom
tvuong/readline-locale-crash
Mar 18, 2025
Merged

readline: add patch to fix crash when readline is started with an invalid locale specification#12903
christopherco merged 1 commit into3.0-devfrom
tvuong/readline-locale-crash

Conversation

@trungams
Copy link
Copy Markdown
Member

@trungams trungams commented Mar 11, 2025

…alid locale specification

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • LICENSE-MAP files are up-to-date (./LICENSES-AND-NOTICES/SPECS/data/licenses.json, ./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md, ./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

readline 8.2 would crash when _rl_init_locale is called with an invalid locale specification (e.g locale not available in the system). This causes a problem in initramfs emergency shell because it was not packaged with the preferred locale (C.UTF-8), thus bash will crash and no emergency shell is available. This issue does not affect Mariner 2 as it is using readline 8.1, and the bug seems to be introduced by version 8.2.

Change Log
  • Backport patch to address readline 8.2 crash when started with an invalid locale specification.
Does this affect the toolchain?

YES

Associated issues
Test Methodology

Image built with readline 8.2 including the patch: https://dev.azure.com/mariner-org/mariner/_build/results?buildId=760522&view=results

  1. Boot the image, update grub to append rd.shell=1 rd.break to kernel command line
  2. Set the root password
  3. Regenerate initramfs dracut --force --regenerate-all
  4. Reboot and enter emergency shell
  5. Enter root password, and a bash shell is spawned
  6. Verified with core image and cvm image.

@trungams trungams marked this pull request as ready for review March 12, 2025 23:09
@trungams trungams requested a review from a team as a code owner March 12, 2025 23:09
Copy link
Copy Markdown
Collaborator

@christopherco christopherco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please retarget to 3.0-dev

@trungams trungams changed the base branch from 3.0 to 3.0-dev March 17, 2025 19:12
@microsoft-github-policy-service microsoft-github-policy-service Bot added the 3.0-dev PRs Destined for AzureLinux 3.0 label Mar 17, 2025
…alid locale specification

Signed-off-by: Thien Trung Vuong <tvuong@microsoft.com>
@trungams trungams force-pushed the tvuong/readline-locale-crash branch from 40051a5 to f654c2e Compare March 17, 2025 19:53
@christopherco christopherco merged commit fdaf7da into 3.0-dev Mar 18, 2025
@christopherco christopherco deleted the tvuong/readline-locale-crash branch March 18, 2025 18:21
SumitJenaHCL pushed a commit to SumitJenaHCL/azurelinux that referenced this pull request Aug 20, 2025
…alid locale specification (microsoft#12903)

readline 8.2 would crash when _rl_init_locale is called with an invalid locale specification (e.g locale not available in the system). This causes a problem in initramfs emergency shell because it was not packaged with the preferred locale (C.UTF-8), thus bash will crash and no emergency shell is available. This issue does not affect Mariner 2 as it is using readline 8.1, and the bug seems to be introduced by version 8.2.

Backport patch to address readline 8.2 crash when started with an invalid locale specification.

Signed-off-by: Thien Trung Vuong <tvuong@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.0-dev PRs Destined for AzureLinux 3.0 3.0 PRs Destined for 3.0 Packaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants