Skip to content

[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] Update kernel base to 6.6.146 - #2027

Merged
opsiff merged 2 commits into
deepin-community:linux-6.6.yfrom
opsiff:linux-stable-update-6.6.146
Jul 30, 2026
Merged

[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] Update kernel base to 6.6.146#2027
opsiff merged 2 commits into
deepin-community:linux-6.6.yfrom
opsiff:linux-stable-update-6.6.146

Conversation

@opsiff

@opsiff opsiff commented Jul 30, 2026

Copy link
Copy Markdown
Member

Update kernel base to 6.6.146.

Summary by Sourcery

Adjust mm_access error semantics and update callers while bumping kernel sublevel to 6.6.146.

Bug Fixes:

  • Standardize mm_access to return -ESRCH via ERR_PTR instead of NULL when no mm_struct is present, and fix callers to handle only error-pointer results.
  • Correct /proc and process memory operations to propagate accurate error codes (ESRCH/EACCES) instead of conflating NULL mm_struct with ESRCH.

Build:

  • Update kernel version sublevel from 6.6.145 to 6.6.146.

ljskernel and others added 2 commits July 30, 2026 16:10
[ Upstream commit cd3f846 ]

mm_access() can return NULL if the mm is not found, but this is handled
the same as an error in all callers, with some translating this into an
-ESRCH error.

Only proc_mem_open() returns NULL if no mm is found, however in this case
it is clearer and makes more sense to explicitly handle the error.
Additionally we take the opportunity to refactor the function to eliminate
unnecessary nesting.

Simplify things by simply returning -ESRCH if no mm is found - this both
eliminates confusing use of the IS_ERR_OR_NULL() macro, and simplifies
callers which would return -ESRCH by returning this error directly.

[lorenzo.stoakes@oracle.com: prefer neater pointer error comparison]
  Link: https://lkml.kernel.org/r/2fae1834-749a-45e1-8594-5e5979cf7103@lucifer.local
Link: https://lkml.kernel.org/r/20240924201023.193135-1-lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit d8a1f7420d2d58fcbde479bd72d0900fb512cb2d)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ae068b67619673618814059f96802314e08050d1)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
@sourcery-ai

sourcery-ai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Reviewer's Guide

Update kernel base to 6.6.146 and adjust mm_access error handling semantics, propagating the new behavior across proc, madvise, and process_vm syscalls.

Sequence diagram for updated mm_access handling in proc_mem_open

sequenceDiagram
    participant proc_mem_open
    participant get_proc_task
    participant mm_access
    participant task_struct

    proc_mem_open->>get_proc_task: get_proc_task(inode)
    get_proc_task-->>proc_mem_open: task

    alt no_task
        proc_mem_open-->>proc_mem_open: return ERR_PTR_ESRCH
    else task_exists
        proc_mem_open->>mm_access: mm_access(task, mode|PTRACE_MODE_FSCREDS)
        mm_access-->>proc_mem_open: mm
        proc_mem_open->>task_struct: put_task_struct(task)

        alt mm_is_ERR_ESRCH
            proc_mem_open-->>proc_mem_open: return NULL
        else mm_is_other_error
            proc_mem_open-->>proc_mem_open: return mm_error
        else mm_is_valid
            proc_mem_open->>mm_access: mmgrab(mm)
            proc_mem_open->>mm_access: mmput(mm)
            proc_mem_open-->>proc_mem_open: return mm
        end
    end
Loading

File-Level Changes

Change Details Files
Adjust proc_mem_open to treat ESRCH from mm_access as a no-mm case and refine mm lifetime management.
  • Return ERR_PTR(-ESRCH) immediately when no task is found
  • Call mm_access unconditionally for a valid task and then drop the task reference
  • Map ERR_PTR(-ESRCH) from mm_access to a NULL return, other errors are propagated as-is
  • Ensure non-error mm_struct is kept alive via mmgrab/mmput before returning
fs/proc/base.c
Make mm_access return ERR_PTR(-ESRCH) instead of NULL when no mm exists, and keep other access checks intact.
  • Call get_task_mm and convert a NULL mm into ERR_PTR(-ESRCH)
  • Preserve ptrace_may_access enforcement, converting unauthorized access into ERR_PTR(-EACCES)
  • Keep mmput on mm when access is denied to avoid leaks
kernel/fork.c
Update users of mm_access to treat only ERR_PTR values as failures and remove special handling for NULL mm.
  • Change process_madvise to treat any error from mm_access via PTR_ERR(mm) and drop the old -ESRCH-on-NULL path
  • Update process_vm_rw_core to interpret errors solely via PTR_ERR(mm), removing the separate NULL handling
  • Adjust map_files_d_revalidate to only treat IS_ERR(mm) as failure rather than IS_ERR_OR_NULL
mm/madvise.c
mm/process_vm_access.c
fs/proc/base.c
Bump kernel sublevel from 145 to 146 to reflect the new upstream base version.
  • Increment SUBLEVEL from 145 to 146 in the top-level Makefile
Makefile

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

@Avenger-285714

Copy link
Copy Markdown
Member

/approve

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Avenger-285714

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

The pull request process is described 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

@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 left some high level feedback:

  • In proc_mem_open, converting ERR_PTR(-ESRCH) back to NULL while returning other errors as ERR_PTR makes the mm_access semantics less uniform; consider consistently using error pointers and adjusting callers instead of special-casing ESRCH.
  • The comparison mm == ERR_PTR(-ESRCH) in proc_mem_open relies on pointer equality with an ERR_PTR value; using IS_ERR(mm) together with PTR_ERR(mm) == -ESRCH would be clearer and less brittle.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `proc_mem_open`, converting `ERR_PTR(-ESRCH)` back to `NULL` while returning other errors as `ERR_PTR` makes the mm_access semantics less uniform; consider consistently using error pointers and adjusting callers instead of special-casing ESRCH.
- The comparison `mm == ERR_PTR(-ESRCH)` in `proc_mem_open` relies on pointer equality with an ERR_PTR value; using `IS_ERR(mm)` together with `PTR_ERR(mm) == -ESRCH` would be clearer and less brittle.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copilot AI 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.

Pull request overview

Updates the Deepin kernel tree to Linux 6.6.146 and aligns mm_access() semantics with upstream expectations by returning ERR_PTR(-ESRCH) when a task has no mm_struct, with corresponding caller adjustments across /proc and process memory syscalls.

Changes:

  • Bump kernel SUBLEVEL from 6.6.145 to 6.6.146.
  • Change mm_access() to return ERR_PTR(-ESRCH) (instead of NULL) when no mm_struct is present.
  • Update process_vm_*, process_madvise, and /proc paths to treat mm_access() results as error-pointers (and preserve /proc “empty for no-mm task” behavior where applicable).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mm/process_vm_access.c Updates mm_access() return handling to rely on IS_ERR()/PTR_ERR() only.
mm/madvise.c Updates process_madvise to treat mm_access() failures as error-pointers only.
kernel/fork.c Changes mm_access() to return ERR_PTR(-ESRCH) when get_task_mm() returns NULL.
fs/proc/base.c Adjusts /proc helpers and map_files logic to the new mm_access() error-pointer semantics, preserving “empty” behavior for no-mm tasks.
Makefile Bumps kernel sublevel to 6.6.146.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fs/proc/base.c
Comment on lines +822 to +823
if (IS_ERR(mm))
return mm == ERR_PTR(-ESRCH) ? NULL : mm;
@opsiff
opsiff merged commit 9de258a into deepin-community:linux-6.6.y Jul 30, 2026
14 of 16 checks passed
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.

6 participants