emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 32b4f9d21b1: Disable process tracing before launching /system/bin


From: Po Lu
Subject: master 32b4f9d21b1: Disable process tracing before launching /system/bin/su
Date: Mon, 26 Feb 2024 21:06:28 -0500 (EST)

branch: master
commit 32b4f9d21b14190f1ed1611515751abe4b90fa68
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Disable process tracing before launching /system/bin/su
    
    * lisp/net/tramp-androidsu.el
    (tramp-androidsu-maybe-open-connection): Disable process tracing
    around start-process, that the setuid su binary may be started
    regardless of its status.
---
 lisp/net/tramp-androidsu.el | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/lisp/net/tramp-androidsu.el b/lisp/net/tramp-androidsu.el
index 06800205f2e..cf6b0d7202c 100644
--- a/lisp/net/tramp-androidsu.el
+++ b/lisp/net/tramp-androidsu.el
@@ -55,6 +55,8 @@
  (add-to-list 'tramp-default-host-alist
               `(,tramp-androidsu-method nil "localhost")))
 
+(defvar android-use-exec-loader) ; androidfns.c.
+
 (defun tramp-androidsu-maybe-open-connection (vec)
   "Open a connection VEC if not already open.
 Mostly identical to `tramp-adb-maybe-open-connection', but also disables
@@ -84,14 +86,17 @@ multibyte mode and waits for the shell prompt to appear."
                          (tramp-file-name-method vec)))
               (let* ((coding-system-for-read 'utf-8-unix)
                      (process-connection-type tramp-process-connection-type)
-                    (p (apply
-                        #'start-process
-                        (tramp-get-connection-name vec)
-                        (tramp-get-connection-buffer vec)
-                        (append
-                         `(,tramp-encoding-shell)
-                         (and tramp-encoding-command-interactive
-                              `(,tramp-encoding-command-interactive)))))
+                     ;; The executable loader cannot execute setuid
+                     ;; binaries, such as su.
+                     (android-use-exec-loader nil)
+                    (p (start-process (tramp-get-connection-name vec)
+                                      (tramp-get-connection-buffer vec)
+                                       ;; Disregard
+                                       ;; tramp-encoding-shell, as
+                                       ;; there's no guarantee that it's
+                                       ;; possible to execute with
+                                       ;; `android-use-exec-loader' off.
+                                      "/system/bin/sh" "-i"))
                     (user (tramp-file-name-user vec))
                      command)
                 ;; Set sentinel.  Initialize variables.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]