]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-116622: Don't expose `FICLONE` ioctl on Android (GH-122522) (#122539)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 16 Aug 2024 08:07:27 +0000 (10:07 +0200)
committerGitHub <noreply@github.com>
Fri, 16 Aug 2024 08:07:27 +0000 (16:07 +0800)
gh-116622: Don't expose `FICLONE` ioctl on Android (GH-122522)

Don't expose `FICLONE` ioctl on Android

(cherry picked from commit 06656e259bc9b2c3cf8a23bdc6e4acb052c56e1f)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Misc/NEWS.d/next/Library/2024-07-31-15-08-42.gh-issue-116622.aKxIQA.rst [new file with mode: 0644]
Modules/fcntlmodule.c

diff --git a/Misc/NEWS.d/next/Library/2024-07-31-15-08-42.gh-issue-116622.aKxIQA.rst b/Misc/NEWS.d/next/Library/2024-07-31-15-08-42.gh-issue-116622.aKxIQA.rst
new file mode 100644 (file)
index 0000000..fc65b4d
--- /dev/null
@@ -0,0 +1,2 @@
+On Android, the ``FICLONE`` and ``FICLONERANGE`` constants are no longer
+exposed by :mod:`fcntl`, as these ioctls are blocked by SELinux.
index b6eeec2c66f6e592ce2fc5ffeaa235956f59c7d2..17ecf4c6731ff713d36e9798ee85475bfff5f6cc 100644 (file)
@@ -580,12 +580,17 @@ all_ins(PyObject* m)
 #ifdef F_GETPIPE_SZ
     if (PyModule_AddIntMacro(m, F_GETPIPE_SZ)) return -1;
 #endif
+
+/* On Android, FICLONE is blocked by SELinux. */
+#ifndef __ANDROID__
 #ifdef FICLONE
     if (PyModule_AddIntMacro(m, FICLONE)) return -1;
 #endif
 #ifdef FICLONERANGE
     if (PyModule_AddIntMacro(m, FICLONERANGE)) return -1;
 #endif
+#endif
+
 #ifdef F_GETOWN_EX
     // since Linux 2.6.32
     if (PyModule_AddIntMacro(m, F_GETOWN_EX)) return -1;