GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-152936: Make privileged functions available on Android by sabamdarif · Pull Request #152977 · python/cpython

Conversation

@sabamdarif

@sabamdarif sabamdarif commented Jul 3, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

os.chroot,initgroups,setegid,seteuid,setgid.... are currently blocked on Android.
Because the underlying C functions crash the process when called by a non-root user on android, rather than returning an error.
So i added getuid() != 0 check (under #ifdef __ANDROID__) before each call, so it will return PermissionError for non-root just like normal Unix

  • Fixes Make privileged functions available on Android #152936
  • Issue: Make privileged functions available on Android #152936

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sabamdarif
pythongh-152936: Make privileged functions available on Android
8b77d9d
@sabamdarif
sabamdarif requested review from AA-Turner, corona10, emmatyping, erlend-aasland and itamaro as code owners July 3, 2026 19:11
@bedevere-app

bedevere-app Bot commented Jul 3, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@python-cla-bot

python-cla-bot Bot commented Jul 3, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot mentioned this pull request Jul 3, 2026
Make privileged functions available on Android #152936
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Jul 3, 2026
@sabamdarif

sabamdarif commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

it's my first pr here so i don't know much about the NEWS entry, if it's not a problem can anyone tell me if i do need to add any NEWS entry ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@read-the-docs-community

read-the-docs-community Bot commented Jul 3, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34351207 | 📁 Comparing d4df9df against main (423ae0f)

  🔍 Preview build  

184 files changed · + 4 added · ± 180 modified

+ Added

  • library/asyncio-tools.html
  • library/time-complexity.html
  • library/tkinter.fontchooser.html
  • library/tkinter.systray.html

± Modified

  • glossary.html
  • index.html
  • license.html
  • py-modindex.html
  • c-api/arg.html
  • c-api/capsule.html
  • c-api/exceptions.html
  • c-api/float.html
  • c-api/import.html
  • c-api/init_config.html
  • and 170 more...
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Aniketsy

Aniketsy commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

it's my first pr here so i don't know much about the NEWS entry, if it's not a problem can anyone tell me if i do need to add any NEWS entry ?

thanks for the PR, as per my thought yes, this will need NEWS entry but you can wait for the review and then you can add NEWS entry ( to get 100 % sure 😀)

sabamdarif reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhsmith
mhsmith self-requested a review July 4, 2026 01:26
@sabamdarif

sabamdarif commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

i have another question for the Android test failure should i update the test_posix.py ? to do something like if support.is_android and os.getuid() != 0: so it will not failed on PermissionError ? or should i need to update something on my patch so the existing test pass

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sabamdarif

sabamdarif commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

why did the Tests / Sanitizers / TSan (free-threading) (pull_request) failed i don't get it ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertkirkman

robertkirkman commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

We can see that the cause of one of the test failures probably is that the Python test suite has interpreted the unblocking of setresuid() as an indication that it should be usable as non-root user, even though we want to use it as root user and continue to show an error for non-root users;

cpython/Lib/test/test_os/test_posix.py

Lines 99 to 105 in 0621639

@unittest.skipUnless(hasattr(posix, 'setresuid'),
'test needs posix.setresuid()')
def test_setresuid(self):
current_user_ids = posix.getresuid()
self.assertIsNone(posix.setresuid(*current_user_ids))
# -1 means don't change that value.
self.assertIsNone(posix.setresuid(-1, -1, -1))

I would say that yes, the test should probably be modified to check for Android platform, and in the case of Android platform, only test that function if the test is running as root user;

however, what I find concerning is that the CI here only produced a failure for x86_64, and not for aarch64, even though in my own separate test, both x86_64 and aarch64 architectures of Android should be returning the same result from the same function:

image

I wonder if that suggests there is a deeper problem with the tests or an inconsistency somewhere in the test implementation between x86_64 and aarch64.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sabamdarif

sabamdarif commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

@robertkirkman yes, let see what others are saying about this . I still didn't get any other comment from any of the core maintainers

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertkirkman

robertkirkman commented Jul 6, 2026 •
edited by mhsmith
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Skipping tests: GitHub Actions does not support the Android emulator on this platform.

Ah I see, the aarch64 build does not run the test suite in CI, so if it did, it would also have that error.

cpython/Platforms/Android/__main__.py

Lines 844 to 852 in 881a13a

if (
"GITHUB_ACTIONS" in os.environ
and (platform.system(), platform.machine()) != ("Linux", "x86_64")
):
print(
"Skipping tests: GitHub Actions does not support the Android "
"emulator on this platform."
)
else:

Discussion of testing aarch64 Android on GitHub Actions

It's possible in theory, in some projects, to implement testing aarch64 Android platform in CI, but in this case, based on my understanding of CPython and Android cumulatively so far, in order to implement that in CPython CI, one of the two following blockers would have to be overcome:

  1. the current official upstream build.gradle.kts would have to be split in some way so that all portions of it related to Android NDK and all portions of it related to running the managed emulator (technically virtual machine) are in two separate files or at least run separately, on two separate runners - the NDK portion on the GitHub Actions x86 runner and the emulator portion on the GitHub Actions ARM runner.

cpython/Platforms/Android/testbed/app/build.gradle.kts

Lines 119 to 130 in 881a13a

ndk.abiFilters.addAll(abis.values)
externalNativeBuild.cmake.arguments(
"-DPYTHON_PREFIX_DIR=" + if (inSourceTree) {
// AGP uses the ${} syntax for its own purposes, so use a Jinja style
// placeholder.
"$PYTHON_CROSS_DIR/{{triplet}}/prefix"
} else {
prefixes[0]
},
"-DPYTHON_VERSION=$pythonVersion",
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
)

cpython/Platforms/Android/testbed/app/build.gradle.kts

Lines 266 to 270 in 881a13a

val systemImage = listOf(
"system-images",
"android-${apiLevel.get()}",
systemImageSource.get(),
abi.get(),

  1. Alternatively, another way to do that would be to obtain or build an unofficial build of the Android NDK for running on aarch64 GNU/Linux which could be used to build the testbed and run it in the managed emulator (technically virtual machine) contiguously on the same aarch64 GNU/Linux runner.

both of these blockers arise because Google has never officially released any prebuilt Android NDK archives for the platform aarch64 GNU/Linux. If they do in the future some time, that would change.

I don't know why the aarch64 macos runner that's currently used to build the aarch64 target Android testbed in CI isn't able to run the managed emulator (technically virtual machine), so I've just described this situation from the perspective I know, which is that of what would be required in the case of using entirely GNU/Linux runners for it.

cpython/.github/workflows/build.yml

Lines 337 to 349 in 881a13a

build-android:
name: Android (${{ matrix.arch }})
needs: build-context
if: needs.build-context.outputs.run-android == 'true'
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- arch: aarch64
runs-on: macos-26
- arch: x86_64
runs-on: ubuntu-24.04

it is understandable that all of this work is probably not worth it until there is a very important need to run the Android testbed for aarch64 in CI here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhsmith mhsmith added the needs backport to 3.15 bugs and security fixes label Jul 7, 2026
@mhsmith

mhsmith commented Jul 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

It would be very useful to run the tests on aarch64 on GitHub Actions, but the macOS runner is apparently already a virtual machine, so it can't run the emulator.

another way to do that would be to obtain or build an unofficial build of the Android NDK for running on aarch64 GNU/Linux which could be used to build the testbed and run it in the managed emulator (technically virtual machine) contiguously on the same aarch64 GNU/Linux runner.

But the Android emulator isn't available for aarch64 Linux either. From this discussion, it sounds like it is possible to build it from source, but do you know of any downloadable build which is suitable for production use?

robertkirkman reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mhsmith
mhsmith reviewed Jul 7, 2026
View reviewed changes

@mhsmith mhsmith left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

can anyone tell me if i do need to add any NEWS entry ?

It's a change in behavior, so there should be a NEWS entry in the "Library" section. I think it's enough for it to list the functions and say that they are now available on Android. It doesn't need to go into details of exactly how this was done.

should i update the test_posix.py ? to do something like if support.is_android and os.getuid() != 0: so it will not failed on PermissionError ? or should i need to update something on my patch so the existing test pass

On Linux, apparently the set...id functions all allow an unprivileged process to set any of the IDs to any of the saved, effective or real IDs (i.e. the values returned by getres...id), or in some cases, -1 to leave the ID unchanged. You should test whether this is true on Android as well, and if so, update the code to allow the function to run under those circumstances. Then the test will pass.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sabamdarif reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Modules/posixmodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/posixmodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@mhsmith

mhsmith commented Jul 7, 2026

Copy link
Copy Markdown
Member

why did the Tests / Sanitizers / TSan (free-threading) (pull_request) failed i don't get it ?

Those tests are unreliable; you can ignore them for now.

robertkirkman and sabamdarif reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertkirkman

robertkirkman commented Jul 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

But the Android emulator isn't available for aarch64 Linux either. From beeware/briefcase#449 (comment), it sounds like it is possible to build it from source, but do you know of any downloadable build which is suitable for production use?

yes, that's completely right; not only would an aarch64 build of the Android NDK probably be required, also an aarch64 build of the emulator would be, though the part of the emulator that I believe would need to be compiled is the part that is mostly formed from QEMU, and doesn't take as long to compile as the entire AVD image would take to build (which I think wouldn't be required), nor as long as the Android NDK would take to build. I agree, though, that both a custom emulator QEMU and a custom NDK are probably too complicated and involve too many unofficial steps for them to be worth using for CPython unless a pressing need for running the aarch64 Android tests in CI is found.

On Linux, apparently the set...id functions all allow an unprivileged process to set any of the IDs to any of the saved, effective or real IDs (i.e. the values returned by getres...id), or in some cases, -1 to leave the ID unchanged. You should test whether this is true on Android as well, and if so, update the code to allow the function to run under those circumstances. Then the test will pass.

I am not sure exactly what the matrix of crashing vs not crashing looks like for this beyond "some of the functions here cause crashing when called as non-root user", but I can confirm that not all of the functions appear to be able to crash the program, only certain ones or combinations of arguments with certain ones, since I just now checked these several and saw these results, on Samsung Galaxy S8+ SM-G955F with Android 16:

does not crash

#include <stdio.h>
#include <unistd.h>

int main(void) {
    printf("%d\n", setresuid(-1, -1, -1));
}

does not crash

#include <stdio.h>
#include <unistd.h>

int main(void) {
    uid_t r, e, s;
    getresuid(&r, &e, &s);
    printf("%d\n", setresuid(r, e, s));
}

does not crash

#include <stdio.h>
#include <unistd.h>

int main(void) {
    printf("%d\n", setresuid(0, 0, 0));
}

crashes with Unknown signal 31

#include <stdio.h>
#include <unistd.h>

int main(void) {
    printf("%d\n", setgid(0));
}

crashes with Unknown signal 31

#include <stdio.h>
#include <unistd.h>

int main(void) {
    printf("%d\n", chroot("/"));
}

for this reason, if others see similar results and we assume that all recent Android versions produce the same matrix of whether each function will cause a crash, it does seem like some, maybe including setresuid(), could be entirely unblocked, and then tested here as non-root user, while others such as chroot() and setgid() would need to remain blocked for non-root users, but I haven't tested and am not sure of what decisions should be made for all other functions or all possible combinations of argument values.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertkirkman

robertkirkman commented Jul 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I have just finished creating a custom ROM of the Android Studio Android Virtual Device Android Emulator that has the popular KernelSU implementation of root for Android preconfigured into it. For all non-root tests of this PR this is not important, but for anyone interested in testing the root-only functionality, expand to read further.

more information

While it is not at all viable for CI anywhere since it is a custom ROM that takes many hours to compile, it might be useful if someone ever wants to manually test the root-only functionality of this PR, or the root-only functionality of the real-world reverse dependency of this PR (potential chroot managers for Android written in Python), but doesn't have any rooted bare metal Android devices to verify the functionality on that have one of the two leading implementations of root for Android, KernelSU or Magisk, installed, as opposed to only the vanilla AVD's adb root, which it is difficult and tedious to run Termux and Termux programs from properly without knowing a series of obscure commands. having KernelSU installed allows granting root permission to the Termux App from the KernelSU manager app in exactly the same workflow and root implementation that many users of rooted bare metal Android use.

https://github.com/robertkirkman/kernelsu-goldfish-builder

I made this because I was frustrated with the limited options available to most developers who don't have rooted Android for manual testing of root-only Android apps or code. It enables claims like "these functions don't crash the program if run as root user" to be validated objectively by outside testers.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

blurb-it Bot and others added 2 commits July 8, 2026 06:54
@blurb-it
📜🤖 Added by blurb_it.
f7effcf
@sabamdarif
pythongh-152936: Use posix_error for Android checks
dd73903
@sabamdarif

sabamdarif commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@robertkirkman can you test it https://github.com/sabamdarif/termux-packages/actions/runs/28925155859 and see if posix.setresuid(-1, -1, -1) works for you or not , i test tested it and it didn't actually crash , can you verify that ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertkirkman

robertkirkman commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Yes, for me that doesn't crash, when I test that build.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz picnixz removed the needs backport to 3.15 bugs and security fixes label Jul 8, 2026
@picnixz

picnixz commented Jul 8, 2026

Copy link
Copy Markdown
Member

@mhsmith FTR, once we are in the beta cycle, we can't introduce features anymore. Only bug fixes are considered backportable.

mhsmith reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

picnixz
picnixz reviewed Jul 8, 2026
View reviewed changes

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Please also add a What's New entry for Python 3.16.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/os.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@mhsmith

mhsmith commented Jul 8, 2026

Copy link
Copy Markdown
Member

I can confirm that not all of the functions appear to be able to crash the program

I found the same thing when experimenting with ctypes on API level 36:

>>> c = ctypes.CDLL(None, use_errno=True)
>>> c.setresuid(0, 0, 0)
-1
>>> os.strerror(ctypes.get_errno())
'Operation not permitted'

On this emulator, when passing all arguments as 0, setresuid and seteuid return an error, while setuid and setreuid crash the process.

I can't see any logical reason for this difference, so I guess it may be an oversight which they'll fix in a future version of Android. In which case, it's probably still safer for us to keep the checks in all the functions.

robertkirkman reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhsmith

mhsmith commented Jul 8, 2026

Copy link
Copy Markdown
Member

Based on the logcat message, the crash is evidently a deliberate security feature:

10:08:54.234 DEBUG            A  signal 31 (SIGSYS), code 1 (SYS_SECCOMP), fault addr --------
10:08:54.234 DEBUG            A  Cause: seccomp prevented call to disallowed arm64 system call 146

This occurs even for calls which are supposed to be allowed in unprivileged processes, such as setuid(getuid()).

So I think we should disregard what I said before about checking the argument values, keep blocking all the functions when getuid() != 0, and update the failing test instead.

sabamdarif reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sabamdarif added 3 commits July 8, 2026 20:20
@sabamdarif
pythongh-152936: Document Android support in os and socket
27e854c
@sabamdarif
pythongh-152936: Fix test_os and test_posix failures on Android
907676b
@sabamdarif
pythongh-152936: Fix AttributeError for os.chroot on platforms withou…
16b633c
…t it
@flameastro

This comment was marked as off-topic.

Sign in to view
mhsmith added 2 commits August 12, 2026 17:17
@mhsmith
Merge branch 'main' into sabamdarif-main
5bf2bcc
@mhsmith
Revert to including path in chroot error message
32d37aa
mhsmith
mhsmith approved these changes Aug 12, 2026
View reviewed changes

@mhsmith mhsmith left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Sorry for the delay; this all looks good to me now. @picnixz: are you able to merge it?`

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Aug 12, 2026
@mhsmith
Merge remote-tracking branch 'origin/main' into sabamdarif-main
d4df9df
@mhsmith
mhsmith requested a review from freakboy3742 September 2, 2026 11:15
@mhsmith

This comment was marked as resolved.

Sign in to view
@bedevere-bot

This comment was marked as resolved.

Sign in to view
@mhsmith

mhsmith commented Sep 2, 2026

Copy link
Copy Markdown
Member

!buildbot aarch64 android

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Sep 2, 2026

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @mhsmith for commit d4df9df 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F152977%2Fmerge

The command will test the builders whose names match following regular expression: aarch64 android

The builders matched are:

  • aarch64 Android PR
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

freakboy3742
freakboy3742 approved these changes Sep 8, 2026
View reviewed changes

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks good to me - thanks for the PR!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Sep 8, 2026
@freakboy3742
freakboy3742 merged commit adea841 into python:main Sep 8, 2026
60 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Sep 8, 2026
maurycy added a commit to maurycy/cpython that referenced this pull request Sep 10, 2026
@maurycy
Merge branch 'main' into tachyon-native-callable
e028ff5
* main: (158 commits)
  pythongh-156924: Try reifying lazy imports in `ForwarRef.evaluate()` (python#156940)
  pythongh-156233: Fix typos and code snippet errors in the docs (python#156475)
  pythongh-156837: Refer to yield expressions in generator function definitions (pythonGH-156863)
  pythongh-155292: Skip updating unicodedata with mismatched interpreter (pythonGH-157066)
  pythongh-157170: Document the scope of global curses settings (pythonGH-157207)
  pythongh-155966: Correct handling of `math.tanpi` poles (python#155980)
  pythongh-157170: Restore use_env() after test_use_prescr_screen in test_curses (pythonGH-157171)
  pythongh-156910: fix deadlock in type_set_abstractmethods under free-threading (python#156948)
  pythongh-155648: Write the empty and placeholder IDLE tests (python#156260)
  pythongh-153569: centralize formatted-string state and source spans (python#156484)
  pythongh-157137: Mark the PEP 820 soft deprecations as 3.15, not `next` (python#157138)
  pythongh-152433: Use regular LoadLibrary in UWP for Windows system libs (pythonGH-156972)
  pythongh-121617: Fix Py_CLEAR() memcpy in C++: replace NULL with _Py_NULL (python#157188)
  pythongh-157135: Fix documentation errors in the `math.atan{2}pi` functions (python#157136)
  pythongh-121617: Fix Py_CLEAR() in C++: replace NULL with _Py_NULL (python#157067)
  pythongh-156774: Speed up pdb startup with asyncio guard (python#156775)
  pythongh-156109: Allow static, non-framework iOS builds (python#156110)
  pythongh-156780: Emscripten: add missing EM_JS_DEPS (python#156798)
  pythongh-152936: Make privileged functions available on Android (python#152977)
  pythongh-123018: Keep the libedit history file header when truncating (pythonGH-157165)
  ...
clin1234 pushed a commit to clin1234/cpython that referenced this pull request Sep 12, 2026
@sabamdarif @blurb-it
@mhsmith @clin1234
pythongh-152936: Make privileged functions available on Android (pyth…
d2a5cab
…on#152977)

Expose the chroot, initgroups, setegid, seteuid, setgid, sethostname, setregid,
setresgid, setresuid, setreuid, and setuid functions on Android. Previously, 
these methods were excluded by an autoconf guard; they're now included with
a permission check to prevent issues invoking them as a non-root user.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Malcolm Smith <[email protected]>
johnslavik pushed a commit to johnslavik/cpython that referenced this pull request Sep 14, 2026
@sabamdarif @blurb-it
@mhsmith @johnslavik
pythongh-152936: Make privileged functions available on Android (pyth…
7f928c2
…on#152977)

Expose the chroot, initgroups, setegid, seteuid, setgid, sethostname, setregid,
setresgid, setresuid, setreuid, and setuid functions on Android. Previously, 
these methods were excluded by an autoconf guard; they're now included with
a permission check to prevent issues invoking them as a non-root user.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Malcolm Smith <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz left review comments
@freakboy3742 freakboy3742 freakboy3742 approved these changes
@mhsmith mhsmith mhsmith approved these changes
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@corona10 corona10 Awaiting requested review from corona10 corona10 is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner
@emmatyping emmatyping Awaiting requested review from emmatyping emmatyping is a code owner
@itamaro itamaro Awaiting requested review from itamaro itamaro is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Make privileged functions available on Android

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@sabamdarif @Aniketsy @robertkirkman @mhsmith @picnixz @flameastro @bedevere-bot @freakboy3742
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.