From owner-svn-src-all@freebsd.org Thu May 14 17:47:56 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 807492F7C8B; Thu, 14 May 2020 17:47:56 +0000 (UTC) (envelope-from jhb@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49NJsm2sScz4bpS; Thu, 14 May 2020 17:47:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CAADED47; Thu, 14 May 2020 17:47:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04EHlujG078767; Thu, 14 May 2020 17:47:56 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04EHltN1078763; Thu, 14 May 2020 17:47:55 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202005141747.04EHltN1078763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 May 2020 17:47:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r361035 - in releng/11.4: lib/libsysdecode sys/fs/procfs sys/sys usr.sbin/procctl X-SVN-Group: releng X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in releng/11.4: lib/libsysdecode sys/fs/procfs sys/sys usr.sbin/procctl X-SVN-Commit-Revision: 361035 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2020 17:47:56 -0000 Author: jhb Date: Thu May 14 17:47:55 2020 New Revision: 361035 URL: https://svnweb.freebsd.org/changeset/base/361035 Log: MF11 361020: Deprecate procfs-based process debugging. 359047: Mark procfs-based process debugging as deprecated for FreeBSD 13. Attempting to use ioctls on /proc//mem to control a process will trigger warnings on the console. The include file will also now emit a compile-time warning when used from userland. 359054: Fix the workaround to ignore the #warning for GCC. clang and gcc use different warning flags for #warning preprocessor directives. For both 12 and 11, adjust the GCC warning flags to only be added in 4.7 and later since 4.2.1 does not support -Wno-cpp. For 11, add the needed warning suppression to procctl's build. procctl was removed in 12.0. Approved by: re (gjb, kib) Modified: releng/11.4/lib/libsysdecode/Makefile releng/11.4/sys/fs/procfs/procfs_ioctl.c releng/11.4/sys/sys/pioctl.h releng/11.4/usr.sbin/procctl/Makefile Directory Properties: releng/11.4/ (props changed) Modified: releng/11.4/lib/libsysdecode/Makefile ============================================================================== --- releng/11.4/lib/libsysdecode/Makefile Thu May 14 17:19:07 2020 (r361034) +++ releng/11.4/lib/libsysdecode/Makefile Thu May 14 17:47:55 2020 (r361035) @@ -123,6 +123,13 @@ CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls # Workaround warning for unused ssi_cables[] in CFLAGS.gcc.ioctl.c+= -Wno-unused +# Ignore deprecation warning in +CFLAGS.clang.ioctl.c+= -Wno-\#warnings +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40700 +CFLAGS.gcc.ioctl.c+= -Wno-cpp +.endif + +CFLAGS.clang+= ${CFLAGS.clang.${.IMPSRC}} CFLAGS.gcc+= ${CFLAGS.gcc.${.IMPSRC}} DEPENDOBJS+= tables.h Modified: releng/11.4/sys/fs/procfs/procfs_ioctl.c ============================================================================== --- releng/11.4/sys/fs/procfs/procfs_ioctl.c Thu May 14 17:19:07 2020 (r361034) +++ releng/11.4/sys/fs/procfs/procfs_ioctl.c Thu May 14 17:47:55 2020 (r361035) @@ -69,10 +69,53 @@ procfs_ioctl(PFS_IOCTL_ARGS) #ifdef COMPAT_FREEBSD6 int ival; #endif + static struct timeval lasttime; + static struct timeval interval = { .tv_sec = 1, .tv_usec = 0 }; KASSERT(p != NULL, ("%s() called without a process", __func__)); PROC_LOCK_ASSERT(p, MA_OWNED); + + switch (cmd) { +#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) + case _IOC(IOC_IN, 'p', 1, 0): +#endif +#ifdef COMPAT_FREEBSD6 + case _IO('p', 1): +#endif + case PIOCBIS: +#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) + case _IOC(IOC_IN, 'p', 2, 0): +#endif +#ifdef COMPAT_FREEBSD6 + case _IO('p', 2): +#endif + case PIOCBIC: +#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) + case _IOC(IOC_IN, 'p', 3, 0): +#endif +#ifdef COMPAT_FREEBSD6 + case _IO('p', 3): +#endif + case PIOCSFL: + case PIOCGFL: + case PIOCWAIT: + case PIOCSTATUS: +#ifdef COMPAT_FREEBSD32 + case PIOCWAIT32: + case PIOCSTATUS32: +#endif +#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) + case _IOC(IOC_IN, 'p', 5, 0): +#endif +#ifdef COMPAT_FREEBSD6 + case _IO('p', 5): +#endif + case PIOCCONT: + if (ratecheck(&lasttime, &interval) != 0) + gone_in(13, "procfs-based process debugging"); + break; + } error = 0; switch (cmd) { Modified: releng/11.4/sys/sys/pioctl.h ============================================================================== --- releng/11.4/sys/sys/pioctl.h Thu May 14 17:19:07 2020 (r361034) +++ releng/11.4/sys/sys/pioctl.h Thu May 14 17:47:55 2020 (r361035) @@ -39,6 +39,10 @@ #ifndef _SYS_PIOCTL_H # define _SYS_PIOCTL_H +#ifndef _KERNEL +#warning " is deprecated, ptrace() should be used instead" +#endif + # include struct procfs_status { Modified: releng/11.4/usr.sbin/procctl/Makefile ============================================================================== --- releng/11.4/usr.sbin/procctl/Makefile Thu May 14 17:19:07 2020 (r361034) +++ releng/11.4/usr.sbin/procctl/Makefile Thu May 14 17:47:55 2020 (r361035) @@ -1,6 +1,14 @@ # $FreeBSD$ +.include + PROG= procctl MAN= procctl.8 + +# Ignore deprecation warning in +CFLAGS.clang+= -Wno-\#warnings +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40700 +CFLAGS.gcc+= -Wno-cpp +.endif .include