Date: Sun, 7 Nov 2021 09:19:53 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: a90ff3c4bc90 - main - linux: Add ptrace(2) support on arm64 Message-ID: <202111070919.1A79JrgM056687@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=a90ff3c4bc901947a040717f39d5b3b8778047fe commit a90ff3c4bc901947a040717f39d5b3b8778047fe Author: Edward Tomasz Napierala <trasz@FreeBSD.org> AuthorDate: 2021-11-07 08:22:41 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> CommitDate: 2021-11-07 08:39:24 +0000 linux: Add ptrace(2) support on arm64 This moves linux_ptrace.c from sys/amd64/linux/ to sys/compat/linux/, making it possible to use it on architectures other than amd64. It also enables Linux ptrace(2) on arm64. Relnotes: yes Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32868 --- sys/arm64/linux/linux_ptrace.c | 56 ------------------------------ sys/compat/linux/linux_misc.c | 2 +- sys/compat/linux/linux_misc.h | 2 +- sys/{amd64 => compat}/linux/linux_ptrace.c | 0 4 files changed, 2 insertions(+), 58 deletions(-) diff --git a/sys/arm64/linux/linux_ptrace.c b/sys/arm64/linux/linux_ptrace.c deleted file mode 100644 index a7d53470a12d..000000000000 --- a/sys/arm64/linux/linux_ptrace.c +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (C) 2018 Turing Robotic Industries Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/sdt.h> -#include <sys/proc.h> -#include <sys/ptrace.h> - -#include <arm64/linux/linux.h> -#include <arm64/linux/linux_proto.h> -#include <compat/linux/linux_dtrace.h> - -/* DTrace init */ -LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); - -/* DTrace probes */ -LIN_SDT_PROBE_DEFINE0(ptrace, linux_ptrace, todo); - -int -linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) -{ - - /* LINUXTODO: implement arm64 linux_ptrace */ - LIN_SDT_PROBE0(ptrace, linux_ptrace, todo); - return (EDOOFUS); -} diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 559eb6463da0..5ae4051aaf38 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1024,7 +1024,7 @@ linux_common_wait(struct thread *td, int pid, int *statusp, } else if (WIFSTOPPED(tmpstat)) { tmpstat = (tmpstat & 0xffff00ff) | (bsd_to_linux_signal(WSTOPSIG(tmpstat)) << 8); -#if defined(__amd64__) && !defined(COMPAT_LINUX32) +#if defined(__aarch64__) || (defined(__amd64__) && !defined(COMPAT_LINUX32)) if (WSTOPSIG(status) == SIGTRAP) { tmpstat = linux_ptrace_status(td, siginfo.si_pid, tmpstat); diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index ceb140d3da75..bf8f3dd2f0cd 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -153,7 +153,7 @@ extern int stclohz; /* Linux syslog flags */ #define LINUX_SYSLOG_ACTION_READ_ALL 3 -#if defined(__amd64__) && !defined(COMPAT_LINUX32) +#if defined(__aarch64__) || (defined(__amd64__) && !defined(COMPAT_LINUX32)) int linux_ptrace_status(struct thread *td, int pid, int status); #endif void linux_to_bsd_waitopts(int options, int *bsdopts); diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/compat/linux/linux_ptrace.c similarity index 100% rename from sys/amd64/linux/linux_ptrace.c rename to sys/compat/linux/linux_ptrace.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111070919.1A79JrgM056687>