Skip to content

Conversation

@gfdgd-xi
Copy link

@gfdgd-xi gfdgd-xi commented Dec 27, 2025

Export the currently un-exported symbols to support some Android emulator such as kmre and so on.

Summary by Sourcery

Export previously internal kernel symbols required by Android driver and emulator support.

Enhancements:

  • Make binder security hooks available to out-of-tree modules via GPL symbol exports.
  • Expose list_lru add/delete helpers as GPL-exported symbols for external users.
  • Export file_close_fd, init_ipc_ns, put_ipc_ns, can_nice, __wake_up_pollfree, task_work_add, zap_page_range_single, and lock_vma_under_rcu for use by GPL-licensed kernel modules.

symbols: Export symbols needed by Android Drivers

Signed-off-by: gfdgd_xi <[email protected]>
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 27, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Exports a set of core kernel and security helper symbols as GPL-only to support out-of-tree Android drivers and emulator components, without changing their internal behavior.

Sequence diagram for Android driver using binder security helper

sequenceDiagram
    actor AndroidDriver
    participant Kernel as KernelModuleBinder
    participant Security as LSMHooks

    AndroidDriver->>Kernel: security_binder_transaction(from_cred, to_cred)
    Kernel->>Security: binder_transaction(from_cred, to_cred)
    Security-->>Kernel: decision (allow_or_deny)
    Kernel-->>AndroidDriver: return decision
Loading

File-Level Changes

Change Details Files
Export binder LSM helper functions for use by out-of-tree Android modules
  • Add EXPORT_SYMBOL_GPL declarations for security_binder_set_context_mgr
  • Add EXPORT_SYMBOL_GPL declarations for security_binder_transaction
  • Add EXPORT_SYMBOL_GPL declarations for security_binder_transfer_binder
  • Add EXPORT_SYMBOL_GPL declarations for security_binder_transfer_file
security/security.c
Expose list LRU helpers to GPL modules
  • Export list_lru_add for external use
  • Export list_lru_del for external use
mm/list_lru.c
Expose file descriptor close helper to GPL modules
  • Export file_close_fd to allow external modules to close FDs and get struct file
fs/file.c
Expose IPC namespace and lifetime management helpers
  • Export init_ipc_ns to make the initial IPC namespace visible to modules
  • Export put_ipc_ns so modules can safely drop references to IPC namespaces
ipc/msgutil.c
ipc/namespace.c
Expose scheduling and waitqueue helpers
  • Export can_nice so external code can validate nice level changes
  • Export __wake_up_pollfree for modules interacting with poll waitqueues
kernel/sched/syscalls.c
kernel/sched/wait.c
Expose task work and memory management helpers
  • Export task_work_add so modules can enqueue task work callbacks
  • Export zap_page_range_single so modules can unmap page ranges
  • Export lock_vma_under_rcu to allow RCU-safe VMA locking in modules
kernel/task_work.c
mm/memory.c
mm/mmap_lock.c

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

Hi @gfdgd-xi. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@gfdgd-xi gfdgd-xi changed the title symbols: Export symbols needed by Android Drivers [linux-6.18.y] symbols: Export symbols needed by Android Drivers Dec 27, 2025
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

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

@Avenger-285714
Copy link
Member

@opsiff
Waiting for opsiff's review. Since this task performs best with single-threaded execution, it might be a lesser effort for him to backport these commits from a lower kernel version.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request exports internal kernel symbols as GPL-only exports to enable Android driver and emulator support (such as KMRE). The changes add EXPORT_SYMBOL_GPL macros to 14 previously unexported functions across the kernel subsystems including security, memory management, scheduling, IPC, and filesystem layers.

  • Adds GPL symbol exports for binder security hooks to enable external binder implementations
  • Exports memory management functions (VMA locking, page unmapping, LRU list operations) for memory subsystem interactions
  • Exposes scheduler and task management functions for process control operations
  • Makes IPC namespace and file descriptor operations available to external modules

Reviewed changes

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

Show a summary per file
File Description
security/security.c Exports 4 binder security hook functions for Android IPC support
mm/mmap_lock.c Exports lock_vma_under_rcu for VMA locking support (with placement issue)
mm/memory.c Exports zap_page_range_single for memory unmapping operations
mm/list_lru.c Exports list_lru_add and list_lru_del for LRU list management
kernel/task_work.c Exports task_work_add for task work queue operations
kernel/sched/wait.c Exports __wake_up_pollfree for wait queue operations
kernel/sched/syscalls.c Exports can_nice for nice value checking
ipc/namespace.c Exports put_ipc_ns for IPC namespace reference management
ipc/msgutil.c Exports init_ipc_ns global for IPC namespace initialization
fs/file.c Exports file_close_fd for file descriptor closing operations

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


return vma;
}
EXPORT_SYMBOL_GPL(lock_vma_under_rcu);
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

The EXPORT_SYMBOL_GPL(lock_vma_under_rcu) is placed after the wrong function. The lock_vma_under_rcu function ends at line 270, but this export is placed at line 362 after the lock_next_vma function. This will cause the export to be associated with the wrong function symbol. Move this line to immediately after line 270 where lock_vma_under_rcu actually ends.

Suggested change
EXPORT_SYMBOL_GPL(lock_vma_under_rcu);

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

The EXPORT_SYMBOL_GPL(lock_vma_under_rcu) is placed after the wrong function. The lock_vma_under_rcu function ends at line 270, but this export is placed at line 362 after the lock_next_vma function. This will cause the export to be associated with the wrong function symbol. Move this line to immediately after line 270 where lock_vma_under_rcu actually ends.

虽然这比较奇怪 但是按我的理解不应该影响功能 @gfdgd-xi 看看改一下?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants