Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package reptyr for openSUSE:Factory checked 
in at 2023-06-04 20:41:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/reptyr (Old)
 and      /work/SRC/openSUSE:Factory/.reptyr.new.15902 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "reptyr"

Sun Jun  4 20:41:23 2023 rev:14 rq:1090758 version:0.10.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/reptyr/reptyr.changes    2022-06-16 
18:22:18.504258827 +0200
+++ /work/SRC/openSUSE:Factory/.reptyr.new.15902/reptyr.changes 2023-06-04 
20:41:27.627264380 +0200
@@ -1,0 +2,7 @@
+Sun Jun  4 16:29:06 UTC 2023 - Mia Herkt <m...@0x0.st>
+
+- Update to version 0.10.0
+  * Add arm7 and aarch64 support for FreeBSD
+- Run tests
+
+-------------------------------------------------------------------

Old:
----
  reptyr-0.9.0.tar.gz

New:
----
  reptyr-0.10.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ reptyr.spec ++++++
--- /var/tmp/diff_new_pack.jGn0Rl/_old  2023-06-04 20:41:28.219267897 +0200
+++ /var/tmp/diff_new_pack.jGn0Rl/_new  2023-06-04 20:41:28.223267921 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package reptyr
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           reptyr
-Version:        0.9.0
+Version:        0.10.0
 Release:        0
 Summary:        A tool for "re-ptying" programs
 License:        MIT
@@ -25,7 +25,9 @@
 URL:            https://github.com/nelhage/reptyr
 Source:         
https://github.com/nelhage/reptyr/archive/%{name}-%{version}.tar.gz
 BuildRequires:  bash-completion
-BuildRequires:  gcc
+BuildRequires:  c_compiler
+BuildRequires:  python3-pexpect
+BuildRequires:  python3-python-prctl
 
 %description
 reptyr is a utility for taking an existing running program and
@@ -45,6 +47,9 @@
 %install
 %make_install PREFIX="%{_prefix}" 
BASHCOMPDIR="%{_datadir}/bash-completion/completions"
 
+%check
+%make_build test PYTHON_CMD=python3
+
 %files
 %doc ChangeLog README.md NOTES
 %license COPYING

++++++ reptyr-0.9.0.tar.gz -> reptyr-0.10.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reptyr-reptyr-0.9.0/.cirrus.yml 
new/reptyr-reptyr-0.10.0/.cirrus.yml
--- old/reptyr-reptyr-0.9.0/.cirrus.yml 2022-06-12 17:58:44.000000000 +0200
+++ new/reptyr-reptyr-0.10.0/.cirrus.yml        2023-06-04 17:15:43.000000000 
+0200
@@ -1,9 +1,9 @@
 freebsd_12_task:
   freebsd_instance:
-    image: freebsd-12-2-release-amd64
+    image: freebsd-12-4-release-amd64
   install_script:
-    pkg install -y gmake py38-pexpect
+    pkg install -y gmake py39-pexpect
   build_script:
     gmake
   test_script:
-    - env NO_TEST_BASIC=yes gmake test PYTHON_CMD=python3.8
+    - gmake test PYTHON_CMD=python3.9
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reptyr-reptyr-0.9.0/ChangeLog 
new/reptyr-reptyr-0.10.0/ChangeLog
--- old/reptyr-reptyr-0.9.0/ChangeLog   2022-06-12 17:58:44.000000000 +0200
+++ new/reptyr-reptyr-0.10.0/ChangeLog  2023-06-04 17:15:43.000000000 +0200
@@ -1,3 +1,6 @@
+* 0.10.0 (Jun 04, 2023)
+ - Add arm7 and aarch64 support for FreeBSD
+
 * 0.9.0 (Jun 12, 2022)
  - Add RISCV64 support on Linux
  - Fix tty-stealing on PowerPC
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reptyr-reptyr-0.9.0/platform/freebsd/arch/aarch64.h 
new/reptyr-reptyr-0.10.0/platform/freebsd/arch/aarch64.h
--- old/reptyr-reptyr-0.9.0/platform/freebsd/arch/aarch64.h     1970-01-01 
01:00:00.000000000 +0100
+++ new/reptyr-reptyr-0.10.0/platform/freebsd/arch/aarch64.h    2023-06-04 
17:15:43.000000000 +0200
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 by Nelson Elhage
+ * Copyright (C) 2023 Kyle Evans <kev...@freebsd.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+static struct ptrace_personality arch_personality[1] = {
+    {
+        offsetof(struct reg, x[0]),
+        offsetof(struct reg, x[0]),
+        offsetof(struct reg, x[1]),
+        offsetof(struct reg, x[2]),
+        offsetof(struct reg, x[3]),
+        offsetof(struct reg, x[4]),
+        offsetof(struct reg, x[5]),
+        offsetof(struct reg, elr),
+    }
+};
+
+#define ptr(regs, off) ((unsigned long*)((void*)(regs)+(off)))
+
+static inline void arch_fixup_regs(struct ptrace_child *child) {
+    child->regs.elr -= 4;
+}
+
+static inline void arch_set_register(struct ptrace_child *child, unsigned long 
oft, unsigned long val)
+{
+    struct reg regs;
+
+    (void)ptrace_command(child, PT_GETREGS, &regs);
+    *ptr(&regs, oft) = val;
+    (void)ptrace_command(child, PT_SETREGS, &regs);
+}
+
+static inline void arch_set_syscall(struct ptrace_child *child,
+                                   unsigned long sysno) {
+    arch_set_register(child, offsetof(struct reg, x[8]), sysno);
+}
+
+#undef ptr
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reptyr-reptyr-0.9.0/platform/freebsd/arch/arm.h 
new/reptyr-reptyr-0.10.0/platform/freebsd/arch/arm.h
--- old/reptyr-reptyr-0.9.0/platform/freebsd/arch/arm.h 2022-06-12 
17:58:44.000000000 +0200
+++ new/reptyr-reptyr-0.10.0/platform/freebsd/arch/arm.h        2023-06-04 
17:15:43.000000000 +0200
@@ -20,42 +20,44 @@
  * THE SOFTWARE.
  */
 
-#error ARM not yet supported for FreeBSD
+#include <machine/armreg.h>
 
 static struct ptrace_personality arch_personality[1] = {
     {
-        offsetof(struct user, regs.uregs[0]),
-        offsetof(struct user, regs.uregs[0]),
-        offsetof(struct user, regs.uregs[1]),
-        offsetof(struct user, regs.uregs[2]),
-        offsetof(struct user, regs.uregs[3]),
-        offsetof(struct user, regs.uregs[4]),
-        offsetof(struct user, regs.uregs[5]),
-        offsetof(struct user, regs.ARM_pc),
+        offsetof(struct reg, r[0]),
+        offsetof(struct reg, r[0]),
+        offsetof(struct reg, r[1]),
+        offsetof(struct reg, r[2]),
+        offsetof(struct reg, r[3]),
+        ~0UL,  /* Spill to stack */
+        ~0UL,  /* Spill to stack */
+        offsetof(struct reg, r_pc),
+        offsetof(struct reg, r_sp),
     }
 };
 
+#define ptr(regs, off) ((unsigned long*)((void*)(regs)+(off)))
+
 static inline void arch_fixup_regs(struct ptrace_child *child) {
-    child->user.regs.ARM_pc -= 4;
+    if ((child->regs.r_cpsr & PSR_T) != 0)
+        child->regs.r_pc -= THUMB_INSN_SIZE;
+    else
+        child->regs.r_pc -= INSN_SIZE;
 }
 
-static inline int arch_set_syscall(struct ptrace_child *child,
-                                   unsigned long sysno) {
-    return ptrace_command(child, PTRACE_SET_SYSCALL, 0, sysno);
+static inline void arch_set_register(struct ptrace_child *child, unsigned long 
oft, unsigned long val)
+{
+    struct reg regs;
+
+    (void)ptrace_command(child, PT_GETREGS, &regs);
+    *ptr(&regs, oft) = val;
+    (void)ptrace_command(child, PT_SETREGS, &regs);
 }
 
-static inline int arch_save_syscall(struct ptrace_child *child) {
-    unsigned long swi;
-    swi = ptrace_command(child, PTRACE_PEEKTEXT, child->user.regs.ARM_pc);
-    if (child->error)
-        return -1;
-    if (swi == 0xef000000)
-        child->saved_syscall = child->user.regs.uregs[7];
-    else
-        child->saved_syscall = (swi & 0x000fffff);
+static inline int arch_set_syscall(struct ptrace_child *child,
+                                   unsigned long sysno) {
+    arch_set_register(child, offsetof(struct reg, r[7]), sysno);
     return 0;
 }
 
-static inline int arch_restore_syscall(struct ptrace_child *child) {
-    return arch_set_syscall(child, child->saved_syscall);
-}
+#undef ptr
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/reptyr-reptyr-0.9.0/platform/freebsd/arch/x86_common.h 
new/reptyr-reptyr-0.10.0/platform/freebsd/arch/x86_common.h
--- old/reptyr-reptyr-0.9.0/platform/freebsd/arch/x86_common.h  2022-06-12 
17:58:44.000000000 +0200
+++ new/reptyr-reptyr-0.10.0/platform/freebsd/arch/x86_common.h 2023-06-04 
17:15:43.000000000 +0200
@@ -31,14 +31,10 @@
 }
 
 static inline void arch_fixup_regs(struct ptrace_child *child) {
-    struct x86_personality *x86pers = x86_pers(child);
     struct ptrace_personality *pers = personality(child);
     struct reg *regs = &child->regs;
 #define ptr(regs, off) ((unsigned long*)((void*)(regs)+(off)))
     *ptr(regs, pers->reg_ip) -= 2;
-    *ptr(regs, x86pers->ax) = child->saved_syscall;
-    //*ptr(user, x86pers->ax) = *ptr(user, x86pers->orig_ax);
-       
//https://lists.freebsd.org/pipermail/freebsd-hackers/2009-July/029206.html
 }
 
 static inline unsigned long arch_get_register(struct ptrace_child *child, 
unsigned long oft) {
@@ -57,21 +53,14 @@
        (void) ptrace_command(child, PT_SETREGS, &regs);
 }
 
-static inline int arch_save_syscall(struct ptrace_child *child) {
-    child->saved_syscall = *ptr(&child->regs, x86_pers(child)->ax);
-    return 0;
-}
-
 static inline int arch_get_syscall(struct ptrace_child *child,
                                    unsigned long sysno) {
        return *ptr(&child->regs, personality(child)->syscall_rv);
-    //return ptrace_command(child, PTRACE_POKEUSER,
-                          //x86_pers(child)->orig_ax,
-                          //sysno);
 }
 
-static inline int arch_restore_syscall(struct ptrace_child *child) {
-    return 0;
+static inline void arch_set_syscall(struct ptrace_child *child,
+                                   unsigned long sysno) {
+    arch_set_register(child, x86_pers(child)->ax, sysno);
 }
 
 #undef ptr
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/reptyr-reptyr-0.9.0/platform/freebsd/freebsd_ptrace.c 
new/reptyr-reptyr-0.10.0/platform/freebsd/freebsd_ptrace.c
--- old/reptyr-reptyr-0.9.0/platform/freebsd/freebsd_ptrace.c   2022-06-12 
17:58:44.000000000 +0200
+++ new/reptyr-reptyr-0.10.0/platform/freebsd/freebsd_ptrace.c  2023-06-04 
17:15:43.000000000 +0200
@@ -32,6 +32,7 @@
 #include <sys/syscall.h>
 #include <sys/mman.h>
 #include <assert.h>
+#include <stdbool.h>
 #include <stddef.h>
 #include <signal.h>
 
@@ -60,6 +61,7 @@
     size_t syscall_arg4;
     size_t syscall_arg5;
     size_t reg_ip;
+    size_t reg_sp;
 };
 
 
@@ -71,6 +73,8 @@
 #include "arch/i386.h"
 #elif defined(__arm__)
 #include "arch/arm.h"
+#elif defined(__aarch64__)
+#include "arch/aarch64.h"
 #else
 #error Unsupported architecture.
 #endif
@@ -200,19 +204,40 @@
         return -1;
     if (ptrace_command(child, PT_GETREGS, &child->regs, 0) < 0)
         return -1;
-    arch_save_syscall(child);
     arch_fixup_regs(child);
-    if (arch_save_syscall(child) < 0)
-        return -1;
     return 0;
 }
 
 int ptrace_restore_regs(struct ptrace_child *child) {
-    int err;
-    err = ptrace_command(child, PT_SETREGS, &child->regs, 0);
-    if (err < 0)
-        return err;
-    return arch_restore_syscall(child);
+    return ptrace_command(child, PT_SETREGS, &child->regs, 0);
+}
+
+static unsigned long ptrace_push_to_stack(struct ptrace_child *child,
+                                          unsigned long val)
+{
+    struct reg regs;
+    unsigned long *rsp, sp;
+    int rv;
+
+    /* XXX */
+    assert(val <= UINT_MAX);
+
+#define ptr(regs, off) ((unsigned long*)((void*)(regs)+(off)))
+    /* Grab the stack pointer */
+    (void)ptrace_command(child, PT_GETREGS, &regs);
+    rsp = ptr(&regs, personality(child)->reg_sp);
+    sp = *rsp - sizeof(int);
+
+    /* Splat the new value in */
+    rv = ptrace_command(child, PT_WRITE_D, sp, val);
+    if (rv != 0)
+        return -1;
+
+    /* And move the stack pointer. */
+    *rsp = sp;
+    rv = ptrace_command(child, PT_SETREGS, &regs);
+
+    return 0;
 }
 
 unsigned long ptrace_remote_syscall(struct ptrace_child *child,
@@ -224,21 +249,69 @@
     struct ptrace_sc_ret psr;
 #endif
     unsigned long rv;
+    bool stack_used;
+
     if (ptrace_advance_to_state(child, ptrace_at_syscall) < 0)
         return -1;
 #define setreg(r, v) arch_set_register(child,personality(child)->r,v)
 
-    //if (arch_set_syscall(child, sysno) < 0)
-    //return -1;
-
-    setreg(syscall_rv, sysno);
+    stack_used = false;
+    arch_set_syscall(child, sysno);
 
     setreg(syscall_arg0, p0);
     setreg(syscall_arg1, p1);
     setreg(syscall_arg2, p2);
     setreg(syscall_arg3, p3);
-    setreg(syscall_arg4, p4);
-    setreg(syscall_arg5, p5);
+    if (personality(child)->syscall_arg4 < sizeof(struct reg)) {
+        setreg(syscall_arg4, p4);
+    } else {
+        stack_used = true;
+
+        /*
+         * Pad out to eight arguments; this is not-so-secretly a kludge.  
mmap's
+         * sixth argument is actually a 64-bit quantity, so the value should be
+         * split into two 32-bit quantities across the first two stack slots
+         * used.  However, we know in advance that we won't be needing the
+         * offset to do what we need to do, so we just pad out to eight
+         * arguments to maintain stack alignment and avoid garbage in the upper
+         * 32-bits of the offset.
+         */
+        rv = ptrace_push_to_stack(child, 0);
+        if (rv != 0)
+            return -1;
+        rv = ptrace_push_to_stack(child, 0);
+        if (rv != 0)
+            return -1;
+        rv = ptrace_push_to_stack(child, p5);
+        if (rv != 0)
+             return -1;
+        rv = ptrace_push_to_stack(child, p4);
+        if (rv != 0)
+             return -1;
+        assert(personality(child)->syscall_arg5 >= sizeof(struct reg));
+    }
+
+    if (!stack_used) {
+        if (personality(child)->syscall_arg5 < sizeof(struct reg)) {
+            setreg(syscall_arg5, p5);
+        } else  {
+            /* Only done if p4 wasn't pushed to the stack. */
+            stack_used = true;
+            /* Pad out to eight arguments, see above */
+            rv = ptrace_push_to_stack(child, 0);
+            if (rv != 0)
+                return -1;
+            rv = ptrace_push_to_stack(child, 0);
+            if (rv != 0)
+                return -1;
+            rv = ptrace_push_to_stack(child, 0);
+            if (rv != 0)
+                return -1;
+            rv = ptrace_push_to_stack(child, p5);
+            if (rv != 0)
+                return -1;
+        }
+    }
 
     if (ptrace_advance_to_state(child, ptrace_after_syscall) < 0)
         return -1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reptyr-reptyr-0.9.0/release.sh 
new/reptyr-reptyr-0.10.0/release.sh
--- old/reptyr-reptyr-0.9.0/release.sh  2022-06-12 17:58:44.000000000 +0200
+++ new/reptyr-reptyr-0.10.0/release.sh 2023-06-04 17:15:43.000000000 +0200
@@ -29,4 +29,4 @@
 git add ChangeLog reptyr.h
 
 git commit -m "reptyr $version"
-git tag "reptyr-$version" -m "reptyr $version" -s
+git tag "reptyr-$version" -m "reptyr $version"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reptyr-reptyr-0.9.0/reptyr.h 
new/reptyr-reptyr-0.10.0/reptyr.h
--- old/reptyr-reptyr-0.9.0/reptyr.h    2022-06-12 17:58:44.000000000 +0200
+++ new/reptyr-reptyr-0.10.0/reptyr.h   2023-06-04 17:15:43.000000000 +0200
@@ -20,7 +20,7 @@
  * THE SOFTWARE.
  */
 
-#define REPTYR_VERSION "0.8.0"
+#define REPTYR_VERSION "0.10.0"
 
 #define assert_nonzero(expr) ({                         \
             typeof(expr) __val = expr;                  \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reptyr-reptyr-0.9.0/test/basic.py 
new/reptyr-reptyr-0.10.0/test/basic.py
--- old/reptyr-reptyr-0.9.0/test/basic.py       2022-06-12 17:58:44.000000000 
+0200
+++ new/reptyr-reptyr-0.10.0/test/basic.py      2023-06-04 17:15:43.000000000 
+0200
@@ -16,12 +16,12 @@
 child.logfile = logfile
 child.setecho(False)
 child.sendline("hello")
-child.expect("ECHO: hello")
+child.expect("ECHO: hello\r\n")
 
 reptyr = pexpect.spawn("./reptyr -V %d" % (child.pid,))
 reptyr.logfile = logfile
 reptyr.sendline("world")
-reptyr.expect("ECHO: world")
+reptyr.expect("ECHO: world\r\n")
 
 child.sendline("final")
 expect_eof(child.child_fd)

Reply via email to