From owner-svn-src-stable@freebsd.org Sun Aug 23 21:48:59 2020 Return-Path: Delivered-To: svn-src-stable@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 B1B893CC5D0; Sun, 23 Aug 2020 21:48:59 +0000 (UTC) (envelope-from trasz@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTRH4Gxyz4b4D; Sun, 23 Aug 2020 21:48:59 +0000 (UTC) (envelope-from trasz@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 76190DEC7; Sun, 23 Aug 2020 21:48:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NLmxdZ073534; Sun, 23 Aug 2020 21:48:59 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLmvZj073523; Sun, 23 Aug 2020 21:48:57 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232148.07NLmvZj073523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 21:48:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364556 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Commit-Revision: 364556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:48:59 -0000 Author: trasz Date: Sun Aug 23 21:48:57 2020 New Revision: 364556 URL: https://svnweb.freebsd.org/changeset/base/364556 Log: MFC r353725 by yuripv: linux: futex_mtx should follow futex_list Move futex_mtx to linux_common.ko for amd64 and aarch64 along with respective list/mutex init/destroy. PR: 240989 Reported by: Alex S Modified: stable/12/sys/amd64/linux/linux_sysvec.c stable/12/sys/amd64/linux32/linux32_sysvec.c stable/12/sys/arm64/linux/linux_sysvec.c stable/12/sys/compat/linux/linux.c stable/12/sys/compat/linux/linux.h stable/12/sys/compat/linux/linux_common.c stable/12/sys/compat/linux/linux_futex.c stable/12/sys/compat/linux/linux_futex.h stable/12/sys/i386/linux/linux_sysvec.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux/linux_sysvec.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/amd64/linux/linux_sysvec.c Sun Aug 23 21:48:57 2020 (r364556) @@ -75,7 +75,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -883,8 +882,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_register_handler(*lihp); - LIST_INIT(&futex_list); - mtx_init(&futex_mtx, "ftllk64", NULL, MTX_DEF); stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux x86-64 ELF exec handler installed\n"); @@ -905,7 +902,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_unregister_handler(*lihp); - mtx_destroy(&futex_mtx); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else Modified: stable/12/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_sysvec.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/amd64/linux32/linux32_sysvec.c Sun Aug 23 21:48:57 2020 (r364556) @@ -81,7 +81,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -1073,8 +1072,6 @@ linux_elf_modevent(module_t mod, int type, void *data) if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux32_ioctl_register_handler(*lihp); - LIST_INIT(&futex_list); - mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux ELF exec handler installed\n"); @@ -1095,7 +1092,6 @@ linux_elf_modevent(module_t mod, int type, void *data) if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux32_ioctl_unregister_handler(*lihp); - mtx_destroy(&futex_mtx); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else Modified: stable/12/sys/arm64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/arm64/linux/linux_sysvec.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/arm64/linux/linux_sysvec.c Sun Aug 23 21:48:57 2020 (r364556) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -503,8 +502,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_register_handler(*lihp); - LIST_INIT(&futex_list); - mtx_init(&futex_mtx, "ftllk64", NULL, MTX_DEF); stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux arm64 ELF exec handler installed\n"); @@ -524,7 +521,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_unregister_handler(*lihp); - mtx_destroy(&futex_mtx); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else Modified: stable/12/sys/compat/linux/linux.c ============================================================================== --- stable/12/sys/compat/linux/linux.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/compat/linux/linux.c Sun Aug 23 21:48:57 2020 (r364556) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include struct futex_list futex_list; +struct mtx futex_mtx; /* protects the futex list */ CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); Modified: stable/12/sys/compat/linux/linux.h ============================================================================== --- stable/12/sys/compat/linux/linux.h Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/compat/linux/linux.h Sun Aug 23 21:48:57 2020 (r364556) @@ -130,5 +130,6 @@ int linux_to_bsd_signal(int sig); int bsd_to_linux_signal(int sig); extern LIST_HEAD(futex_list, futex) futex_list; +extern struct mtx futex_mtx; #endif /* _LINUX_MI_H_ */ Modified: stable/12/sys/compat/linux/linux_common.c ============================================================================== --- stable/12/sys/compat/linux/linux_common.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/compat/linux/linux_common.c Sun Aug 23 21:48:57 2020 (r364556) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -76,11 +77,14 @@ linux_common_modevent(module_t mod, int type, void *da linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_register_handler(*ldhp); + LIST_INIT(&futex_list); + mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); break; case MOD_UNLOAD: linux_osd_jail_deregister(); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_unregister_handler(*ldhp); + mtx_destroy(&futex_mtx); EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag); EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag); Modified: stable/12/sys/compat/linux/linux_futex.c ============================================================================== --- stable/12/sys/compat/linux/linux_futex.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/compat/linux/linux_futex.c Sun Aug 23 21:48:57 2020 (r364556) @@ -224,7 +224,6 @@ struct futex { #define FUTEX_ASSERT_LOCKED(f) mtx_assert(&(f)->f_lck, MA_OWNED) #define FUTEX_ASSERT_UNLOCKED(f) mtx_assert(&(f)->f_lck, MA_NOTOWNED) -struct mtx futex_mtx; /* protects the futex list */ #define FUTEXES_LOCK do { \ mtx_lock(&futex_mtx); \ LIN_SDT_PROBE1(locks, futex_mtx, \ Modified: stable/12/sys/compat/linux/linux_futex.h ============================================================================== --- stable/12/sys/compat/linux/linux_futex.h Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/compat/linux/linux_futex.h Sun Aug 23 21:48:57 2020 (r364556) @@ -38,8 +38,6 @@ #ifndef _LINUX_FUTEX_H #define _LINUX_FUTEX_H -extern struct mtx futex_mtx; - #define LINUX_FUTEX_WAIT 0 #define LINUX_FUTEX_WAKE 1 #define LINUX_FUTEX_FD 2 /* unused */ Modified: stable/12/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/i386/linux/linux_sysvec.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/i386/linux/linux_sysvec.c Sun Aug 23 21:48:57 2020 (r364556) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include