From owner-svn-src-stable@freebsd.org Sun Mar 19 10:41:38 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54294D1283C; Sun, 19 Mar 2017 10:41:38 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0161E1D26; Sun, 19 Mar 2017 10:41:37 +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 v2JAfbfj070218; Sun, 19 Mar 2017 10:41:37 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2JAfboA070217; Sun, 19 Mar 2017 10:41:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201703191041.v2JAfboA070217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 19 Mar 2017 10:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315544 - stable/11/sys/amd64/linux X-SVN-Group: stable-11 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.23 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, 19 Mar 2017 10:41:38 -0000 Author: trasz Date: Sun Mar 19 10:41:36 2017 New Revision: 315544 URL: https://svnweb.freebsd.org/changeset/base/315544 Log: MFC r313993: Reimplement linux_arch_prctl() as a wrapper around sysarch(2). This also adds support for LINUX_ARCH_SET_GS. Modified: stable/11/sys/amd64/linux/linux_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_machdep.c ============================================================================== --- stable/11/sys/amd64/linux/linux_machdep.c Sun Mar 19 10:39:59 2017 (r315543) +++ stable/11/sys/amd64/linux/linux_machdep.c Sun Mar 19 10:41:36 2017 (r315544) @@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include int linux_execve(struct thread *td, struct linux_execve_args *args) @@ -226,28 +227,34 @@ int linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) { int error; - struct pcb *pcb; + struct sysarch_args bsd_args; LINUX_CTR2(arch_prctl, "0x%x, %p", args->code, args->addr); - error = ENOTSUP; - pcb = td->td_pcb; - switch (args->code) { - case LINUX_ARCH_GET_GS: - error = copyout(&pcb->pcb_gsbase, (unsigned long *)args->addr, - sizeof(args->addr)); - break; case LINUX_ARCH_SET_GS: - if (args->addr >= VM_MAXUSER_ADDRESS) - return(EPERM); + bsd_args.op = AMD64_SET_GSBASE; + bsd_args.parms = (void *)args->addr; + error = sysarch(td, &bsd_args); + if (error == EINVAL) + error = EPERM; + break; + case LINUX_ARCH_SET_FS: + bsd_args.op = AMD64_SET_FSBASE; + bsd_args.parms = (void *)args->addr; + error = sysarch(td, &bsd_args); + if (error == EINVAL) + error = EPERM; break; case LINUX_ARCH_GET_FS: - error = copyout(&pcb->pcb_fsbase, (unsigned long *)args->addr, - sizeof(args->addr)); + bsd_args.op = AMD64_GET_FSBASE; + bsd_args.parms = (void *)args->addr; + error = sysarch(td, &bsd_args); break; - case LINUX_ARCH_SET_FS: - error = linux_set_cloned_tls(td, (void *)args->addr); + case LINUX_ARCH_GET_GS: + bsd_args.op = AMD64_GET_GSBASE; + bsd_args.parms = (void *)args->addr; + error = sysarch(td, &bsd_args); break; default: error = EINVAL;