Skip to content

fix: drop the internal UT-2026-0115 su pseudo-terminal patch - #29

Open
Zeno-sole wants to merge 1 commit into
deepin-community:masterfrom
Zeno-sole:fix/drop-ut-2026-0115
Open

Zeno-sole wants to merge 1 commit into
deepin-community:masterfrom
Zeno-sole:fix/drop-ut-2026-0115

Conversation

@Zeno-sole

@Zeno-sole Zeno-sole commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

目的

移除内部补丁 UT-2026-0115-su-tiocsti.patch,让 su 回到上游 util-linux 的默认行为:只有显式指定 -P/--pty 时才分配私有伪终端。

背景

该补丁让「stdin 是 tty 的交互式 su」默认设置 su->force_pty = 1,即无论是否请求,都为目标会话创建一个新的伪终端。这不是上游行为,也不是上游的安全策略:

  • 上游 util-linux 只在显式 -P/--pty 时创建私有 pty,runuser 保持历史行为不变;
  • 该补丁防的是 TIOCSTI/TIOCLINUX 注入(CVE-2016-2779 类问题),但 6.2 及以上内核默认已禁用 TIOCSTI(dev.tty.legacy_tiocsti=0),
  • 副作用是交互式 su 与调用方不再共享控制终端,依赖同一终端的场景(script/screen/expect、终端复用、部分终端工具与审计方案)会被打断。

历史上该移除提交过(3b29e0b),随后被 0591854 整体回退;本 PR 重新应用该移除,并带一条新的 changelog 版本条目 2.40.4-3deepin18。

改动

  • 删除 debian/patches/UT-2026-0115-su-tiocsti.patch
  • 从 debian/patches/series 移除对应条目(其余 46 个补丁顺序不变)
  • debian/changelog 新增 2.40.4-3deepin18

验证

  • git archive HEAD 导出后 quilt push -a:46 个补丁全部干净应用,无 .rej、无 fuzz;

  • login-utils/su-common.c 与未打补丁的上游源码一致(force_pty 仅剩上游自身的 -P/-T 处理),仓库内除 changelog 外不再有 UT-2026-0115 引用;

  • 编译:--disable-all-programs --enable-su --enable-runuser,su 与 runuser 均编译通过;

  • 行为(在 pty 中实测,root 调用 su - <user>):

    命令 子进程 tty 结论
    su - <user> -c 'tty'(默认) /dev/pts/10(= 父终端) 不再分配私有 pty ✔
    su -P - <user> -c 'tty' /dev/pts/11(新 pty) -P/--pty 仍可用 ✔
    runuser -u <user> -- echo 正常执行 runuser 行为未变 ✔

    对照组:本机已安装的 util-linux(带该补丁)默认 su 的子进程 tty 是 /dev/pts/11,与本分支行为相反,说明移除确实生效。

影响

  • 交互式 su 恢复与调用方共享控制终端;
  • 需要隔离终端(例如给不可信会话隔离 TTY)的调用方需显式使用 su -P;
  • runuser 不受影响。

Summary by Sourcery

Restore shared-terminal behavior for interactive su by dropping the internal automatic pseudo-terminal patch.

Bug Fixes:

  • Restore upstream util-linux su behavior by removing the internal patch that automatically allocated a private pseudo-terminal for interactive sessions.
  • Preserve explicit su -P/--pty pseudo-terminal allocation while leaving runuser behavior unchanged.

Chores:

  • Add changelog entry for version 2.40.4-3deepin18 and remove the retired patch from the patch series.

The patch forced interactively started su to allocate its own
pseudo-terminal by default. That is not upstream behavior: upstream
util-linux only creates a private pty when -P/--pty is given
explicitly, and runuser keeps its historical behavior.

Remove the patch and its series entry so su returns to the upstream
default. -P/--pty is still available for callers that want the private
pseudo-terminal, and kernels >= 6.2 keep TIOCSTI disabled by default.
No other patches depend on this one; the remaining series still applies
cleanly.

This re-applies the removal from 3b29e0b, which was reverted in 0591854.

Log: Removed the internal UT-2026-0115 su patch, restoring upstream su terminal behavior

Influence:
1. Verify su works interactively without a private pty by default
2. Verify su -P/--pty still creates a private pseudo-terminal
3. Verify runuser behavior is unchanged
4. Verify the package builds with the reduced patch series

fix: 移除内部 UT-2026-0115 su 伪终端补丁

该补丁让交互式启动的 su 默认分配自己的伪终端。这不是上游行为:
上游 util-linux 只在显式指定 -P/--pty 时才创建私有 pty,
runuser 保持原有行为。

移除该补丁及 series 条目,使 su 回到上游默认行为。
需要私有伪终端的调用方仍可使用 -P/--pty,
且 6.2 及以上内核默认禁用 TIOCSTI。
没有其他补丁依赖此补丁,剩余 series 仍可干净应用。

重新应用 3b29e0b 的移除(该提交已被 0591854 回退)。

Log: 移除内部 UT-2026-0115 su 补丁,恢复上游 su 终端行为

Influence:
1. 验证 su 交互式登录默认不再使用私有 pty
2. 验证 su -P/--pty 仍能创建私有伪终端
3. 验证 runuser 行为未发生变化
4. 验证裁剪补丁后的包可以正常构建

repo: util-linux #master
@sourcery-ai

sourcery-ai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR removes the internal TIOCSTI-mitigation patch and its quilt-series entry so su follows upstream util-linux behavior: default interactive sessions share the caller’s controlling terminal, while -P/--pty still creates an isolated pseudo-terminal and runuser is unaffected. The change is documented in a new changelog entry and was validated through clean patch application, targeted compilation, and PTY behavior checks.

File-Level Changes

Change Details Files
Removes the internal patch that forced interactive su sessions onto a private pseudo-terminal, restoring upstream terminal-sharing behavior.
  • Deletes the UT-2026-0115-su-tiocsti.patch implementation.
  • Removes the patch from the quilt series while preserving the remaining patch order.
  • Restores private PTY allocation to explicit su -P/--pty requests; leaves runuser unchanged.
debian/patches/UT-2026-0115-su-tiocsti.patch
debian/patches/series
Records the behavior change in the package changelog.
  • Adds changelog version 2.40.4-3deepin18.
debian/changelog

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from zeno-sole. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

Copy link
Copy Markdown

TAG Bot

TAG: 2.40.4-3deepin18
EXISTED: no
DISTRIBUTION: unstable

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@Zeno-sole

Copy link
Copy Markdown
Contributor Author

/integrate

@github-actions

Copy link
Copy Markdown

AutoIntegrationPr Bot
auto integrate with pr url: deepin-community/Repository-Integration#4713
PrNumber: 4713
PrBranch: auto-integration-40874986239

@hudeng-go

Copy link
Copy Markdown
Contributor

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants