From nobody Tue Feb 14 03:31:55 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PG6Fm13Jvz3qNjZ; Tue, 14 Feb 2023 03:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PG6Fm0cR2z44rg; Tue, 14 Feb 2023 03:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676345516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s5cxW1N3Byl8eTz0gfZsQpNJe+7/myWVzd2yU+q/zCo=; b=EufFir+X52VJ434i15BR5mXtm82iilfk9q+tDvOztevAgjTEiidcUBFoU1Y9XQNwA6v6yB qzzBfX3zLF0MAux4nLAmNJNkJ/UyJFK0lO8VmnBqXa+37cQrn3Ff3mhRxU8Z6g7w+O5HY2 54cGJTGms0vGFoegTfAje0Ux1b3dDLevr3/qgzopu/nJCQy6sDm+MEpQ4AIjLf/IYaadE7 l9OnVjKOGZe+nb/7646tXat6VVeshyqrvJt7nrHR/gDYUY8p6+g5wyM5WRqUNmmUEKkW4O zI05QEZR2jnAWHFOCZFw/6dtS3TPMlbM81aYLwvHp16H3quBlAJZTCYKW06VCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676345516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s5cxW1N3Byl8eTz0gfZsQpNJe+7/myWVzd2yU+q/zCo=; b=OYYNchPPomuAJCaCGm4gXWWzZzUx9dovoO4D+1L+OCIYDiWYEDIlXftlTAzSkY+8RFUqqR KkVKKX+DmRiZThreFsH1WDZa2CtUWJscSF1/Gjk4m1tZozE8avVCrCUqxfU8Zl8k8g/f/+ ytZmp0ndf7LOxhONn4erpQzlnf3wtX50QRaLEcf/y/RmfsrAN0k2G7AF86wDDdK0TH/ola tGWQb9Jp72hFFvKKYkRlk6mBEGK+0EP0WJmHG44q+86aGG7ahLo6SGhgwyPjuI2X6xAHdG h+kE+9xrDgcHYhtddO5Pdk6RwQitvrU4r1RuHAl0ws8NE7CRhkjMBKyiLpxYvg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676345516; a=rsa-sha256; cv=none; b=UE+60fzHCqWysz5lW9GPGO6sG04mt8crew8Hiw1tqkti+38fjE8uw/f1orxTxTh9FEF4C7 Jj1zpR68wDamXusjjKDqx4ZcFQo4XQ38QKd2aeQaZxZkcfXkJdXN4rkLDhvISXDJChDtnx FLK3wLgk1OMgNI9rchPrvyeKQr8VCSrLz7V/aCW09HWbY+n7rWgzl7UWUnbLQRZ3HYBWFe BhwtL2VIc0GcXx1Mb5tFQqso2JZDYVw11n6Uew6gXgCwFEwjJc8NAfhrYOAB8VCUq+lafq Pt12MT88Mbu8kysYXB6egu52Jc0x6tMjC3xN6EYWjU/ACtlk6/9UDonRIehv2A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PG6Fl6nc4zkpn; Tue, 14 Feb 2023 03:31:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31E3Vtx3012236; Tue, 14 Feb 2023 03:31:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31E3VtDk012235; Tue, 14 Feb 2023 03:31:55 GMT (envelope-from git) Date: Tue, 14 Feb 2023 03:31:55 GMT Message-Id: <202302140331.31E3VtDk012235@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Alexey Dokuchaev Subject: git: 1663c003bcb6 - main - sysutils/scanmem: use correct types for parameters in ptrace(2) calls List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: danfe X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1663c003bcb6fbc65e71ed67e87dc4bd9a04d724 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by danfe: URL: https://cgit.FreeBSD.org/ports/commit/?id=1663c003bcb6fbc65e71ed67e87dc4bd9a04d724 commit 1663c003bcb6fbc65e71ed67e87dc4bd9a04d724 Author: Alexey Dokuchaev AuthorDate: 2023-02-14 03:31:04 +0000 Commit: Alexey Dokuchaev CommitDate: 2023-02-14 03:31:04 +0000 sysutils/scanmem: use correct types for parameters in ptrace(2) calls Clang 15 is now very strict about these bugs and would no longer accept such broken code. Reported by: pkg-fallout --- sysutils/scanmem/files/patch-ptrace.c | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/sysutils/scanmem/files/patch-ptrace.c b/sysutils/scanmem/files/patch-ptrace.c index b22f53a6a2ea..da80b94b2113 100644 --- a/sysutils/scanmem/files/patch-ptrace.c +++ b/sysutils/scanmem/files/patch-ptrace.c @@ -14,6 +14,42 @@ #include #include +@@ -94,7 +96,7 @@ bool sm_attach(pid_t target) + int status; + + /* attach to the target application, which should cause a SIGSTOP */ +- if (ptrace(PTRACE_ATTACH, target, NULL, NULL) == -1L) { ++ if (ptrace(PTRACE_ATTACH, target, NULL, 0) == -1L) { + show_error("failed to attach to %d, %s\n", target, strerror(errno)); + return false; + } +@@ -117,7 +119,7 @@ bool sm_attach(pid_t target) + bool sm_detach(pid_t target) + { + // addr is ignored on Linux, but should be 1 on FreeBSD in order to let the child process continue execution where it had been interrupted +- return ptrace(PTRACE_DETACH, target, 1, 0) == 0; ++ return ptrace(PTRACE_DETACH, target, (caddr_t)1, 0) == 0; + } + + +@@ -184,7 +186,7 @@ extern inline bool sm_peekdata(pid_t pid, const void * + for (i = 0; i < missing_bytes; i += sizeof(long)) + { + const char *ptrace_address = peekbuf.base + peekbuf.size; +- long ptraced_long = ptrace(PTRACE_PEEKDATA, pid, ptrace_address, NULL); ++ long ptraced_long = ptrace(PTRACE_PEEKDATA, pid, ptrace_address, 0); + + /* check if ptrace() succeeded */ + if (EXPECT(ptraced_long == -1L && errno != 0, false)) { +@@ -195,7 +197,7 @@ extern inline bool sm_peekdata(pid_t pid, const void * + for (j = 1, errno = 0; j < sizeof(long); j++, errno = 0) { + + /* try for a shifted ptrace - 'continue' (i.e. try an increased shift) if it fails */ +- if ((ptraced_long = ptrace(PTRACE_PEEKDATA, pid, ptrace_address - j, NULL)) == -1L && ++ if ((ptraced_long = ptrace(PTRACE_PEEKDATA, pid, ptrace_address - j, 0)) == -1L && + (errno == EIO || errno == EFAULT)) + continue; + @@ -406,7 +408,7 @@ bool sm_checkmatches(globals_t *vars, return sm_detach(vars->target); } @@ -50,3 +86,12 @@ bool sm_write_array(pid_t target, void *addr, const void *data, int len) { int i,j; +@@ -735,7 +737,7 @@ bool sm_write_array(pid_t target, void *addr, const vo + for(j = 0; j <= sizeof(long) - (len - i); ++j) + { + errno = 0; +- if(((peek_value = ptrace(PTRACE_PEEKDATA, target, addr - j, NULL)) == -1L) && (errno != 0)) ++ if(((peek_value = ptrace(PTRACE_PEEKDATA, target, addr - j, 0)) == -1L) && (errno != 0)) + { + if (errno == EIO || errno == EFAULT) /* may try next shift */ + continue;