Skip to content

[autobackport: sssd-2-9] KCM: fix TGT renewal use-after-free and stabilize test - #9016

Merged
alexey-tikhonov merged 3 commits into
SSSD:sssd-2-9from
sssd-bot:SSSD-sssd-backport-pr9005-to-sssd-2-9
Jul 28, 2026
Merged

[autobackport: sssd-2-9] KCM: fix TGT renewal use-after-free and stabilize test#9016
alexey-tikhonov merged 3 commits into
SSSD:sssd-2-9from
sssd-bot:SSSD-sssd-backport-pr9005-to-sssd-2-9

Conversation

@sssd-bot

Copy link
Copy Markdown
Contributor

This is an automatic backport of PR#9005 KCM: fix TGT renewal use-after-free and stabilize test to branch sssd-2-9, created by @danlavu.

Please make sure this backport is correct.

Note

The commits were cherry-picked without conflicts.

You can push changes to this pull request

git remote add sssd-bot git@github.com:sssd-bot/sssd.git
git fetch sssd-bot refs/heads/SSSD-sssd-backport-pr9005-to-sssd-2-9
git checkout SSSD-sssd-backport-pr9005-to-sssd-2-9
git push sssd-bot SSSD-sssd-backport-pr9005-to-sssd-2-9 --force

Original commits
2373a46 - KCM: fix use-after-free of ccache name during TGT renewal
854dcda - KCM: free auth_data on TGT renewal setup failure
3efe248 - tests: widen KCM TGT renewal poll window

Backported commits

  • abf6bda - KCM: fix use-after-free of ccache name during TGT renewal
  • 10de2c9 - KCM: free auth_data on TGT renewal setup failure
  • 73f2392 - tests: widen KCM TGT renewal poll window

Original Pull Request Body

  • Fix use-after-free where auth_data->ccname pointed at a short-lived tmp_ctx ccache name freed before the tevent renewal callback (caused flaky renewals against bogus names like KCM:p).
  • Free auth_data on strdup / tevent_create_immediate failure paths.
  • Widen the system test ticket lifetime/poll window now that renewal uses the correct ccache.

Replaces the exploratory work in #8857.

Co-authored-by: Cursor cursoragent@cursor.com
Model used: Cursor Sonnet 5

Dan Lavu added 3 commits July 28, 2026 19:01
auth_data->ccname pointed at cc->name on a short-lived tmp_ctx that is
freed before the tevent immediate renewal callback runs. Copy the name
onto auth_data so krb5_child renews the correct KCM ccache.

Co-authored-by: Cursor <cursoragent@cursor.com>
Model used: Cursor Sonnet 5

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
(cherry picked from commit 2373a46)
Avoid leaking the partially initialized auth_data when strdup or
tevent_create_immediate fails in kcm_creds_check_times().

Co-authored-by: Cursor <cursoragent@cursor.com>
Model used: Cursor Sonnet 5

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
(cherry picked from commit 854dcda)
Use a 10s lifetime and 30s renewable life so renew_till stays past
endtime, and poll for half-life plus slack after the UAF fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
Model used: Cursor Sonnet 5

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
(cherry picked from commit 3efe248)
@sssd-bot

Copy link
Copy Markdown
Contributor Author

The pull request was accepted by @alexey-tikhonov with the following PR CI status:


🟢 CodeQL (success)
🟢 rpm-build:centos-stream-9-x86_64:upstream (success)
🟢 testing-farm:centos-stream-9-x86_64:upstream (success)
🟢 Build / make-distcheck (success)
🟢 ci / prepare (success)
🟢 ci / system (centos-9) (success)
🟢 Static code analysis / codeql (success)
🟢 Static code analysis / pre-commit (success)
🟢 Static code analysis / python-system-tests (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

@sssd-bot
sssd-bot force-pushed the SSSD-sssd-backport-pr9005-to-sssd-2-9 branch from 73f2392 to 216d664 Compare July 28, 2026 19:01
@alexey-tikhonov
alexey-tikhonov merged commit 14e4f14 into SSSD:sssd-2-9 Jul 28, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accepted no-backport This should go to target branch only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants