From owner-svn-src-stable@freebsd.org Sun Jun 11 02:04:41 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 79375BFB877; Sun, 11 Jun 2017 02:04:41 +0000 (UTC) (envelope-from allanjude@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 52AA46EFC5; Sun, 11 Jun 2017 02:04:41 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5B24e1h000895; Sun, 11 Jun 2017 02:04:40 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5B24dmk000888; Sun, 11 Jun 2017 02:04:39 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201706110204.v5B24dmk000888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sun, 11 Jun 2017 02:04:39 +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: r319819 - in stable/11: lib/libc/sys share/man/man4 sys/compat/freebsd32 sys/kern 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, 11 Jun 2017 02:04:41 -0000 Author: allanjude Date: Sun Jun 11 02:04:39 2017 New Revision: 319819 URL: https://svnweb.freebsd.org/changeset/base/319819 Log: MFC r318765: Allow cpuset_{get,set}affinity in capabilities mode Approved by: re (marius) Modified: stable/11/lib/libc/sys/cpuset_getaffinity.2 stable/11/share/man/man4/capsicum.4 stable/11/sys/compat/freebsd32/capabilities.conf stable/11/sys/compat/freebsd32/freebsd32_sysent.c stable/11/sys/kern/capabilities.conf stable/11/sys/kern/init_sysent.c stable/11/sys/kern/kern_cpuset.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/cpuset_getaffinity.2 ============================================================================== --- stable/11/lib/libc/sys/cpuset_getaffinity.2 Sun Jun 11 00:44:19 2017 (r319818) +++ stable/11/lib/libc/sys/cpuset_getaffinity.2 Sun Jun 11 02:04:39 2017 (r319819) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 2016 +.Dd May 23, 2017 .Dt CPUSET_GETAFFINITY 2 .Os .Sh NAME @@ -148,8 +148,14 @@ was either preposterously large or smaller than the ke .It Bq Er EPERM The calling process did not have the credentials required to complete the operation. +.It Bq Er ECAPMODE +The calling process attempted to act on a process other than itself, while +in capability mode. +See +.Xr capsicum 4 . .El .Sh SEE ALSO +.Xr capsicum 4 , .Xr cpuset 1 , .Xr cpuset 2 , .Xr cpuset_getid 2 , Modified: stable/11/share/man/man4/capsicum.4 ============================================================================== --- stable/11/share/man/man4/capsicum.4 Sun Jun 11 00:44:19 2017 (r319818) +++ stable/11/share/man/man4/capsicum.4 Sun Jun 11 02:04:39 2017 (r319819) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 5, 2016 +.Dd May 18, 2017 .Dt CAPSICUM 4 .Os .Sh NAME @@ -87,6 +87,16 @@ greater detail in An extension to the POSIX shared memory API to support anonymous swap objects associated with file descriptors; described in greater detail in .Xr shm_open 2 . +.El +.Pp +In some cases, +.Nm +limits the valid values of some parameters to traditional APIs in order to +restrict access to global namespaces: +.Bl -tag -width indent +.It process IDs +Processes can only act upon their own process ID with syscalls such as +.Xr cpuset_setaffinity 2 . .El .Sh SEE ALSO .Xr cap_enter 2 , Modified: stable/11/sys/compat/freebsd32/capabilities.conf ============================================================================== --- stable/11/sys/compat/freebsd32/capabilities.conf Sun Jun 11 00:44:19 2017 (r319818) +++ stable/11/sys/compat/freebsd32/capabilities.conf Sun Jun 11 02:04:39 2017 (r319819) @@ -76,9 +76,9 @@ close closefrom connectat #cpuset -#freebsd32_cpuset_getaffinity +freebsd32_cpuset_getaffinity #freebsd32_cpuset_getid -#freebsd32_cpuset_setaffinity +freebsd32_cpuset_setaffinity #freebsd32_cpuset_setid dup dup2 Modified: stable/11/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_sysent.c Sun Jun 11 00:44:19 2017 (r319818) +++ stable/11/sys/compat/freebsd32/freebsd32_sysent.c Sun Jun 11 02:04:39 2017 (r319819) @@ -552,8 +552,8 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_cpuset_setid_args), (sy_call_t *)freebsd32_cpuset_setid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 485 = freebsd32_cpuset_setid */ #endif { AS(freebsd32_cpuset_getid_args), (sy_call_t *)freebsd32_cpuset_getid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 486 = freebsd32_cpuset_getid */ - { AS(freebsd32_cpuset_getaffinity_args), (sy_call_t *)freebsd32_cpuset_getaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 487 = freebsd32_cpuset_getaffinity */ - { AS(freebsd32_cpuset_setaffinity_args), (sy_call_t *)freebsd32_cpuset_setaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 488 = freebsd32_cpuset_setaffinity */ + { AS(freebsd32_cpuset_getaffinity_args), (sy_call_t *)freebsd32_cpuset_getaffinity, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 487 = freebsd32_cpuset_getaffinity */ + { AS(freebsd32_cpuset_setaffinity_args), (sy_call_t *)freebsd32_cpuset_setaffinity, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 488 = freebsd32_cpuset_setaffinity */ { AS(faccessat_args), (sy_call_t *)sys_faccessat, AUE_FACCESSAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 489 = faccessat */ { AS(fchmodat_args), (sy_call_t *)sys_fchmodat, AUE_FCHMODAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 490 = fchmodat */ { AS(fchownat_args), (sy_call_t *)sys_fchownat, AUE_FCHOWNAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 491 = fchownat */ Modified: stable/11/sys/kern/capabilities.conf ============================================================================== --- stable/11/sys/kern/capabilities.conf Sun Jun 11 00:44:19 2017 (r319818) +++ stable/11/sys/kern/capabilities.conf Sun Jun 11 02:04:39 2017 (r319819) @@ -133,13 +133,12 @@ closefrom connectat ## -## cpuset(2) and related calls require scoping by process, but should -## eventually be allowed, at least in the current process case. +## cpuset(2) and related calls are limited to caller's own process/thread. ## #cpuset -#cpuset_getaffinity +cpuset_getaffinity #cpuset_getid -#cpuset_setaffinity +cpuset_setaffinity #cpuset_setid ## Modified: stable/11/sys/kern/init_sysent.c ============================================================================== --- stable/11/sys/kern/init_sysent.c Sun Jun 11 00:44:19 2017 (r319818) +++ stable/11/sys/kern/init_sysent.c Sun Jun 11 02:04:39 2017 (r319819) @@ -532,8 +532,8 @@ struct sysent sysent[] = { { AS(cpuset_args), (sy_call_t *)sys_cpuset, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 484 = cpuset */ { AS(cpuset_setid_args), (sy_call_t *)sys_cpuset_setid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 485 = cpuset_setid */ { AS(cpuset_getid_args), (sy_call_t *)sys_cpuset_getid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 486 = cpuset_getid */ - { AS(cpuset_getaffinity_args), (sy_call_t *)sys_cpuset_getaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 487 = cpuset_getaffinity */ - { AS(cpuset_setaffinity_args), (sy_call_t *)sys_cpuset_setaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 488 = cpuset_setaffinity */ + { AS(cpuset_getaffinity_args), (sy_call_t *)sys_cpuset_getaffinity, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 487 = cpuset_getaffinity */ + { AS(cpuset_setaffinity_args), (sy_call_t *)sys_cpuset_setaffinity, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 488 = cpuset_setaffinity */ { AS(faccessat_args), (sy_call_t *)sys_faccessat, AUE_FACCESSAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 489 = faccessat */ { AS(fchmodat_args), (sy_call_t *)sys_fchmodat, AUE_FCHMODAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 490 = fchmodat */ { AS(fchownat_args), (sy_call_t *)sys_fchownat, AUE_FCHOWNAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 491 = fchownat */ Modified: stable/11/sys/kern/kern_cpuset.c ============================================================================== --- stable/11/sys/kern/kern_cpuset.c Sun Jun 11 00:44:19 2017 (r319818) +++ stable/11/sys/kern/kern_cpuset.c Sun Jun 11 02:04:39 2017 (r319819) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -523,6 +524,7 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t int threads; int nfree; int error; + /* * The algorithm requires two passes due to locking considerations. * @@ -1097,6 +1099,15 @@ kern_cpuset_getaffinity(struct thread *td, cpulevel_t if (cpusetsize < sizeof(cpuset_t) || cpusetsize > CPU_MAXSIZE / NBBY) return (ERANGE); + /* In Capability mode, you can only get your own CPU set. */ + if (IN_CAPABILITY_MODE(td)) { + if (level != CPU_LEVEL_WHICH) + return (ECAPMODE); + if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) + return (ECAPMODE); + if (id != -1) + return (ECAPMODE); + } size = cpusetsize; mask = malloc(size, M_TEMP, M_WAITOK | M_ZERO); error = cpuset_which(which, id, &p, &ttd, &set); @@ -1201,6 +1212,15 @@ kern_cpuset_setaffinity(struct thread *td, cpulevel_t if (cpusetsize < sizeof(cpuset_t) || cpusetsize > CPU_MAXSIZE / NBBY) return (ERANGE); + /* In Capability mode, you can only set your own CPU set. */ + if (IN_CAPABILITY_MODE(td)) { + if (level != CPU_LEVEL_WHICH) + return (ECAPMODE); + if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) + return (ECAPMODE); + if (id != -1) + return (ECAPMODE); + } mask = malloc(cpusetsize, M_TEMP, M_WAITOK | M_ZERO); error = copyin(maskp, mask, cpusetsize); if (error) From owner-svn-src-stable@freebsd.org Sun Jun 11 09:33:10 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 7A3C8C77F76; Sun, 11 Jun 2017 09:33:10 +0000 (UTC) (envelope-from dchagin@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 49D3D85169; Sun, 11 Jun 2017 09:33:10 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5B9X9iP006150; Sun, 11 Jun 2017 09:33:09 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5B9X9QJ006148; Sun, 11 Jun 2017 09:33:09 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201706110933.v5B9X9QJ006148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 11 Jun 2017 09:33:09 +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: r319823 - stable/11/sys/compat/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, 11 Jun 2017 09:33:10 -0000 Author: dchagin Date: Sun Jun 11 09:33:09 2017 New Revision: 319823 URL: https://svnweb.freebsd.org/changeset/base/319823 Log: MFC r319571: On success, getrandom() Linux system call returns the number of bytes that were copied to the buffer supplied by the user. PR: 219464 Submitted by: Maciej Pasternacki Reported by: Maciej Pasternacki Approved by: re (kib) Modified: stable/11/sys/compat/linux/linux_misc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_misc.c ============================================================================== --- stable/11/sys/compat/linux/linux_misc.c Sun Jun 11 04:03:09 2017 (r319822) +++ stable/11/sys/compat/linux/linux_misc.c Sun Jun 11 09:33:09 2017 (r319823) @@ -2516,6 +2516,7 @@ linux_getrandom(struct thread *td, struct linux_getran { struct uio uio; struct iovec iov; + int error; if (args->flags & ~(LINUX_GRND_NONBLOCK|LINUX_GRND_RANDOM)) return (EINVAL); @@ -2532,7 +2533,10 @@ linux_getrandom(struct thread *td, struct linux_getran uio.uio_rw = UIO_READ; uio.uio_td = td; - return (read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK)); + error = read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK); + if (error == 0) + td->td_retval[0] = args->count - uio.uio_resid; + return (error); } int From owner-svn-src-stable@freebsd.org Mon Jun 12 14:32:40 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 EEABABFDAEC; Mon, 12 Jun 2017 14:32:40 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA2D471684; Mon, 12 Jun 2017 14:32:40 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x242.google.com with SMTP id a70so14453790pge.0; Mon, 12 Jun 2017 07:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=RLkL/E2H82985jGCjPmuwU8GMH0Oo6hg6Uw8x7P2ZGc=; b=tlmkgg5Gwx6nUtTKbJkbLg6Kax4csvXIBU2j0AlqOLzJiVUGSa2+hLzHrtdYzFeUuB zVvisSLW/30sOgsuxYdMUtFACJYpiPknSme8zrs5IaMOUNoWOG5ihh2G8bxptYBO6uf3 lc7TzZ1no21alKIzU25rtQIBZvhq/BZmuZ5w7f23JuBXGieZ2dk4QXPKbNkomHvY5jLP fSJVq4AZsvqKou+hklOPfmwbe/CuZo8MnFpMEefECMOo4FWjf6NYg59Klw45I+D9whsq Ju1Z8NrAg1LeQjD/Li3MSdcllL8Ow3gicX9kWjUAYSBdC0i/fyRWOg8kFjL638oC7UZi 6OoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=RLkL/E2H82985jGCjPmuwU8GMH0Oo6hg6Uw8x7P2ZGc=; b=Jz2k+ebeB1ea7zsAAvqWpCy3XByCR9H59CuuKNS37ak0eU5QUTZPcEnaDa+Eyg13nX WaKo9ATdp2x8WW15fPOlrT/cIFZbZpuTVBvcUzU5lqV6x7VMXiWUdjZAwI8F/5b6S38G mLirXG3OztB0AYqiL4RHZfjbXp81ShoUIabzDASubuH4ODSeJeSoHoyE1J9e0eCCy+/3 OBzngpCyMKBxpkmtc6gNnI3vlZCVaj/vQ8lpix7Iu5RqKf0Vu7JbRfRPT35J5alXPgZR JFRKOS8YFOxy1KfASYkGPjDGeHDGSRWWm9VTJIU31Nc+c2wUGnhMehF9YZopIKig+kjk D0kw== X-Gm-Message-State: AKS2vOxZWs6wGRYrLuorcWmTDYObgGP5uUGGWxVfvSh1/pG68ahuU/SW f12Phf4WNNpB2Yf2N20= X-Received: by 10.84.231.194 with SMTP id g2mr13281057pln.34.1497277959840; Mon, 12 Jun 2017 07:32:39 -0700 (PDT) Received: from [192.168.20.13] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id i62sm20578296pfj.30.2017.06.12.07.32.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jun 2017 07:32:39 -0700 (PDT) Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r319349 - in stable/11: contrib/byacc contrib/byacc/package contrib/byacc/package/debian contrib/byacc/package/pkgsrc contrib/byacc/test contrib/byacc/test/btyacc contrib/byacc/test/yac... From: Ngie Cooper X-Mailer: iPhone Mail (14F89) In-Reply-To: <201705311916.v4VJGNeO096940@repo.freebsd.org> Date: Mon, 12 Jun 2017 07:32:38 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Message-Id: <217388AE-894D-4DDB-AE1F-08F8347971BA@gmail.com> References: <201705311916.v4VJGNeO096940@repo.freebsd.org> To: Jung-uk Kim Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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: Mon, 12 Jun 2017 14:32:41 -0000 > On May 31, 2017, at 12:16, Jung-uk Kim wrote: >=20 > Author: jkim > Date: Wed May 31 19:16:22 2017 > New Revision: 319349 > URL: https://svnweb.freebsd.org/changeset/base/319349 >=20 > Log: > MFC: r313105, r313106 >=20 > Update byacc to 20170201. This change broke the tests, due to a missing MFC: https://bugs.freebsd.org/= bugzilla/show_bug.cgi?id=3D216891 . Thanks, -Ngie= From owner-svn-src-stable@freebsd.org Mon Jun 12 17:37:19 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 4B620C08F59; Mon, 12 Jun 2017 17:37:19 +0000 (UTC) (envelope-from ngie@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 19EC5777C4; Mon, 12 Jun 2017 17:37:19 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5CHbIku005443; Mon, 12 Jun 2017 17:37:18 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5CHbImQ005442; Mon, 12 Jun 2017 17:37:18 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201706121737.v5CHbImQ005442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 12 Jun 2017 17:37:18 +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: r319860 - stable/11/contrib/byacc/test/yacc 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: Mon, 12 Jun 2017 17:37:19 -0000 Author: ngie Date: Mon Jun 12 17:37:18 2017 New Revision: 319860 URL: https://svnweb.freebsd.org/changeset/base/319860 Log: MFC r313398: Approved by: re (gjb) Apply r274475's to expr.oxout.tab.c to fix the test on FreeBSD YYINT on FreeBSD is int, not short I'll work with the upstream maintainer or come up with a build method of modifying their definitions on install instead of having to modify tests to match our forked YYINT definition. PR: 216891 Modified: stable/11/contrib/byacc/test/yacc/expr.oxout.tab.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/byacc/test/yacc/expr.oxout.tab.c ============================================================================== --- stable/11/contrib/byacc/test/yacc/expr.oxout.tab.c Mon Jun 12 17:22:23 2017 (r319859) +++ stable/11/contrib/byacc/test/yacc/expr.oxout.tab.c Mon Jun 12 17:37:18 2017 (r319860) @@ -178,7 +178,7 @@ extern int YYPARSE_DECL(); #define ID 257 #define CONST 258 #define YYERRCODE 256 -typedef short YYINT; +typedef int YYINT; static const YYINT expr.oxout_lhs[] = { -1, 2, 0, 1, 3, 3, 3, 3, 3, 3, 3, }; From owner-svn-src-stable@freebsd.org Tue Jun 13 00:22:17 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 A1F42D8765D; Tue, 13 Jun 2017 00:22:17 +0000 (UTC) (envelope-from sjg@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 69C65E68; Tue, 13 Jun 2017 00:22:17 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5D0MGgG073955; Tue, 13 Jun 2017 00:22:16 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5D0MFHe073943; Tue, 13 Jun 2017 00:22:15 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201706130022.v5D0MFHe073943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Tue, 13 Jun 2017 00:22:15 +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: r319884 - in stable/11: contrib/bmake contrib/bmake/PSD.doc contrib/bmake/mk contrib/bmake/mk/sys contrib/bmake/unit-tests usr.bin/bmake 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: Tue, 13 Jun 2017 00:22:17 -0000 Author: sjg Date: Tue Jun 13 00:22:15 2017 New Revision: 319884 URL: https://svnweb.freebsd.org/changeset/base/319884 Log: Update bmake to 20170510 Approved by: re@ Added: stable/11/contrib/bmake/mk/files.mk - copied unchanged from r318163, head/contrib/bmake/mk/files.mk stable/11/contrib/bmake/mk/sys.debug.mk - copied unchanged from r310304, head/contrib/bmake/mk/sys.debug.mk stable/11/contrib/bmake/mk/sys.vars.mk - copied, changed from r310304, head/contrib/bmake/mk/sys.vars.mk Modified: stable/11/contrib/bmake/ChangeLog stable/11/contrib/bmake/Makefile stable/11/contrib/bmake/PSD.doc/tutorial.ms stable/11/contrib/bmake/arch.c stable/11/contrib/bmake/bmake.1 stable/11/contrib/bmake/bmake.cat1 stable/11/contrib/bmake/compat.c stable/11/contrib/bmake/cond.c stable/11/contrib/bmake/dir.c stable/11/contrib/bmake/for.c stable/11/contrib/bmake/job.c stable/11/contrib/bmake/main.c stable/11/contrib/bmake/make.1 stable/11/contrib/bmake/make.c stable/11/contrib/bmake/make.h stable/11/contrib/bmake/make_malloc.c stable/11/contrib/bmake/meta.c stable/11/contrib/bmake/mk/ChangeLog stable/11/contrib/bmake/mk/FILES stable/11/contrib/bmake/mk/auto.obj.mk stable/11/contrib/bmake/mk/dirdeps.mk stable/11/contrib/bmake/mk/doc.mk stable/11/contrib/bmake/mk/dpadd.mk stable/11/contrib/bmake/mk/final.mk stable/11/contrib/bmake/mk/gendirdeps.mk stable/11/contrib/bmake/mk/inc.mk stable/11/contrib/bmake/mk/init.mk stable/11/contrib/bmake/mk/install-mk stable/11/contrib/bmake/mk/lib.mk stable/11/contrib/bmake/mk/meta.stage.mk stable/11/contrib/bmake/mk/meta.sys.mk stable/11/contrib/bmake/mk/meta2deps.py stable/11/contrib/bmake/mk/meta2deps.sh stable/11/contrib/bmake/mk/mkopt.sh stable/11/contrib/bmake/mk/own.mk stable/11/contrib/bmake/mk/prog.mk stable/11/contrib/bmake/mk/scripts.mk stable/11/contrib/bmake/mk/subdir.mk stable/11/contrib/bmake/mk/sys.mk stable/11/contrib/bmake/mk/sys/AIX.mk stable/11/contrib/bmake/mk/sys/Darwin.mk stable/11/contrib/bmake/mk/sys/Generic.mk stable/11/contrib/bmake/mk/sys/HP-UX.mk stable/11/contrib/bmake/mk/sys/IRIX.mk stable/11/contrib/bmake/mk/sys/Linux.mk stable/11/contrib/bmake/mk/sys/NetBSD.mk stable/11/contrib/bmake/mk/sys/OSF1.mk stable/11/contrib/bmake/mk/sys/OpenBSD.mk stable/11/contrib/bmake/mk/sys/SunOS.mk stable/11/contrib/bmake/mk/sys/UnixWare.mk stable/11/contrib/bmake/nonints.h stable/11/contrib/bmake/os.sh stable/11/contrib/bmake/parse.c stable/11/contrib/bmake/str.c stable/11/contrib/bmake/suff.c stable/11/contrib/bmake/targ.c stable/11/contrib/bmake/unit-tests/modmatch.exp stable/11/contrib/bmake/unit-tests/modmatch.mk stable/11/contrib/bmake/unit-tests/varmisc.exp stable/11/contrib/bmake/unit-tests/varmisc.mk stable/11/contrib/bmake/var.c stable/11/usr.bin/bmake/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/bmake/ChangeLog ============================================================================== --- stable/11/contrib/bmake/ChangeLog Mon Jun 12 23:50:30 2017 (r319883) +++ stable/11/contrib/bmake/ChangeLog Tue Jun 13 00:22:15 2017 (r319884) @@ -1,3 +1,169 @@ +2017-05-10 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170510 + Merge with NetBSD make, pick up + o main.c: Main_SetObjdir: ensure buf2 is in scope + +2017-05-08 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170505 + see mk/ChangeLog + +2017-05-05 Simon J. Gerraty + + * parse.c: not everyone has stdint.h + +2017-05-01 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170501 + see mk/ChangeLog + +2017-04-21 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170421 + Merge with NetBSD make, pick up + o str.c: Str_Match: fix closure tests for [^] and add unit-test. + +2017-04-20 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170420 + Merge with NetBSD make, pick up + o main.c: only use -C arg "as is" if it contains no + relative component. + +2017-04-18 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170418 + Merge with NetBSD make, pick up + o main.c: fix Main_SetObjdir() for relative paths (eg obj). + +2017-04-17 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170417 + Merge with NetBSD make, pick up + o fixes a number of coverity complaints + - check return value of fseek, fcntl + - plug memory leak in Dir_FindFile, Var_LoopExpand, + JobPrintCommand, ParseTraditionalInclude + - use bmake_malloc() where NULL is not tollerated + - use MAKE_ATTR_UNUSED rather that kludges like + return(unused ? 0 : 0) + - use purge_cached_realpaths() rather than abuse cached_realpath() + +2017-04-13 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170413 + Merge with NetBSD make, pick up + o main.c: when setting .OBJDIR ignore '$' in paths. + + * job.c: use MALLOC_OPTIONS to set malloc_options. + +2017-04-11 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170411 + Merge with NetBSD make, pick up + o str.c: Str_Match: allow [^a-z] to behave as expected. + +2017-03-26 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170326 + Merge with NetBSD make, pick up + o main.c: purge relative paths from realpath cache when .OBJDIR + is changed. + +2017-03-11 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170311 + Merge with NetBSD make, pick up + o main.c: only use -C arg "as is" if it starts with '/'. + +2017-03-01 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170301 + Merge with NetBSD make, pick up + o main.c: use -C arg "as is" rather than getcwd() + if they identify the same directory. + o parse.c: ensure loadfile buffer is \n terminated in non-mmap case + +2017-02-01 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170201 + Merge with NetBSD make, pick up + o var.c: allow :_=var and avoid use of special context. + +2017-01-30 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170130 + Merge with NetBSD make, pick up + o var.c: add :range and :_ + o main.c: partially initialize Dir_* before MainParseArgs() + can be called. + If -V, skip Main_ExportMAKEFLAGS() + +2017-01-14 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170114 + Merge with NetBSD make, pick up + o var.c: allow specifying the utc value used by :{gm,local}time + +2016-12-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161212 + Merge with NetBSD make, pick up + o main.c: look for obj.${MACHINE}-${MACHINE_ARCH} too. + +2016-12-09 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161209 + Merge with NetBSD make, pick up + o main.c: cleanup setting of .OBJDIR + o parse.c: avoid coredump from (var)=val + +2016-11-26 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161126 + Merge with NetBSD make, pick up + o make.c: Make_OODate: report src node name if path not set + +2016-09-26 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160926 + Merge with NetBSD make, pick up + o support for .DELETE_ON_ERROR: (remove targets that fail) + +2016-09-26 Simon J. Gerraty + + * Makefile MAN: tweak .Dt to match ${PROG} + +2016-08-18 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160818 + its a neater number; pick up whitespace fixes to man page. + +2016-08-17 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160817 + Merge with NetBSD make, pick up + o meta.c: move handling of .MAKE.META.IGNORE_* to meta_ignore() + so we can call it before adding entries to missingFiles. + Thus we do not track files we have been told to ignore. + +2016-08-15 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160815 + Merge with NetBSD make, pick up + o meta_oodate: apply .MAKE.META.IGNORE_FILTER (if defined) to + pathnames, and skip if the expansion is empty. + Useful for dirdeps.mk when checking DIRDEPS_CACHE. + +2016-08-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160812 + Merge with NetBSD make, pick up + o meta.c: remove all missingFiles entries that match a deleted + dir. + o main.c: set .ERROR_CMD if possible. + 2016-06-06 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20160606 Modified: stable/11/contrib/bmake/Makefile ============================================================================== --- stable/11/contrib/bmake/Makefile Mon Jun 12 23:50:30 2017 (r319883) +++ stable/11/contrib/bmake/Makefile Tue Jun 13 00:22:15 2017 (r319884) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.67 2016/06/07 00:46:12 sjg Exp $ +# $Id: Makefile,v 1.92 2017/05/10 22:29:04 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20160606 +_MAKE_VERSION= 20170510 PROG= bmake @@ -156,7 +156,10 @@ my.history: ${MAKEFILE} .NOPATH: ${MAN} ${MAN}: make.1 my.history @echo making $@ - @sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \ + @sed \ + -e '/^.Dt/s/MAKE/${PROG:tu}/' \ + -e 's/^.Nx/NetBSD/' \ + -e '/^.Nm/s/make/${PROG}/' \ -e '/^.Sh HISTORY/rmy.history' \ -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@ Modified: stable/11/contrib/bmake/PSD.doc/tutorial.ms ============================================================================== --- stable/11/contrib/bmake/PSD.doc/tutorial.ms Mon Jun 12 23:50:30 2017 (r319883) +++ stable/11/contrib/bmake/PSD.doc/tutorial.ms Tue Jun 13 00:22:15 2017 (r319884) @@ -1,4 +1,4 @@ -.\" $NetBSD: tutorial.ms,v 1.12 2014/09/30 21:33:14 christos Exp $ +.\" $NetBSD: tutorial.ms,v 1.13 2017/03/01 13:05:11 kre Exp $ .\" Copyright (c) 1988, 1989, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -117,6 +117,15 @@ .de No .br .ne 0.5i +.ie n \{\ +.nr g3 \w'NOTE ' +.po -\\n(g3u +.br +NOTE +.br +.po +\\n(g3u +.\} +.el \{\ .po -0.5i .br .mk @@ -148,12 +157,14 @@ .rt .ft \\n(g3 .ps \\n(g4 +.\} .. .de Bp .ie !\\n(.$ .IP \(bu 2 .el .IP "\&" 2 .. -.po +.3i +.ie n .po +\w'NOTE 'u +.el .po +.3i .TL PMake \*- A Tutorial .AU Modified: stable/11/contrib/bmake/arch.c ============================================================================== --- stable/11/contrib/bmake/arch.c Mon Jun 12 23:50:30 2017 (r319883) +++ stable/11/contrib/bmake/arch.c Tue Jun 13 00:22:15 2017 (r319884) @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $ */ +/* $NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $"); +__RCSID("$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $"); #endif #endif /* not lint */ #endif @@ -726,7 +726,8 @@ ArchStatMember(char *archive, char *member, Boolean ha if (fread(memName, elen, 1, arch) != 1) goto badarch; memName[elen] = '\0'; - fseek(arch, -elen, SEEK_CUR); + if (fseek(arch, -elen, SEEK_CUR) != 0) + goto badarch; if (DEBUG(ARCH) || DEBUG(MAKE)) { fprintf(debug_file, "ArchStat: Extended format entry for %s\n", memName); } @@ -737,7 +738,8 @@ ArchStatMember(char *archive, char *member, Boolean ha Hash_SetValue(he, bmake_malloc(sizeof(struct ar_hdr))); memcpy(Hash_GetValue(he), &arh, sizeof(struct ar_hdr)); } - fseek(arch, (size + 1) & ~1, SEEK_CUR); + if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0) + goto badarch; } fclose(arch); @@ -956,7 +958,10 @@ ArchFindMember(char *archive, char *member, struct ar_ * the file at the actual member, rather than its header, but * not here... */ - fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR); + if (fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } return (arch); } } else @@ -986,10 +991,17 @@ ArchFindMember(char *archive, char *member, struct ar_ } if (strncmp(ename, member, len) == 0) { /* Found as extended name */ - fseek(arch, -sizeof(struct ar_hdr) - elen, SEEK_CUR); + if (fseek(arch, -sizeof(struct ar_hdr) - elen, + SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } return (arch); } - fseek(arch, -elen, SEEK_CUR); + if (fseek(arch, -elen, SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } goto skip; } else #endif @@ -1002,9 +1014,12 @@ skip: * extract the size of the file from the 'size' field of the * header and round it up during the seek. */ - arhPtr->ar_size[sizeof(arhPtr->AR_SIZE)-1] = '\0'; + arhPtr->AR_SIZE[sizeof(arhPtr->AR_SIZE)-1] = '\0'; size = (int)strtol(arhPtr->AR_SIZE, NULL, 10); - fseek(arch, (size + 1) & ~1, SEEK_CUR); + if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } } } Modified: stable/11/contrib/bmake/bmake.1 ============================================================================== --- stable/11/contrib/bmake/bmake.1 Mon Jun 12 23:50:30 2017 (r319883) +++ stable/11/contrib/bmake/bmake.1 Tue Jun 13 00:22:15 2017 (r319884) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.259 2016/06/03 07:07:37 wiz Exp $ +.\" $NetBSD: make.1,v 1.266 2017/02/01 18:39:27 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,8 +29,8 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd June 2, 2016 -.Dt MAKE 1 +.Dd February 1, 2017 +.Dt BMAKE 1 .Os .Sh NAME .Nm bmake @@ -927,6 +927,9 @@ The default list includes: .It Va .MAKE.META.IGNORE_PATTERNS Provides a list of patterns to match against pathnames. Ignore any that match. +.It Va .MAKE.META.IGNORE_FILTER +Provides a list of variable modifiers to apply to each pathname. +Ignore if the expansion is an empty string. .It Va .MAKE.META.PREFIX Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: @@ -974,7 +977,19 @@ per normal evaluation rules. .It Va MAKE_PRINT_VAR_ON_ERROR When .Nm -stops due to an error, it prints its name and the value of +stops due to an error, it sets +.Ql Va .ERROR_TARGET +to the name of the target that failed, +.Ql Va .ERROR_CMD +to the commands of the failed target, +and in "meta" mode, it also sets +.Ql Va .ERROR_CWD +to the +.Xr getcwd 3 , +and +.Ql Va .ERROR_META_FILE +to the path of the meta file (if any) describing the failed target. +It then prints its name and the value of .Ql Va .CURDIR as well as the value of any variables named in .Ql Va MAKE_PRINT_VAR_ON_ERROR . @@ -1190,18 +1205,28 @@ safely through recursive invocations of .Nm . .It Cm \&:R Replaces each word in the variable with everything but its suffix. -.It Cm \&:gmtime +.It Cm \&:range[=count] +The value is an integer sequence representing the words of the original +value, or the supplied +.Va count . +.It Cm \&:gmtime[=utc] The value is a format string for .Xr strftime 3 , -using the current +using .Xr gmtime 3 . +If a +.Va utc +value is not provided or is 0, the current time is used. .It Cm \&:hash Compute a 32-bit hash of the value and encode it as hex digits. -.It Cm \&:localtime +.It Cm \&:localtime[=utc] The value is a format string for .Xr strftime 3 , -using the current +using .Xr localtime 3 . +If a +.Va utc +value is not provided or is 0, the current time is used. .It Cm \&:tA Attempt to convert variable to an absolute path using .Xr realpath 3 , @@ -1401,6 +1426,27 @@ For example. .Pp However a single character variable is often more readable: .Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} +.It Cm \&:_[=var] +Save the current variable value in +.Ql $_ +or the named +.Va var +for later reference. +Example usage: +.Bd -literal -offset indent +M_cmpv.units = 1 1000 1000000 +M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \&\\ +\\* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh + +.Dv .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} + +.Ed +Here +.Ql $_ +is used to save the result of the +.Ql :S +modifier which is later referenced using the index values from +.Ql :range . .It Cm \&:U Ns Ar newval If the variable is undefined .Ar newval @@ -1996,6 +2042,14 @@ variable of a target that inherits .Ic .DEFAULT Ns 's commands is set to the target's own name. +.It Ic .DELETE_ON_ERROR +If this target is present in the makefile, it globally causes make to +delete targets whose commands fail. +(By default, only targets whose commands are interrupted during +execution are deleted. +This is the historical behavior.) +This setting can be used to help prevent half-finished or malformed +targets from being left around and corrupting future rebuilds. .It Ic .END Any command lines attached to this target are executed after everything else is done. Modified: stable/11/contrib/bmake/bmake.cat1 ============================================================================== --- stable/11/contrib/bmake/bmake.cat1 Mon Jun 12 23:50:30 2017 (r319883) +++ stable/11/contrib/bmake/bmake.cat1 Tue Jun 13 00:22:15 2017 (r319884) @@ -1,4 +1,4 @@ -MAKE(1) NetBSD General Commands Manual MAKE(1) +BMAKE(1) NetBSD General Commands Manual BMAKE(1) NNAAMMEE bbmmaakkee -- maintain program dependencies @@ -604,6 +604,10 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT Provides a list of patterns to match against pathnames. Ignore any that match. + _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___F_I_L_T_E_R + Provides a list of variable modifiers to apply to each + pathname. Ignore if the expansion is an empty string. + _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: @@ -635,9 +639,14 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT becomes `$' per normal evaluation rules. _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R - When bbmmaakkee stops due to an error, it prints its name and - the value of `_._C_U_R_D_I_R' as well as the value of any vari- - ables named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. + When bbmmaakkee stops due to an error, it sets `_._E_R_R_O_R___T_A_R_G_E_T' + to the name of the target that failed, `_._E_R_R_O_R___C_M_D' to + the commands of the failed target, and in "meta" mode, it + also sets `_._E_R_R_O_R___C_W_D' to the getcwd(3), and + `_._E_R_R_O_R___M_E_T_A___F_I_L_E' to the path of the meta file (if any) + describing the failed target. It then prints its name + and the value of `_._C_U_R_D_I_R' as well as the value of any + variables named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. _._n_e_w_l_i_n_e This variable is simply assigned a newline character as its value. This allows expansions using the ::@@ modifier @@ -780,16 +789,20 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT ::RR Replaces each word in the variable with everything but its suffix. - ::ggmmttiimmee - The value is a format string for strftime(3), using the current - gmtime(3). + ::rraannggee[[==ccoouunntt]] + The value is an integer sequence representing the words of the orig- + inal value, or the supplied _c_o_u_n_t. + ::ggmmttiimmee[[==uuttcc]] + The value is a format string for strftime(3), using gmtime(3). If a + _u_t_c value is not provided or is 0, the current time is used. + ::hhaasshh Compute a 32-bit hash of the value and encode it as hex digits. - ::llooccaallttiimmee - The value is a format string for strftime(3), using the current - localtime(3). + ::llooccaallttiimmee[[==uuttcc]] + The value is a format string for strftime(3), using localtime(3). + If a _u_t_c value is not provided or is 0, the current time is used. ::ttAA Attempt to convert variable to an absolute path using realpath(3), if that fails, the value is unchanged. @@ -890,6 +903,19 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT However a single character variable is often more readable: ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} + ::__[[==vvaarr]] + Save the current variable value in `$_' or the named _v_a_r for later + reference. Example usage: + + M_cmpv.units = 1 1000 1000000 + M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \ + \* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh + + .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} + + Here `$_' is used to save the result of the `:S' modifier which is + later referenced using the index values from `:range'. + ::UU_n_e_w_v_a_l If the variable is undefined _n_e_w_v_a_l is the value. If the variable is defined, the existing value is returned. This is another ODE @@ -1276,6 +1302,14 @@ SSPPEECCIIAALL TTAARRGGEETTSS target that inherits ..DDEEFFAAUULLTT's commands is set to the target's own name. + ..DDEELLEETTEE__OONN__EERRRROORR + If this target is present in the makefile, it globally causes + make to delete targets whose commands fail. (By default, only + targets whose commands are interrupted during execution are + deleted. This is the historical behavior.) This setting can be + used to help prevent half-finished or malformed targets from + being left around and corrupting future rebuilds. + ..EENNDD Any command lines attached to this target are executed after everything else is done. @@ -1489,4 +1523,4 @@ BBUUGGSS There is no way of escaping a space character in a filename. -NetBSD 5.1 June 2, 2016 NetBSD 5.1 +NetBSD 7.1_RC1 February 1, 2017 NetBSD 7.1_RC1 Modified: stable/11/contrib/bmake/compat.c ============================================================================== --- stable/11/contrib/bmake/compat.c Mon Jun 12 23:50:30 2017 (r319883) +++ stable/11/contrib/bmake/compat.c Tue Jun 13 00:22:15 2017 (r319884) @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $ */ +/* $NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $"); +__RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"); #endif #endif /* not lint */ #endif @@ -119,6 +119,25 @@ static GNode *curTarg = NULL; static GNode *ENDNode; static void CompatInterrupt(int); +/* + * CompatDeleteTarget -- delete a failed, interrupted, or otherwise + * duffed target if not inhibited by .PRECIOUS. + */ +static void +CompatDeleteTarget(GNode *gn) +{ + if ((gn != NULL) && !Targ_Precious (gn)) { + char *p1; + char *file = Var_Value(TARGET, gn, &p1); + + if (!noExecute && eunlink(file) != -1) { + Error("*** %s removed", file); + } + + free(p1); + } +} + /*- *----------------------------------------------------------------------- * CompatInterrupt -- @@ -132,6 +151,9 @@ static void CompatInterrupt(int); * The target is removed and the process exits. If .INTERRUPT exists, * its commands are run first WITH INTERRUPTS IGNORED.. * + * XXX: is .PRECIOUS supposed to inhibit .INTERRUPT? I doubt it, but I've + * left the logic alone for now. - dholland 20160826 + * *----------------------------------------------------------------------- */ static void @@ -139,16 +161,9 @@ CompatInterrupt(int signo) { GNode *gn; - if ((curTarg != NULL) && !Targ_Precious (curTarg)) { - char *p1; - char *file = Var_Value(TARGET, curTarg, &p1); + CompatDeleteTarget(curTarg); - if (!noExecute && eunlink(file) != -1) { - Error("*** %s removed", file); - } - - free(p1); - + if ((curTarg != NULL) && !Targ_Precious (curTarg)) { /* * Run .INTERRUPT only if hit with interrupt signal */ @@ -158,7 +173,6 @@ CompatInterrupt(int signo) Compat_Make(gn, gn); } } - } if (signo == SIGQUIT) _exit(signo); @@ -447,7 +461,12 @@ again: * continue. */ printf(" (continuing)\n"); + } else { + printf("\n"); } + if (deleteOnError) { + CompatDeleteTarget(gn); + } } else { /* * Continue executing commands for this target. @@ -607,7 +626,7 @@ Compat_Make(void *gnp, void *pgnp) } else if (keepgoing) { pgn->flags &= ~REMAKE; } else { - PrintOnError(gn, "\n\nStop."); + PrintOnError(gn, "\nStop."); exit(1); } } else if (gn->made == ERROR) { @@ -698,7 +717,7 @@ Compat_Run(Lst targs) if (gn != NULL) { Compat_Make(gn, gn); if (gn->made == ERROR) { - PrintOnError(gn, "\n\nStop."); + PrintOnError(gn, "\nStop."); exit(1); } } @@ -739,7 +758,7 @@ Compat_Run(Lst targs) if (errors == 0) { Compat_Make(ENDNode, ENDNode); if (gn->made == ERROR) { - PrintOnError(gn, "\n\nStop."); + PrintOnError(gn, "\nStop."); exit(1); } } Modified: stable/11/contrib/bmake/cond.c ============================================================================== --- stable/11/contrib/bmake/cond.c Mon Jun 12 23:50:30 2017 (r319883) +++ stable/11/contrib/bmake/cond.c Tue Jun 13 00:22:15 2017 (r319884) @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.74 2016/02/18 18:29:14 christos Exp $ */ +/* $NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: cond.c,v 1.74 2016/02/18 18:29:14 christos Exp $"; +static char rcsid[] = "$NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: cond.c,v 1.74 2016/02/18 18:29:14 christos Exp $"); +__RCSID("$NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $"); #endif #endif /* not lint */ #endif @@ -91,6 +91,7 @@ __RCSID("$NetBSD: cond.c,v 1.74 2016/02/18 18:29:14 ch * */ +#include #include #include /* For strtoul() error checking */ @@ -1174,8 +1175,9 @@ Cond_EvalExpression(const struct If *info, char *line, break; dflt_info = info; } + assert(info != NULL); - if_info = info != NULL ? info : ifs + 4; + if_info = info; condExpr = line; condPushBack = TOK_NONE; Modified: stable/11/contrib/bmake/dir.c ============================================================================== --- stable/11/contrib/bmake/dir.c Mon Jun 12 23:50:30 2017 (r319883) +++ stable/11/contrib/bmake/dir.c Tue Jun 13 00:22:15 2017 (r319884) @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.68 2016/06/07 00:40:00 sjg Exp $ */ +/* $NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: dir.c,v 1.68 2016/06/07 00:40:00 sjg Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: dir.c,v 1.68 2016/06/07 00:40:00 sjg Exp $"); +__RCSID("$NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $"); #endif #endif /* not lint */ #endif @@ -346,11 +346,13 @@ cached_lstat(const char *pathname, void *st) void Dir_Init(const char *cdname) { - dirSearchPath = Lst_Init(FALSE); - openDirectories = Lst_Init(FALSE); - Hash_InitTable(&mtimes, 0); - Hash_InitTable(&lmtimes, 0); - + if (!cdname) { + dirSearchPath = Lst_Init(FALSE); + openDirectories = Lst_Init(FALSE); + Hash_InitTable(&mtimes, 0); + Hash_InitTable(&lmtimes, 0); + return; + } Dir_InitCur(cdname); dotLast = bmake_malloc(sizeof(Path)); @@ -801,11 +803,11 @@ DirExpandInt(const char *word, Lst path, Lst expansion *----------------------------------------------------------------------- */ static int -DirPrintWord(void *word, void *dummy) +DirPrintWord(void *word, void *dummy MAKE_ATTR_UNUSED) { fprintf(debug_file, "%s ", (char *)word); - return(dummy ? 0 : 0); + return 0; } /*- @@ -1313,8 +1315,14 @@ Dir_FindFile(const char *name, Lst path) fprintf(debug_file, " Trying exact path matches...\n"); } - if (!hasLastDot && cur && (file = DirLookupAbs(cur, name, cp)) != NULL) - return *file?file:NULL; + if (!hasLastDot && cur && ((file = DirLookupAbs(cur, name, cp)) + != NULL)) { + if (file[0] == '\0') { + free(file); + return NULL; + } + return file; + } (void)Lst_Open(path); while ((ln = Lst_Next(path)) != NULL) { @@ -1323,13 +1331,23 @@ Dir_FindFile(const char *name, Lst path) continue; if ((file = DirLookupAbs(p, name, cp)) != NULL) { Lst_Close(path); - return *file?file:NULL; + if (file[0] == '\0') { + free(file); + return NULL; + } + return file; } } Lst_Close(path); - if (hasLastDot && cur && (file = DirLookupAbs(cur, name, cp)) != NULL) - return *file?file:NULL; + if (hasLastDot && cur && ((file = DirLookupAbs(cur, name, cp)) + != NULL)) { + if (file[0] == '\0') { + free(file); + return NULL; + } + return file; + } } /* @@ -1849,10 +1867,10 @@ Dir_PrintDirectories(void) } static int -DirPrintDir(void *p, void *dummy) +DirPrintDir(void *p, void *dummy MAKE_ATTR_UNUSED) { fprintf(debug_file, "%s ", ((Path *)p)->name); - return (dummy ? 0 : 0); + return 0; } void Modified: stable/11/contrib/bmake/for.c ============================================================================== --- stable/11/contrib/bmake/for.c Mon Jun 12 23:50:30 2017 (r319883) +++ stable/11/contrib/bmake/for.c Tue Jun 13 00:22:15 2017 (r319884) @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.52 2016/02/18 18:29:14 christos Exp $ */ +/* $NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -30,14 +30,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: for.c,v 1.52 2016/02/18 18:29:14 christos Exp $"; +static char rcsid[] = "$NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)for.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: for.c,v 1.52 2016/02/18 18:29:14 christos Exp $"); +__RCSID("$NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $"); #endif #endif /* not lint */ #endif @@ -427,7 +427,7 @@ For_Iterate(void *v_arg, size_t *ret_len) for (cp = cmd_cp; (cp = strchr(cp, '$')) != NULL;) { char ech; ch = *++cp; - if ((ch == '(' && (ech = ')')) || (ch == '{' && (ech = '}'))) { + if ((ch == '(' && (ech = ')', 1)) || (ch == '{' && (ech = '}', 1))) { cp++; /* Check variable name against the .for loop variables */ STRLIST_FOREACH(var, &arg->vars, i) { Modified: stable/11/contrib/bmake/job.c ============================================================================== --- stable/11/contrib/bmake/job.c Mon Jun 12 23:50:30 2017 (r319883) +++ stable/11/contrib/bmake/job.c Tue Jun 13 00:22:15 2017 (r319884) @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $ */ +/* $NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $"); +__RCSID("$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $"); #endif #endif /* not lint */ #endif @@ -389,7 +389,10 @@ static void JobSigLock(sigset_t *); static void JobSigUnlock(sigset_t *); static void JobSigReset(void); -const char *malloc_options="A"; +#if !defined(MALLOC_OPTIONS) +# define MALLOC_OPTIONS "A" +#endif +const char *malloc_options= MALLOC_OPTIONS; static void job_table_dump(const char *where) @@ -404,6 +407,21 @@ job_table_dump(const char *where) } /* + * Delete the target of a failed, interrupted, or otherwise + * unsuccessful job unless inhibited by .PRECIOUS. + */ +static void +JobDeleteTarget(GNode *gn) +{ + if ((gn->type & (OP_JOIN|OP_PHONY)) == 0 && !Targ_Precious(gn)) { + char *file = (gn->path == NULL ? gn->name : gn->path); + if (!noExecute && eunlink(file) != -1) { + Error("*** %s removed", file); + } + } +} + +/* * JobSigLock/JobSigUnlock * * Signal lock routines to get exclusive access. Currently used to @@ -425,7 +443,7 @@ static void JobSigUnlock(sigset_t *omaskp) static void JobCreatePipe(Job *job, int minfd) { - int i, fd; + int i, fd, flags; if (pipe(job->jobPipe) == -1) Punt("Cannot create pipe: %s", strerror(errno)); @@ -440,8 +458,10 @@ JobCreatePipe(Job *job, int minfd) } /* Set close-on-exec flag for both */ - (void)fcntl(job->jobPipe[0], F_SETFD, FD_CLOEXEC); - (void)fcntl(job->jobPipe[1], F_SETFD, FD_CLOEXEC); + if (fcntl(job->jobPipe[0], F_SETFD, FD_CLOEXEC) == -1) + Punt("Cannot set close-on-exec: %s", strerror(errno)); + if (fcntl(job->jobPipe[1], F_SETFD, FD_CLOEXEC) == -1) + Punt("Cannot set close-on-exec: %s", strerror(errno)); /* * We mark the input side of the pipe non-blocking; we poll(2) the @@ -449,8 +469,12 @@ JobCreatePipe(Job *job, int minfd) * race for the token when a new one becomes available, so the read * from the pipe should not block. */ - fcntl(job->jobPipe[0], F_SETFL, - fcntl(job->jobPipe[0], F_GETFL, 0) | O_NONBLOCK); + flags = fcntl(job->jobPipe[0], F_GETFL, 0); + if (flags == -1) + Punt("Cannot get flags: %s", strerror(errno)); + flags |= O_NONBLOCK; + if (fcntl(job->jobPipe[0], F_SETFL, flags) == -1) + Punt("Cannot set flags: %s", strerror(errno)); } /*- @@ -752,6 +776,7 @@ JobPrintCommand(void *cmdp, void *jobp) * but this one needs to be - use compat mode just for it. */ CompatRunCommand(cmdp, job->node); + free(cmdStart); return 0; } break; @@ -1049,6 +1074,9 @@ JobFinish (Job *job, WAIT_T status) if (job->flags & JOB_IGNERR) { WAIT_STATUS(status) = 0; } else { + if (deleteOnError) { + JobDeleteTarget(job->node); + } PrintOnError(job->node, NULL); } } else if (DEBUG(JOB)) { @@ -1066,6 +1094,9 @@ JobFinish (Job *job, WAIT_T status) } (void)printf("*** [%s] Signal %d\n", job->node->name, WTERMSIG(status)); + if (deleteOnError) { + JobDeleteTarget(job->node); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Jun 13 01:13:11 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 2FD8FD88837; Tue, 13 Jun 2017 01:13:11 +0000 (UTC) (envelope-from gjb@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 F25E92E0D; Tue, 13 Jun 2017 01:13:10 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5D1DAYK095002; Tue, 13 Jun 2017 01:13:10 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5D1DALO095001; Tue, 13 Jun 2017 01:13:10 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201706130113.v5D1DALO095001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 13 Jun 2017 01:13:10 +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: r319889 - stable/11/release/doc/en_US.ISO8859-1/relnotes 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: Tue, 13 Jun 2017 01:13:11 -0000 Author: gjb Date: Tue Jun 13 01:13:09 2017 New Revision: 319889 URL: https://svnweb.freebsd.org/changeset/base/319889 Log: Document r319884, make(1) version 20170510. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Jun 13 01:12:37 2017 (r319888) +++ stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Jun 13 01:13:09 2017 (r319889) @@ -362,6 +362,9 @@ &man.byacc.1; has been updated to version 20170201. + + bmake has + been updated to version 20170510. From owner-svn-src-stable@freebsd.org Tue Jun 13 15:23:50 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 83458BF769B; Tue, 13 Jun 2017 15:23:50 +0000 (UTC) (envelope-from allanjude@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 532837FE3C; Tue, 13 Jun 2017 15:23:50 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5DFNnZ9047054; Tue, 13 Jun 2017 15:23:49 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5DFNnm3047053; Tue, 13 Jun 2017 15:23:49 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201706131523.v5DFNnm3047053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Tue, 13 Jun 2017 15:23:49 +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: r319901 - stable/11/usr.sbin/sesutil 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: Tue, 13 Jun 2017 15:23:50 -0000 Author: allanjude Date: Tue Jun 13 15:23:49 2017 New Revision: 319901 URL: https://svnweb.freebsd.org/changeset/base/319901 Log: MFC r319610: usr.sbin/sesutil: correct 'locate all off' to deactivate empty slot LEDs PR: 217409 Approved by: re (marius) Modified: stable/11/usr.sbin/sesutil/sesutil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/sesutil/sesutil.c ============================================================================== --- stable/11/usr.sbin/sesutil/sesutil.c Tue Jun 13 14:57:48 2017 (r319900) +++ stable/11/usr.sbin/sesutil/sesutil.c Tue Jun 13 15:23:49 2017 (r319901) @@ -252,6 +252,10 @@ sesled(int argc, char **argv, bool setfault) break; } for (j = 0; j < nobj; j++) { + if (all) { + do_led(fd, objp[j].elm_idx, onoff, setfault); + continue; + } memset(&objdn, 0, sizeof(objdn)); objdn.elm_idx = objp[j].elm_idx; objdn.elm_names_size = 128; @@ -265,11 +269,6 @@ sesled(int argc, char **argv, bool setfault) continue; } if (objdn.elm_names_len > 0) { - if (all) { - do_led(fd, objdn.elm_idx, - onoff, setfault); - continue; - } if (disk_match(objdn.elm_devnames, disk, len)) { do_led(fd, objdn.elm_idx, onoff, setfault); From owner-svn-src-stable@freebsd.org Tue Jun 13 18:59:35 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 E4325BFC46B; Tue, 13 Jun 2017 18:59:35 +0000 (UTC) (envelope-from emaste@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 B21393A53; Tue, 13 Jun 2017 18:59:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5DIxY26035254; Tue, 13 Jun 2017 18:59:34 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5DIxY1V035253; Tue, 13 Jun 2017 18:59:34 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201706131859.v5DIxY1V035253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 13 Jun 2017 18:59:34 +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: r319915 - stable/11/sys/arm/arm 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: Tue, 13 Jun 2017 18:59:36 -0000 Author: emaste Date: Tue Jun 13 18:59:34 2017 New Revision: 319915 URL: https://svnweb.freebsd.org/changeset/base/319915 Log: MFC r317428 (cognet): fix arm64 MSI In arm_gicv2m_alloc_msi(), if we found a suitable irq range, leave the loop before we increase irq again, or we'd end up choosing an irq, and then really using the next one, even if it's not available. Also in the inner loop, correct the end check so that we check every irq, even the last one. This makes the msk(4) adapter able to use MSI on Softiron Overdrive 1000. PR: 219956 Approved by: re (gjb) Modified: stable/11/sys/arm/arm/gic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/gic.c ============================================================================== --- stable/11/sys/arm/arm/gic.c Tue Jun 13 18:55:21 2017 (r319914) +++ stable/11/sys/arm/arm/gic.c Tue Jun 13 18:59:34 2017 (r319915) @@ -1640,7 +1640,7 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int mtx_lock(&sc->sc_mutex); found = false; - for (irq = sc->sc_spi_start; irq < sc->sc_spi_end && !found; irq++) { + for (irq = sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { /* Start on an aligned interrupt */ if ((irq & (maxcount - 1)) != 0) continue; @@ -1649,7 +1649,7 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int found = true; /* Check this range is valid */ - for (end_irq = irq; end_irq != irq + count - 1; end_irq++) { + for (end_irq = irq; end_irq != irq + count; end_irq++) { /* No free interrupts */ if (end_irq == sc->sc_spi_end) { found = false; @@ -1666,6 +1666,8 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int break; } } + if (found) + break; } /* Not enough interrupts were found */ From owner-svn-src-stable@freebsd.org Tue Jun 13 22:34:43 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 EDCDFC080BB; Tue, 13 Jun 2017 22:34:43 +0000 (UTC) (envelope-from rgrimes@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 C93666EAFD; Tue, 13 Jun 2017 22:34:43 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5DMYgjG025880; Tue, 13 Jun 2017 22:34:42 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5DMYgOa025879; Tue, 13 Jun 2017 22:34:42 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201706132234.v5DMYgOa025879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Tue, 13 Jun 2017 22:34:42 +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: r319919 - stable/11/usr.sbin/bhyve 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: Tue, 13 Jun 2017 22:34:44 -0000 Author: rgrimes Date: Tue Jun 13 22:34:42 2017 New Revision: 319919 URL: https://svnweb.freebsd.org/changeset/base/319919 Log: MFC r307517, r314342, r316357, r317545, r317777: r307517: Typo fixed: arbitraty -> arbitrary. PR: 213559 r314342: bhyve: document virtio-console in the manpage r316357: Minor style improvements in bhyve.8 Replace "as of now" with "at present". As the change is a really minor one, don't bump .Dd. r317545: Document raw framebuffer device and XHCI device configurations. r317777: Improve documentation of fbuf device. Approved by: grehan (mentor) Approved by: re (gjb) Modified: stable/11/usr.sbin/bhyve/bhyve.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/bhyve.8 ============================================================================== --- stable/11/usr.sbin/bhyve/bhyve.8 Tue Jun 13 21:01:06 2017 (r319918) +++ stable/11/usr.sbin/bhyve/bhyve.8 Tue Jun 13 22:34:42 2017 (r319919) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 9, 2016 +.Dd May 3, 2017 .Dt BHYVE 8 .Os .Sh NAME @@ -49,10 +49,13 @@ virtual machine. Parameters such as the number of virtual CPUs, amount of guest memory, and I/O connectivity can be specified with command-line parameters. .Pp -The guest operating system must be loaded with +If not using a boot ROM, the guest operating system must be loaded with .Xr bhyveload 8 or a similar boot loader before running -.Nm . +.Nm , +otherwise, it is enough to run +.Nm +with a boot ROM of choice. .Pp .Nm runs until the guest operating system reboots or an unhandled hypervisor @@ -171,8 +174,12 @@ Virtio network interface. Virtio block storage interface. .It Li virtio-rnd Virtio RNG interface. +.It Li virtio-console +Virtio console interface, which exposes multiple ports +to the guest in the form of simple char devices for simple IO +between the guest and host userspaces. .It Li ahci -AHCI controller attached to arbitraty devices. +AHCI controller attached to arbitrary devices. .It Li ahci-cd AHCI controller attached to an ATAPI CD/DVD. .It Li ahci-hd @@ -184,6 +191,10 @@ PCI 16550 serial device. .It Li lpc LPC PCI-ISA bridge with COM1 and COM2 16550 serial ports and a boot ROM. The LPC bridge emulation can only be configured on bus 0. +.It Li fbuf +Raw framebuffer device attached to VNC server. +.It Li xhci +eXtensible Host Controller Interface (xHCI) USB controller. .El .It Op Ar conf This optional parameter describes the backend for device emulations. @@ -270,7 +281,103 @@ The host device must have been reserved at boot-time u .Va pptdev loader variable as described in .Xr vmm 4 . +.Pp +Virtio console devices: +.Bl -tag -width 10n +.It Li port1= Ns Pa /path/to/port1.sock Ns ,anotherport= Ns Pa ... +A maximum of 16 ports per device can be created. +Every port is named and corresponds to a Unix domain socket created by +.Nm . +.Nm +accepts at most one connection per port at a time. +.Pp +Limitations: +.Bl -bullet -offset 2n +.It +Due to lack of destructors in +.Nm , +sockets on the filesystem must be cleaned up manually after +.Nm +exits. +.It +There is no way to use the "console port" feature, nor the console port +resize at present. +.It +Emergency write is advertised, but no-op at present. .El +.El +.Pp +Framebuffer devices: +.Bl -tag -width 10n +.It Oo rfb= Ns Oo Ar IP: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= Ns Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc +.Bl -tag -width 8n +.It Ar IP:port +An +.Ar IP +address and a +.Ar port +VNC should listen on. +The default is to listen on localhost IPv4 address and default VNC port 5900. +Listening on an IPv6 address is not supported. +.It Ar width No and Ar height +A display resolution, width and height, respectively. +If not specified, a default resolution of 1024x768 pixels will be used. +Minimal supported resolution is 640x480 pixels, +and maximum is 1920x1200 pixels. +.It Ar vgaconf +Possible values for this option are +.Dq io +(default), +.Dq on +, and +.Dq off . +PCI graphics cards have a dual personality in that they are +standard PCI devices with BAR addressing, but may also +implicitly decode legacy VGA I/O space +.Pq Ad 0x3c0-3df +and memory space +.Pq 64KB at Ad 0xA0000 . +The default +.Dq io +option should be used for guests that attempt to issue BIOS +calls which result in I/O port queries, and fail to boot if I/O decode is disabled. +.Pp +The +.Dq on +option should be used along with the CSM BIOS capability in UEFI +to boot traditional BIOS guests that require the legacy VGA I/O and +memory regions to be available. +.Pp +The +.Dq off +option should be used for the UEFI guests that assume that +VGA adapter is present if they detect the I/O ports. +An example of such a guest is +.Ox +in UEFI mode. +.Pp +Please refer to the +.Nm +.Fx +wiki page +.Pq Lk https://wiki.freebsd.org/bhyve +for configuration notes of particular guests. +.It wait +Instruct +.Nm +to only boot upon the initiation of a VNC connection, simplifying the installation +of operating systems that require immediate keyboard input. +This can be removed for post-installation use. +.El +.El +.Pp +xHCI USB devices: +.Bl -tag -width 10n +.It Li tablet +A USB tablet device which provides precise cursor synchronization +when using VNC. +.El +.El .It Fl S Wire guest memory. .It Fl u @@ -318,11 +425,12 @@ halted triple fault .El .Sh EXAMPLES -The guest operating system must have been loaded with +If not using a boot ROM, the guest operating system must have been loaded with .Xr bhyveload 8 or a similar boot loader before .Xr bhyve 4 can be run. +Otherwise, the boot loader is not needed. .Pp To run a virtual machine with 1GB of memory, two virtual CPUs, a virtio block device backed by the @@ -359,6 +467,21 @@ cd:/images/install.iso \\ -s 3,virtio-net,tap0 \\ -l com1,/dev/nmdm0A \\ -A -H -P -m 8G +.Ed +.Pp +Run a UEFI virtual machine with a display resolution of 800 by 600 pixels +that can be accessed via VNC at: 0.0.0.0:5900. +.Bd -literal -offset indent +bhyve -c 2 -m 4G -w -H \\ + -s 0,hostbridge \\ + -s 3,ahci-cd,/path/to/uefi-OS-install.iso \\ + -s 4,ahci-hd,disk.img \\ + -s 5,virtio-net,tap0 \\ + -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \\ + -s 30,xhci,tablet \\ + -s 31,lpc -l com1,stdio \\ + -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ + uefivm .Ed .Sh SEE ALSO .Xr bhyve 4 , From owner-svn-src-stable@freebsd.org Wed Jun 14 05:12:10 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 D6B6CD86009; Wed, 14 Jun 2017 05:12:10 +0000 (UTC) (envelope-from kib@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 A6B0D7A073; Wed, 14 Jun 2017 05:12:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5E5C9kf089660; Wed, 14 Jun 2017 05:12:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5E5C9jH089659; Wed, 14 Jun 2017 05:12:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201706140512.v5E5C9jH089659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 14 Jun 2017 05:12:09 +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: r319937 - stable/11/sys/x86/acpica 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: Wed, 14 Jun 2017 05:12:11 -0000 Author: kib Date: Wed Jun 14 05:12:09 2017 New Revision: 319937 URL: https://svnweb.freebsd.org/changeset/base/319937 Log: MFC r319825: More accurately handle early EFER restoration on resume. Approved by: re (delphij) Modified: stable/11/sys/x86/acpica/acpi_wakeup.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- stable/11/sys/x86/acpica/acpi_wakeup.c Wed Jun 14 04:26:37 2017 (r319936) +++ stable/11/sys/x86/acpica/acpi_wakeup.c Wed Jun 14 05:12:09 2017 (r319937) @@ -224,7 +224,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0)); #ifdef __amd64__ - WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER)); + WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER) & + ~(EFER_LMA)); #else WAKECODE_FIXUP(wakeup_cr4, register_t, pcb->pcb_cr4); #endif From owner-svn-src-stable@freebsd.org Wed Jun 14 13:23:42 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 365FED8DC3A; Wed, 14 Jun 2017 13:23:42 +0000 (UTC) (envelope-from dexuan@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 EF6F12E1E; Wed, 14 Jun 2017 13:23:41 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5EDNfjO090558; Wed, 14 Jun 2017 13:23:41 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5EDNf8W090557; Wed, 14 Jun 2017 13:23:41 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201706141323.v5EDNf8W090557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Wed, 14 Jun 2017 13:23:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r319941 - stable/10/sys/dev/hyperv/pcib X-SVN-Group: stable-10 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: Wed, 14 Jun 2017 13:23:42 -0000 Author: dexuan Date: Wed Jun 14 13:23:40 2017 New Revision: 319941 URL: https://svnweb.freebsd.org/changeset/base/319941 Log: MFC: 319690 r319690 hyperv/pcib: use the device serial number as PCI domain Currently the PCI domain is initialized with the instance GUID in vmbus_pcib_attach(). It turns out the GUID can change across VM reboot, while some users want a persistent value for PCI domain. The solution is that we can change to use the device serial number, which starts with 1 and is unique within a VM. Obtained from: Haiyang Zhang Sponsored by: Microsoft Modified: stable/10/sys/dev/hyperv/pcib/vmbus_pcib.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/pcib/vmbus_pcib.c ============================================================================== --- stable/10/sys/dev/hyperv/pcib/vmbus_pcib.c Wed Jun 14 08:01:53 2017 (r319940) +++ stable/10/sys/dev/hyperv/pcib/vmbus_pcib.c Wed Jun 14 13:23:40 2017 (r319941) @@ -574,6 +574,8 @@ new_pcichild_device(struct hv_pcibus *hbus, struct pci hpdev->desc = *desc; mtx_lock(&hbus->device_list_lock); + if (TAILQ_EMPTY(&hbus->children)) + hbus->pci_domain = desc->ser & 0xFFFF; TAILQ_INSERT_TAIL(&hbus->children, hpdev, link); mtx_unlock(&hbus->device_list_lock); return (hpdev); From owner-svn-src-stable@freebsd.org Wed Jun 14 13:44:33 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 E3FCBD8E2D6; Wed, 14 Jun 2017 13:44:33 +0000 (UTC) (envelope-from dexuan@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 B37163974; Wed, 14 Jun 2017 13:44:33 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5EDiW0c098773; Wed, 14 Jun 2017 13:44:32 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5EDiWjT098772; Wed, 14 Jun 2017 13:44:32 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201706141344.v5EDiWjT098772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Wed, 14 Jun 2017 13:44:32 +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: r319943 - stable/11/sys/dev/hyperv/pcib 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: Wed, 14 Jun 2017 13:44:34 -0000 Author: dexuan Date: Wed Jun 14 13:44:32 2017 New Revision: 319943 URL: https://svnweb.freebsd.org/changeset/base/319943 Log: MFC: 319690 Approved by: re (marius) r319690 hyperv/pcib: use the device serial number as PCI domain Currently the PCI domain is initialized with the instance GUID in vmbus_pcib_attach(). It turns out the GUID can change across VM reboot, while some users want a persistent value for PCI domain. The solution is that we can change to use the device serial number, which starts with 1 and is unique within a VM. Obtained from: Haiyang Zhang Sponsored by: Microsoft Modified: stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c ============================================================================== --- stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c Wed Jun 14 13:34:09 2017 (r319942) +++ stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c Wed Jun 14 13:44:32 2017 (r319943) @@ -574,6 +574,8 @@ new_pcichild_device(struct hv_pcibus *hbus, struct pci hpdev->desc = *desc; mtx_lock(&hbus->device_list_lock); + if (TAILQ_EMPTY(&hbus->children)) + hbus->pci_domain = desc->ser & 0xFFFF; TAILQ_INSERT_TAIL(&hbus->children, hpdev, link); mtx_unlock(&hbus->device_list_lock); return (hpdev); From owner-svn-src-stable@freebsd.org Thu Jun 15 02:39:34 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 DAD38BFC924; Thu, 15 Jun 2017 02:39:34 +0000 (UTC) (envelope-from jkim@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 AB82F8341A; Thu, 15 Jun 2017 02:39:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5F2dXSX017462; Thu, 15 Jun 2017 02:39:33 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5F2dXSc017461; Thu, 15 Jun 2017 02:39:33 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201706150239.v5F2dXSc017461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 15 Jun 2017 02:39:33 +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: r319963 - stable/11/sys/vm 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: Thu, 15 Jun 2017 02:39:35 -0000 Author: jkim Date: Thu Jun 15 02:39:33 2017 New Revision: 319963 URL: https://svnweb.freebsd.org/changeset/base/319963 Log: Null pointer must be checked before use. This fixes a regression introduced in r318716. Note it is a direct commit to stable/11 because head removed support for idle page zeroing in r305362. PR: 219994 Reviewed by: markj Approved by: re (gjb) Modified: stable/11/sys/vm/vm_page.c Modified: stable/11/sys/vm/vm_page.c ============================================================================== --- stable/11/sys/vm/vm_page.c Thu Jun 15 00:59:02 2017 (r319962) +++ stable/11/sys/vm/vm_page.c Thu Jun 15 02:39:33 2017 (r319963) @@ -1759,18 +1759,18 @@ retry: pagedaemon_wakeup(); return (NULL); } - if (m_ret != NULL) + if (m_ret != NULL) { vm_phys_freecnt_adj(m_ret, -npages); - else { + for (m = m_ret; m < &m_ret[npages]; m++) + if ((m->flags & PG_ZERO) != 0) + vm_page_zero_count--; + } else { #if VM_NRESERVLEVEL > 0 if (vm_reserv_reclaim_contig(npages, low, high, alignment, boundary)) goto retry; #endif } - for (m = m_ret; m < &m_ret[npages]; m++) - if ((m->flags & PG_ZERO) != 0) - vm_page_zero_count--; mtx_unlock(&vm_page_queue_free_mtx); if (m_ret == NULL) return (NULL); From owner-svn-src-stable@freebsd.org Thu Jun 15 03:58:25 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 3505DBFFE89; Thu, 15 Jun 2017 03:58:25 +0000 (UTC) (envelope-from alc@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 0B66C1D03; Thu, 15 Jun 2017 03:58:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5F3wOWW050498; Thu, 15 Jun 2017 03:58:24 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5F3wNrI050494; Thu, 15 Jun 2017 03:58:23 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201706150358.v5F3wNrI050494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 15 Jun 2017 03:58:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r319965 - in stable/10/sys: kern sys vm X-SVN-Group: stable-10 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: Thu, 15 Jun 2017 03:58:25 -0000 Author: alc Date: Thu Jun 15 03:58:23 2017 New Revision: 319965 URL: https://svnweb.freebsd.org/changeset/base/319965 Log: MFC r318995 In r118390, the swap pager's approach to striping swap allocation over multiple devices was changed. However, swapoff_one() was not fully and correctly converted. In particular, with r118390's introduction of a per- device blist, the maximum swap block size, "dmmax", became irrelevant to swapoff_one()'s operation. Moreover, swapoff_one() was performing out-of- range operations on the per-device blist that were silently ignored by blist_fill(). This change corrects both of these problems with swapoff_one(), which will allow us to potentially increase MAX_PAGEOUT_CLUSTER. Previously, swapoff_one() would panic inside of blist_fill() if you increased MAX_PAGEOUT_CLUSTER. MFC r319001 After r118390, the variable "dmmax" was neither the correct strip size nor the correct maximum block size. Moreover, after r318995, it serves no purpose except to provide information to user space through a read- sysctl. This change eliminates the variable "dmmax" but retains the sysctl. It also corrects the value returned by the sysctl. MFC r319604 Halve the memory being internally allocated by the blist allocator. In short, half of the memory that is allocated to implement the radix tree is wasted because we did not change "u_daddr_t" to be a 64-bit unsigned int when we changed "daddr_t" to be a 64-bit (signed) int. (See r96849 and r96851.) MFC r319612 When the function blist_fill() was added to the kernel in r107913, the swap pager used a different scheme for striping the allocation of swap space across multiple devices. And, although blist_fill() was intended to support fill operations with large counts, the old striping scheme never performed a fill larger than the stripe size. Consequently, the misplacement of a sanity check in blst_meta_fill() went undetected. Now, moving forward in time to r118390, a new scheme for striping was introduced that maintained a blist allocator per device, but as noted in r318995, swapoff_one() was not fully and correctly converted to the new scheme. This change completes what was started in r318995 by fixing the underlying bug in blst_meta_fill() that stops swapoff_one() from simply performing a single blist_fill() operation. MFC r319627 Starting in r118390, swaponsomething() began to reserve the blocks at the beginning of a swap area for a disk label. However, neither r118390 nor r118544, which increased the reservation from one to two blocks, correctly accounted for these blocks when updating the variable "swap_pager_avail". This change corrects that error. MFC r319655 Originally, this file could be compiled as a user-space application for testing purposes. However, over the years, various changes to the kernel have broken this feature. This revision applies some fixes to get user- space compilation working again. There are no changes in this revision to code that is used by the kernel. Modified: stable/10/sys/kern/subr_blist.c stable/10/sys/sys/blist.h stable/10/sys/vm/swap_pager.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/subr_blist.c ============================================================================== --- stable/10/sys/kern/subr_blist.c Thu Jun 15 02:45:43 2017 (r319964) +++ stable/10/sys/kern/subr_blist.c Thu Jun 15 03:58:23 2017 (r319965) @@ -99,9 +99,8 @@ __FBSDID("$FreeBSD$"); #define BLIST_DEBUG #endif -#define SWAPBLK_NONE ((daddr_t)-1) - #include +#include #include #include #include @@ -110,8 +109,6 @@ __FBSDID("$FreeBSD$"); #define malloc(a,b,c) calloc(a, 1) #define free(a,b) free(a) -typedef unsigned int u_daddr_t; - #include void panic(const char *ctl, ...); @@ -366,7 +363,7 @@ blst_leaf_alloc( j >>= 1; mask >>= j; } - scan->u.bmu_bitmap &= ~(1 << r); + scan->u.bmu_bitmap &= ~((u_daddr_t)1 << r); return(blk + r); } if (count <= BLIST_BMAP_RADIX) { @@ -658,7 +655,7 @@ static void blst_copy( int i; for (i = 0; i < BLIST_BMAP_RADIX && i < count; ++i) { - if (v & (1 << i)) + if (v & ((u_daddr_t)1 << i)) blist_free(dest, blk + i, 1); } } @@ -769,6 +766,8 @@ blst_meta_fill( int next_skip = ((u_int)skip / BLIST_META_RADIX); int nblks = 0; + if (count > radix) + panic("blist_meta_fill: allocation too large"); if (count == radix || scan->u.bmu_avail == 0) { /* * ALL-ALLOCATED special case @@ -800,9 +799,6 @@ blst_meta_fill( radix /= BLIST_META_RADIX; } - if (count > radix) - panic("blist_meta_fill: allocation too large"); - i = (allocBlk - blk) / radix; blk += i * radix; i = i * next_skip + 1; @@ -922,7 +918,7 @@ blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t if (radix == BLIST_BMAP_RADIX) { printf( - "%*.*s(%08llx,%lld): bitmap %08llx big=%lld\n", + "%*.*s(%08llx,%lld): bitmap %016llx big=%lld\n", tab, tab, "", (long long)blk, (long long)radix, (long long)scan->u.bmu_bitmap, @@ -1016,10 +1012,9 @@ main(int ac, char **av) for (;;) { char buf[1024]; - daddr_t da = 0; - daddr_t count = 0; + long long da = 0; + long long count = 0; - printf("%lld/%lld/%lld> ", (long long)bl->bl_free, (long long)size, (long long)bl->bl_radix); fflush(stdout); @@ -1028,7 +1023,7 @@ main(int ac, char **av) switch(buf[0]) { case 'r': if (sscanf(buf + 1, "%lld", &count) == 1) { - blist_resize(&bl, count, 1); + blist_resize(&bl, count, 1, M_WAITOK); } else { printf("?\n"); } @@ -1044,16 +1039,14 @@ main(int ac, char **av) } break; case 'f': - if (sscanf(buf + 1, "%llx %lld", - (long long *)&da, (long long *)&count) == 2) { + if (sscanf(buf + 1, "%llx %lld", &da, &count) == 2) { blist_free(bl, da, count); } else { printf("?\n"); } break; case 'l': - if (sscanf(buf + 1, "%llx %lld", - (long long *)&da, (long long *)&count) == 2) { + if (sscanf(buf + 1, "%llx %lld", &da, &count) == 2) { printf(" n=%d\n", blist_fill(bl, da, count)); } else { Modified: stable/10/sys/sys/blist.h ============================================================================== --- stable/10/sys/sys/blist.h Thu Jun 15 02:45:43 2017 (r319964) +++ stable/10/sys/sys/blist.h Thu Jun 15 03:58:23 2017 (r319965) @@ -44,7 +44,7 @@ * ops. * * SWAPBLK_NONE is returned on failure. This module is typically - * capable of managing up to (2^31) blocks per blist, though + * capable of managing up to (2^63) blocks per blist, though * the memory utilization would be insane if you actually did * that. Managing something like 512MB worth of 4K blocks * eats around 32 KBytes of memory. @@ -56,7 +56,7 @@ #ifndef _SYS_BLIST_H_ #define _SYS_BLIST_H_ -typedef u_int32_t u_daddr_t; /* unsigned disk address */ +typedef uint64_t u_daddr_t; /* unsigned disk address */ /* * note: currently use SWAPBLK_NONE as an absolute value rather then Modified: stable/10/sys/vm/swap_pager.c ============================================================================== --- stable/10/sys/vm/swap_pager.c Thu Jun 15 02:45:43 2017 (r319964) +++ stable/10/sys/vm/swap_pager.c Thu Jun 15 03:58:23 2017 (r319965) @@ -115,9 +115,8 @@ __FBSDID("$FreeBSD$"); #include /* - * SWB_NPAGES must be a power of 2. It may be set to 1, 2, 4, 8, 16 - * or 32 pages per allocation. - * The 32-page limit is due to the radix code (kern/subr_blist.c). + * MAX_PAGEOUT_CLUSTER must be a power of 2 between 1 and 64. + * The 64-page limit is due to the radix code (kern/subr_blist.c). */ #ifndef MAX_PAGEOUT_CLUSTER #define MAX_PAGEOUT_CLUSTER 16 @@ -381,18 +380,14 @@ struct pagerops swappagerops = { }; /* - * dmmax is in page-sized chunks with the new swap system. It was - * dev-bsized chunks in the old. dmmax is always a power of 2. - * * swap_*() routines are externally accessible. swp_*() routines are * internal. */ -static int dmmax; static int nswap_lowat = 128; /* in pages, swap_pager_almost_full warn */ static int nswap_hiwat = 512; /* in pages, swap_pager_almost_full warn */ -SYSCTL_INT(_vm, OID_AUTO, dmmax, - CTLFLAG_RD, &dmmax, 0, "Maximum size of a swap block"); +SYSCTL_INT(_vm, OID_AUTO, dmmax, CTLFLAG_RD, &nsw_cluster_max, 0, + "Maximum size of a swap block in pages"); static void swp_sizecheck(void); static void swp_pager_async_iodone(struct buf *bp); @@ -499,11 +494,6 @@ swap_pager_init(void) mtx_init(&sw_alloc_mtx, "swap_pager list", NULL, MTX_DEF); mtx_init(&sw_dev_mtx, "swapdev", NULL, MTX_DEF); sx_init(&sw_alloc_sx, "swspsx"); - - /* - * Device Stripe, in PAGE_SIZE'd blocks - */ - dmmax = SWB_NPAGES * 2; } /* @@ -2252,7 +2242,7 @@ swaponsomething(struct vnode *vp, void *id, u_long nbl sp->sw_end = dvbase + nblks; TAILQ_INSERT_TAIL(&swtailq, sp, sw_list); nswapdev++; - swap_pager_avail += nblks; + swap_pager_avail += nblks - 2; swap_total += (vm_ooffset_t)nblks * PAGE_SIZE; swapon_check_swzone(swap_total / PAGE_SIZE); swp_sizecheck(); @@ -2324,7 +2314,7 @@ done: static int swapoff_one(struct swdevt *sp, struct ucred *cred) { - u_long nblks, dvbase; + u_long nblks; #ifdef MAC int error; #endif @@ -2355,10 +2345,7 @@ swapoff_one(struct swdevt *sp, struct ucred *cred) */ mtx_lock(&sw_dev_mtx); sp->sw_flags |= SW_CLOSING; - for (dvbase = 0; dvbase < sp->sw_end; dvbase += dmmax) { - swap_pager_avail -= blist_fill(sp->sw_blist, - dvbase, dmmax); - } + swap_pager_avail -= blist_fill(sp->sw_blist, 0, nblks); swap_total -= (vm_ooffset_t)nblks * PAGE_SIZE; mtx_unlock(&sw_dev_mtx); From owner-svn-src-stable@freebsd.org Thu Jun 15 04:37:24 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 2E614C091BD; Thu, 15 Jun 2017 04:37:24 +0000 (UTC) (envelope-from delphij@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 F253E2EBA; Thu, 15 Jun 2017 04:37:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5F4bN6k066450; Thu, 15 Jun 2017 04:37:23 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5F4bNK6066449; Thu, 15 Jun 2017 04:37:23 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201706150437.v5F4bNK6066449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 15 Jun 2017 04:37:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r319966 - stable/10/usr.sbin/rpc.lockd X-SVN-Group: stable-10 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: Thu, 15 Jun 2017 04:37:24 -0000 Author: delphij Date: Thu Jun 15 04:37:23 2017 New Revision: 319966 URL: https://svnweb.freebsd.org/changeset/base/319966 Log: MFC r319852: Fix buffer lengths. After r319369, the RPC code validates caller supplied buffer length in taddr2uaddr. When no -h is specified, the sizeof(ai_addr) is used, which is always smaller than the required size and therefore uaddr would be NULL, causing the kernel to copyin() from userland NULL and fail with EFAULT. Modified: stable/10/usr.sbin/rpc.lockd/lockd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/rpc.lockd/lockd.c ============================================================================== --- stable/10/usr.sbin/rpc.lockd/lockd.c Thu Jun 15 03:58:23 2017 (r319965) +++ stable/10/usr.sbin/rpc.lockd/lockd.c Thu Jun 15 04:37:23 2017 (r319966) @@ -906,8 +906,7 @@ lookup_addresses(struct netconfig *nconf) sin->sin_port = htons(0); sin->sin_addr.s_addr = htonl(INADDR_ANY); res->ai_addr = (struct sockaddr*) sin; - res->ai_addrlen = (socklen_t) - sizeof(res->ai_addr); + res->ai_addrlen = sizeof(struct sockaddr_in); break; case AF_INET6: sin6 = malloc(sizeof(struct sockaddr_in6)); @@ -917,7 +916,7 @@ lookup_addresses(struct netconfig *nconf) sin6->sin6_port = htons(0); sin6->sin6_addr = in6addr_any; res->ai_addr = (struct sockaddr*) sin6; - res->ai_addrlen = (socklen_t) sizeof(res->ai_addr); + res->ai_addrlen = sizeof(struct sockaddr_in6); break; default: break; @@ -942,7 +941,7 @@ lookup_addresses(struct netconfig *nconf) } } - servaddr.len = servaddr.maxlen = res->ai_addr->sa_len; + servaddr.len = servaddr.maxlen = res->ai_addrlen; servaddr.buf = res->ai_addr; uaddr = taddr2uaddr(nconf, &servaddr); From owner-svn-src-stable@freebsd.org Thu Jun 15 15:08:56 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 24A5FD8C337; Thu, 15 Jun 2017 15:08:56 +0000 (UTC) (envelope-from kib@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 E6EBE78333; Thu, 15 Jun 2017 15:08:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FF8t3P022936; Thu, 15 Jun 2017 15:08:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FF8tpI022935; Thu, 15 Jun 2017 15:08:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201706151508.v5FF8tpI022935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 15 Jun 2017 15:08:55 +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: r319976 - stable/11/tools/test/ptrace 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: Thu, 15 Jun 2017 15:08:56 -0000 Author: kib Date: Thu Jun 15 15:08:54 2017 New Revision: 319976 URL: https://svnweb.freebsd.org/changeset/base/319976 Log: MFC r319869: Decode recently added flags. Approved by: re (marius) Modified: stable/11/tools/test/ptrace/scescx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/test/ptrace/scescx.c ============================================================================== --- stable/11/tools/test/ptrace/scescx.c Thu Jun 15 14:34:33 2017 (r319975) +++ stable/11/tools/test/ptrace/scescx.c Thu Jun 15 15:08:54 2017 (r319976) @@ -97,6 +97,11 @@ decode_pl_flags(struct ptrace_lwpinfo *lwpinfo) { PL_FLAG_EXEC, "EXEC" }, { PL_FLAG_SI, "SI" }, { PL_FLAG_FORKED, "FORKED" }, + { PL_FLAG_CHILD, "CHILD" }, + { PL_FLAG_BORN, "LWPBORN" }, + { PL_FLAG_EXITED, "LWPEXITED" }, + { PL_FLAG_VFORKED, "VFORKED" }, + { PL_FLAG_VFORK_DONE, "VFORKDONE" }, }; char de[32]; unsigned first, flags, i; From owner-svn-src-stable@freebsd.org Thu Jun 15 15:24:16 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 439BCD8C72E; Thu, 15 Jun 2017 15:24:16 +0000 (UTC) (envelope-from delphij@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 1393A78C44; Thu, 15 Jun 2017 15:24:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FFOF7o031265; Thu, 15 Jun 2017 15:24:15 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FFOFpA031264; Thu, 15 Jun 2017 15:24:15 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201706151524.v5FFOFpA031264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 15 Jun 2017 15:24:15 +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: r319977 - stable/11/usr.sbin/rpc.lockd 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: Thu, 15 Jun 2017 15:24:16 -0000 Author: delphij Date: Thu Jun 15 15:24:15 2017 New Revision: 319977 URL: https://svnweb.freebsd.org/changeset/base/319977 Log: MFC r319852: Fix buffer lengths. After r319369, the RPC code validates caller supplied buffer length in taddr2uaddr. When no -h is specified, the sizeof(ai_addr) is used, which is always smaller than the required size and therefore uaddr would be NULL, causing the kernel to copyin() from userland NULL and fail with EFAULT. Approved by: re (kib) Modified: stable/11/usr.sbin/rpc.lockd/lockd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/rpc.lockd/lockd.c ============================================================================== --- stable/11/usr.sbin/rpc.lockd/lockd.c Thu Jun 15 15:08:54 2017 (r319976) +++ stable/11/usr.sbin/rpc.lockd/lockd.c Thu Jun 15 15:24:15 2017 (r319977) @@ -902,8 +902,7 @@ lookup_addresses(struct netconfig *nconf) sin->sin_port = htons(0); sin->sin_addr.s_addr = htonl(INADDR_ANY); res->ai_addr = (struct sockaddr*) sin; - res->ai_addrlen = (socklen_t) - sizeof(res->ai_addr); + res->ai_addrlen = sizeof(struct sockaddr_in); break; case AF_INET6: sin6 = malloc(sizeof(struct sockaddr_in6)); @@ -913,7 +912,7 @@ lookup_addresses(struct netconfig *nconf) sin6->sin6_port = htons(0); sin6->sin6_addr = in6addr_any; res->ai_addr = (struct sockaddr*) sin6; - res->ai_addrlen = (socklen_t) sizeof(res->ai_addr); + res->ai_addrlen = sizeof(struct sockaddr_in6); break; default: break; @@ -938,7 +937,7 @@ lookup_addresses(struct netconfig *nconf) } } - servaddr.len = servaddr.maxlen = res->ai_addr->sa_len; + servaddr.len = servaddr.maxlen = res->ai_addrlen; servaddr.buf = res->ai_addr; uaddr = taddr2uaddr(nconf, &servaddr); From owner-svn-src-stable@freebsd.org Thu Jun 15 15:50:18 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 DF900D8CC5A; Thu, 15 Jun 2017 15:50:18 +0000 (UTC) (envelope-from gjb@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 AC92579879; Thu, 15 Jun 2017 15:50:18 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FFoHMa039700; Thu, 15 Jun 2017 15:50:17 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FFoHqf039699; Thu, 15 Jun 2017 15:50:17 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201706151550.v5FFoHqf039699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 15 Jun 2017 15:50:17 +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: r319978 - stable/11/usr.sbin/freebsd-update 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: Thu, 15 Jun 2017 15:50:19 -0000 Author: gjb Date: Thu Jun 15 15:50:17 2017 New Revision: 319978 URL: https://svnweb.freebsd.org/changeset/base/319978 Log: MFC r319954: Modernize FreeBSD version numbers in freebsd-update(8). While here, expand a contraction to make textproc/igor happy. Approved by: re (kib) Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/freebsd-update/freebsd-update.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/freebsd-update/freebsd-update.8 ============================================================================== --- stable/11/usr.sbin/freebsd-update/freebsd-update.8 Thu Jun 15 15:24:15 2017 (r319977) +++ stable/11/usr.sbin/freebsd-update/freebsd-update.8 Thu Jun 15 15:50:17 2017 (r319978) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2015 +.Dd June 14, 2017 .Dt FREEBSD-UPDATE 8 .Os FreeBSD .Sh NAME @@ -56,13 +56,13 @@ by the .Fx Release Engineering Team, e.g., .Fx -9.3-RELEASE and +10.3-RELEASE and .Fx -10.1-RELEASE, but not +11.0-RELEASE, but not .Fx -9.3-STABLE or +10.3-STABLE or .Fx -11-CURRENT. +12-CURRENT. .Sh OPTIONS The following options are supported: .Bl -tag -width "-r newrelease" @@ -114,7 +114,7 @@ Please do not run from crontab or similar using this flag, see: .Nm Cm cron .It Fl -currently-running Ar release -Don't detect the currently-running release; instead, assume that the +Do not detect the currently-running release; instead, assume that the system is running the specified .Ar release . This is most likely to be useful when upgrading jails. From owner-svn-src-stable@freebsd.org Thu Jun 15 15:50:51 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 618A3D8CD7B; Thu, 15 Jun 2017 15:50:51 +0000 (UTC) (envelope-from gjb@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 3008279A1C; Thu, 15 Jun 2017 15:50:51 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FFoofB039788; Thu, 15 Jun 2017 15:50:50 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FFooM8039787; Thu, 15 Jun 2017 15:50:50 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201706151550.v5FFooM8039787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 15 Jun 2017 15:50:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r319979 - stable/10/usr.sbin/freebsd-update X-SVN-Group: stable-10 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: Thu, 15 Jun 2017 15:50:51 -0000 Author: gjb Date: Thu Jun 15 15:50:49 2017 New Revision: 319979 URL: https://svnweb.freebsd.org/changeset/base/319979 Log: MFC r319954: Modernize FreeBSD version numbers in freebsd-update(8). While here, expand a contraction to make textproc/igor happy. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/freebsd-update/freebsd-update.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/freebsd-update/freebsd-update.8 ============================================================================== --- stable/10/usr.sbin/freebsd-update/freebsd-update.8 Thu Jun 15 15:50:17 2017 (r319978) +++ stable/10/usr.sbin/freebsd-update/freebsd-update.8 Thu Jun 15 15:50:49 2017 (r319979) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2015 +.Dd June 14, 2017 .Dt FREEBSD-UPDATE 8 .Os FreeBSD .Sh NAME @@ -56,13 +56,13 @@ by the .Fx Release Engineering Team, e.g., .Fx -9.3-RELEASE and +10.3-RELEASE and .Fx -10.1-RELEASE, but not +11.0-RELEASE, but not .Fx -9.3-STABLE or +10.3-STABLE or .Fx -11-CURRENT. +12-CURRENT. .Sh OPTIONS The following options are supported: .Bl -tag -width "-r newrelease" @@ -114,7 +114,7 @@ Please do not run from crontab or similar using this flag, see: .Nm Cm cron .It Fl -currently-running Ar release -Don't detect the currently-running release; instead, assume that the +Do not detect the currently-running release; instead, assume that the system is running the specified .Ar release . This is most likely to be useful when upgrading jails. From owner-svn-src-stable@freebsd.org Thu Jun 15 16:12:46 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 A943AD8D4E3; Thu, 15 Jun 2017 16:12:46 +0000 (UTC) (envelope-from jpaetzel@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 693187A7B1; Thu, 15 Jun 2017 16:12:46 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FGCjVP051394; Thu, 15 Jun 2017 16:12:45 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FGCjxV051393; Thu, 15 Jun 2017 16:12:45 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201706151612.v5FGCjxV051393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Thu, 15 Jun 2017 16:12:45 +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: r319980 - stable/11/contrib/smbfs/lib/smb 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: Thu, 15 Jun 2017 16:12:46 -0000 Author: jpaetzel Date: Thu Jun 15 16:12:45 2017 New Revision: 319980 URL: https://svnweb.freebsd.org/changeset/base/319980 Log: MFC 319670 Fix SMBFS when saved passwords are greater than 18 character PR: 132302 Submitted by: dhorn2000@gmail.com guru@unixarea.de Approved by: re (gjb) Modified: stable/11/contrib/smbfs/lib/smb/subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/smbfs/lib/smb/subr.c ============================================================================== --- stable/11/contrib/smbfs/lib/smb/subr.c Thu Jun 15 15:50:49 2017 (r319979) +++ stable/11/contrib/smbfs/lib/smb/subr.c Thu Jun 15 16:12:45 2017 (r319980) @@ -232,6 +232,8 @@ smb_simplecrypt(char *dst, const char *src) islower(ch) ? ('a' + (ch - 'a' + 13) % 26) : ch); ch ^= pos; pos += 13; + if (pos > 256) + pos -= 256; sprintf(dst, "%02x", ch); dst += 2; } @@ -262,6 +264,8 @@ smb_simpledecrypt(char *dst, const char *src) return EINVAL; ch ^= pos; pos += 13; + if (pos > 256) + pos -= 256; if (isascii(ch)) ch = (isupper(ch) ? ('A' + (ch - 'A' + 13) % 26) : islower(ch) ? ('a' + (ch - 'a' + 13) % 26) : ch); From owner-svn-src-stable@freebsd.org Thu Jun 15 17:06:05 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 59952D8E370; Thu, 15 Jun 2017 17:06:05 +0000 (UTC) (envelope-from alc@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 3683A7C176; Thu, 15 Jun 2017 17:06:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FH64Va071804; Thu, 15 Jun 2017 17:06:04 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FH64Gi071801; Thu, 15 Jun 2017 17:06:04 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201706151706.v5FH64Gi071801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 15 Jun 2017 17:06:04 +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: r319981 - in stable/11/sys: kern sys vm 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: Thu, 15 Jun 2017 17:06:05 -0000 Author: alc Date: Thu Jun 15 17:06:04 2017 New Revision: 319981 URL: https://svnweb.freebsd.org/changeset/base/319981 Log: MFC r318995 In r118390, the swap pager's approach to striping swap allocation over multiple devices was changed. However, swapoff_one() was not fully and correctly converted. In particular, with r118390's introduction of a per- device blist, the maximum swap block size, "dmmax", became irrelevant to swapoff_one()'s operation. Moreover, swapoff_one() was performing out-of- range operations on the per-device blist that were silently ignored by blist_fill(). This change corrects both of these problems with swapoff_one(), which will allow us to potentially increase MAX_PAGEOUT_CLUSTER. Previously, swapoff_one() would panic inside of blist_fill() if you increased MAX_PAGEOUT_CLUSTER. MFC r319001 After r118390, the variable "dmmax" was neither the correct strip size nor the correct maximum block size. Moreover, after r318995, it serves no purpose except to provide information to user space through a read- sysctl. This change eliminates the variable "dmmax" but retains the sysctl. It also corrects the value returned by the sysctl. MFC r319604 Halve the memory being internally allocated by the blist allocator. In short, half of the memory that is allocated to implement the radix tree is wasted because we did not change "u_daddr_t" to be a 64-bit unsigned int when we changed "daddr_t" to be a 64-bit (signed) int. (See r96849 and r96851.) MFC r319612 When the function blist_fill() was added to the kernel in r107913, the swap pager used a different scheme for striping the allocation of swap space across multiple devices. And, although blist_fill() was intended to support fill operations with large counts, the old striping scheme never performed a fill larger than the stripe size. Consequently, the misplacement of a sanity check in blst_meta_fill() went undetected. Now, moving forward in time to r118390, a new scheme for striping was introduced that maintained a blist allocator per device, but as noted in r318995, swapoff_one() was not fully and correctly converted to the new scheme. This change completes what was started in r318995 by fixing the underlying bug in blst_meta_fill() that stops swapoff_one() from simply performing a single blist_fill() operation. MFC r319627 Starting in r118390, swaponsomething() began to reserve the blocks at the beginning of a swap area for a disk label. However, neither r118390 nor r118544, which increased the reservation from one to two blocks, correctly accounted for these blocks when updating the variable "swap_pager_avail". This change corrects that error. MFC r319655 Originally, this file could be compiled as a user-space application for testing purposes. However, over the years, various changes to the kernel have broken this feature. This revision applies some fixes to get user- space compilation working again. There are no changes in this revision to code that is used by the kernel. Approved by: re (kib) Modified: stable/11/sys/kern/subr_blist.c stable/11/sys/sys/blist.h stable/11/sys/vm/swap_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_blist.c ============================================================================== --- stable/11/sys/kern/subr_blist.c Thu Jun 15 16:12:45 2017 (r319980) +++ stable/11/sys/kern/subr_blist.c Thu Jun 15 17:06:04 2017 (r319981) @@ -99,9 +99,8 @@ __FBSDID("$FreeBSD$"); #define BLIST_DEBUG #endif -#define SWAPBLK_NONE ((daddr_t)-1) - #include +#include #include #include #include @@ -110,8 +109,6 @@ __FBSDID("$FreeBSD$"); #define malloc(a,b,c) calloc(a, 1) #define free(a,b) free(a) -typedef unsigned int u_daddr_t; - #include void panic(const char *ctl, ...); @@ -366,7 +363,7 @@ blst_leaf_alloc( j >>= 1; mask >>= j; } - scan->u.bmu_bitmap &= ~(1 << r); + scan->u.bmu_bitmap &= ~((u_daddr_t)1 << r); return(blk + r); } if (count <= BLIST_BMAP_RADIX) { @@ -658,7 +655,7 @@ static void blst_copy( int i; for (i = 0; i < BLIST_BMAP_RADIX && i < count; ++i) { - if (v & (1 << i)) + if (v & ((u_daddr_t)1 << i)) blist_free(dest, blk + i, 1); } } @@ -769,6 +766,8 @@ blst_meta_fill( int next_skip = ((u_int)skip / BLIST_META_RADIX); int nblks = 0; + if (count > radix) + panic("blist_meta_fill: allocation too large"); if (count == radix || scan->u.bmu_avail == 0) { /* * ALL-ALLOCATED special case @@ -800,9 +799,6 @@ blst_meta_fill( radix /= BLIST_META_RADIX; } - if (count > radix) - panic("blist_meta_fill: allocation too large"); - i = (allocBlk - blk) / radix; blk += i * radix; i = i * next_skip + 1; @@ -922,7 +918,7 @@ blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t if (radix == BLIST_BMAP_RADIX) { printf( - "%*.*s(%08llx,%lld): bitmap %08llx big=%lld\n", + "%*.*s(%08llx,%lld): bitmap %016llx big=%lld\n", tab, tab, "", (long long)blk, (long long)radix, (long long)scan->u.bmu_bitmap, @@ -1016,10 +1012,9 @@ main(int ac, char **av) for (;;) { char buf[1024]; - daddr_t da = 0; - daddr_t count = 0; + long long da = 0; + long long count = 0; - printf("%lld/%lld/%lld> ", (long long)bl->bl_free, (long long)size, (long long)bl->bl_radix); fflush(stdout); @@ -1028,7 +1023,7 @@ main(int ac, char **av) switch(buf[0]) { case 'r': if (sscanf(buf + 1, "%lld", &count) == 1) { - blist_resize(&bl, count, 1); + blist_resize(&bl, count, 1, M_WAITOK); } else { printf("?\n"); } @@ -1044,16 +1039,14 @@ main(int ac, char **av) } break; case 'f': - if (sscanf(buf + 1, "%llx %lld", - (long long *)&da, (long long *)&count) == 2) { + if (sscanf(buf + 1, "%llx %lld", &da, &count) == 2) { blist_free(bl, da, count); } else { printf("?\n"); } break; case 'l': - if (sscanf(buf + 1, "%llx %lld", - (long long *)&da, (long long *)&count) == 2) { + if (sscanf(buf + 1, "%llx %lld", &da, &count) == 2) { printf(" n=%d\n", blist_fill(bl, da, count)); } else { Modified: stable/11/sys/sys/blist.h ============================================================================== --- stable/11/sys/sys/blist.h Thu Jun 15 16:12:45 2017 (r319980) +++ stable/11/sys/sys/blist.h Thu Jun 15 17:06:04 2017 (r319981) @@ -44,7 +44,7 @@ * ops. * * SWAPBLK_NONE is returned on failure. This module is typically - * capable of managing up to (2^31) blocks per blist, though + * capable of managing up to (2^63) blocks per blist, though * the memory utilization would be insane if you actually did * that. Managing something like 512MB worth of 4K blocks * eats around 32 KBytes of memory. @@ -56,7 +56,7 @@ #ifndef _SYS_BLIST_H_ #define _SYS_BLIST_H_ -typedef u_int32_t u_daddr_t; /* unsigned disk address */ +typedef uint64_t u_daddr_t; /* unsigned disk address */ /* * note: currently use SWAPBLK_NONE as an absolute value rather then Modified: stable/11/sys/vm/swap_pager.c ============================================================================== --- stable/11/sys/vm/swap_pager.c Thu Jun 15 16:12:45 2017 (r319980) +++ stable/11/sys/vm/swap_pager.c Thu Jun 15 17:06:04 2017 (r319981) @@ -115,9 +115,8 @@ __FBSDID("$FreeBSD$"); #include /* - * SWB_NPAGES must be a power of 2. It may be set to 1, 2, 4, 8, 16 - * or 32 pages per allocation. - * The 32-page limit is due to the radix code (kern/subr_blist.c). + * MAX_PAGEOUT_CLUSTER must be a power of 2 between 1 and 64. + * The 64-page limit is due to the radix code (kern/subr_blist.c). */ #ifndef MAX_PAGEOUT_CLUSTER #define MAX_PAGEOUT_CLUSTER 16 @@ -380,18 +379,14 @@ struct pagerops swappagerops = { }; /* - * dmmax is in page-sized chunks with the new swap system. It was - * dev-bsized chunks in the old. dmmax is always a power of 2. - * * swap_*() routines are externally accessible. swp_*() routines are * internal. */ -static int dmmax; static int nswap_lowat = 128; /* in pages, swap_pager_almost_full warn */ static int nswap_hiwat = 512; /* in pages, swap_pager_almost_full warn */ -SYSCTL_INT(_vm, OID_AUTO, dmmax, CTLFLAG_RD, &dmmax, 0, - "Maximum size of a swap block"); +SYSCTL_INT(_vm, OID_AUTO, dmmax, CTLFLAG_RD, &nsw_cluster_max, 0, + "Maximum size of a swap block in pages"); static void swp_sizecheck(void); static void swp_pager_async_iodone(struct buf *bp); @@ -488,11 +483,6 @@ swap_pager_init(void) mtx_init(&sw_dev_mtx, "swapdev", NULL, MTX_DEF); sx_init(&sw_alloc_sx, "swspsx"); sx_init(&swdev_syscall_lock, "swsysc"); - - /* - * Device Stripe, in PAGE_SIZE'd blocks - */ - dmmax = SWB_NPAGES * 2; } /* @@ -2204,7 +2194,7 @@ swaponsomething(struct vnode *vp, void *id, u_long nbl sp->sw_end = dvbase + nblks; TAILQ_INSERT_TAIL(&swtailq, sp, sw_list); nswapdev++; - swap_pager_avail += nblks; + swap_pager_avail += nblks - 2; swap_total += (vm_ooffset_t)nblks * PAGE_SIZE; swapon_check_swzone(swap_total / PAGE_SIZE); swp_sizecheck(); @@ -2271,7 +2261,7 @@ done: static int swapoff_one(struct swdevt *sp, struct ucred *cred) { - u_long nblks, dvbase; + u_long nblks; #ifdef MAC int error; #endif @@ -2302,10 +2292,7 @@ swapoff_one(struct swdevt *sp, struct ucred *cred) */ mtx_lock(&sw_dev_mtx); sp->sw_flags |= SW_CLOSING; - for (dvbase = 0; dvbase < sp->sw_end; dvbase += dmmax) { - swap_pager_avail -= blist_fill(sp->sw_blist, - dvbase, dmmax); - } + swap_pager_avail -= blist_fill(sp->sw_blist, 0, nblks); swap_total -= (vm_ooffset_t)nblks * PAGE_SIZE; mtx_unlock(&sw_dev_mtx); From owner-svn-src-stable@freebsd.org Thu Jun 15 17:43:42 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 30E85D8ECCF; Thu, 15 Jun 2017 17:43:42 +0000 (UTC) (envelope-from allanjude@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 F37C77D334; Thu, 15 Jun 2017 17:43:41 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FHhfQq087866; Thu, 15 Jun 2017 17:43:41 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FHhftC087864; Thu, 15 Jun 2017 17:43:41 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201706151743.v5FHhftC087864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Thu, 15 Jun 2017 17:43:41 +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: r319982 - stable/11/usr.bin/top 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: Thu, 15 Jun 2017 17:43:42 -0000 Author: allanjude Date: Thu Jun 15 17:43:40 2017 New Revision: 319982 URL: https://svnweb.freebsd.org/changeset/base/319982 Log: MFC: r319866, r319867 top: Change the way the ZFS ARC compression ratio is calculated remove overhead statistics, already included in other counters Approved by: re (gjb) Modified: stable/11/usr.bin/top/machine.c stable/11/usr.bin/top/top.local.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/top/machine.c ============================================================================== --- stable/11/usr.bin/top/machine.c Thu Jun 15 17:06:04 2017 (r319981) +++ stable/11/usr.bin/top/machine.c Thu Jun 15 17:43:40 2017 (r319982) @@ -188,9 +188,9 @@ char *arcnames[] = { NULL }; -int carc_stats[5]; +int carc_stats[4]; char *carcnames[] = { - "K Compressed, ", "K Uncompressed, ", ":1 Ratio, ", "K Overhead", + "K Compressed, ", "K Uncompressed, ", ":1 Ratio, ", NULL }; @@ -580,11 +580,9 @@ get_system_info(struct system_info *si) if (carc_enabled) { GETSYSCTL("kstat.zfs.misc.arcstats.compressed_size", arc_stat); carc_stats[0] = arc_stat >> 10; + carc_stats[2] = arc_stat >> 10; /* For ratio */ GETSYSCTL("kstat.zfs.misc.arcstats.uncompressed_size", arc_stat); carc_stats[1] = arc_stat >> 10; - carc_stats[2] = arc_stats[0]; /* ARC Total */ - GETSYSCTL("kstat.zfs.misc.arcstats.overhead_size", arc_stat); - carc_stats[3] = arc_stat >> 10; si->carc = carc_stats; } Modified: stable/11/usr.bin/top/top.local.1 ============================================================================== --- stable/11/usr.bin/top/top.local.1 Thu Jun 15 17:06:04 2017 (r319981) +++ stable/11/usr.bin/top/top.local.1 Thu Jun 15 17:43:40 2017 (r319982) @@ -65,10 +65,7 @@ bytes of memory used by ARC caches bytes of data stored in ARC caches before compression .TP .B Ratio: -ratio of uncompressed data to total ARC size -.TP -.B Overhead: -amount of overhead from ARC compression +compression ratio of data cached in the ARC .SS Swap Stats .TP .B Total: From owner-svn-src-stable@freebsd.org Thu Jun 15 17:44:18 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 0092BD8ED32; Thu, 15 Jun 2017 17:44:18 +0000 (UTC) (envelope-from allanjude@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 BEE2E7D461; Thu, 15 Jun 2017 17:44:17 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FHiGoa087957; Thu, 15 Jun 2017 17:44:16 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FHiGl4087955; Thu, 15 Jun 2017 17:44:16 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201706151744.v5FHiGl4087955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Thu, 15 Jun 2017 17:44:16 +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: r319983 - stable/11/usr.sbin/bsdinstall/scripts 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: Thu, 15 Jun 2017 17:44:18 -0000 Author: allanjude Date: Thu Jun 15 17:44:16 2017 New Revision: 319983 URL: https://svnweb.freebsd.org/changeset/base/319983 Log: MFC: r319863 bsdinstall: Make ZFS min_auto_ashift adjustment persistent MFC: r319864 bsdinstall: support Auto ZFS mode for ARM64 Approved by: re (gjb) Modified: stable/11/usr.sbin/bsdinstall/scripts/auto stable/11/usr.sbin/bsdinstall/scripts/zfsboot Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bsdinstall/scripts/auto ============================================================================== --- stable/11/usr.sbin/bsdinstall/scripts/auto Thu Jun 15 17:43:40 2017 (r319982) +++ stable/11/usr.sbin/bsdinstall/scripts/auto Thu Jun 15 17:44:16 2017 (r319983) @@ -260,7 +260,7 @@ Shell \"Open a shell and partition by hand\"" CURARCH=$( uname -m ) case $CURARCH in - amd64|i386) # Booting ZFS Supported + amd64|arm64|i386) # Booting ZFS Supported PMODES="$PMODES \"Auto (ZFS)\" \"Guided Root-on-ZFS\"" ;; *) # Booting ZFS Unspported Modified: stable/11/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- stable/11/usr.sbin/bsdinstall/scripts/zfsboot Thu Jun 15 17:43:40 2017 (r319982) +++ stable/11/usr.sbin/bsdinstall/scripts/zfsboot Thu Jun 15 17:44:16 2017 (r319983) @@ -1443,6 +1443,12 @@ zfs_create_boot() 'kern.geom.label.gptid.enable=\"0\"' \ $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE + if [ "$ZFSBOOT_FORCE_4K_SECTORS" ]; then + f_eval_catch $funcname echo "$ECHO_APPEND" \ + 'vfs.zfs.min_auto_ashift=12' \ + $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE + fi + if [ "$ZFSBOOT_SWAP_MIRROR" ]; then f_eval_catch $funcname echo "$ECHO_APPEND" \ 'geom_mirror_load=\"YES\"' \ From owner-svn-src-stable@freebsd.org Thu Jun 15 18:49:48 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 1BAC5B940CE; Thu, 15 Jun 2017 18:49:48 +0000 (UTC) (envelope-from alc@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 E06847FCA5; Thu, 15 Jun 2017 18:49:47 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FInlTs012596; Thu, 15 Jun 2017 18:49:47 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FInlmu012595; Thu, 15 Jun 2017 18:49:47 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201706151849.v5FInlmu012595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 15 Jun 2017 18:49:47 +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: r319985 - stable/11/sys/kern 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: Thu, 15 Jun 2017 18:49:48 -0000 Author: alc Date: Thu Jun 15 18:49:46 2017 New Revision: 319985 URL: https://svnweb.freebsd.org/changeset/base/319985 Log: MFC r319540 The data type returned by vmoff() is too narrow in its range. This could break the transmission of files longer than 4 GB on 32-bit architectures. Approved by: re (gjb) Modified: stable/11/sys/kern/kern_sendfile.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_sendfile.c ============================================================================== --- stable/11/sys/kern/kern_sendfile.c Thu Jun 15 17:46:20 2017 (r319984) +++ stable/11/sys/kern/kern_sendfile.c Thu Jun 15 18:49:46 2017 (r319985) @@ -207,12 +207,12 @@ xfsize(int i, int n, off_t off, off_t len) /* * Helper function to get offset within object for i page. */ -static inline vm_offset_t +static inline vm_ooffset_t vmoff(int i, off_t off) { if (i == 0) - return ((vm_offset_t)off); + return ((vm_ooffset_t)off); return (trunc_page(off + i * PAGE_SIZE)); } From owner-svn-src-stable@freebsd.org Thu Jun 15 23:14:06 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 27973BF1328; Thu, 15 Jun 2017 23:14:06 +0000 (UTC) (envelope-from jpaetzel@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 E527A64200; Thu, 15 Jun 2017 23:14:05 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FNE4AU026105; Thu, 15 Jun 2017 23:14:04 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FNE486026104; Thu, 15 Jun 2017 23:14:04 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201706152314.v5FNE486026104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Thu, 15 Jun 2017 23:14:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r319992 - stable/10/contrib/smbfs/lib/smb X-SVN-Group: stable-10 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: Thu, 15 Jun 2017 23:14:06 -0000 Author: jpaetzel Date: Thu Jun 15 23:14:04 2017 New Revision: 319992 URL: https://svnweb.freebsd.org/changeset/base/319992 Log: MFC 319670 Fix SMBFS when saved passwords are greater than 18 characters PR: 132302 Submitted by: dhorn2000@gmail.com guru@unixarea.de Modified: stable/10/contrib/smbfs/lib/smb/subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/smbfs/lib/smb/subr.c ============================================================================== --- stable/10/contrib/smbfs/lib/smb/subr.c Thu Jun 15 21:34:43 2017 (r319991) +++ stable/10/contrib/smbfs/lib/smb/subr.c Thu Jun 15 23:14:04 2017 (r319992) @@ -232,6 +232,8 @@ smb_simplecrypt(char *dst, const char *src) islower(ch) ? ('a' + (ch - 'a' + 13) % 26) : ch); ch ^= pos; pos += 13; + if (pos > 256) + pos -= 256; sprintf(dst, "%02x", ch); dst += 2; } @@ -262,6 +264,8 @@ smb_simpledecrypt(char *dst, const char *src) return EINVAL; ch ^= pos; pos += 13; + if (pos > 256) + pos -= 256; if (isascii(ch)) ch = (isupper(ch) ? ('A' + (ch - 'A' + 13) % 26) : islower(ch) ? ('a' + (ch - 'a' + 13) % 26) : ch); From owner-svn-src-stable@freebsd.org Fri Jun 16 00:00:03 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 0CBB4BF1DA6; Fri, 16 Jun 2017 00:00:03 +0000 (UTC) (envelope-from gjb@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 D0B1365042; Fri, 16 Jun 2017 00:00:02 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5G002rI042628; Fri, 16 Jun 2017 00:00:02 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5G002kA042627; Fri, 16 Jun 2017 00:00:02 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201706160000.v5G002kA042627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 16 Jun 2017 00:00:02 +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: r319993 - stable/11/sys/conf 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: Fri, 16 Jun 2017 00:00:03 -0000 Author: gjb Date: Fri Jun 16 00:00:01 2017 New Revision: 319993 URL: https://svnweb.freebsd.org/changeset/base/319993 Log: Update stable/11 to BETA2 as part of the 11.1-RELEASE cycle. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/conf/newvers.sh Modified: stable/11/sys/conf/newvers.sh ============================================================================== --- stable/11/sys/conf/newvers.sh Thu Jun 15 23:14:04 2017 (r319992) +++ stable/11/sys/conf/newvers.sh Fri Jun 16 00:00:01 2017 (r319993) @@ -44,7 +44,7 @@ TYPE="FreeBSD" REVISION="11.1" -BRANCH="BETA1" +BRANCH="BETA2" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable@freebsd.org Sat Jun 17 17:10:51 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 CA6F0BFDF4E; Sat, 17 Jun 2017 17:10:51 +0000 (UTC) (envelope-from kib@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 9E4D47243E; Sat, 17 Jun 2017 17:10:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5HHAoGS059740; Sat, 17 Jun 2017 17:10:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5HHAopr059738; Sat, 17 Jun 2017 17:10:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201706171710.v5HHAopr059738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 17 Jun 2017 17:10:50 +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: r320057 - stable/11/sys/ufs/ffs 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: Sat, 17 Jun 2017 17:10:51 -0000 Author: kib Date: Sat Jun 17 17:10:50 2017 New Revision: 320057 URL: https://svnweb.freebsd.org/changeset/base/320057 Log: MFC r319539: Mitigate several problems with the softdep_request_cleanup() on busy host. Approved by: re (gjb) Modified: stable/11/sys/ufs/ffs/ffs_softdep.c stable/11/sys/ufs/ffs/softdep.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_softdep.c Sat Jun 17 14:46:14 2017 (r320056) +++ stable/11/sys/ufs/ffs/ffs_softdep.c Sat Jun 17 17:10:50 2017 (r320057) @@ -901,6 +901,7 @@ static int pagedep_find(struct pagedep_hashhead *, ino struct pagedep **); static void pause_timer(void *); static int request_cleanup(struct mount *, int); +static int softdep_request_cleanup_flush(struct mount *, struct ufsmount *); static void schedule_cleanup(struct mount *); static void softdep_ast_cleanup_proc(struct thread *); static int process_worklist_item(struct mount *, int, int); @@ -13266,10 +13267,9 @@ softdep_request_cleanup(fs, vp, cred, resource) { struct ufsmount *ump; struct mount *mp; - struct vnode *lvp, *mvp; long starttime; ufs2_daddr_t needed; - int error; + int error, failed_vnode; /* * If we are being called because of a process doing a @@ -13360,41 +13360,88 @@ retry: * to the worklist that we can then process to reap addition * resources. We walk the vnodes associated with the mount point * until we get the needed worklist requests that we can reap. + * + * If there are several threads all needing to clean the same + * mount point, only one is allowed to walk the mount list. + * When several threads all try to walk the same mount list, + * they end up competing with each other and often end up in + * livelock. This approach ensures that forward progress is + * made at the cost of occational ENOSPC errors being returned + * that might otherwise have been avoided. */ + error = 1; if ((resource == FLUSH_BLOCKS_WAIT && fs->fs_cstotal.cs_nbfree <= needed) || (resource == FLUSH_INODES_WAIT && fs->fs_pendinginodes > 0 && fs->fs_cstotal.cs_nifree <= needed)) { - MNT_VNODE_FOREACH_ALL(lvp, mp, mvp) { - if (TAILQ_FIRST(&lvp->v_bufobj.bo_dirty.bv_hd) == 0) { - VI_UNLOCK(lvp); - continue; + ACQUIRE_LOCK(ump); + if ((ump->um_softdep->sd_flags & FLUSH_RC_ACTIVE) == 0) { + ump->um_softdep->sd_flags |= FLUSH_RC_ACTIVE; + FREE_LOCK(ump); + failed_vnode = softdep_request_cleanup_flush(mp, ump); + ACQUIRE_LOCK(ump); + ump->um_softdep->sd_flags &= ~FLUSH_RC_ACTIVE; + FREE_LOCK(ump); + if (ump->softdep_on_worklist > 0) { + stat_cleanup_retries += 1; + if (!failed_vnode) + goto retry; } - if (vget(lvp, LK_EXCLUSIVE | LK_INTERLOCK | LK_NOWAIT, - curthread)) - continue; - if (lvp->v_vflag & VV_NOSYNC) { /* unlinked */ - vput(lvp); - continue; - } - (void) ffs_syncvnode(lvp, MNT_NOWAIT, 0); - vput(lvp); + } else { + FREE_LOCK(ump); + error = 0; } - lvp = ump->um_devvp; - if (vn_lock(lvp, LK_EXCLUSIVE | LK_NOWAIT) == 0) { - VOP_FSYNC(lvp, MNT_NOWAIT, curthread); - VOP_UNLOCK(lvp, 0); - } - if (ump->softdep_on_worklist > 0) { - stat_cleanup_retries += 1; - goto retry; - } stat_cleanup_failures += 1; } if (time_second - starttime > stat_cleanup_high_delay) stat_cleanup_high_delay = time_second - starttime; UFS_LOCK(ump); - return (1); + return (error); +} + +/* + * Scan the vnodes for the specified mount point flushing out any + * vnodes that can be locked without waiting. Finally, try to flush + * the device associated with the mount point if it can be locked + * without waiting. + * + * We return 0 if we were able to lock every vnode in our scan. + * If we had to skip one or more vnodes, we return 1. + */ +static int +softdep_request_cleanup_flush(mp, ump) + struct mount *mp; + struct ufsmount *ump; +{ + struct thread *td; + struct vnode *lvp, *mvp; + int failed_vnode; + + failed_vnode = 0; + td = curthread; + MNT_VNODE_FOREACH_ALL(lvp, mp, mvp) { + if (TAILQ_FIRST(&lvp->v_bufobj.bo_dirty.bv_hd) == 0) { + VI_UNLOCK(lvp); + continue; + } + if (vget(lvp, LK_EXCLUSIVE | LK_INTERLOCK | LK_NOWAIT, + td) != 0) { + failed_vnode = 1; + continue; + } + if (lvp->v_vflag & VV_NOSYNC) { /* unlinked */ + vput(lvp); + continue; + } + (void) ffs_syncvnode(lvp, MNT_NOWAIT, 0); + vput(lvp); + } + lvp = ump->um_devvp; + if (vn_lock(lvp, LK_EXCLUSIVE | LK_NOWAIT) == 0) { + VOP_FSYNC(lvp, MNT_NOWAIT, td); + VOP_UNLOCK(lvp, 0); + } + return (failed_vnode); } static bool Modified: stable/11/sys/ufs/ffs/softdep.h ============================================================================== --- stable/11/sys/ufs/ffs/softdep.h Sat Jun 17 14:46:14 2017 (r320056) +++ stable/11/sys/ufs/ffs/softdep.h Sat Jun 17 17:10:50 2017 (r320057) @@ -1065,6 +1065,7 @@ struct mount_softdeps { #define FLUSH_EXIT 0x0001 /* time to exit */ #define FLUSH_CLEANUP 0x0002 /* need to clear out softdep structures */ #define FLUSH_STARTING 0x0004 /* flush thread not yet started */ +#define FLUSH_RC_ACTIVE 0x0008 /* a thread is flushing the mount point */ /* * Keep the old names from when these were in the ufsmount structure. From owner-svn-src-stable@freebsd.org Sat Jun 17 19:00:13 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 6931ABFF902; Sat, 17 Jun 2017 19:00:13 +0000 (UTC) (envelope-from emaste@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 423FE74EBB; Sat, 17 Jun 2017 19:00:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5HJ0C8F006204; Sat, 17 Jun 2017 19:00:12 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5HJ0CLR006202; Sat, 17 Jun 2017 19:00:12 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201706171900.v5HJ0CLR006202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 17 Jun 2017 19:00:12 +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: r320060 - stable/11/contrib/llvm/tools/lld/ELF 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: Sat, 17 Jun 2017 19:00:13 -0000 Author: emaste Date: Sat Jun 17 19:00:12 2017 New Revision: 320060 URL: https://svnweb.freebsd.org/changeset/base/320060 Log: lld: Fix weak symbols on arm and aarch64 MFC r319955: lld: sort relocations No functional change; applied to facilitate merge of later LLD commit. MFC r319956: lld: Fix weak symbols on arm and aarch64 Given .weak target .global _start _start: b target The intention is that the branch goes to the instruction after the branch, effectively turning it on a nop. The branch adds the runtime PC, but we were adding it statically too. I noticed the oddity by inspection, but llvm-objdump seems to agree, since it now prints things like: b #-4 <_start+0x4> Obtained from: LLD r298797, r305212 Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Modified: stable/11/contrib/llvm/tools/lld/ELF/InputSection.cpp stable/11/contrib/llvm/tools/lld/ELF/Relocations.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/llvm/tools/lld/ELF/InputSection.cpp ============================================================================== --- stable/11/contrib/llvm/tools/lld/ELF/InputSection.cpp Sat Jun 17 17:42:52 2017 (r320059) +++ stable/11/contrib/llvm/tools/lld/ELF/InputSection.cpp Sat Jun 17 19:00:12 2017 (r320060) @@ -255,7 +255,7 @@ static uint32_t getARMUndefinedRelativeWeakVA(uint32_t uint32_t P) { switch (Type) { case R_ARM_THM_JUMP11: - return P + 2; + return P + 2 + A; case R_ARM_CALL: case R_ARM_JUMP24: case R_ARM_PC24: @@ -263,12 +263,12 @@ static uint32_t getARMUndefinedRelativeWeakVA(uint32_t case R_ARM_PREL31: case R_ARM_THM_JUMP19: case R_ARM_THM_JUMP24: - return P + 4; + return P + 4 + A; case R_ARM_THM_CALL: // We don't want an interworking BLX to ARM - return P + 5; + return P + 5 + A; default: - return A; + return P + A; } } @@ -279,9 +279,9 @@ static uint64_t getAArch64UndefinedRelativeWeakVA(uint case R_AARCH64_CONDBR19: case R_AARCH64_JUMP26: case R_AARCH64_TSTBR14: - return P + 4; + return P + 4 + A; default: - return A; + return P + A; } } @@ -290,82 +290,37 @@ static typename ELFT::uint getRelocTargetVA(uint32_t Type, typename ELFT::uint A, typename ELFT::uint P, const SymbolBody &Body, RelExpr Expr) { switch (Expr) { - case R_HINT: - case R_TLSDESC_CALL: - llvm_unreachable("cannot relocate hint relocs"); - case R_TLSLD: - return In::Got->getTlsIndexOff() + A - In::Got->getSize(); - case R_TLSLD_PC: - return In::Got->getTlsIndexVA() + A - P; - case R_THUNK_ABS: - return Body.getThunkVA() + A; - case R_THUNK_PC: - case R_THUNK_PLT_PC: - return Body.getThunkVA() + A - P; - case R_PPC_TOC: - return getPPC64TocBase() + A; - case R_TLSGD: - return In::Got->getGlobalDynOffset(Body) + A - - In::Got->getSize(); - case R_TLSGD_PC: - return In::Got->getGlobalDynAddr(Body) + A - P; - case R_TLSDESC: - return In::Got->getGlobalDynAddr(Body) + A; - case R_TLSDESC_PAGE: - return getAArch64Page(In::Got->getGlobalDynAddr(Body) + A) - - getAArch64Page(P); - case R_PLT: - return Body.getPltVA() + A; - case R_PLT_PC: - case R_PPC_PLT_OPD: - return Body.getPltVA() + A - P; - case R_SIZE: - return Body.getSize() + A; + case R_ABS: + case R_RELAX_GOT_PC_NOPIC: + return Body.getVA(A); + case R_GOT: + case R_RELAX_TLS_GD_TO_IE_ABS: + return Body.getGotVA() + A; + case R_GOTONLY_PC: + return In::Got->getVA() + A - P; + case R_GOTONLY_PC_FROM_END: + return In::Got->getVA() + A - P + In::Got->getSize(); case R_GOTREL: return Body.getVA(A) - In::Got->getVA(); case R_GOTREL_FROM_END: return Body.getVA(A) - In::Got->getVA() - In::Got->getSize(); - case R_RELAX_TLS_GD_TO_IE_END: case R_GOT_FROM_END: + case R_RELAX_TLS_GD_TO_IE_END: return Body.getGotOffset() + A - In::Got->getSize(); - case R_RELAX_TLS_GD_TO_IE_ABS: - case R_GOT: - return Body.getGotVA() + A; - case R_RELAX_TLS_GD_TO_IE_PAGE_PC: + case R_GOT_OFF: + return Body.getGotOffset() + A; case R_GOT_PAGE_PC: + case R_RELAX_TLS_GD_TO_IE_PAGE_PC: return getAArch64Page(Body.getGotVA() + A) - getAArch64Page(P); - case R_RELAX_TLS_GD_TO_IE: case R_GOT_PC: + case R_RELAX_TLS_GD_TO_IE: return Body.getGotVA() + A - P; - case R_GOTONLY_PC: - return In::Got->getVA() + A - P; - case R_GOTONLY_PC_FROM_END: - return In::Got->getVA() + A - P + In::Got->getSize(); - case R_RELAX_TLS_LD_TO_LE: - case R_RELAX_TLS_IE_TO_LE: - case R_RELAX_TLS_GD_TO_LE: - case R_TLS: - // A weak undefined TLS symbol resolves to the base of the TLS - // block, i.e. gets a value of zero. If we pass --gc-sections to - // lld and .tbss is not referenced, it gets reclaimed and we don't - // create a TLS program header. Therefore, we resolve this - // statically to zero. - if (Body.isTls() && (Body.isLazy() || Body.isUndefined()) && - Body.symbol()->isWeak()) - return 0; - if (Target->TcbSize) - return Body.getVA(A) + - alignTo(Target->TcbSize, Out::TlsPhdr->p_align); - return Body.getVA(A) - Out::TlsPhdr->p_memsz; - case R_RELAX_TLS_GD_TO_LE_NEG: - case R_NEG_TLS: - return Out::TlsPhdr->p_memsz - Body.getVA(A); - case R_ABS: - case R_RELAX_GOT_PC_NOPIC: - return Body.getVA(A); - case R_GOT_OFF: - return Body.getGotOffset() + A; + case R_HINT: + case R_TLSDESC_CALL: + llvm_unreachable("cannot relocate hint relocs"); + case R_MIPS_GOTREL: + return Body.getVA(A) - In::MipsGot->getGp(); case R_MIPS_GOT_LOCAL_PAGE: // If relocation against MIPS local symbol requires GOT entry, this entry // should be initialized by 'page address'. This address is high 16-bits @@ -381,8 +336,6 @@ getRelocTargetVA(uint32_t Type, typename ELFT::uint A, return In::MipsGot->getVA() + In::MipsGot->getBodyEntryOffset(Body, A) - In::MipsGot->getGp(); - case R_MIPS_GOTREL: - return Body.getVA(A) - In::MipsGot->getGp(); case R_MIPS_TLSGD: return In::MipsGot->getVA() + In::MipsGot->getTlsOffset() + In::MipsGot->getGlobalDynOffset(Body) - @@ -390,6 +343,36 @@ getRelocTargetVA(uint32_t Type, typename ELFT::uint A, case R_MIPS_TLSLD: return In::MipsGot->getVA() + In::MipsGot->getTlsOffset() + In::MipsGot->getTlsIndexOff() - In::MipsGot->getGp(); + case R_PAGE_PC: + case R_PLT_PAGE_PC: { + uint64_t Dest; + if (Body.isUndefined() && !Body.isLocal() && Body.symbol()->isWeak()) + Dest = getAArch64Page(A); + else + Dest = getAArch64Page(Body.getVA(A)); + return Dest - getAArch64Page(P); + } + case R_PC: { + uint64_t Dest; + if (Body.isUndefined() && !Body.isLocal() && Body.symbol()->isWeak()) { + // On ARM and AArch64 a branch to an undefined weak resolves to the + // next instruction, otherwise the place. + if (Config->EMachine == EM_ARM) + Dest = getARMUndefinedRelativeWeakVA(Type, A, P); + else if (Config->EMachine == EM_AARCH64) + Dest = getAArch64UndefinedRelativeWeakVA(Type, A, P); + else + Dest = Body.getVA(A); + } else { + Dest = Body.getVA(A); + } + return Dest - P; + } + case R_PLT: + return Body.getPltVA() + A; + case R_PLT_PC: + case R_PPC_PLT_OPD: + return Body.getPltVA() + A - P; case R_PPC_OPD: { uint64_t SymVA = Body.getVA(A); // If we have an undefined weak symbol, we might get here with a symbol @@ -408,22 +391,50 @@ getRelocTargetVA(uint32_t Type, typename ELFT::uint A, } return SymVA - P; } - case R_PC: - if (Body.isUndefined() && !Body.isLocal() && Body.symbol()->isWeak()) { - // On ARM and AArch64 a branch to an undefined weak resolves to the - // next instruction, otherwise the place. - if (Config->EMachine == EM_ARM) - return getARMUndefinedRelativeWeakVA(Type, A, P); - if (Config->EMachine == EM_AARCH64) - return getAArch64UndefinedRelativeWeakVA(Type, A, P); - } + case R_PPC_TOC: + return getPPC64TocBase() + A; case R_RELAX_GOT_PC: return Body.getVA(A) - P; - case R_PLT_PAGE_PC: - case R_PAGE_PC: - if (Body.isUndefined() && !Body.isLocal() && Body.symbol()->isWeak()) - return getAArch64Page(A); - return getAArch64Page(Body.getVA(A)) - getAArch64Page(P); + case R_RELAX_TLS_GD_TO_LE: + case R_RELAX_TLS_IE_TO_LE: + case R_RELAX_TLS_LD_TO_LE: + case R_TLS: + // A weak undefined TLS symbol resolves to the base of the TLS + // block, i.e. gets a value of zero. If we pass --gc-sections to + // lld and .tbss is not referenced, it gets reclaimed and we don't + // create a TLS program header. Therefore, we resolve this + // statically to zero. + if (Body.isTls() && (Body.isLazy() || Body.isUndefined()) && + Body.symbol()->isWeak()) + return 0; + if (Target->TcbSize) + return Body.getVA(A) + + alignTo(Target->TcbSize, Out::TlsPhdr->p_align); + return Body.getVA(A) - Out::TlsPhdr->p_memsz; + case R_RELAX_TLS_GD_TO_LE_NEG: + case R_NEG_TLS: + return Out::TlsPhdr->p_memsz - Body.getVA(A); + case R_SIZE: + return Body.getSize() + A; + case R_THUNK_ABS: + return Body.getThunkVA() + A; + case R_THUNK_PC: + case R_THUNK_PLT_PC: + return Body.getThunkVA() + A - P; + case R_TLSDESC: + return In::Got->getGlobalDynAddr(Body) + A; + case R_TLSDESC_PAGE: + return getAArch64Page(In::Got->getGlobalDynAddr(Body) + A) - + getAArch64Page(P); + case R_TLSGD: + return In::Got->getGlobalDynOffset(Body) + A - + In::Got->getSize(); + case R_TLSGD_PC: + return In::Got->getGlobalDynAddr(Body) + A - P; + case R_TLSLD: + return In::Got->getTlsIndexOff() + A - In::Got->getSize(); + case R_TLSLD_PC: + return In::Got->getTlsIndexVA() + A - P; } llvm_unreachable("Invalid expression"); } Modified: stable/11/contrib/llvm/tools/lld/ELF/Relocations.h ============================================================================== --- stable/11/contrib/llvm/tools/lld/ELF/Relocations.h Sat Jun 17 17:42:52 2017 (r320059) +++ stable/11/contrib/llvm/tools/lld/ELF/Relocations.h Sat Jun 17 19:00:12 2017 (r320060) @@ -34,26 +34,26 @@ enum RelExpr { R_GOT_PAGE_PC, R_GOT_PC, R_HINT, + R_MIPS_GOTREL, R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32, - R_MIPS_GOTREL, R_MIPS_TLSGD, R_MIPS_TLSLD, R_NEG_TLS, R_PAGE_PC, R_PC, R_PLT, - R_PLT_PC, R_PLT_PAGE_PC, + R_PLT_PC, R_PPC_OPD, R_PPC_PLT_OPD, R_PPC_TOC, R_RELAX_GOT_PC, R_RELAX_GOT_PC_NOPIC, R_RELAX_TLS_GD_TO_IE, - R_RELAX_TLS_GD_TO_IE_END, R_RELAX_TLS_GD_TO_IE_ABS, + R_RELAX_TLS_GD_TO_IE_END, R_RELAX_TLS_GD_TO_IE_PAGE_PC, R_RELAX_TLS_GD_TO_LE, R_RELAX_TLS_GD_TO_LE_NEG, @@ -65,8 +65,8 @@ enum RelExpr { R_THUNK_PLT_PC, R_TLS, R_TLSDESC, - R_TLSDESC_PAGE, R_TLSDESC_CALL, + R_TLSDESC_PAGE, R_TLSGD, R_TLSGD_PC, R_TLSLD,