From owner-svn-src-stable@freebsd.org Sun Jul 29 05:12:53 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD3BB104AF4D for ; Sun, 29 Jul 2018 05:12:52 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A7067172C for ; Sun, 29 Jul 2018 05:12:52 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from mail-yb0-f171.google.com (mail-yb0-f171.google.com [209.85.213.171]) (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)) (Authenticated sender: eadler) by smtp.freebsd.org (Postfix) with ESMTPSA id 498231E609 for ; Sun, 29 Jul 2018 05:12:52 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: by mail-yb0-f171.google.com with SMTP id x15-v6so3571974ybm.2 for ; Sat, 28 Jul 2018 22:12:52 -0700 (PDT) X-Gm-Message-State: AOUpUlGiG5MROjA/XXaHNJdaPhbrI74jwpwqfRwvplhjDOpoAySjLXVs rDQmS7CVro5J08jmqFBpxyIazP+uv6FLrfh0s2ZUVQ== X-Google-Smtp-Source: AAOMgpedkrHCYgxiBUB1mPMtGPwfW0mh71GtudECmje0uhQCAiMJRtXL4HVoyJmZNvkXpOzjrqZhNsyYD/6ytH9Wc7w= X-Received: by 2002:a25:22c1:: with SMTP id i184-v6mr6677906ybi.479.1532841171700; Sat, 28 Jul 2018 22:12:51 -0700 (PDT) MIME-Version: 1.0 References: <201807280737.w6S7b12F025452@repo.freebsd.org> <20180728233405.GD40119@kib.kiev.ua> In-Reply-To: <20180728233405.GD40119@kib.kiev.ua> From: Eitan Adler Date: Sat, 28 Jul 2018 22:12:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r336805 - in stable/11: share/man/man4 sys/dev/vt/hw/vga To: Kostik Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 29 Jul 2018 05:12:53 -0000 On Sat, 28 Jul 2018 at 16:34, Konstantin Belousov wrote: > > On Sat, Jul 28, 2018 at 07:37:01AM +0000, Eitan Adler wrote: > > Author: eadler > > Date: Sat Jul 28 07:37:01 2018 > > New Revision: 336805 > > URL: https://svnweb.freebsd.org/changeset/base/336805 > > > > Log: > > MFC r335629: > > > > vt: add option to ignore NO_VGA flag in ACPI > > > > To workaround buggy firmware that sets this flag when there's actually > > a VGA present. > > > > Ref D16003 > > PR: 229235 > > > > Modified: > > stable/11/share/man/man4/vt.4 > > stable/11/sys/dev/vt/hw/vga/vt_vga.c > > Directory Properties: > > stable/11/ (props changed) > > > > Modified: stable/11/share/man/man4/vt.4 > > ============================================================================== > > --- stable/11/share/man/man4/vt.4 Sat Jul 28 06:46:10 2018 (r336804) > > +++ stable/11/share/man/man4/vt.4 Sat Jul 28 07:37:01 2018 (r336805) > > @@ -44,6 +44,7 @@ > > In > > .Xr loader.conf 5 : > > .Cd hw.vga.textmode=1 > > +.Cd hw.vga.acpi_ignore_no_vga=1 > > .Cd kern.vty=vt > > .Cd kern.vt.color..rgb="" > > .Cd kern.vt.fb.default_mode="x" > > @@ -196,6 +197,10 @@ prompt or in > > Set to 1 to use virtual terminals in text mode instead of graphics mode. > > Features that require graphics mode, like loadable fonts, will be > > disabled. > > +.It Va hw.vga.acpi_ignore_no_vga > > +Set to 1 to force the usage of the VGA driver regardless of whether > > +ACPI IAPC_BOOT_ARCH signals no VGA support. > > +Can be used to workaround firmware bugs in the ACPI tables. > > .It Va kern.vty > > Set this value to > > .Ql vt > > > > Modified: stable/11/sys/dev/vt/hw/vga/vt_vga.c > > ============================================================================== > > --- stable/11/sys/dev/vt/hw/vga/vt_vga.c Sat Jul 28 06:46:10 2018 (r336804) > > +++ stable/11/sys/dev/vt/hw/vga/vt_vga.c Sat Jul 28 07:37:01 2018 (r336805) > > @@ -1211,6 +1211,12 @@ vga_acpi_disabled(void) > > ACPI_TABLE_FADT *fadt; > > vm_paddr_t physaddr; > > uint16_t flags; > > + int ignore; > > + > > + TUNABLE_INT_FETCH("hw.vga.acpi_ignore_no_vga", &ignore); > > + > > + if (ignore) > > + return (false); > If the tunable is not set, this code evaluates the stack garbage. > Why did you merged this without asking the author and not looking > at the followups ? Please assume some level of good faith. I MFCed this because I was asked to here https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229235 over a month ago. During that time no one mentioned or linked any followups. I did look in my email for mentions of r335629 as well - of which there are none. Now that you mention it, I looked at the svn log and found r335631 which I will MFC as well. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-stable@freebsd.org Sun Jul 29 05:14:27 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7852D104B009; Sun, 29 Jul 2018 05:14:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E01B718A9; Sun, 29 Jul 2018 05:14:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BBD9115DC; Sun, 29 Jul 2018 05:14:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6T5EQtW004083; Sun, 29 Jul 2018 05:14:26 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6T5EQPq004082; Sun, 29 Jul 2018 05:14:26 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201807290514.w6T5EQPq004082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 29 Jul 2018 05:14:26 +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: r336858 - stable/11/sys/dev/vt/hw/vga X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/vt/hw/vga X-SVN-Commit-Revision: 336858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 29 Jul 2018 05:14:27 -0000 Author: eadler Date: Sun Jul 29 05:14:26 2018 New Revision: 336858 URL: https://svnweb.freebsd.org/changeset/base/336858 Log: MFC r335631: Always initialize the ignore local variable. PR: 229235 Modified: stable/11/sys/dev/vt/hw/vga/vt_vga.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/vt/hw/vga/vt_vga.c ============================================================================== --- stable/11/sys/dev/vt/hw/vga/vt_vga.c Sun Jul 29 03:20:05 2018 (r336857) +++ stable/11/sys/dev/vt/hw/vga/vt_vga.c Sun Jul 29 05:14:26 2018 (r336858) @@ -1213,6 +1213,7 @@ vga_acpi_disabled(void) uint16_t flags; int ignore; + ignore = 0; TUNABLE_INT_FETCH("hw.vga.acpi_ignore_no_vga", &ignore); if (ignore) From owner-svn-src-stable@freebsd.org Sun Jul 29 15:34:54 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F483105998C; Sun, 29 Jul 2018 15:34:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 29161844D4; Sun, 29 Jul 2018 15:34:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w6TFYhYX072968 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 29 Jul 2018 18:34:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w6TFYhYX072968 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w6TFYhjK072967; Sun, 29 Jul 2018 18:34:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 29 Jul 2018 18:34:43 +0300 From: Konstantin Belousov To: Eitan Adler Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r336805 - in stable/11: share/man/man4 sys/dev/vt/hw/vga Message-ID: <20180729153443.GF40119@kib.kiev.ua> References: <201807280737.w6S7b12F025452@repo.freebsd.org> <20180728233405.GD40119@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 29 Jul 2018 15:34:54 -0000 On Sat, Jul 28, 2018 at 10:12:25PM -0700, Eitan Adler wrote: > On Sat, 28 Jul 2018 at 16:34, Konstantin Belousov wrote: > > > > On Sat, Jul 28, 2018 at 07:37:01AM +0000, Eitan Adler wrote: > > > Author: eadler > > > Date: Sat Jul 28 07:37:01 2018 > > > New Revision: 336805 > > > URL: https://svnweb.freebsd.org/changeset/base/336805 > > > > > > Log: > > > MFC r335629: > > > > > > vt: add option to ignore NO_VGA flag in ACPI > > > > > > To workaround buggy firmware that sets this flag when there's actually > > > a VGA present. > > > > > > Ref D16003 > > > PR: 229235 > > > > > > Modified: > > > stable/11/share/man/man4/vt.4 > > > stable/11/sys/dev/vt/hw/vga/vt_vga.c > > > Directory Properties: > > > stable/11/ (props changed) > > > > > > Modified: stable/11/share/man/man4/vt.4 > > > ============================================================================== > > > --- stable/11/share/man/man4/vt.4 Sat Jul 28 06:46:10 2018 (r336804) > > > +++ stable/11/share/man/man4/vt.4 Sat Jul 28 07:37:01 2018 (r336805) > > > @@ -44,6 +44,7 @@ > > > In > > > .Xr loader.conf 5 : > > > .Cd hw.vga.textmode=1 > > > +.Cd hw.vga.acpi_ignore_no_vga=1 > > > .Cd kern.vty=vt > > > .Cd kern.vt.color..rgb="" > > > .Cd kern.vt.fb.default_mode="x" > > > @@ -196,6 +197,10 @@ prompt or in > > > Set to 1 to use virtual terminals in text mode instead of graphics mode. > > > Features that require graphics mode, like loadable fonts, will be > > > disabled. > > > +.It Va hw.vga.acpi_ignore_no_vga > > > +Set to 1 to force the usage of the VGA driver regardless of whether > > > +ACPI IAPC_BOOT_ARCH signals no VGA support. > > > +Can be used to workaround firmware bugs in the ACPI tables. > > > .It Va kern.vty > > > Set this value to > > > .Ql vt > > > > > > Modified: stable/11/sys/dev/vt/hw/vga/vt_vga.c > > > ============================================================================== > > > --- stable/11/sys/dev/vt/hw/vga/vt_vga.c Sat Jul 28 06:46:10 2018 (r336804) > > > +++ stable/11/sys/dev/vt/hw/vga/vt_vga.c Sat Jul 28 07:37:01 2018 (r336805) > > > @@ -1211,6 +1211,12 @@ vga_acpi_disabled(void) > > > ACPI_TABLE_FADT *fadt; > > > vm_paddr_t physaddr; > > > uint16_t flags; > > > + int ignore; > > > + > > > + TUNABLE_INT_FETCH("hw.vga.acpi_ignore_no_vga", &ignore); > > > + > > > + if (ignore) > > > + return (false); > > > If the tunable is not set, this code evaluates the stack garbage. > > Why did you merged this without asking the author and not looking > > at the followups ? > > Please assume some level of good faith. > > I MFCed this because I was asked to here > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229235 over a month > ago. During that time no one mentioned or linked any followups. I did > look in my email for mentions of r335629 as well - of which there are > none. > > Now that you mention it, I looked at the svn log and found r335631 > which I will MFC as well. What if I did not mentioned it ? Good faith has nothing to do with not asking the author and not looking at the followups. From owner-svn-src-stable@freebsd.org Sun Jul 29 19:11:24 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B166105E916; Sun, 29 Jul 2018 19:11:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF02B8D7A1; Sun, 29 Jul 2018 19:11:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA95D19C5B; Sun, 29 Jul 2018 19:11:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6TJBL12038368; Sun, 29 Jul 2018 19:11:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6TJBLr5038367; Sun, 29 Jul 2018 19:11:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807291911.w6TJBLr5038367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 29 Jul 2018 19:11:21 +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: r336872 - stable/11/lib/libproc/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/lib/libproc/tests X-SVN-Commit-Revision: 336872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 29 Jul 2018 19:11:24 -0000 Author: markj Date: Sun Jul 29 19:11:21 2018 New Revision: 336872 URL: https://svnweb.freebsd.org/changeset/base/336872 Log: MFC r336591: Disable optimization of the libproc test program. Modified: stable/11/lib/libproc/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libproc/tests/Makefile ============================================================================== --- stable/11/lib/libproc/tests/Makefile Sun Jul 29 18:22:26 2018 (r336871) +++ stable/11/lib/libproc/tests/Makefile Sun Jul 29 19:11:21 2018 (r336872) @@ -12,5 +12,6 @@ LIBADD= elf proc rtld_db util # Ensure that symbols aren't stripped from the test program, as they're needed # for testing symbol lookup. STRIP= +CFLAGS.target_prog.c+= -O0 .include From owner-svn-src-stable@freebsd.org Sun Jul 29 19:12:08 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1846A105EAE2; Sun, 29 Jul 2018 19:12:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BF1888E07F; Sun, 29 Jul 2018 19:12:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB06D19D97; Sun, 29 Jul 2018 19:12:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6TJC67H042635; Sun, 29 Jul 2018 19:12:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6TJC65n042634; Sun, 29 Jul 2018 19:12:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807291912.w6TJC65n042634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 29 Jul 2018 19:12:06 +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: r336873 - stable/11/tests/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/tests/sys/kern X-SVN-Commit-Revision: 336873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 29 Jul 2018 19:12:08 -0000 Author: markj Date: Sun Jul 29 19:12:06 2018 New Revision: 336873 URL: https://svnweb.freebsd.org/changeset/base/336873 Log: MFC r336614: Add a regression test for PR 131876. PR: 131876 Modified: stable/11/tests/sys/kern/unix_passfd_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/kern/unix_passfd_test.c ============================================================================== --- stable/11/tests/sys/kern/unix_passfd_test.c Sun Jul 29 19:11:21 2018 (r336872) +++ stable/11/tests/sys/kern/unix_passfd_test.c Sun Jul 29 19:12:06 2018 (r336873) @@ -23,10 +23,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include @@ -100,6 +101,23 @@ dofstat(int fd, struct stat *sb) "fstat failed: %s", strerror(errno)); } +static int +getnfds(void) +{ + size_t len; + int mib[4], n, rc; + + len = sizeof(n); + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_NFDS; + mib[3] = 0; + + rc = sysctl(mib, 4, &n, &len, NULL, 0); + ATF_REQUIRE_MSG(rc != -1, "sysctl(KERN_PROC_NFDS) failed"); + return (n); +} + static void samefile(struct stat *sb1, struct stat *sb2) { @@ -129,7 +147,7 @@ sendfd_payload(int sockfd, int send_fd, void *payload, msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; - cmsghdr = (struct cmsghdr *)(void*)message; + cmsghdr = (struct cmsghdr *)(void *)message; cmsghdr->cmsg_len = CMSG_LEN(sizeof(int)); cmsghdr->cmsg_level = SOL_SOCKET; cmsghdr->cmsg_type = SCM_RIGHTS; @@ -380,6 +398,55 @@ ATF_TC_BODY(rights_creds_payload, tc) closesocketpair(fd); } +/* + * Test for PR 131876. Receiver uses a control message buffer that is too + * small for the incoming SCM_RIGHTS message, so the message is truncated. + * The kernel must not leak the copied right into the receiver's namespace. + */ +ATF_TC_WITHOUT_HEAD(truncated_rights); +ATF_TC_BODY(truncated_rights, tc) +{ + struct iovec iovec; + struct msghdr msghdr; + char buf[16], message[CMSG_SPACE(0)]; + ssize_t len; + int fd[2], nfds, putfd; + + atf_tc_expect_fail("PR 131876: " + "FD leak when 'control' message is truncated"); + + memset(buf, 42, sizeof(buf)); + domainsocketpair(fd); + devnull(&putfd); + nfds = getnfds(); + + sendfd_payload(fd[0], putfd, buf, sizeof(buf)); + + bzero(&msghdr, sizeof(msghdr)); + bzero(message, sizeof(message)); + + iovec.iov_base = buf; + iovec.iov_len = sizeof(buf); + msghdr.msg_control = message; + msghdr.msg_controllen = sizeof(message); + msghdr.msg_iov = &iovec; + msghdr.msg_iovlen = 1; + + len = recvmsg(fd[1], &msghdr, 0); + ATF_REQUIRE_MSG(len != -1, "recvmsg failed: %s", strerror(errno)); + ATF_REQUIRE_MSG((size_t)len == sizeof(buf), + "recvmsg: %zd bytes received; expected %zd", len, sizeof(buf)); + for (size_t i = 0; i < sizeof(buf); i++) + ATF_REQUIRE_MSG(buf[i] == 42, "unexpected buffer contents"); + + ATF_REQUIRE_MSG((msghdr.msg_flags & MSG_CTRUNC) != 0, + "MSG_CTRUNC not set after truncation"); + ATF_REQUIRE(getnfds() == nfds); + + close(putfd); + closesocketpair(fd); +} + ATF_TP_ADD_TCS(tp) { @@ -391,6 +458,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, bundle_cancel); ATF_TP_ADD_TC(tp, devfs_orphan); ATF_TP_ADD_TC(tp, rights_creds_payload); + ATF_TP_ADD_TC(tp, truncated_rights); return (atf_no_error()); } From owner-svn-src-stable@freebsd.org Mon Jul 30 00:08:37 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73D2510679BC; Mon, 30 Jul 2018 00:08:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A8BE802D9; Mon, 30 Jul 2018 00:08:37 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1ADC1CCA2; Mon, 30 Jul 2018 00:08:36 +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 w6U08auX037683; Mon, 30 Jul 2018 00:08:36 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6U08aK4037682; Mon, 30 Jul 2018 00:08:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201807300008.w6U08aK4037682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 30 Jul 2018 00:08:36 +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: r336880 - stable/11/contrib/llvm/tools/lld/ELF X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 336880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 00:08:37 -0000 Author: emaste Date: Mon Jul 30 00:08:36 2018 New Revision: 336880 URL: https://svnweb.freebsd.org/changeset/base/336880 Log: MFC r336664: lld: fix addends with partial linking [ELF] Update addends in non-allocatable sections for REL targets when creating a relocatable output. LLVM PR: 37735 LLVM Differential Revision: https://reviews.llvm.org/D48929 PR: 225128, 228753 Obtained from: LLVM r336799 by Igor Kudrin Modified: stable/11/contrib/llvm/tools/lld/ELF/InputSection.cpp 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 Mon Jul 30 00:04:42 2018 (r336879) +++ stable/11/contrib/llvm/tools/lld/ELF/InputSection.cpp Mon Jul 30 00:08:36 2018 (r336880) @@ -686,6 +686,23 @@ void InputSection::relocateNonAlloc(uint8_t *Buf, Arra } } +// This is used when '-r' is given. +// For REL targets, InputSection::copyRelocations() may store artificial +// relocations aimed to update addends. They are handled in relocateAlloc() +// for allocatable sections, and this function does the same for +// non-allocatable sections, such as sections with debug information. +static void relocateNonAllocForRelocatable(InputSection *Sec, uint8_t *Buf) { + const unsigned Bits = Config->Is64 ? 64 : 32; + + for (const Relocation &Rel : Sec->Relocations) { + // InputSection::copyRelocations() adds only R_ABS relocations. + assert(Rel.Expr == R_ABS); + uint8_t *BufLoc = Buf + Rel.Offset + Sec->OutSecOff; + uint64_t TargetVA = SignExtend64(Rel.Sym->getVA(Rel.Addend), Bits); + Target->relocateOne(BufLoc, Rel.Type, TargetVA); + } +} + template void InputSectionBase::relocate(uint8_t *Buf, uint8_t *BufEnd) { if (Flags & SHF_ALLOC) { @@ -694,7 +711,9 @@ void InputSectionBase::relocate(uint8_t *Buf, uint8_t } auto *Sec = cast(this); - if (Sec->AreRelocsRela) + if (Config->Relocatable) + relocateNonAllocForRelocatable(Sec, Buf); + else if (Sec->AreRelocsRela) Sec->relocateNonAlloc(Buf, Sec->template relas()); else Sec->relocateNonAlloc(Buf, Sec->template rels()); From owner-svn-src-stable@freebsd.org Mon Jul 30 09:15:10 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36C6D104FC78; Mon, 30 Jul 2018 09:15:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF6D58EEFE; Mon, 30 Jul 2018 09:15:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0A542254D; Mon, 30 Jul 2018 09:15:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6U9F9LF018252; Mon, 30 Jul 2018 09:15:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6U9F9x5018251; Mon, 30 Jul 2018 09:15:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201807300915.w6U9F9x5018251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 30 Jul 2018 09:15: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: r336883 - stable/11/lib/libusb X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/lib/libusb X-SVN-Commit-Revision: 336883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 09:15:10 -0000 Author: hselasky Date: Mon Jul 30 09:15:09 2018 New Revision: 336883 URL: https://svnweb.freebsd.org/changeset/base/336883 Log: MFC r335669: Improve the userspace USB string reading function in LibUSB. Some USB devices does not allow a partial descriptor readout. Found by: bz @ Sponsored by: Mellanox Technologies Modified: stable/11/lib/libusb/libusb20.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libusb/libusb20.c ============================================================================== --- stable/11/lib/libusb/libusb20.c Mon Jul 30 07:01:00 2018 (r336882) +++ stable/11/lib/libusb/libusb20.c Mon Jul 30 09:15:09 2018 (r336883) @@ -812,6 +812,7 @@ libusb20_dev_req_string_sync(struct libusb20_device *p { struct LIBUSB20_CONTROL_SETUP_DECODED req; int error; + int flags; /* make sure memory is initialised */ memset(ptr, 0, len); @@ -838,22 +839,24 @@ libusb20_dev_req_string_sync(struct libusb20_device *p error = libusb20_dev_request_sync(pdev, &req, ptr, NULL, 1000, LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK); if (error) { - return (error); + /* try to request full string */ + req.wLength = 255; + flags = 0; + } else { + /* extract length and request full string */ + req.wLength = *(uint8_t *)ptr; + flags = LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK; } - req.wLength = *(uint8_t *)ptr; /* bytes */ if (req.wLength > len) { /* partial string read */ req.wLength = len; } - error = libusb20_dev_request_sync(pdev, &req, - ptr, NULL, 1000, LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK); - - if (error) { + error = libusb20_dev_request_sync(pdev, &req, ptr, NULL, 1000, flags); + if (error) return (error); - } - if (((uint8_t *)ptr)[1] != LIBUSB20_DT_STRING) { + + if (((uint8_t *)ptr)[1] != LIBUSB20_DT_STRING) return (LIBUSB20_ERROR_OTHER); - } return (0); /* success */ } From owner-svn-src-stable@freebsd.org Mon Jul 30 09:16:48 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8362A104FD97; Mon, 30 Jul 2018 09:16:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 384FD8F164; Mon, 30 Jul 2018 09:16:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 196BC2254F; Mon, 30 Jul 2018 09:16:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6U9GlTU018493; Mon, 30 Jul 2018 09:16:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6U9Gldr018492; Mon, 30 Jul 2018 09:16:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201807300916.w6U9Gldr018492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 30 Jul 2018 09:16:47 +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: r336884 - stable/10/lib/libusb X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/lib/libusb X-SVN-Commit-Revision: 336884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 09:16:48 -0000 Author: hselasky Date: Mon Jul 30 09:16:47 2018 New Revision: 336884 URL: https://svnweb.freebsd.org/changeset/base/336884 Log: MFC r335669: Improve the userspace USB string reading function in LibUSB. Some USB devices does not allow a partial descriptor readout. Found by: bz @ Sponsored by: Mellanox Technologies Modified: stable/10/lib/libusb/libusb20.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libusb/libusb20.c ============================================================================== --- stable/10/lib/libusb/libusb20.c Mon Jul 30 09:15:09 2018 (r336883) +++ stable/10/lib/libusb/libusb20.c Mon Jul 30 09:16:47 2018 (r336884) @@ -794,6 +794,7 @@ libusb20_dev_req_string_sync(struct libusb20_device *p { struct LIBUSB20_CONTROL_SETUP_DECODED req; int error; + int flags; /* make sure memory is initialised */ memset(ptr, 0, len); @@ -820,22 +821,24 @@ libusb20_dev_req_string_sync(struct libusb20_device *p error = libusb20_dev_request_sync(pdev, &req, ptr, NULL, 1000, LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK); if (error) { - return (error); + /* try to request full string */ + req.wLength = 255; + flags = 0; + } else { + /* extract length and request full string */ + req.wLength = *(uint8_t *)ptr; + flags = LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK; } - req.wLength = *(uint8_t *)ptr; /* bytes */ if (req.wLength > len) { /* partial string read */ req.wLength = len; } - error = libusb20_dev_request_sync(pdev, &req, - ptr, NULL, 1000, LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK); - - if (error) { + error = libusb20_dev_request_sync(pdev, &req, ptr, NULL, 1000, flags); + if (error) return (error); - } - if (((uint8_t *)ptr)[1] != LIBUSB20_DT_STRING) { + + if (((uint8_t *)ptr)[1] != LIBUSB20_DT_STRING) return (LIBUSB20_ERROR_OTHER); - } return (0); /* success */ } From owner-svn-src-stable@freebsd.org Mon Jul 30 09:18:46 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0BD9104FF0A; Mon, 30 Jul 2018 09:18:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 563E98F395; Mon, 30 Jul 2018 09:18:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3402122550; Mon, 30 Jul 2018 09:18:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6U9Ik06018628; Mon, 30 Jul 2018 09:18:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6U9Ike0018627; Mon, 30 Jul 2018 09:18:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201807300918.w6U9Ike0018627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 30 Jul 2018 09:18:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r336885 - stable/9/lib/libusb X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/lib/libusb X-SVN-Commit-Revision: 336885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 09:18:46 -0000 Author: hselasky Date: Mon Jul 30 09:18:45 2018 New Revision: 336885 URL: https://svnweb.freebsd.org/changeset/base/336885 Log: MFC r335669: Improve the userspace USB string reading function in LibUSB. Some USB devices does not allow a partial descriptor readout. Found by: bz @ Sponsored by: Mellanox Technologies Modified: stable/9/lib/libusb/libusb20.c Directory Properties: stable/9/lib/ (props changed) stable/9/lib/libusb/ (props changed) Modified: stable/9/lib/libusb/libusb20.c ============================================================================== --- stable/9/lib/libusb/libusb20.c Mon Jul 30 09:16:47 2018 (r336884) +++ stable/9/lib/libusb/libusb20.c Mon Jul 30 09:18:45 2018 (r336885) @@ -783,6 +783,7 @@ libusb20_dev_req_string_sync(struct libusb20_device *p { struct LIBUSB20_CONTROL_SETUP_DECODED req; int error; + int flags; /* make sure memory is initialised */ memset(ptr, 0, len); @@ -809,22 +810,24 @@ libusb20_dev_req_string_sync(struct libusb20_device *p error = libusb20_dev_request_sync(pdev, &req, ptr, NULL, 1000, LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK); if (error) { - return (error); + /* try to request full string */ + req.wLength = 255; + flags = 0; + } else { + /* extract length and request full string */ + req.wLength = *(uint8_t *)ptr; + flags = LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK; } - req.wLength = *(uint8_t *)ptr; /* bytes */ if (req.wLength > len) { /* partial string read */ req.wLength = len; } - error = libusb20_dev_request_sync(pdev, &req, - ptr, NULL, 1000, LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK); - - if (error) { + error = libusb20_dev_request_sync(pdev, &req, ptr, NULL, 1000, flags); + if (error) return (error); - } - if (((uint8_t *)ptr)[1] != LIBUSB20_DT_STRING) { + + if (((uint8_t *)ptr)[1] != LIBUSB20_DT_STRING) return (LIBUSB20_ERROR_OTHER); - } return (0); /* success */ } From owner-svn-src-stable@freebsd.org Mon Jul 30 09:20:18 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4090910500BB; Mon, 30 Jul 2018 09:20:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E9E678F57F; Mon, 30 Jul 2018 09:20:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1C5022555; Mon, 30 Jul 2018 09:20:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6U9KH3c018784; Mon, 30 Jul 2018 09:20:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6U9KHcc018783; Mon, 30 Jul 2018 09:20:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201807300920.w6U9KHcc018783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 30 Jul 2018 09:20: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: r336886 - stable/11/sys/dev/usb X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/usb X-SVN-Commit-Revision: 336886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 09:20:18 -0000 Author: hselasky Date: Mon Jul 30 09:20:17 2018 New Revision: 336886 URL: https://svnweb.freebsd.org/changeset/base/336886 Log: MFC r335700: Improve the kernel's USB descriptor reading function. Some USB devices does not allow a partial descriptor readout. Found by: bz@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/usb/usb_request.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/usb_request.c ============================================================================== --- stable/11/sys/dev/usb/usb_request.c Mon Jul 30 09:18:45 2018 (r336885) +++ stable/11/sys/dev/usb/usb_request.c Mon Jul 30 09:20:17 2018 (r336886) @@ -988,7 +988,7 @@ usbd_req_get_desc(struct usb_device *udev, uint8_t retries) { struct usb_device_request req; - uint8_t *buf; + uint8_t *buf = desc; usb_error_t err; DPRINTFN(4, "id=%d, type=%d, index=%d, max_len=%d\n", @@ -1010,6 +1010,32 @@ usbd_req_get_desc(struct usb_device *udev, err = usbd_do_request_flags(udev, mtx, &req, desc, 0, NULL, 500 /* ms */); + if (err != 0 && err != USB_ERR_TIMEOUT && + min_len != max_len) { + /* clear descriptor data */ + memset(desc, 0, max_len); + + /* try to read full descriptor length */ + USETW(req.wLength, max_len); + + err = usbd_do_request_flags(udev, mtx, &req, + desc, USB_SHORT_XFER_OK, NULL, 500 /* ms */); + + if (err == 0) { + /* verify length */ + if (buf[0] > max_len) + buf[0] = max_len; + else if (buf[0] < 2) + err = USB_ERR_INVAL; + + min_len = buf[0]; + + /* enforce descriptor type */ + buf[1] = type; + goto done; + } + } + if (err) { if (!retries) { goto done; @@ -1020,7 +1046,6 @@ usbd_req_get_desc(struct usb_device *udev, continue; } - buf = desc; if (min_len == max_len) { From owner-svn-src-stable@freebsd.org Mon Jul 30 09:21:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8C921050173; Mon, 30 Jul 2018 09:21:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E66E8F898; Mon, 30 Jul 2018 09:21:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FA4A22687; Mon, 30 Jul 2018 09:21:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6U9LKH6018885; Mon, 30 Jul 2018 09:21:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6U9LK50018884; Mon, 30 Jul 2018 09:21:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201807300921.w6U9LK50018884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 30 Jul 2018 09:21:20 +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: r336887 - stable/10/sys/dev/usb X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/usb X-SVN-Commit-Revision: 336887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 09:21:20 -0000 Author: hselasky Date: Mon Jul 30 09:21:19 2018 New Revision: 336887 URL: https://svnweb.freebsd.org/changeset/base/336887 Log: MFC r335700: Improve the kernel's USB descriptor reading function. Some USB devices does not allow a partial descriptor readout. Found by: bz@ Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/usb/usb_request.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/usb_request.c ============================================================================== --- stable/10/sys/dev/usb/usb_request.c Mon Jul 30 09:20:17 2018 (r336886) +++ stable/10/sys/dev/usb/usb_request.c Mon Jul 30 09:21:19 2018 (r336887) @@ -988,7 +988,7 @@ usbd_req_get_desc(struct usb_device *udev, uint8_t retries) { struct usb_device_request req; - uint8_t *buf; + uint8_t *buf = desc; usb_error_t err; DPRINTFN(4, "id=%d, type=%d, index=%d, max_len=%d\n", @@ -1010,6 +1010,32 @@ usbd_req_get_desc(struct usb_device *udev, err = usbd_do_request_flags(udev, mtx, &req, desc, 0, NULL, 500 /* ms */); + if (err != 0 && err != USB_ERR_TIMEOUT && + min_len != max_len) { + /* clear descriptor data */ + memset(desc, 0, max_len); + + /* try to read full descriptor length */ + USETW(req.wLength, max_len); + + err = usbd_do_request_flags(udev, mtx, &req, + desc, USB_SHORT_XFER_OK, NULL, 500 /* ms */); + + if (err == 0) { + /* verify length */ + if (buf[0] > max_len) + buf[0] = max_len; + else if (buf[0] < 2) + err = USB_ERR_INVAL; + + min_len = buf[0]; + + /* enforce descriptor type */ + buf[1] = type; + goto done; + } + } + if (err) { if (!retries) { goto done; @@ -1020,7 +1046,6 @@ usbd_req_get_desc(struct usb_device *udev, continue; } - buf = desc; if (min_len == max_len) { From owner-svn-src-stable@freebsd.org Mon Jul 30 09:22:22 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 508E8105035D; Mon, 30 Jul 2018 09:22:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 06E278FA64; Mon, 30 Jul 2018 09:22:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC3B4226D3; Mon, 30 Jul 2018 09:22:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6U9MLSB021186; Mon, 30 Jul 2018 09:22:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6U9MLei021185; Mon, 30 Jul 2018 09:22:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201807300922.w6U9MLei021185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 30 Jul 2018 09:22:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r336888 - stable/9/sys/dev/usb X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/dev/usb X-SVN-Commit-Revision: 336888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 09:22:22 -0000 Author: hselasky Date: Mon Jul 30 09:22:21 2018 New Revision: 336888 URL: https://svnweb.freebsd.org/changeset/base/336888 Log: MFC r335700: Improve the kernel's USB descriptor reading function. Some USB devices does not allow a partial descriptor readout. Found by: bz@ Sponsored by: Mellanox Technologies Modified: stable/9/sys/dev/usb/usb_request.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/usb/usb_request.c ============================================================================== --- stable/9/sys/dev/usb/usb_request.c Mon Jul 30 09:21:19 2018 (r336887) +++ stable/9/sys/dev/usb/usb_request.c Mon Jul 30 09:22:21 2018 (r336888) @@ -981,7 +981,7 @@ usbd_req_get_desc(struct usb_device *udev, uint8_t retries) { struct usb_device_request req; - uint8_t *buf; + uint8_t *buf = desc; usb_error_t err; DPRINTFN(4, "id=%d, type=%d, index=%d, max_len=%d\n", @@ -1003,6 +1003,32 @@ usbd_req_get_desc(struct usb_device *udev, err = usbd_do_request_flags(udev, mtx, &req, desc, 0, NULL, 500 /* ms */); + if (err != 0 && err != USB_ERR_TIMEOUT && + min_len != max_len) { + /* clear descriptor data */ + memset(desc, 0, max_len); + + /* try to read full descriptor length */ + USETW(req.wLength, max_len); + + err = usbd_do_request_flags(udev, mtx, &req, + desc, USB_SHORT_XFER_OK, NULL, 500 /* ms */); + + if (err == 0) { + /* verify length */ + if (buf[0] > max_len) + buf[0] = max_len; + else if (buf[0] < 2) + err = USB_ERR_INVAL; + + min_len = buf[0]; + + /* enforce descriptor type */ + buf[1] = type; + goto done; + } + } + if (err) { if (!retries) { goto done; @@ -1013,7 +1039,6 @@ usbd_req_get_desc(struct usb_device *udev, continue; } - buf = desc; if (min_len == max_len) { From owner-svn-src-stable@freebsd.org Mon Jul 30 09:25:57 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA23A10504AF; Mon, 30 Jul 2018 09:25:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7FA9B8FCAF; Mon, 30 Jul 2018 09:25:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E19D226E1; Mon, 30 Jul 2018 09:25:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6U9PvmV023796; Mon, 30 Jul 2018 09:25:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6U9Pvdo023795; Mon, 30 Jul 2018 09:25:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201807300925.w6U9Pvdo023795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 30 Jul 2018 09:25:57 +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: r336889 - stable/11/sys/dev/sound/pcm X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/sound/pcm X-SVN-Commit-Revision: 336889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 09:25:58 -0000 Author: hselasky Date: Mon Jul 30 09:25:56 2018 New Revision: 336889 URL: https://svnweb.freebsd.org/changeset/base/336889 Log: MFC r336632: Update modify counter when setting a mixer control. PR: 229969 Modified: stable/11/sys/dev/sound/pcm/mixer.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/pcm/mixer.c ============================================================================== --- stable/11/sys/dev/sound/pcm/mixer.c Mon Jul 30 09:22:21 2018 (r336888) +++ stable/11/sys/dev/sound/pcm/mixer.c Mon Jul 30 09:25:56 2018 (r336889) @@ -322,6 +322,7 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int lev) MIXER_SET_LOCK(m, dropmtx); m->level[dev] = l | (r << 8); + m->modify_counter++; return 0; } From owner-svn-src-stable@freebsd.org Mon Jul 30 09:28:01 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 700331050581; Mon, 30 Jul 2018 09:28:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 253048FE41; Mon, 30 Jul 2018 09:28:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06405226E5; Mon, 30 Jul 2018 09:28:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6U9S0oq023947; Mon, 30 Jul 2018 09:28:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6U9S00g023946; Mon, 30 Jul 2018 09:28:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201807300928.w6U9S00g023946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 30 Jul 2018 09:28:00 +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: r336890 - stable/10/sys/dev/sound/pcm X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/sound/pcm X-SVN-Commit-Revision: 336890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 09:28:01 -0000 Author: hselasky Date: Mon Jul 30 09:28:00 2018 New Revision: 336890 URL: https://svnweb.freebsd.org/changeset/base/336890 Log: MFC r336632: Update modify counter when setting a mixer control. PR: 229969 Modified: stable/10/sys/dev/sound/pcm/mixer.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sound/pcm/mixer.c ============================================================================== --- stable/10/sys/dev/sound/pcm/mixer.c Mon Jul 30 09:25:56 2018 (r336889) +++ stable/10/sys/dev/sound/pcm/mixer.c Mon Jul 30 09:28:00 2018 (r336890) @@ -323,6 +323,7 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int lev) MIXER_SET_LOCK(m, dropmtx); m->level[dev] = l | (r << 8); + m->modify_counter++; return 0; } From owner-svn-src-stable@freebsd.org Mon Jul 30 09:29:33 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02BBD10506EC; Mon, 30 Jul 2018 09:29:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB858900A9; Mon, 30 Jul 2018 09:29:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CA6E226E8; Mon, 30 Jul 2018 09:29:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6U9TWiY024181; Mon, 30 Jul 2018 09:29:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6U9TWUR024180; Mon, 30 Jul 2018 09:29:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201807300929.w6U9TWUR024180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 30 Jul 2018 09:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r336891 - stable/9/sys/dev/sound/pcm X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/dev/sound/pcm X-SVN-Commit-Revision: 336891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 09:29:33 -0000 Author: hselasky Date: Mon Jul 30 09:29:32 2018 New Revision: 336891 URL: https://svnweb.freebsd.org/changeset/base/336891 Log: MFC r336632: Update modify counter when setting a mixer control. PR: 229969 Modified: stable/9/sys/dev/sound/pcm/mixer.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/sound/pcm/mixer.c ============================================================================== --- stable/9/sys/dev/sound/pcm/mixer.c Mon Jul 30 09:28:00 2018 (r336890) +++ stable/9/sys/dev/sound/pcm/mixer.c Mon Jul 30 09:29:32 2018 (r336891) @@ -323,6 +323,7 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int lev) MIXER_SET_LOCK(m, dropmtx); m->level[dev] = l | (r << 8); + m->modify_counter++; return 0; } From owner-svn-src-stable@freebsd.org Mon Jul 30 12:10:25 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0606210551D2; Mon, 30 Jul 2018 12:10:25 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9FD2E96B0F; Mon, 30 Jul 2018 12:10:24 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6351824180; Mon, 30 Jul 2018 12:10:24 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6UCAOK1006328; Mon, 30 Jul 2018 12:10:24 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6UCAODb006327; Mon, 30 Jul 2018 12:10:24 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807301210.w6UCAODb006327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 30 Jul 2018 12:10:24 +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: r336898 - in stable/11/sys/fs: nfs nfsclient X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in stable/11/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 336898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 12:10:25 -0000 Author: rmacklem Date: Mon Jul 30 12:10:23 2018 New Revision: 336898 URL: https://svnweb.freebsd.org/changeset/base/336898 Log: MFC: r334966 Add a couple of safety belt checks to the NFSv4.1 client related to sessions. There were a couple of cases in newnfs_request() that it assumed that it was an NFSv4.1 mount with a session. This should always be the case when a Sequence operation is in the reply or the server replies NFSERR_BADSESSION. However, if a server was broken and sent an erroneous reply, these safety belt checks should avoid trouble. The one check required a small tweak to nfsmnt_mdssession() so that it returns NULL when there is no session instead of the offset of the field in the structure (0x8 for i386). This patch should have no effect on normal operation of the client. Found by inspection during pNFS server development. Modified: stable/11/sys/fs/nfs/nfs_commonkrpc.c stable/11/sys/fs/nfsclient/nfsmount.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonkrpc.c Mon Jul 30 11:41:51 2018 (r336897) +++ stable/11/sys/fs/nfs/nfs_commonkrpc.c Mon Jul 30 12:10:23 2018 (r336898) @@ -849,9 +849,9 @@ tryagain: if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j != 0) || (clp != NULL && i == NFSV4OP_CBSEQUENCE && j != 0)) NFSCL_DEBUG(1, "failed seq=%d\n", j); - if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) || - (clp != NULL && i == NFSV4OP_CBSEQUENCE && j == 0) - ) { + if (((nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) || + (clp != NULL && i == NFSV4OP_CBSEQUENCE && + j == 0)) && sep != NULL) { if (i == NFSV4OP_SEQUENCE) NFSM_DISSECT(tl, uint32_t *, NFSX_V4SESSIONID + @@ -893,7 +893,8 @@ tryagain: } if (nd->nd_repstat != 0) { if (nd->nd_repstat == NFSERR_BADSESSION && - nmp != NULL && dssep == NULL) { + nmp != NULL && dssep == NULL && + (nd->nd_flag & ND_NFSV41) != 0) { /* * If this is a client side MDS RPC, mark * the MDS session defunct and initiate Modified: stable/11/sys/fs/nfsclient/nfsmount.h ============================================================================== --- stable/11/sys/fs/nfsclient/nfsmount.h Mon Jul 30 11:41:51 2018 (r336897) +++ stable/11/sys/fs/nfsclient/nfsmount.h Mon Jul 30 12:10:23 2018 (r336898) @@ -127,8 +127,10 @@ nfsmnt_mdssession(struct nfsmount *nmp) { struct nfsclsession *tsep; + tsep = NULL; mtx_lock(&nmp->nm_mtx); - tsep = NFSMNT_MDSSESSION(nmp); + if (TAILQ_FIRST(&nmp->nm_sess) != NULL) + tsep = NFSMNT_MDSSESSION(nmp); mtx_unlock(&nmp->nm_mtx); return (tsep); } From owner-svn-src-stable@freebsd.org Mon Jul 30 12:17:12 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 268C11055483; Mon, 30 Jul 2018 12:17:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A3D196FFA; Mon, 30 Jul 2018 12:17:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B63724310; Mon, 30 Jul 2018 12:17:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6UCHBer011763; Mon, 30 Jul 2018 12:17:11 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6UCHBTP011762; Mon, 30 Jul 2018 12:17:11 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807301217.w6UCHBTP011762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 30 Jul 2018 12:17:11 +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: r336899 - in stable/10/sys/fs: nfs nfsclient X-SVN-Group: stable-10 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in stable/10/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 336899 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 12:17:12 -0000 Author: rmacklem Date: Mon Jul 30 12:17:10 2018 New Revision: 336899 URL: https://svnweb.freebsd.org/changeset/base/336899 Log: MFC: r334966 Add a couple of safety belt checks to the NFSv4.1 client related to sessions. There were a couple of cases in newnfs_request() that it assumed that it was an NFSv4.1 mount with a session. This should always be the case when a Sequence operation is in the reply or the server replies NFSERR_BADSESSION. However, if a server was broken and sent an erroneous reply, these safety belt checks should avoid trouble. The one check required a small tweak to nfsmnt_mdssession() so that it returns NULL when there is no session instead of the offset of the field in the structure (0x8 for i386). This patch should have no effect on normal operation of the client. Found by inspection during pNFS server development. Modified: stable/10/sys/fs/nfs/nfs_commonkrpc.c stable/10/sys/fs/nfsclient/nfsmount.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonkrpc.c Mon Jul 30 12:10:23 2018 (r336898) +++ stable/10/sys/fs/nfs/nfs_commonkrpc.c Mon Jul 30 12:17:10 2018 (r336899) @@ -850,9 +850,9 @@ tryagain: if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j != 0) || (clp != NULL && i == NFSV4OP_CBSEQUENCE && j != 0)) NFSCL_DEBUG(1, "failed seq=%d\n", j); - if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) || - (clp != NULL && i == NFSV4OP_CBSEQUENCE && j == 0) - ) { + if (((nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) || + (clp != NULL && i == NFSV4OP_CBSEQUENCE && + j == 0)) && sep != NULL) { if (i == NFSV4OP_SEQUENCE) NFSM_DISSECT(tl, uint32_t *, NFSX_V4SESSIONID + @@ -894,7 +894,8 @@ tryagain: } if (nd->nd_repstat != 0) { if (nd->nd_repstat == NFSERR_BADSESSION && - nmp != NULL && dssep == NULL) { + nmp != NULL && dssep == NULL && + (nd->nd_flag & ND_NFSV41) != 0) { /* * If this is a client side MDS RPC, mark * the MDS session defunct and initiate Modified: stable/10/sys/fs/nfsclient/nfsmount.h ============================================================================== --- stable/10/sys/fs/nfsclient/nfsmount.h Mon Jul 30 12:10:23 2018 (r336898) +++ stable/10/sys/fs/nfsclient/nfsmount.h Mon Jul 30 12:17:10 2018 (r336899) @@ -122,8 +122,10 @@ nfsmnt_mdssession(struct nfsmount *nmp) { struct nfsclsession *tsep; + tsep = NULL; mtx_lock(&nmp->nm_mtx); - tsep = NFSMNT_MDSSESSION(nmp); + if (TAILQ_FIRST(&nmp->nm_sess) != NULL) + tsep = NFSMNT_MDSSESSION(nmp); mtx_unlock(&nmp->nm_mtx); return (tsep); } From owner-svn-src-stable@freebsd.org Mon Jul 30 12:51:58 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5141D10562AC; Mon, 30 Jul 2018 12:51:58 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0318970865; Mon, 30 Jul 2018 12:51:58 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8B7B24960; Mon, 30 Jul 2018 12:51:57 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6UCpvMH032337; Mon, 30 Jul 2018 12:51:57 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6UCpvcW032336; Mon, 30 Jul 2018 12:51:57 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201807301251.w6UCpvcW032336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Mon, 30 Jul 2018 12:51:57 +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: r336903 - stable/11/contrib/tcpdump X-SVN-Group: stable-11 X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: stable/11/contrib/tcpdump X-SVN-Commit-Revision: 336903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 12:51:58 -0000 Author: slavash Date: Mon Jul 30 12:51:57 2018 New Revision: 336903 URL: https://svnweb.freebsd.org/changeset/base/336903 Log: MFC r334318: Vendor import two upstream commits: c1bb8784abd3ca978e376b0d10e324db0491237b 9c4af7213cc2543a1f5586d8f2c19f86aa0cbe72 Approved by: hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: stable/11/contrib/tcpdump/tcpdump.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tcpdump/tcpdump.c ============================================================================== --- stable/11/contrib/tcpdump/tcpdump.c Mon Jul 30 12:44:44 2018 (r336902) +++ stable/11/contrib/tcpdump/tcpdump.c Mon Jul 30 12:51:57 2018 (r336903) @@ -77,7 +77,6 @@ The Regents of the University of California. All righ */ #ifdef HAVE_CAPSICUM #include -#include #include #include #include @@ -114,6 +113,10 @@ The Regents of the University of California. All righ #endif /* HAVE_CAP_NG_H */ #endif /* HAVE_LIBCAP_NG */ +#ifdef __FreeBSD__ +#include +#endif /* __FreeBSD__ */ + #include "netdissect.h" #include "interface.h" #include "addrtoname.h" @@ -1095,6 +1098,10 @@ open_interface(const char *device, netdissect_options sysctlbyname(sysctl, parent, &s, NULL, 0); strlcpy(newdev, device, sizeof(newdev)); /* Suggest a new wlan device. */ + /* FIXME: incrementing the index this way is not going to work well + * when the index is 9 or greater but the only consequence in this + * specific case would be an error message that looks a bit odd. + */ newdev[strlen(newdev)-1]++; error("%s is not a monitor mode VAP\n" "To create a new monitor mode VAP use:\n" From owner-svn-src-stable@freebsd.org Mon Jul 30 17:49:48 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDE52105C90C; Mon, 30 Jul 2018 17:49:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 69FA17C58D; Mon, 30 Jul 2018 17:49:48 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F35E27B18; Mon, 30 Jul 2018 17:49:48 +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 w6UHnmiS082320; Mon, 30 Jul 2018 17:49:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6UHnmqF082319; Mon, 30 Jul 2018 17:49:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201807301749.w6UHnmqF082319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 30 Jul 2018 17:49:48 +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: r336920 - stable/11/usr.sbin/acpi/acpidump X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 336920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 17:49:48 -0000 Author: emaste Date: Mon Jul 30 17:49:47 2018 New Revision: 336920 URL: https://svnweb.freebsd.org/changeset/base/336920 Log: MFC r335459: acpidump.8: include NFIT in the man page list of tables Was missed in r321298 [MFC'd in r322461]. Reported by: Ben Widawsky (in review D15931) Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/acpi/acpidump/acpidump.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/acpi/acpidump/acpidump.8 ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpidump.8 Mon Jul 30 17:40:27 2018 (r336919) +++ stable/11/usr.sbin/acpi/acpidump/acpidump.8 Mon Jul 30 17:49:47 2018 (r336920) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 14, 2005 +.Dd June 20, 2018 .Dt ACPIDUMP 8 .Os .Sh NAME @@ -105,6 +105,7 @@ utility dumps contents of the following tables: .It HPET .It MADT .It MCFG +.It NFIT .It RSD PTR .It RSDT .El From owner-svn-src-stable@freebsd.org Mon Jul 30 19:23:53 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D4E9105EE4E; Mon, 30 Jul 2018 19:23:53 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0FDD180A67; Mon, 30 Jul 2018 19:23:53 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF700C22; Mon, 30 Jul 2018 19:23:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6UJNqKT033454; Mon, 30 Jul 2018 19:23:52 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6UJNqWd033453; Mon, 30 Jul 2018 19:23:52 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807301923.w6UJNqWd033453@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 30 Jul 2018 19:23:52 +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: r336927 - stable/11/sys/rpc X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/11/sys/rpc X-SVN-Commit-Revision: 336927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 19:23:53 -0000 Author: rmacklem Date: Mon Jul 30 19:23:52 2018 New Revision: 336927 URL: https://svnweb.freebsd.org/changeset/base/336927 Log: MFC: r335866 Fix the server side krpc so that the kernel nfsd threads terminate. Occationally the kernel nfsd threads would not terminate when a SIGKILL was posted for the kernel process (called nfsd (slave)). When this occurred, the thread associated with the process (called "ismaster") had returned from svc_run_internal() and was sleeping waiting for the other threads to terminate. The other threads (created by kthread_start()) were still in svc_run_internal() handling NFS RPCs. The only way this could occur is for the "ismaster" thread to return from svc_run_internal() without having called svc_exit(). There was only one place in the code where this could happen and this patch stops that from happening. Since the problem is intermittent, I cannot be sure if this has fixed the problem, but I have not seen an occurrence of the problem with this patch applied. Modified: stable/11/sys/rpc/svc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/rpc/svc.c ============================================================================== --- stable/11/sys/rpc/svc.c Mon Jul 30 18:29:46 2018 (r336926) +++ stable/11/sys/rpc/svc.c Mon Jul 30 19:23:52 2018 (r336927) @@ -1183,7 +1183,8 @@ svc_run_internal(SVCGROUP *grp, bool_t ismaster) /* * Enforce maxthreads count. */ - if (grp->sg_threadcount > grp->sg_maxthreads) + if (!ismaster && grp->sg_threadcount > + grp->sg_maxthreads) break; /* From owner-svn-src-stable@freebsd.org Mon Jul 30 19:29:32 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5732105F034; Mon, 30 Jul 2018 19:29:32 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 570CB80C72; Mon, 30 Jul 2018 19:29:32 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32D55C24; Mon, 30 Jul 2018 19:29:32 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6UJTWYs033741; Mon, 30 Jul 2018 19:29:32 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6UJTW8M033740; Mon, 30 Jul 2018 19:29:32 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807301929.w6UJTW8M033740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 30 Jul 2018 19:29:32 +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: r336928 - stable/10/sys/rpc X-SVN-Group: stable-10 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/10/sys/rpc X-SVN-Commit-Revision: 336928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 19:29:32 -0000 Author: rmacklem Date: Mon Jul 30 19:29:31 2018 New Revision: 336928 URL: https://svnweb.freebsd.org/changeset/base/336928 Log: MFC: r335866 Fix the server side krpc so that the kernel nfsd threads terminate. Occationally the kernel nfsd threads would not terminate when a SIGKILL was posted for the kernel process (called nfsd (slave)). When this occurred, the thread associated with the process (called "ismaster") had returned from svc_run_internal() and was sleeping waiting for the other threads to terminate. The other threads (created by kthread_start()) were still in svc_run_internal() handling NFS RPCs. The only way this could occur is for the "ismaster" thread to return from svc_run_internal() without having called svc_exit(). There was only one place in the code where this could happen and this patch stops that from happening. Since the problem is intermittent, I cannot be sure if this has fixed the problem, but I have not seen an occurrence of the problem with this patch applied. Modified: stable/10/sys/rpc/svc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/rpc/svc.c ============================================================================== --- stable/10/sys/rpc/svc.c Mon Jul 30 19:23:52 2018 (r336927) +++ stable/10/sys/rpc/svc.c Mon Jul 30 19:29:31 2018 (r336928) @@ -1183,7 +1183,8 @@ svc_run_internal(SVCGROUP *grp, bool_t ismaster) /* * Enforce maxthreads count. */ - if (grp->sg_threadcount > grp->sg_maxthreads) + if (!ismaster && grp->sg_threadcount > + grp->sg_maxthreads) break; /* From owner-svn-src-stable@freebsd.org Mon Jul 30 20:59:59 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F27B61060D71; Mon, 30 Jul 2018 20:59:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6262841FE; Mon, 30 Jul 2018 20:59:58 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71EEC1AC2; Mon, 30 Jul 2018 20:59:58 +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 w6UKxw7w080979; Mon, 30 Jul 2018 20:59:58 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6UKxwk5080978; Mon, 30 Jul 2018 20:59:58 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201807302059.w6UKxwk5080978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 30 Jul 2018 20:59:58 +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: r336936 - stable/11/release/tools X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/tools X-SVN-Commit-Revision: 336936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 20:59:59 -0000 Author: gjb Date: Mon Jul 30 20:59:58 2018 New Revision: 336936 URL: https://svnweb.freebsd.org/changeset/base/336936 Log: As part of r336741, BOOTFILES needs special handling when cross building on stable/11, where the path should be: /usr/obj/TARGET.TARGET_ARCH/[...] The change in r336741, which was a direct commit to stable/11 was not complete enough to evaluate where BOOTFILES should be. This, as was r336741, is a direct commit to stable/11. Tested with: stable/11 BANANAPI build Sponsored by: The FreeBSD Foundation Modified: stable/11/release/tools/arm.subr Modified: stable/11/release/tools/arm.subr ============================================================================== --- stable/11/release/tools/arm.subr Mon Jul 30 20:36:51 2018 (r336935) +++ stable/11/release/tools/arm.subr Mon Jul 30 20:59:58 2018 (r336936) @@ -142,14 +142,13 @@ arm_install_boot() { ${FATMOUNT}/ubldr.bin fi - # Ensure the correct .OBJDIR exists. - chroot ${CHROOTDIR} env TARGET=${EMBEDDED_TARGET} \ - TARGET_ARCH=${EMBEDDED_TARGET_ARCH} WITH_UNIFIED_OBJDIR=yes \ - make -C ${WORLDDIR}/stand obj - BOOTFILES="$(chroot ${CHROOTDIR} \ - env TARGET=${EMBEDDED_TARGET} TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \ - WITH_UNIFIED_OBJDIR=yes \ - make -C ${WORLDDIR}/stand -V .OBJDIR)" + # Ensure the correct .OBJDIR is used for BOOTFILES. + _OBJDIR="$(chroot ${CHROOTDIR} make -C /usr/src -V .OBJDIR)" + if [ -d "/${CHROOTDIR}/${_OBJDIR%%/usr/src}/${EMBEDDED_TARGET}.${EMBEDDED_TARGET_ARCH}/usr/src/stand" ]; then + BOOTFILES=/${_OBJDIR%%/usr/src}/${EMBEDDED_TARGET}.${EMBEDDED_TARGET_ARCH}/usr/src/stand + else + BOOTFILES=/${_OBJDIR}/stand + fi BOOTFILES="$(chroot ${CHROOTDIR} realpath ${BOOTFILES})" chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/EFI/BOOT From owner-svn-src-stable@freebsd.org Mon Jul 30 21:24:29 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A8B71061764; Mon, 30 Jul 2018 21:24:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E72385329; Mon, 30 Jul 2018 21:24:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 202751FE4; Mon, 30 Jul 2018 21:24:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6ULOS8n096079; Mon, 30 Jul 2018 21:24:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6ULOSsT096076; Mon, 30 Jul 2018 21:24:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201807302124.w6ULOSsT096076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 30 Jul 2018 21:24:28 +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: r336938 - stable/11/usr.sbin/config X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.sbin/config X-SVN-Commit-Revision: 336938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 21:24:29 -0000 Author: kevans Date: Mon Jul 30 21:24:27 2018 New Revision: 336938 URL: https://svnweb.freebsd.org/changeset/base/336938 Log: MFC r307967,324082,325955: config(8) fixes r307967: Allow config to be compiled from another source directory, such as one for building tools. This boils down to replacing ${.CURDIR} with ${SRCDIR}, where the latter is the directory in which this makefile lives. Also allow overriding where file2c comes from using ${FILE2C}. r324082: Typo in filename in comment. r325955: Fix 'local' to not look in the source tree for the file. Usually 'local' is used along with other rules such as 'no-implicit-rule' or 'dependency' which avoids this problem. It's possible to need to use 'local' while relying on the default rules though for a file which is not in the source tree nor generated in the kernel. Modified: stable/11/usr.sbin/config/Makefile stable/11/usr.sbin/config/config.h stable/11/usr.sbin/config/configvers.h stable/11/usr.sbin/config/mkmakefile.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/config/Makefile ============================================================================== --- stable/11/usr.sbin/config/Makefile Mon Jul 30 21:13:42 2018 (r336937) +++ stable/11/usr.sbin/config/Makefile Mon Jul 30 21:24:27 2018 (r336938) @@ -1,15 +1,20 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +SRCDIR:=${.PARSEDIR:tA} + PROG= config MAN= config.5 config.8 SRCS= config.y main.c lang.l mkmakefile.c mkheaders.c \ mkoptions.c y.tab.h kernconf.c +FILE2C?=file2c + kernconf.c: kernconf.tmpl - file2c 'char kernconfstr[] = {' ',0};' < ${.CURDIR}/kernconf.tmpl > kernconf.c + ${FILE2C} 'char kernconfstr[] = {' ',0};' < \ + ${SRCDIR}/kernconf.tmpl > kernconf.c -CFLAGS+= -I. -I${.CURDIR} +CFLAGS+= -I. -I${SRCDIR} NO_WMISSING_VARIABLE_DECLARATIONS= Modified: stable/11/usr.sbin/config/config.h ============================================================================== --- stable/11/usr.sbin/config/config.h Mon Jul 30 21:13:42 2018 (r336937) +++ stable/11/usr.sbin/config/config.h Mon Jul 30 21:24:27 2018 (r336938) @@ -55,6 +55,7 @@ struct file_list { char *f_clean; /* File list to add to clean rule */ char *f_warn; /* warning message */ const char *f_objprefix; /* prefix string for object name */ + const char *f_srcprefix; /* source prefix such as $S/ */ }; struct files_name { @@ -161,7 +162,7 @@ struct includepath { SLIST_HEAD(, includepath) includepath; /* - * Tag present in the kernelconf.tmlp template file. It's mandatory for those + * Tag present in the kernconf.tmpl template file. It's mandatory for those * two strings to be the same. Otherwise you'll get into trouble. */ #define KERNCONFTAG "%%KERNCONFFILE%%" Modified: stable/11/usr.sbin/config/configvers.h ============================================================================== --- stable/11/usr.sbin/config/configvers.h Mon Jul 30 21:13:42 2018 (r336937) +++ stable/11/usr.sbin/config/configvers.h Mon Jul 30 21:24:27 2018 (r336938) @@ -49,5 +49,5 @@ * * $FreeBSD$ */ -#define CONFIGVERS 600014 +#define CONFIGVERS 600015 #define MAJOR_VERS(x) ((x) / 100000) Modified: stable/11/usr.sbin/config/mkmakefile.c ============================================================================== --- stable/11/usr.sbin/config/mkmakefile.c Mon Jul 30 21:13:42 2018 (r336937) +++ stable/11/usr.sbin/config/mkmakefile.c Mon Jul 30 21:24:27 2018 (r336938) @@ -535,6 +535,10 @@ nextparam:; tp = new_fent(); tp->f_fn = this; tp->f_type = filetype; + if (filetype == LOCAL) + tp->f_srcprefix = ""; + else + tp->f_srcprefix = "$S/"; if (imp_rule) tp->f_flags |= NO_IMPLCT_RULE; if (no_obj) @@ -610,7 +614,8 @@ do_before_depend(FILE *fp) if (tp->f_flags & NO_IMPLCT_RULE) fprintf(fp, "%s ", tp->f_fn); else - fprintf(fp, "$S/%s ", tp->f_fn); + fprintf(fp, "%s%s ", tp->f_srcprefix, + tp->f_fn); lpos += len + 1; } if (lpos != 8) @@ -675,10 +680,7 @@ do_xxfiles(char *tag, FILE *fp) lpos = 8; fputs("\\\n\t", fp); } - if (tp->f_type != LOCAL) - fprintf(fp, "$S/%s ", tp->f_fn); - else - fprintf(fp, "%s ", tp->f_fn); + fprintf(fp, "%s%s ", tp->f_srcprefix, tp->f_fn); lpos += len + 1; } free(suff); @@ -724,25 +726,30 @@ do_rules(FILE *f) else { *cp = '\0'; if (och == 'o') { - fprintf(f, "%s%so:\n\t-cp $S/%so .\n\n", - ftp->f_objprefix, tail(np), np); + fprintf(f, "%s%so:\n\t-cp %s%so .\n\n", + ftp->f_objprefix, tail(np), + ftp->f_srcprefix, np); continue; } if (ftp->f_depends) { - fprintf(f, "%s%sln: $S/%s%c %s\n", - ftp->f_objprefix, tail(np), np, och, + fprintf(f, "%s%sln: %s%s%c %s\n", + ftp->f_objprefix, tail(np), + ftp->f_srcprefix, np, och, ftp->f_depends); fprintf(f, "\t${NORMAL_LINT}\n\n"); - fprintf(f, "%s%so: $S/%s%c %s\n", - ftp->f_objprefix, tail(np), np, och, + fprintf(f, "%s%so: %s%s%c %s\n", + ftp->f_objprefix, tail(np), + ftp->f_srcprefix, np, och, ftp->f_depends); } else { - fprintf(f, "%s%sln: $S/%s%c\n", - ftp->f_objprefix, tail(np), np, och); + fprintf(f, "%s%sln: %s%s%c\n", + ftp->f_objprefix, tail(np), + ftp->f_srcprefix, np, och); fprintf(f, "\t${NORMAL_LINT}\n\n"); - fprintf(f, "%s%so: $S/%s%c\n", - ftp->f_objprefix, tail(np), np, och); + fprintf(f, "%s%so: %s%s%c\n", + ftp->f_objprefix, tail(np), + ftp->f_srcprefix, np, och); } } compilewith = ftp->f_compilewith; @@ -771,7 +778,8 @@ do_rules(FILE *f) } *cp = och; if (strlen(ftp->f_objprefix)) - fprintf(f, "\t%s $S/%s\n", compilewith, np); + fprintf(f, "\t%s %s%s\n", compilewith, + ftp->f_srcprefix, np); else fprintf(f, "\t%s\n", compilewith); From owner-svn-src-stable@freebsd.org Mon Jul 30 21:25:46 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4C6410617D8; Mon, 30 Jul 2018 21:25:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 548F485495; Mon, 30 Jul 2018 21:25:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 358231FEE; Mon, 30 Jul 2018 21:25:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6ULPkQf096198; Mon, 30 Jul 2018 21:25:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6ULPk4o096197; Mon, 30 Jul 2018 21:25:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201807302125.w6ULPk4o096197@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 30 Jul 2018 21:25:46 +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: r336939 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 336939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 21:25:46 -0000 Author: kevans Date: Mon Jul 30 21:25:45 2018 New Revision: 336939 URL: https://svnweb.freebsd.org/changeset/base/336939 Log: MFC r336353, r336358-r336359, r336414: One big config(8) no-op r336353: config(8): Bump major version after r335998 config-generated hints.c/env.c from r335998 and later are incompatible with earlier kernels due to no longer setting envmode/hintmode. A minor bump for this is insufficient, as matching major version with a later minor version is still viewed as backwards-compatible. This was an MI kernel change, soo all VERSREQ's are bumped. r336358: Partially revert r336353: sys/conf/* %VERSREQ bumps The changes made in r335998 don't strictly require a newer config(8), though it is advised. The %VERSREQ bumps were premature. r336359: Revert 336358 and step away fron machine for the day... VERSREQ < 7.+ physically will not work with new config(8) due to major bump, which is why I bumped it in the first place... Back to the original version r336414: Revert r336353 completely based on protest; compatibility shims incoming Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable@freebsd.org Mon Jul 30 21:29:27 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9723D1061981; Mon, 30 Jul 2018 21:29:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B8D1859F1; Mon, 30 Jul 2018 21:29:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DCB2201E; Mon, 30 Jul 2018 21:29:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6ULTRwo096488; Mon, 30 Jul 2018 21:29:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6ULTR56096487; Mon, 30 Jul 2018 21:29:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201807302129.w6ULTR56096487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 30 Jul 2018 21:29:27 +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: r336941 - stable/11/usr.sbin/config X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.sbin/config X-SVN-Commit-Revision: 336941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 21:29:27 -0000 Author: kevans Date: Mon Jul 30 21:29:26 2018 New Revision: 336941 URL: https://svnweb.freebsd.org/changeset/base/336941 Log: MFC r335526: Let -s actually work. Modified: stable/11/usr.sbin/config/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/config/main.c ============================================================================== --- stable/11/usr.sbin/config/main.c Mon Jul 30 21:27:26 2018 (r336940) +++ stable/11/usr.sbin/config/main.c Mon Jul 30 21:29:26 2018 (r336941) @@ -116,7 +116,7 @@ main(int argc, char **argv) printmachine = 0; kernfile = NULL; SLIST_INIT(&includepath); - while ((ch = getopt(argc, argv, "CI:d:gmpsVx:")) != -1) + while ((ch = getopt(argc, argv, "CI:d:gmps:Vx:")) != -1) switch (ch) { case 'C': filebased = 1; From owner-svn-src-stable@freebsd.org Mon Jul 30 22:38:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F22E1062DCF; Mon, 30 Jul 2018 22:38:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3E54885F9; Mon, 30 Jul 2018 22:38:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 20ABF10AFCD; Mon, 30 Jul 2018 18:38:14 -0400 (EDT) Subject: Re: svn commit: r336805 - in stable/11: share/man/man4 sys/dev/vt/hw/vga To: Eitan Adler , Kostik Belousov References: <201807280737.w6S7b12F025452@repo.freebsd.org> <20180728233405.GD40119@kib.kiev.ua> Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org From: John Baldwin Message-ID: Date: Mon, 30 Jul 2018 15:38:13 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 30 Jul 2018 18:38:14 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 30 Jul 2018 22:38:16 -0000 On 7/28/18 10:12 PM, Eitan Adler wrote: > On Sat, 28 Jul 2018 at 16:34, Konstantin Belousov wrote: >> >> On Sat, Jul 28, 2018 at 07:37:01AM +0000, Eitan Adler wrote: >>> Author: eadler >>> Date: Sat Jul 28 07:37:01 2018 >>> New Revision: 336805 >>> URL: https://svnweb.freebsd.org/changeset/base/336805 >>> >>> Log: >>> MFC r335629: >>> >>> vt: add option to ignore NO_VGA flag in ACPI >>> >>> To workaround buggy firmware that sets this flag when there's actually >>> a VGA present. >>> >>> Ref D16003 >>> PR: 229235 >>> >>> Modified: >>> stable/11/share/man/man4/vt.4 >>> stable/11/sys/dev/vt/hw/vga/vt_vga.c >>> Directory Properties: >>> stable/11/ (props changed) >>> >>> Modified: stable/11/share/man/man4/vt.4 >>> ============================================================================== >>> --- stable/11/share/man/man4/vt.4 Sat Jul 28 06:46:10 2018 (r336804) >>> +++ stable/11/share/man/man4/vt.4 Sat Jul 28 07:37:01 2018 (r336805) >>> @@ -44,6 +44,7 @@ >>> In >>> .Xr loader.conf 5 : >>> .Cd hw.vga.textmode=1 >>> +.Cd hw.vga.acpi_ignore_no_vga=1 >>> .Cd kern.vty=vt >>> .Cd kern.vt.color..rgb="" >>> .Cd kern.vt.fb.default_mode="x" >>> @@ -196,6 +197,10 @@ prompt or in >>> Set to 1 to use virtual terminals in text mode instead of graphics mode. >>> Features that require graphics mode, like loadable fonts, will be >>> disabled. >>> +.It Va hw.vga.acpi_ignore_no_vga >>> +Set to 1 to force the usage of the VGA driver regardless of whether >>> +ACPI IAPC_BOOT_ARCH signals no VGA support. >>> +Can be used to workaround firmware bugs in the ACPI tables. >>> .It Va kern.vty >>> Set this value to >>> .Ql vt >>> >>> Modified: stable/11/sys/dev/vt/hw/vga/vt_vga.c >>> ============================================================================== >>> --- stable/11/sys/dev/vt/hw/vga/vt_vga.c Sat Jul 28 06:46:10 2018 (r336804) >>> +++ stable/11/sys/dev/vt/hw/vga/vt_vga.c Sat Jul 28 07:37:01 2018 (r336805) >>> @@ -1211,6 +1211,12 @@ vga_acpi_disabled(void) >>> ACPI_TABLE_FADT *fadt; >>> vm_paddr_t physaddr; >>> uint16_t flags; >>> + int ignore; >>> + >>> + TUNABLE_INT_FETCH("hw.vga.acpi_ignore_no_vga", &ignore); >>> + >>> + if (ignore) >>> + return (false); > >> If the tunable is not set, this code evaluates the stack garbage. >> Why did you merged this without asking the author and not looking >> at the followups ? > > Please assume some level of good faith. > > I MFCed this because I was asked to here > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229235 over a month > ago. During that time no one mentioned or linked any followups. I did > look in my email for mentions of r335629 as well - of which there are > none. > > Now that you mention it, I looked at the svn log and found r335631 > which I will MFC as well. If MFC'ing a change by another developer you should proactively look at the svn logs of the changed files to see if there are follow up fixes. I do this myself via svnweb for my own commits. I also have a script that takes a given svn revision ID to merge from head to the current working directory, grabs the list of files from that change, then outputs a list of all the not-yet-merged svn revisions that touch the effected files so I can review them to see which ones are followups: #!/bin/sh # # mfclist [rev ... ] # # Given 1 or more SVN revisions for commits to head, build a list of eligible # commits to those files that haven't been merged yet. Must be run with the # cwd being the root of a checkout to merge to from ^/head. WRKDIR=`mktemp -d -t mfclist` if [ $? -ne 0 ]; then echo "Can't create temporary directory." exit 1 fi cleanup() { [ -d ${WRKDIR} ] && rm -rf ${WRKDIR} } trap cleanup EXIT INT QUIT TERM for rev; do svn log -qvc ${rev} ^/head | \ awk '/^ [A-Z] / { sub(/\/head\//, "", $2); print $2 }' >> \ ${WRKDIR}/files done sort ${WRKDIR}/files | uniq > ${WRKDIR}/files.u xargs -I % -n 1 svn mergeinfo --show-revs eligible '^/head/%' % < \ ${WRKDIR}/files.u | sort | uniq exit 0 -- John Baldwin From owner-svn-src-stable@freebsd.org Tue Jul 31 00:37:27 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D0BC10663F5; Tue, 31 Jul 2018 00:37:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40F268F2A3; Tue, 31 Jul 2018 00:37:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0350243DD; Tue, 31 Jul 2018 00:37:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6V0bQsK099925; Tue, 31 Jul 2018 00:37:26 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6V0bPlm099916; Tue, 31 Jul 2018 00:37:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807310037.w6V0bPlm099916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 31 Jul 2018 00:37:25 +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: r336953 - in stable: 10/usr.bin/mail 11/usr.bin/mail X-SVN-Group: stable-10 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable: 10/usr.bin/mail 11/usr.bin/mail X-SVN-Commit-Revision: 336953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 31 Jul 2018 00:37:28 -0000 Author: markj Date: Tue Jul 31 00:37:25 2018 New Revision: 336953 URL: https://svnweb.freebsd.org/changeset/base/336953 Log: Revert r335693, r335694, r335695 by eadler. They cause mail(1) to crash in certain scenarios. PR: 230196 Reported by: Pete French Modified: stable/10/usr.bin/mail/cmd1.c stable/10/usr.bin/mail/cmd2.c stable/10/usr.bin/mail/cmd3.c stable/10/usr.bin/mail/edit.c stable/10/usr.bin/mail/extern.h stable/10/usr.bin/mail/fio.c stable/10/usr.bin/mail/getname.c stable/10/usr.bin/mail/popen.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.bin/mail/cmd1.c stable/11/usr.bin/mail/cmd2.c stable/11/usr.bin/mail/cmd3.c stable/11/usr.bin/mail/edit.c stable/11/usr.bin/mail/extern.h stable/11/usr.bin/mail/fio.c stable/11/usr.bin/mail/getname.c stable/11/usr.bin/mail/popen.c Directory Properties: stable/11/ (props changed) Modified: stable/10/usr.bin/mail/cmd1.c ============================================================================== --- stable/10/usr.bin/mail/cmd1.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/10/usr.bin/mail/cmd1.c Tue Jul 31 00:37:25 2018 (r336953) @@ -439,7 +439,7 @@ folders(void) } if ((cmd = value("LISTER")) == NULL) cmd = "ls"; - (void)run_command(cmd, 0, -1, -1, dirname, NULL); + (void)run_command(cmd, 0, -1, -1, dirname, NULL, NULL); return (0); } Modified: stable/10/usr.bin/mail/cmd2.c ============================================================================== --- stable/10/usr.bin/mail/cmd2.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/10/usr.bin/mail/cmd2.c Tue Jul 31 00:37:25 2018 (r336953) @@ -130,9 +130,8 @@ hitit: * so we can discard when the user quits. */ int -save(void *v) +save(char str[]) { - char *str = v; return (save1(str, 1, "save", saveignore)); } @@ -141,9 +140,8 @@ save(void *v) * Copy a message to a file without affected its saved-ness */ int -copycmd(void *v) +copycmd(char str[]) { - char *str = v; return (save1(str, 0, "copy", saveignore)); } Modified: stable/10/usr.bin/mail/cmd3.c ============================================================================== --- stable/10/usr.bin/mail/cmd3.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/10/usr.bin/mail/cmd3.c Tue Jul 31 00:37:25 2018 (r336953) @@ -79,7 +79,7 @@ dosh(char *str __unused) if ((sh = value("SHELL")) == NULL) sh = _PATH_CSHELL; - (void)run_command(sh, 0, -1, -1, NULL); + (void)run_command(sh, 0, -1, -1, NULL, NULL, NULL); (void)signal(SIGINT, sigint); printf("\n"); return (0); @@ -102,7 +102,7 @@ bangexp(char *str, size_t strsize) n = sizeof(bangbuf); while (*cp != '\0') { if (*cp == '!') { - if (n < (int)strlen(lastbang)) { + if (n < strlen(lastbang)) { overf: printf("Command buffer overflow\n"); return (-1); Modified: stable/10/usr.bin/mail/edit.c ============================================================================== --- stable/10/usr.bin/mail/edit.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/10/usr.bin/mail/edit.c Tue Jul 31 00:37:25 2018 (r336953) @@ -180,7 +180,7 @@ run_editor(FILE *fp, off_t size, int type, int readonl nf = NULL; if ((edit = value(type == 'e' ? "EDITOR" : "VISUAL")) == NULL) edit = type == 'e' ? _PATH_EX : _PATH_VI; - if (run_command(edit, 0, -1, -1, tempname, NULL) < 0) { + if (run_command(edit, 0, -1, -1, tempname, NULL, NULL) < 0) { (void)rm(tempname); goto out; } Modified: stable/10/usr.bin/mail/extern.h ============================================================================== --- stable/10/usr.bin/mail/extern.h Tue Jul 31 00:34:39 2018 (r336952) +++ stable/10/usr.bin/mail/extern.h Tue Jul 31 00:37:25 2018 (r336953) @@ -49,7 +49,7 @@ char *copyin(char *, char **); char *detract(struct name *, int); char *expand(char *); char *getdeadletter(void); -char *getname(uid_t); +char *getname(int); char *hfield(const char *, struct message *); FILE *infix(struct header *, FILE *); char *ishfield(char [], char *, const char *); @@ -95,7 +95,7 @@ void collhup(int); void collint(int); void collstop(int); void commands(void); -int copycmd(void *v); +int copycmd(char []); int core(void); int count(struct name *); int delete(int []); @@ -130,7 +130,7 @@ int getfold(char *, int); int gethfield(FILE *, char [], int, char **); int getmsglist(char *, int *, int); int getrawlist(char [], char **, int); -uid_t getuserid(char []); +int getuserid(char []); int grabh(struct header *, int); int group(char **); void hangup(int); @@ -198,8 +198,8 @@ int respond(int *); int retfield(char *[]); int rexit(int); int rm(char *); -int run_command(char *, sigset_t *, int, int, ...); -int save(void *v); +int run_command(char *, sigset_t *, int, int, char *, char *, char *); +int save(char []); int save1(char [], int, const char *, struct ignoretab *); void savedeadletter(FILE *); int saveigfield(char *[]); @@ -223,7 +223,7 @@ void sort(char **); int source(char **); void spreserve(void); void sreset(void); -int start_command(char *, sigset_t *, int, int, ...); +int start_command(char *, sigset_t *, int, int, char *, char *, char *); void statusput(struct message *, FILE *, char *); void stop(int); int stouch(int []); Modified: stable/10/usr.bin/mail/fio.c ============================================================================== --- stable/10/usr.bin/mail/fio.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/10/usr.bin/mail/fio.c Tue Jul 31 00:37:25 2018 (r336953) @@ -235,7 +235,7 @@ makemessage(FILE *f, int omsgCount) size -= (omsgCount + 1) * sizeof(struct message); (void)fflush(f); (void)lseek(fileno(f), (off_t)sizeof(*message), 0); - if (read(fileno(f), (void *)&message[omsgCount], size) != size) + if (read(fileno(f), (char *)&message[omsgCount], size) != size) errx(1, "Message temporary file corrupted"); message[msgCount].m_size = 0; message[msgCount].m_lines = 0; Modified: stable/10/usr.bin/mail/getname.c ============================================================================== --- stable/10/usr.bin/mail/getname.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/10/usr.bin/mail/getname.c Tue Jul 31 00:37:25 2018 (r336953) @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); * Search the passwd file for a uid. Return name on success, NULL on failure. */ char * -getname(uid_t uid) +getname(int uid) { struct passwd *pw; @@ -58,7 +58,7 @@ getname(uid_t uid) * Convert the passed name to a user id and return it. Return -1 * on error. */ -uid_t +int getuserid(char name[]) { struct passwd *pw; Modified: stable/10/usr.bin/mail/popen.c ============================================================================== --- stable/10/usr.bin/mail/popen.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/10/usr.bin/mail/popen.c Tue Jul 31 00:37:25 2018 (r336953) @@ -38,8 +38,6 @@ __FBSDID("$FreeBSD$"); #include "rcv.h" #include #include -#include -#include #include "extern.h" #define READ 0 @@ -48,23 +46,22 @@ __FBSDID("$FreeBSD$"); struct fp { FILE *fp; int pipe; - pid_t pid; + int pid; struct fp *link; }; static struct fp *fp_head; struct child { - pid_t pid; + int pid; char done; char free; int status; struct child *link; }; -static struct child *child, *child_freelist = NULL; - +static struct child *child; +static struct child *findchild(int); static void delchild(struct child *); -static pid_t file_pid(FILE *); -static pid_t start_commandv(char *, sigset_t *, int, int, va_list); +static int file_pid(FILE *); FILE * Fopen(const char *path, const char *mode) @@ -93,7 +90,6 @@ Fdopen(int fd, const char *mode) int Fclose(FILE *fp) { - unregister_file(fp); return (fclose(fp)); } @@ -103,7 +99,7 @@ Popen(char *cmd, const char *mode) { int p[2]; int myside, hisside, fd0, fd1; - pid_t pid; + int pid; sigset_t nset; FILE *fp; @@ -113,15 +109,15 @@ Popen(char *cmd, const char *mode) (void)fcntl(p[WRITE], F_SETFD, 1); if (*mode == 'r') { myside = p[READ]; - hisside = fd0 = fd1 = p[WRITE]; + fd0 = -1; + hisside = fd1 = p[WRITE]; } else { myside = p[WRITE]; hisside = fd0 = p[READ]; fd1 = -1; } (void)sigemptyset(&nset); - pid = start_command(value("SHELL"), &nset, fd0, fd1, "-c", cmd, NULL); - if (pid < 0) { + if ((pid = start_command(cmd, &nset, fd0, fd1, NULL, NULL, NULL)) < 0) { (void)close(p[READ]); (void)close(p[WRITE]); return (NULL); @@ -162,7 +158,7 @@ close_all_files(void) } void -register_file(FILE *fp, int pipe, pid_t pid) +register_file(FILE *fp, int pipe, int pid) { struct fp *fpp; @@ -190,7 +186,7 @@ unregister_file(FILE *fp) /*NOTREACHED*/ } -pid_t +int file_pid(FILE *fp) { struct fp *p; @@ -204,17 +200,30 @@ file_pid(FILE *fp) /* * Run a command without a shell, with optional arguments and splicing - * of stdin (-1 means none) and stdout. The command name can be a sequence - * of words. + * of stdin and stdout. The command name can be a sequence of words. * Signals must be handled by the caller. - * "nset" contains the signals to ignore in the new process. - * SIGINT is enabled unless it's in "nset". + * "Mask" contains the signals to ignore in the new process. + * SIGINT is enabled unless it's in the mask. */ -static pid_t -start_commandv(char *cmd, sigset_t *nset, int infd, int outfd, va_list args) +/*VARARGS4*/ +int +run_command(char *cmd, sigset_t *mask, int infd, int outfd, char *a0, + char *a1, char *a2) { - pid_t pid; + int pid; + if ((pid = start_command(cmd, mask, infd, outfd, a0, a1, a2)) < 0) + return (-1); + return (wait_command(pid)); +} + +/*VARARGS4*/ +int +start_command(char *cmd, sigset_t *mask, int infd, int outfd, char *a0, + char *a1, char *a2) +{ + int pid; + if ((pid = fork()) < 0) { warn("fork"); return (-1); @@ -223,10 +232,11 @@ start_commandv(char *cmd, sigset_t *nset, int infd, in char *argv[100]; int i = getrawlist(cmd, argv, sizeof(argv) / sizeof(*argv)); - while ((argv[i++] = va_arg(args, char *))) - ; - argv[i] = NULL; - prepare_child(nset, infd, outfd); + if ((argv[i++] = a0) != NULL && + (argv[i++] = a1) != NULL && + (argv[i++] = a2) != NULL) + argv[i] = NULL; + prepare_child(mask, infd, outfd); execvp(argv[0], argv); warn("%s", argv[0]); _exit(1); @@ -234,32 +244,6 @@ start_commandv(char *cmd, sigset_t *nset, int infd, in return (pid); } -int -run_command(char *cmd, sigset_t *nset, int infd, int outfd, ...) -{ - pid_t pid; - va_list args; - - va_start(args, outfd); - pid = start_commandv(cmd, nset, infd, outfd, args); - va_end(args); - if (pid < 0) - return -1; - return wait_command(pid); -} - -int -start_command(char *cmd, sigset_t *nset, int infd, int outfd, ...) -{ - va_list args; - int r; - - va_start(args, outfd); - r = start_commandv(cmd, nset, infd, outfd, args); - va_end(args); - return r; -} - void prepare_child(sigset_t *nset, int infd, int outfd) { @@ -284,7 +268,7 @@ prepare_child(sigset_t *nset, int infd, int outfd) } int -wait_command(pid_t pid) +wait_command(int pid) { if (wait_child(pid) < 0) { @@ -295,7 +279,7 @@ wait_command(pid_t pid) } static struct child * -findchild(pid_t pid, int dont_alloc) +findchild(int pid) { struct child **cpp; @@ -303,16 +287,9 @@ findchild(pid_t pid, int dont_alloc) cpp = &(*cpp)->link) ; if (*cpp == NULL) { - if (dont_alloc) - return(NULL); - if (child_freelist) { - *cpp = child_freelist; - child_freelist = (*cpp)->link; - } else { - *cpp = malloc(sizeof(struct child)); - if (*cpp == NULL) - err(1, "malloc"); - } + *cpp = malloc(sizeof(struct child)); + if (*cpp == NULL) + err(1, "Out of memory"); (*cpp)->pid = pid; (*cpp)->done = (*cpp)->free = 0; (*cpp)->link = NULL; @@ -328,22 +305,19 @@ delchild(struct child *cp) for (cpp = &child; *cpp != cp; cpp = &(*cpp)->link) ; *cpp = cp->link; - cp->link = child_freelist; - child_freelist = cp; + (void)free(cp); } /*ARGSUSED*/ void sigchild(int signo __unused) { - pid_t pid; + int pid; int status; struct child *cp; - int save_errno; - save_errno = errno; while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { - cp = findchild(pid, 1); + cp = findchild(pid); if (cp->free) delchild(cp); else { @@ -351,7 +325,6 @@ sigchild(int signo __unused) cp->status = status; } } - errno = save_errno; } int wait_status; @@ -360,51 +333,41 @@ int wait_status; * Wait for a specific child to die. */ int -wait_child(pid_t pid) +wait_child(int pid) { - struct child *cp; sigset_t nset, oset; - pid_t rv = 0; + struct child *cp; (void)sigemptyset(&nset); (void)sigaddset(&nset, SIGCHLD); - (void)sigprocmask(SIG_BLOCK, &nset, &oset); - /* - * If we have not already waited on the pid (via sigchild) - * wait on it now. Otherwise, use the wait status stashed - * by sigchild. - */ - cp = findchild(pid, 1); - if (cp == NULL || !cp->done) - rv = waitpid(pid, &wait_status, 0); - else - wait_status = cp->status; - if (cp != NULL) - delchild(cp); + (void)sigprocmask(SIG_BLOCK, &nset, &oset); + + cp = findchild(pid); + + while (!cp->done) + (void)sigsuspend(&oset); + wait_status = cp->status; + delchild(cp); (void)sigprocmask(SIG_SETMASK, &oset, NULL); - if (rv == -1 || (WIFEXITED(wait_status) && WEXITSTATUS(wait_status))) - return -1; - else - return 0; + return ((WIFEXITED(wait_status) && WEXITSTATUS(wait_status)) ? -1 : 0); } /* * Mark a child as don't care. */ void -free_child(pid_t pid) +free_child(int pid) { - struct child *cp; sigset_t nset, oset; + struct child *cp = findchild(pid); (void)sigemptyset(&nset); (void)sigaddset(&nset, SIGCHLD); - (void)sigprocmask(SIG_BLOCK, &nset, &oset); - if ((cp = findchild(pid, 0)) != NULL) { - if (cp->done) - delchild(cp); - else - cp->free = 1; - } + (void)sigprocmask(SIG_BLOCK, &nset, &oset); + + if (cp->done) + delchild(cp); + else + cp->free = 1; (void)sigprocmask(SIG_SETMASK, &oset, NULL); } From owner-svn-src-stable@freebsd.org Tue Jul 31 00:37:29 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7674510663FD; Tue, 31 Jul 2018 00:37:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2752F8F2A5; Tue, 31 Jul 2018 00:37:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E10A543DE; Tue, 31 Jul 2018 00:37:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6V0bSOY099940; Tue, 31 Jul 2018 00:37:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6V0bRwX099930; Tue, 31 Jul 2018 00:37:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807310037.w6V0bRwX099930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 31 Jul 2018 00:37:27 +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: r336953 - in stable: 10/usr.bin/mail 11/usr.bin/mail X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable: 10/usr.bin/mail 11/usr.bin/mail X-SVN-Commit-Revision: 336953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 31 Jul 2018 00:37:29 -0000 Author: markj Date: Tue Jul 31 00:37:25 2018 New Revision: 336953 URL: https://svnweb.freebsd.org/changeset/base/336953 Log: Revert r335693, r335694, r335695 by eadler. They cause mail(1) to crash in certain scenarios. PR: 230196 Reported by: Pete French Modified: stable/11/usr.bin/mail/cmd1.c stable/11/usr.bin/mail/cmd2.c stable/11/usr.bin/mail/cmd3.c stable/11/usr.bin/mail/edit.c stable/11/usr.bin/mail/extern.h stable/11/usr.bin/mail/fio.c stable/11/usr.bin/mail/getname.c stable/11/usr.bin/mail/popen.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/usr.bin/mail/cmd1.c stable/10/usr.bin/mail/cmd2.c stable/10/usr.bin/mail/cmd3.c stable/10/usr.bin/mail/edit.c stable/10/usr.bin/mail/extern.h stable/10/usr.bin/mail/fio.c stable/10/usr.bin/mail/getname.c stable/10/usr.bin/mail/popen.c Directory Properties: stable/10/ (props changed) Modified: stable/11/usr.bin/mail/cmd1.c ============================================================================== --- stable/11/usr.bin/mail/cmd1.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/11/usr.bin/mail/cmd1.c Tue Jul 31 00:37:25 2018 (r336953) @@ -439,7 +439,7 @@ folders(void) } if ((cmd = value("LISTER")) == NULL) cmd = "ls"; - (void)run_command(cmd, 0, -1, -1, dirname, NULL); + (void)run_command(cmd, 0, -1, -1, dirname, NULL, NULL); return (0); } Modified: stable/11/usr.bin/mail/cmd2.c ============================================================================== --- stable/11/usr.bin/mail/cmd2.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/11/usr.bin/mail/cmd2.c Tue Jul 31 00:37:25 2018 (r336953) @@ -130,9 +130,8 @@ hitit: * so we can discard when the user quits. */ int -save(void *v) +save(char str[]) { - char *str = v; return (save1(str, 1, "save", saveignore)); } @@ -141,9 +140,8 @@ save(void *v) * Copy a message to a file without affected its saved-ness */ int -copycmd(void *v) +copycmd(char str[]) { - char *str = v; return (save1(str, 0, "copy", saveignore)); } Modified: stable/11/usr.bin/mail/cmd3.c ============================================================================== --- stable/11/usr.bin/mail/cmd3.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/11/usr.bin/mail/cmd3.c Tue Jul 31 00:37:25 2018 (r336953) @@ -79,7 +79,7 @@ dosh(char *str __unused) if ((sh = value("SHELL")) == NULL) sh = _PATH_CSHELL; - (void)run_command(sh, 0, -1, -1, NULL); + (void)run_command(sh, 0, -1, -1, NULL, NULL, NULL); (void)signal(SIGINT, sigint); printf("\n"); return (0); @@ -102,7 +102,7 @@ bangexp(char *str, size_t strsize) n = sizeof(bangbuf); while (*cp != '\0') { if (*cp == '!') { - if (n < (int)strlen(lastbang)) { + if (n < strlen(lastbang)) { overf: printf("Command buffer overflow\n"); return (-1); Modified: stable/11/usr.bin/mail/edit.c ============================================================================== --- stable/11/usr.bin/mail/edit.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/11/usr.bin/mail/edit.c Tue Jul 31 00:37:25 2018 (r336953) @@ -180,7 +180,7 @@ run_editor(FILE *fp, off_t size, int type, int readonl nf = NULL; if ((edit = value(type == 'e' ? "EDITOR" : "VISUAL")) == NULL) edit = type == 'e' ? _PATH_EX : _PATH_VI; - if (run_command(edit, 0, -1, -1, tempname, NULL) < 0) { + if (run_command(edit, 0, -1, -1, tempname, NULL, NULL) < 0) { (void)rm(tempname); goto out; } Modified: stable/11/usr.bin/mail/extern.h ============================================================================== --- stable/11/usr.bin/mail/extern.h Tue Jul 31 00:34:39 2018 (r336952) +++ stable/11/usr.bin/mail/extern.h Tue Jul 31 00:37:25 2018 (r336953) @@ -49,7 +49,7 @@ char *copyin(char *, char **); char *detract(struct name *, int); char *expand(char *); char *getdeadletter(void); -char *getname(uid_t); +char *getname(int); char *hfield(const char *, struct message *); FILE *infix(struct header *, FILE *); char *ishfield(char [], char *, const char *); @@ -95,7 +95,7 @@ void collhup(int); void collint(int); void collstop(int); void commands(void); -int copycmd(void *v); +int copycmd(char []); int core(void); int count(struct name *); int delete(int []); @@ -130,7 +130,7 @@ int getfold(char *, int); int gethfield(FILE *, char [], int, char **); int getmsglist(char *, int *, int); int getrawlist(char [], char **, int); -uid_t getuserid(char []); +int getuserid(char []); int grabh(struct header *, int); int group(char **); void hangup(int); @@ -198,8 +198,8 @@ int respond(int *); int retfield(char *[]); int rexit(int); int rm(char *); -int run_command(char *, sigset_t *, int, int, ...); -int save(void *v); +int run_command(char *, sigset_t *, int, int, char *, char *, char *); +int save(char []); int save1(char [], int, const char *, struct ignoretab *); void savedeadletter(FILE *); int saveigfield(char *[]); @@ -223,7 +223,7 @@ void sort(char **); int source(char **); void spreserve(void); void sreset(void); -int start_command(char *, sigset_t *, int, int, ...); +int start_command(char *, sigset_t *, int, int, char *, char *, char *); void statusput(struct message *, FILE *, char *); void stop(int); int stouch(int []); Modified: stable/11/usr.bin/mail/fio.c ============================================================================== --- stable/11/usr.bin/mail/fio.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/11/usr.bin/mail/fio.c Tue Jul 31 00:37:25 2018 (r336953) @@ -235,7 +235,7 @@ makemessage(FILE *f, int omsgCount) size -= (omsgCount + 1) * sizeof(struct message); (void)fflush(f); (void)lseek(fileno(f), (off_t)sizeof(*message), 0); - if (read(fileno(f), (void *)&message[omsgCount], size) != size) + if (read(fileno(f), (char *)&message[omsgCount], size) != size) errx(1, "Message temporary file corrupted"); message[msgCount].m_size = 0; message[msgCount].m_lines = 0; Modified: stable/11/usr.bin/mail/getname.c ============================================================================== --- stable/11/usr.bin/mail/getname.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/11/usr.bin/mail/getname.c Tue Jul 31 00:37:25 2018 (r336953) @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); * Search the passwd file for a uid. Return name on success, NULL on failure. */ char * -getname(uid_t uid) +getname(int uid) { struct passwd *pw; @@ -58,7 +58,7 @@ getname(uid_t uid) * Convert the passed name to a user id and return it. Return -1 * on error. */ -uid_t +int getuserid(char name[]) { struct passwd *pw; Modified: stable/11/usr.bin/mail/popen.c ============================================================================== --- stable/11/usr.bin/mail/popen.c Tue Jul 31 00:34:39 2018 (r336952) +++ stable/11/usr.bin/mail/popen.c Tue Jul 31 00:37:25 2018 (r336953) @@ -38,8 +38,6 @@ __FBSDID("$FreeBSD$"); #include "rcv.h" #include #include -#include -#include #include "extern.h" #define READ 0 @@ -48,23 +46,22 @@ __FBSDID("$FreeBSD$"); struct fp { FILE *fp; int pipe; - pid_t pid; + int pid; struct fp *link; }; static struct fp *fp_head; struct child { - pid_t pid; + int pid; char done; char free; int status; struct child *link; }; -static struct child *child, *child_freelist = NULL; - +static struct child *child; +static struct child *findchild(int); static void delchild(struct child *); -static pid_t file_pid(FILE *); -static pid_t start_commandv(char *, sigset_t *, int, int, va_list); +static int file_pid(FILE *); FILE * Fopen(const char *path, const char *mode) @@ -93,7 +90,6 @@ Fdopen(int fd, const char *mode) int Fclose(FILE *fp) { - unregister_file(fp); return (fclose(fp)); } @@ -103,7 +99,7 @@ Popen(char *cmd, const char *mode) { int p[2]; int myside, hisside, fd0, fd1; - pid_t pid; + int pid; sigset_t nset; FILE *fp; @@ -113,15 +109,15 @@ Popen(char *cmd, const char *mode) (void)fcntl(p[WRITE], F_SETFD, 1); if (*mode == 'r') { myside = p[READ]; - hisside = fd0 = fd1 = p[WRITE]; + fd0 = -1; + hisside = fd1 = p[WRITE]; } else { myside = p[WRITE]; hisside = fd0 = p[READ]; fd1 = -1; } (void)sigemptyset(&nset); - pid = start_command(value("SHELL"), &nset, fd0, fd1, "-c", cmd, NULL); - if (pid < 0) { + if ((pid = start_command(cmd, &nset, fd0, fd1, NULL, NULL, NULL)) < 0) { (void)close(p[READ]); (void)close(p[WRITE]); return (NULL); @@ -162,7 +158,7 @@ close_all_files(void) } void -register_file(FILE *fp, int pipe, pid_t pid) +register_file(FILE *fp, int pipe, int pid) { struct fp *fpp; @@ -190,7 +186,7 @@ unregister_file(FILE *fp) /*NOTREACHED*/ } -pid_t +int file_pid(FILE *fp) { struct fp *p; @@ -204,17 +200,30 @@ file_pid(FILE *fp) /* * Run a command without a shell, with optional arguments and splicing - * of stdin (-1 means none) and stdout. The command name can be a sequence - * of words. + * of stdin and stdout. The command name can be a sequence of words. * Signals must be handled by the caller. - * "nset" contains the signals to ignore in the new process. - * SIGINT is enabled unless it's in "nset". + * "Mask" contains the signals to ignore in the new process. + * SIGINT is enabled unless it's in the mask. */ -static pid_t -start_commandv(char *cmd, sigset_t *nset, int infd, int outfd, va_list args) +/*VARARGS4*/ +int +run_command(char *cmd, sigset_t *mask, int infd, int outfd, char *a0, + char *a1, char *a2) { - pid_t pid; + int pid; + if ((pid = start_command(cmd, mask, infd, outfd, a0, a1, a2)) < 0) + return (-1); + return (wait_command(pid)); +} + +/*VARARGS4*/ +int +start_command(char *cmd, sigset_t *mask, int infd, int outfd, char *a0, + char *a1, char *a2) +{ + int pid; + if ((pid = fork()) < 0) { warn("fork"); return (-1); @@ -223,10 +232,11 @@ start_commandv(char *cmd, sigset_t *nset, int infd, in char *argv[100]; int i = getrawlist(cmd, argv, sizeof(argv) / sizeof(*argv)); - while ((argv[i++] = va_arg(args, char *))) - ; - argv[i] = NULL; - prepare_child(nset, infd, outfd); + if ((argv[i++] = a0) != NULL && + (argv[i++] = a1) != NULL && + (argv[i++] = a2) != NULL) + argv[i] = NULL; + prepare_child(mask, infd, outfd); execvp(argv[0], argv); warn("%s", argv[0]); _exit(1); @@ -234,32 +244,6 @@ start_commandv(char *cmd, sigset_t *nset, int infd, in return (pid); } -int -run_command(char *cmd, sigset_t *nset, int infd, int outfd, ...) -{ - pid_t pid; - va_list args; - - va_start(args, outfd); - pid = start_commandv(cmd, nset, infd, outfd, args); - va_end(args); - if (pid < 0) - return -1; - return wait_command(pid); -} - -int -start_command(char *cmd, sigset_t *nset, int infd, int outfd, ...) -{ - va_list args; - int r; - - va_start(args, outfd); - r = start_commandv(cmd, nset, infd, outfd, args); - va_end(args); - return r; -} - void prepare_child(sigset_t *nset, int infd, int outfd) { @@ -284,7 +268,7 @@ prepare_child(sigset_t *nset, int infd, int outfd) } int -wait_command(pid_t pid) +wait_command(int pid) { if (wait_child(pid) < 0) { @@ -295,7 +279,7 @@ wait_command(pid_t pid) } static struct child * -findchild(pid_t pid, int dont_alloc) +findchild(int pid) { struct child **cpp; @@ -303,16 +287,9 @@ findchild(pid_t pid, int dont_alloc) cpp = &(*cpp)->link) ; if (*cpp == NULL) { - if (dont_alloc) - return(NULL); - if (child_freelist) { - *cpp = child_freelist; - child_freelist = (*cpp)->link; - } else { - *cpp = malloc(sizeof(struct child)); - if (*cpp == NULL) - err(1, "malloc"); - } + *cpp = malloc(sizeof(struct child)); + if (*cpp == NULL) + err(1, "Out of memory"); (*cpp)->pid = pid; (*cpp)->done = (*cpp)->free = 0; (*cpp)->link = NULL; @@ -328,22 +305,19 @@ delchild(struct child *cp) for (cpp = &child; *cpp != cp; cpp = &(*cpp)->link) ; *cpp = cp->link; - cp->link = child_freelist; - child_freelist = cp; + (void)free(cp); } /*ARGSUSED*/ void sigchild(int signo __unused) { - pid_t pid; + int pid; int status; struct child *cp; - int save_errno; - save_errno = errno; while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { - cp = findchild(pid, 1); + cp = findchild(pid); if (cp->free) delchild(cp); else { @@ -351,7 +325,6 @@ sigchild(int signo __unused) cp->status = status; } } - errno = save_errno; } int wait_status; @@ -360,51 +333,41 @@ int wait_status; * Wait for a specific child to die. */ int -wait_child(pid_t pid) +wait_child(int pid) { - struct child *cp; sigset_t nset, oset; - pid_t rv = 0; + struct child *cp; (void)sigemptyset(&nset); (void)sigaddset(&nset, SIGCHLD); - (void)sigprocmask(SIG_BLOCK, &nset, &oset); - /* - * If we have not already waited on the pid (via sigchild) - * wait on it now. Otherwise, use the wait status stashed - * by sigchild. - */ - cp = findchild(pid, 1); - if (cp == NULL || !cp->done) - rv = waitpid(pid, &wait_status, 0); - else - wait_status = cp->status; - if (cp != NULL) - delchild(cp); + (void)sigprocmask(SIG_BLOCK, &nset, &oset); + + cp = findchild(pid); + + while (!cp->done) + (void)sigsuspend(&oset); + wait_status = cp->status; + delchild(cp); (void)sigprocmask(SIG_SETMASK, &oset, NULL); - if (rv == -1 || (WIFEXITED(wait_status) && WEXITSTATUS(wait_status))) - return -1; - else - return 0; + return ((WIFEXITED(wait_status) && WEXITSTATUS(wait_status)) ? -1 : 0); } /* * Mark a child as don't care. */ void -free_child(pid_t pid) +free_child(int pid) { - struct child *cp; sigset_t nset, oset; + struct child *cp = findchild(pid); (void)sigemptyset(&nset); (void)sigaddset(&nset, SIGCHLD); - (void)sigprocmask(SIG_BLOCK, &nset, &oset); - if ((cp = findchild(pid, 0)) != NULL) { - if (cp->done) - delchild(cp); - else - cp->free = 1; - } + (void)sigprocmask(SIG_BLOCK, &nset, &oset); + + if (cp->done) + delchild(cp); + else + cp->free = 1; (void)sigprocmask(SIG_SETMASK, &oset, NULL); } From owner-svn-src-stable@freebsd.org Tue Jul 31 05:28:01 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6412E104E1EF for ; Tue, 31 Jul 2018 05:28:01 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D117E79EC4 for ; Tue, 31 Jul 2018 05:28:00 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from mail-yb0-f169.google.com (mail-yb0-f169.google.com [209.85.213.169]) (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)) (Authenticated sender: eadler) by smtp.freebsd.org (Postfix) with ESMTPSA id 6D58810B20 for ; Tue, 31 Jul 2018 05:28:00 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: by mail-yb0-f169.google.com with SMTP id c3-v6so5685832ybi.13 for ; Mon, 30 Jul 2018 22:28:00 -0700 (PDT) X-Gm-Message-State: AOUpUlHdnPnnG+G0cl/cWGfSBxevx16/HM1JSsuiDNq5jKbJXTamfpo1 x+kRPCP676/CcOJov0+GCZo+MaBSZ9ynHgDhRtw8+w== X-Google-Smtp-Source: AAOMgpdC9iOSKC89nDEQE9hGUjdBon1/ltAxc4E87grs2TrjoPddrW9s4+IW7Jxvj/K8F/0glZJvd6eHrNTA+dFstxE= X-Received: by 2002:a25:4546:: with SMTP id s67-v6mr10971845yba.89.1533014879723; Mon, 30 Jul 2018 22:27:59 -0700 (PDT) MIME-Version: 1.0 References: <201807280737.w6S7b12F025452@repo.freebsd.org> <20180728233405.GD40119@kib.kiev.ua> In-Reply-To: From: Eitan Adler Date: Mon, 30 Jul 2018 22:27:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r336805 - in stable/11: share/man/man4 sys/dev/vt/hw/vga To: John Baldwin Cc: Kostik Belousov , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 31 Jul 2018 05:28:01 -0000 On Mon, 30 Jul 2018 at 15:38, John Baldwin wrote: > > On 7/28/18 10:12 PM, Eitan Adler wrote: > > On Sat, 28 Jul 2018 at 16:34, Konstantin Belousov wrote: > >> > >> On Sat, Jul 28, 2018 at 07:37:01AM +0000, Eitan Adler wrote: > >>> Author: eadler > >>> Date: Sat Jul 28 07:37:01 2018 > >>> New Revision: 336805 > >>> URL: https://svnweb.freebsd.org/changeset/base/336805 > >>> > >>> Log: > >>> MFC r335629: > >>> > >>> vt: add option to ignore NO_VGA flag in ACPI > >>> > >>> To workaround buggy firmware that sets this flag when there's actually > >>> a VGA present. > >>> > >>> Ref D16003 > >>> PR: 229235 > >>> > >>> Modified: > >>> stable/11/share/man/man4/vt.4 > >>> stable/11/sys/dev/vt/hw/vga/vt_vga.c > >>> Directory Properties: > >>> stable/11/ (props changed) > >>> > >>> Modified: stable/11/share/man/man4/vt.4 > >>> ============================================================================== > >>> --- stable/11/share/man/man4/vt.4 Sat Jul 28 06:46:10 2018 (r336804) > >>> +++ stable/11/share/man/man4/vt.4 Sat Jul 28 07:37:01 2018 (r336805) > >>> @@ -44,6 +44,7 @@ > >>> In > >>> .Xr loader.conf 5 : > >>> .Cd hw.vga.textmode=1 > >>> +.Cd hw.vga.acpi_ignore_no_vga=1 > >>> .Cd kern.vty=vt > >>> .Cd kern.vt.color..rgb="" > >>> .Cd kern.vt.fb.default_mode="x" > >>> @@ -196,6 +197,10 @@ prompt or in > >>> Set to 1 to use virtual terminals in text mode instead of graphics mode. > >>> Features that require graphics mode, like loadable fonts, will be > >>> disabled. > >>> +.It Va hw.vga.acpi_ignore_no_vga > >>> +Set to 1 to force the usage of the VGA driver regardless of whether > >>> +ACPI IAPC_BOOT_ARCH signals no VGA support. > >>> +Can be used to workaround firmware bugs in the ACPI tables. > >>> .It Va kern.vty > >>> Set this value to > >>> .Ql vt > >>> > >>> Modified: stable/11/sys/dev/vt/hw/vga/vt_vga.c > >>> ============================================================================== > >>> --- stable/11/sys/dev/vt/hw/vga/vt_vga.c Sat Jul 28 06:46:10 2018 (r336804) > >>> +++ stable/11/sys/dev/vt/hw/vga/vt_vga.c Sat Jul 28 07:37:01 2018 (r336805) > >>> @@ -1211,6 +1211,12 @@ vga_acpi_disabled(void) > >>> ACPI_TABLE_FADT *fadt; > >>> vm_paddr_t physaddr; > >>> uint16_t flags; > >>> + int ignore; > >>> + > >>> + TUNABLE_INT_FETCH("hw.vga.acpi_ignore_no_vga", &ignore); > >>> + > >>> + if (ignore) > >>> + return (false); > > > >> If the tunable is not set, this code evaluates the stack garbage. > >> Why did you merged this without asking the author and not looking > >> at the followups ? > > > > Please assume some level of good faith. > > > > I MFCed this because I was asked to here > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229235 over a month > > ago. During that time no one mentioned or linked any followups. I did > > look in my email for mentions of r335629 as well - of which there are > > none. > > > > Now that you mention it, I looked at the svn log and found r335631 > > which I will MFC as well. > > If MFC'ing a change by another developer you should proactively look at > the svn logs of the changed files to see if there are follow up fixes. I did this, but looked by bug ID and by revision ID. Could I have found r335631 if I had looked at svn logs too? yes. Is it appropriate to say I did not look for followups? no Anyways, -stable is good now so this is my last response to the thread. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-stable@freebsd.org Tue Jul 31 05:47:59 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BACC0104E832 for ; Tue, 31 Jul 2018 05:47:59 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-yw0-x22d.google.com (mail-yw0-x22d.google.com [IPv6:2607:f8b0:4002:c05::22d]) (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 5106B7A7F3 for ; Tue, 31 Jul 2018 05:47:59 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: by mail-yw0-x22d.google.com with SMTP id w76-v6so5323228ywg.4 for ; Mon, 30 Jul 2018 22:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LqBDm/Qi3WGCXfWk/yXj+CRNPQJyzI5X66Um0p0OwwE=; b=hhoP6cZ2BywzKluxNNW1daoSVevKKoUY/ZlBjWRlf3YQHxO6L4fVCyMIULK9EJvR+h 2o9hRcwpqNfw+U1H8o3Yc87PjVrdj6Kdzg+EnCqXfJG6gCGD8lq3XjxjeLFBw6P5k9ed 6kQ2YCGMGfv4Y9JHQfKeDj3FYK4lTd+W1VIag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LqBDm/Qi3WGCXfWk/yXj+CRNPQJyzI5X66Um0p0OwwE=; b=C6y68LhuoqIl97mCcJaUe9/n3m1eXHBpLGtk+y8KevajGNqBXoi0r1DM6phBkK8tSl Wk5lqMqy44xGc4cPpMUCqKFNgTn4Oi0lHAdrpLMiRIFobVZ/Ngy8l2zGsFxkOIhggUkr ecThqjNO4Eji1RLa0V9F58kqful7mMOLAF6+Uql7aJVwpfC1BfBWrki1tSJTOnlApovb xVJRUjgQ6IkfUQMIgEwPSqddBB68cTH/VR2KzHxTRxFGkKrxlN/kg9O3s7Lva7VUG/eU wexscTwXraLGeXPzaJz0n0ki+a0QuqHZVEIf17M760LN6Wdq+24DSl/agRZJgkZuNyXC MobA== X-Gm-Message-State: AOUpUlH7WO1lg8J5O8S4kz0s4VKNq0z2C8BOi3rjNd05P0ldP1ZB3Rif 0uT0aZiIivBL039U6nO4yGDExE9YN8e+kXCPovGiVA== X-Google-Smtp-Source: AAOMgpe2em9BOKIIdKjlP9XgwJs3+iZj1+2yXjW1BlDaZKWfB6qbCnuhl/SYvbk2AVjvkEkVG+07uCoidPiijaU90YI= X-Received: by 2002:a81:af06:: with SMTP id n6-v6mr10266126ywh.113.1533016078553; Mon, 30 Jul 2018 22:47:58 -0700 (PDT) MIME-Version: 1.0 References: <201807310037.w6V0bPlm099916@repo.freebsd.org> In-Reply-To: <201807310037.w6V0bPlm099916@repo.freebsd.org> From: Eitan Adler Date: Mon, 30 Jul 2018 22:47:30 -0700 Message-ID: Subject: Re: svn commit: r336953 - in stable: 10/usr.bin/mail 11/usr.bin/mail To: Mark Johnston Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 31 Jul 2018 05:47:59 -0000 On Mon, 30 Jul 2018 at 17:37, Mark Johnston wrote: > > Author: markj > Date: Tue Jul 31 00:37:25 2018 > New Revision: 336953 > URL: https://svnweb.freebsd.org/changeset/base/336953 > > Log: > Revert r335693, r335694, r335695 by eadler. > > They cause mail(1) to crash in certain scenarios. Thanks! I was going to do this myself shortly. -- Eitan Adler From owner-svn-src-stable@freebsd.org Tue Jul 31 10:18:32 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BCB91054BFB; Tue, 31 Jul 2018 10:18:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3135A83411; Tue, 31 Jul 2018 10:18:32 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 136C1124D1; Tue, 31 Jul 2018 10:18:32 +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 w6VAIVw8098801; Tue, 31 Jul 2018 10:18:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6VAIVeW098798; Tue, 31 Jul 2018 10:18:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201807311018.w6VAIVeW098798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 31 Jul 2018 10:18:31 +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: r336963 - in stable/11/sys: amd64/amd64 i386/i386 i386/isa X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 i386/isa X-SVN-Commit-Revision: 336963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 31 Jul 2018 10:18:32 -0000 Author: kib Date: Tue Jul 31 10:18:30 2018 New Revision: 336963 URL: https://svnweb.freebsd.org/changeset/base/336963 Log: MFC r336683: Extend ranges of the critical sections to ensure that context switch code never sees FPU pcb flags not consistent with the hardware state. Modified: stable/11/sys/amd64/amd64/fpu.c stable/11/sys/amd64/amd64/machdep.c stable/11/sys/i386/i386/machdep.c stable/11/sys/i386/isa/npx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/fpu.c ============================================================================== --- stable/11/sys/amd64/amd64/fpu.c Tue Jul 31 06:27:05 2018 (r336962) +++ stable/11/sys/amd64/amd64/fpu.c Tue Jul 31 10:18:30 2018 (r336963) @@ -744,22 +744,22 @@ fpugetregs(struct thread *td) int max_ext_n, i, owned; pcb = td->td_pcb; + critical_enter(); if ((pcb->pcb_flags & PCB_USERFPUINITDONE) == 0) { bcopy(fpu_initialstate, get_pcb_user_save_pcb(pcb), cpu_max_ext_state_size); get_pcb_user_save_pcb(pcb)->sv_env.en_cw = pcb->pcb_initial_fpucw; fpuuserinited(td); + critical_exit(); return (_MC_FPOWNED_PCB); } - critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { fpusave(get_pcb_user_save_pcb(pcb)); owned = _MC_FPOWNED_FPU; } else { owned = _MC_FPOWNED_PCB; } - critical_exit(); if (use_xsave) { /* * Handle partially saved state. @@ -779,6 +779,7 @@ fpugetregs(struct thread *td) *xstate_bv |= bit; } } + critical_exit(); return (owned); } @@ -787,6 +788,7 @@ fpuuserinited(struct thread *td) { struct pcb *pcb; + CRITICAL_ASSERT(td); pcb = td->td_pcb; if (PCB_USER_FPU(pcb)) set_pcb_flags(pcb, @@ -845,26 +847,25 @@ fpusetregs(struct thread *td, struct savefpu *addr, ch addr->sv_env.en_mxcsr &= cpu_mxcsr_mask; pcb = td->td_pcb; + error = 0; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { error = fpusetxstate(td, xfpustate, xfpustate_size); - if (error != 0) { - critical_exit(); - return (error); + if (error == 0) { + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); + fpurestore(get_pcb_user_save_td(td)); + set_pcb_flags(pcb, PCB_FPUINITDONE | + PCB_USERFPUINITDONE); } - bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); - fpurestore(get_pcb_user_save_td(td)); - critical_exit(); - set_pcb_flags(pcb, PCB_FPUINITDONE | PCB_USERFPUINITDONE); } else { - critical_exit(); error = fpusetxstate(td, xfpustate, xfpustate_size); - if (error != 0) - return (error); - bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); - fpuuserinited(td); + if (error == 0) { + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); + fpuuserinited(td); + } } - return (0); + critical_exit(); + return (error); } /* @@ -1037,6 +1038,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx ctx->flags = FPU_KERN_CTX_DUMMY | FPU_KERN_CTX_INUSE; return (0); } + critical_enter(); KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == get_pcb_user_save_pcb(pcb), ("mangled pcb_save")); ctx->flags = FPU_KERN_CTX_INUSE; @@ -1047,6 +1049,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx pcb->pcb_save = fpu_kern_ctx_savefpu(ctx); set_pcb_flags(pcb, PCB_KERNFPU); clear_pcb_flags(pcb, PCB_FPUINITDONE); + critical_exit(); return (0); } @@ -1065,7 +1068,6 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx clear_pcb_flags(pcb, PCB_FPUNOSAVE | PCB_FPUINITDONE); start_emulating(); - critical_exit(); } else { KASSERT((ctx->flags & FPU_KERN_CTX_INUSE) != 0, ("leaving not inuse ctx")); @@ -1079,7 +1081,6 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx critical_enter(); if (curthread == PCPU_GET(fpcurthread)) fpudrop(); - critical_exit(); pcb->pcb_save = ctx->prev; } @@ -1096,6 +1097,7 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx clear_pcb_flags(pcb, PCB_FPUINITDONE); KASSERT(!PCB_USER_FPU(pcb), ("unpaired fpu_kern_leave")); } + critical_exit(); return (0); } Modified: stable/11/sys/amd64/amd64/machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/machdep.c Tue Jul 31 06:27:05 2018 (r336962) +++ stable/11/sys/amd64/amd64/machdep.c Tue Jul 31 10:18:30 2018 (r336963) @@ -2158,8 +2158,10 @@ int set_fpregs(struct thread *td, struct fpreg *fpregs) { + critical_enter(); set_fpregs_xmm(fpregs, get_pcb_user_save_td(td)); fpuuserinited(td); + critical_exit(); return (0); } Modified: stable/11/sys/i386/i386/machdep.c ============================================================================== --- stable/11/sys/i386/i386/machdep.c Tue Jul 31 06:27:05 2018 (r336962) +++ stable/11/sys/i386/i386/machdep.c Tue Jul 31 10:18:30 2018 (r336963) @@ -3004,6 +3004,7 @@ int set_fpregs(struct thread *td, struct fpreg *fpregs) { + critical_enter(); if (cpu_fxsr) npx_set_fpregs_xmm((struct save87 *)fpregs, &get_pcb_user_save_td(td)->sv_xmm); @@ -3011,6 +3012,7 @@ set_fpregs(struct thread *td, struct fpreg *fpregs) bcopy(fpregs, &get_pcb_user_save_td(td)->sv_87, sizeof(*fpregs)); npxuserinited(td); + critical_exit(); return (0); } Modified: stable/11/sys/i386/isa/npx.c ============================================================================== --- stable/11/sys/i386/isa/npx.c Tue Jul 31 06:27:05 2018 (r336962) +++ stable/11/sys/i386/isa/npx.c Tue Jul 31 10:18:30 2018 (r336963) @@ -974,14 +974,15 @@ npxgetregs(struct thread *td) return (_MC_FPOWNED_NONE); pcb = td->td_pcb; + critical_enter(); if ((pcb->pcb_flags & PCB_NPXINITDONE) == 0) { bcopy(npx_initialstate, get_pcb_user_save_pcb(pcb), cpu_max_ext_state_size); SET_FPU_CW(get_pcb_user_save_pcb(pcb), pcb->pcb_initial_npxcw); npxuserinited(td); + critical_exit(); return (_MC_FPOWNED_PCB); } - critical_enter(); if (td == PCPU_GET(fpcurthread)) { fpusave(get_pcb_user_save_pcb(pcb)); if (!cpu_fxsr) @@ -995,7 +996,6 @@ npxgetregs(struct thread *td) } else { owned = _MC_FPOWNED_PCB; } - critical_exit(); if (use_xsave) { /* * Handle partially saved state. @@ -1018,6 +1018,7 @@ npxgetregs(struct thread *td) *xstate_bv |= bit; } } + critical_exit(); return (owned); } @@ -1026,6 +1027,7 @@ npxuserinited(struct thread *td) { struct pcb *pcb; + CRITICAL_ASSERT(td); pcb = td->td_pcb; if (PCB_USER_FPU(pcb)) pcb->pcb_flags |= PCB_NPXINITDONE; @@ -1083,28 +1085,26 @@ npxsetregs(struct thread *td, union savefpu *addr, cha if (cpu_fxsr) addr->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; pcb = td->td_pcb; + error = 0; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { error = npxsetxstate(td, xfpustate, xfpustate_size); - if (error != 0) { - critical_exit(); - return (error); + if (error == 0) { + if (!cpu_fxsr) + fnclex(); /* As in npxdrop(). */ + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); + fpurstor(get_pcb_user_save_td(td)); + pcb->pcb_flags |= PCB_NPXUSERINITDONE | PCB_NPXINITDONE; } - if (!cpu_fxsr) - fnclex(); /* As in npxdrop(). */ - bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); - fpurstor(get_pcb_user_save_td(td)); - critical_exit(); - pcb->pcb_flags |= PCB_NPXUSERINITDONE | PCB_NPXINITDONE; } else { - critical_exit(); error = npxsetxstate(td, xfpustate, xfpustate_size); - if (error != 0) - return (error); - bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); - npxuserinited(td); + if (error == 0) { + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); + npxuserinited(td); + } } - return (0); + critical_exit(); + return (error); } static void @@ -1373,6 +1373,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx return (0); } pcb = td->td_pcb; + critical_enter(); KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == get_pcb_user_save_pcb(pcb), ("mangled pcb_save")); ctx->flags = FPU_KERN_CTX_INUSE; @@ -1383,6 +1384,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx pcb->pcb_save = fpu_kern_ctx_savefpu(ctx); pcb->pcb_flags |= PCB_KERNNPX; pcb->pcb_flags &= ~PCB_NPXINITDONE; + critical_exit(); return (0); } @@ -1401,7 +1403,6 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx critical_enter(); if (curthread == PCPU_GET(fpcurthread)) npxdrop(); - critical_exit(); pcb->pcb_save = ctx->prev; if (pcb->pcb_save == get_pcb_user_save_pcb(pcb)) { if ((pcb->pcb_flags & PCB_NPXUSERINITDONE) != 0) @@ -1416,6 +1417,7 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx pcb->pcb_flags &= ~PCB_NPXINITDONE; KASSERT(!PCB_USER_FPU(pcb), ("unpaired fpu_kern_leave")); } + critical_exit(); return (0); } From owner-svn-src-stable@freebsd.org Tue Jul 31 13:32:37 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD044105A84F; Tue, 31 Jul 2018 13:32:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F90C8B2B6; Tue, 31 Jul 2018 13:32:37 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71632144F2; Tue, 31 Jul 2018 13:32:37 +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 w6VDWbNB001096; Tue, 31 Jul 2018 13:32:37 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6VDWbBH001094; Tue, 31 Jul 2018 13:32:37 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201807311332.w6VDWbBH001094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 31 Jul 2018 13:32:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r336968 - stable/11/release/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/arm X-SVN-Commit-Revision: 336968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 31 Jul 2018 13:32:38 -0000 Author: gjb Date: Tue Jul 31 13:32:36 2018 New Revision: 336968 URL: https://svnweb.freebsd.org/changeset/base/336968 Log: MFC r336721, r336750 [1]: r336721 (manu): Add OL_DIR forgot in r336600. r336750: Fix OL_DIR definition following r336721. [1] These commits were stated to have been merged in r336726, however are not present in context nor svn:mergeinfo. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/arm/RPI-B.conf stable/11/release/arm/RPI2.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/release/arm/RPI-B.conf ============================================================================== --- stable/11/release/arm/RPI-B.conf Tue Jul 31 12:53:27 2018 (r336967) +++ stable/11/release/arm/RPI-B.conf Tue Jul 31 13:32:36 2018 (r336968) @@ -13,13 +13,14 @@ IMAGE_SIZE="1G" KERNEL="RPI-B" MD_ARGS="-x 63 -y 255" NODOC=1 +UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi" +RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware" +OL_DIR="${RPI_FIRMWARE_DIR}/overlays" OVERLAYS="mmc.dtbo pi3-disable-bt.dtbo" PART_SCHEME="MBR" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x2000000" arm_install_uboot() { - UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi" - RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware" UBOOT_FILES="u-boot.bin" RPI_FIRMWARE_FILES="bootcode.bin config.txt \ fixup.dat fixup_cd.dat fixup_db.dat fixup_x.dat \ Modified: stable/11/release/arm/RPI2.conf ============================================================================== --- stable/11/release/arm/RPI2.conf Tue Jul 31 12:53:27 2018 (r336967) +++ stable/11/release/arm/RPI2.conf Tue Jul 31 13:32:36 2018 (r336968) @@ -13,13 +13,14 @@ IMAGE_SIZE="1536M" KERNEL="RPI2" MD_ARGS="-x 63 -y 255" NODOC=1 +UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi2" +RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware" +OL_DIR="${RPI_FIRMWARE_DIR}/overlays" OVERLAYS="mmc.dtbo" PART_SCHEME="MBR" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x2000000" arm_install_uboot() { - UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi2" - RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware" UBOOT_FILES="u-boot.bin" RPI_FIRMWARE_FILES="bootcode.bin config.txt \ fixup.dat fixup_cd.dat fixup_db.dat fixup_x.dat \ From owner-svn-src-stable@freebsd.org Tue Jul 31 16:08:40 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7792F105DA49; Tue, 31 Jul 2018 16:08:40 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CF137054B; Tue, 31 Jul 2018 16:08:40 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E94C215D66; Tue, 31 Jul 2018 16:08:39 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6VG8dAJ079049; Tue, 31 Jul 2018 16:08:39 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6VG8dsn079045; Tue, 31 Jul 2018 16:08:39 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201807311608.w6VG8dsn079045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 31 Jul 2018 16:08: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: r336976 - in stable/11: share/man/man4 sys/dev/jedec_ts X-SVN-Group: stable-11 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/jedec_ts X-SVN-Commit-Revision: 336976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 31 Jul 2018 16:08:40 -0000 Author: rpokala Date: Tue Jul 31 16:08:38 2018 New Revision: 336976 URL: https://svnweb.freebsd.org/changeset/base/336976 Log: MFC r336662,r336682 r336662: Deprecate jedec_ts(4) and point users to jedec_dimm(4) instead jedec_dimm(4) is a superset of the functionality of jedec_ts(4). Mark jedec_ts(4) as removed in FreeBSD 12, and include a pointer to the migration instructions in the jedec_dimm(4) manpage, in both the jedec_ts(4) code and the jedec_ts(4) manpage. Add a note to the jedec_dimm(4) manpage about the fact that it is a superset of jedec_ts(4). r336682: Update .Dd in light of r336662. Modified: stable/11/share/man/man4/jedec_dimm.4 stable/11/share/man/man4/jedec_ts.4 stable/11/sys/dev/jedec_ts/jedec_ts.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/jedec_dimm.4 ============================================================================== --- stable/11/share/man/man4/jedec_dimm.4 Tue Jul 31 16:08:17 2018 (r336975) +++ stable/11/share/man/man4/jedec_dimm.4 Tue Jul 31 16:08:38 2018 (r336976) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 22, 2018 +.Dd July 24, 2018 .Dt JEDEC_DIMM 4 .Os .Sh NAME @@ -163,6 +163,9 @@ dev.jedec_dimm.6.temp: 43.1C dev.jedec_dimm.6.type: DDR4 .Ed .Sh COMPATIBILITY +.Nm +implements a superset of the functionality of +.Xr jedec_ts 4 . Hints for .Xr jedec_ts 4 can be mechanically converted for use with Modified: stable/11/share/man/man4/jedec_ts.4 ============================================================================== --- stable/11/share/man/man4/jedec_ts.4 Tue Jul 31 16:08:17 2018 (r336975) +++ stable/11/share/man/man4/jedec_ts.4 Tue Jul 31 16:08:38 2018 (r336976) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 9, 2017 +.Dd July 24, 2018 .Dt JEDEC_TS 4 .Os .Sh NAME @@ -63,6 +63,18 @@ In .Cd hint.jedec_ts.7.at="smbus0" .Cd hint.jedec_ts.7.addr="0x3E" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 12.0 +and later. +A superset of its functionality is available in the +.Xr jedec_dimm 4 +driver. +That driver's manpage includes instructions on updating +.Pa /boot/device.hints +accordingly. .Sh DESCRIPTION The .Nm Modified: stable/11/sys/dev/jedec_ts/jedec_ts.c ============================================================================== --- stable/11/sys/dev/jedec_ts/jedec_ts.c Tue Jul 31 16:08:17 2018 (r336975) +++ stable/11/sys/dev/jedec_ts/jedec_ts.c Tue Jul 31 16:08:38 2018 (r336976) @@ -247,6 +247,9 @@ ts_attach(device_t dev) CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, 0, ts_temp_sysctl, "IK4", "Current temperature"); + gone_in_dev(dev, 12, + "jedec_ts(4) driver; see COMPATIBILITY section of jedec_dimm(4)"); + return (0); } From owner-svn-src-stable@freebsd.org Tue Jul 31 20:57:32 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF6191064BCE; Tue, 31 Jul 2018 20:57:32 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8355D7C829; Tue, 31 Jul 2018 20:57:32 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6513B18DF2; Tue, 31 Jul 2018 20:57:32 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6VKvWRv033215; Tue, 31 Jul 2018 20:57:32 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6VKvW4k033214; Tue, 31 Jul 2018 20:57:32 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807312057.w6VKvW4k033214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 31 Jul 2018 20:57: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: r337005 - stable/11/sys/fs/nfsserver X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/11/sys/fs/nfsserver X-SVN-Commit-Revision: 337005 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 31 Jul 2018 20:57:33 -0000 Author: rmacklem Date: Tue Jul 31 20:57:31 2018 New Revision: 337005 URL: https://svnweb.freebsd.org/changeset/base/337005 Log: MFC: r336215 Ignore the cookie verifier for NFSv4.1 when the cookie is 0. RFC5661 states that the cookie verifier should be 0 when the cookie is 0. However, the wording is somewhat unclear and a recent discussion on the nfsv4@ietf.org mailing list indicated that the NFSv4 server should ignore the cookie verifier's value when the dirctory offset cookie is 0. This patch deletes the check for this that would return NFSERR_BAD_COOKIE when the verifier was not 0. This was found during testing of the ESXi client against the NFSv4.1 server. Modified: stable/11/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/11/sys/fs/nfsserver/nfs_nfsdport.c Tue Jul 31 20:50:50 2018 (r337004) +++ stable/11/sys/fs/nfsserver/nfs_nfsdport.c Tue Jul 31 20:57:31 2018 (r337005) @@ -1876,6 +1876,7 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdg } fullsiz = siz; nd->nd_repstat = getret = nfsvno_getattr(vp, &at, nd->nd_cred, p, 1); +#if 0 if (!nd->nd_repstat) { if (off && verf != at.na_filerev) { /* @@ -1884,17 +1885,14 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdg * removed/added unless that offset cookies returned to * the client are no longer valid. */ -#if 0 if (nd->nd_flag & ND_NFSV4) { nd->nd_repstat = NFSERR_NOTSAME; } else { nd->nd_repstat = NFSERR_BAD_COOKIE; } -#endif - } else if ((nd->nd_flag & ND_NFSV4) && off == 0 && verf != 0) { - nd->nd_repstat = NFSERR_BAD_COOKIE; } } +#endif if (!nd->nd_repstat && vp->v_type != VDIR) nd->nd_repstat = NFSERR_NOTDIR; if (!nd->nd_repstat && cnt == 0) From owner-svn-src-stable@freebsd.org Tue Jul 31 21:02:46 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED3921064E32; Tue, 31 Jul 2018 21:02:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 95B5F7CCE8; Tue, 31 Jul 2018 21:02:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72C6C18F8E; Tue, 31 Jul 2018 21:02:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6VL2jUT038023; Tue, 31 Jul 2018 21:02:45 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6VL2jDa038022; Tue, 31 Jul 2018 21:02:45 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807312102.w6VL2jDa038022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 31 Jul 2018 21:02:45 +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: r337006 - stable/10/sys/fs/nfsserver X-SVN-Group: stable-10 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/10/sys/fs/nfsserver X-SVN-Commit-Revision: 337006 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 31 Jul 2018 21:02:46 -0000 Author: rmacklem Date: Tue Jul 31 21:02:45 2018 New Revision: 337006 URL: https://svnweb.freebsd.org/changeset/base/337006 Log: MFC: r336215 Ignore the cookie verifier for NFSv4.1 when the cookie is 0. RFC5661 states that the cookie verifier should be 0 when the cookie is 0. However, the wording is somewhat unclear and a recent discussion on the nfsv4@ietf.org mailing list indicated that the NFSv4 server should ignore the cookie verifier's value when the dirctory offset cookie is 0. This patch deletes the check for this that would return NFSERR_BAD_COOKIE when the verifier was not 0. This was found during testing of the ESXi client against the NFSv4.1 server. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdport.c Tue Jul 31 20:57:31 2018 (r337005) +++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c Tue Jul 31 21:02:45 2018 (r337006) @@ -1871,6 +1871,7 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdg } fullsiz = siz; nd->nd_repstat = getret = nfsvno_getattr(vp, &at, nd->nd_cred, p, 1); +#if 0 if (!nd->nd_repstat) { if (off && verf != at.na_filerev) { /* @@ -1879,17 +1880,14 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdg * removed/added unless that offset cookies returned to * the client are no longer valid. */ -#if 0 if (nd->nd_flag & ND_NFSV4) { nd->nd_repstat = NFSERR_NOTSAME; } else { nd->nd_repstat = NFSERR_BAD_COOKIE; } -#endif - } else if ((nd->nd_flag & ND_NFSV4) && off == 0 && verf != 0) { - nd->nd_repstat = NFSERR_BAD_COOKIE; } } +#endif if (!nd->nd_repstat && vp->v_type != VDIR) nd->nd_repstat = NFSERR_NOTDIR; if (!nd->nd_repstat && cnt == 0) From owner-svn-src-stable@freebsd.org Wed Aug 1 00:41:04 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EB49106B07C; Wed, 1 Aug 2018 00:41:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B72D18C217; Wed, 1 Aug 2018 00:41:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99BAB1B26C; Wed, 1 Aug 2018 00:41:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w710f3sS060492; Wed, 1 Aug 2018 00:41:03 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w710f3Cg060489; Wed, 1 Aug 2018 00:41:03 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201808010041.w710f3Cg060489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 1 Aug 2018 00:41:03 +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: r337024 - in stable/11/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 337024 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 01 Aug 2018 00:41:04 -0000 Author: jhb Date: Wed Aug 1 00:41:02 2018 New Revision: 337024 URL: https://svnweb.freebsd.org/changeset/base/337024 Log: MFC 330823,332335: Cosmetic cleanups to some Linuxulator files. 330823: Apply some style(9) to Linuxulator linux_sysvec.c comments 332335: linuxulator: add else case braces to reduce diffs between archs Modified: stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/i386/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/11/sys/amd64/linux/linux_sysvec.c Wed Aug 1 00:39:21 2018 (r337023) +++ stable/11/sys/amd64/linux/linux_sysvec.c Wed Aug 1 00:41:02 2018 (r337024) @@ -101,10 +101,9 @@ SYSCTL_PROC(_compat_linux, OID_AUTO, debug, #endif /* - * Allow the this functions to use the ldebug() facility - * even though they are not syscalls themselves. Map them - * to syscall 0. This is slightly less bogus than using - * ldebug(sigreturn). + * Allow the sendsig functions to use the ldebug() facility even though they + * are not syscalls themselves. Map them to syscall 0. This is slightly less + * bogus than using ldebug(sigreturn). */ #define LINUX_SYS_linux_rt_sendsig 0 @@ -253,8 +252,7 @@ linux_set_syscall_retval(struct thread *td, int error) /* * On Linux only %rcx and %r11 values are not preserved across - * the syscall. - * So, do not clobber %rdx and %r10 + * the syscall. So, do not clobber %rdx and %r10. */ td->td_retval[1] = frame->tf_rdx; if (error != EJUSTRETURN) @@ -336,9 +334,7 @@ linux_copyout_strings(struct image_params *imgp) size_t execpath_len; struct proc *p; - /* - * Calculate string base and vector table pointers. - */ + /* Calculate string base and vector table pointers. */ if (imgp->execpath != NULL && imgp->auxargs != NULL) execpath_len = strlen(imgp->execpath) + 1; else @@ -346,7 +342,7 @@ linux_copyout_strings(struct image_params *imgp) p = imgp->proc; arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; - destp = (caddr_t)arginfo - SPARE_USRSPACE - + destp = (caddr_t)arginfo - SPARE_USRSPACE - roundup(sizeof(canary), sizeof(char *)) - roundup(execpath_len, sizeof(char *)) - roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); @@ -356,19 +352,14 @@ linux_copyout_strings(struct image_params *imgp) copyout(imgp->execpath, (void *)imgp->execpathp, execpath_len); } - /* - * Prepare the canary for SSP. - */ + /* Prepare the canary for SSP. */ arc4rand(canary, sizeof(canary), 0); imgp->canary = (uintptr_t)arginfo - roundup(execpath_len, sizeof(char *)) - roundup(sizeof(canary), sizeof(char *)); copyout(canary, (void *)imgp->canary, sizeof(canary)); - /* - * If we have a valid auxargs ptr, prepare some room - * on the stack. - */ + /* If we have a valid auxargs ptr, prepare some room on the stack. */ if (imgp->auxargs) { /* * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for @@ -394,29 +385,21 @@ linux_copyout_strings(struct image_params *imgp) imgp->args->envc + 2) * sizeof(char *)); } - /* - * vectp also becomes our initial stack base - */ + /* vectp also becomes our initial stack base. */ stack_base = (register_t *)vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; envc = imgp->args->envc; - /* - * Copy out strings - arguments and environment. - */ + /* Copy out strings - arguments and environment. */ copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); - /* - * Fill in "ps_strings" struct for ps, w, etc. - */ + /* Fill in "ps_strings" struct for ps, w, etc. */ suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp); suword(&arginfo->ps_nargvstr, argc); - /* - * Fill in argument portion of vector table. - */ + /* Fill in argument portion of vector table. */ for (; argc > 0; --argc) { suword(vectp++, (long)(intptr_t)destp); while (*stringp++ != 0) @@ -424,15 +407,13 @@ linux_copyout_strings(struct image_params *imgp) destp++; } - /* a null vector table pointer separates the argp's from the envp's */ + /* A null vector table pointer separates the argp's from the envp's. */ suword(vectp++, 0); suword(&arginfo->ps_envstr, (long)(intptr_t)vectp); suword(&arginfo->ps_nenvstr, envc); - /* - * Fill in environment portion of vector table. - */ + /* Fill in environment portion of vector table. */ for (; envc > 0; --envc) { suword(vectp++, (long)(intptr_t)destp); while (*stringp++ != 0) @@ -440,7 +421,7 @@ linux_copyout_strings(struct image_params *imgp) destp++; } - /* end of vector table is a null pointer */ + /* The end of the vector table is a null pointer. */ suword(vectp, 0); return (stack_base); } @@ -685,12 +666,10 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse regs->tf_rdx = (register_t)&sfp->sf_sc; /* arg 3 in %rdx */ sf.sf_handler = catcher; - /* Fill in POSIX parts */ + /* Fill in POSIX parts. */ ksiginfo_to_lsiginfo(ksi, &sf.sf_si, sig); - /* - * Copy the sigframe out to the user's stack. - */ + /* Copy the sigframe out to the user's stack. */ if (copyout(&sf, sfp, sizeof(*sfp)) != 0) { #ifdef DEBUG printf("process %ld has trashed its stack\n", (long)p->p_pid); @@ -766,7 +745,7 @@ linux_vsyscall(struct thread *td) frame = td->td_frame; - /* Check %rip for vsyscall area */ + /* Check %rip for vsyscall area. */ if (__predict_true(frame->tf_rip < LINUX_VSYSCALL_START)) return (EINVAL); if ((frame->tf_rip & (LINUX_VSYSCALL_SZ - 1)) != 0) @@ -777,7 +756,7 @@ linux_vsyscall(struct thread *td) /* * vsyscall called as callq *(%rax), so we must - * use return address from %rsp and also fixup %rsp + * use return address from %rsp and also fixup %rsp. */ error = copyin((void *)frame->tf_rsp, &retqaddr, sizeof(retqaddr)); if (error) Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/11/sys/amd64/linux32/linux32_sysvec.c Wed Aug 1 00:39:21 2018 (r337023) +++ stable/11/sys/amd64/linux32/linux32_sysvec.c Wed Aug 1 00:41:02 2018 (r337024) @@ -100,10 +100,9 @@ MODULE_VERSION(linux, 1); #endif /* - * Allow the sendsig functions to use the ldebug() facility - * even though they are not syscalls themselves. Map them - * to syscall 0. This is slightly less bogus than using - * ldebug(sigreturn). + * Allow the sendsig functions to use the ldebug() facility even though they + * are not syscalls themselves. Map them to syscall 0. This is slightly less + * bogus than using ldebug(sigreturn). */ #define LINUX32_SYS_linux_rt_sendsig 0 #define LINUX32_SYS_linux_sendsig 0 @@ -310,9 +309,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse printf(ARGS(rt_sendsig, "%p, %d, %p, %u"), catcher, sig, (void*)mask, code); #endif - /* - * Allocate space for the signal handler context. - */ + /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) && !oonstack && SIGISMEMBER(psp->ps_sigonstack, sig)) { fp = (struct l_rt_sigframe *)((uintptr_t)td->td_sigstk.ss_sp + @@ -321,9 +318,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse fp = (struct l_rt_sigframe *)regs->tf_rsp - 1; mtx_unlock(&psp->ps_mtx); - /* - * Build the argument list for the signal handler. - */ + /* Build the argument list for the signal handler. */ sig = bsd_to_linux_signal(sig); bzero(&frame, sizeof(frame)); @@ -333,12 +328,11 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse frame.sf_siginfo = PTROUT(&fp->sf_si); frame.sf_ucontext = PTROUT(&fp->sf_sc); - /* Fill in POSIX parts */ + /* Fill in POSIX parts. */ ksiginfo_to_lsiginfo(ksi, &frame.sf_si, sig); /* - * Build the signal context to be used by sigreturn - * and libgcc unwind. + * Build the signal context to be used by sigreturn and libgcc unwind. */ frame.sf_sc.uc_flags = 0; /* XXX ??? */ frame.sf_sc.uc_link = 0; /* XXX ??? */ @@ -394,9 +388,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse sigexit(td, SIGILL); } - /* - * Build context to run handler in. - */ + /* Build context to run handler in. */ regs->tf_rsp = PTROUT(fp); regs->tf_rip = linux32_rt_sigcode; regs->tf_rflags &= ~(PSL_T | PSL_D); @@ -455,9 +447,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t catcher, sig, (void*)mask, code); #endif - /* - * Allocate space for the signal handler context. - */ + /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) && !oonstack && SIGISMEMBER(psp->ps_sigonstack, sig)) { fp = (struct l_sigframe *)((uintptr_t)td->td_sigstk.ss_sp + @@ -467,9 +457,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); - /* - * Build the argument list for the signal handler. - */ + /* Build the argument list for the signal handler. */ sig = bsd_to_linux_signal(sig); bzero(&frame, sizeof(frame)); @@ -479,9 +467,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t bsd_to_linux_sigset(mask, &lmask); - /* - * Build the signal context to be used by sigreturn. - */ + /* Build the signal context to be used by sigreturn. */ frame.sf_sc.sc_mask = lmask.__mask; frame.sf_sc.sc_gs = regs->tf_gs; frame.sf_sc.sc_fs = regs->tf_fs; @@ -515,9 +501,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t sigexit(td, SIGILL); } - /* - * Build context to run handler in. - */ + /* Build context to run handler in. */ regs->tf_rsp = PTROUT(fp); regs->tf_rip = linux32_sigcode; regs->tf_rflags &= ~(PSL_T | PSL_D); @@ -567,9 +551,7 @@ linux_sigreturn(struct thread *td, struct linux_sigret if (copyin(args->sfp, &frame, sizeof(frame)) != 0) return (EFAULT); - /* - * Check for security violations. - */ + /* Check for security violations. */ #define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = frame.sf_sc.sc_eflags; if (!EFLAGS_SECURE(eflags, regs->tf_rflags)) @@ -596,9 +578,7 @@ linux_sigreturn(struct thread *td, struct linux_sigret linux_to_bsd_sigset(&lmask, &bmask); kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0); - /* - * Restore signal context. - */ + /* Restore signal context. */ regs->tf_rdi = frame.sf_sc.sc_edi; regs->tf_rsi = frame.sf_sc.sc_esi; regs->tf_rbp = frame.sf_sc.sc_ebp; @@ -658,9 +638,7 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_ context = &uc.uc_mcontext; - /* - * Check for security violations. - */ + /* Check for security violations. */ #define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = context->sc_eflags; if (!EFLAGS_SECURE(eflags, regs->tf_rflags)) @@ -852,9 +830,7 @@ linux_copyout_strings(struct image_params *imgp) char canary[LINUX_AT_RANDOM_LEN]; size_t execpath_len; - /* - * Calculate string base and vector table pointers. - */ + /* Calculate string base and vector table pointers. */ if (imgp->execpath != NULL && imgp->auxargs != NULL) execpath_len = strlen(imgp->execpath) + 1; else @@ -871,19 +847,14 @@ linux_copyout_strings(struct image_params *imgp) copyout(imgp->execpath, (void *)imgp->execpathp, execpath_len); } - /* - * Prepare the canary for SSP. - */ + /* Prepare the canary for SSP. */ arc4rand(canary, sizeof(canary), 0); imgp->canary = (uintptr_t)arginfo - roundup(execpath_len, sizeof(char *)) - roundup(sizeof(canary), sizeof(char *)); copyout(canary, (void *)imgp->canary, sizeof(canary)); - /* - * If we have a valid auxargs ptr, prepare some room - * on the stack. - */ + /* If we have a valid auxargs ptr, prepare some room on the stack. */ if (imgp->auxargs) { /* * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for @@ -900,36 +871,29 @@ linux_copyout_strings(struct image_params *imgp) imgp->args->envc + 2 + imgp->auxarg_size) * sizeof(u_int32_t)); - } else + } else { /* * The '+ 2' is for the null pointers at the end of each of * the arg and env vector sets */ vectp = (u_int32_t *)(destp - (imgp->args->argc + imgp->args->envc + 2) * sizeof(u_int32_t)); + } - /* - * vectp also becomes our initial stack base - */ + /* vectp also becomes our initial stack base. */ stack_base = vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; envc = imgp->args->envc; - /* - * Copy out strings - arguments and environment. - */ + /* Copy out strings - arguments and environment. */ copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); - /* - * Fill in "ps_strings" struct for ps, w, etc. - */ + /* Fill in "ps_strings" struct for ps, w, etc. */ suword32(&arginfo->ps_argvstr, (uint32_t)(intptr_t)vectp); suword32(&arginfo->ps_nargvstr, argc); - /* - * Fill in argument portion of vector table. - */ + /* Fill in argument portion of vector table. */ for (; argc > 0; --argc) { suword32(vectp++, (uint32_t)(intptr_t)destp); while (*stringp++ != 0) @@ -937,15 +901,13 @@ linux_copyout_strings(struct image_params *imgp) destp++; } - /* a null vector table pointer separates the argp's from the envp's */ + /* A null vector table pointer separates the argp's from the envp's. */ suword32(vectp++, 0); suword32(&arginfo->ps_envstr, (uint32_t)(intptr_t)vectp); suword32(&arginfo->ps_nenvstr, envc); - /* - * Fill in environment portion of vector table. - */ + /* Fill in environment portion of vector table. */ for (; envc > 0; --envc) { suword32(vectp++, (uint32_t)(intptr_t)destp); while (*stringp++ != 0) @@ -953,7 +915,7 @@ linux_copyout_strings(struct image_params *imgp) destp++; } - /* end of vector table is a null pointer */ + /* The end of the vector table is a null pointer. */ suword32(vectp, 0); return ((register_t *)stack_base); Modified: stable/11/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/11/sys/i386/linux/linux_sysvec.c Wed Aug 1 00:39:21 2018 (r337023) +++ stable/11/sys/i386/linux/linux_sysvec.c Wed Aug 1 00:41:02 2018 (r337024) @@ -90,10 +90,9 @@ SYSCTL_PROC(_compat_linux, OID_AUTO, debug, #endif /* - * Allow the sendsig functions to use the ldebug() facility - * even though they are not syscalls themselves. Map them - * to syscall 0. This is slightly less bogus than using - * ldebug(sigreturn). + * Allow the sendsig functions to use the ldebug() facility even though they + * are not syscalls themselves. Map them to syscall 0. This is slightly less + * bogus than using ldebug(sigreturn). */ #define LINUX_SYS_linux_rt_sendsig 0 #define LINUX_SYS_linux_sendsig 0 @@ -308,9 +307,7 @@ linux_copyout_strings(struct image_params *imgp) size_t execpath_len; struct proc *p; - /* - * Calculate string base and vector table pointers. - */ + /* Calculate string base and vector table pointers. */ p = imgp->proc; if (imgp->execpath != NULL && imgp->auxargs != NULL) execpath_len = strlen(imgp->execpath) + 1; @@ -322,9 +319,7 @@ linux_copyout_strings(struct image_params *imgp) roundup(execpath_len, sizeof(char *)) - roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); - /* - * install LINUX_PLATFORM - */ + /* Install LINUX_PLATFORM. */ copyout(linux_kplatform, ((caddr_t)arginfo - linux_szplatform), linux_szplatform); @@ -334,19 +329,14 @@ linux_copyout_strings(struct image_params *imgp) copyout(imgp->execpath, (void *)imgp->execpathp, execpath_len); } - /* - * Prepare the canary for SSP. - */ + /* Prepare the canary for SSP. */ arc4rand(canary, sizeof(canary), 0); imgp->canary = (uintptr_t)arginfo - linux_szplatform - roundup(execpath_len, sizeof(char *)) - roundup(sizeof(canary), sizeof(char *)); copyout(canary, (void *)imgp->canary, sizeof(canary)); - /* - * If we have a valid auxargs ptr, prepare some room - * on the stack. - */ + /* If we have a valid auxargs ptr, prepare some room on the stack. */ if (imgp->auxargs) { /* * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for @@ -370,29 +360,21 @@ linux_copyout_strings(struct image_params *imgp) sizeof(char *)); } - /* - * vectp also becomes our initial stack base - */ + /* vectp also becomes our initial stack base. */ stack_base = (register_t *)vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; envc = imgp->args->envc; - /* - * Copy out strings - arguments and environment. - */ + /* Copy out strings - arguments and environment. */ copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); - /* - * Fill in "ps_strings" struct for ps, w, etc. - */ + /* Fill in "ps_strings" struct for ps, w, etc. */ suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp); suword(&arginfo->ps_nargvstr, argc); - /* - * Fill in argument portion of vector table. - */ + /* Fill in argument portion of vector table. */ for (; argc > 0; --argc) { suword(vectp++, (long)(intptr_t)destp); while (*stringp++ != 0) @@ -400,15 +382,13 @@ linux_copyout_strings(struct image_params *imgp) destp++; } - /* a null vector table pointer separates the argp's from the envp's */ + /* A null vector table pointer separates the argp's from the envp's. */ suword(vectp++, 0); suword(&arginfo->ps_envstr, (long)(intptr_t)vectp); suword(&arginfo->ps_nenvstr, envc); - /* - * Fill in environment portion of vector table. - */ + /* Fill in environment portion of vector table. */ for (; envc > 0; --envc) { suword(vectp++, (long)(intptr_t)destp); while (*stringp++ != 0) @@ -416,7 +396,7 @@ linux_copyout_strings(struct image_params *imgp) destp++; } - /* end of vector table is a null pointer */ + /* The end of the vector table is a null pointer. */ suword(vectp, 0); return (stack_base); @@ -446,9 +426,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse printf(ARGS(rt_sendsig, "%p, %d, %p, %u"), catcher, sig, (void*)mask, code); #endif - /* - * Allocate space for the signal handler context. - */ + /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) && !oonstack && SIGISMEMBER(psp->ps_sigonstack, sig)) { fp = (struct l_rt_sigframe *)((uintptr_t)td->td_sigstk.ss_sp + @@ -457,9 +435,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse fp = (struct l_rt_sigframe *)regs->tf_esp - 1; mtx_unlock(&psp->ps_mtx); - /* - * Build the argument list for the signal handler. - */ + /* Build the argument list for the signal handler. */ sig = bsd_to_linux_signal(sig); bzero(&frame, sizeof(frame)); @@ -469,12 +445,10 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse frame.sf_siginfo = &fp->sf_si; frame.sf_ucontext = &fp->sf_sc; - /* Fill in POSIX parts */ + /* Fill in POSIX parts. */ ksiginfo_to_lsiginfo(ksi, &frame.sf_si, sig); - /* - * Build the signal context to be used by sigreturn. - */ + /* Build the signal context to be used by sigreturn. */ frame.sf_sc.uc_flags = 0; /* XXX ??? */ frame.sf_sc.uc_link = NULL; /* XXX ??? */ @@ -529,9 +503,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse sigexit(td, SIGILL); } - /* - * Build context to run handler in. - */ + /* Build context to run handler in. */ regs->tf_esp = (int)fp; regs->tf_eip = linux_rt_sigcode; regs->tf_eflags &= ~(PSL_T | PSL_VM | PSL_D); @@ -586,9 +558,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t catcher, sig, (void*)mask, code); #endif - /* - * Allocate space for the signal handler context. - */ + /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) && !oonstack && SIGISMEMBER(psp->ps_sigonstack, sig)) { fp = (struct l_sigframe *)((uintptr_t)td->td_sigstk.ss_sp + @@ -598,9 +568,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); - /* - * Build the argument list for the signal handler. - */ + /* Build the argument list for the signal handler. */ sig = bsd_to_linux_signal(sig); bzero(&frame, sizeof(frame)); @@ -610,9 +578,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t bsd_to_linux_sigset(mask, &lmask); - /* - * Build the signal context to be used by sigreturn. - */ + /* Build the signal context to be used by sigreturn. */ frame.sf_sc.sc_mask = lmask.__mask; frame.sf_sc.sc_gs = rgs(); frame.sf_sc.sc_fs = regs->tf_fs; @@ -646,9 +612,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t sigexit(td, SIGILL); } - /* - * Build context to run handler in. - */ + /* Build context to run handler in. */ regs->tf_esp = (int)fp; regs->tf_eip = linux_sigcode; regs->tf_eflags &= ~(PSL_T | PSL_VM | PSL_D); @@ -695,9 +659,7 @@ linux_sigreturn(struct thread *td, struct linux_sigret if (copyin(args->sfp, &frame, sizeof(frame)) != 0) return (EFAULT); - /* - * Check for security violations. - */ + /* Check for security violations. */ #define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = frame.sf_sc.sc_eflags; if (!EFLAGS_SECURE(eflags, regs->tf_eflags)) @@ -723,9 +685,7 @@ linux_sigreturn(struct thread *td, struct linux_sigret linux_to_bsd_sigset(&lmask, &bmask); kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0); - /* - * Restore signal context. - */ + /* Restore signal context. */ /* %gs was restored by the trampoline. */ regs->tf_fs = frame.sf_sc.sc_fs; regs->tf_es = frame.sf_sc.sc_es; @@ -784,9 +744,7 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_ context = &uc.uc_mcontext; - /* - * Check for security violations. - */ + /* Check for security violations. */ #define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = context->sc_eflags; if (!EFLAGS_SECURE(eflags, regs->tf_eflags)) @@ -811,9 +769,7 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_ linux_to_bsd_sigset(&uc.uc_sigmask, &bmask); kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0); - /* - * Restore signal context - */ + /* Restore signal context. */ /* %gs was restored by the trampoline. */ regs->tf_fs = context->sc_fs; regs->tf_es = context->sc_es; @@ -831,9 +787,7 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_ regs->tf_esp = context->sc_esp_at_signal; regs->tf_ss = context->sc_ss; - /* - * call sigaltstack & ignore results.. - */ + /* Call sigaltstack & ignore results. */ lss = &uc.uc_stack; ss.ss_sp = lss->ss_sp; ss.ss_size = lss->ss_size; @@ -930,7 +884,7 @@ exec_linux_setregs(struct thread *td, struct image_par exec_setregs(td, imgp, stack); - /* Linux sets %gs to 0, we default to _udatasel */ + /* Linux sets %gs to 0, we default to _udatasel. */ pcb->pcb_gs = 0; load_gs(0); From owner-svn-src-stable@freebsd.org Wed Aug 1 10:34:55 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63D0A1050DE1; Wed, 1 Aug 2018 10:34:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B3FA8CC8F; Wed, 1 Aug 2018 10:34:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C295D21524; Wed, 1 Aug 2018 10:34:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w71AYssi069348; Wed, 1 Aug 2018 10:34:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w71AYrVX069341; Wed, 1 Aug 2018 10:34:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808011034.w71AYrVX069341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 1 Aug 2018 10:34:53 +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: r337034 - in stable/10: share/man/man9 sys/kern sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 337034 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 01 Aug 2018 10:34:55 -0000 Author: hselasky Date: Wed Aug 1 10:34:53 2018 New Revision: 337034 URL: https://svnweb.freebsd.org/changeset/base/337034 Log: MFC r330349 and r330362: Allow pause_sbt() to catch signals during sleep by passing C_CATCH flag. Define pause_sig() function macro helper similarly to other kernel functions which catch signals. Update outdated function description. Document pause_sig(9) and update prototypes for existing pause(9) and pause_sbt(9) functions. Discussed with: kib@ Suggested by: cem@ Sponsored by: Mellanox Technologies Modified: stable/10/share/man/man9/Makefile stable/10/share/man/man9/sleep.9 stable/10/sys/kern/kern_synch.c stable/10/sys/sys/callout.h stable/10/sys/sys/systm.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/Makefile ============================================================================== --- stable/10/share/man/man9/Makefile Wed Aug 1 08:24:34 2018 (r337033) +++ stable/10/share/man/man9/Makefile Wed Aug 1 10:34:53 2018 (r337034) @@ -1249,6 +1249,7 @@ MLINKS+=sleep.9 msleep.9 \ sleep.9 msleep_spin.9 \ sleep.9 msleep_spin_sbt.9 \ sleep.9 pause.9 \ + sleep.9 pause_sig.9 \ sleep.9 pause_sbt.9 \ sleep.9 tsleep.9 \ sleep.9 tsleep_sbt.9 \ Modified: stable/10/share/man/man9/sleep.9 ============================================================================== --- stable/10/share/man/man9/sleep.9 Wed Aug 1 08:24:34 2018 (r337033) +++ stable/10/share/man/man9/sleep.9 Wed Aug 1 10:34:53 2018 (r337034) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 19, 2013 +.Dd August 1, 2018 .Dt SLEEP 9 .Os .Sh NAME @@ -34,6 +34,7 @@ .Nm msleep_spin , .Nm msleep_spin_sbt , .Nm pause , +.Nm pause_sig , .Nm pause_sbt , .Nm tsleep , .Nm tsleep_sbt , @@ -53,9 +54,11 @@ .Ft int .Fn msleep_spin_sbt "void *chan" "struct mtx *mtx" "const char *wmesg" \ "sbintime_t sbt" "sbintime_t pr" "int flags" -.Ft void +.Ft int .Fn pause "const char *wmesg" "int timo" -.Ft void +.Ft int +.Fn pause_sig "const char *wmesg" "int timo" +.Ft int .Fn pause_sbt "const char *wmesg" "sbintime_t sbt" "sbintime_t pr" \ "int flags" .Ft int @@ -73,6 +76,8 @@ The functions .Fn msleep , .Fn msleep_spin , .Fn pause , +.Fn pause_sig , +.Fn pause_sbt , .Fn wakeup , and .Fn wakeup_one @@ -82,8 +87,10 @@ external event, it is put to sleep by .Fn tsleep , .Fn msleep , .Fn msleep_spin , +.Fn pause , +.Fn pause_sig , or -.Fn pause . +.Fn pause_sbt . Threads may also wait using one of the locking primitive sleep routines .Xr mtx_sleep 9 , .Xr rw_sleep 9 , @@ -261,6 +268,11 @@ The thread can not be awakened early by signals or cal .Fn wakeup or .Fn wakeup_one . +The +.Fn pause_sig +function is a variant of +.Fn pause +which can be awakened early by signals. .Pp The .Fn wakeup_one @@ -380,6 +392,10 @@ The .Fn pause function appeared in .Fx 7.0 . +The +.Fn pause_sig +function appeared in +.Fx 12.0 . .Sh AUTHORS .An -nosplit This manual page was written by Modified: stable/10/sys/kern/kern_synch.c ============================================================================== --- stable/10/sys/kern/kern_synch.c Wed Aug 1 08:24:34 2018 (r337033) +++ stable/10/sys/kern/kern_synch.c Wed Aug 1 10:34:53 2018 (r337034) @@ -334,16 +334,16 @@ msleep_spin_sbt(void *ident, struct mtx *mtx, const ch } /* - * pause() delays the calling thread by the given number of system ticks. - * During cold bootup, pause() uses the DELAY() function instead of - * the tsleep() function to do the waiting. The "timo" argument must be - * greater than or equal to zero. A "timo" value of zero is equivalent - * to a "timo" value of one. + * pause_sbt() delays the calling thread by the given signed binary + * time. During cold bootup, pause_sbt() uses the DELAY() function + * instead of the _sleep() function to do the waiting. The "sbt" + * argument must be greater than or equal to zero. A "sbt" value of + * zero is equivalent to a "sbt" value of one tick. */ int pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) { - KASSERT(sbt >= 0, ("pause: timeout must be >= 0")); + KASSERT(sbt >= 0, ("pause_sbt: timeout must be >= 0")); /* silently convert invalid timeouts */ if (sbt == 0) @@ -364,7 +364,8 @@ pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_ DELAY(sbt); return (0); } - return (_sleep(&pause_wchan[curcpu], NULL, 0, wmesg, sbt, pr, flags)); + return (_sleep(&pause_wchan[curcpu], NULL, + (flags & C_CATCH) ? PCATCH : 0, wmesg, sbt, pr, flags)); } /* Modified: stable/10/sys/sys/callout.h ============================================================================== --- stable/10/sys/sys/callout.h Wed Aug 1 08:24:34 2018 (r337033) +++ stable/10/sys/sys/callout.h Wed Aug 1 10:34:53 2018 (r337034) @@ -58,6 +58,7 @@ #define C_HARDCLOCK 0x0100 /* align to hardclock() calls */ #define C_ABSOLUTE 0x0200 /* event time is absolute. */ #define C_PRECALC 0x0400 /* event time is pre-calculated. */ +#define C_CATCH 0x0800 /* catch signals, used by pause_sbt(9) */ struct callout_handle { struct callout *callout; Modified: stable/10/sys/sys/systm.h ============================================================================== --- stable/10/sys/sys/systm.h Wed Aug 1 08:24:34 2018 (r337033) +++ stable/10/sys/sys/systm.h Wed Aug 1 10:34:53 2018 (r337034) @@ -386,6 +386,8 @@ int pause_sbt(const char *wmesg, sbintime_t sbt, sbint int flags); #define pause(wmesg, timo) \ pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK) +#define pause_sig(wmesg, timo) \ + pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK | C_CATCH) #define tsleep(chan, pri, wmesg, timo) \ _sleep((chan), NULL, (pri), (wmesg), tick_sbt * (timo), \ 0, C_HARDCLOCK) From owner-svn-src-stable@freebsd.org Wed Aug 1 10:35:50 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A19FA1050EEE; Wed, 1 Aug 2018 10:35:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 573638CD81; Wed, 1 Aug 2018 10:35:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3855321525; Wed, 1 Aug 2018 10:35:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w71AZoYP069471; Wed, 1 Aug 2018 10:35:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w71AZotf069470; Wed, 1 Aug 2018 10:35:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808011035.w71AZotf069470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 1 Aug 2018 10:35: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: r337035 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 337035 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 01 Aug 2018 10:35:50 -0000 Author: hselasky Date: Wed Aug 1 10:35:49 2018 New Revision: 337035 URL: https://svnweb.freebsd.org/changeset/base/337035 Log: MFC r330344: Correct the return code from pause() during cold startup from zero to EWOULDBLOCK. This also matches the description in pause(9). Discussed with: kib@ Sponsored by: Mellanox Technologies Modified: stable/10/sys/kern/kern_synch.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_synch.c ============================================================================== --- stable/10/sys/kern/kern_synch.c Wed Aug 1 10:34:53 2018 (r337034) +++ stable/10/sys/kern/kern_synch.c Wed Aug 1 10:35:49 2018 (r337035) @@ -362,7 +362,7 @@ pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_ sbt = (sbt + SBT_1US - 1) / SBT_1US; if (sbt > 0) DELAY(sbt); - return (0); + return (EWOULDBLOCK); } return (_sleep(&pause_wchan[curcpu], NULL, (flags & C_CATCH) ? PCATCH : 0, wmesg, sbt, pr, flags)); From owner-svn-src-stable@freebsd.org Wed Aug 1 11:08:53 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D4981053EF3; Wed, 1 Aug 2018 11:08:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C63368DEBE; Wed, 1 Aug 2018 11:08:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7439219F4; Wed, 1 Aug 2018 11:08:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w71B8q6U085482; Wed, 1 Aug 2018 11:08:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w71B8qPB085480; Wed, 1 Aug 2018 11:08:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808011108.w71B8qPB085480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 1 Aug 2018 11:08:52 +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: r337036 - in stable/10/sys: arm/arm sys X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10/sys: arm/arm sys X-SVN-Commit-Revision: 337036 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 01 Aug 2018 11:08:53 -0000 Author: hselasky Date: Wed Aug 1 11:08:52 2018 New Revision: 337036 URL: https://svnweb.freebsd.org/changeset/base/337036 Log: MFC r321686 and r330361: Add inline functions to convert between sbintime_t and decimal time units. Use them in some existing code that is vulnerable to roundoff errors. Modified: stable/10/sys/arm/arm/mpcore_timer.c stable/10/sys/sys/time.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/mpcore_timer.c ============================================================================== --- stable/10/sys/arm/arm/mpcore_timer.c Wed Aug 1 10:35:49 2018 (r337035) +++ stable/10/sys/arm/arm/mpcore_timer.c Wed Aug 1 11:08:52 2018 (r337036) @@ -349,7 +349,7 @@ attach_et(struct arm_tmr_softc *sc) sc->et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU; sc->et.et_quality = 1000; sc->et.et_frequency = sc->clkfreq; - sc->et.et_min_period = 20 * SBT_1NS; + sc->et.et_min_period = nstosbt(20); sc->et.et_max_period = 2 * SBT_1S; sc->et.et_start = arm_tmr_start; sc->et.et_stop = arm_tmr_stop; Modified: stable/10/sys/sys/time.h ============================================================================== --- stable/10/sys/sys/time.h Wed Aug 1 10:35:49 2018 (r337035) +++ stable/10/sys/sys/time.h Wed Aug 1 11:08:52 2018 (r337036) @@ -128,7 +128,7 @@ bintime_shift(struct bintime *_bt, int _exp) #define SBT_1M (SBT_1S * 60) #define SBT_1MS (SBT_1S / 1000) #define SBT_1US (SBT_1S / 1000000) -#define SBT_1NS (SBT_1S / 1000000000) +#define SBT_1NS (SBT_1S / 1000000000) /* beware rounding, see nstosbt() */ #define SBT_MAX 0x7fffffffffffffffLL static __inline int @@ -155,6 +155,53 @@ sbttobt(sbintime_t _sbt) return (_bt); } +/* + * Decimal<->sbt conversions. Multiplying or dividing by SBT_1NS results in + * large roundoff errors which sbttons() and nstosbt() avoid. Millisecond and + * microsecond functions are also provided for completeness. + */ +static __inline int64_t +sbttons(sbintime_t _sbt) +{ + + return ((1000000000 * _sbt) >> 32); +} + +static __inline sbintime_t +nstosbt(int64_t _ns) +{ + + return ((_ns * (((uint64_t)1 << 63) / 500000000)) >> 32); +} + +static __inline int64_t +sbttous(sbintime_t _sbt) +{ + + return ((1000000 * _sbt) >> 32); +} + +static __inline sbintime_t +ustosbt(int64_t _us) +{ + + return ((_us * (((uint64_t)1 << 63) / 500000)) >> 32); +} + +static __inline int64_t +sbttoms(sbintime_t _sbt) +{ + + return ((1000 * _sbt) >> 32); +} + +static __inline sbintime_t +mstosbt(int64_t _ms) +{ + + return ((_ms * (((uint64_t)1 << 63) / 500)) >> 32); +} + /*- * Background information: * @@ -210,7 +257,7 @@ sbttots(sbintime_t _sbt) struct timespec _ts; _ts.tv_sec = _sbt >> 32; - _ts.tv_nsec = ((uint64_t)1000000000 * (uint32_t)_sbt) >> 32; + _ts.tv_nsec = sbttons((uint32_t)_sbt); return (_ts); } @@ -218,8 +265,7 @@ static __inline sbintime_t tstosbt(struct timespec _ts) { - return (((sbintime_t)_ts.tv_sec << 32) + - (_ts.tv_nsec * (((uint64_t)1 << 63) / 500000000) >> 32)); + return (((sbintime_t)_ts.tv_sec << 32) + nstosbt(_ts.tv_nsec)); } static __inline struct timeval @@ -228,7 +274,7 @@ sbttotv(sbintime_t _sbt) struct timeval _tv; _tv.tv_sec = _sbt >> 32; - _tv.tv_usec = ((uint64_t)1000000 * (uint32_t)_sbt) >> 32; + _tv.tv_usec = sbttous((uint32_t)_sbt); return (_tv); } @@ -236,8 +282,7 @@ static __inline sbintime_t tvtosbt(struct timeval _tv) { - return (((sbintime_t)_tv.tv_sec << 32) + - (_tv.tv_usec * (((uint64_t)1 << 63) / 500000) >> 32)); + return (((sbintime_t)_tv.tv_sec << 32) + ustosbt(_tv.tv_usec)); } #endif /* __BSD_VISIBLE */ From owner-svn-src-stable@freebsd.org Wed Aug 1 12:49:52 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0CA2105B41E; Wed, 1 Aug 2018 12:49:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5581D725F6; Wed, 1 Aug 2018 12:49:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33A2E22A51; Wed, 1 Aug 2018 12:49:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w71Cnqcb036477; Wed, 1 Aug 2018 12:49:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w71CnpWg036475; Wed, 1 Aug 2018 12:49:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808011249.w71CnpWg036475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 1 Aug 2018 12:49:51 +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: r337041 - in stable/10/sys: amd64/include i386/include X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10/sys: amd64/include i386/include X-SVN-Commit-Revision: 337041 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 01 Aug 2018 12:49:52 -0000 Author: hselasky Date: Wed Aug 1 12:49:51 2018 New Revision: 337041 URL: https://svnweb.freebsd.org/changeset/base/337041 Log: MFC r311169, r312975, r313080, r315718 and r316031: Add support for atomic_(f)cmpset to x86. Modified: stable/10/sys/amd64/include/atomic.h stable/10/sys/i386/include/atomic.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/include/atomic.h ============================================================================== --- stable/10/sys/amd64/include/atomic.h Wed Aug 1 12:18:52 2018 (r337040) +++ stable/10/sys/amd64/include/atomic.h Wed Aug 1 12:49:51 2018 (r337041) @@ -78,8 +78,15 @@ void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +int atomic_cmpset_char(volatile u_char *dst, u_char expect, u_char src); +int atomic_cmpset_short(volatile u_short *dst, u_short expect, u_short src); int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src); int atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src); +int atomic_fcmpset_char(volatile u_char *dst, u_char *expect, u_char src); +int atomic_fcmpset_short(volatile u_short *dst, u_short *expect, + u_short src); +int atomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src); +int atomic_fcmpset_long(volatile u_long *dst, u_long *expect, u_long src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); u_long atomic_fetchadd_long(volatile u_long *p, u_long v); int atomic_testandset_int(volatile u_int *p, u_int v); @@ -130,49 +137,62 @@ atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_## struct __hack /* - * Atomic compare and set, used by the mutex functions + * Atomic compare and set, used by the mutex functions. * - * if (*dst == expect) *dst = src (all 32 bit words) + * cmpset: + * if (*dst == expect) + * *dst = src * - * Returns 0 on failure, non-zero on success + * fcmpset: + * if (*dst == *expect) + * *dst = src + * else + * *expect = *dst + * + * Returns 0 on failure, non-zero on success. */ - -static __inline int -atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgl %3,%1 ; " - " sete %0 ; " - "# atomic_cmpset_int" - : "=q" (res), /* 0 */ - "+m" (*dst), /* 1 */ - "+a" (expect) /* 2 */ - : "r" (src) /* 3 */ - : "memory", "cc"); - return (res); +#define ATOMIC_CMPSET(TYPE) \ +static __inline int \ +atomic_cmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE expect, u_##TYPE src) \ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " cmpxchg %3,%1 ; " \ + " sete %0 ; " \ + "# atomic_cmpset_" #TYPE " " \ + : "=q" (res), /* 0 */ \ + "+m" (*dst), /* 1 */ \ + "+a" (expect) /* 2 */ \ + : "r" (src) /* 3 */ \ + : "memory", "cc"); \ + return (res); \ +} \ + \ +static __inline int \ +atomic_fcmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE *expect, u_##TYPE src) \ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " cmpxchg %3,%1 ; " \ + " sete %0 ; " \ + "# atomic_fcmpset_" #TYPE " " \ + : "=q" (res), /* 0 */ \ + "+m" (*dst), /* 1 */ \ + "+a" (*expect) /* 2 */ \ + : "r" (src) /* 3 */ \ + : "memory", "cc"); \ + return (res); \ } -static __inline int -atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src) -{ - u_char res; +ATOMIC_CMPSET(char); +ATOMIC_CMPSET(short); +ATOMIC_CMPSET(int); +ATOMIC_CMPSET(long); - __asm __volatile( - " " MPLOCKED " " - " cmpxchgq %3,%1 ; " - " sete %0 ; " - "# atomic_cmpset_long" - : "=q" (res), /* 0 */ - "+m" (*dst), /* 1 */ - "+a" (expect) /* 2 */ - : "r" (src) /* 3 */ - : "memory", "cc"); - return (res); -} - /* * Atomically add the value of v to the integer pointed to by p and return * the previous value of *p. @@ -409,6 +429,10 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_add_rel_char atomic_add_barr_char #define atomic_subtract_acq_char atomic_subtract_barr_char #define atomic_subtract_rel_char atomic_subtract_barr_char +#define atomic_cmpset_acq_char atomic_cmpset_char +#define atomic_cmpset_rel_char atomic_cmpset_char +#define atomic_fcmpset_acq_char atomic_fcmpset_char +#define atomic_fcmpset_rel_char atomic_fcmpset_char #define atomic_set_acq_short atomic_set_barr_short #define atomic_set_rel_short atomic_set_barr_short @@ -418,6 +442,10 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_add_rel_short atomic_add_barr_short #define atomic_subtract_acq_short atomic_subtract_barr_short #define atomic_subtract_rel_short atomic_subtract_barr_short +#define atomic_cmpset_acq_short atomic_cmpset_short +#define atomic_cmpset_rel_short atomic_cmpset_short +#define atomic_fcmpset_acq_short atomic_fcmpset_short +#define atomic_fcmpset_rel_short atomic_fcmpset_short #define atomic_set_acq_int atomic_set_barr_int #define atomic_set_rel_int atomic_set_barr_int @@ -429,6 +457,8 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_int atomic_subtract_barr_int #define atomic_cmpset_acq_int atomic_cmpset_int #define atomic_cmpset_rel_int atomic_cmpset_int +#define atomic_fcmpset_acq_int atomic_fcmpset_int +#define atomic_fcmpset_rel_int atomic_fcmpset_int #define atomic_set_acq_long atomic_set_barr_long #define atomic_set_rel_long atomic_set_barr_long @@ -440,6 +470,8 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_long atomic_subtract_barr_long #define atomic_cmpset_acq_long atomic_cmpset_long #define atomic_cmpset_rel_long atomic_cmpset_long +#define atomic_fcmpset_acq_long atomic_fcmpset_long +#define atomic_fcmpset_rel_long atomic_fcmpset_long #define atomic_readandclear_int(p) atomic_swap_int(p, 0) #define atomic_readandclear_long(p) atomic_swap_long(p, 0) @@ -459,6 +491,12 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_8 atomic_subtract_rel_char #define atomic_load_acq_8 atomic_load_acq_char #define atomic_store_rel_8 atomic_store_rel_char +#define atomic_cmpset_8 atomic_cmpset_char +#define atomic_cmpset_acq_8 atomic_cmpset_acq_char +#define atomic_cmpset_rel_8 atomic_cmpset_rel_char +#define atomic_fcmpset_8 atomic_fcmpset_char +#define atomic_fcmpset_acq_8 atomic_fcmpset_acq_char +#define atomic_fcmpset_rel_8 atomic_fcmpset_rel_char /* Operations on 16-bit words. */ #define atomic_set_16 atomic_set_short @@ -475,6 +513,12 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_16 atomic_subtract_rel_short #define atomic_load_acq_16 atomic_load_acq_short #define atomic_store_rel_16 atomic_store_rel_short +#define atomic_cmpset_16 atomic_cmpset_short +#define atomic_cmpset_acq_16 atomic_cmpset_acq_short +#define atomic_cmpset_rel_16 atomic_cmpset_rel_short +#define atomic_fcmpset_16 atomic_fcmpset_short +#define atomic_fcmpset_acq_16 atomic_fcmpset_acq_short +#define atomic_fcmpset_rel_16 atomic_fcmpset_rel_short /* Operations on 32-bit double words. */ #define atomic_set_32 atomic_set_int @@ -494,6 +538,9 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_cmpset_32 atomic_cmpset_int #define atomic_cmpset_acq_32 atomic_cmpset_acq_int #define atomic_cmpset_rel_32 atomic_cmpset_rel_int +#define atomic_fcmpset_32 atomic_fcmpset_int +#define atomic_fcmpset_acq_32 atomic_fcmpset_acq_int +#define atomic_fcmpset_rel_32 atomic_fcmpset_rel_int #define atomic_swap_32 atomic_swap_int #define atomic_readandclear_32 atomic_readandclear_int #define atomic_fetchadd_32 atomic_fetchadd_int @@ -518,6 +565,9 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_cmpset_64 atomic_cmpset_long #define atomic_cmpset_acq_64 atomic_cmpset_acq_long #define atomic_cmpset_rel_64 atomic_cmpset_rel_long +#define atomic_fcmpset_64 atomic_fcmpset_long +#define atomic_fcmpset_acq_64 atomic_fcmpset_acq_long +#define atomic_fcmpset_rel_64 atomic_fcmpset_rel_long #define atomic_swap_64 atomic_swap_long #define atomic_readandclear_64 atomic_readandclear_long #define atomic_fetchadd_64 atomic_fetchadd_long @@ -542,6 +592,9 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_cmpset_ptr atomic_cmpset_long #define atomic_cmpset_acq_ptr atomic_cmpset_acq_long #define atomic_cmpset_rel_ptr atomic_cmpset_rel_long +#define atomic_fcmpset_ptr atomic_fcmpset_long +#define atomic_fcmpset_acq_ptr atomic_fcmpset_acq_long +#define atomic_fcmpset_rel_ptr atomic_fcmpset_rel_long #define atomic_swap_ptr atomic_swap_long #define atomic_readandclear_ptr atomic_readandclear_long Modified: stable/10/sys/i386/include/atomic.h ============================================================================== --- stable/10/sys/i386/include/atomic.h Wed Aug 1 12:18:52 2018 (r337040) +++ stable/10/sys/i386/include/atomic.h Wed Aug 1 12:49:51 2018 (r337041) @@ -83,7 +83,13 @@ void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +int atomic_cmpset_char(volatile u_char *dst, u_char expect, u_char src); +int atomic_cmpset_short(volatile u_short *dst, u_short expect, u_short src); int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src); +int atomic_fcmpset_char(volatile u_char *dst, u_char *expect, u_char src); +int atomic_fcmpset_short(volatile u_short *dst, u_short *expect, + u_short src); +int atomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); int atomic_testandset_int(volatile u_int *p, u_int v); int atomic_testandclear_int(volatile u_int *p, u_int v); @@ -137,60 +143,61 @@ atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_## struct __hack /* - * Atomic compare and set, used by the mutex functions + * Atomic compare and set, used by the mutex functions. * - * if (*dst == expect) *dst = src (all 32 bit words) + * cmpset: + * if (*dst == expect) + * *dst = src * - * Returns 0 on failure, non-zero on success + * fcmpset: + * if (*dst == *expect) + * *dst = src + * else + * *expect = *dst + * + * Returns 0 on failure, non-zero on success. */ - -#ifdef CPU_DISABLE_CMPXCHG - -static __inline int -atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src) -{ - u_char res; - - __asm __volatile( - " pushfl ; " - " cli ; " - " cmpl %3,%1 ; " - " jne 1f ; " - " movl %2,%1 ; " - "1: " - " sete %0 ; " - " popfl ; " - "# atomic_cmpset_int" - : "=q" (res), /* 0 */ - "+m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "r" (expect) /* 3 */ - : "memory"); - return (res); +#define ATOMIC_CMPSET(TYPE, CONS) \ +static __inline int \ +atomic_cmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE expect, u_##TYPE src) \ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " cmpxchg %3,%1 ; " \ + " sete %0 ; " \ + "# atomic_cmpset_" #TYPE " " \ + : "=q" (res), /* 0 */ \ + "+m" (*dst), /* 1 */ \ + "+a" (expect) /* 2 */ \ + : CONS (src) /* 3 */ \ + : "memory", "cc"); \ + return (res); \ +} \ + \ +static __inline int \ +atomic_fcmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE *expect, u_##TYPE src) \ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " cmpxchg %3,%1 ; " \ + " sete %0 ; " \ + "# atomic_fcmpset_" #TYPE " " \ + : "=q" (res), /* 0 */ \ + "+m" (*dst), /* 1 */ \ + "+a" (*expect) /* 2 */ \ + : CONS (src) /* 3 */ \ + : "memory", "cc"); \ + return (res); \ } -#else /* !CPU_DISABLE_CMPXCHG */ +ATOMIC_CMPSET(char, "q"); +ATOMIC_CMPSET(short, "r"); +ATOMIC_CMPSET(int, "r"); -static __inline int -atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgl %3,%1 ; " - " sete %0 ; " - "# atomic_cmpset_int" - : "=q" (res), /* 0 */ - "+m" (*dst), /* 1 */ - "+a" (expect) /* 2 */ - : "r" (src) /* 3 */ - : "memory", "cc"); - return (res); -} - -#endif /* CPU_DISABLE_CMPXCHG */ - /* * Atomically add the value of v to the integer pointed to by p and return * the previous value of *p. @@ -623,6 +630,10 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_add_rel_char atomic_add_barr_char #define atomic_subtract_acq_char atomic_subtract_barr_char #define atomic_subtract_rel_char atomic_subtract_barr_char +#define atomic_cmpset_acq_char atomic_cmpset_char +#define atomic_cmpset_rel_char atomic_cmpset_char +#define atomic_fcmpset_acq_char atomic_fcmpset_char +#define atomic_fcmpset_rel_char atomic_fcmpset_char #define atomic_set_acq_short atomic_set_barr_short #define atomic_set_rel_short atomic_set_barr_short @@ -632,6 +643,10 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_add_rel_short atomic_add_barr_short #define atomic_subtract_acq_short atomic_subtract_barr_short #define atomic_subtract_rel_short atomic_subtract_barr_short +#define atomic_cmpset_acq_short atomic_cmpset_short +#define atomic_cmpset_rel_short atomic_cmpset_short +#define atomic_fcmpset_acq_short atomic_fcmpset_short +#define atomic_fcmpset_rel_short atomic_fcmpset_short #define atomic_set_acq_int atomic_set_barr_int #define atomic_set_rel_int atomic_set_barr_int @@ -643,6 +658,8 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_int atomic_subtract_barr_int #define atomic_cmpset_acq_int atomic_cmpset_int #define atomic_cmpset_rel_int atomic_cmpset_int +#define atomic_fcmpset_acq_int atomic_fcmpset_int +#define atomic_fcmpset_rel_int atomic_fcmpset_int #define atomic_set_acq_long atomic_set_barr_long #define atomic_set_rel_long atomic_set_barr_long @@ -654,6 +671,8 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_long atomic_subtract_barr_long #define atomic_cmpset_acq_long atomic_cmpset_long #define atomic_cmpset_rel_long atomic_cmpset_long +#define atomic_fcmpset_acq_long atomic_fcmpset_long +#define atomic_fcmpset_rel_long atomic_fcmpset_long #define atomic_readandclear_int(p) atomic_swap_int(p, 0) #define atomic_readandclear_long(p) atomic_swap_long(p, 0) @@ -673,6 +692,12 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_8 atomic_subtract_rel_char #define atomic_load_acq_8 atomic_load_acq_char #define atomic_store_rel_8 atomic_store_rel_char +#define atomic_cmpset_8 atomic_cmpset_char +#define atomic_cmpset_acq_8 atomic_cmpset_acq_char +#define atomic_cmpset_rel_8 atomic_cmpset_rel_char +#define atomic_fcmpset_8 atomic_fcmpset_char +#define atomic_fcmpset_acq_8 atomic_fcmpset_acq_char +#define atomic_fcmpset_rel_8 atomic_fcmpset_rel_char /* Operations on 16-bit words. */ #define atomic_set_16 atomic_set_short @@ -689,6 +714,12 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_16 atomic_subtract_rel_short #define atomic_load_acq_16 atomic_load_acq_short #define atomic_store_rel_16 atomic_store_rel_short +#define atomic_cmpset_16 atomic_cmpset_short +#define atomic_cmpset_acq_16 atomic_cmpset_acq_short +#define atomic_cmpset_rel_16 atomic_cmpset_rel_short +#define atomic_fcmpset_16 atomic_fcmpset_short +#define atomic_fcmpset_acq_16 atomic_fcmpset_acq_short +#define atomic_fcmpset_rel_16 atomic_fcmpset_rel_short /* Operations on 32-bit double words. */ #define atomic_set_32 atomic_set_int @@ -708,6 +739,9 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_cmpset_32 atomic_cmpset_int #define atomic_cmpset_acq_32 atomic_cmpset_acq_int #define atomic_cmpset_rel_32 atomic_cmpset_rel_int +#define atomic_fcmpset_32 atomic_fcmpset_int +#define atomic_fcmpset_acq_32 atomic_fcmpset_acq_int +#define atomic_fcmpset_rel_32 atomic_fcmpset_rel_int #define atomic_swap_32 atomic_swap_int #define atomic_readandclear_32 atomic_readandclear_int #define atomic_fetchadd_32 atomic_fetchadd_int @@ -750,6 +784,14 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); (u_int)(new)) #define atomic_cmpset_rel_ptr(dst, old, new) \ atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old), \ + (u_int)(new)) +#define atomic_fcmpset_ptr(dst, old, new) \ + atomic_fcmpset_int((volatile u_int *)(dst), (u_int *)(old), (u_int)(new)) +#define atomic_fcmpset_acq_ptr(dst, old, new) \ + atomic_fcmpset_acq_int((volatile u_int *)(dst), (u_int *)(old), \ + (u_int)(new)) +#define atomic_fcmpset_rel_ptr(dst, old, new) \ + atomic_fcmpset_rel_int((volatile u_int *)(dst), (u_int *)(old), \ (u_int)(new)) #define atomic_swap_ptr(p, v) \ atomic_swap_int((volatile u_int *)(p), (u_int)(v)) From owner-svn-src-stable@freebsd.org Wed Aug 1 13:13:44 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F348105BE58; Wed, 1 Aug 2018 13:13:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 157837359B; Wed, 1 Aug 2018 13:13:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB03122F37; Wed, 1 Aug 2018 13:13:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w71DDhkt051427; Wed, 1 Aug 2018 13:13:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w71DDhHO051426; Wed, 1 Aug 2018 13:13:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808011313.w71DDhHO051426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 1 Aug 2018 13:13:43 +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: r337042 - stable/10/sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/sys X-SVN-Commit-Revision: 337042 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 01 Aug 2018 13:13:44 -0000 Author: hselasky Date: Wed Aug 1 13:13:43 2018 New Revision: 337042 URL: https://svnweb.freebsd.org/changeset/base/337042 Log: MFC r322596: Add SI_SUB_TASKQ after SI_SUB_INTR and move taskqueue initialization there for EARLY_AP_STARTUP This fixes a regression accidentally introduced in r322588, due to an interaction with EARLY_AP_STARTUP. Reviewed by: bdrewery@, jhb@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12053 Modified: stable/10/sys/sys/kernel.h stable/10/sys/sys/taskqueue.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/kernel.h ============================================================================== --- stable/10/sys/sys/kernel.h Wed Aug 1 12:49:51 2018 (r337041) +++ stable/10/sys/sys/kernel.h Wed Aug 1 13:13:43 2018 (r337042) @@ -127,8 +127,9 @@ enum sysinit_sub_id { SI_SUB_SCHED_IDLE = 0x2600000, /* required idle procs */ SI_SUB_MBUF = 0x2700000, /* mbuf subsystem */ SI_SUB_INTR = 0x2800000, /* interrupt threads */ - SI_SUB_SOFTINTR = 0x2800001, /* start soft interrupt thread */ + SI_SUB_TASKQ = 0x2880000, /* task queues */ SI_SUB_ACL = 0x2900000, /* start for filesystem ACLs */ + SI_SUB_SOFTINTR = 0x2A00000, /* start soft interrupt thread */ SI_SUB_DEVFS = 0x2F00000, /* devfs ready for devices */ SI_SUB_INIT_IF = 0x3000000, /* prep for net interfaces */ SI_SUB_NETGRAPH = 0x3010000, /* Let Netgraph initialize */ Modified: stable/10/sys/sys/taskqueue.h ============================================================================== --- stable/10/sys/sys/taskqueue.h Wed Aug 1 12:49:51 2018 (r337041) +++ stable/10/sys/sys/taskqueue.h Wed Aug 1 13:13:43 2018 (r337042) @@ -141,7 +141,7 @@ taskqueue_define_##name(void *arg) \ init; \ } \ \ -SYSINIT(taskqueue_##name, SI_SUB_CONFIGURE, SI_ORDER_SECOND, \ +SYSINIT(taskqueue_##name, SI_SUB_TASKQ, SI_ORDER_SECOND, \ taskqueue_define_##name, NULL); \ \ struct __hack @@ -166,7 +166,7 @@ taskqueue_define_##name(void *arg) \ init; \ } \ \ -SYSINIT(taskqueue_##name, SI_SUB_CONFIGURE, SI_ORDER_SECOND, \ +SYSINIT(taskqueue_##name, SI_SUB_TASKQ, SI_ORDER_SECOND, \ taskqueue_define_##name, NULL); \ \ struct __hack From owner-svn-src-stable@freebsd.org Wed Aug 1 17:40:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3354106478C; Wed, 1 Aug 2018 17:40:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 761107F4BD; Wed, 1 Aug 2018 17:40:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 571B7259F3; Wed, 1 Aug 2018 17:40:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w71HeJhd086197; Wed, 1 Aug 2018 17:40:19 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w71HeIZu086191; Wed, 1 Aug 2018 17:40:18 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201808011740.w71HeIZu086191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 1 Aug 2018 17:40: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: r337046 - in stable/11/sys: amd64/linux amd64/linux32 compat/freebsd32 i386/linux kern sys X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11/sys: amd64/linux amd64/linux32 compat/freebsd32 i386/linux kern sys X-SVN-Commit-Revision: 337046 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 01 Aug 2018 17:40:20 -0000 Author: jhb Date: Wed Aug 1 17:40:17 2018 New Revision: 337046 URL: https://svnweb.freebsd.org/changeset/base/337046 Log: MFC 332782: Simplify the code to allocate stack for auxv, argv[], and environment vectors. Remove auxarg_size as it was only used once right after a confusing assignment in each of the variants of exec_copyout_strings(). Modified: stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/compat/freebsd32/freebsd32_misc.c stable/11/sys/i386/linux/linux_sysvec.c stable/11/sys/kern/kern_exec.c stable/11/sys/sys/imgact.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/11/sys/amd64/linux/linux_sysvec.c Wed Aug 1 15:55:14 2018 (r337045) +++ stable/11/sys/amd64/linux/linux_sysvec.c Wed Aug 1 17:40:17 2018 (r337046) @@ -359,31 +359,21 @@ linux_copyout_strings(struct image_params *imgp) roundup(sizeof(canary), sizeof(char *)); copyout(canary, (void *)imgp->canary, sizeof(canary)); - /* If we have a valid auxargs ptr, prepare some room on the stack. */ + vectp = (char **)destp; if (imgp->auxargs) { /* - * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for - * lower compatibility. + * Allocate room on the stack for the ELF auxargs + * array. It has LINUX_AT_COUNT entries. */ - imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size : - (LINUX_AT_COUNT * 2); - - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets,and imgp->auxarg_size is room - * for argument of Runtime loader. - */ - vectp = (char **)(destp - (imgp->args->argc + - imgp->args->envc + 2 + imgp->auxarg_size) * sizeof(char *)); - - } else { - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets - */ - vectp = (char **)(destp - (imgp->args->argc + - imgp->args->envc + 2) * sizeof(char *)); + vectp -= howmany(LINUX_AT_COUNT * sizeof(Elf64_Auxinfo), + sizeof(*vectp)); } + + /* + * Allocate room for the argv[] and env vectors including the + * terminating NULL pointers. + */ + vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; /* vectp also becomes our initial stack base. */ stack_base = (register_t *)vectp; Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/11/sys/amd64/linux32/linux32_sysvec.c Wed Aug 1 15:55:14 2018 (r337045) +++ stable/11/sys/amd64/linux32/linux32_sysvec.c Wed Aug 1 17:40:17 2018 (r337046) @@ -854,31 +854,21 @@ linux_copyout_strings(struct image_params *imgp) roundup(sizeof(canary), sizeof(char *)); copyout(canary, (void *)imgp->canary, sizeof(canary)); - /* If we have a valid auxargs ptr, prepare some room on the stack. */ + vectp = (uint32_t *)destp; if (imgp->auxargs) { /* - * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for - * lower compatibility. + * Allocate room on the stack for the ELF auxargs + * array. It has LINUX_AT_COUNT entries. */ - imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size : - (LINUX_AT_COUNT * 2); - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets,and imgp->auxarg_size is room - * for argument of Runtime loader. - */ - vectp = (u_int32_t *) (destp - (imgp->args->argc + - imgp->args->envc + 2 + imgp->auxarg_size) * - sizeof(u_int32_t)); - - } else { - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets - */ - vectp = (u_int32_t *)(destp - (imgp->args->argc + - imgp->args->envc + 2) * sizeof(u_int32_t)); + vectp -= howmany(LINUX_AT_COUNT * sizeof(Elf32_Auxinfo), + sizeof(*vectp)); } + + /* + * Allocate room for the argv[] and env vectors including the + * terminating NULL pointers. + */ + vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; /* vectp also becomes our initial stack base. */ stack_base = vectp; Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_misc.c Wed Aug 1 15:55:14 2018 (r337045) +++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Wed Aug 1 17:40:17 2018 (r337046) @@ -2885,33 +2885,21 @@ freebsd32_copyout_strings(struct image_params *imgp) destp -= ARG_MAX - imgp->args->stringspace; destp = rounddown2(destp, sizeof(uint32_t)); - /* - * If we have a valid auxargs ptr, prepare some room - * on the stack. - */ + vectp = (uint32_t *)destp; if (imgp->auxargs) { /* - * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for - * lower compatibility. + * Allocate room on the stack for the ELF auxargs + * array. It has up to AT_COUNT entries. */ - imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size - : (AT_COUNT * 2); - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets,and imgp->auxarg_size is room - * for argument of Runtime loader. - */ - vectp = (u_int32_t *) (destp - (imgp->args->argc + - imgp->args->envc + 2 + imgp->auxarg_size + execpath_len) * - sizeof(u_int32_t)); - } else { - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets - */ - vectp = (u_int32_t *)(destp - (imgp->args->argc + - imgp->args->envc + 2) * sizeof(u_int32_t)); + vectp -= howmany(AT_COUNT * sizeof(Elf32_Auxinfo), + sizeof(*vectp)); } + + /* + * Allocate room for the argv[] and env vectors including the + * terminating NULL pointers. + */ + vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; /* * vectp also becomes our initial stack base Modified: stable/11/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/11/sys/i386/linux/linux_sysvec.c Wed Aug 1 15:55:14 2018 (r337045) +++ stable/11/sys/i386/linux/linux_sysvec.c Wed Aug 1 17:40:17 2018 (r337046) @@ -336,29 +336,21 @@ linux_copyout_strings(struct image_params *imgp) roundup(sizeof(canary), sizeof(char *)); copyout(canary, (void *)imgp->canary, sizeof(canary)); - /* If we have a valid auxargs ptr, prepare some room on the stack. */ + vectp = (char **)destp; if (imgp->auxargs) { /* - * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for - * lower compatibility. + * Allocate room on the stack for the ELF auxargs + * array. It has LINUX_AT_COUNT entries. */ - imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size : - (LINUX_AT_COUNT * 2); - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets,and imgp->auxarg_size is room - * for argument of Runtime loader. - */ - vectp = (char **)(destp - (imgp->args->argc + - imgp->args->envc + 2 + imgp->auxarg_size) * sizeof(char *)); - } else { - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets - */ - vectp = (char **)(destp - (imgp->args->argc + imgp->args->envc + 2) * - sizeof(char *)); + vectp -= howmany(LINUX_AT_COUNT * sizeof(Elf32_Auxinfo), + sizeof(*vectp)); } + + /* + * Allocate room for the argv[] and env vectors including the + * terminating NULL pointers. + */ + vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; /* vectp also becomes our initial stack base. */ stack_base = (register_t *)vectp; Modified: stable/11/sys/kern/kern_exec.c ============================================================================== --- stable/11/sys/kern/kern_exec.c Wed Aug 1 15:55:14 2018 (r337045) +++ stable/11/sys/kern/kern_exec.c Wed Aug 1 17:40:17 2018 (r337046) @@ -1533,33 +1533,21 @@ exec_copyout_strings(struct image_params *imgp) destp -= ARG_MAX - imgp->args->stringspace; destp = rounddown2(destp, sizeof(void *)); - /* - * If we have a valid auxargs ptr, prepare some room - * on the stack. - */ + vectp = (char **)destp; if (imgp->auxargs) { /* - * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for - * lower compatibility. + * Allocate room on the stack for the ELF auxargs + * array. It has up to AT_COUNT entries. */ - imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size : - (AT_COUNT * 2); - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets,and imgp->auxarg_size is room - * for argument of Runtime loader. - */ - vectp = (char **)(destp - (imgp->args->argc + - imgp->args->envc + 2 + imgp->auxarg_size) - * sizeof(char *)); - } else { - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets - */ - vectp = (char **)(destp - (imgp->args->argc + imgp->args->envc - + 2) * sizeof(char *)); + vectp -= howmany(AT_COUNT * sizeof(Elf_Auxinfo), + sizeof(*vectp)); } + + /* + * Allocate room for the argv[] and env vectors including the + * terminating NULL pointers. + */ + vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; /* * vectp also becomes our initial stack base Modified: stable/11/sys/sys/imgact.h ============================================================================== --- stable/11/sys/sys/imgact.h Wed Aug 1 15:55:14 2018 (r337045) +++ stable/11/sys/sys/imgact.h Wed Aug 1 17:40:17 2018 (r337046) @@ -73,7 +73,6 @@ struct image_params { void *auxargs; /* ELF Auxinfo structure pointer */ struct sf_buf *firstpage; /* first page that we mapped */ unsigned long ps_strings; /* PS_STRINGS for BSD/OS binaries */ - size_t auxarg_size; struct image_args *args; /* system call arguments */ struct sysentvec *sysent; /* system entry vector */ char *execpath; From owner-svn-src-stable@freebsd.org Wed Aug 1 19:25:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25B931067253; Wed, 1 Aug 2018 19:25:14 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BEBFC84025; Wed, 1 Aug 2018 19:25:13 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A37826C6A; Wed, 1 Aug 2018 19:25:13 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w71JPDAv043025; Wed, 1 Aug 2018 19:25:13 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w71JPDd8043022; Wed, 1 Aug 2018 19:25:13 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201808011925.w71JPDd8043022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 1 Aug 2018 19:25:13 +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: r337058 - in stable/10/sys/fs: nfs nfsserver X-SVN-Group: stable-10 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in stable/10/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 337058 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 01 Aug 2018 19:25:14 -0000 Author: rmacklem Date: Wed Aug 1 19:25:12 2018 New Revision: 337058 URL: https://svnweb.freebsd.org/changeset/base/337058 Log: MFC: r336357 Modify the reasons for not issuing a delegation in the NFSv4.1 server. The ESXi NFSv4.1 client will generate warning messages when the reason for not issuing a delegation is two. Two refers to a resource limit and I do not see why it would be considered invalid. However it probably was not the best choice of reason for not issuing a delegation. This patch changes the reasons used to ones that the ESXi client doesn't complain about. This change does not affect the FreeBSD client and does not appear to affect behaviour of the Linux NFSv4.1 client. RFC5661 defines these "reasons" but does not give any guidance w.r.t. which ones are more appropriate to return to a client. Modified: stable/10/sys/fs/nfs/nfsproto.h stable/10/sys/fs/nfsserver/nfs_nfsdserv.c stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfsproto.h ============================================================================== --- stable/10/sys/fs/nfs/nfsproto.h Wed Aug 1 19:17:55 2018 (r337057) +++ stable/10/sys/fs/nfs/nfsproto.h Wed Aug 1 19:25:12 2018 (r337058) @@ -552,6 +552,7 @@ #define NFSV4OPEN_WDRESOURCE 0x00080000 #define NFSV4OPEN_WDCONTENTION 0x00100000 #define NFSV4OPEN_WDNOTWANTED 0x00200000 +#define NFSV4OPEN_WDSUPPFTYPE 0x00400000 /* * NFS V4 File Handle types Modified: stable/10/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Wed Aug 1 19:17:55 2018 (r337057) +++ stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Wed Aug 1 19:25:12 2018 (r337058) @@ -2929,7 +2929,13 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int is *tl = txdr_unsigned(NFSV4OPEN_DELEGATEWRITE); else if (retext != 0) { *tl = txdr_unsigned(NFSV4OPEN_DELEGATENONEEXT); - if ((rflags & NFSV4OPEN_WDCONTENTION) != 0) { + if ((rflags & NFSV4OPEN_WDNOTWANTED) != 0) { + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OPEN_NOTWANTED); + } else if ((rflags & NFSV4OPEN_WDSUPPFTYPE) != 0) { + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OPEN_NOTSUPPFTYPE); + } else if ((rflags & NFSV4OPEN_WDCONTENTION) != 0) { NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OPEN_CONTENTION); *tl = newnfs_false; Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Wed Aug 1 19:17:55 2018 (r337057) +++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Wed Aug 1 19:25:12 2018 (r337058) @@ -3022,7 +3022,13 @@ tryagain: /* * This is where we can choose to issue a delegation. */ - if (delegate == 0 || writedeleg == 0 || + if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0) + *rflagsp |= NFSV4OPEN_WDNOTWANTED; + else if (nfsrv_issuedelegs == 0) + *rflagsp |= NFSV4OPEN_WDSUPPFTYPE; + else if (NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt)) + *rflagsp |= NFSV4OPEN_WDRESOURCE; + else if (delegate == 0 || writedeleg == 0 || NFSVNO_EXRDONLY(exp) || (readonly != 0 && nfsrv_writedelegifpos == 0) || !NFSVNO_DELEGOK(vp) || @@ -3030,11 +3036,6 @@ tryagain: (clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) != LCL_CALLBACKSON) *rflagsp |= NFSV4OPEN_WDCONTENTION; - else if (nfsrv_issuedelegs == 0 || - NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt)) - *rflagsp |= NFSV4OPEN_WDRESOURCE; - else if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0) - *rflagsp |= NFSV4OPEN_WDNOTWANTED; else { new_deleg->ls_stateid.seqid = delegstateidp->seqid = 1; new_deleg->ls_stateid.other[0] = delegstateidp->other[0] @@ -3085,16 +3086,17 @@ tryagain: /* * This is where we can choose to issue a delegation. */ - if (delegate == 0 || (writedeleg == 0 && readonly == 0) || - !NFSVNO_DELEGOK(vp) || + if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0) + *rflagsp |= NFSV4OPEN_WDNOTWANTED; + else if (nfsrv_issuedelegs == 0) + *rflagsp |= NFSV4OPEN_WDSUPPFTYPE; + else if (NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt)) + *rflagsp |= NFSV4OPEN_WDRESOURCE; + else if (delegate == 0 || (writedeleg == 0 && + readonly == 0) || !NFSVNO_DELEGOK(vp) || (clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) != LCL_CALLBACKSON) *rflagsp |= NFSV4OPEN_WDCONTENTION; - else if (nfsrv_issuedelegs == 0 || - NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt)) - *rflagsp |= NFSV4OPEN_WDRESOURCE; - else if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0) - *rflagsp |= NFSV4OPEN_WDNOTWANTED; else { new_deleg->ls_stateid.seqid = delegstateidp->seqid = 1; new_deleg->ls_stateid.other[0] = delegstateidp->other[0] From owner-svn-src-stable@freebsd.org Wed Aug 1 20:38:02 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CE521068A96; Wed, 1 Aug 2018 20:38:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C698086BC4; Wed, 1 Aug 2018 20:38:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A37FF27806; Wed, 1 Aug 2018 20:38:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w71Kc1c7079966; Wed, 1 Aug 2018 20:38:01 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w71Kc14u079965; Wed, 1 Aug 2018 20:38:01 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201808012038.w71Kc14u079965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 1 Aug 2018 20:38:01 +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: r337061 - stable/11/sys/sparc64/sparc64 X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/sparc64/sparc64 X-SVN-Commit-Revision: 337061 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 01 Aug 2018 20:38:02 -0000 Author: jhb Date: Wed Aug 1 20:38:01 2018 New Revision: 337061 URL: https://svnweb.freebsd.org/changeset/base/337061 Log: MFC 333416: Report TRAP_BRKPT for breakpoint traps on sparc64. Modified: stable/11/sys/sparc64/sparc64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sparc64/sparc64/trap.c ============================================================================== --- stable/11/sys/sparc64/sparc64/trap.c Wed Aug 1 20:08:20 2018 (r337060) +++ stable/11/sys/sparc64/sparc64/trap.c Wed Aug 1 20:38:01 2018 (r337061) @@ -257,7 +257,7 @@ trap(struct trapframe *tf) struct thread *td; struct proc *p; int error; - int sig; + int sig, ucode; register_t addr; ksiginfo_t ksi; @@ -277,6 +277,7 @@ trap(struct trapframe *tf) td->td_pticks = 0; td->td_frame = tf; addr = tf->tf_tpc; + ucode = (int)tf->tf_type; /* XXX not POSIX */ if (td->td_cowgen != p->p_cowgen) thread_cow_update(td); @@ -300,6 +301,10 @@ trap(struct trapframe *tf) case T_CORRECTED_ECC_ERROR: sig = trap_cecc(); break; + case T_BREAKPOINT: + sig = SIGTRAP; + ucode = TRAP_BRKPT; + break; default: if (tf->tf_type > T_MAX) panic("trap: bad trap type %#lx (user)", @@ -322,7 +327,7 @@ trap(struct trapframe *tf) kdb_enter(KDB_WHY_TRAPSIG, "trapsig"); ksiginfo_init_trap(&ksi); ksi.ksi_signo = sig; - ksi.ksi_code = (int)tf->tf_type; /* XXX not POSIX */ + ksi.ksi_code = ucode; ksi.ksi_addr = (void *)addr; ksi.ksi_trapno = (int)tf->tf_type; trapsignal(td, &ksi); From owner-svn-src-stable@freebsd.org Thu Aug 2 03:14:01 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45A551052BA3; Thu, 2 Aug 2018 03:14:01 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF8109607A; Thu, 2 Aug 2018 03:14:00 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D03AC3FEF; Thu, 2 Aug 2018 03:14:00 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w723E0ZP084887; Thu, 2 Aug 2018 03:14:00 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w723E0pD084885; Thu, 2 Aug 2018 03:14:00 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201808020314.w723E0pD084885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 2 Aug 2018 03:14:00 +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: r337064 - in stable/11/sys/fs: nfs nfsserver X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in stable/11/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 337064 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 03:14:01 -0000 Author: rmacklem Date: Thu Aug 2 03:13:59 2018 New Revision: 337064 URL: https://svnweb.freebsd.org/changeset/base/337064 Log: MFC: r336357 Modify the reasons for not issuing a delegation in the NFSv4.1 server. The ESXi NFSv4.1 client will generate warning messages when the reason for not issuing a delegation is two. Two refers to a resource limit and I do not see why it would be considered invalid. However it probably was not the best choice of reason for not issuing a delegation. This patch changes the reasons used to ones that the ESXi client doesn't complain about. This change does not affect the FreeBSD client and does not appear to affect behaviour of the Linux NFSv4.1 client. RFC5661 defines these "reasons" but does not give any guidance w.r.t. which ones are more appropriate to return to a client. Modified: stable/11/sys/fs/nfs/nfsproto.h stable/11/sys/fs/nfsserver/nfs_nfsdserv.c stable/11/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfsproto.h ============================================================================== --- stable/11/sys/fs/nfs/nfsproto.h Wed Aug 1 21:51:49 2018 (r337063) +++ stable/11/sys/fs/nfs/nfsproto.h Thu Aug 2 03:13:59 2018 (r337064) @@ -554,6 +554,7 @@ #define NFSV4OPEN_WDRESOURCE 0x00080000 #define NFSV4OPEN_WDCONTENTION 0x00100000 #define NFSV4OPEN_WDNOTWANTED 0x00200000 +#define NFSV4OPEN_WDSUPPFTYPE 0x00400000 /* * NFS V4 File Handle types Modified: stable/11/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/11/sys/fs/nfsserver/nfs_nfsdserv.c Wed Aug 1 21:51:49 2018 (r337063) +++ stable/11/sys/fs/nfsserver/nfs_nfsdserv.c Thu Aug 2 03:13:59 2018 (r337064) @@ -2951,7 +2951,13 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int is *tl = txdr_unsigned(NFSV4OPEN_DELEGATEWRITE); else if (retext != 0) { *tl = txdr_unsigned(NFSV4OPEN_DELEGATENONEEXT); - if ((rflags & NFSV4OPEN_WDCONTENTION) != 0) { + if ((rflags & NFSV4OPEN_WDNOTWANTED) != 0) { + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OPEN_NOTWANTED); + } else if ((rflags & NFSV4OPEN_WDSUPPFTYPE) != 0) { + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OPEN_NOTSUPPFTYPE); + } else if ((rflags & NFSV4OPEN_WDCONTENTION) != 0) { NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OPEN_CONTENTION); *tl = newnfs_false; Modified: stable/11/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/11/sys/fs/nfsserver/nfs_nfsdstate.c Wed Aug 1 21:51:49 2018 (r337063) +++ stable/11/sys/fs/nfsserver/nfs_nfsdstate.c Thu Aug 2 03:13:59 2018 (r337064) @@ -3025,7 +3025,13 @@ tryagain: /* * This is where we can choose to issue a delegation. */ - if (delegate == 0 || writedeleg == 0 || + if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0) + *rflagsp |= NFSV4OPEN_WDNOTWANTED; + else if (nfsrv_issuedelegs == 0) + *rflagsp |= NFSV4OPEN_WDSUPPFTYPE; + else if (NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt)) + *rflagsp |= NFSV4OPEN_WDRESOURCE; + else if (delegate == 0 || writedeleg == 0 || NFSVNO_EXRDONLY(exp) || (readonly != 0 && nfsrv_writedelegifpos == 0) || !NFSVNO_DELEGOK(vp) || @@ -3033,11 +3039,6 @@ tryagain: (clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) != LCL_CALLBACKSON) *rflagsp |= NFSV4OPEN_WDCONTENTION; - else if (nfsrv_issuedelegs == 0 || - NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt)) - *rflagsp |= NFSV4OPEN_WDRESOURCE; - else if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0) - *rflagsp |= NFSV4OPEN_WDNOTWANTED; else { new_deleg->ls_stateid.seqid = delegstateidp->seqid = 1; new_deleg->ls_stateid.other[0] = delegstateidp->other[0] @@ -3088,16 +3089,17 @@ tryagain: /* * This is where we can choose to issue a delegation. */ - if (delegate == 0 || (writedeleg == 0 && readonly == 0) || - !NFSVNO_DELEGOK(vp) || + if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0) + *rflagsp |= NFSV4OPEN_WDNOTWANTED; + else if (nfsrv_issuedelegs == 0) + *rflagsp |= NFSV4OPEN_WDSUPPFTYPE; + else if (NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt)) + *rflagsp |= NFSV4OPEN_WDRESOURCE; + else if (delegate == 0 || (writedeleg == 0 && + readonly == 0) || !NFSVNO_DELEGOK(vp) || (clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) != LCL_CALLBACKSON) *rflagsp |= NFSV4OPEN_WDCONTENTION; - else if (nfsrv_issuedelegs == 0 || - NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt)) - *rflagsp |= NFSV4OPEN_WDRESOURCE; - else if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0) - *rflagsp |= NFSV4OPEN_WDNOTWANTED; else { new_deleg->ls_stateid.seqid = delegstateidp->seqid = 1; new_deleg->ls_stateid.other[0] = delegstateidp->other[0] From owner-svn-src-stable@freebsd.org Thu Aug 2 08:04:22 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B8A6105CBF2; Thu, 2 Aug 2018 08:04:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3082379069; Thu, 2 Aug 2018 08:04:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 114236F3C; Thu, 2 Aug 2018 08:04:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7284L1N033603; Thu, 2 Aug 2018 08:04:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7284LIq033602; Thu, 2 Aug 2018 08:04:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020804.w7284LIq033602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:04:21 +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: r337068 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337068 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:04:22 -0000 Author: hselasky Date: Thu Aug 2 08:04:21 2018 New Revision: 337068 URL: https://svnweb.freebsd.org/changeset/base/337068 Log: MFC r335094 and r335123: Revert r335094 and properly fix OFED build after r335053. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_user_mad.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_user_mad.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_user_mad.c Thu Aug 2 07:43:28 2018 (r337067) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_user_mad.c Thu Aug 2 08:04:21 2018 (r337068) @@ -130,7 +130,7 @@ struct ib_umad_packet { static struct class *umad_class; -static const dev_t base_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE); +#define base_dev MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE) static DEFINE_SPINLOCK(port_lock); static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS); From owner-svn-src-stable@freebsd.org Thu Aug 2 08:05:21 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8B37105CC85; Thu, 2 Aug 2018 08:05:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9DCD6791AF; Thu, 2 Aug 2018 08:05:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 807856F3D; Thu, 2 Aug 2018 08:05:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7285KdG033715; Thu, 2 Aug 2018 08:05:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7285KXt033714; Thu, 2 Aug 2018 08:05:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020805.w7285KXt033714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:05:20 +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: r337069 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337069 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:05:21 -0000 Author: hselasky Date: Thu Aug 2 08:05:20 2018 New Revision: 337069 URL: https://svnweb.freebsd.org/changeset/base/337069 Log: MFC r336363: Process address resolve requests at least one time per second in ibcore. When setting a large address resolve timeout it was observed that the address resolving would succeed at the timeout and not when the address was available. Make sure the address resolving requests are processed no slower than one time every second. While at it use "int" for jiffies instead of "unsigned long" to match FreeBSD ticks. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:04:21 2018 (r337068) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:05:20 2018 (r337069) @@ -63,7 +63,7 @@ struct addr_req { void *context; void (*callback)(int status, struct sockaddr *src_addr, struct rdma_dev_addr *addr, void *context); - unsigned long timeout; + int timeout; int status; }; @@ -190,13 +190,15 @@ int rdma_translate_ip(const struct sockaddr *addr, } EXPORT_SYMBOL(rdma_translate_ip); -static void set_timeout(unsigned long time) +static void set_timeout(int time) { int delay; /* under FreeBSD ticks are 32-bit */ delay = time - jiffies; if (delay <= 0) delay = 1; + else if (delay > hz) + delay = hz; mod_delayed_work(addr_wq, &work, delay); } From owner-svn-src-stable@freebsd.org Thu Aug 2 08:06:18 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4409A105CD1C; Thu, 2 Aug 2018 08:06:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECDB079329; Thu, 2 Aug 2018 08:06:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF3A86F3E; Thu, 2 Aug 2018 08:06:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7286HaP033813; Thu, 2 Aug 2018 08:06:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7286HqW033812; Thu, 2 Aug 2018 08:06:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020806.w7286HqW033812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:06: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: r337070 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337070 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:06:18 -0000 Author: hselasky Date: Thu Aug 2 08:06:17 2018 New Revision: 337070 URL: https://svnweb.freebsd.org/changeset/base/337070 Log: MFC r336364: Only update source address when resolving is successful in ibcore. When resolving an IP address in ibcore, only update the source address upon normal completion. The ibcore address resolve function does not care about the scope ID value of the IPv6 link-local addresses and expects this information has already been extracted into the bound_dev_if field. Because the same IPv6 link-local address can exist on multiple interfaces the ibcore address resolver gets confused and returns ENETUNREACH. Instead of updating both source address and bound_dev_if just keep the address set to any address until resolving completes. For the sake of code symmetry a similar change has been applied to the IPv4 address resolve path. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:05:20 2018 (r337069) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:06:17 2018 (r337070) @@ -257,7 +257,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, }; struct sockaddr_in dst_tmp = *dst_in; in_port_t src_port; - struct sockaddr *saddr; + struct sockaddr *saddr = NULL; struct rtentry *rte; struct ifnet *ifp; int error; @@ -333,11 +333,6 @@ static int addr4_resolve(struct sockaddr_in *src_in, /* get destination network interface from route */ ifp = rte->rt_ifp; dev_hold(ifp); - - /* update source address */ - src_port = src_in->sin_port; - memcpy(src_in, saddr, rdma_addr_size(saddr)); - src_in->sin_port = src_port; /* preserve port number */ break; default: break; @@ -369,6 +364,15 @@ static int addr4_resolve(struct sockaddr_in *src_in, addr->network = RDMA_NETWORK_IPV4; } + /* + * Step 4 - update source address, if any + */ + if (saddr != NULL) { + src_port = src_in->sin_port; + memcpy(src_in, saddr, rdma_addr_size(saddr)); + src_in->sin_port = src_port; /* preserve port number */ + } + if (rte != NULL) RTFREE(rte); @@ -412,7 +416,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, }; struct sockaddr_in6 dst_tmp = *dst_in; in_port_t src_port; - struct sockaddr *saddr; + struct sockaddr *saddr = NULL; struct rtentry *rte; struct ifnet *ifp; int error; @@ -502,10 +506,6 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, /* get destination network interface from route */ ifp = rte->rt_ifp; dev_hold(ifp); - - src_port = src_in->sin6_port; - memcpy(src_in, saddr, rdma_addr_size(saddr)); - src_in->sin6_port = src_port; /* preserve port number */ break; default: break; @@ -532,6 +532,15 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, goto error_put_ifp; else if (is_gw != 0) addr->network = RDMA_NETWORK_IPV6; + } + + /* + * Step 4 - update source address, if any + */ + if (saddr != NULL) { + src_port = src_in->sin6_port; + memcpy(src_in, saddr, rdma_addr_size(saddr)); + src_in->sin6_port = src_port; /* preserve port number */ } if (rte != NULL) From owner-svn-src-stable@freebsd.org Thu Aug 2 08:07:12 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04768105CDF9; Thu, 2 Aug 2018 08:07:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ADDA479490; Thu, 2 Aug 2018 08:07:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F2576F42; Thu, 2 Aug 2018 08:07:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7287BAL033910; Thu, 2 Aug 2018 08:07:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7287Bl4033909; Thu, 2 Aug 2018 08:07:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020807.w7287Bl4033909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:07:11 +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: r337071 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337071 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:07:12 -0000 Author: hselasky Date: Thu Aug 2 08:07:10 2018 New Revision: 337071 URL: https://svnweb.freebsd.org/changeset/base/337071 Log: MFC r336365: Add lock to multicast handlers in ibcore. When two handlers used the same object in the old schema, we blocked the process in the kernel. The new schema just returns -EBUSY. This could lead to different behaviour in applications between the old schema and the new schema. In most cases, using such handlers concurrently could lead to crashing the process. For example, if thread A destroys a QP and thread B modifies it, we could have the destruction happens before the modification. In this case, we are accessing freed memory which could lead to crashing the process. This is true for most cases. However, attaching and detaching a multicast address from QP concurrently is safe. Therefore, we preserve the original behaviour by adding a lock there. Linux commit: f48b726920d96dcd1860df06143bdea7d6d7dcc3 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c stable/11/sys/ofed/drivers/infiniband/core/uverbs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu Aug 2 08:06:17 2018 (r337070) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu Aug 2 08:07:10 2018 (r337071) @@ -1794,6 +1794,7 @@ static int create_qp(struct ib_uverbs_file *file, init_uobj(&obj->uevent.uobject, cmd->user_handle, file->ucontext, &qp_lock_class); + mutex_init(&obj->mcast_lock); down_write(&obj->uevent.uobject.mutex); if (cmd_sz >= offsetof(typeof(*cmd), rwq_ind_tbl_handle) + sizeof(cmd->rwq_ind_tbl_handle) && @@ -3030,6 +3031,7 @@ ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file * obj = container_of(qp->uobject, struct ib_uqp_object, uevent.uobject); + mutex_lock(&obj->mcast_lock); list_for_each_entry(mcast, &obj->mcast_list, list) if (cmd.mlid == mcast->lid && !memcmp(cmd.gid, mcast->gid.raw, sizeof mcast->gid.raw)) { @@ -3053,6 +3055,7 @@ ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file * kfree(mcast); out_put: + mutex_unlock(&obj->mcast_lock); put_qp_write(qp); return ret ? ret : in_len; @@ -3076,12 +3079,13 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file * if (!qp) return -EINVAL; + obj = container_of(qp->uobject, struct ib_uqp_object, uevent.uobject); + mutex_lock(&obj->mcast_lock); + ret = ib_detach_mcast(qp, (union ib_gid *) cmd.gid, cmd.mlid); if (ret) goto out_put; - obj = container_of(qp->uobject, struct ib_uqp_object, uevent.uobject); - list_for_each_entry(mcast, &obj->mcast_list, list) if (cmd.mlid == mcast->lid && !memcmp(cmd.gid, mcast->gid.raw, sizeof mcast->gid.raw)) { @@ -3091,6 +3095,7 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file * } out_put: + mutex_unlock(&obj->mcast_lock); put_qp_write(qp); return ret ? ret : in_len; Modified: stable/11/sys/ofed/drivers/infiniband/core/uverbs.h ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/uverbs.h Thu Aug 2 08:06:17 2018 (r337070) +++ stable/11/sys/ofed/drivers/infiniband/core/uverbs.h Thu Aug 2 08:07:10 2018 (r337071) @@ -164,6 +164,8 @@ struct ib_usrq_object { struct ib_uqp_object { struct ib_uevent_object uevent; + /* lock for mcast list */ + struct mutex mcast_lock; struct list_head mcast_list; struct ib_uxrcd_object *uxrcd; }; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:08:03 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79C06105CEA8; Thu, 2 Aug 2018 08:08:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2EF7679623; Thu, 2 Aug 2018 08:08:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 107076F43; Thu, 2 Aug 2018 08:08:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w72882ds034002; Thu, 2 Aug 2018 08:08:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728827r034001; Thu, 2 Aug 2018 08:08:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020808.w728827r034001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:08: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: r337072 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337072 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:08:03 -0000 Author: hselasky Date: Thu Aug 2 08:08:02 2018 New Revision: 337072 URL: https://svnweb.freebsd.org/changeset/base/337072 Log: MFC r336366: If the MGID/MLID pair is not on the list return an error in ibcore. A list of MGID/MLID pairs is built when doing a multicast attach. When the multicast detach is called, the list is searched, and regardless of the search outcome, the driver detach is called. If an MGID/MLID pair is not on the list, driver detach should not be called, and an error should be returned. Calling the driver without removing an MGID/MLID pair from the list can leave the core and driver out of sync. Linux commit: 20c7840a77ddcb2ed2fbd66e8197db2868495751 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu Aug 2 08:07:10 2018 (r337071) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu Aug 2 08:08:02 2018 (r337072) @@ -3071,6 +3071,7 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file * struct ib_qp *qp; struct ib_uverbs_mcast_entry *mcast; int ret = -EINVAL; + bool found = false; if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -3082,17 +3083,21 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file * obj = container_of(qp->uobject, struct ib_uqp_object, uevent.uobject); mutex_lock(&obj->mcast_lock); - ret = ib_detach_mcast(qp, (union ib_gid *) cmd.gid, cmd.mlid); - if (ret) - goto out_put; - list_for_each_entry(mcast, &obj->mcast_list, list) if (cmd.mlid == mcast->lid && !memcmp(cmd.gid, mcast->gid.raw, sizeof mcast->gid.raw)) { list_del(&mcast->list); kfree(mcast); + found = true; break; } + + if (!found) { + ret = -EINVAL; + goto out_put; + } + + ret = ib_detach_mcast(qp, (union ib_gid *)cmd.gid, cmd.mlid); out_put: mutex_unlock(&obj->mcast_lock); From owner-svn-src-stable@freebsd.org Thu Aug 2 08:10:07 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50980105CFD6; Thu, 2 Aug 2018 08:10:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 06578797DF; Thu, 2 Aug 2018 08:10:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCFDF6F48; Thu, 2 Aug 2018 08:10:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728A6Xw034171; Thu, 2 Aug 2018 08:10:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728A629034169; Thu, 2 Aug 2018 08:10:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020810.w728A629034169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:10:06 +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: r337073 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337073 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:10:07 -0000 Author: hselasky Date: Thu Aug 2 08:10:06 2018 New Revision: 337073 URL: https://svnweb.freebsd.org/changeset/base/337073 Log: MFC r336367: Add native FreeBSD support for multicast in ibcore. This change adds support for registering multicast addresses, both IPv4 and IPv6. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:08:02 2018 (r337072) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:10:06 2018 (r337073) @@ -346,9 +346,12 @@ static int addr4_resolve(struct sockaddr_in *src_in, ifp->if_addrlen, MAX_ADDR_LEN); error = 0; } else if (IN_MULTICAST(ntohl(dst_tmp.sin_addr.s_addr))) { + bool is_gw = (rte->rt_flags & RTF_GATEWAY) != 0; error = addr_resolve_multi(edst, ifp, (struct sockaddr *)&dst_tmp); if (error != 0) goto error_put_ifp; + else if (is_gw) + addr->network = RDMA_NETWORK_IPV4; } else if (ifp->if_flags & IFF_LOOPBACK) { memset(edst, 0, MAX_ADDR_LEN); error = 0; @@ -360,7 +363,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, edst, NULL, NULL); if (error != 0) goto error_put_ifp; - else if (is_gw != 0) + else if (is_gw) addr->network = RDMA_NETWORK_IPV4; } @@ -515,10 +518,13 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, * Step 3 - resolve destination MAC address */ if (IN6_IS_ADDR_MULTICAST(&dst_tmp.sin6_addr)) { + bool is_gw = (rte->rt_flags & RTF_GATEWAY) != 0; error = addr_resolve_multi(edst, ifp, (struct sockaddr *)&dst_tmp); if (error != 0) goto error_put_ifp; + else if (is_gw) + addr->network = RDMA_NETWORK_IPV6; } else if (rte->rt_ifp->if_flags & IFF_LOOPBACK) { memset(edst, 0, MAX_ADDR_LEN); error = 0; @@ -530,7 +536,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, edst, NULL, NULL); if (error != 0) goto error_put_ifp; - else if (is_gw != 0) + else if (is_gw) addr->network = RDMA_NETWORK_IPV6; } Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:08:02 2018 (r337072) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:10:06 2018 (r337073) @@ -427,6 +427,30 @@ static inline void cma_set_ip_ver(struct cma_hdr *hdr, hdr->ip_version = (ip_ver << 4) | (hdr->ip_version & 0xF); } +static int cma_igmp_send(struct net_device *ndev, const union ib_gid *mgid, bool join) +{ + int retval; + + if (ndev) { + union { + struct sockaddr sock; + struct sockaddr_storage storage; + } addr; + + rdma_gid2ip(&addr.sock, mgid); + + CURVNET_SET_QUIET(ndev->if_vnet); + if (join) + retval = -if_addmulti(ndev, &addr.sock, NULL); + else + retval = -if_delmulti(ndev, &addr.sock); + CURVNET_RESTORE(); + } else { + retval = -ENODEV; + } + return retval; +} + static void _cma_attach_to_dev(struct rdma_id_private *id_priv, struct cma_device *cma_dev) { @@ -1621,6 +1645,9 @@ static void cma_leave_mc_groups(struct rdma_id_private ndev = dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if); if (ndev) { + cma_igmp_send(ndev, + &mc->multicast.ib->rec.mgid, + false); dev_put(ndev); } } @@ -4024,7 +4051,10 @@ static int cma_iboe_join_multicast(struct rdma_id_priv if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) { mc->multicast.ib->rec.hop_limit = IPV6_DEFAULT_HOPLIMIT; if (!send_only) { - mc->igmp_joined = true; + err = cma_igmp_send(ndev, &mc->multicast.ib->rec.mgid, + true); + if (!err) + mc->igmp_joined = true; } } } else { @@ -4129,6 +4159,9 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struc ndev = dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if); if (ndev) { + cma_igmp_send(ndev, + &mc->multicast.ib->rec.mgid, + false); dev_put(ndev); } mc->igmp_joined = false; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:10:55 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88C13105D057; Thu, 2 Aug 2018 08:10:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E37E7996D; Thu, 2 Aug 2018 08:10:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F6FC6F6C; Thu, 2 Aug 2018 08:10:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728Atw3034262; Thu, 2 Aug 2018 08:10:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728AsXX034259; Thu, 2 Aug 2018 08:10:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020810.w728AsXX034259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:10:54 +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: r337074 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337074 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:10:55 -0000 Author: hselasky Date: Thu Aug 2 08:10:54 2018 New Revision: 337074 URL: https://svnweb.freebsd.org/changeset/base/337074 Log: MFC r336368: Fix for RDMA loopback over VLAN in ibcore. Implement a more generic solution for detecting loopback. The problem was that the default netdevice was resolved for loopback also when VLAN was used. Use real network device instead of loopback device for bound device interface. How to test: ucmatose -b 127.0.0.1 -p 20090 ucmatose -s 5.6.5.1 -p 20090 Note that RDMA treats the IPv4 and IPv6 loopback addresses like any address. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c stable/11/sys/ofed/drivers/infiniband/core/ib_sa_query.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:10:06 2018 (r337073) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:10:54 2018 (r337074) @@ -124,7 +124,7 @@ int rdma_copy_addr(struct rdma_dev_addr *dev_addr, str const unsigned char *dst_dev_addr) { /* check for loopback device */ - if (dev->if_type == IFT_LOOP) { + if (dev->if_flags & IFF_LOOPBACK) { dev_addr->dev_type = ARPHRD_ETHER; memset(dev_addr->src_dev_addr, 0, MAX_ADDR_LEN); memset(dev_addr->broadcast, 0, MAX_ADDR_LEN); @@ -153,19 +153,12 @@ EXPORT_SYMBOL(rdma_copy_addr); int rdma_translate_ip(const struct sockaddr *addr, struct rdma_dev_addr *dev_addr) { - struct net_device *dev = NULL; - int ret = -EADDRNOTAVAIL; + struct net_device *dev; + int ret; if (dev_addr->bound_dev_if) { dev = dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if); - if (!dev) - return -ENODEV; - ret = rdma_copy_addr(dev_addr, dev, NULL); - dev_put(dev); - return ret; - } - - switch (addr->sa_family) { + } else switch (addr->sa_family) { #ifdef INET case AF_INET: dev = ip_dev_find(dev_addr->net, @@ -179,12 +172,19 @@ int rdma_translate_ip(const struct sockaddr *addr, break; #endif default: + dev = NULL; break; } if (dev != NULL) { - ret = rdma_copy_addr(dev_addr, dev, NULL); + /* disallow connections through 127.0.0.1 itself */ + if (dev->if_flags & IFF_LOOPBACK) + ret = -EINVAL; + else + ret = rdma_copy_addr(dev_addr, dev, NULL); dev_put(dev); + } else { + ret = -ENODEV; } return ret; } @@ -305,20 +305,39 @@ static int addr4_resolve(struct sockaddr_in *src_in, /* Step 2 - find outgoing network interface */ switch (type) { case ADDR_VALID: - /* check for loopback device */ - if (rte->rt_ifp->if_flags & IFF_LOOPBACK) { - ifp = rte->rt_ifp; - dev_hold(ifp); - } else if (addr->bound_dev_if != 0) { + /* get source interface */ + if (addr->bound_dev_if != 0) { ifp = dev_get_by_index(addr->net, addr->bound_dev_if); } else { ifp = ip_dev_find(addr->net, src_in->sin_addr.s_addr); } + /* check source interface */ if (ifp == NULL) { error = ENETUNREACH; goto error_rt_free; + } else if (ifp->if_flags & IFF_LOOPBACK) { + /* + * Source address cannot be a loopback device. + */ + error = EHOSTUNREACH; + goto error_put_ifp; + } else if (rte->rt_ifp->if_flags & IFF_LOOPBACK) { + if (memcmp(&src_in->sin_addr, &dst_in->sin_addr, + sizeof(src_in->sin_addr))) { + /* + * Destination is loopback, but source + * and destination address is not the + * same. + */ + error = EHOSTUNREACH; + goto error_put_ifp; + } } else if (ifp != rte->rt_ifp) { + /* + * Source and destination interfaces are + * different. + */ error = ENETUNREACH; goto error_put_ifp; } @@ -481,20 +500,39 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, /* Step 2 - find outgoing network interface */ switch (type) { case ADDR_VALID: - /* check for loopback device */ - if (rte->rt_ifp->if_flags & IFF_LOOPBACK) { - ifp = rte->rt_ifp; - dev_hold(ifp); - } else if (addr->bound_dev_if != 0) { + /* get source interface */ + if (addr->bound_dev_if != 0) { ifp = dev_get_by_index(addr->net, addr->bound_dev_if); } else { ifp = ip6_dev_find(addr->net, src_in->sin6_addr); } + /* check source interface */ if (ifp == NULL) { error = ENETUNREACH; goto error_rt_free; + } else if (ifp->if_flags & IFF_LOOPBACK) { + /* + * Source address cannot be a loopback device. + */ + error = EHOSTUNREACH; + goto error_put_ifp; + } else if (rte->rt_ifp->if_flags & IFF_LOOPBACK) { + if (memcmp(&src_in->sin6_addr, &dst_in->sin6_addr, + sizeof(src_in->sin6_addr))) { + /* + * Destination is loopback, but source + * and destination address is not the + * same. + */ + error = EHOSTUNREACH; + goto error_put_ifp; + } } else if (ifp != rte->rt_ifp) { + /* + * Source and destination interfaces are + * different. + */ error = ENETUNREACH; goto error_put_ifp; } @@ -586,11 +624,14 @@ static int addr_resolve_neigh(struct ifnet *dev, if (dev->if_flags & IFF_LOOPBACK) { int ret; + /* find real device, not loopback one */ + addr->bound_dev_if = 0; + ret = rdma_translate_ip(dst_in, addr); - if (!ret) + if (ret == 0) { memcpy(addr->dst_dev_addr, addr->src_dev_addr, MAX_ADDR_LEN); - + } return ret; } @@ -603,8 +644,7 @@ static int addr_resolve_neigh(struct ifnet *dev, static int addr_resolve(struct sockaddr *src_in, const struct sockaddr *dst_in, - struct rdma_dev_addr *addr, - bool resolve_neigh) + struct rdma_dev_addr *addr) { struct net_device *ndev = NULL; u8 edst[MAX_ADDR_LEN]; @@ -613,27 +653,30 @@ static int addr_resolve(struct sockaddr *src_in, if (dst_in->sa_family != src_in->sa_family) return -EINVAL; - if (src_in->sa_family == AF_INET) { + switch (src_in->sa_family) { + case AF_INET: ret = addr4_resolve((struct sockaddr_in *)src_in, (const struct sockaddr_in *)dst_in, addr, edst, &ndev); - if (ret) - return ret; - - if (resolve_neigh) - ret = addr_resolve_neigh(ndev, dst_in, edst, addr); - } else { + break; + case AF_INET6: ret = addr6_resolve((struct sockaddr_in6 *)src_in, (const struct sockaddr_in6 *)dst_in, addr, edst, &ndev); - if (ret) - return ret; - - if (resolve_neigh) - ret = addr_resolve_neigh(ndev, dst_in, edst, addr); + break; + default: + ret = -EADDRNOTAVAIL; + break; } - addr->bound_dev_if = ndev->if_index; + /* check for error */ + if (ret != 0) + return ret; + + /* store MAC addresses and check for loopback */ + ret = addr_resolve_neigh(ndev, dst_in, edst, addr); + + /* set belonging VNET, if any */ addr->net = dev_net(ndev); dev_put(ndev); @@ -653,8 +696,7 @@ static void process_req(struct work_struct *work) if (req->status == -ENODATA) { src_in = (struct sockaddr *) &req->src_addr; dst_in = (struct sockaddr *) &req->dst_addr; - req->status = addr_resolve(src_in, dst_in, req->addr, - true); + req->status = addr_resolve(src_in, dst_in, req->addr); if (req->status && time_after_eq(jiffies, req->timeout)) req->status = -ETIMEDOUT; else if (req->status == -ENODATA) @@ -714,7 +756,7 @@ int rdma_resolve_ip(struct rdma_addr_client *client, req->client = client; atomic_inc(&client->refcount); - req->status = addr_resolve(src_in, dst_in, addr, true); + req->status = addr_resolve(src_in, dst_in, addr); switch (req->status) { case 0: req->timeout = jiffies; @@ -752,7 +794,7 @@ int rdma_resolve_ip_route(struct sockaddr *src_addr, src_in->sa_family = dst_addr->sa_family; } - return addr_resolve(src_in, dst_addr, addr, false); + return addr_resolve(src_in, dst_addr, addr); } EXPORT_SYMBOL(rdma_resolve_ip_route); Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:10:06 2018 (r337073) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:10:54 2018 (r337074) @@ -568,12 +568,12 @@ static int cma_translate_addr(struct sockaddr *addr, s static inline int cma_validate_port(struct ib_device *device, u8 port, enum ib_gid_type gid_type, - union ib_gid *gid, int dev_type, - struct vnet *net, - int bound_if_index) + union ib_gid *gid, + const struct rdma_dev_addr *dev_addr) { + const int dev_type = dev_addr->dev_type; + struct net_device *ndev; int ret = -ENODEV; - struct net_device *ndev = NULL; if ((dev_type == ARPHRD_INFINIBAND) && !rdma_protocol_ib(device, port)) return ret; @@ -582,19 +582,9 @@ static inline int cma_validate_port(struct ib_device * return ret; if (dev_type == ARPHRD_ETHER && rdma_protocol_roce(device, port)) { - ndev = dev_get_by_index(net, bound_if_index); - if (ndev && ndev->if_flags & IFF_LOOPBACK) { - pr_info("detected loopback device\n"); - dev_put(ndev); - - if (!device->get_netdev) - return -EOPNOTSUPP; - - ndev = device->get_netdev(device, port); - if (!ndev) - return -ENODEV; - } + ndev = dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if); } else { + ndev = NULL; gid_type = IB_GID_TYPE_IB; } @@ -636,10 +626,7 @@ static int cma_acquire_dev(struct rdma_id_private *id_ ret = cma_validate_port(cma_dev->device, port, rdma_protocol_ib(cma_dev->device, port) ? IB_GID_TYPE_IB : - listen_id_priv->gid_type, gidp, - dev_addr->dev_type, - dev_addr->net, - dev_addr->bound_dev_if); + listen_id_priv->gid_type, gidp, dev_addr); if (!ret) { id_priv->id.port_num = port; goto out; @@ -660,9 +647,7 @@ static int cma_acquire_dev(struct rdma_id_private *id_ rdma_protocol_ib(cma_dev->device, port) ? IB_GID_TYPE_IB : cma_dev->default_gid_type[port - 1], - gidp, dev_addr->dev_type, - dev_addr->net, - dev_addr->bound_dev_if); + gidp, dev_addr); if (!ret) { id_priv->id.port_num = port; goto out; @@ -2521,21 +2506,6 @@ static int cma_resolve_iboe_route(struct rdma_id_priva if (!ndev) { ret = -ENODEV; goto err2; - } - - if (ndev->if_flags & IFF_LOOPBACK) { - dev_put(ndev); - if (!id_priv->id.device->get_netdev) { - ret = -EOPNOTSUPP; - goto err2; - } - - ndev = id_priv->id.device->get_netdev(id_priv->id.device, - id_priv->id.port_num); - if (!ndev) { - ret = -ENODEV; - goto err2; - } } route->path_rec->net = ndev->if_vnet; Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_sa_query.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_sa_query.c Thu Aug 2 08:10:06 2018 (r337073) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_sa_query.c Thu Aug 2 08:10:54 2018 (r337074) @@ -696,10 +696,9 @@ int ib_init_ah_from_path(struct ib_device *device, u8 resolved_dev = dev_get_by_index(dev_addr.net, dev_addr.bound_dev_if); - if (resolved_dev->if_flags & IFF_LOOPBACK) { - dev_put(resolved_dev); - resolved_dev = idev; - dev_hold(resolved_dev); + if (!resolved_dev) { + dev_put(idev); + return -ENODEV; } ndev = ib_get_ndev_from_path(rec); rcu_read_lock(); From owner-svn-src-stable@freebsd.org Thu Aug 2 08:12:02 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9536105D21B; Thu, 2 Aug 2018 08:12:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F00579C8E; Thu, 2 Aug 2018 08:12:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7032C6FBA; Thu, 2 Aug 2018 08:12:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728C1qe034396; Thu, 2 Aug 2018 08:12:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728C1LB034395; Thu, 2 Aug 2018 08:12:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020812.w728C1LB034395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:12:01 +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: r337075 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337075 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:12:02 -0000 Author: hselasky Date: Thu Aug 2 08:12:01 2018 New Revision: 337075 URL: https://svnweb.freebsd.org/changeset/base/337075 Log: MFC r336369: For multicast functions in ibcore, verify that LIDs are multicast LIDs. The Infiniband spec defines "A multicast address is defined by a MGID and a MLID" (section 10.5). Add check to verify that the MLID value is in the correct address range. RoCE Annex (A16.9.10/11) declares that during attach (detach) QP to a multicast group, if the QP is associated with a RoCE port, the multicast group MLID is unused and is ignored. During attach or detach multicast, when the QP is associated with a port, it is enough to check the port's link layer and validate the LID only if it is Infiniband. Otherwise, avoid validating the multicast LID. Linux commit: 8561eae60ff9417a50fa1fb2b83ae950dc5c1e21 5236333592244557a19694a51337df6ac018f0a7 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:10:54 2018 (r337074) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:12:01 2018 (r337075) @@ -1467,13 +1467,52 @@ EXPORT_SYMBOL(ib_dealloc_fmr); /* Multicast groups */ +static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid) +{ + struct ib_qp_init_attr init_attr = {}; + struct ib_qp_attr attr = {}; + int num_eth_ports = 0; + int port; + + /* If QP state >= init, it is assigned to a port and we can check this + * port only. + */ + if (!ib_query_qp(qp, &attr, IB_QP_STATE | IB_QP_PORT, &init_attr)) { + if (attr.qp_state >= IB_QPS_INIT) { + if (rdma_port_get_link_layer(qp->device, attr.port_num) != + IB_LINK_LAYER_INFINIBAND) + return true; + goto lid_check; + } + } + + /* Can't get a quick answer, iterate over all ports */ + for (port = 0; port < qp->device->phys_port_cnt; port++) + if (rdma_port_get_link_layer(qp->device, port) != + IB_LINK_LAYER_INFINIBAND) + num_eth_ports++; + + /* If we have at lease one Ethernet port, RoCE annex declares that + * multicast LID should be ignored. We can't tell at this step if the + * QP belongs to an IB or Ethernet port. + */ + if (num_eth_ports) + return true; + + /* If all the ports are IB, we can check according to IB spec. */ +lid_check: + return !(lid < be16_to_cpu(IB_MULTICAST_LID_BASE) || + lid == be16_to_cpu(IB_LID_PERMISSIVE)); +} + int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) { int ret; if (!qp->device->attach_mcast) return -ENOSYS; - if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD) + if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD || + !is_valid_mcast_lid(qp, lid)) return -EINVAL; ret = qp->device->attach_mcast(qp, gid, lid); @@ -1489,7 +1528,8 @@ int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gi if (!qp->device->detach_mcast) return -ENOSYS; - if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD) + if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD || + !is_valid_mcast_lid(qp, lid)) return -EINVAL; ret = qp->device->detach_mcast(qp, gid, lid); From owner-svn-src-stable@freebsd.org Thu Aug 2 08:12:53 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72510105D2A0; Thu, 2 Aug 2018 08:12:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2837E79E42; Thu, 2 Aug 2018 08:12:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0965670EC; Thu, 2 Aug 2018 08:12:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728Cq5d039218; Thu, 2 Aug 2018 08:12:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728Cq44039215; Thu, 2 Aug 2018 08:12:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020812.w728Cq44039215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:12:52 +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: r337076 - in stable/11/sys/ofed: drivers/infiniband/core include/rdma X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/ofed: drivers/infiniband/core include/rdma X-SVN-Commit-Revision: 337076 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:12:53 -0000 Author: hselasky Date: Thu Aug 2 08:12:52 2018 New Revision: 337076 URL: https://svnweb.freebsd.org/changeset/base/337076 Log: MFC r336370: Set RoCEv2 MGID according to spec in ibcore. RoCEv2 Annex states that for RoCEv2 over IPv4, the corresponding IPv4 address is encoded into the GID according to the following rule: GID= :ffff: Remove the 0xff0e prefix for RoCEv2 packets with IPv4 and leave it zeroed and change rdma_is_multicast_addr() to consider the new logic. Linux commit: be1d325a335840a86c133a56c6a911c368bac0fd 1c3aea2bc8f0b2e5b57375ead40457ff75a3a2ec Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c stable/11/sys/ofed/include/rdma/ib_addr.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:12:01 2018 (r337075) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:12:52 2018 (r337076) @@ -3947,7 +3947,8 @@ static void iboe_mcast_work_handler(struct work_struct kfree(mw); } -static void cma_iboe_set_mgid(struct sockaddr *addr, union ib_gid *mgid) +static void cma_iboe_set_mgid(struct sockaddr *addr, union ib_gid *mgid, + enum ib_gid_type gid_type) { struct sockaddr_in *sin = (struct sockaddr_in *)addr; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr; @@ -3957,8 +3958,8 @@ static void cma_iboe_set_mgid(struct sockaddr *addr, u } else if (addr->sa_family == AF_INET6) { memcpy(mgid, &sin6->sin6_addr, sizeof *mgid); } else { - mgid->raw[0] = 0xff; - mgid->raw[1] = 0x0e; + mgid->raw[0] = (gid_type == IB_GID_TYPE_IB) ? 0xff : 0; + mgid->raw[1] = (gid_type == IB_GID_TYPE_IB) ? 0x0e : 0; mgid->raw[2] = 0; mgid->raw[3] = 0; mgid->raw[4] = 0; @@ -3999,7 +4000,9 @@ static int cma_iboe_join_multicast(struct rdma_id_priv goto out1; } - cma_iboe_set_mgid(addr, &mc->multicast.ib->rec.mgid); + gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - + rdma_start_port(id_priv->cma_dev->device)]; + cma_iboe_set_mgid(addr, &mc->multicast.ib->rec.mgid, gid_type); mc->multicast.ib->rec.pkey = cpu_to_be16(0xffff); if (id_priv->id.ps == RDMA_PS_UDP) @@ -4015,8 +4018,6 @@ static int cma_iboe_join_multicast(struct rdma_id_priv mc->multicast.ib->rec.hop_limit = 1; mc->multicast.ib->rec.mtu = iboe_get_mtu(ndev->if_mtu); - gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - - rdma_start_port(id_priv->cma_dev->device)]; if (addr->sa_family == AF_INET) { if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) { mc->multicast.ib->rec.hop_limit = IPV6_DEFAULT_HOPLIMIT; Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:12:01 2018 (r337075) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:12:52 2018 (r337076) @@ -1511,8 +1511,9 @@ int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gi if (!qp->device->attach_mcast) return -ENOSYS; - if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD || - !is_valid_mcast_lid(qp, lid)) + + if (!rdma_is_multicast_addr((struct in6_addr *)gid->raw) || + qp->qp_type != IB_QPT_UD || !is_valid_mcast_lid(qp, lid)) return -EINVAL; ret = qp->device->attach_mcast(qp, gid, lid); @@ -1528,8 +1529,9 @@ int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gi if (!qp->device->detach_mcast) return -ENOSYS; - if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD || - !is_valid_mcast_lid(qp, lid)) + + if (!rdma_is_multicast_addr((struct in6_addr *)gid->raw) || + qp->qp_type != IB_QPT_UD || !is_valid_mcast_lid(qp, lid)) return -EINVAL; ret = qp->device->detach_mcast(qp, gid, lid); Modified: stable/11/sys/ofed/include/rdma/ib_addr.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_addr.h Thu Aug 2 08:12:01 2018 (r337075) +++ stable/11/sys/ofed/include/rdma/ib_addr.h Thu Aug 2 08:12:52 2018 (r337076) @@ -315,7 +315,13 @@ static inline void rdma_get_ll_mac(struct in6_addr *ad static inline int rdma_is_multicast_addr(struct in6_addr *addr) { - return addr->s6_addr[0] == 0xff; + __be32 ipv4_addr; + + if (addr->s6_addr[0] == 0xff) + return 1; + + ipv4_addr = addr->s6_addr32[3]; + return (ipv6_addr_v4mapped(addr) && ipv4_is_multicast(ipv4_addr)); } static inline void rdma_get_mcast_mac(struct in6_addr *addr, u8 *mac) From owner-svn-src-stable@freebsd.org Thu Aug 2 08:14:01 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26DAA105D34A; Thu, 2 Aug 2018 08:14:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD3B279FB1; Thu, 2 Aug 2018 08:14:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFE1070ED; Thu, 2 Aug 2018 08:14:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728E0kQ039325; Thu, 2 Aug 2018 08:14:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728E0kZ039324; Thu, 2 Aug 2018 08:14:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020814.w728E0kZ039324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:14:00 +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: r337077 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337077 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:14:01 -0000 Author: hselasky Date: Thu Aug 2 08:14:00 2018 New Revision: 337077 URL: https://svnweb.freebsd.org/changeset/base/337077 Log: MFC r336371: Set default GID type as RoCE when resolving RoCE route in ibcore. cma_iboe_set_mgid() is updated to reflect the RoCEv2 GID check. Linux commit: 5c181bda77f409d89ad513528eccac5f3a416474 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:12:52 2018 (r337076) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:14:00 2018 (r337077) @@ -3958,8 +3958,10 @@ static void cma_iboe_set_mgid(struct sockaddr *addr, u } else if (addr->sa_family == AF_INET6) { memcpy(mgid, &sin6->sin6_addr, sizeof *mgid); } else { - mgid->raw[0] = (gid_type == IB_GID_TYPE_IB) ? 0xff : 0; - mgid->raw[1] = (gid_type == IB_GID_TYPE_IB) ? 0x0e : 0; + mgid->raw[0] = + (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) ? 0 : 0xff; + mgid->raw[1] = + (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) ? 0 : 0x0e; mgid->raw[2] = 0; mgid->raw[3] = 0; mgid->raw[4] = 0; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:15:07 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DEDA105D405; Thu, 2 Aug 2018 08:15:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2EF47A11B; Thu, 2 Aug 2018 08:15:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A50F770EF; Thu, 2 Aug 2018 08:15:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728F6Bf039443; Thu, 2 Aug 2018 08:15:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728F50o039436; Thu, 2 Aug 2018 08:15:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020815.w728F50o039436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:15:05 +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: r337078 - in stable/11/sys: dev/mlx4/mlx4_ib dev/mlx5/mlx5_ib ofed/drivers/infiniband/core ofed/include/rdma X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: dev/mlx4/mlx4_ib dev/mlx5/mlx5_ib ofed/drivers/infiniband/core ofed/include/rdma X-SVN-Commit-Revision: 337078 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:15:07 -0000 Author: hselasky Date: Thu Aug 2 08:15:05 2018 New Revision: 337078 URL: https://svnweb.freebsd.org/changeset/base/337078 Log: MFC r336372: Add support for prio-tagged traffic for RDMA in ibcore. When receiving a PCP change all GID entries are reloaded. This ensures the relevant GID entries use prio tagging, by setting VLAN present and VLAN ID to zero. The priority for prio tagged traffic is set using the regular rdma_set_service_type() function. Fake the real network device to have a VLAN ID of zero when prio tagging is enabled. This is logic is hidden inside the rdma_vlan_dev_vlan_id() function which must always be used to retrieve the VLAN ID throughout all of ibcore and the infiniband network drivers. The VLAN presence information then propagates through all of ibcore and so incoming connections will have the VLAN bit set. The incoming VLAN ID is then checked against the return value of rdma_vlan_dev_vlan_id(). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c stable/11/sys/ofed/include/rdma/ib_addr.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c ============================================================================== --- stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c Thu Aug 2 08:14:00 2018 (r337077) +++ stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c Thu Aug 2 08:15:05 2018 (r337078) @@ -96,8 +96,7 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, return ERR_PTR(ret); eth_zero_addr(ah->av.eth.s_mac); if (gid_attr.ndev) { - if (is_vlan_dev(gid_attr.ndev)) - vlan_tag = vlan_dev_vlan_id(gid_attr.ndev); + vlan_tag = rdma_vlan_dev_vlan_id(gid_attr.ndev); memcpy(ah->av.eth.s_mac, IF_LLADDR(gid_attr.ndev), ETH_ALEN); dev_put(gid_attr.ndev); } Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 2 08:14:00 2018 (r337077) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 2 08:15:05 2018 (r337078) @@ -285,14 +285,16 @@ static void ib_gid_to_mlx5_roce_addr(const union ib_gi source_l3_address); void *mlx5_addr_mac = MLX5_ADDR_OF(roce_addr_layout, mlx5_addr, source_mac_47_32); + u16 vlan_id; if (!gid) return; ether_addr_copy(mlx5_addr_mac, IF_LLADDR(attr->ndev)); - if (is_vlan_dev(attr->ndev)) { + vlan_id = rdma_vlan_dev_vlan_id(attr->ndev); + if (vlan_id != 0xffff) { MLX5_SET_RA(mlx5_addr, vlan_valid, 1); - MLX5_SET_RA(mlx5_addr, vlan_id, vlan_dev_vlan_id(attr->ndev)); + MLX5_SET_RA(mlx5_addr, vlan_id, vlan_id); } switch (attr->gid_type) { Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Thu Aug 2 08:14:00 2018 (r337077) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Thu Aug 2 08:15:05 2018 (r337078) @@ -402,7 +402,20 @@ static struct notifier_block nb_inetaddr = { .notifier_call = inetaddr_event }; +static eventhandler_tag eh_ifnet_event; + static void +roce_ifnet_event(void *arg, struct ifnet *ifp, int event) +{ + if (event != IFNET_EVENT_PCP || is_vlan_dev(ifp)) + return; + + /* make sure GID table is reloaded */ + roce_gid_delete_all_event(ifp); + roce_gid_queue_scan_event(ifp); +} + +static void roce_rescan_device_handler(struct work_struct *_work) { struct roce_rescan_work *work = @@ -445,11 +458,18 @@ int __init roce_gid_mgmt_init(void) */ register_netdevice_notifier(&nb_inetaddr); + eh_ifnet_event = EVENTHANDLER_REGISTER(ifnet_event, + roce_ifnet_event, NULL, EVENTHANDLER_PRI_ANY); + return 0; } void __exit roce_gid_mgmt_cleanup(void) { + + if (eh_ifnet_event != NULL) + EVENTHANDLER_DEREGISTER(ifnet_event, eh_ifnet_event); + unregister_inetaddr_notifier(&nb_inetaddr); unregister_netdevice_notifier(&nb_inetaddr); Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:14:00 2018 (r337077) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:15:05 2018 (r337078) @@ -402,12 +402,8 @@ static bool find_gid_index(const union ib_gid *gid, if (ctx->gid_type != gid_attr->gid_type) return false; - - if ((!!(ctx->vlan_id != 0xffff) == !is_vlan_dev(gid_attr->ndev)) || - (is_vlan_dev(gid_attr->ndev) && - vlan_dev_vlan_id(gid_attr->ndev) != ctx->vlan_id)) + if (rdma_vlan_dev_vlan_id(gid_attr->ndev) != ctx->vlan_id) return false; - return true; } @@ -484,7 +480,7 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 po if (rdma_protocol_roce(device, port_num)) { struct ib_gid_attr dgid_attr; - const u16 vlan_id = wc->wc_flags & IB_WC_WITH_VLAN ? + const u16 vlan_id = (wc->wc_flags & IB_WC_WITH_VLAN) ? wc->vlan_id : 0xffff; if (!(wc->wc_flags & IB_WC_GRH)) Modified: stable/11/sys/ofed/include/rdma/ib_addr.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_addr.h Thu Aug 2 08:14:00 2018 (r337077) +++ stable/11/sys/ofed/include/rdma/ib_addr.h Thu Aug 2 08:15:05 2018 (r337078) @@ -163,6 +163,8 @@ static inline u16 rdma_vlan_dev_vlan_id(const struct n { uint16_t tag; + if (dev->if_pcp != IFNET_PCP_NONE) + return 0x0000; /* prio-tagged traffic */ if (VLAN_TAG(__DECONST(struct ifnet *, dev), &tag) != 0) return 0xffff; return tag; @@ -342,8 +344,10 @@ static inline u16 rdma_get_vlan_id(union ib_gid *dgid) return vid < 0x1000 ? vid : 0xffff; } -static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device *dev) +static inline struct net_device *rdma_vlan_dev_real_dev(struct net_device *dev) { + if (dev->if_pcp != IFNET_PCP_NONE) + return dev; /* prio-tagged traffic */ return VLAN_TRUNKDEV(__DECONST(struct ifnet *, dev)); } From owner-svn-src-stable@freebsd.org Thu Aug 2 08:17:10 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A932105D4C3; Thu, 2 Aug 2018 08:17:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE6D17A288; Thu, 2 Aug 2018 08:17:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A899170F0; Thu, 2 Aug 2018 08:17:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728H9D8039579; Thu, 2 Aug 2018 08:17:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728H97S039578; Thu, 2 Aug 2018 08:17:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020817.w728H97S039578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:17: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: r337079 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337079 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:17:10 -0000 Author: hselasky Date: Thu Aug 2 08:17:09 2018 New Revision: 337079 URL: https://svnweb.freebsd.org/changeset/base/337079 Log: MFC r336373: Ensure that CM_ID exists prior to access it in ibcore. Prior to access UCMA commands, the context should be initialized and connected to CM_ID with ucma_create_id(). In case user skips this step, he can provide non-valid ctx without CM_ID and cause to multiple NULL dereferences. Also there are situations where the create_id can be raced with other user access, ensure that the context is only shared to other threads once it is fully initialized to avoid the races. Linux commit: e8980d67d6017c8eee8f9c35f782c4bd68e004c9 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c Thu Aug 2 08:15:05 2018 (r337078) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c Thu Aug 2 08:17:09 2018 (r337079) @@ -124,7 +124,7 @@ static inline struct ucma_context *_ucma_find_context( ctx = idr_find(&ctx_idr, id); if (!ctx) ctx = ERR_PTR(-ENOENT); - else if (ctx->file != file) + else if (ctx->file != file || !ctx->cm_id) ctx = ERR_PTR(-EINVAL); return ctx; } @@ -446,6 +446,7 @@ static ssize_t ucma_create_id(struct ucma_file *file, struct rdma_ucm_create_id cmd; struct rdma_ucm_create_id_resp resp; struct ucma_context *ctx; + struct rdma_cm_id *cm_id; enum ib_qp_type qp_type; int ret; @@ -466,10 +467,10 @@ static ssize_t ucma_create_id(struct ucma_file *file, return -ENOMEM; ctx->uid = cmd.uid; - ctx->cm_id = rdma_create_id(TD_TO_VNET(curthread), - ucma_event_handler, ctx, cmd.ps, qp_type); - if (IS_ERR(ctx->cm_id)) { - ret = PTR_ERR(ctx->cm_id); + cm_id = rdma_create_id(TD_TO_VNET(curthread), + ucma_event_handler, ctx, cmd.ps, qp_type); + if (IS_ERR(cm_id)) { + ret = PTR_ERR(cm_id); goto err1; } @@ -479,10 +480,12 @@ static ssize_t ucma_create_id(struct ucma_file *file, ret = -EFAULT; goto err2; } + + ctx->cm_id = cm_id; return 0; err2: - rdma_destroy_id(ctx->cm_id); + rdma_destroy_id(cm_id); err1: mutex_lock(&mut); idr_remove(&ctx_idr, ctx->id); From owner-svn-src-stable@freebsd.org Thu Aug 2 08:18:12 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF982105D5C0; Thu, 2 Aug 2018 08:18:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 951AF7A426; Thu, 2 Aug 2018 08:18:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7643070F2; Thu, 2 Aug 2018 08:18:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728IC1U039680; Thu, 2 Aug 2018 08:18:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728ICrT039679; Thu, 2 Aug 2018 08:18:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020818.w728ICrT039679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:18: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: r337080 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337080 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:18:13 -0000 Author: hselasky Date: Thu Aug 2 08:18:11 2018 New Revision: 337080 URL: https://svnweb.freebsd.org/changeset/base/337080 Log: MFC r336374: Avoid that ib_drain_qp() triggers an out-of-bounds stack access in ibcore. Linux commit: a1ae7d0345edd593d6725d3218434d903a0af95d Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:17:09 2018 (r337079) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:18:11 2018 (r337080) @@ -1940,7 +1940,13 @@ static void __ib_drain_sq(struct ib_qp *qp) { struct ib_qp_attr attr = { .qp_state = IB_QPS_ERR }; struct ib_drain_cqe sdrain; - struct ib_send_wr swr = {}, *bad_swr; + struct ib_send_wr *bad_swr; + struct ib_rdma_wr swr = { + .wr = { + .opcode = IB_WR_RDMA_WRITE, + .wr_cqe = &sdrain.cqe, + }, + }; int ret; if (qp->send_cq->poll_ctx == IB_POLL_DIRECT) { @@ -1949,7 +1955,6 @@ static void __ib_drain_sq(struct ib_qp *qp) return; } - swr.wr_cqe = &sdrain.cqe; sdrain.cqe.done = ib_drain_qp_done; init_completion(&sdrain.done); @@ -1959,7 +1964,7 @@ static void __ib_drain_sq(struct ib_qp *qp) return; } - ret = ib_post_send(qp, &swr, &bad_swr); + ret = ib_post_send(qp, &swr.wr, &bad_swr); if (ret) { WARN_ONCE(ret, "failed to drain send queue: %d\n", ret); return; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:19:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B59A3105D65B; Thu, 2 Aug 2018 08:19:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6AF1F7A592; Thu, 2 Aug 2018 08:19:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D30170F3; Thu, 2 Aug 2018 08:19:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728J91n039779; Thu, 2 Aug 2018 08:19:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728J9Xs039778; Thu, 2 Aug 2018 08:19:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020819.w728J9Xs039778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:19: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: r337081 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337081 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:19:09 -0000 Author: hselasky Date: Thu Aug 2 08:19:08 2018 New Revision: 337081 URL: https://svnweb.freebsd.org/changeset/base/337081 Log: MFC r336375: Fix access to non-initialized CM_ID object in ibcore. The attempt to join multicast group without ensuring that CMA device exists will lead to the following crash reported by syzkaller. Linux commit: 7688f2c3bbf55e52388e37ac5d63ca471a7712e1 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:18:11 2018 (r337080) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:19:08 2018 (r337081) @@ -4064,6 +4064,9 @@ int rdma_join_multicast(struct rdma_cm_id *id, struct struct cma_multicast *mc; int ret; + if (!id->device) + return -EINVAL; + id_priv = container_of(id, struct rdma_id_private, id); if (!cma_comp(id_priv, RDMA_CM_ADDR_BOUND) && !cma_comp(id_priv, RDMA_CM_ADDR_RESOLVED)) From owner-svn-src-stable@freebsd.org Thu Aug 2 08:20:12 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81C54105D788; Thu, 2 Aug 2018 08:20:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 380C17A741; Thu, 2 Aug 2018 08:20:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A51F70FA; Thu, 2 Aug 2018 08:20:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728KB6r039911; Thu, 2 Aug 2018 08:20:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728KB0B039910; Thu, 2 Aug 2018 08:20:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020820.w728KB0B039910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:20:11 +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: r337082 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337082 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:20:12 -0000 Author: hselasky Date: Thu Aug 2 08:20:11 2018 New Revision: 337082 URL: https://svnweb.freebsd.org/changeset/base/337082 Log: MFC r336376: Fix NULL pointer dereference during device removal in ibcore. As part of ib_uverbs_remove_one which might be triggered upon reset flow, we trigger IB_EVENT_DEVICE_FATAL event to userspace application. If device was removed after uverbs fd was opened but before ib_uverbs_get_context was called, the event file will be accessed before it was allocated, result in NULL pointer dereference: Linux commit: 870201f95fcbd19538aef630393fe9d583eff82e Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c Thu Aug 2 08:19:08 2018 (r337081) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c Thu Aug 2 08:20:11 2018 (r337082) @@ -1274,7 +1274,6 @@ static void ib_uverbs_free_hw_resources(struct ib_uver kref_get(&file->ref); mutex_unlock(&uverbs_dev->lists_mutex); - ib_uverbs_event_handler(&file->event_handler, &event); mutex_lock(&file->cleanup_mutex); ucontext = file->ucontext; @@ -1291,6 +1290,7 @@ static void ib_uverbs_free_hw_resources(struct ib_uver * for example due to freeing the resources * (e.g mmput). */ + ib_uverbs_event_handler(&file->event_handler, &event); ib_dev->disassociate_ucontext(ucontext); ib_uverbs_cleanup_ucontext(file, ucontext); } From owner-svn-src-stable@freebsd.org Thu Aug 2 08:21:05 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D298F105D888; Thu, 2 Aug 2018 08:21:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85C6E7AA59; Thu, 2 Aug 2018 08:21:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67BF7721E; Thu, 2 Aug 2018 08:21:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728L5hQ040710; Thu, 2 Aug 2018 08:21:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728L59e040709; Thu, 2 Aug 2018 08:21:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020821.w728L59e040709@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:21:05 +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: r337083 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337083 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:21:06 -0000 Author: hselasky Date: Thu Aug 2 08:21:04 2018 New Revision: 337083 URL: https://svnweb.freebsd.org/changeset/base/337083 Log: MFC r336377: Fix kernel panic while using XRC_TGT QP type in ibcore. Attempt to modify XRC_TGT QP type from the user space (ibv_xsrq_pingpong invocation) will trigger the following kernel panic. It is caused by the fact that such QPs missed uobject initialization. Linux commit: f45765872e7aae7b81feb3044aaf9886b21885ef Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu Aug 2 08:20:11 2018 (r337082) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu Aug 2 08:21:04 2018 (r337083) @@ -1943,6 +1943,9 @@ static int create_qp(struct ib_uverbs_file *file, atomic_inc(&attr.srq->usecnt); if (ind_tbl) atomic_inc(&ind_tbl->usecnt); + } else { + /* It is done in _ib_create_qp for other QP types */ + qp->uobject = &obj->uevent.uobject; } qp->uobject = &obj->uevent.uobject; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:21:56 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F945105D958; Thu, 2 Aug 2018 08:21:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 34EB57AC32; Thu, 2 Aug 2018 08:21:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15EE87259; Thu, 2 Aug 2018 08:21:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728LtZh043789; Thu, 2 Aug 2018 08:21:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728LttN043788; Thu, 2 Aug 2018 08:21:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020821.w728LttN043788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:21: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: r337084 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:21:56 -0000 Author: hselasky Date: Thu Aug 2 08:21:55 2018 New Revision: 337084 URL: https://svnweb.freebsd.org/changeset/base/337084 Log: MFC r336379: Check for a cm_id->device in all user calls that need it in ibcore. This was done by auditing all callers of ucma_get_ctx and switching the ones that unconditionally touch ->device to ucma_get_ctx_dev. This covers a little less than half of the call sites. The 11 remaining call sites to ucma_get_ctx() were manually audited. Linux commit: 4b658d1bbc16605330694bb3ef2570c465ef383d 8b77586bd8fe600d97f922c79f7222c46f37c118 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c Thu Aug 2 08:21:04 2018 (r337083) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c Thu Aug 2 08:21:55 2018 (r337084) @@ -151,6 +151,23 @@ static void ucma_put_ctx(struct ucma_context *ctx) complete(&ctx->comp); } +/* + * Same as ucm_get_ctx but requires that ->cm_id->device is valid, eg that the + * CM_ID is bound. + */ +static struct ucma_context *ucma_get_ctx_dev(struct ucma_file *file, int id) +{ + struct ucma_context *ctx = ucma_get_ctx(file, id); + + if (IS_ERR(ctx)) + return ctx; + if (!ctx->cm_id->device) { + ucma_put_ctx(ctx); + return ERR_PTR(-EINVAL); + } + return ctx; +} + static void ucma_close_event_id(struct work_struct *work) { struct ucma_event *uevent_close = container_of(work, struct ucma_event, close_work); @@ -712,7 +729,7 @@ static ssize_t ucma_resolve_route(struct ucma_file *fi if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; - ctx = ucma_get_ctx(file, cmd.id); + ctx = ucma_get_ctx_dev(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); @@ -1020,7 +1037,7 @@ static ssize_t ucma_connect(struct ucma_file *file, co if (!cmd.conn_param.valid) return -EINVAL; - ctx = ucma_get_ctx(file, cmd.id); + ctx = ucma_get_ctx_dev(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); @@ -1062,7 +1079,7 @@ static ssize_t ucma_accept(struct ucma_file *file, con if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; - ctx = ucma_get_ctx(file, cmd.id); + ctx = ucma_get_ctx_dev(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); @@ -1090,7 +1107,7 @@ static ssize_t ucma_reject(struct ucma_file *file, con if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; - ctx = ucma_get_ctx(file, cmd.id); + ctx = ucma_get_ctx_dev(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); @@ -1109,7 +1126,7 @@ static ssize_t ucma_disconnect(struct ucma_file *file, if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; - ctx = ucma_get_ctx(file, cmd.id); + ctx = ucma_get_ctx_dev(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); @@ -1134,7 +1151,7 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *fil if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; - ctx = ucma_get_ctx(file, cmd.id); + ctx = ucma_get_ctx_dev(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); @@ -1329,7 +1346,7 @@ static ssize_t ucma_process_join(struct ucma_file *fil else return -EINVAL; - ctx = ucma_get_ctx(file, cmd->id); + ctx = ucma_get_ctx_dev(file, cmd->id); if (IS_ERR(ctx)) return PTR_ERR(ctx); From owner-svn-src-stable@freebsd.org Thu Aug 2 08:22:55 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB363105DB63; Thu, 2 Aug 2018 08:22:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6FDF27AE42; Thu, 2 Aug 2018 08:22:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 528927288; Thu, 2 Aug 2018 08:22:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728Ms0h044606; Thu, 2 Aug 2018 08:22:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728MrxP044604; Thu, 2 Aug 2018 08:22:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020822.w728MrxP044604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:22:53 +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: r337085 - in stable/11/sys/ofed: drivers/infiniband/core include/rdma X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/ofed: drivers/infiniband/core include/rdma X-SVN-Commit-Revision: 337085 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:22:55 -0000 Author: hselasky Date: Thu Aug 2 08:22:53 2018 New Revision: 337085 URL: https://svnweb.freebsd.org/changeset/base/337085 Log: MFC r336380: Check AF family prior resolving address and introduce safer rdma_addr_size() variants in ibcore. Garbage supplied by user will cause to UCMA module provide zero memory size for memcpy(), because it wasn't checked, it will produce unpredictable results in rdma_resolve_addr(). There are several places in the ucma ABI where userspace can pass in a sockaddr but set the address family to AF_IB. When that happens, rdma_addr_size() will return a size bigger than sizeof struct sockaddr_in6, and the ucma kernel code might end up copying past the end of a buffer not sized for a struct sockaddr_ib. Fix this by introducing new variants int rdma_addr_size_in6(struct sockaddr_in6 *addr); int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr); that are type-safe for the types used in the ucma ABI and return 0 if the size computed is bigger than the size of the type passed in. We can use these new variants to check what size userspace has passed in before copying any addresses. Linux commit: 2975d5de6428ff6d9317e9948f0968f7d42e5d74 09abfe7b5b2f442a85f4c4d59ecf582ad76088d7 84652aefb347297aa08e91e283adf7b18f77c2d5 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c stable/11/sys/ofed/include/rdma/ib_addr.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:21:55 2018 (r337084) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:22:53 2018 (r337085) @@ -89,6 +89,22 @@ int rdma_addr_size(struct sockaddr *addr) } EXPORT_SYMBOL(rdma_addr_size); +int rdma_addr_size_in6(struct sockaddr_in6 *addr) +{ + int ret = rdma_addr_size((struct sockaddr *) addr); + + return ret <= sizeof(*addr) ? ret : 0; +} +EXPORT_SYMBOL(rdma_addr_size_in6); + +int rdma_addr_size_kss(struct sockaddr_storage *addr) +{ + int ret = rdma_addr_size((struct sockaddr *) addr); + + return ret <= sizeof(*addr) ? ret : 0; +} +EXPORT_SYMBOL(rdma_addr_size_kss); + static struct rdma_addr_client self; void rdma_addr_register_client(struct rdma_addr_client *client) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c Thu Aug 2 08:21:55 2018 (r337084) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c Thu Aug 2 08:22:53 2018 (r337085) @@ -636,6 +636,9 @@ static ssize_t ucma_bind_ip(struct ucma_file *file, co if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; + if (!rdma_addr_size_in6(&cmd.addr)) + return -EINVAL; + ctx = ucma_get_ctx(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); @@ -649,22 +652,21 @@ static ssize_t ucma_bind(struct ucma_file *file, const int in_len, int out_len) { struct rdma_ucm_bind cmd; - struct sockaddr *addr; struct ucma_context *ctx; int ret; if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; - addr = (struct sockaddr *) &cmd.addr; - if (cmd.reserved || !cmd.addr_size || (cmd.addr_size != rdma_addr_size(addr))) + if (cmd.reserved || !cmd.addr_size || + cmd.addr_size != rdma_addr_size_kss(&cmd.addr)) return -EINVAL; ctx = ucma_get_ctx(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); - ret = rdma_bind_addr(ctx->cm_id, addr); + ret = rdma_bind_addr(ctx->cm_id, (struct sockaddr *) &cmd.addr); ucma_put_ctx(ctx); return ret; } @@ -680,13 +682,16 @@ static ssize_t ucma_resolve_ip(struct ucma_file *file, if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; + if ((cmd.src_addr.sin6_family && !rdma_addr_size_in6(&cmd.src_addr)) || + !rdma_addr_size_in6(&cmd.dst_addr)) + return -EINVAL; + ctx = ucma_get_ctx(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); ret = rdma_resolve_addr(ctx->cm_id, (struct sockaddr *) &cmd.src_addr, - (struct sockaddr *) &cmd.dst_addr, - cmd.timeout_ms); + (struct sockaddr *) &cmd.dst_addr, cmd.timeout_ms); ucma_put_ctx(ctx); return ret; } @@ -696,24 +701,23 @@ static ssize_t ucma_resolve_addr(struct ucma_file *fil int in_len, int out_len) { struct rdma_ucm_resolve_addr cmd; - struct sockaddr *src, *dst; struct ucma_context *ctx; int ret; if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; - src = (struct sockaddr *) &cmd.src_addr; - dst = (struct sockaddr *) &cmd.dst_addr; - if (cmd.reserved || (cmd.src_size && (cmd.src_size != rdma_addr_size(src))) || - !cmd.dst_size || (cmd.dst_size != rdma_addr_size(dst))) + if (cmd.reserved || + (cmd.src_size && (cmd.src_size != rdma_addr_size_kss(&cmd.src_addr))) || + !cmd.dst_size || (cmd.dst_size != rdma_addr_size_kss(&cmd.dst_addr))) return -EINVAL; ctx = ucma_get_ctx(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); - ret = rdma_resolve_addr(ctx->cm_id, src, dst, cmd.timeout_ms); + ret = rdma_resolve_addr(ctx->cm_id, (struct sockaddr *) &cmd.src_addr, + (struct sockaddr *) &cmd.dst_addr, cmd.timeout_ms); ucma_put_ctx(ctx); return ret; } @@ -1403,7 +1407,7 @@ static ssize_t ucma_join_ip_multicast(struct ucma_file join_cmd.response = cmd.response; join_cmd.uid = cmd.uid; join_cmd.id = cmd.id; - join_cmd.addr_size = rdma_addr_size((struct sockaddr *) &cmd.addr); + join_cmd.addr_size = rdma_addr_size_in6(&cmd.addr); join_cmd.join_flags = RDMA_MC_JOIN_FLAG_FULLMEMBER; memcpy(&join_cmd.addr, &cmd.addr, join_cmd.addr_size); @@ -1418,6 +1422,9 @@ static ssize_t ucma_join_multicast(struct ucma_file *f if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; + + if (!rdma_addr_size_kss(&cmd.addr)) + return -EINVAL; return ucma_process_join(file, &cmd, out_len); } Modified: stable/11/sys/ofed/include/rdma/ib_addr.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_addr.h Thu Aug 2 08:21:55 2018 (r337084) +++ stable/11/sys/ofed/include/rdma/ib_addr.h Thu Aug 2 08:22:53 2018 (r337085) @@ -131,6 +131,8 @@ int rdma_copy_addr(struct rdma_dev_addr *dev_addr, str const unsigned char *dst_dev_addr); int rdma_addr_size(struct sockaddr *addr); +int rdma_addr_size_in6(struct sockaddr_in6 *addr); +int rdma_addr_size_kss(struct sockaddr_storage *addr); int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, const union ib_gid *dgid, From owner-svn-src-stable@freebsd.org Thu Aug 2 08:23:55 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3846105DC7D; Thu, 2 Aug 2018 08:23:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 58E3C7B025; Thu, 2 Aug 2018 08:23:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A727728A; Thu, 2 Aug 2018 08:23:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728Nthp044704; Thu, 2 Aug 2018 08:23:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728NtvB044703; Thu, 2 Aug 2018 08:23:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020823.w728NtvB044703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:23: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: r337086 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337086 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:23:55 -0000 Author: hselasky Date: Thu Aug 2 08:23:54 2018 New Revision: 337086 URL: https://svnweb.freebsd.org/changeset/base/337086 Log: MFC r336381: Fix kernel crash during fail to initialize device in ibcore. This patch fixes the kernel crash that occurs during ib_dealloc_device() called due to provider driver fails with an error after ib_alloc_device() and before it can register using ib_register_device(). This crashed seen in tha lab as below which can occur with any IB device which fails to perform its device initialization before invoking ib_register_device(). This patch avoids touching cache and port immutable structures if device is not yet initialized. It also releases related memory when cache and port immutable data structure initialization fails during register_device() state. Linux commit: 4be3a4fa51f432ef045546d16f25c68a1ab525b9 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_device.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_device.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_device.c Thu Aug 2 08:22:53 2018 (r337085) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_device.c Thu Aug 2 08:23:54 2018 (r337086) @@ -174,8 +174,16 @@ static void ib_device_release(struct device *device) { struct ib_device *dev = container_of(device, struct ib_device, dev); - ib_cache_release_one(dev); - kfree(dev->port_immutable); + WARN_ON(dev->reg_state == IB_DEV_REGISTERED); + if (dev->reg_state == IB_DEV_UNREGISTERED) { + /* + * In IB_DEV_UNINITIALIZED state, cache or port table + * is not even created. Free cache and port table only when + * device reaches UNREGISTERED state. + */ + ib_cache_release_one(dev); + kfree(dev->port_immutable); + } kfree(dev); } @@ -347,23 +355,21 @@ int ib_register_device(struct ib_device *device, ret = ib_cache_setup_one(device); if (ret) { pr_warn("Couldn't set up InfiniBand P_Key/GID cache\n"); - goto out; + goto port_cleanup; } memset(&device->attrs, 0, sizeof(device->attrs)); ret = device->query_device(device, &device->attrs, &uhw); if (ret) { pr_warn("Couldn't query the device attributes\n"); - ib_cache_cleanup_one(device); - goto out; + goto cache_cleanup; } ret = ib_device_register_sysfs(device, port_callback); if (ret) { pr_warn("Couldn't register device %s with driver model\n", device->name); - ib_cache_cleanup_one(device); - goto out; + goto cache_cleanup; } device->reg_state = IB_DEV_REGISTERED; @@ -375,6 +381,14 @@ int ib_register_device(struct ib_device *device, down_write(&lists_rwsem); list_add_tail(&device->core_list, &device_list); up_write(&lists_rwsem); + mutex_unlock(&device_mutex); + return 0; + +cache_cleanup: + ib_cache_cleanup_one(device); + ib_cache_release_one(device); +port_cleanup: + kfree(device->port_immutable); out: mutex_unlock(&device_mutex); return ret; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:24:46 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E891D105DD4F; Thu, 2 Aug 2018 08:24:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9DE417B1A3; Thu, 2 Aug 2018 08:24:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FA33728C; Thu, 2 Aug 2018 08:24:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728OjiJ044805; Thu, 2 Aug 2018 08:24:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728OjGH044804; Thu, 2 Aug 2018 08:24:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020824.w728OjGH044804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:24: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: r337087 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337087 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:24:46 -0000 Author: hselasky Date: Thu Aug 2 08:24:45 2018 New Revision: 337087 URL: https://svnweb.freebsd.org/changeset/base/337087 Log: MFC r336382: Depend on IPv6 stack to resolve link local address for RoCEv2 in ibcore. RoCEv1 does not use the IPv6 stack to resolve the link local DGID since it uses GID address. It forms the DMAC directly from the DGID. Linux commit: 56d0a7d9a0f045ee27a001762deac28c7d28e2e4 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:23:54 2018 (r337086) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:24:45 2018 (r337087) @@ -1160,7 +1160,10 @@ EXPORT_SYMBOL(ib_modify_qp_is_ok); int ib_resolve_eth_dmac(struct ib_device *device, struct ib_ah_attr *ah_attr) { - int ret = 0; + struct ib_gid_attr sgid_attr; + union ib_gid sgid; + int hop_limit; + int ret; if (ah_attr->port_num < rdma_start_port(device) || ah_attr->port_num > rdma_end_port(device)) @@ -1169,35 +1172,22 @@ int ib_resolve_eth_dmac(struct ib_device *device, if (!rdma_cap_eth_ah(device, ah_attr->port_num)) return 0; - if (rdma_link_local_addr((struct in6_addr *)ah_attr->grh.dgid.raw)) { - rdma_get_ll_mac((struct in6_addr *)ah_attr->grh.dgid.raw, - ah_attr->dmac); - } else { - union ib_gid sgid; - struct ib_gid_attr sgid_attr; - int hop_limit; + ret = ib_query_gid(device, + ah_attr->port_num, + ah_attr->grh.sgid_index, + &sgid, &sgid_attr); + if (ret != 0) + return (ret); + if (!sgid_attr.ndev) + return -ENXIO; - ret = ib_query_gid(device, - ah_attr->port_num, - ah_attr->grh.sgid_index, - &sgid, &sgid_attr); + ret = rdma_addr_find_l2_eth_by_grh(&sgid, + &ah_attr->grh.dgid, + ah_attr->dmac, + sgid_attr.ndev, &hop_limit); + dev_put(sgid_attr.ndev); - if (ret || !sgid_attr.ndev) { - if (!ret) - ret = -ENXIO; - goto out; - } - - ret = rdma_addr_find_l2_eth_by_grh(&sgid, - &ah_attr->grh.dgid, - ah_attr->dmac, - sgid_attr.ndev, &hop_limit); - - dev_put(sgid_attr.ndev); - - ah_attr->grh.hop_limit = hop_limit; - } -out: + ah_attr->grh.hop_limit = hop_limit; return ret; } EXPORT_SYMBOL(ib_resolve_eth_dmac); From owner-svn-src-stable@freebsd.org Thu Aug 2 08:25:49 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56D91105DE42; Thu, 2 Aug 2018 08:25:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BAB07B32F; Thu, 2 Aug 2018 08:25:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2136728E; Thu, 2 Aug 2018 08:25:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728PmdE044917; Thu, 2 Aug 2018 08:25:48 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728PmIx044913; Thu, 2 Aug 2018 08:25:48 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020825.w728PmIx044913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:25:48 +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: r337088 - in stable/11/sys/ofed: drivers/infiniband/core include/rdma X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/ofed: drivers/infiniband/core include/rdma X-SVN-Commit-Revision: 337088 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:25:49 -0000 Author: hselasky Date: Thu Aug 2 08:25:48 2018 New Revision: 337088 URL: https://svnweb.freebsd.org/changeset/base/337088 Log: MFC r336383: Check port number supplied by user verbs cmds in ibcore. The ib_uverbs_create_ah() ind ib_uverbs_modify_qp() calls receive the port number from user input as part of its attributes and assumes it is valid. Down on the stack, that parameter is used to access kernel data structures. If the value is invalid, the kernel accesses memory it should not. To prevent this, verify the port number before using it. Linux commit: 5ecce4c9b17bed4dc9cb58bfb10447307569b77b a62ab66b13a0f9bcb17b7b761f6670941ed5cd62 5a7a88f1b488e4ee49eb3d5b82612d4d9ffdf2c3 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c stable/11/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:24:45 2018 (r337087) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:25:48 2018 (r337088) @@ -983,6 +983,8 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib } else ret = iw_cm_init_qp_attr(id_priv->cm_id.iw, qp_attr, qp_attr_mask); + qp_attr->port_num = id_priv->id.port_num; + *qp_attr_mask |= IB_QP_PORT; } else ret = -ENOSYS; Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu Aug 2 08:24:45 2018 (r337087) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu Aug 2 08:25:48 2018 (r337088) @@ -2366,6 +2366,25 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *fil goto out; } + if ((cmd.attr_mask & IB_QP_PORT) && + !rdma_is_port_valid(qp->device, cmd.port_num)) { + ret = -EINVAL; + goto release_qp; + } + + if ((cmd.attr_mask & IB_QP_AV) && + !rdma_is_port_valid(qp->device, cmd.dest.port_num)) { + ret = -EINVAL; + goto release_qp; + } + + if ((cmd.attr_mask & IB_QP_ALT_PATH) && + (!rdma_is_port_valid(qp->device, cmd.alt_port_num) || + !rdma_is_port_valid(qp->device, cmd.alt_dest.port_num))) { + ret = -EINVAL; + goto release_qp; + } + attr->qp_state = cmd.qp_state; attr->cur_qp_state = cmd.cur_qp_state; attr->path_mtu = cmd.path_mtu; @@ -2895,6 +2914,9 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *fil if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; + + if (!rdma_is_port_valid(ib_dev, cmd.attr.port_num)) + return -EINVAL; INIT_UDATA(&udata, buf + sizeof(cmd), (unsigned long)cmd.response + sizeof(resp), Modified: stable/11/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_verbs.h Thu Aug 2 08:24:45 2018 (r337087) +++ stable/11/sys/ofed/include/rdma/ib_verbs.h Thu Aug 2 08:25:48 2018 (r337088) @@ -2268,6 +2268,13 @@ static inline u8 rdma_end_port(const struct ib_device return rdma_cap_ib_switch(device) ? 0 : device->phys_port_cnt; } +static inline int rdma_is_port_valid(const struct ib_device *device, + unsigned int port) +{ + return (port >= rdma_start_port(device) && + port <= rdma_end_port(device)); +} + static inline bool rdma_protocol_ib(const struct ib_device *device, u8 port_num) { return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_IB; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:26:57 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C287105DF06; Thu, 2 Aug 2018 08:26:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3853B7B491; Thu, 2 Aug 2018 08:26:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 160CB7290; Thu, 2 Aug 2018 08:26:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728QuQq045019; Thu, 2 Aug 2018 08:26:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728QuFd045018; Thu, 2 Aug 2018 08:26:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020826.w728QuFd045018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:26:56 +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: r337089 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337089 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:26:57 -0000 Author: hselasky Date: Thu Aug 2 08:26:56 2018 New Revision: 337089 URL: https://svnweb.freebsd.org/changeset/base/337089 Log: MFC r336384: Fix for loopback detection in address resolve logic in ibcore. When a loopback address is detected use the network interface which has the loopback flag set to trigger loopback logic in address resolve. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:25:48 2018 (r337088) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:26:56 2018 (r337089) @@ -349,6 +349,10 @@ static int addr4_resolve(struct sockaddr_in *src_in, error = EHOSTUNREACH; goto error_put_ifp; } + /* get destination network interface from route */ + dev_put(ifp); + ifp = rte->rt_ifp; + dev_hold(ifp); } else if (ifp != rte->rt_ifp) { /* * Source and destination interfaces are @@ -544,6 +548,10 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, error = EHOSTUNREACH; goto error_put_ifp; } + /* get destination network interface from route */ + dev_put(ifp); + ifp = rte->rt_ifp; + dev_hold(ifp); } else if (ifp != rte->rt_ifp) { /* * Source and destination interfaces are From owner-svn-src-stable@freebsd.org Thu Aug 2 08:27:50 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F661105DFA5; Thu, 2 Aug 2018 08:27:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54D417B5D3; Thu, 2 Aug 2018 08:27:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35EED7292; Thu, 2 Aug 2018 08:27:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728Ronu045115; Thu, 2 Aug 2018 08:27:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728RoGN045114; Thu, 2 Aug 2018 08:27:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020827.w728RoGN045114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:27: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: r337090 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337090 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:27:50 -0000 Author: hselasky Date: Thu Aug 2 08:27:49 2018 New Revision: 337090 URL: https://svnweb.freebsd.org/changeset/base/337090 Log: MFC r336385: Set IPv4 TOS and IPv6 traffic class field for RoCEv2 traffic in ibcore. The current implementation assumes a static mapping between the TOS bits and the priority code point, PCP bits. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:26:56 2018 (r337089) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:27:49 2018 (r337090) @@ -2451,15 +2451,9 @@ static int cma_resolve_iw_route(struct rdma_id_private static int iboe_tos_to_sl(struct net_device *ndev, int tos) { - /* get service level, SL, from type of service, TOS */ - int sl = tos; + /* get service level, SL, from IPv4 type of service, TOS */ + int sl = (tos >> 5) & 0x7; - /* range check input argument and map 1:1 */ - if (sl > 255) - sl = 255; - else if (sl < 0) - sl = 0; - /* final mappings are done by the vendor specific drivers */ return sl; } @@ -2543,6 +2537,7 @@ static int cma_resolve_iboe_route(struct rdma_id_priva route->path_rec->pkey = cpu_to_be16(0xffff); route->path_rec->mtu_selector = IB_SA_EQ; route->path_rec->sl = iboe_tos_to_sl(ndev, id_priv->tos); + route->path_rec->traffic_class = id_priv->tos; route->path_rec->mtu = iboe_get_mtu(ndev->if_mtu); route->path_rec->rate_selector = IB_SA_EQ; route->path_rec->rate = iboe_get_rate(ndev); From owner-svn-src-stable@freebsd.org Thu Aug 2 08:28:50 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E9C1105E041; Thu, 2 Aug 2018 08:28:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D72607B72F; Thu, 2 Aug 2018 08:28:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B80007293; Thu, 2 Aug 2018 08:28:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728SnKh045219; Thu, 2 Aug 2018 08:28:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728SnI0045218; Thu, 2 Aug 2018 08:28:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020828.w728SnI0045218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:28: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: r337091 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337091 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:28:50 -0000 Author: hselasky Date: Thu Aug 2 08:28:49 2018 New Revision: 337091 URL: https://svnweb.freebsd.org/changeset/base/337091 Log: MFC r336386: Honor port_num while resolving GID for IB link layer in ibcore. ah_attr contains the port number to which cm_id is bound. However, while searching for GID table for matching GID entry, the port number is ignored. This could cause the wrong GID to be used when the ah_attr is converted to an AH. Linux commit: 563c4ba3bd2b8b0b21c65669ec2226b1cfa1138b Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_multicast.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_multicast.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_multicast.c Thu Aug 2 08:27:49 2018 (r337090) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_multicast.c Thu Aug 2 08:28:49 2018 (r337091) @@ -727,21 +727,19 @@ int ib_init_ah_from_mcmember(struct ib_device *device, { int ret; u16 gid_index; - u8 p; - if (rdma_protocol_roce(device, port_num)) { - ret = ib_find_cached_gid_by_port(device, &rec->port_gid, - gid_type, port_num, - ndev, - &gid_index); - } else if (rdma_protocol_ib(device, port_num)) { - ret = ib_find_cached_gid(device, &rec->port_gid, - IB_GID_TYPE_IB, NULL, &p, - &gid_index); - } else { - ret = -EINVAL; - } + /* GID table is not based on the netdevice for IB link layer, + * so ignore ndev during search. + */ + if (rdma_protocol_ib(device, port_num)) + ndev = NULL; + else if (!rdma_protocol_roce(device, port_num)) + return -EINVAL; + ret = ib_find_cached_gid_by_port(device, &rec->port_gid, + gid_type, port_num, + ndev, + &gid_index); if (ret) return ret; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:29:41 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C820E105E123; Thu, 2 Aug 2018 08:29:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D65B7B8CA; Thu, 2 Aug 2018 08:29:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 600F87296; Thu, 2 Aug 2018 08:29:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728TfOa045314; Thu, 2 Aug 2018 08:29:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728TfDU045313; Thu, 2 Aug 2018 08:29:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020829.w728TfDU045313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:29: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: r337092 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337092 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:29:42 -0000 Author: hselasky Date: Thu Aug 2 08:29:40 2018 New Revision: 337092 URL: https://svnweb.freebsd.org/changeset/base/337092 Log: MFC r336387: Honor return status of ib_init_ah_from_mcmember() in ibcore. The return status of ib_init_ah_from_mcmember() is ignored by cma_ib_mc_handler(). Honor it and return error event if ah attribute initialization failed. Linux commit: 6d337179f28cc50ddd7e224f677b4cda70b275fc Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:28:49 2018 (r337091) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:29:40 2018 (r337092) @@ -3764,10 +3764,14 @@ static int cma_ib_mc_handler(int status, struct ib_sa_ rdma_start_port(id_priv->cma_dev->device)]; event.event = RDMA_CM_EVENT_MULTICAST_JOIN; - ib_init_ah_from_mcmember(id_priv->id.device, - id_priv->id.port_num, &multicast->rec, - ndev, gid_type, - &event.param.ud.ah_attr); + ret = ib_init_ah_from_mcmember(id_priv->id.device, + id_priv->id.port_num, + &multicast->rec, + ndev, gid_type, + &event.param.ud.ah_attr); + if (ret) + event.event = RDMA_CM_EVENT_MULTICAST_ERROR; + event.param.ud.qp_num = 0xFFFFFF; event.param.ud.qkey = be32_to_cpu(multicast->rec.qkey); if (ndev) From owner-svn-src-stable@freebsd.org Thu Aug 2 08:30:45 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FC02105E1E0; Thu, 2 Aug 2018 08:30:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 04D547BA64; Thu, 2 Aug 2018 08:30:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA39272AC; Thu, 2 Aug 2018 08:30:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728UiAY045442; Thu, 2 Aug 2018 08:30:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728Uist045441; Thu, 2 Aug 2018 08:30:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020830.w728Uist045441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:30:44 +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: r337093 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337093 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:30:45 -0000 Author: hselasky Date: Thu Aug 2 08:30:44 2018 New Revision: 337093 URL: https://svnweb.freebsd.org/changeset/base/337093 Log: MFC r336388: Add support for RoCEv2 multicast in ibcore. When creating address handle from multicast GID, set MAC according to the appropriate formula instead of searching for it in the GID table: - For IPv4 multicast GID use ip_eth_mc_map(). - For IPv6 multicast GID use ipv6_eth_mc_map(). Linux commit: 9636a56fa864464896bf7d1272c701f2b9a57737 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:29:40 2018 (r337092) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:30:44 2018 (r337093) @@ -1172,6 +1172,19 @@ int ib_resolve_eth_dmac(struct ib_device *device, if (!rdma_cap_eth_ah(device, ah_attr->port_num)) return 0; + if (rdma_is_multicast_addr((struct in6_addr *)ah_attr->grh.dgid.raw)) { + if (ipv6_addr_v4mapped((struct in6_addr *)ah_attr->grh.dgid.raw)) { + __be32 addr = 0; + + memcpy(&addr, ah_attr->grh.dgid.raw + 12, 4); + ip_eth_mc_map(addr, (char *)ah_attr->dmac); + } else { + ipv6_eth_mc_map((struct in6_addr *)ah_attr->grh.dgid.raw, + (char *)ah_attr->dmac); + } + return 0; + } + ret = ib_query_gid(device, ah_attr->port_num, ah_attr->grh.sgid_index, From owner-svn-src-stable@freebsd.org Thu Aug 2 08:31:35 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C898105E292; Thu, 2 Aug 2018 08:31:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 123BF7BC5F; Thu, 2 Aug 2018 08:31:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E855272E9; Thu, 2 Aug 2018 08:31:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728VYep047880; Thu, 2 Aug 2018 08:31:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728VYWS047862; Thu, 2 Aug 2018 08:31:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020831.w728VYWS047862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:31: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: r337094 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 337094 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:31:35 -0000 Author: hselasky Date: Thu Aug 2 08:31:34 2018 New Revision: 337094 URL: https://svnweb.freebsd.org/changeset/base/337094 Log: MFC r336389: Add support for IPv6 multicast in ibcore. This change allows us to join IPv6 multicast networks. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:30:44 2018 (r337093) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:31:34 2018 (r337094) @@ -4021,7 +4021,7 @@ static int cma_iboe_join_multicast(struct rdma_id_priv mc->multicast.ib->rec.hop_limit = 1; mc->multicast.ib->rec.mtu = iboe_get_mtu(ndev->if_mtu); - if (addr->sa_family == AF_INET) { + if (addr->sa_family == AF_INET || addr->sa_family == AF_INET6) { if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) { mc->multicast.ib->rec.hop_limit = IPV6_DEFAULT_HOPLIMIT; if (!send_only) { From owner-svn-src-stable@freebsd.org Thu Aug 2 08:32:25 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5910105E441; Thu, 2 Aug 2018 08:32:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B37E7BF32; Thu, 2 Aug 2018 08:32:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 636D9741C; Thu, 2 Aug 2018 08:32:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728WOgm049526; Thu, 2 Aug 2018 08:32:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728WOFm049525; Thu, 2 Aug 2018 08:32:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020832.w728WOFm049525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:32:24 +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: r337095 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 337095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:32:25 -0000 Author: hselasky Date: Thu Aug 2 08:32:23 2018 New Revision: 337095 URL: https://svnweb.freebsd.org/changeset/base/337095 Log: MFC r336390: Remove blank line. Sponsored by: Mellanox Technologies Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable@freebsd.org Thu Aug 2 08:34:01 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D90B105E52D; Thu, 2 Aug 2018 08:34:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 52B4A7C0C3; Thu, 2 Aug 2018 08:34:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1913F7427; Thu, 2 Aug 2018 08:34:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728Y0gE050401; Thu, 2 Aug 2018 08:34:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728XqK6050355; Thu, 2 Aug 2018 08:33:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020833.w728XqK6050355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:33:52 +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: r337096 - in stable/11/sys/ofed/drivers/infiniband: core ulp/ipoib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/ofed/drivers/infiniband: core ulp/ipoib X-SVN-Commit-Revision: 337096 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:34:01 -0000 Author: hselasky Date: Thu Aug 2 08:33:51 2018 New Revision: 337096 URL: https://svnweb.freebsd.org/changeset/base/337096 Log: MFC r336391: Use __FBSDID() for RCS tags in ibcore. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c stable/11/sys/ofed/drivers/infiniband/core/ib_agent.c stable/11/sys/ofed/drivers/infiniband/core/ib_cache.c stable/11/sys/ofed/drivers/infiniband/core/ib_cm.c stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c stable/11/sys/ofed/drivers/infiniband/core/ib_cq.c stable/11/sys/ofed/drivers/infiniband/core/ib_device.c stable/11/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c stable/11/sys/ofed/drivers/infiniband/core/ib_iwcm.c stable/11/sys/ofed/drivers/infiniband/core/ib_iwpm_msg.c stable/11/sys/ofed/drivers/infiniband/core/ib_iwpm_util.c stable/11/sys/ofed/drivers/infiniband/core/ib_mad.c stable/11/sys/ofed/drivers/infiniband/core/ib_mad_rmpp.c stable/11/sys/ofed/drivers/infiniband/core/ib_multicast.c stable/11/sys/ofed/drivers/infiniband/core/ib_packer.c stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c stable/11/sys/ofed/drivers/infiniband/core/ib_sa_query.c stable/11/sys/ofed/drivers/infiniband/core/ib_smi.c stable/11/sys/ofed/drivers/infiniband/core/ib_sysfs.c stable/11/sys/ofed/drivers/infiniband/core/ib_ucm.c stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c stable/11/sys/ofed/drivers/infiniband/core/ib_ud_header.c stable/11/sys/ofed/drivers/infiniband/core/ib_umem.c stable/11/sys/ofed/drivers/infiniband/core/ib_umem_odp.c stable/11/sys/ofed/drivers/infiniband/core/ib_umem_rbtree.c stable/11/sys/ofed/drivers/infiniband/core/ib_user_mad.c stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_marshall.c stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_fs.c stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_addr.c Thu Aug 2 08:33:51 2018 (r337096) @@ -33,9 +33,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_agent.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_agent.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_agent.c Thu Aug 2 08:33:51 2018 (r337096) @@ -35,9 +35,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cache.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cache.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cache.c Thu Aug 2 08:33:51 2018 (r337096) @@ -33,9 +33,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cm.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cm.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cm.c Thu Aug 2 08:33:51 2018 (r337096) @@ -33,9 +33,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Thu Aug 2 08:33:51 2018 (r337096) @@ -33,9 +33,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #define LINUXKPI_PARAM_PREFIX ibcore_ Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cq.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cq.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cq.c Thu Aug 2 08:33:51 2018 (r337096) @@ -30,9 +30,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_device.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_device.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_device.c Thu Aug 2 08:33:51 2018 (r337096) @@ -31,9 +31,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c Thu Aug 2 08:33:51 2018 (r337096) @@ -31,9 +31,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_iwcm.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_iwcm.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_iwcm.c Thu Aug 2 08:33:51 2018 (r337096) @@ -35,9 +35,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_iwpm_msg.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_iwpm_msg.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_iwpm_msg.c Thu Aug 2 08:33:51 2018 (r337096) @@ -31,9 +31,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include "iwpm_util.h" Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_iwpm_util.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_iwpm_util.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_iwpm_util.c Thu Aug 2 08:33:51 2018 (r337096) @@ -31,9 +31,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include "iwpm_util.h" Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_mad.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_mad.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_mad.c Thu Aug 2 08:33:51 2018 (r337096) @@ -34,9 +34,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #define LINUXKPI_PARAM_PREFIX ibcore_ #define KBUILD_MODNAME "ibcore" Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_mad_rmpp.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_mad_rmpp.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_mad_rmpp.c Thu Aug 2 08:33:51 2018 (r337096) @@ -32,9 +32,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_multicast.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_multicast.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_multicast.c Thu Aug 2 08:33:51 2018 (r337096) @@ -30,9 +30,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #define LINUXKPI_PARAM_PREFIX ibcore_ Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_packer.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_packer.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_packer.c Thu Aug 2 08:33:51 2018 (r337096) @@ -31,9 +31,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Thu Aug 2 08:33:51 2018 (r337096) @@ -30,9 +30,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include "core_priv.h" Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_sa_query.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_sa_query.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_sa_query.c Thu Aug 2 08:33:51 2018 (r337096) @@ -32,9 +32,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_smi.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_smi.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_smi.c Thu Aug 2 08:33:51 2018 (r337096) @@ -36,9 +36,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include "smi.h" Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_sysfs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_sysfs.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_sysfs.c Thu Aug 2 08:33:51 2018 (r337096) @@ -32,9 +32,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include "core_priv.h" Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_ucm.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_ucm.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_ucm.c Thu Aug 2 08:33:51 2018 (r337096) @@ -31,9 +31,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_ucma.c Thu Aug 2 08:33:51 2018 (r337096) @@ -30,9 +30,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_ud_header.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_ud_header.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_ud_header.c Thu Aug 2 08:33:51 2018 (r337096) @@ -31,9 +31,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_umem.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_umem.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_umem.c Thu Aug 2 08:33:51 2018 (r337096) @@ -32,9 +32,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #define LINUXKPI_PARAM_PREFIX ibcore_ Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_umem_odp.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_umem_odp.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_umem_odp.c Thu Aug 2 08:33:51 2018 (r337096) @@ -30,9 +30,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_umem_rbtree.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_umem_rbtree.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_umem_rbtree.c Thu Aug 2 08:33:51 2018 (r337096) @@ -30,9 +30,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_user_mad.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_user_mad.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_user_mad.c Thu Aug 2 08:33:51 2018 (r337096) @@ -33,9 +33,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #define pr_fmt(fmt) "user_mad: " fmt Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu Aug 2 08:33:51 2018 (r337096) @@ -33,9 +33,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #define LINUXKPI_PARAM_PREFIX ibcore_ Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c Thu Aug 2 08:33:51 2018 (r337096) @@ -34,9 +34,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_marshall.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_marshall.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_marshall.c Thu Aug 2 08:33:51 2018 (r337096) @@ -30,9 +30,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu Aug 2 08:33:51 2018 (r337096) @@ -36,9 +36,10 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Thu Aug 2 08:33:51 2018 (r337096) @@ -30,6 +30,8 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. + * + * $FreeBSD$ */ #ifndef _IPOIB_H Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Thu Aug 2 08:33:51 2018 (r337096) @@ -30,6 +30,9 @@ * SOFTWARE. */ +#include +__FBSDID("$FreeBSD$"); + #include "ipoib.h" #ifdef CONFIG_INFINIBAND_IPOIB_CM Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c Thu Aug 2 08:33:51 2018 (r337096) @@ -30,6 +30,9 @@ * SOFTWARE. */ +#include +__FBSDID("$FreeBSD$"); + #include #include Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_fs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_fs.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_fs.c Thu Aug 2 08:33:51 2018 (r337096) @@ -30,6 +30,9 @@ * SOFTWARE. */ +#include +__FBSDID("$FreeBSD$"); + #include #include Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Thu Aug 2 08:33:51 2018 (r337096) @@ -33,6 +33,9 @@ * SOFTWARE. */ +#include +__FBSDID("$FreeBSD$"); + #include "ipoib.h" #include Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Aug 2 08:33:51 2018 (r337096) @@ -32,6 +32,9 @@ * SOFTWARE. */ +#include +__FBSDID("$FreeBSD$"); + #include "ipoib.h" static int ipoib_resolvemulti(struct ifnet *, struct sockaddr **, @@ -318,8 +321,8 @@ ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t break; case SIOCGIFADDR: - bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], - INFINIBAND_ALEN); + bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], + INFINIBAND_ALEN); break; case SIOCSIFMTU: Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Thu Aug 2 08:33:51 2018 (r337096) @@ -32,6 +32,9 @@ * SOFTWARE. */ +#include +__FBSDID("$FreeBSD$"); + #include "ipoib.h" #include Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c Thu Aug 2 08:33:51 2018 (r337096) @@ -31,6 +31,9 @@ * SOFTWARE. */ +#include +__FBSDID("$FreeBSD$"); + #include "ipoib.h" int ipoib_mcast_attach(struct ipoib_dev_priv *priv, u16 mlid, union ib_gid *mgid, int set_qkey) Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c Thu Aug 2 08:32:23 2018 (r337095) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c Thu Aug 2 08:33:51 2018 (r337096) @@ -30,6 +30,9 @@ * SOFTWARE. */ +#include +__FBSDID("$FreeBSD$"); + #include #include From owner-svn-src-stable@freebsd.org Thu Aug 2 08:35:32 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBC96105E68B; Thu, 2 Aug 2018 08:35:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 920DA7C33C; Thu, 2 Aug 2018 08:35:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73EB4742E; Thu, 2 Aug 2018 08:35:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728ZWcR050645; Thu, 2 Aug 2018 08:35:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728ZWN3050644; Thu, 2 Aug 2018 08:35:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020835.w728ZWN3050644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:35: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: r337097 - stable/11/sys/ofed/include/rdma X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/include/rdma X-SVN-Commit-Revision: 337097 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:35:33 -0000 Author: hselasky Date: Thu Aug 2 08:35:32 2018 New Revision: 337097 URL: https://svnweb.freebsd.org/changeset/base/337097 Log: MFC r336964: Only NULL check the VNET pointer when VIMAGE is enabled in ibcore. Else a NULL VNET pointer should be ignored. This fixes address resolving when VIMAGE is disabled. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/include/rdma/ib_sa.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/include/rdma/ib_sa.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_sa.h Thu Aug 2 08:33:51 2018 (r337096) +++ stable/11/sys/ofed/include/rdma/ib_sa.h Thu Aug 2 08:35:32 2018 (r337097) @@ -180,7 +180,11 @@ struct ib_sa_path_rec { static inline struct net_device *ib_get_ndev_from_path(struct ib_sa_path_rec *rec) { - return rec->net ? dev_get_by_index(rec->net, rec->ifindex) : NULL; +#ifdef VIMAGE + if (rec->net == NULL) + return NULL; +#endif + return dev_get_by_index(rec->net, rec->ifindex); } #define IB_SA_MCMEMBER_REC_MGID IB_SA_COMP_MASK( 0) From owner-svn-src-stable@freebsd.org Thu Aug 2 08:36:54 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A623B105E804; Thu, 2 Aug 2018 08:36:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473107C59C; Thu, 2 Aug 2018 08:36:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 279327439; Thu, 2 Aug 2018 08:36:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728asp0050767; Thu, 2 Aug 2018 08:36:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728apw5050752; Thu, 2 Aug 2018 08:36:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020836.w728apw5050752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:36:51 +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: r337098 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Commit-Revision: 337098 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:36:55 -0000 Author: hselasky Date: Thu Aug 2 08:36:51 2018 New Revision: 337098 URL: https://svnweb.freebsd.org/changeset/base/337098 Log: MFC r336392: Implement support for Differentiated Service Code Point, DSCP, in mlx5en(4). The DSCP feature is controlled using a set of sysctl(8) fields under the qos sysctl directory entry for mlx5en(4). For Routable RoCE QPs, the DSCP should be set in the QP's address path. The DSCP's value is derived from the traffic class. Linux commit: ed88451e1f2d400fd6a743d0a481631cf9f97550 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib.h stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c stable/11/sys/dev/mlx5/mlx5_ifc.h stable/11/sys/dev/mlx5/port.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/device.h Thu Aug 2 08:36:51 2018 (r337098) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -47,11 +47,15 @@ #define __mlx5_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)0) #define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld) #define __mlx5_bit_off(typ, fld) __offsetof(struct mlx5_ifc_##typ##_bits, fld) +#define __mlx5_16_off(typ, fld) (__mlx5_bit_off(typ, fld) / 16) #define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32) #define __mlx5_64_off(typ, fld) (__mlx5_bit_off(typ, fld) / 64) +#define __mlx5_16_bit_off(typ, fld) (16 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0xf)) #define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f)) #define __mlx5_mask(typ, fld) ((u32)((1ull << __mlx5_bit_sz(typ, fld)) - 1)) #define __mlx5_dw_mask(typ, fld) (__mlx5_mask(typ, fld) << __mlx5_dw_bit_off(typ, fld)) +#define __mlx5_mask16(typ, fld) ((u16)((1ull << __mlx5_bit_sz(typ, fld)) - 1)) +#define __mlx5_16_mask(typ, fld) (__mlx5_mask16(typ, fld) << __mlx5_16_bit_off(typ, fld)) #define __mlx5_st_sz_bits(typ) sizeof(struct mlx5_ifc_##typ##_bits) #define MLX5_FLD_SZ_BYTES(typ, fld) (__mlx5_bit_sz(typ, fld) / 8) @@ -109,6 +113,19 @@ __mlx5_mask(typ, fld)) #define MLX5_GET64(typ, p, fld) be64_to_cpu(*((__be64 *)(p) + __mlx5_64_off(typ, fld))) +#define MLX5_GET16(typ, p, fld) ((be16_to_cpu(*((__be16 *)(p) +\ +__mlx5_16_off(typ, fld))) >> __mlx5_16_bit_off(typ, fld)) & \ +__mlx5_mask16(typ, fld)) + +#define MLX5_SET16(typ, p, fld, v) do { \ + u16 _v = v; \ + BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 16); \ + *((__be16 *)(p) + __mlx5_16_off(typ, fld)) = \ + cpu_to_be16((be16_to_cpu(*((__be16 *)(p) + __mlx5_16_off(typ, fld))) & \ + (~__mlx5_16_mask(typ, fld))) | (((_v) & __mlx5_mask16(typ, fld)) \ + << __mlx5_16_bit_off(typ, fld))); \ +} while (0) + #define MLX5_GET64_BE(typ, p, fld) (*((__be64 *)(p) +\ __mlx5_64_off(typ, fld))) @@ -895,6 +912,14 @@ enum mlx5_cap_type { MLX5_CAP_NUM }; +enum mlx5_qcam_reg_groups { + MLX5_QCAM_REGS_FIRST_128 = 0x0, +}; + +enum mlx5_qcam_feature_groups { + MLX5_QCAM_FEATURE_ENHANCED_FEATURES = 0x0, +}; + /* GET Dev Caps macros */ #define MLX5_CAP_GEN(mdev, cap) \ MLX5_GET(cmd_hca_cap, mdev->hca_caps_cur[MLX5_CAP_GENERAL], cap) @@ -999,6 +1024,12 @@ enum mlx5_cap_type { #define MLX5_CAP_QOS_MAX(mdev, cap) \ MLX5_GET(qos_cap,\ mdev->hca_caps_max[MLX5_CAP_QOS], cap) + +#define MLX5_CAP_QCAM_REG(mdev, fld) \ + MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_access_reg_cap_mask.reg_cap.fld) + +#define MLX5_CAP_QCAM_FEATURE(mdev, fld) \ + MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_feature_cap_mask.feature_cap.fld) enum { MLX5_CMD_STAT_OK = 0x0, Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/driver.h Thu Aug 2 08:36:51 2018 (r337098) @@ -119,10 +119,13 @@ enum { }; enum { + MLX5_REG_QPTS = 0x4002, MLX5_REG_QETCR = 0x4005, MLX5_REG_QPDP = 0x4007, MLX5_REG_QTCT = 0x400A, + MLX5_REG_QPDPM = 0x4013, MLX5_REG_QHLL = 0x4016, + MLX5_REG_QCAM = 0x4019, MLX5_REG_DCBX_PARAM = 0x4020, MLX5_REG_DCBX_APP = 0x4021, MLX5_REG_PCAP = 0x5001, @@ -626,6 +629,9 @@ struct mlx5_core_dev { struct mlx5_port_caps port_caps[MLX5_MAX_PORTS]; u32 hca_caps_cur[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; u32 hca_caps_max[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; + struct { + u32 qcam[MLX5_ST_SZ_DW(qcam_reg)]; + } caps; phys_addr_t iseg_base; struct mlx5_init_seg __iomem *iseg; enum mlx5_device_state state; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu Aug 2 08:36:51 2018 (r337098) @@ -80,6 +80,8 @@ struct mlx5_core_dev; int mlx5_query_hca_caps(struct mlx5_core_dev *dev); int mlx5_query_board_id(struct mlx5_core_dev *dev); +int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u32 *qcam, + u8 feature_group, u8 access_reg_group); int mlx5_cmd_init_hca(struct mlx5_core_dev *dev); int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev); int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu Aug 2 08:36:51 2018 (r337098) @@ -110,6 +110,13 @@ static int mlx5_core_query_special_contexts(struct mlx return err; } +static int mlx5_get_qcam_reg(struct mlx5_core_dev *dev) +{ + return mlx5_query_qcam_reg(dev, dev->caps.qcam, + MLX5_QCAM_FEATURE_ENHANCED_FEATURES, + MLX5_QCAM_REGS_FIRST_128); +} + int mlx5_query_hca_caps(struct mlx5_core_dev *dev) { int err; @@ -185,6 +192,12 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev) if (MLX5_CAP_GEN(dev, qos)) { err = mlx5_core_get_caps(dev, MLX5_CAP_QOS); + if (err) + return err; + } + + if (MLX5_CAP_GEN(dev, qcam_reg)) { + err = mlx5_get_qcam_reg(dev); if (err) return err; } Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu Aug 2 08:36:51 2018 (r337098) @@ -66,6 +66,19 @@ out: } EXPORT_SYMBOL_GPL(mlx5_core_access_reg); +int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u32 *qcam, + u8 feature_group, u8 access_reg_group) +{ + u32 in[MLX5_ST_SZ_DW(qcam_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(qcam_reg); + + MLX5_SET(qcam_reg, in, feature_group, feature_group); + MLX5_SET(qcam_reg, in, access_reg_group, access_reg_group); + + return mlx5_core_access_reg(mdev, in, sz, qcam, sz, MLX5_REG_QCAM, 0, 0); +} +EXPORT_SYMBOL_GPL(mlx5_query_qcam_reg); + struct mlx5_reg_pcap { u8 rsvd0; u8 port_num; @@ -966,4 +979,102 @@ int mlx5_query_diagnostic_counters(struct mlx5_core_de MLX5_SET(query_diagnostic_counters_in, in, sample_index, sample_index); return mlx5_cmd_exec(mdev, in, sizeof(in), out, out_size); +} + +int mlx5_set_trust_state(struct mlx5_core_dev *mdev, u8 trust_state) +{ + u32 out[MLX5_ST_SZ_DW(qpts_reg)] = {}; + u32 in[MLX5_ST_SZ_DW(qpts_reg)] = {}; + int err; + + MLX5_SET(qpts_reg, in, local_port, 1); + MLX5_SET(qpts_reg, in, trust_state, trust_state); + + err = mlx5_core_access_reg(mdev, in, sizeof(in), out, + sizeof(out), MLX5_REG_QPTS, 0, 1); + return err; +} + +int mlx5_query_trust_state(struct mlx5_core_dev *mdev, u8 *trust_state) +{ + u32 out[MLX5_ST_SZ_DW(qpts_reg)] = {}; + u32 in[MLX5_ST_SZ_DW(qpts_reg)] = {}; + int err; + + MLX5_SET(qpts_reg, in, local_port, 1); + + err = mlx5_core_access_reg(mdev, in, sizeof(in), out, + sizeof(out), MLX5_REG_QPTS, 0, 0); + if (!err) + *trust_state = MLX5_GET(qpts_reg, out, trust_state); + + return err; +} + +int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, const u8 *dscp2prio) +{ + int sz = MLX5_ST_SZ_BYTES(qpdpm_reg); + void *qpdpm_dscp; + void *out; + void *in; + int err; + int i; + + in = kzalloc(sz, GFP_KERNEL); + out = kzalloc(sz, GFP_KERNEL); + if (!in || !out) { + err = -ENOMEM; + goto out; + } + + MLX5_SET(qpdpm_reg, in, local_port, 1); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_QPDPM, 0, 0); + if (err) + goto out; + + memcpy(in, out, sz); + MLX5_SET(qpdpm_reg, in, local_port, 1); + + /* Update the corresponding dscp entry */ + for (i = 0; i < MLX5_MAX_SUPPORTED_DSCP; i++) { + qpdpm_dscp = MLX5_ADDR_OF(qpdpm_reg, in, dscp[i]); + MLX5_SET16(qpdpm_dscp_reg, qpdpm_dscp, prio, dscp2prio[i]); + MLX5_SET16(qpdpm_dscp_reg, qpdpm_dscp, e, 1); + } + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_QPDPM, 0, 1); +out: + kfree(in); + kfree(out); + return err; +} + +int mlx5_query_dscp2prio(struct mlx5_core_dev *mdev, u8 *dscp2prio) +{ + int sz = MLX5_ST_SZ_BYTES(qpdpm_reg); + void *qpdpm_dscp; + void *out; + void *in; + int err; + int i; + + in = kzalloc(sz, GFP_KERNEL); + out = kzalloc(sz, GFP_KERNEL); + if (!in || !out) { + err = -ENOMEM; + goto out; + } + + MLX5_SET(qpdpm_reg, in, local_port, 1); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_QPDPM, 0, 0); + if (err) + goto out; + + for (i = 0; i < MLX5_MAX_SUPPORTED_DSCP; i++) { + qpdpm_dscp = MLX5_ADDR_OF(qpdpm_reg, out, dscp[i]); + dscp2prio[i] = MLX5_GET16(qpdpm_dscp_reg, qpdpm_dscp, prio); + } +out: + kfree(in); + kfree(out); + return err; } Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 2 08:36:51 2018 (r337098) @@ -476,6 +476,8 @@ struct mlx5e_params_ethtool { MLX5E_PARAMS(MLX5E_STATS_VAR) u64 max_bw_value[IEEE_8021QAZ_MAX_TCS]; u8 prio_tc[IEEE_8021QAZ_MAX_TCS]; + u8 dscp2prio[MLX5_MAX_SUPPORTED_DSCP]; + u8 trust_state; }; /* EEPROM Standards for plug in modules */ Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 2 08:36:51 2018 (r337098) @@ -121,6 +121,30 @@ done: } static int +mlx5e_get_dscp(struct mlx5e_priv *priv) +{ + struct mlx5_core_dev *mdev = priv->mdev; + int err; + + if (MLX5_CAP_GEN(mdev, qcam_reg) == 0 || + MLX5_CAP_QCAM_REG(mdev, qpts) == 0 || + MLX5_CAP_QCAM_REG(mdev, qpdpm) == 0) + return (EOPNOTSUPP); + + PRIV_LOCK(priv); + err = -mlx5_query_dscp2prio(mdev, priv->params_ethtool.dscp2prio); + if (err) + goto done; + + err = -mlx5_query_trust_state(mdev, &priv->params_ethtool.trust_state); + if (err) + goto done; +done: + PRIV_UNLOCK(priv); + return (err); +} + +static int mlx5e_tc_maxrate_handler(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; @@ -229,6 +253,84 @@ done: return (err); } +static int +mlx5e_trust_state_handler(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv = arg1; + struct mlx5_core_dev *mdev = priv->mdev; + int err; + u8 result; + + PRIV_LOCK(priv); + result = priv->params_ethtool.trust_state; + err = sysctl_handle_8(oidp, &result, 0, req); + if (err || !req->newptr || + result == priv->params_ethtool.trust_state) + goto done; + + switch (result) { + case MLX5_QPTS_TRUST_PCP: + case MLX5_QPTS_TRUST_DSCP: + break; + case MLX5_QPTS_TRUST_BOTH: + if (!MLX5_CAP_QCAM_FEATURE(mdev, qpts_trust_both)) { + err = EOPNOTSUPP; + goto done; + } + break; + default: + err = ERANGE; + goto done; + } + + err = -mlx5_set_trust_state(mdev, result); + if (err) + goto done; + + priv->params_ethtool.trust_state = result; +done: + PRIV_UNLOCK(priv); + return (err); +} + +static int +mlx5e_dscp_prio_handler(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv = arg1; + int prio_index = arg2; + struct mlx5_core_dev *mdev = priv->mdev; + uint8_t dscp2prio[MLX5_MAX_SUPPORTED_DSCP]; + uint8_t x; + int err; + + PRIV_LOCK(priv); + err = SYSCTL_OUT(req, priv->params_ethtool.dscp2prio + prio_index, + sizeof(priv->params_ethtool.dscp2prio) / 8); + if (err || !req->newptr) + goto done; + + memcpy(dscp2prio, priv->params_ethtool.dscp2prio, sizeof(dscp2prio)); + err = SYSCTL_IN(req, dscp2prio + prio_index, sizeof(dscp2prio) / 8); + if (err) + goto done; + for (x = 0; x != MLX5_MAX_SUPPORTED_DSCP; x++) { + if (dscp2prio[x] > 7) { + err = ERANGE; + goto done; + } + } + err = -mlx5_set_dscp2prio(mdev, dscp2prio); + if (err) + goto done; + + /* update local array */ + memcpy(priv->params_ethtool.dscp2prio, dscp2prio, + sizeof(priv->params_ethtool.dscp2prio)); +done: + PRIV_UNLOCK(priv); + return (err); +} + #define MLX5_PARAM_OFFSET(n) \ __offsetof(struct mlx5e_priv, params_ethtool.n) @@ -1009,5 +1111,21 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) OID_AUTO, name, CTLTYPE_U8 | CTLFLAG_RW | CTLFLAG_MPSAFE, priv, i, mlx5e_prio_to_tc_handler, "CU", "Set priority to traffic class"); + } + + /* DSCP support */ + if (mlx5e_get_dscp(priv) == 0) { + for (i = 0; i != MLX5_MAX_SUPPORTED_DSCP; i += 8) { + char name[32]; + snprintf(name, sizeof(name), "dscp_%d_%d_prio", i, i + 7); + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), + OID_AUTO, name, CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + priv, i, mlx5e_dscp_prio_handler, "CU", + "Set DSCP to priority mapping, 0..7"); + } + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), + OID_AUTO, "trust_state", CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + priv, 0, mlx5e_trust_state_handler, "CU", + "Set trust state, 1:PCP 2:DSCP 3:BOTH"); } } Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Thu Aug 2 08:36:51 2018 (r337098) @@ -944,6 +944,8 @@ int mlx5_ib_set_vf_guid(struct ib_device *device, int __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num, int index); +int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num, + int index, enum ib_gid_type *gid_type); /* GSI QP helper functions */ struct ib_qp *mlx5_ib_gsi_create_qp(struct ib_pd *pd, Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 2 08:36:51 2018 (r337098) @@ -380,6 +380,27 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev return cpu_to_be16(MLX5_CAP_ROCE(dev->mdev, r_roce_min_src_udp_port)); } +int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num, + int index, enum ib_gid_type *gid_type) +{ + struct ib_gid_attr attr; + union ib_gid gid; + int ret; + + ret = ib_get_cached_gid(&dev->ib_dev, port_num, index, &gid, &attr); + if (ret) + return ret; + + if (!attr.ndev) + return -ENODEV; + + dev_put(attr.ndev); + + *gid_type = attr.gid_type; + + return 0; +} + static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev) { if (MLX5_CAP_GEN(dev->mdev, port_type) == MLX5_CAP_PORT_TYPE_IB) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu Aug 2 08:36:51 2018 (r337098) @@ -2195,6 +2195,7 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, stru { enum rdma_link_layer ll = rdma_port_get_link_layer(&dev->ib_dev, port); int err; + enum ib_gid_type gid_type; if (attr_mask & IB_QP_PKEY_INDEX) path->pkey_index = cpu_to_be16(alt ? attr->alt_pkey_index : @@ -2213,10 +2214,16 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, stru if (ll == IB_LINK_LAYER_ETHERNET) { if (!(ah->ah_flags & IB_AH_GRH)) return -EINVAL; + err = mlx5_get_roce_gid_type(dev, port, ah->grh.sgid_index, + &gid_type); + if (err) + return err; memcpy(path->rmac, ah->dmac, sizeof(ah->dmac)); path->udp_sport = mlx5_get_roce_udp_sport(dev, port, ah->grh.sgid_index); path->dci_cfi_prio_sl = (ah->sl & 0x7) << 4; + if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) + path->ecn_dscp = (ah->grh.traffic_class >> 2) & 0x3f; } else { path->fl_free_ar = (path_flags & MLX5_PATH_FLAG_FL) ? 0x80 : 0; path->fl_free_ar |= Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu Aug 2 08:36:51 2018 (r337098) @@ -962,7 +962,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 cc_modify_allowed[0x1]; u8 start_pad[0x1]; u8 cache_line_128byte[0x1]; - u8 reserved_15[0xb]; + u8 reserved_at_165[0xa]; + u8 qcam_reg[0x1]; u8 gid_table_size[0x10]; u8 out_of_seq_cnt[0x1]; @@ -8383,6 +8384,43 @@ struct mlx5_ifc_peir_reg_bits { u8 error_type[0x8]; }; +struct mlx5_ifc_qcam_access_reg_cap_mask { + u8 qcam_access_reg_cap_mask_127_to_20[0x6C]; + u8 qpdpm[0x1]; + u8 qcam_access_reg_cap_mask_18_to_4[0x0F]; + u8 qdpm[0x1]; + u8 qpts[0x1]; + u8 qcap[0x1]; + u8 qcam_access_reg_cap_mask_0[0x1]; +}; + +struct mlx5_ifc_qcam_qos_feature_cap_mask { + u8 qcam_qos_feature_cap_mask_127_to_1[0x7F]; + u8 qpts_trust_both[0x1]; +}; + +struct mlx5_ifc_qcam_reg_bits { + u8 reserved_at_0[0x8]; + u8 feature_group[0x8]; + u8 reserved_at_10[0x8]; + u8 access_reg_group[0x8]; + u8 reserved_at_20[0x20]; + + union { + struct mlx5_ifc_qcam_access_reg_cap_mask reg_cap; + u8 reserved_at_0[0x80]; + } qos_access_reg_cap_mask; + + u8 reserved_at_c0[0x80]; + + union { + struct mlx5_ifc_qcam_qos_feature_cap_mask feature_cap; + u8 reserved_at_0[0x80]; + } qos_feature_cap_mask; + + u8 reserved_at_1c0[0x80]; +}; + struct mlx5_ifc_pcap_reg_bits { u8 reserved_0[0x8]; u8 local_port[0x8]; @@ -9695,5 +9733,24 @@ union mlx5_ifc_uplink_pci_interface_document_bits { u8 reserved_0[0x20120]; }; +struct mlx5_ifc_qpdpm_dscp_reg_bits { + u8 e[0x1]; + u8 reserved_at_01[0x0b]; + u8 prio[0x04]; +}; + +struct mlx5_ifc_qpdpm_reg_bits { + u8 reserved_at_0[0x8]; + u8 local_port[0x8]; + u8 reserved_at_10[0x10]; + struct mlx5_ifc_qpdpm_dscp_reg_bits dscp[64]; +}; + +struct mlx5_ifc_qpts_reg_bits { + u8 reserved_at_0[0x8]; + u8 local_port[0x8]; + u8 reserved_at_10[0x2d]; + u8 trust_state[0x3]; +}; #endif /* MLX5_IFC_H */ Modified: stable/11/sys/dev/mlx5/port.h ============================================================================== --- stable/11/sys/dev/mlx5/port.h Thu Aug 2 08:35:32 2018 (r337097) +++ stable/11/sys/dev/mlx5/port.h Thu Aug 2 08:36:51 2018 (r337098) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2016-2018, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -102,6 +102,12 @@ enum mlx5e_connector_type { MLX5E_CONNECTOR_TYPE_NUMBER, }; +enum mlx5_qpts_trust_state { + MLX5_QPTS_TRUST_PCP = 1, + MLX5_QPTS_TRUST_DSCP = 2, + MLX5_QPTS_TRUST_BOTH = 3, +}; + #define MLX5E_PROT_MASK(link_mode) (1 << (link_mode)) #define PORT_MODULE_EVENT_MODULE_STATUS_MASK 0xF @@ -155,4 +161,11 @@ int mlx5_query_port_prio_tc(struct mlx5_core_dev *mdev u8 prio, u8 *tc); int mlx5_set_port_prio_tc(struct mlx5_core_dev *mdev, int prio_index, const u8 prio_tc); +int mlx5_set_trust_state(struct mlx5_core_dev *mdev, u8 trust_state); +int mlx5_query_trust_state(struct mlx5_core_dev *mdev, u8 *trust_state); + +#define MLX5_MAX_SUPPORTED_DSCP 64 +int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, const u8 *dscp2prio); +int mlx5_query_dscp2prio(struct mlx5_core_dev *mdev, u8 *dscp2prio); + #endif /* __MLX5_PORT_H__ */ From owner-svn-src-stable@freebsd.org Thu Aug 2 08:37:45 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68A67105E8EC; Thu, 2 Aug 2018 08:37:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E7FF7C732; Thu, 2 Aug 2018 08:37:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2A1D743A; Thu, 2 Aug 2018 08:37:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728bid4050860; Thu, 2 Aug 2018 08:37:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728bieA050859; Thu, 2 Aug 2018 08:37:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020837.w728bieA050859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:37:44 +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: r337099 - stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 337099 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:37:45 -0000 Author: hselasky Date: Thu Aug 2 08:37:44 2018 New Revision: 337099 URL: https://svnweb.freebsd.org/changeset/base/337099 Log: MFC r336393: Use static device naming instead of dynamic one in mlx5ib. When resetting mlx5core instances it can happen that the order of attach and detach for mlx5ib instances is changed. Take the unit number for mlx5_%d from the parent PCI device, similarly to what is done in mlx5en(4), so that there is a direct relationship between mce and mlx5_. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 2 08:36:51 2018 (r337098) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 2 08:37:44 2018 (r337099) @@ -2957,7 +2957,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) struct mlx5_ib_dev *dev; enum rdma_link_layer ll; int port_type_cap; - const char *name; int err; int i; @@ -2990,9 +2989,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) MLX5_INIT_DOORBELL_LOCK(&dev->uar_lock); - name = "mlx5_%d"; - - strlcpy(dev->ib_dev.name, name, IB_DEVICE_NAME_MAX); + snprintf(dev->ib_dev.name, IB_DEVICE_NAME_MAX, "mlx5_%d", device_get_unit(mdev->pdev->dev.bsddev)); dev->ib_dev.owner = THIS_MODULE; dev->ib_dev.node_type = RDMA_NODE_IB_CA; dev->ib_dev.local_dma_lkey = 0 /* not supported for now */; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:38:38 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 652F2105E9E0; Thu, 2 Aug 2018 08:38:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 199B67C892; Thu, 2 Aug 2018 08:38:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EECC9743C; Thu, 2 Aug 2018 08:38:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728cbaV050970; Thu, 2 Aug 2018 08:38:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728cbb4050969; Thu, 2 Aug 2018 08:38:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020838.w728cbb4050969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:38:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r337100 - stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 337100 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:38:38 -0000 Author: hselasky Date: Thu Aug 2 08:38:37 2018 New Revision: 337100 URL: https://svnweb.freebsd.org/changeset/base/337100 Log: MFC r336394: Don't pass unsupported events to ibcore from mlx5ib. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 2 08:37:44 2018 (r337099) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 2 08:38:37 2018 (r337100) @@ -2381,14 +2381,15 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v break; default: - break; + /* unsupported event */ + return; } ibev.device = &ibdev->ib_dev; ibev.element.port_num = port; if (port < 1 || port > ibdev->num_ports) { - mlx5_ib_warn(ibdev, "warning: event on port %d\n", port); + mlx5_ib_warn(ibdev, "warning: event(%d) on port %d\n", event, port); return; } From owner-svn-src-stable@freebsd.org Thu Aug 2 08:39:49 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B806105EB4F; Thu, 2 Aug 2018 08:39:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C531C7CB42; Thu, 2 Aug 2018 08:39:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6DB67441; Thu, 2 Aug 2018 08:39:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728dmS2051197; Thu, 2 Aug 2018 08:39:48 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728dmTZ051196; Thu, 2 Aug 2018 08:39:48 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020839.w728dmTZ051196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:39:48 +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: r337101 - stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 337101 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:39:49 -0000 Author: hselasky Date: Thu Aug 2 08:39:48 2018 New Revision: 337101 URL: https://svnweb.freebsd.org/changeset/base/337101 Log: MFC r336395: Update version information for the mlx5ib module. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 2 08:38:37 2018 (r337100) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 2 08:39:48 2018 (r337101) @@ -51,8 +51,10 @@ #include "mlx5_ib.h" #define DRIVER_NAME "mlx5_ib" -#define DRIVER_VERSION "3.4.1-BETA" -#define DRIVER_RELDATE "October 2017" +#ifndef DRIVER_VERSION +#define DRIVER_VERSION "3.4.2" +#endif +#define DRIVER_RELDATE "July 2018" MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); @@ -65,8 +67,8 @@ static int deprecated_prof_sel = 2; module_param_named(prof_sel, deprecated_prof_sel, int, 0444); MODULE_PARM_DESC(prof_sel, "profile selector. Deprecated here. Moved to module mlx5_core"); -static char mlx5_version[] = - DRIVER_NAME ": Mellanox Connect-IB Infiniband driver v" +static const char mlx5_version[] = + DRIVER_NAME ": Mellanox Connect-IB Infiniband driver " DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; enum { From owner-svn-src-stable@freebsd.org Thu Aug 2 08:40:47 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECAC9105EC22; Thu, 2 Aug 2018 08:40:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B35D7CCE4; Thu, 2 Aug 2018 08:40:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6CC967455; Thu, 2 Aug 2018 08:40:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728ekFw051322; Thu, 2 Aug 2018 08:40:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728ekSA051321; Thu, 2 Aug 2018 08:40:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020840.w728ekSA051321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:40:46 +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: r337102 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 337102 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:40:47 -0000 Author: hselasky Date: Thu Aug 2 08:40:46 2018 New Revision: 337102 URL: https://svnweb.freebsd.org/changeset/base/337102 Log: MFC r336396: Remove redundant newline character in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu Aug 2 08:39:48 2018 (r337101) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu Aug 2 08:40:46 2018 (r337102) @@ -159,8 +159,7 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev) return err; } - if ( - MLX5_CAP_GEN(dev, eswitch_flow_table)) { + if (MLX5_CAP_GEN(dev, eswitch_flow_table)) { err = mlx5_core_get_caps(dev, MLX5_CAP_ESWITCH_FLOW_TABLE); if (err) return err; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:42:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEEA6105EE6B; Thu, 2 Aug 2018 08:42:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70F007D0BE; Thu, 2 Aug 2018 08:42:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51DC875D1; Thu, 2 Aug 2018 08:42:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728ggR3056083; Thu, 2 Aug 2018 08:42:42 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728geCx056075; Thu, 2 Aug 2018 08:42:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020842.w728geCx056075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:42:40 +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: r337103 - in stable/11/sys: conf dev/mlx5 dev/mlx5/mlx5_core modules/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: conf dev/mlx5 dev/mlx5/mlx5_core modules/mlx5 X-SVN-Commit-Revision: 337103 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:42:43 -0000 Author: hselasky Date: Thu Aug 2 08:42:40 2018 New Revision: 337103 URL: https://svnweb.freebsd.org/changeset/base/337103 Log: MFC r336397: Refactor access to CR-space into using VSC APIs in mlx5core. Remove no longer used files and APIs. Sponsored by: Mellanox Technologies Deleted: stable/11/sys/dev/mlx5/mlx5_core/mlx5_crspace.c Modified: stable/11/sys/conf/files stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_vsc.c stable/11/sys/modules/mlx5/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Thu Aug 2 08:40:46 2018 (r337102) +++ stable/11/sys/conf/files Thu Aug 2 08:42:40 2018 (r337103) @@ -4542,8 +4542,6 @@ dev/mlx5/mlx5_core/mlx5_cmd.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_cq.c optional mlx5 pci \ compile-with "${OFED_C}" -dev/mlx5/mlx5_core/mlx5_crspace.c optional mlx5 pci \ - compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_diagnostics.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_eq.c optional mlx5 pci \ Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu Aug 2 08:40:46 2018 (r337102) +++ stable/11/sys/dev/mlx5/driver.h Thu Aug 2 08:42:40 2018 (r337103) @@ -656,7 +656,6 @@ struct mlx5_core_dev { struct mlx5_flow_root_namespace *sniffer_tx_root_ns; u32 num_q_counter_allocated[MLX5_INTERFACE_NUMBER]; struct mlx5_dump_data *dump_data; - u32 vsec_addr; }; enum { @@ -1029,8 +1028,11 @@ int mlx5_vsc_find_cap(struct mlx5_core_dev *mdev); int mlx5_vsc_lock(struct mlx5_core_dev *mdev); void mlx5_vsc_unlock(struct mlx5_core_dev *mdev); int mlx5_vsc_set_space(struct mlx5_core_dev *mdev, u16 space); -int mlx5_vsc_write(struct mlx5_core_dev *mdev, u32 addr, u32 *data); +int mlx5_vsc_write(struct mlx5_core_dev *mdev, u32 addr, const u32 *data); int mlx5_vsc_read(struct mlx5_core_dev *mdev, u32 addr, u32 *data); +int mlx5_vsc_lock_addr_space(struct mlx5_core_dev *mdev, u32 addr); +int mlx5_vsc_unlock_addr_space(struct mlx5_core_dev *mdev, u32 addr); + static inline u32 mlx5_mkey_to_idx(u32 mkey) { return mkey >> 8; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu Aug 2 08:40:46 2018 (r337102) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu Aug 2 08:42:40 2018 (r337103) @@ -70,12 +70,6 @@ enum mlx5_semaphore_space_address { MLX5_SEMAPHORE_SW_RESET = 0x20, }; -enum { - UNLOCK = 0, - LOCK = 1, - CAP_ID = 0x9, -}; - struct mlx5_core_dev; int mlx5_query_hca_caps(struct mlx5_core_dev *dev); @@ -109,8 +103,4 @@ struct mlx5_crspace_regmap { extern struct pci_driver mlx5_core_driver; -void mlx5_vsec_init(struct mlx5_core_dev *dev); -int mlx5_pciconf_cap9_sem(struct mlx5_core_dev *dev, int state); -int mlx5_pciconf_set_sem_addr_space(struct mlx5_core_dev *dev, - u32 sem_space_address, int state); #endif /* __MLX5_CORE_H__ */ Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu Aug 2 08:40:46 2018 (r337102) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu Aug 2 08:42:40 2018 (r337103) @@ -59,19 +59,19 @@ enum { MLX5_SENSOR_FW_SYND_RFR = 5, }; -static int lock_sem_sw_reset(struct mlx5_core_dev *dev, int state) +static int lock_sem_sw_reset(struct mlx5_core_dev *dev) { - int ret, err; + int ret; /* Lock GW access */ - ret = mlx5_pciconf_cap9_sem(dev, LOCK); + ret = -mlx5_vsc_lock(dev); if (ret) { - mlx5_core_warn(dev, "Timed out locking gateway %d, %d\n", state, ret); + mlx5_core_warn(dev, "Timed out locking gateway %d\n", ret); return ret; } - ret = mlx5_pciconf_set_sem_addr_space(dev, MLX5_SEMAPHORE_SW_RESET, state); - if (ret && state == LOCK) { + ret = -mlx5_vsc_lock_addr_space(dev, MLX5_SEMAPHORE_SW_RESET); + if (ret) { if (ret == -EBUSY) mlx5_core_dbg(dev, "SW reset FW semaphore already locked, another function will handle the reset\n"); else @@ -79,13 +79,30 @@ static int lock_sem_sw_reset(struct mlx5_core_dev *dev } /* Unlock GW access */ - err = mlx5_pciconf_cap9_sem(dev, UNLOCK); - if (err) - mlx5_core_warn(dev, "Timed out unlocking gateway: state %d, err %d\n", state, err); + mlx5_vsc_unlock(dev); return ret; } +static int unlock_sem_sw_reset(struct mlx5_core_dev *dev) +{ + int ret; + + /* Lock GW access */ + ret = -mlx5_vsc_lock(dev); + if (ret) { + mlx5_core_warn(dev, "Timed out locking gateway %d\n", ret); + return ret; + } + + ret = -mlx5_vsc_unlock_addr_space(dev, MLX5_SEMAPHORE_SW_RESET); + + /* Unlock GW access */ + mlx5_vsc_unlock(dev); + + return ret; +} + static u8 get_nic_mode(struct mlx5_core_dev *dev) { return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 7; @@ -223,7 +240,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, if (fatal_error == MLX5_SENSOR_FW_SYND_RFR) { /* Get cr-dump and reset FW semaphore */ if (mlx5_core_is_pf(dev)) - lock = lock_sem_sw_reset(dev, LOCK); + lock = lock_sem_sw_reset(dev); /* Execute cr-dump and SW reset */ if (lock != -EBUSY) { @@ -249,7 +266,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, /* Release FW semaphore if you are the lock owner */ if (!lock) - lock_sem_sw_reset(dev, UNLOCK); + unlock_sem_sw_reset(dev); mlx5_core_err(dev, "system error event triggered\n"); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Aug 2 08:40:46 2018 (r337102) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Aug 2 08:42:40 2018 (r337103) @@ -873,7 +873,9 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, s struct pci_dev *pdev = dev->pdev; int err; - mlx5_vsec_init(dev); + err = mlx5_vsc_find_cap(dev); + if (err) + dev_err(&pdev->dev, "Unable to find vendor specific capabilities\n"); err = mlx5_query_hca_caps(dev); if (err) { Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vsc.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Thu Aug 2 08:40:46 2018 (r337102) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Thu Aug 2 08:42:40 2018 (r337103) @@ -29,6 +29,8 @@ #include #include +#define MLX5_SEMAPHORE_SPACE_DOMAIN 0xA + struct mlx5_ifc_vsc_space_bits { u8 status[0x3]; u8 reserved0[0xd]; @@ -139,7 +141,7 @@ int mlx5_vsc_set_space(struct mlx5_core_dev *mdev, u16 return 0; } -int mlx5_vsc_write(struct mlx5_core_dev *mdev, u32 addr, u32 *data) +int mlx5_vsc_write(struct mlx5_core_dev *mdev, u32 addr, const u32 *data) { device_t dev = mdev->pdev->dev.bsddev; int vsc_addr = mdev->vsc_addr; @@ -185,6 +187,60 @@ int mlx5_vsc_read(struct mlx5_core_dev *mdev, u32 addr } *data = pci_read_config(dev, vsc_addr + MLX5_VSC_DATA_OFFSET, 4); + + return 0; +} + +int mlx5_vsc_lock_addr_space(struct mlx5_core_dev *mdev, u32 addr) +{ + device_t dev = mdev->pdev->dev.bsddev; + int vsc_addr = mdev->vsc_addr; + u32 data; + int ret; + u32 id; + + ret = mlx5_vsc_set_space(mdev, MLX5_SEMAPHORE_SPACE_DOMAIN); + if (ret) + return ret; + + /* Get a unique ID based on the counter */ + id = pci_read_config(dev, vsc_addr + MLX5_VSC_COUNTER_OFFSET, 4); + + /* Try to modify lock */ + ret = mlx5_vsc_write(mdev, addr, &id); + if (ret) + return ret; + + /* Verify */ + ret = mlx5_vsc_read(mdev, addr, &data); + if (ret) + return ret; + if (data != id) + return EBUSY; + + return 0; +} + +int mlx5_vsc_unlock_addr_space(struct mlx5_core_dev *mdev, u32 addr) +{ + u32 data = 0; + int ret; + + ret = mlx5_vsc_set_space(mdev, MLX5_SEMAPHORE_SPACE_DOMAIN); + if (ret) + return ret; + + /* Try to modify lock */ + ret = mlx5_vsc_write(mdev, addr, &data); + if (ret) + return ret; + + /* Verify */ + ret = mlx5_vsc_read(mdev, addr, &data); + if (ret) + return ret; + if (data != 0) + return EBUSY; return 0; } Modified: stable/11/sys/modules/mlx5/Makefile ============================================================================== --- stable/11/sys/modules/mlx5/Makefile Thu Aug 2 08:40:46 2018 (r337102) +++ stable/11/sys/modules/mlx5/Makefile Thu Aug 2 08:42:40 2018 (r337103) @@ -6,7 +6,6 @@ SRCS= \ mlx5_alloc.c \ mlx5_cmd.c \ mlx5_cq.c \ -mlx5_crspace.c \ mlx5_diagnostics.c \ mlx5_eq.c \ mlx5_fs_cmd.c \ From owner-svn-src-stable@freebsd.org Thu Aug 2 08:43:55 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E76E2105EF16; Thu, 2 Aug 2018 08:43:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 976797D23C; Thu, 2 Aug 2018 08:43:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7830375D2; Thu, 2 Aug 2018 08:43:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728hsHS056189; Thu, 2 Aug 2018 08:43:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728hsCa056188; Thu, 2 Aug 2018 08:43:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020843.w728hsCa056188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:43:54 +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: r337104 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 337104 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:43:55 -0000 Author: hselasky Date: Thu Aug 2 08:43:54 2018 New Revision: 337104 URL: https://svnweb.freebsd.org/changeset/base/337104 Log: MFC r336398: Make sure the state variable is set atomically instead of using a mutex in mlx5core. Device detach and setting error state may deadlock over the interface mutex like this: a) Detach code in mlx5en waits until error state is set while the interface mutex is locked. b) The set error handler needs to lock the interface mutex before it can set the error state. The solution is to use atomics to set the error state. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu Aug 2 08:42:40 2018 (r337103) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu Aug 2 08:43:54 2018 (r337104) @@ -219,21 +219,19 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, u32 fatal_error; int lock = -EBUSY; - mutex_lock(&dev->intf_state_mutex); - if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { - goto unlock; - return; - } - fatal_error = check_fatal_sensors(dev); if (fatal_error || force) { + if (xchg(&dev->state, MLX5_DEVICE_STATE_INTERNAL_ERROR) == + MLX5_DEVICE_STATE_INTERNAL_ERROR) + return; if (!force) mlx5_core_err(dev, "internal state error detected\n"); - dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mlx5_trigger_cmd_completions(dev); } + mutex_lock(&dev->intf_state_mutex); + if (force) goto err_state_done; @@ -272,7 +270,6 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, err_state_done: mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0); -unlock: mutex_unlock(&dev->intf_state_mutex); } From owner-svn-src-stable@freebsd.org Thu Aug 2 08:44:41 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7AED2105EFCE; Thu, 2 Aug 2018 08:44:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 315B37D3D4; Thu, 2 Aug 2018 08:44:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1266C75D3; Thu, 2 Aug 2018 08:44:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728ie1U056303; Thu, 2 Aug 2018 08:44:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728ieQ0056302; Thu, 2 Aug 2018 08:44:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020844.w728ieQ0056302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:44:40 +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: r337105 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 337105 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:44:41 -0000 Author: hselasky Date: Thu Aug 2 08:44:40 2018 New Revision: 337105 URL: https://svnweb.freebsd.org/changeset/base/337105 Log: MFC r336399: Remove redundant call to mlx5_vsc_find_cap() in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Aug 2 08:43:54 2018 (r337104) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Aug 2 08:44:40 2018 (r337105) @@ -846,10 +846,7 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, st goto err_clr_master; } - if (mlx5_vsc_find_cap(dev)) - dev_err(&pdev->dev, "Unable to find vendor specific capabilities\n"); - - return 0; + return 0; err_clr_master: pci_clear_master(dev->pdev); From owner-svn-src-stable@freebsd.org Thu Aug 2 08:45:33 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50D19105F0E7; Thu, 2 Aug 2018 08:45:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 057107D5C2; Thu, 2 Aug 2018 08:45:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAC3C75D4; Thu, 2 Aug 2018 08:45:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728jWXu056407; Thu, 2 Aug 2018 08:45:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728jW48056406; Thu, 2 Aug 2018 08:45:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020845.w728jW48056406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:45: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: r337106 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 337106 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:45:33 -0000 Author: hselasky Date: Thu Aug 2 08:45:32 2018 New Revision: 337106 URL: https://svnweb.freebsd.org/changeset/base/337106 Log: MFC r336401: Correctly write atomic variable in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:44:40 2018 (r337105) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:45:32 2018 (r337106) @@ -1232,7 +1232,7 @@ mlx5e_open_sq(struct mlx5e_channel *c, if (err) goto err_disable_sq; - atomic_store_rel_int(&sq->queue_state, MLX5E_SQ_READY); + WRITE_ONCE(sq->queue_state, MLX5E_SQ_READY); return (0); From owner-svn-src-stable@freebsd.org Thu Aug 2 08:46:28 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0C93105F205; Thu, 2 Aug 2018 08:46:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 665007D748; Thu, 2 Aug 2018 08:46:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 483F275D6; Thu, 2 Aug 2018 08:46:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728kSkl056503; Thu, 2 Aug 2018 08:46:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728kSj9056502; Thu, 2 Aug 2018 08:46:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020846.w728kSj9056502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:46:28 +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: r337107 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 337107 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:46:28 -0000 Author: hselasky Date: Thu Aug 2 08:46:27 2018 New Revision: 337107 URL: https://svnweb.freebsd.org/changeset/base/337107 Log: MFC r336402: Do not hint about 'trust both' mode when the mlx5en(4) hardware does not support it. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 2 08:45:32 2018 (r337106) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 2 08:46:27 2018 (r337107) @@ -1123,9 +1123,14 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) priv, i, mlx5e_dscp_prio_handler, "CU", "Set DSCP to priority mapping, 0..7"); } +#define A "Set trust state, 1:PCP 2:DSCP" +#define B " 3:BOTH" SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), OID_AUTO, "trust_state", CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, priv, 0, mlx5e_trust_state_handler, "CU", - "Set trust state, 1:PCP 2:DSCP 3:BOTH"); + MLX5_CAP_QCAM_FEATURE(mdev, qpts_trust_both) ? + A B : A); +#undef B +#undef A } } From owner-svn-src-stable@freebsd.org Thu Aug 2 08:47:25 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BB1D105F2F3; Thu, 2 Aug 2018 08:47:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 312D87D8F7; Thu, 2 Aug 2018 08:47:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1265F75DA; Thu, 2 Aug 2018 08:47:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728lO2l056606; Thu, 2 Aug 2018 08:47:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728lOg6056603; Thu, 2 Aug 2018 08:47:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020847.w728lOg6056603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:47:24 +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: r337108 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 337108 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:47:25 -0000 Author: hselasky Date: Thu Aug 2 08:47:24 2018 New Revision: 337108 URL: https://svnweb.freebsd.org/changeset/base/337108 Log: MFC r336403: Add context numbers for HW elements in mlx5en(4). To access the data, set sysctl dev.mce.N.conf.debug_stats to 1. This enables the sysctl node dev.mce.N.hw_ctx_debug. Its content is the mapping of each channel' number to used receive queue and associated completion queue, set of the transmit queues numbers and corresponding completion queues. Trimmed example output: channel 30 rq 188 cq 1085 channel 30 tc 0 sq 187 cq 1084 channel 31 rq 191 cq 1087 channel 31 tc 0 sq 190 cq 1086 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 2 08:46:27 2018 (r337107) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 2 08:47:24 2018 (r337108) @@ -759,6 +759,7 @@ struct mlx5e_priv { struct sysctl_oid *sysctl_hw; int sysctl_debug; struct mlx5e_stats stats; + struct sysctl_ctx_list sysctl_ctx_channel_debug; int counter_set_id; struct workqueue_struct *wq; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 2 08:46:27 2018 (r337107) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 2 08:47:24 2018 (r337108) @@ -916,27 +916,75 @@ static const char *mlx5e_port_stats_debug_desc[] = { }; static int +mlx5e_ethtool_debug_channel_info(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv; + struct sbuf sb; + struct mlx5e_channel *c; + struct mlx5e_sq *sq; + struct mlx5e_rq *rq; + int error, i, tc; + + priv = arg1; + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + if (sbuf_new_for_sysctl(&sb, NULL, 128, req) == NULL) + return (ENOMEM); + sbuf_clear_flags(&sb, SBUF_INCLUDENUL); + + PRIV_LOCK(priv); + if (test_bit(MLX5E_STATE_OPENED, &priv->state) == 0) + goto out; + for (i = 0; i < priv->params.num_channels; i++) { + c = priv->channel[i]; + rq = &c->rq; + sbuf_printf(&sb, "channel %d rq %d cq %d\n", + c->ix, rq->rqn, rq->cq.mcq.cqn); + for (tc = 0; tc < c->num_tc; tc++) { + sq = &c->sq[tc]; + sbuf_printf(&sb, "channel %d tc %d sq %d cq %d\n", + c->ix, tc, sq->sqn, sq->cq.mcq.cqn); + } + } +out: + PRIV_UNLOCK(priv); + error = sbuf_finish(&sb); + sbuf_delete(&sb); + return (error); +} + +static int mlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; - int error; - int sys_debug; + int error, sys_debug; sys_debug = priv->sysctl_debug; error = sysctl_handle_int(oidp, &priv->sysctl_debug, 0, req); - if (error || !req->newptr) + if (error != 0 || !req->newptr) return (error); - priv->sysctl_debug = !!priv->sysctl_debug; + priv->sysctl_debug = priv->sysctl_debug != 0; if (sys_debug == priv->sysctl_debug) - return (error); - if (priv->sysctl_debug) + return (0); + + PRIV_LOCK(priv); + if (priv->sysctl_debug) { mlx5e_create_stats(&priv->stats.port_stats_debug.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), "debug_stats", mlx5e_port_stats_debug_desc, MLX5E_PORT_STATS_DEBUG_NUM, priv->stats.port_stats_debug.arg); - else + SYSCTL_ADD_PROC(&priv->sysctl_ctx_channel_debug, + SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, + "hw_ctx_debug", + CTLFLAG_RD | CTLFLAG_MPSAFE | CTLTYPE_STRING, priv, 0, + mlx5e_ethtool_debug_channel_info, "S", ""); + } else { sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); - return (error); + sysctl_ctx_free(&priv->sysctl_ctx_channel_debug); + } + PRIV_UNLOCK(priv); + return (0); } static void Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:46:27 2018 (r337107) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:47:24 2018 (r337108) @@ -3407,6 +3407,8 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) ifp->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); + sysctl_ctx_init(&priv->sysctl_ctx_channel_debug); + /* ifnet sysctl tree */ sysctl_ctx_init(&priv->sysctl_ctx); priv->sysctl_ifnet = SYSCTL_ADD_NODE(&priv->sysctl_ctx, SYSCTL_STATIC_CHILDREN(_dev), @@ -3565,6 +3567,7 @@ err_free_wq: err_free_sysctl: sysctl_ctx_free(&priv->sysctl_ctx); + sysctl_ctx_free(&priv->sysctl_ctx_channel_debug); if_free(ifp); @@ -3612,8 +3615,10 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp if_free(ifp); /* destroy all remaining sysctl nodes */ - if (priv->sysctl_debug) + if (priv->sysctl_debug) { + sysctl_ctx_free(&priv->sysctl_ctx_channel_debug); sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); + } sysctl_ctx_free(&priv->stats.vport.ctx); sysctl_ctx_free(&priv->stats.pport.ctx); sysctl_ctx_free(&priv->sysctl_ctx); From owner-svn-src-stable@freebsd.org Thu Aug 2 08:48:28 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 039DA105F3BA; Thu, 2 Aug 2018 08:48:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ACC2D7DA7C; Thu, 2 Aug 2018 08:48:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DD3975DB; Thu, 2 Aug 2018 08:48:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728mRtV056707; Thu, 2 Aug 2018 08:48:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728mRYm056706; Thu, 2 Aug 2018 08:48:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020848.w728mRYm056706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:48:27 +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: r337109 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 337109 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:48:28 -0000 Author: hselasky Date: Thu Aug 2 08:48:27 2018 New Revision: 337109 URL: https://svnweb.freebsd.org/changeset/base/337109 Log: MFC r336404: Enable both receive and transmit pauseframes by default in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:47:24 2018 (r337108) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:48:27 2018 (r337109) @@ -3252,8 +3252,8 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv) char path[96]; int error; - /* Only receiving pauseframes is enabled by default */ - priv->params.tx_pauseframe_control = 0; + /* enable pauseframes by default */ + priv->params.tx_pauseframe_control = 1; priv->params.rx_pauseframe_control = 1; /* disable ports flow control, PFC, by default */ From owner-svn-src-stable@freebsd.org Thu Aug 2 08:49:37 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CF3C105F530; Thu, 2 Aug 2018 08:49:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C66A27DC3A; Thu, 2 Aug 2018 08:49:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A789C75DC; Thu, 2 Aug 2018 08:49:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728naXM056812; Thu, 2 Aug 2018 08:49:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728naAe056810; Thu, 2 Aug 2018 08:49:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020849.w728naAe056810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:49:36 +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: r337110 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 337110 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:49:37 -0000 Author: hselasky Date: Thu Aug 2 08:49:35 2018 New Revision: 337110 URL: https://svnweb.freebsd.org/changeset/base/337110 Log: MFC r336407: Handle jumbo frames without requiring big clusters in mlx5en(4). The scatter list is formed by the chunks of MCLBYTES each, and larger than default packets are returned to the stack as the mbuf chain. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 2 08:48:27 2018 (r337109) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 2 08:49:35 2018 (r337110) @@ -80,8 +80,19 @@ #define MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE 0xa #define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE 0xe -/* freeBSD HW LRO is limited by 16KB - the size of max mbuf */ +#define MLX5E_MAX_RX_SEGS 7 + +#ifndef MLX5E_MAX_RX_BYTES +#define MLX5E_MAX_RX_BYTES MCLBYTES +#endif + +#if (MLX5E_MAX_RX_SEGS == 1) +/* FreeBSD HW LRO is limited by 16KB - the size of max mbuf */ #define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ MJUM16BYTES +#else +#define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ \ + MIN(65535, MLX5E_MAX_RX_SEGS * MLX5E_MAX_RX_BYTES) +#endif #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC 0x10 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE 0x3 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_PKTS 0x20 @@ -532,6 +543,7 @@ struct mlx5e_rq { struct mtx mtx; bus_dma_tag_t dma_tag; u32 wqe_sz; + u32 nsegs; struct mlx5e_rq_mbuf *mbuf; struct ifnet *ifp; struct mlx5e_rq_stats stats; @@ -782,8 +794,11 @@ struct mlx5e_tx_wqe { struct mlx5e_rx_wqe { struct mlx5_wqe_srq_next_seg next; - struct mlx5_wqe_data_seg data; + struct mlx5_wqe_data_seg data[]; }; + +/* the size of the structure above must be power of two */ +CTASSERT(powerof2(sizeof(struct mlx5e_rx_wqe))); struct mlx5e_eeprom { int lock_bit; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:48:27 2018 (r337109) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:49:35 2018 (r337110) @@ -33,9 +33,12 @@ #ifndef ETH_DRIVER_VERSION #define ETH_DRIVER_VERSION "3.4.1" #endif + char mlx5e_version[] = "Mellanox Ethernet driver" " (" ETH_DRIVER_VERSION ")"; +static int mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, u32 *nsegs); + struct mlx5e_channel_param { struct mlx5e_rq_param rq; struct mlx5e_sq_param sq; @@ -705,7 +708,12 @@ mlx5e_create_rq(struct mlx5e_channel *c, int wq_sz; int err; int i; + u32 nsegs, wqe_sz; + err = mlx5e_get_wqe_sz(priv, &wqe_sz, &nsegs); + if (err != 0) + goto done; + /* Create DMA descriptor TAG */ if ((err = -bus_dma_tag_create( bus_get_dma_tag(mdev->pdev->dev.bsddev), @@ -714,9 +722,9 @@ mlx5e_create_rq(struct mlx5e_channel *c, BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MJUM16BYTES, /* maxsize */ - 1, /* nsegments */ - MJUM16BYTES, /* maxsegsize */ + nsegs * MLX5E_MAX_RX_BYTES, /* maxsize */ + nsegs, /* nsegments */ + nsegs * MLX5E_MAX_RX_BYTES, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockfuncarg */ &rq->dma_tag))) @@ -729,23 +737,9 @@ mlx5e_create_rq(struct mlx5e_channel *c, rq->wq.db = &rq->wq.db[MLX5_RCV_DBR]; - if (priv->params.hw_lro_en) { - rq->wqe_sz = priv->params.lro_wqe_sz; - } else { - rq->wqe_sz = MLX5E_SW2MB_MTU(priv->ifp->if_mtu); - } - if (rq->wqe_sz > MJUM16BYTES) { - err = -ENOMEM; + err = mlx5e_get_wqe_sz(priv, &rq->wqe_sz, &rq->nsegs); + if (err != 0) goto err_rq_wq_destroy; - } else if (rq->wqe_sz > MJUM9BYTES) { - rq->wqe_sz = MJUM16BYTES; - } else if (rq->wqe_sz > MJUMPAGESIZE) { - rq->wqe_sz = MJUM9BYTES; - } else if (rq->wqe_sz > MCLBYTES) { - rq->wqe_sz = MJUMPAGESIZE; - } else { - rq->wqe_sz = MCLBYTES; - } wq_sz = mlx5_wq_ll_get_size(&rq->wq); @@ -756,7 +750,11 @@ mlx5e_create_rq(struct mlx5e_channel *c, rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); for (i = 0; i != wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i); +#if (MLX5E_MAX_RX_SEGS == 1) uint32_t byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN; +#else + int j; +#endif err = -bus_dmamap_create(rq->dma_tag, 0, &rq->mbuf[i].dma_map); if (err != 0) { @@ -764,8 +762,15 @@ mlx5e_create_rq(struct mlx5e_channel *c, bus_dmamap_destroy(rq->dma_tag, rq->mbuf[i].dma_map); goto err_rq_mbuf_free; } - wqe->data.lkey = c->mkey_be; - wqe->data.byte_count = cpu_to_be32(byte_count | MLX5_HW_START_PADDING); + + /* set value for constant fields */ +#if (MLX5E_MAX_RX_SEGS == 1) + wqe->data[0].lkey = c->mkey_be; + wqe->data[0].byte_count = cpu_to_be32(byte_count | MLX5_HW_START_PADDING); +#else + for (j = 0; j < rq->nsegs; j++) + wqe->data[j].lkey = c->mkey_be; +#endif } rq->ifp = c->ifp; @@ -1704,16 +1709,51 @@ mlx5e_close_channel_wait(struct mlx5e_channel *volatil free(c, M_MLX5EN); } +static int +mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, u32 *nsegs) +{ + u32 r, n; + + r = priv->params.hw_lro_en ? priv->params.lro_wqe_sz : + MLX5E_SW2MB_MTU(priv->ifp->if_mtu); + if (r > MJUM16BYTES) + return (-ENOMEM); + + if (r > MJUM9BYTES) + r = MJUM16BYTES; + else if (r > MJUMPAGESIZE) + r = MJUM9BYTES; + else if (r > MCLBYTES) + r = MJUMPAGESIZE; + else + r = MCLBYTES; + + /* + * n + 1 must be a power of two, because stride size must be. + * Stride size is 16 * (n + 1), as the first segment is + * control. + */ + for (n = howmany(r, MLX5E_MAX_RX_BYTES); !powerof2(n + 1); n++) + ; + + *wqe_sz = r; + *nsegs = n; + return (0); +} + static void mlx5e_build_rq_param(struct mlx5e_priv *priv, struct mlx5e_rq_param *param) { void *rqc = param->rqc; void *wq = MLX5_ADDR_OF(rqc, rqc, wq); + u32 wqe_sz, nsegs; + mlx5e_get_wqe_sz(priv, &wqe_sz, &nsegs); MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_LINKED_LIST); MLX5_SET(wq, wq, end_padding_mode, MLX5_WQ_END_PAD_MODE_ALIGN); - MLX5_SET(wq, wq, log_wq_stride, ilog2(sizeof(struct mlx5e_rx_wqe))); + MLX5_SET(wq, wq, log_wq_stride, ilog2(sizeof(struct mlx5e_rx_wqe) + + nsegs * sizeof(struct mlx5_wqe_data_seg))); MLX5_SET(wq, wq, log_wq_sz, priv->params.log_rq_size); MLX5_SET(wq, wq, pd, priv->pdn); Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu Aug 2 08:48:27 2018 (r337109) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu Aug 2 08:49:35 2018 (r337110) @@ -32,21 +32,47 @@ static inline int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix) { - bus_dma_segment_t segs[1]; + bus_dma_segment_t segs[rq->nsegs]; struct mbuf *mb; int nsegs; int err; - +#if (MLX5E_MAX_RX_SEGS != 1) + struct mbuf *mb_head; + int i; +#endif if (rq->mbuf[ix].mbuf != NULL) return (0); +#if (MLX5E_MAX_RX_SEGS == 1) mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, rq->wqe_sz); if (unlikely(!mb)) return (-ENOMEM); - /* set initial mbuf length */ mb->m_pkthdr.len = mb->m_len = rq->wqe_sz; +#else + mb_head = mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, + MLX5E_MAX_RX_BYTES); + if (unlikely(mb == NULL)) + return (-ENOMEM); + mb->m_len = MLX5E_MAX_RX_BYTES; + mb->m_pkthdr.len = MLX5E_MAX_RX_BYTES; + + for (i = 1; i < rq->nsegs; i++) { + if (mb_head->m_pkthdr.len >= rq->wqe_sz) + break; + mb = mb->m_next = m_getjcl(M_NOWAIT, MT_DATA, 0, + MLX5E_MAX_RX_BYTES); + if (unlikely(mb == NULL)) { + m_freem(mb_head); + return (-ENOMEM); + } + mb->m_len = MLX5E_MAX_RX_BYTES; + mb_head->m_pkthdr.len += MLX5E_MAX_RX_BYTES; + } + /* rewind to first mbuf in chain */ + mb = mb_head; +#endif /* get IP header aligned */ m_adj(mb, MLX5E_NET_IP_ALIGN); @@ -54,12 +80,26 @@ mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, mb, segs, &nsegs, BUS_DMA_NOWAIT); if (err != 0) goto err_free_mbuf; - if (unlikely(nsegs != 1)) { + if (unlikely(nsegs == 0)) { bus_dmamap_unload(rq->dma_tag, rq->mbuf[ix].dma_map); err = -ENOMEM; goto err_free_mbuf; } - wqe->data.addr = cpu_to_be64(segs[0].ds_addr); +#if (MLX5E_MAX_RX_SEGS == 1) + wqe->data[0].addr = cpu_to_be64(segs[0].ds_addr); +#else + wqe->data[0].addr = cpu_to_be64(segs[0].ds_addr); + wqe->data[0].byte_count = cpu_to_be32(segs[0].ds_len | + MLX5_HW_START_PADDING); + for (i = 1; i != nsegs; i++) { + wqe->data[i].addr = cpu_to_be64(segs[i].ds_addr); + wqe->data[i].byte_count = cpu_to_be32(segs[i].ds_len); + } + for (; i < rq->nsegs; i++) { + wqe->data[i].addr = 0; + wqe->data[i].byte_count = 0; + } +#endif rq->mbuf[ix].mbuf = mb; rq->mbuf[ix].data = mb->m_data; @@ -185,6 +225,9 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, u32 cqe_bcnt) { struct ifnet *ifp = rq->ifp; +#if (MLX5E_MAX_RX_SEGS != 1) + struct mbuf *mb_head; +#endif int lro_num_seg; /* HW LRO session aggregated packets counter */ lro_num_seg = be32_to_cpu(cqe->srqn) >> 24; @@ -194,7 +237,26 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, rq->stats.lro_bytes += cqe_bcnt; } +#if (MLX5E_MAX_RX_SEGS == 1) mb->m_pkthdr.len = mb->m_len = cqe_bcnt; +#else + mb->m_pkthdr.len = cqe_bcnt; + for (mb_head = mb; mb != NULL; mb = mb->m_next) { + if (mb->m_len > cqe_bcnt) + mb->m_len = cqe_bcnt; + cqe_bcnt -= mb->m_len; + if (likely(cqe_bcnt == 0)) { + if (likely(mb->m_next != NULL)) { + /* trim off empty mbufs */ + m_freem(mb->m_next); + mb->m_next = NULL; + } + break; + } + } + /* rewind to first mbuf in chain */ + mb = mb_head; +#endif /* check if a Toeplitz hash was computed */ if (cqe->rss_hash_type != 0) { mb->m_pkthdr.flowid = be32_to_cpu(cqe->rss_hash_result); @@ -357,6 +419,10 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) } if ((MHLEN - MLX5E_NET_IP_ALIGN) >= byte_cnt && (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { +#if (MLX5E_MAX_RX_SEGS != 1) + /* set maximum mbuf length */ + mb->m_len = MHLEN - MLX5E_NET_IP_ALIGN; +#endif /* get IP header aligned */ mb->m_data += MLX5E_NET_IP_ALIGN; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:50:29 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75249105F5FE; Thu, 2 Aug 2018 08:50:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B7F17DDA8; Thu, 2 Aug 2018 08:50:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E992C75E1; Thu, 2 Aug 2018 08:50:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728oSkc056942; Thu, 2 Aug 2018 08:50:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728oSeS056941; Thu, 2 Aug 2018 08:50:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020850.w728oSeS056941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:50:28 +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: r337111 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 337111 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:50:29 -0000 Author: hselasky Date: Thu Aug 2 08:50:28 2018 New Revision: 337111 URL: https://svnweb.freebsd.org/changeset/base/337111 Log: MFC r336408: Add missing newline. Sponsored by: Mellanox Technologies Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable@freebsd.org Thu Aug 2 08:51:57 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E56A6105F95C; Thu, 2 Aug 2018 08:51:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 942517E10A; Thu, 2 Aug 2018 08:51:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7537E7756; Thu, 2 Aug 2018 08:51:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728puCa060856; Thu, 2 Aug 2018 08:51:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728pusZ060855; Thu, 2 Aug 2018 08:51:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020851.w728pusZ060855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:51:56 +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: r337112 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 337112 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:51:57 -0000 Author: hselasky Date: Thu Aug 2 08:51:55 2018 New Revision: 337112 URL: https://svnweb.freebsd.org/changeset/base/337112 Log: MFC r336410: Add module parameter to limit number of MSIX EQ vectors in mlx5en(4). For setups having a large amount of PCI devices, it makes sense to limit the number of MSIX vectors per PCI device, in order to avoid running out of IRQ vectors. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Aug 2 08:50:28 2018 (r337111) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Aug 2 08:51:55 2018 (r337112) @@ -61,6 +61,10 @@ static int prof_sel = MLX5_DEFAULT_PROF; module_param_named(prof_sel, prof_sel, int, 0444); MODULE_PARM_DESC(prof_sel, "profile selector. Valid range 0 - 2"); +static int mlx5_core_msix_eqvec; +module_param_named(msix_eqvec, mlx5_core_msix_eqvec, int, 0644); +MODULE_PARM_DESC(msix_eqvec, "Maximum number of MSIX event queue vectors"); + #define NUMA_NO_NODE -1 static LIST_HEAD(intf_list); @@ -239,11 +243,15 @@ static int mlx5_enable_msix(struct mlx5_core_dev *dev) struct mlx5_priv *priv = &dev->priv; struct mlx5_eq_table *table = &priv->eq_table; int num_eqs = 1 << MLX5_CAP_GEN(dev, log_max_eq); - int nvec; + int limit = mlx5_core_msix_eqvec; + int nvec = MLX5_EQ_VEC_COMP_BASE; int i; - nvec = MLX5_CAP_GEN(dev, num_ports) * num_online_cpus() + - MLX5_EQ_VEC_COMP_BASE; + if (limit > 0) + nvec += limit; + else + nvec += MLX5_CAP_GEN(dev, num_ports) * num_online_cpus(); + nvec = min_t(int, nvec, num_eqs); if (nvec <= MLX5_EQ_VEC_COMP_BASE) return -ENOMEM; From owner-svn-src-stable@freebsd.org Thu Aug 2 08:52:51 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE6DA105FB5F; Thu, 2 Aug 2018 08:52:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 990F97E3D6; Thu, 2 Aug 2018 08:52:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A6D57783; Thu, 2 Aug 2018 08:52:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728qoxM061882; Thu, 2 Aug 2018 08:52:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728qo9b061881; Thu, 2 Aug 2018 08:52:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020852.w728qo9b061881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:52: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: r337113 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 337113 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:52:51 -0000 Author: hselasky Date: Thu Aug 2 08:52:49 2018 New Revision: 337113 URL: https://svnweb.freebsd.org/changeset/base/337113 Log: MFC r336411: Use a mbuf header instead of a mbuf cluster for debugging interrupts in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu Aug 2 08:51:55 2018 (r337112) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu Aug 2 08:52:49 2018 (r337113) @@ -468,7 +468,10 @@ mlx5e_rx_cq_comp(struct mlx5_core_cq *mcq) int i = 0; #ifdef HAVE_PER_CQ_EVENT_PACKET - struct mbuf *mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, rq->wqe_sz); +#if (MHLEN < 15) +#error "MHLEN is too small" +#endif + struct mbuf *mb = m_gethdr(M_NOWAIT, MT_DATA); if (mb != NULL) { /* this code is used for debugging purpose only */ From owner-svn-src-stable@freebsd.org Thu Aug 2 08:55:22 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0DF8105FC68; Thu, 2 Aug 2018 08:55:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4D157E563; Thu, 2 Aug 2018 08:55:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 817E27784; Thu, 2 Aug 2018 08:55:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728tLFc062110; Thu, 2 Aug 2018 08:55:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728tKZp062103; Thu, 2 Aug 2018 08:55:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020855.w728tKZp062103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:55:20 +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: r337114 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 337114 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:55:22 -0000 Author: hselasky Date: Thu Aug 2 08:55:19 2018 New Revision: 337114 URL: https://svnweb.freebsd.org/changeset/base/337114 Log: MFC r336450: Do not inline transmit headers and use HW VLAN tagging if supported by mlx5en(4). Query the minimal inline mode supported by the card. When creating a send queue, cache the queried mode and optimize the transmit if no inlining is required. In this case, we can avoid touching the headers cache line and avoid dirtying several more lines by copying headers into the send WQEs. Also, if no inline headers are used, hardware assists in the VLAN tag framing. Submitted by: kib@, slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c stable/11/sys/dev/mlx5/qp.h stable/11/sys/dev/mlx5/vport.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Thu Aug 2 08:52:49 2018 (r337113) +++ stable/11/sys/dev/mlx5/device.h Thu Aug 2 08:55:19 2018 (r337114) @@ -1091,6 +1091,13 @@ enum { MLX5_CMD_HCA_CAP_MIN_WQE_INLINE_MODE_NOT_REQUIRED = 0x2 }; +enum mlx5_inline_modes { + MLX5_INLINE_MODE_NONE, + MLX5_INLINE_MODE_L2, + MLX5_INLINE_MODE_IP, + MLX5_INLINE_MODE_TCP_UDP, +}; + enum { MLX5_QUERY_VPORT_STATE_OUT_STATE_FOLLOW = 0x2, }; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Thu Aug 2 08:52:49 2018 (r337113) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Thu Aug 2 08:55:19 2018 (r337114) @@ -208,6 +208,58 @@ int mlx5_vport_query_out_of_rx_buffer(struct mlx5_core return err; } +int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev, + u16 vport, u8 *min_inline) +{ + u32 out[MLX5_ST_SZ_DW(query_nic_vport_context_out)] = {0}; + int err; + + err = mlx5_query_nic_vport_context(mdev, vport, out, sizeof(out)); + if (!err) + *min_inline = MLX5_GET(query_nic_vport_context_out, out, + nic_vport_context.min_wqe_inline_mode); + return err; +} +EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_min_inline); + +void mlx5_query_min_inline(struct mlx5_core_dev *mdev, + u8 *min_inline_mode) +{ + switch (MLX5_CAP_ETH(mdev, wqe_inline_mode)) { + case MLX5_CAP_INLINE_MODE_L2: + *min_inline_mode = MLX5_INLINE_MODE_L2; + break; + case MLX5_CAP_INLINE_MODE_VPORT_CONTEXT: + mlx5_query_nic_vport_min_inline(mdev, 0, min_inline_mode); + break; + case MLX5_CAP_INLINE_MODE_NOT_REQUIRED: + *min_inline_mode = MLX5_INLINE_MODE_NONE; + break; + } +} +EXPORT_SYMBOL_GPL(mlx5_query_min_inline); + +int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev, + u16 vport, u8 min_inline) +{ + u32 in[MLX5_ST_SZ_DW(modify_nic_vport_context_in)] = {0}; + int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in); + void *nic_vport_ctx; + + MLX5_SET(modify_nic_vport_context_in, in, + field_select.min_wqe_inline_mode, 1); + MLX5_SET(modify_nic_vport_context_in, in, vport_number, vport); + MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1); + + nic_vport_ctx = MLX5_ADDR_OF(modify_nic_vport_context_in, + in, nic_vport_context); + MLX5_SET(nic_vport_context, nic_vport_ctx, + min_wqe_inline_mode, min_inline); + + return mlx5_modify_nic_vport_context(mdev, in, inlen); +} +EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_min_inline); + int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u16 vport, u8 *addr) { Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 2 08:52:49 2018 (r337113) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 2 08:55:19 2018 (r337114) @@ -450,6 +450,8 @@ struct mlx5e_params { u32 rx_pauseframe_control __aligned(4); u32 tx_priority_flow_control __aligned(4); u32 rx_priority_flow_control __aligned(4); + u16 tx_max_inline; + u8 tx_min_inline_mode; }; #define MLX5E_PARAMS(m) \ @@ -612,6 +614,9 @@ struct mlx5e_sq { u32 sqn; u32 bf_buf_size; u32 mkey_be; + u16 max_inline; + u8 min_inline_mode; + u8 vlan_inline_cap; /* control path */ struct mlx5_wq_ctrl wq_ctrl; @@ -909,5 +914,6 @@ void mlx5e_drain_sq(struct mlx5e_sq *); void mlx5e_modify_tx_dma(struct mlx5e_priv *priv, uint8_t value); void mlx5e_modify_rx_dma(struct mlx5e_priv *priv, uint8_t value); void mlx5e_resume_sq(struct mlx5e_sq *sq); +u8 mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev); #endif /* _MLX5_EN_H_ */ Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:52:49 2018 (r337113) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:55:19 2018 (r337114) @@ -1069,6 +1069,9 @@ mlx5e_create_sq(struct mlx5e_channel *c, sq->ifp = priv->ifp; sq->priv = priv; sq->tc = tc; + sq->max_inline = priv->params.tx_max_inline; + sq->min_inline_mode = priv->params.tx_min_inline_mode; + sq->vlan_inline_cap = MLX5_CAP_ETH(mdev, wqe_vlan_insert); /* check if we should allocate a second packet buffer */ if (priv->params_ethtool.tx_bufring_disable == 0) { @@ -2906,6 +2909,16 @@ mlx5e_check_required_hca_cap(struct mlx5_core_dev *mde return (0); } +static u16 +mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev) +{ + int bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2; + + return bf_buf_size - + sizeof(struct mlx5e_tx_wqe) + + 2 /*sizeof(mlx5e_tx_wqe.inline_hdr_start)*/; +} + static void mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv, @@ -2941,6 +2954,8 @@ mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev, priv->params.num_tc = 1; priv->params.default_vlan_prio = 0; priv->counter_set_id = -1; + priv->params.tx_max_inline = mlx5e_get_max_inline_cap(mdev); + mlx5_query_min_inline(mdev, &priv->params.tx_min_inline_mode); /* * hw lro is currently defaulted to off. when it won't anymore we @@ -3199,6 +3214,20 @@ mlx5e_modify_rx_dma(struct mlx5e_priv *priv, uint8_t v else mlx5e_enable_rx_dma(priv->channel[i]); } +} + +u8 +mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev) +{ + u8 min_inline_mode; + + min_inline_mode = MLX5_INLINE_MODE_L2; + mlx5_query_min_inline(mdev, &min_inline_mode); + if (min_inline_mode == MLX5_INLINE_MODE_NONE && + !MLX5_CAP_ETH(mdev, wqe_vlan_insert)) + min_inline_mode = MLX5_INLINE_MODE_L2; + + return (min_inline_mode); } static void Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Aug 2 08:52:49 2018 (r337113) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Aug 2 08:55:19 2018 (r337114) @@ -137,7 +137,43 @@ mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb) static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq *sq, struct mbuf *mb) { - return (MIN(MLX5E_MAX_TX_INLINE, mb->m_len)); + + switch(sq->min_inline_mode) { + case MLX5_INLINE_MODE_NONE: + /* + * When inline mode is NONE, we do not need to copy + * headers into WQEs, except when vlan tag framing is + * requested. Hardware might offload vlan tagging on + * transmit. This is a separate capability, which is + * known to be disabled on ConnectX-5 due to a hardware + * bug RM 931383. If vlan_inline_cap is not present and + * the packet has vlan tag, fall back to inlining. + */ + if ((mb->m_flags & M_VLANTAG) != 0 && + sq->vlan_inline_cap == 0) + break; + return (0); + case MLX5_INLINE_MODE_L2: + /* + * Due to hardware limitations, when trust mode is + * DSCP, the hardware may request MLX5_INLINE_MODE_L2 + * while it really needs all L2 headers and the 4 first + * bytes of the IP header (which include the + * TOS/traffic-class). + * + * To avoid doing a firmware command for querying the + * trust state and parsing the mbuf for doing + * unnecessary checks (VLAN/eth_type) in the fast path, + * we are going for the worth case (22 Bytes) if + * the mb->m_pkthdr.len allows it. + */ + if (mb->m_pkthdr.len > ETHER_HDR_LEN + + ETHER_VLAN_ENCAP_LEN + 4) + return (MIN(sq->max_inline, ETHER_HDR_LEN + + ETHER_VLAN_ENCAP_LEN + 4)); + break; + } + return (MIN(sq->max_inline, mb->m_pkthdr.len)); } static int @@ -275,37 +311,47 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) sq->mbuf[pi].num_bytes = max_t (unsigned int, mb->m_pkthdr.len, ETHER_MIN_LEN - ETHER_CRC_LEN); } - if (mb->m_flags & M_VLANTAG) { - struct ether_vlan_header *eh = - (struct ether_vlan_header *)wqe->eth.inline_hdr_start; - - /* Range checks */ - if (ihs > (MLX5E_MAX_TX_INLINE - ETHER_VLAN_ENCAP_LEN)) - ihs = (MLX5E_MAX_TX_INLINE - ETHER_VLAN_ENCAP_LEN); - else if (ihs < ETHER_HDR_LEN) { - err = EINVAL; - goto tx_drop; + if (ihs == 0) { + if ((mb->m_flags & M_VLANTAG) != 0) { + wqe->eth.vlan_cmd = htons(0x8000); /* bit 0 CVLAN */ + wqe->eth.vlan_hdr = htons(mb->m_pkthdr.ether_vtag); + } else { + wqe->eth.inline_hdr_sz = 0; } - m_copydata(mb, 0, ETHER_HDR_LEN, (caddr_t)eh); - m_adj(mb, ETHER_HDR_LEN); - /* Insert 4 bytes VLAN tag into data stream */ - eh->evl_proto = eh->evl_encap_proto; - eh->evl_encap_proto = htons(ETHERTYPE_VLAN); - eh->evl_tag = htons(mb->m_pkthdr.ether_vtag); - /* Copy rest of header data, if any */ - m_copydata(mb, 0, ihs - ETHER_HDR_LEN, (caddr_t)(eh + 1)); - m_adj(mb, ihs - ETHER_HDR_LEN); - /* Extend header by 4 bytes */ - ihs += ETHER_VLAN_ENCAP_LEN; } else { - m_copydata(mb, 0, ihs, wqe->eth.inline_hdr_start); - m_adj(mb, ihs); + if ((mb->m_flags & M_VLANTAG) != 0) { + struct ether_vlan_header *eh = (struct ether_vlan_header + *)wqe->eth.inline_hdr_start; + + /* Range checks */ + if (ihs > (MLX5E_MAX_TX_INLINE - ETHER_VLAN_ENCAP_LEN)) + ihs = (MLX5E_MAX_TX_INLINE - + ETHER_VLAN_ENCAP_LEN); + else if (ihs < ETHER_HDR_LEN) { + err = EINVAL; + goto tx_drop; + } + m_copydata(mb, 0, ETHER_HDR_LEN, (caddr_t)eh); + m_adj(mb, ETHER_HDR_LEN); + /* Insert 4 bytes VLAN tag into data stream */ + eh->evl_proto = eh->evl_encap_proto; + eh->evl_encap_proto = htons(ETHERTYPE_VLAN); + eh->evl_tag = htons(mb->m_pkthdr.ether_vtag); + /* Copy rest of header data, if any */ + m_copydata(mb, 0, ihs - ETHER_HDR_LEN, (caddr_t)(eh + + 1)); + m_adj(mb, ihs - ETHER_HDR_LEN); + /* Extend header by 4 bytes */ + ihs += ETHER_VLAN_ENCAP_LEN; + } else { + m_copydata(mb, 0, ihs, wqe->eth.inline_hdr_start); + m_adj(mb, ihs); + } + wqe->eth.inline_hdr_sz = cpu_to_be16(ihs); } - wqe->eth.inline_hdr_sz = cpu_to_be16(ihs); - ds_cnt = sizeof(*wqe) / MLX5_SEND_WQE_DS; - if (likely(ihs > sizeof(wqe->eth.inline_hdr_start))) { + if (ihs > sizeof(wqe->eth.inline_hdr_start)) { ds_cnt += DIV_ROUND_UP(ihs - sizeof(wqe->eth.inline_hdr_start), MLX5_SEND_WQE_DS); } Modified: stable/11/sys/dev/mlx5/qp.h ============================================================================== --- stable/11/sys/dev/mlx5/qp.h Thu Aug 2 08:52:49 2018 (r337113) +++ stable/11/sys/dev/mlx5/qp.h Thu Aug 2 08:55:19 2018 (r337114) @@ -240,8 +240,16 @@ struct mlx5_wqe_eth_seg { u8 swp_flags; __be16 mss; __be32 rsvd2; - __be16 inline_hdr_sz; - u8 inline_hdr_start[2]; + union { + struct { + __be16 inline_hdr_sz; + u8 inline_hdr_start[2]; + }; + struct { + __be16 vlan_cmd; + __be16 vlan_hdr; + }; + }; }; struct mlx5_wqe_xrc_seg { Modified: stable/11/sys/dev/mlx5/vport.h ============================================================================== --- stable/11/sys/dev/mlx5/vport.h Thu Aug 2 08:52:49 2018 (r337113) +++ stable/11/sys/dev/mlx5/vport.h Thu Aug 2 08:55:19 2018 (r337114) @@ -29,6 +29,13 @@ #define __MLX5_VPORT_H__ #include + +enum { + MLX5_CAP_INLINE_MODE_L2, + MLX5_CAP_INLINE_MODE_VPORT_CONTEXT, + MLX5_CAP_INLINE_MODE_NOT_REQUIRED, +}; + int mlx5_vport_alloc_q_counter(struct mlx5_core_dev *mdev, int client_id, u16 *counter_set_id); int mlx5_vport_dealloc_q_counter(struct mlx5_core_dev *mdev, int client_id, @@ -79,6 +86,11 @@ int mlx5_modify_nic_vport_mac_address(struct mlx5_core u16 vport, u8 mac[ETH_ALEN]); int mlx5_set_nic_vport_current_mac(struct mlx5_core_dev *mdev, int vport, bool other_vport, u8 *addr); +int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev, + u16 vport, u8 *min_inline); +void mlx5_query_min_inline(struct mlx5_core_dev *mdev, u8 *min_inline); +int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev, + u16 vport, u8 min_inline); int mlx5_modify_nic_vport_port_guid(struct mlx5_core_dev *mdev, u32 vport, u64 port_guid); int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev, From owner-svn-src-stable@freebsd.org Thu Aug 2 08:56:32 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36610105FCFF; Thu, 2 Aug 2018 08:56:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF5877E6B6; Thu, 2 Aug 2018 08:56:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C002A7785; Thu, 2 Aug 2018 08:56:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728uVXJ062236; Thu, 2 Aug 2018 08:56:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728uRlT062213; Thu, 2 Aug 2018 08:56:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020856.w728uRlT062213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:56:27 +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: r337115 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 337115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:56:32 -0000 Author: hselasky Date: Thu Aug 2 08:56:27 2018 New Revision: 337115 URL: https://svnweb.freebsd.org/changeset/base/337115 Log: MFC r336451: Update version information for the mlx5 and mlx5en(4) modules. While at it bump some copyright dates. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/cq.h stable/11/sys/dev/mlx5/doorbell.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_mad.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_mcg.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_pd.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_srq.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_uar.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_wq.c stable/11/sys/dev/mlx5/mlx5_core/wq.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_rdma_if.h stable/11/sys/dev/mlx5/qp.h stable/11/sys/dev/mlx5/srq.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/cq.h ============================================================================== --- stable/11/sys/dev/mlx5/cq.h Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/cq.h Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/doorbell.h ============================================================================== --- stable/11/sys/dev/mlx5/doorbell.h Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/doorbell.h Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,9 +34,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.4.1" +#define DRIVER_VERSION "3.4.2" #endif -#define DRIVER_RELDATE "February 2018" +#define DRIVER_RELDATE "July 2018" extern int mlx5_core_debug_mask; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_mad.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_mad.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_mad.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_mcg.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_mcg.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_mcg.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_pd.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_pd.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_pd.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_srq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_srq.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_srq.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_uar.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_uar.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_uar.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_wq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_wq.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_wq.c Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_core/wq.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/wq.h Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_core/wq.h Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:56:27 2018 (r337115) @@ -31,7 +31,7 @@ #include #ifndef ETH_DRIVER_VERSION -#define ETH_DRIVER_VERSION "3.4.1" +#define ETH_DRIVER_VERSION "3.4.2" #endif char mlx5e_version[] = "Mellanox Ethernet driver" Modified: stable/11/sys/dev/mlx5/mlx5_rdma_if.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_rdma_if.h Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/mlx5_rdma_if.h Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/qp.h ============================================================================== --- stable/11/sys/dev/mlx5/qp.h Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/qp.h Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/mlx5/srq.h ============================================================================== --- stable/11/sys/dev/mlx5/srq.h Thu Aug 2 08:55:19 2018 (r337114) +++ stable/11/sys/dev/mlx5/srq.h Thu Aug 2 08:56:27 2018 (r337115) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-stable@freebsd.org Thu Aug 2 08:57:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2F45105FD82; Thu, 2 Aug 2018 08:57:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7EA97E801; Thu, 2 Aug 2018 08:57:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88E797786; Thu, 2 Aug 2018 08:57:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728vfNw062363; Thu, 2 Aug 2018 08:57:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728vfq9062361; Thu, 2 Aug 2018 08:57:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020857.w728vfq9062361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 08:57: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: r337116 - stable/11/contrib/ofed/libibumad X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/contrib/ofed/libibumad X-SVN-Commit-Revision: 337116 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:57:42 -0000 Author: hselasky Date: Thu Aug 2 08:57:40 2018 New Revision: 337116 URL: https://svnweb.freebsd.org/changeset/base/337116 Log: MFC r336452: Add ability to parse sysfs paths under FreeBSD in libibumad. Add the ability to to parse sysfs paths to sysctl nodes by replacing '/' with '.' Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/contrib/ofed/libibumad/sysfs.c stable/11/contrib/ofed/libibumad/sysfs.h stable/11/contrib/ofed/libibumad/umad.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/ofed/libibumad/sysfs.c ============================================================================== --- stable/11/contrib/ofed/libibumad/sysfs.c Thu Aug 2 08:56:27 2018 (r337115) +++ stable/11/contrib/ofed/libibumad/sysfs.c Thu Aug 2 08:57:40 2018 (r337116) @@ -62,12 +62,8 @@ int sys_read_string(const char *dir_name, const char * snprintf(path, sizeof(path), "%s/%s", dir_name, file_name); - for (s = &path[0]; *s != '\0'; s++) - if (*s == '/') - *s = '.'; - len = max_len; - if (sysctlbyname(&path[1], str, &len, NULL, 0) == -1) + if (sysctlbyname(PATH_TO_SYS(path), str, &len, NULL, 0) == -1) return ret_code(); str[(len < max_len) ? len : max_len - 1] = 0; @@ -170,11 +166,8 @@ sys_scandir(const char *dirname, struct dirent ***name int i; *namelist = NULL; - /* Skip the leading / */ - strncpy(name, &dirname[1], sizeof(name)); - for (s = &name[0]; *s != '\0'; s++) - if (*s == '/') - *s = '.'; + if (strlcpy(name, PATH_TO_SYS(dirname), sizeof(name)) >= sizeof(name)) + return (-EINVAL); /* * Resolve the path. */ @@ -259,7 +252,7 @@ out: if (cnt && compar) qsort(names, cnt, sizeof(struct dirent *), (int (*)(const void *, const void *))compar); - + *namelist = names; return (cnt); Modified: stable/11/contrib/ofed/libibumad/sysfs.h ============================================================================== --- stable/11/contrib/ofed/libibumad/sysfs.h Thu Aug 2 08:56:27 2018 (r337115) +++ stable/11/contrib/ofed/libibumad/sysfs.h Thu Aug 2 08:57:40 2018 (r337116) @@ -34,6 +34,8 @@ #define _UMAD_SYSFS_H #include +#include +#include #include #include @@ -48,5 +50,38 @@ extern int sys_read_uint(const char *dir_name, const c extern int sys_scandir(const char *dirname, struct dirent ***namelist, int (*select)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)); + +#ifdef __FreeBSD__ +static inline const char * +path_to_sysctl(const char *path, int out_len, char *out) +{ + const char *retval = out; + + /* Validate that out is at least as long as the original path */ + if (out_len < (strlen(path) + 1)) + return NULL; + + while (*path == '/') + path++; + + while (*path) { + if (*path == '/') { + if (*(path + 1) == '/') + *out = '.'; + else + *out++ = '.'; + } else + *out++ = *path; + path++; + } + *out = 0; + return (retval); +} + +#define PATH_TO_SYS(str) \ + path_to_sysctl(str, strlen(str) + 1, alloca(strlen(str) + 1)) +#else +#define PATH_TO_SYS(str) str +#endif #endif /* _UMAD_SYSFS_H */ Modified: stable/11/contrib/ofed/libibumad/umad.c ============================================================================== --- stable/11/contrib/ofed/libibumad/umad.c Thu Aug 2 08:56:27 2018 (r337115) +++ stable/11/contrib/ofed/libibumad/umad.c Thu Aug 2 08:57:40 2018 (r337116) @@ -509,14 +509,14 @@ int umad_init(void) TRACE("umad_init"); if (sys_read_uint(IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE, &abi_version) < 0) { IBWARN - ("can't read ABI version from %s/%s (%m): is ib_umad module loaded?", - IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE); + ("can't read ABI version from %s (%m): is ibcore module loaded?", + PATH_TO_SYS(IB_UMAD_ABI_DIR "/" IB_UMAD_ABI_FILE)); return -1; } if (abi_version < IB_UMAD_ABI_VERSION) { IBWARN - ("wrong ABI version: %s/%s is %d but library minimal ABI is %d", - IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE, abi_version, + ("wrong ABI version: %s is %d but library minimal ABI is %d", + PATH_TO_SYS(IB_UMAD_ABI_DIR "/" IB_UMAD_ABI_FILE), abi_version, IB_UMAD_ABI_VERSION); return -1; } From owner-svn-src-stable@freebsd.org Thu Aug 2 08:58:33 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC255105FE15; Thu, 2 Aug 2018 08:58:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 90B507E95B; Thu, 2 Aug 2018 08:58:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 717F57789; Thu, 2 Aug 2018 08:58:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w728wXC5062468; Thu, 2 Aug 2018 08:58:33 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w728wXSE062467; Thu, 2 Aug 2018 08:58:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201808020858.w728wXSE062467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 2 Aug 2018 08:58: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: r337117 - stable/11/sys/dev/acpica X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/dev/acpica X-SVN-Commit-Revision: 337117 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 08:58:34 -0000 Author: avg Date: Thu Aug 2 08:58:33 2018 New Revision: 337117 URL: https://svnweb.freebsd.org/changeset/base/337117 Log: MFC r334479: call AcpiLeaveSleepStatePrep after re-enabling interrupts Modified: stable/11/sys/dev/acpica/acpi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/acpica/acpi.c ============================================================================== --- stable/11/sys/dev/acpica/acpi.c Thu Aug 2 08:57:40 2018 (r337116) +++ stable/11/sys/dev/acpica/acpi.c Thu Aug 2 08:58:33 2018 (r337117) @@ -2928,8 +2928,6 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state) if (sleep_result == 1 && state != ACPI_STATE_S4) AcpiWriteBitRegister(ACPI_BITREG_SCI_ENABLE, ACPI_ENABLE_EVENT); - AcpiLeaveSleepStatePrep(state); - if (sleep_result == 1 && state == ACPI_STATE_S3) { /* * Prevent mis-interpretation of the wakeup by power button @@ -2958,6 +2956,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state) /* call acpi_wakeup_machdep() again with interrupt enabled */ acpi_wakeup_machdep(sc, state, sleep_result, 1); + AcpiLeaveSleepStatePrep(state); + if (sleep_result == -1) goto backout; @@ -2966,8 +2966,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state) AcpiEnable(); } else { status = AcpiEnterSleepState(state); - AcpiLeaveSleepStatePrep(state); intr_restore(intr); + AcpiLeaveSleepStatePrep(state); if (ACPI_FAILURE(status)) { device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", AcpiFormatException(status)); From owner-svn-src-stable@freebsd.org Thu Aug 2 09:00:10 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E00F10600A5; Thu, 2 Aug 2018 09:00:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E78E7EACC; Thu, 2 Aug 2018 09:00:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16770778E; Thu, 2 Aug 2018 09:00:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7290902062679; Thu, 2 Aug 2018 09:00:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w729094l062677; Thu, 2 Aug 2018 09:00:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201808020900.w729094l062677@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 2 Aug 2018 09:00: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: r337118 - stable/11/sys/x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/x86/x86 X-SVN-Commit-Revision: 337118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 09:00:10 -0000 Author: avg Date: Thu Aug 2 09:00:09 2018 New Revision: 337118 URL: https://svnweb.freebsd.org/changeset/base/337118 Log: MFC r334786: x86: reorganize code that deals with unexpected NMI-s Modified: stable/11/sys/x86/x86/cpu_machdep.c stable/11/sys/x86/x86/mp_x86.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/cpu_machdep.c ============================================================================== --- stable/11/sys/x86/x86/cpu_machdep.c Thu Aug 2 08:58:33 2018 (r337117) +++ stable/11/sys/x86/x86/cpu_machdep.c Thu Aug 2 09:00:09 2018 (r337118) @@ -768,33 +768,34 @@ SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWT "Go to KDB on NMI with unknown source"); #endif -#ifdef DEV_ISA void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame) { + bool claimed = false; +#ifdef DEV_ISA /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(frame->tf_err) == 0) { + if (isa_nmi(frame->tf_err)) { + claimed = true; + if (panic_on_nmi) + panic("NMI indicates hardware failure"); + } +#endif /* DEV_ISA */ #ifdef KDB + if (!claimed && kdb_on_nmi) { /* * NMI can be hooked up to a pushbutton for debugging. */ - if (kdb_on_nmi) { - printf("NMI/cpu%d ... going to debugger\n", cpu); - kdb_trap(type, 0, frame); - } -#endif /* KDB */ - } else if (panic_on_nmi) { - panic("NMI indicates hardware failure"); + printf("NMI/cpu%d ... going to debugger\n", cpu); + kdb_trap(type, 0, frame); } +#endif /* KDB */ } -#endif void nmi_handle_intr(u_int type, struct trapframe *frame) { -#ifdef DEV_ISA #ifdef SMP if (nmi_is_broadcast) { nmi_call_kdb_smp(type, frame); @@ -802,7 +803,6 @@ nmi_handle_intr(u_int type, struct trapframe *frame) } #endif nmi_call_kdb(PCPU_GET(cpuid), type, frame); -#endif } int hw_ibrs_active; Modified: stable/11/sys/x86/x86/mp_x86.c ============================================================================== --- stable/11/sys/x86/x86/mp_x86.c Thu Aug 2 08:58:33 2018 (r337117) +++ stable/11/sys/x86/x86/mp_x86.c Thu Aug 2 09:00:09 2018 (r337118) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include "opt_apic.h" #endif #include "opt_cpu.h" -#include "opt_isa.h" #include "opt_kstack_pages.h" #include "opt_pmap.h" #include "opt_sched.h" @@ -1233,7 +1232,6 @@ ipi_nmi_handler(void) return (0); } -#ifdef DEV_ISA int nmi_kdb_lock; void @@ -1257,7 +1255,6 @@ nmi_call_kdb_smp(u_int type, struct trapframe *frame) if (call_post) cpustop_handler_post(cpu); } -#endif /* * Handle an IPI_STOP by saving our current context and spinning until we From owner-svn-src-stable@freebsd.org Thu Aug 2 09:02:21 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 545481060296; Thu, 2 Aug 2018 09:02:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08F757F379; Thu, 2 Aug 2018 09:02:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF8A4790F; Thu, 2 Aug 2018 09:02:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7292Ksr067243; Thu, 2 Aug 2018 09:02:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7292Jpc067238; Thu, 2 Aug 2018 09:02:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020902.w7292Jpc067238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 09:02:19 +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: r337119 - stable/11/contrib/ofed/libibverbs/examples X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/contrib/ofed/libibverbs/examples X-SVN-Commit-Revision: 337119 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 09:02:21 -0000 Author: hselasky Date: Thu Aug 2 09:02:19 2018 New Revision: 337119 URL: https://svnweb.freebsd.org/changeset/base/337119 Log: MFC r336453: Use unspecified address family when connecting as a client in libibverbs example utilities. This allows connecting to both IPv4 and IPv6 and reverts some FreeBSD only patches. Sponsored by: Mellanox Technologies Modified: stable/11/contrib/ofed/libibverbs/examples/rc_pingpong.c stable/11/contrib/ofed/libibverbs/examples/srq_pingpong.c stable/11/contrib/ofed/libibverbs/examples/uc_pingpong.c stable/11/contrib/ofed/libibverbs/examples/ud_pingpong.c stable/11/contrib/ofed/libibverbs/examples/xsrq_pingpong.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/ofed/libibverbs/examples/rc_pingpong.c ============================================================================== --- stable/11/contrib/ofed/libibverbs/examples/rc_pingpong.c Thu Aug 2 09:00:09 2018 (r337118) +++ stable/11/contrib/ofed/libibverbs/examples/rc_pingpong.c Thu Aug 2 09:02:19 2018 (r337119) @@ -154,7 +154,7 @@ static struct pingpong_dest *pp_client_exch_dest(const { struct addrinfo *res, *t; struct addrinfo hints = { - .ai_family = AF_INET, + .ai_family = AF_UNSPEC, .ai_socktype = SOCK_STREAM }; char *service; Modified: stable/11/contrib/ofed/libibverbs/examples/srq_pingpong.c ============================================================================== --- stable/11/contrib/ofed/libibverbs/examples/srq_pingpong.c Thu Aug 2 09:00:09 2018 (r337118) +++ stable/11/contrib/ofed/libibverbs/examples/srq_pingpong.c Thu Aug 2 09:02:19 2018 (r337119) @@ -147,7 +147,7 @@ static struct pingpong_dest *pp_client_exch_dest(const { struct addrinfo *res, *t; struct addrinfo hints = { - .ai_family = AF_INET, + .ai_family = AF_UNSPEC, .ai_socktype = SOCK_STREAM }; char *service; Modified: stable/11/contrib/ofed/libibverbs/examples/uc_pingpong.c ============================================================================== --- stable/11/contrib/ofed/libibverbs/examples/uc_pingpong.c Thu Aug 2 09:00:09 2018 (r337118) +++ stable/11/contrib/ofed/libibverbs/examples/uc_pingpong.c Thu Aug 2 09:02:19 2018 (r337119) @@ -127,7 +127,7 @@ static struct pingpong_dest *pp_client_exch_dest(const { struct addrinfo *res, *t; struct addrinfo hints = { - .ai_family = AF_INET, + .ai_family = AF_UNSPEC, .ai_socktype = SOCK_STREAM }; char *service; Modified: stable/11/contrib/ofed/libibverbs/examples/ud_pingpong.c ============================================================================== --- stable/11/contrib/ofed/libibverbs/examples/ud_pingpong.c Thu Aug 2 09:00:09 2018 (r337118) +++ stable/11/contrib/ofed/libibverbs/examples/ud_pingpong.c Thu Aug 2 09:02:19 2018 (r337119) @@ -127,7 +127,7 @@ static struct pingpong_dest *pp_client_exch_dest(const { struct addrinfo *res, *t; struct addrinfo hints = { - .ai_family = AF_INET, + .ai_family = AF_UNSPEC, .ai_socktype = SOCK_STREAM }; char *service; Modified: stable/11/contrib/ofed/libibverbs/examples/xsrq_pingpong.c ============================================================================== --- stable/11/contrib/ofed/libibverbs/examples/xsrq_pingpong.c Thu Aug 2 09:00:09 2018 (r337118) +++ stable/11/contrib/ofed/libibverbs/examples/xsrq_pingpong.c Thu Aug 2 09:02:19 2018 (r337119) @@ -544,7 +544,7 @@ static int pp_client_connect(const char *servername, i int ret; int sockfd = -1; struct addrinfo hints = { - .ai_family = AF_INET, + .ai_family = AF_UNSPEC, .ai_socktype = SOCK_STREAM }; From owner-svn-src-stable@freebsd.org Thu Aug 2 09:03:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96BD1106030C; Thu, 2 Aug 2018 09:03:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BDA97F4CD; Thu, 2 Aug 2018 09:03:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BD40791F; Thu, 2 Aug 2018 09:03:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w72939S8067339; Thu, 2 Aug 2018 09:03:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w729395w067338; Thu, 2 Aug 2018 09:03:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201808020903.w729395w067338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 2 Aug 2018 09:03: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: r337120 - stable/11/sys/compat/linuxkpi/common/include/asm X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/asm X-SVN-Commit-Revision: 337120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 09:03:09 -0000 Author: hselasky Date: Thu Aug 2 09:03:08 2018 New Revision: 337120 URL: https://svnweb.freebsd.org/changeset/base/337120 Log: MFC r337056: Don't refer to non-existing atomic functions, even though not compiled, in the LinuxKPI. Found by: rpokala @ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h Thu Aug 2 09:02:19 2018 (r337119) +++ stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h Thu Aug 2 09:03:08 2018 (r337120) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2018 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -159,6 +159,21 @@ atomic_cmpxchg(atomic_t *v, int old, int new) return (ret); } +#if defined(__i386__) || defined(__amd64__) +#define LINUXKPI_ATOMIC_8(...) __VA_ARGS__ +#define LINUXKPI_ATOMIC_16(...) __VA_ARGS__ +#else +#define LINUXKPI_ATOMIC_8(...) +#define LINUXKPI_ATOMIC_16(...) +#endif + +#if defined(__amd64__) || (defined(__ARM_ARCH) && (__ARM_ARCH >= 6)) || \ + defined(__aarch64__) || defined(__powerpc64__) || defined(__riscv) +#define LINUXKPI_ATOMIC_64(...) __VA_ARGS__ +#else +#define LINUXKPI_ATOMIC_64(...) +#endif + #define cmpxchg(ptr, old, new) ({ \ union { \ __typeof(*(ptr)) val; \ @@ -168,30 +183,39 @@ atomic_cmpxchg(atomic_t *v, int old, int new) u64 u64[0]; \ } __ret = { .val = (old) }, __new = { .val = (new) }; \ \ - CTASSERT(sizeof(__ret.val) == 1 || sizeof(__ret.val) == 2 || \ - sizeof(__ret.val) == 4 || sizeof(__ret.val) == 8); \ + CTASSERT( \ + LINUXKPI_ATOMIC_8(sizeof(__ret.val) == 1 ||) \ + LINUXKPI_ATOMIC_16(sizeof(__ret.val) == 2 ||) \ + LINUXKPI_ATOMIC_64(sizeof(__ret.val) == 8 ||) \ + sizeof(__ret.val) == 4); \ \ switch (sizeof(__ret.val)) { \ + LINUXKPI_ATOMIC_8( \ case 1: \ while (!atomic_fcmpset_8((volatile u8 *)(ptr), \ __ret.u8, __new.u8[0]) && __ret.val == (old)) \ ; \ break; \ + ) \ + LINUXKPI_ATOMIC_16( \ case 2: \ while (!atomic_fcmpset_16((volatile u16 *)(ptr), \ __ret.u16, __new.u16[0]) && __ret.val == (old)) \ ; \ break; \ + ) \ case 4: \ while (!atomic_fcmpset_32((volatile u32 *)(ptr), \ __ret.u32, __new.u32[0]) && __ret.val == (old)) \ ; \ break; \ + LINUXKPI_ATOMIC_64( \ case 8: \ while (!atomic_fcmpset_64((volatile u64 *)(ptr), \ __ret.u64, __new.u64[0]) && __ret.val == (old)) \ ; \ break; \ + ) \ } \ __ret.val; \ }) @@ -207,30 +231,39 @@ atomic_cmpxchg(atomic_t *v, int old, int new) u64 u64[0]; \ } __ret, __new = { .val = (new) }; \ \ - CTASSERT(sizeof(__ret.val) == 1 || sizeof(__ret.val) == 2 || \ - sizeof(__ret.val) == 4 || sizeof(__ret.val) == 8); \ + CTASSERT( \ + LINUXKPI_ATOMIC_8(sizeof(__ret.val) == 1 ||) \ + LINUXKPI_ATOMIC_16(sizeof(__ret.val) == 2 ||) \ + LINUXKPI_ATOMIC_64(sizeof(__ret.val) == 8 ||) \ + sizeof(__ret.val) == 4); \ \ switch (sizeof(__ret.val)) { \ + LINUXKPI_ATOMIC_8( \ case 1: \ __ret.val = READ_ONCE(*ptr); \ while (!atomic_fcmpset_8((volatile u8 *)(ptr), \ __ret.u8, __new.u8[0])) \ ; \ break; \ + ) \ + LINUXKPI_ATOMIC_16( \ case 2: \ __ret.val = READ_ONCE(*ptr); \ while (!atomic_fcmpset_16((volatile u16 *)(ptr), \ __ret.u16, __new.u16[0])) \ ; \ break; \ + ) \ case 4: \ __ret.u32[0] = atomic_swap_32((volatile u32 *)(ptr), \ __new.u32[0]); \ break; \ + LINUXKPI_ATOMIC_64( \ case 8: \ __ret.u64[0] = atomic_swap_64((volatile u64 *)(ptr), \ __new.u64[0]); \ break; \ + ) \ } \ __ret.val; \ }) From owner-svn-src-stable@freebsd.org Thu Aug 2 09:29:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 609DE1060B48; Thu, 2 Aug 2018 09:29:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F420380024; Thu, 2 Aug 2018 09:29:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C88A57CC6; Thu, 2 Aug 2018 09:29:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w729Tfh7078066; Thu, 2 Aug 2018 09:29:41 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w729TeNm078059; Thu, 2 Aug 2018 09:29:40 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201808020929.w729TeNm078059@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 2 Aug 2018 09:29:40 +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: r337121 - in stable/11/sys: cam cam/ata cam/nvme cam/scsi dev/acpica/Osd dev/pccbb kern X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11/sys: cam cam/ata cam/nvme cam/scsi dev/acpica/Osd dev/pccbb kern X-SVN-Commit-Revision: 337121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 09:29:42 -0000 Author: avg Date: Thu Aug 2 09:29:39 2018 New Revision: 337121 URL: https://svnweb.freebsd.org/changeset/base/337121 Log: MFC r335934: remove unneeded inclusion of sys/interrupt.h from several files Modified: stable/11/sys/cam/ata/ata_xpt.c stable/11/sys/cam/cam_xpt.c stable/11/sys/cam/nvme/nvme_xpt.c stable/11/sys/cam/scsi/scsi_xpt.c stable/11/sys/dev/acpica/Osd/OsdSchedule.c stable/11/sys/dev/pccbb/pccbb.c stable/11/sys/kern/subr_bus.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/11/sys/cam/ata/ata_xpt.c Thu Aug 2 09:03:08 2018 (r337120) +++ stable/11/sys/cam/ata/ata_xpt.c Thu Aug 2 09:29:39 2018 (r337121) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/11/sys/cam/cam_xpt.c ============================================================================== --- stable/11/sys/cam/cam_xpt.c Thu Aug 2 09:03:08 2018 (r337120) +++ stable/11/sys/cam/cam_xpt.c Thu Aug 2 09:29:39 2018 (r337121) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: stable/11/sys/cam/nvme/nvme_xpt.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_xpt.c Thu Aug 2 09:03:08 2018 (r337120) +++ stable/11/sys/cam/nvme/nvme_xpt.c Thu Aug 2 09:29:39 2018 (r337121) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/11/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_xpt.c Thu Aug 2 09:03:08 2018 (r337120) +++ stable/11/sys/cam/scsi/scsi_xpt.c Thu Aug 2 09:29:39 2018 (r337121) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/11/sys/dev/acpica/Osd/OsdSchedule.c ============================================================================== --- stable/11/sys/dev/acpica/Osd/OsdSchedule.c Thu Aug 2 09:03:08 2018 (r337120) +++ stable/11/sys/dev/acpica/Osd/OsdSchedule.c Thu Aug 2 09:29:39 2018 (r337121) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: stable/11/sys/dev/pccbb/pccbb.c ============================================================================== --- stable/11/sys/dev/pccbb/pccbb.c Thu Aug 2 09:03:08 2018 (r337120) +++ stable/11/sys/dev/pccbb/pccbb.c Thu Aug 2 09:29:39 2018 (r337121) @@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: stable/11/sys/kern/subr_bus.c ============================================================================== --- stable/11/sys/kern/subr_bus.c Thu Aug 2 09:03:08 2018 (r337120) +++ stable/11/sys/kern/subr_bus.c Thu Aug 2 09:29:39 2018 (r337121) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From owner-svn-src-stable@freebsd.org Thu Aug 2 09:31:51 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D4F71060DA6; Thu, 2 Aug 2018 09:31:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C7298802FC; Thu, 2 Aug 2018 09:31:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A97477E18; Thu, 2 Aug 2018 09:31:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w729VofX079028; Thu, 2 Aug 2018 09:31:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w729VoGH079027; Thu, 2 Aug 2018 09:31:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201808020931.w729VoGH079027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 2 Aug 2018 09:31: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: r337122 - stable/11/sys/security/audit X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/security/audit X-SVN-Commit-Revision: 337122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 09:31:51 -0000 Author: avg Date: Thu Aug 2 09:31:50 2018 New Revision: 337122 URL: https://svnweb.freebsd.org/changeset/base/337122 Log: MFC r336641: fix incorrect operator in the AUDITPIPE_SET_QLIMIT bounds check Modified: stable/11/sys/security/audit/audit_pipe.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/security/audit/audit_pipe.c ============================================================================== --- stable/11/sys/security/audit/audit_pipe.c Thu Aug 2 09:29:39 2018 (r337121) +++ stable/11/sys/security/audit/audit_pipe.c Thu Aug 2 09:31:50 2018 (r337122) @@ -756,7 +756,7 @@ audit_pipe_ioctl(struct cdev *dev, u_long cmd, caddr_t case AUDITPIPE_SET_QLIMIT: /* Lockless integer write. */ - if (*(u_int *)data >= AUDIT_PIPE_QLIMIT_MIN || + if (*(u_int *)data >= AUDIT_PIPE_QLIMIT_MIN && *(u_int *)data <= AUDIT_PIPE_QLIMIT_MAX) { ap->ap_qlimit = *(u_int *)data; error = 0; From owner-svn-src-stable@freebsd.org Thu Aug 2 15:17:00 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EB281069FC8; Thu, 2 Aug 2018 15:17:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E92658CB24; Thu, 2 Aug 2018 15:16:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9AD813629; Thu, 2 Aug 2018 15:16:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w72FGx4S057542; Thu, 2 Aug 2018 15:16:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w72FGxZX057541; Thu, 2 Aug 2018 15:16:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201808021516.w72FGxZX057541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 2 Aug 2018 15:16:59 +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: r337132 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 337132 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 02 Aug 2018 15:17:00 -0000 Author: markj Date: Thu Aug 2 15:16:59 2018 New Revision: 337132 URL: https://svnweb.freebsd.org/changeset/base/337132 Log: MFC r336922: Remove a redundant check. Modified: stable/11/sys/kern/uipc_sockbuf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/uipc_sockbuf.c ============================================================================== --- stable/11/sys/kern/uipc_sockbuf.c Thu Aug 2 12:43:40 2018 (r337131) +++ stable/11/sys/kern/uipc_sockbuf.c Thu Aug 2 15:16:59 2018 (r337132) @@ -897,8 +897,6 @@ sbappendcontrol_locked(struct sockbuf *sb, struct mbuf SOCKBUF_LOCK_ASSERT(sb); - if (control == NULL) - panic("sbappendcontrol_locked"); space = m_length(control, &n) + m_length(m0, NULL); if (space > sbspace(sb)) From owner-svn-src-stable@freebsd.org Fri Aug 3 11:36:38 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E4131066FA9; Fri, 3 Aug 2018 11:36:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3059B7D6BB; Fri, 3 Aug 2018 11:36:38 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 102671FDF6; Fri, 3 Aug 2018 11:36:38 +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 w73Bab4H087442; Fri, 3 Aug 2018 11:36:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73Babg0087440; Fri, 3 Aug 2018 11:36:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201808031136.w73Babg0087440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 3 Aug 2018 11:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r337235 - in stable/11/sys: amd64/amd64 x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 x86/x86 X-SVN-Commit-Revision: 337235 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 11:36:38 -0000 Author: kib Date: Fri Aug 3 11:36:37 2018 New Revision: 337235 URL: https://svnweb.freebsd.org/changeset/base/337235 Log: MFC r336763: Add workarounds for several Ryzen erratas, on amd64. Modified: stable/11/sys/amd64/amd64/initcpu.c stable/11/sys/x86/x86/cpu_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/11/sys/amd64/amd64/initcpu.c Fri Aug 3 10:59:05 2018 (r337234) +++ stable/11/sys/amd64/amd64/initcpu.c Fri Aug 3 11:36:37 2018 (r337235) @@ -128,6 +128,30 @@ init_amd(void) } } + /* Ryzen erratas. */ + if (CPUID_TO_FAMILY(cpu_id) == 0x17 && CPUID_TO_MODEL(cpu_id) == 0x1 && + (cpu_feature2 & CPUID2_HV) == 0) { + /* 1021 */ + msr = rdmsr(0xc0011029); + msr |= 0x2000; + wrmsr(0xc0011029, msr); + + /* 1033 */ + msr = rdmsr(0xc0011020); + msr |= 0x10; + wrmsr(0xc0011020, msr); + + /* 1049 */ + msr = rdmsr(0xc0011028); + msr |= 0x10; + wrmsr(0xc0011028, msr); + + /* 1095 */ + msr = rdmsr(0xc0011020); + msr |= 0x200000000000000; + wrmsr(0xc0011020, msr); + } + /* * Work around a problem on Ryzen that is triggered by executing * code near the top of user memory, in our case the signal Modified: stable/11/sys/x86/x86/cpu_machdep.c ============================================================================== --- stable/11/sys/x86/x86/cpu_machdep.c Fri Aug 3 10:59:05 2018 (r337234) +++ stable/11/sys/x86/x86/cpu_machdep.c Fri Aug 3 11:36:37 2018 (r337235) @@ -739,6 +739,13 @@ cpu_idle_tun(void *unused __unused) if (TUNABLE_STR_FETCH("machdep.idle", tunvar, sizeof(tunvar))) cpu_idle_selector(tunvar); + else if (cpu_vendor_id == CPU_VENDOR_AMD && + CPUID_TO_FAMILY(cpu_id) == 0x17 && CPUID_TO_MODEL(cpu_id) == 0x1) { + /* Ryzen erratas 1057, 1109. */ + cpu_idle_selector("hlt"); + idle_mwait = 0; + } + if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_id == 0x506c9) { /* * Apollo Lake errata APL31 (public errata APL30). From owner-svn-src-stable@freebsd.org Fri Aug 3 14:01:33 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60FAE106AB29; Fri, 3 Aug 2018 14:01:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1424882740; Fri, 3 Aug 2018 14:01:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF698215AE; Fri, 3 Aug 2018 14:01:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73E1WhV061065; Fri, 3 Aug 2018 14:01:32 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73E1WJY061063; Fri, 3 Aug 2018 14:01:32 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031401.w73E1WJY061063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:01: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: r337239 - in stable/11: sys/kern tests/sys/aio X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11: sys/kern tests/sys/aio X-SVN-Commit-Revision: 337239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:01:33 -0000 Author: asomers Date: Fri Aug 3 14:01:32 2018 New Revision: 337239 URL: https://svnweb.freebsd.org/changeset/base/337239 Log: MFC r332631: lio_listio: return EAGAIN instead of EIO when out of resources This behavior is already documented by the man page, and suggested by POSIX. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D15099 Modified: stable/11/sys/kern/vfs_aio.c stable/11/tests/sys/aio/Makefile stable/11/tests/sys/aio/lio_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_aio.c ============================================================================== --- stable/11/sys/kern/vfs_aio.c Fri Aug 3 12:47:54 2018 (r337238) +++ stable/11/sys/kern/vfs_aio.c Fri Aug 3 14:01:32 2018 (r337239) @@ -2135,7 +2135,7 @@ kern_lio_listio(struct thread *td, int mode, struct ai struct aioliojob *lj; struct kevent kev; int error; - int nerror; + int nagain, nerror; int i; if ((mode != LIO_NOWAIT) && (mode != LIO_WAIT)) @@ -2204,12 +2204,15 @@ kern_lio_listio(struct thread *td, int mode, struct ai /* * Get pointers to the list of I/O requests. */ + nagain = 0; nerror = 0; for (i = 0; i < nent; i++) { job = acb_list[i]; if (job != NULL) { error = aio_aqueue(td, job, lj, LIO_NOP, ops); - if (error != 0) + if (error == EAGAIN) + nagain++; + else if (error != 0) nerror++; } } @@ -2256,7 +2259,10 @@ kern_lio_listio(struct thread *td, int mode, struct ai if (nerror) return (EIO); - return (error); + else if (nagain) + return (EAGAIN); + else + return (error); } /* syscall - list directed I/O (REALTIME) */ Modified: stable/11/tests/sys/aio/Makefile ============================================================================== --- stable/11/tests/sys/aio/Makefile Fri Aug 3 12:47:54 2018 (r337238) +++ stable/11/tests/sys/aio/Makefile Fri Aug 3 14:01:32 2018 (r337239) @@ -6,6 +6,8 @@ ATF_TESTS_C+= aio_test ATF_TESTS_C+= lio_test TEST_METADATA.aio_test+= timeout="30" TEST_METADATA.lio_test+= timeout="10" +# Some lio_test testcases involve system resource limitations, so cannot run concurrently +TEST_METADATA.lio_test+= is_exclusive=true PLAIN_TESTS_C+= aio_kqueue_test PLAIN_TESTS_C+= lio_kqueue_test Modified: stable/11/tests/sys/aio/lio_test.c ============================================================================== --- stable/11/tests/sys/aio/lio_test.c Fri Aug 3 12:47:54 2018 (r337238) +++ stable/11/tests/sys/aio/lio_test.c Fri Aug 3 14:01:32 2018 (r337239) @@ -30,10 +30,13 @@ #include #include +#include #include +#include #include +#include "local.h" #include "freebsd_test_suite/macros.h" static sem_t completions; @@ -51,6 +54,73 @@ thr_handler(union sigval sv __unused) ATF_REQUIRE_EQ(0, sem_post(&completions)); } +/* + * If lio_listio is unable to enqueue any requests at all, it should return + * EAGAIN. + */ +ATF_TC_WITHOUT_HEAD(lio_listio_eagain_kevent); +ATF_TC_BODY(lio_listio_eagain_kevent, tc) +{ + int fd, i, j, kq, max_queue_per_proc, ios_per_call; + size_t max_queue_per_proc_size; + struct aiocb *aiocbs[2]; + struct aiocb **list[2]; + struct sigevent sev[2]; + char *buffer; + const char *path="tempfile"; + void *udata[2]; + + ATF_REQUIRE_KERNEL_MODULE("aio"); + ATF_REQUIRE_UNSAFE_AIO(); + + max_queue_per_proc_size = sizeof(max_queue_per_proc); + ATF_REQUIRE_EQ(sysctlbyname("vfs.aio.max_aio_queue_per_proc", + &max_queue_per_proc, &max_queue_per_proc_size, NULL, 0), 0); + ios_per_call = max_queue_per_proc; + + fd = open(path, O_RDWR|O_CREAT, 0666); + ATF_REQUIRE(fd >= 0); + + kq = kqueue(); + ATF_REQUIRE(kq > 0); + + buffer = calloc(1, 4096); + ATF_REQUIRE(buffer != NULL); + + /* + * Call lio_listio twice, each with the maximum number of operations. + * The first call should succeed and the second should fail. + */ + for (i = 0; i < 2; i++) { + aiocbs[i] = calloc(ios_per_call, sizeof(struct aiocb)); + ATF_REQUIRE(aiocbs[i] != NULL); + list[i] = calloc(ios_per_call, sizeof(struct aiocb*)); + ATF_REQUIRE(list[i] != NULL); + udata[i] = (void*)((caddr_t)0xdead0000 + i); + sev[i].sigev_notify = SIGEV_KEVENT; + sev[i].sigev_notify_kqueue = kq; + sev[i].sigev_value.sival_ptr = udata[i]; + for (j = 0; j < ios_per_call; j++) { + aiocbs[i][j].aio_fildes = fd; + aiocbs[i][j].aio_offset = (i * ios_per_call + j) * 4096; + aiocbs[i][j].aio_buf = buffer; + aiocbs[i][j].aio_nbytes = 4096; + aiocbs[i][j].aio_lio_opcode = LIO_WRITE; + list[i][j] = &aiocbs[i][j]; + } + } + + ATF_REQUIRE_EQ(0, lio_listio(LIO_NOWAIT, list[0], ios_per_call, &sev[0])); + ATF_REQUIRE_EQ(-1, lio_listio(LIO_NOWAIT, list[1], ios_per_call, &sev[1])); + /* + * The second lio_listio call should fail with EAGAIN. Bad timing may + * mean that some requests did get enqueued, but the result should + * still be EAGAIN. + */ + ATF_REQUIRE_EQ(errno, EAGAIN); +} + + /* With LIO_WAIT, an empty lio_listio should return immediately */ ATF_TC_WITHOUT_HEAD(lio_listio_empty_wait); ATF_TC_BODY(lio_listio_empty_wait, tc) @@ -136,6 +206,7 @@ ATF_TC_BODY(lio_listio_empty_nowait_thread, tc) ATF_TP_ADD_TCS(tp) { + ATF_TP_ADD_TC(tp, lio_listio_eagain_kevent); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_kevent); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_signal); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_thread); From owner-svn-src-stable@freebsd.org Fri Aug 3 14:03:51 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB68B106ABD1; Fri, 3 Aug 2018 14:03:51 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70CBA82B2F; Fri, 3 Aug 2018 14:03:51 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37618215F2; Fri, 3 Aug 2018 14:03:51 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73E3p8X064464; Fri, 3 Aug 2018 14:03:51 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73E3pW5064463; Fri, 3 Aug 2018 14:03:51 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031403.w73E3pW5064463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:03:51 +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: r337241 - stable/11/contrib/openbsm/bin/auditd X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/contrib/openbsm/bin/auditd X-SVN-Commit-Revision: 337241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:03:52 -0000 Author: asomers Date: Fri Aug 3 14:03:50 2018 New Revision: 337241 URL: https://svnweb.freebsd.org/changeset/base/337241 Log: MFC r335899: auditd(8): register signal handlers interrutibly auditd_wait_for_events() relies on read(2) being interrupted by signals, but it registers signal handlers with signal(3), which sets SA_RESTART. That breaks asynchronous signal handling. It means that signals don't actually get handled until after an audit(8) trigger is received. Symptoms include: * Sending SIGTERM to auditd doesn't kill it right away; you must send SIGTERM and then send a trigger with auditon(2). * Same with SIGHUP * Zombie child processes don't get reaped until auditd receives a trigger sent by auditon. This includes children created by expiring audit trails at auditd startup. Fix by using sigaction(2) instead of signal(3). Cherry pick https://github.com/openbsm/openbsm/commit/d060887 PR: 229381 Reviewed by: cem Obtained from: OpenBSM Differential Revision: https://github.com/openbsm/openbsm/pull/36 Modified: stable/11/contrib/openbsm/bin/auditd/auditd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/openbsm/bin/auditd/auditd.c ============================================================================== --- stable/11/contrib/openbsm/bin/auditd/auditd.c Fri Aug 3 14:02:51 2018 (r337240) +++ stable/11/contrib/openbsm/bin/auditd/auditd.c Fri Aug 3 14:03:50 2018 (r337241) @@ -415,27 +415,35 @@ close_all(void) static int register_daemon(void) { + struct sigaction action; FILE * pidfile; int fd; pid_t pid; /* Set up the signal hander. */ - if (signal(SIGTERM, auditd_relay_signal) == SIG_ERR) { + action.sa_handler = auditd_relay_signal; + /* + * sa_flags must not include SA_RESTART, so that read(2) will be + * interruptible in auditd_wait_for_events + */ + action.sa_flags = 0; + sigemptyset(&action.sa_mask); + if (sigaction(SIGTERM, &action, NULL) != 0) { auditd_log_err( "Could not set signal handler for SIGTERM"); fail_exit(); } - if (signal(SIGCHLD, auditd_relay_signal) == SIG_ERR) { + if (sigaction(SIGCHLD, &action, NULL) != 0) { auditd_log_err( "Could not set signal handler for SIGCHLD"); fail_exit(); } - if (signal(SIGHUP, auditd_relay_signal) == SIG_ERR) { + if (sigaction(SIGHUP, &action, NULL) != 0) { auditd_log_err( "Could not set signal handler for SIGHUP"); fail_exit(); } - if (signal(SIGALRM, auditd_relay_signal) == SIG_ERR) { + if (sigaction(SIGALRM, &action, NULL) != 0) { auditd_log_err( "Could not set signal handler for SIGALRM"); fail_exit(); From owner-svn-src-stable@freebsd.org Fri Aug 3 14:05:23 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA6F4106AC57; Fri, 3 Aug 2018 14:05:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E2AD82C94; Fri, 3 Aug 2018 14:05:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EA5C215F4; Fri, 3 Aug 2018 14:05:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73E5NfW064612; Fri, 3 Aug 2018 14:05:23 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73E5MrJ064610; Fri, 3 Aug 2018 14:05:22 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031405.w73E5MrJ064610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:05:22 +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: r337242 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 337242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:05:23 -0000 Author: asomers Date: Fri Aug 3 14:05:22 2018 New Revision: 337242 URL: https://svnweb.freebsd.org/changeset/base/337242 Log: MFC r336205: Don't acquire evclass_lock with a spinlock held When the "pc" audit class is enabled and auditd is running, witness will panic during thread exit because au_event_class tries to lock an rwlock while holding a spinlock acquired upstack by thread_exit. To fix this, move AUDIT_SYSCALL_EXIT futher upstack, before the spinlock is acquired. Of thread_exit's 16 callers, it's only necessary to call AUDIT_SYSCALL_EXIT from two, exit1 (for exiting processes) and kern_thr_exit (for exiting threads). The other callers are all kernel threads, which needen't call AUDIT_SYSCALL_EXIT because since they can't make syscalls there will be nothing to audit. And exit1 already does call AUDIT_SYSCALL_EXIT, making the second call in thread_exit redundant for that case. PR: 228444 Reported by: aniketp Reviewed by: aniketp, kib Differential Revision: https://reviews.freebsd.org/D16210 Modified: stable/11/sys/kern/kern_thr.c stable/11/sys/kern/kern_thread.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_thr.c ============================================================================== --- stable/11/sys/kern/kern_thr.c Fri Aug 3 14:03:50 2018 (r337241) +++ stable/11/sys/kern/kern_thr.c Fri Aug 3 14:05:22 2018 (r337242) @@ -375,6 +375,11 @@ kern_thr_exit(struct thread *td) KASSERT(p->p_numthreads > 1, ("too few threads")); racct_sub(p, RACCT_NTHR, 1); tdsigcleanup(td); + +#ifdef AUDIT + AUDIT_SYSCALL_EXIT(0, td); +#endif + PROC_SLOCK(p); thread_stopped(p); thread_exit(); Modified: stable/11/sys/kern/kern_thread.c ============================================================================== --- stable/11/sys/kern/kern_thread.c Fri Aug 3 14:03:50 2018 (r337241) +++ stable/11/sys/kern/kern_thread.c Fri Aug 3 14:05:22 2018 (r337242) @@ -533,9 +533,6 @@ thread_exit(void) SDT_PROBE0(proc, , , lwp__exit); KASSERT(TAILQ_EMPTY(&td->td_sigqueue.sq_list), ("signal pending")); -#ifdef AUDIT - AUDIT_SYSCALL_EXIT(0, td); -#endif /* * drop FPU & debug register state storage, or any other * architecture specific resources that From owner-svn-src-stable@freebsd.org Fri Aug 3 14:06:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA5DE106ACB7; Fri, 3 Aug 2018 14:06:09 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5CA3D82DD4; Fri, 3 Aug 2018 14:06:09 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D7E7215F7; Fri, 3 Aug 2018 14:06:09 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73E69Va064716; Fri, 3 Aug 2018 14:06:09 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73E69b9064715; Fri, 3 Aug 2018 14:06:09 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031406.w73E69b9064715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:06: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: r337243 - stable/11/sys/security/audit X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/sys/security/audit X-SVN-Commit-Revision: 337243 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:06:09 -0000 Author: asomers Date: Fri Aug 3 14:06:08 2018 New Revision: 337243 URL: https://svnweb.freebsd.org/changeset/base/337243 Log: MFC r336319: auditon(2): fix A_SETPOLICY with 64-bit values A_SETPOLICY is supposed to work with either 64 or 32-bit values, but due to a typo the 64-bit version has never worked correctly. Submitted by: aniketp Reviewed by: asomers, cem Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D16222 Modified: stable/11/sys/security/audit/audit_syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/security/audit/audit_syscalls.c ============================================================================== --- stable/11/sys/security/audit/audit_syscalls.c Fri Aug 3 14:05:22 2018 (r337242) +++ stable/11/sys/security/audit/audit_syscalls.c Fri Aug 3 14:06:08 2018 (r337243) @@ -241,7 +241,7 @@ sys_auditon(struct thread *td, struct auditon_args *ua case A_OLDSETPOLICY: case A_SETPOLICY: if (uap->length == sizeof(udata.au_policy64)) { - if (udata.au_policy & (~AUDIT_CNT|AUDIT_AHLT| + if (udata.au_policy & ~(AUDIT_CNT|AUDIT_AHLT| AUDIT_ARGV|AUDIT_ARGE)) return (EINVAL); audit_fail_stop = ((udata.au_policy64 & AUDIT_CNT) == From owner-svn-src-stable@freebsd.org Fri Aug 3 14:08:40 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8394B106AD64; Fri, 3 Aug 2018 14:08:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3520E82F63; Fri, 3 Aug 2018 14:08:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9064215F8; Fri, 3 Aug 2018 14:08:39 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73E8dKu064868; Fri, 3 Aug 2018 14:08:39 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73E8dEW064866; Fri, 3 Aug 2018 14:08:39 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031408.w73E8dEW064866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:08:39 +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: r337244 - in stable/10: contrib/netbsd-tests/lib/libc/sys lib/libc/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10: contrib/netbsd-tests/lib/libc/sys lib/libc/sys X-SVN-Commit-Revision: 337244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:08:40 -0000 Author: asomers Date: Fri Aug 3 14:08:39 2018 New Revision: 337244 URL: https://svnweb.freebsd.org/changeset/base/337244 Log: MFC r328266: mlock(2): correct documentation for error conditions. The man page is years out of date regarding errors. Our implementation _does_ allow unaligned addresses, and it _does_not_ check for negative lengths, because the length is unsigned. It checks for overflow instead. Update the tests accordingly. Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D13826 Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_mlock.c stable/10/lib/libc/sys/mlock.2 Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_mlock.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Fri Aug 3 14:06:08 2018 (r337243) +++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Fri Aug 3 14:08:39 2018 (r337244) @@ -131,33 +131,38 @@ ATF_TC_BODY(mlock_err, tc) ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)0, page) == -1); errno = 0; - ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)-1, page) == -1); - - errno = 0; ATF_REQUIRE_ERRNO(ENOMEM, munlock(NULL, page) == -1); errno = 0; ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)0, page) == -1); +#ifdef __FreeBSD__ + /* Wrap around should return EINVAL */ errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, mlock((char *)-1, page) == -1); + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1); +#else + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)-1, page) == -1); + errno = 0; ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)-1, page) == -1); +#endif - buf = malloc(page); + buf = malloc(page); /* Get a valid address */ ATF_REQUIRE(buf != NULL); - - /* - * unlocking memory that is not locked is an error... - */ - +#ifdef __FreeBSD__ errno = 0; - ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); - - /* - * These are permitted to fail (EINVAL) but do not on NetBSD - */ - ATF_REQUIRE(mlock((void *)(((uintptr_t)buf) + page/3), page/5) == 0); - ATF_REQUIRE(munlock((void *)(((uintptr_t)buf) + page/3), page/5) == 0); - + /* Wrap around should return EINVAL */ + ATF_REQUIRE_ERRNO(EINVAL, mlock(buf, -page) == -1); + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, munlock(buf, -page) == -1); +#else + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, mlock(buf, -page) == -1); + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, -page) == -1); +#endif (void)free(buf); /* @@ -355,6 +360,80 @@ ATF_TC_CLEANUP(mlock_nested, tc) } #endif +#ifdef __FreeBSD__ +ATF_TC_WITH_CLEANUP(mlock_unaligned); +#else +ATF_TC(mlock_unaligned); +#endif +ATF_TC_HEAD(mlock_unaligned, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that mlock(2) can lock page-unaligned memory"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); + atf_tc_set_md_var(tc, "require.user", "root"); +#endif +} + +ATF_TC_BODY(mlock_unaligned, tc) +{ + void *buf, *addr; + +#ifdef __FreeBSD__ + /* Set max_wired really really high to avoid EAGAIN */ + set_vm_max_wired(INT_MAX); +#endif + + buf = malloc(page); + ATF_REQUIRE(buf != NULL); + + if ((uintptr_t)buf & ((uintptr_t)page - 1)) + addr = buf; + else + addr = (void *)(((uintptr_t)buf) + page/3); + + ATF_REQUIRE_EQ(mlock(addr, page/5), 0); + ATF_REQUIRE_EQ(munlock(addr, page/5), 0); + + (void)free(buf); +} + +#ifdef __FreeBSD__ +ATF_TC_CLEANUP(mlock_unaligned, tc) +{ + + restore_vm_max_wired(); +} +#endif + +ATF_TC(munlock_unlocked); +ATF_TC_HEAD(munlock_unlocked, tc) +{ + atf_tc_set_md_var(tc, "descr", +#ifdef __FreeBSD__ + "munlock(2) accepts unlocked memory"); +#else + "munlock(2) of unlocked memory is an error"); +#endif + atf_tc_set_md_var(tc, "require.user", "root"); +} + +ATF_TC_BODY(munlock_unlocked, tc) +{ + void *buf; + + buf = malloc(page); + ATF_REQUIRE(buf != NULL); + +#ifdef __FreeBSD__ + ATF_REQUIRE_EQ(munlock(buf, page), 0); +#else + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); +#endif + (void)free(buf); +} + ATF_TP_ADD_TCS(tp) { @@ -366,6 +445,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, mlock_limits); ATF_TP_ADD_TC(tp, mlock_mmap); ATF_TP_ADD_TC(tp, mlock_nested); + ATF_TP_ADD_TC(tp, mlock_unaligned); + ATF_TP_ADD_TC(tp, munlock_unlocked); return atf_no_error(); } Modified: stable/10/lib/libc/sys/mlock.2 ============================================================================== --- stable/10/lib/libc/sys/mlock.2 Fri Aug 3 14:06:08 2018 (r337243) +++ stable/10/lib/libc/sys/mlock.2 Fri Aug 3 14:08:39 2018 (r337244) @@ -28,7 +28,7 @@ .\" @(#)mlock.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd May 17, 2014 +.Dd Jan 22, 2018 .Dt MLOCK 2 .Os .Sh NAME @@ -125,7 +125,7 @@ will fail if: .Va security.bsd.unprivileged_mlock is set to 0 and the caller is not the super-user. .It Bq Er EINVAL -The address given is not page aligned or the length is negative. +The address range given wraps around zero. .It Bq Er EAGAIN Locking the indicated range would exceed the system limit for locked memory. .It Bq Er ENOMEM @@ -143,7 +143,7 @@ will fail if: .Va security.bsd.unprivileged_mlock is set to 0 and the caller is not the super-user. .It Bq Er EINVAL -The address given is not page aligned or the length is negative. +The address range given wraps around zero. .It Bq Er ENOMEM Some or all of the address range specified by the addr and len arguments does not correspond to valid mapped pages in the address space From owner-svn-src-stable@freebsd.org Fri Aug 3 14:12:39 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43A1A106AF70; Fri, 3 Aug 2018 14:12:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB76C83368; Fri, 3 Aug 2018 14:12:38 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC6C12179B; Fri, 3 Aug 2018 14:12:38 +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 w73ECc6O069911; Fri, 3 Aug 2018 14:12:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73ECcst069907; Fri, 3 Aug 2018 14:12:38 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201808031412.w73ECcst069907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 3 Aug 2018 14:12:38 +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: r337245 - in stable/10/sys: amd64/amd64 i386/i386 i386/isa X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/10/sys: amd64/amd64 i386/i386 i386/isa X-SVN-Commit-Revision: 337245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:12:39 -0000 Author: kib Date: Fri Aug 3 14:12:37 2018 New Revision: 337245 URL: https://svnweb.freebsd.org/changeset/base/337245 Log: MFC r336683: Extend ranges of the critical sections to ensure that context switch code never sees FPU pcb flags not consistent with the hardware state. Modified: stable/10/sys/amd64/amd64/fpu.c stable/10/sys/amd64/amd64/machdep.c stable/10/sys/i386/i386/machdep.c stable/10/sys/i386/isa/npx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/fpu.c ============================================================================== --- stable/10/sys/amd64/amd64/fpu.c Fri Aug 3 14:08:39 2018 (r337244) +++ stable/10/sys/amd64/amd64/fpu.c Fri Aug 3 14:12:37 2018 (r337245) @@ -741,22 +741,22 @@ fpugetregs(struct thread *td) int max_ext_n, i, owned; pcb = td->td_pcb; + critical_enter(); if ((pcb->pcb_flags & PCB_USERFPUINITDONE) == 0) { bcopy(fpu_initialstate, get_pcb_user_save_pcb(pcb), cpu_max_ext_state_size); get_pcb_user_save_pcb(pcb)->sv_env.en_cw = pcb->pcb_initial_fpucw; fpuuserinited(td); + critical_exit(); return (_MC_FPOWNED_PCB); } - critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { fpusave(get_pcb_user_save_pcb(pcb)); owned = _MC_FPOWNED_FPU; } else { owned = _MC_FPOWNED_PCB; } - critical_exit(); if (use_xsave) { /* * Handle partially saved state. @@ -776,6 +776,7 @@ fpugetregs(struct thread *td) *xstate_bv |= bit; } } + critical_exit(); return (owned); } @@ -784,6 +785,7 @@ fpuuserinited(struct thread *td) { struct pcb *pcb; + CRITICAL_ASSERT(td); pcb = td->td_pcb; if (PCB_USER_FPU(pcb)) set_pcb_flags(pcb, @@ -842,26 +844,25 @@ fpusetregs(struct thread *td, struct savefpu *addr, ch addr->sv_env.en_mxcsr &= cpu_mxcsr_mask; pcb = td->td_pcb; + error = 0; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { error = fpusetxstate(td, xfpustate, xfpustate_size); - if (error != 0) { - critical_exit(); - return (error); + if (error == 0) { + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); + fpurestore(get_pcb_user_save_td(td)); + set_pcb_flags(pcb, PCB_FPUINITDONE | + PCB_USERFPUINITDONE); } - bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); - fpurestore(get_pcb_user_save_td(td)); - critical_exit(); - set_pcb_flags(pcb, PCB_FPUINITDONE | PCB_USERFPUINITDONE); } else { - critical_exit(); error = fpusetxstate(td, xfpustate, xfpustate_size); - if (error != 0) - return (error); - bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); - fpuuserinited(td); + if (error == 0) { + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); + fpuuserinited(td); + } } - return (0); + critical_exit(); + return (error); } /* @@ -1004,6 +1005,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx return (0); } pcb = td->td_pcb; + critical_enter(); KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == get_pcb_user_save_pcb(pcb), ("mangled pcb_save")); ctx->flags = 0; @@ -1014,6 +1016,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx pcb->pcb_save = fpu_kern_ctx_savefpu(ctx); set_pcb_flags(pcb, PCB_KERNFPU); clear_pcb_flags(pcb, PCB_FPUINITDONE); + critical_exit(); return (0); } @@ -1029,7 +1032,6 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx critical_enter(); if (curthread == PCPU_GET(fpcurthread)) fpudrop(); - critical_exit(); pcb->pcb_save = ctx->prev; if (pcb->pcb_save == get_pcb_user_save_pcb(pcb)) { if ((pcb->pcb_flags & PCB_USERFPUINITDONE) != 0) { @@ -1044,6 +1046,7 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx clear_pcb_flags(pcb, PCB_FPUINITDONE); KASSERT(!PCB_USER_FPU(pcb), ("unpaired fpu_kern_leave")); } + critical_exit(); return (0); } Modified: stable/10/sys/amd64/amd64/machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/machdep.c Fri Aug 3 14:08:39 2018 (r337244) +++ stable/10/sys/amd64/amd64/machdep.c Fri Aug 3 14:12:37 2018 (r337245) @@ -2380,8 +2380,10 @@ int set_fpregs(struct thread *td, struct fpreg *fpregs) { + critical_enter(); set_fpregs_xmm(fpregs, get_pcb_user_save_td(td)); fpuuserinited(td); + critical_exit(); return (0); } Modified: stable/10/sys/i386/i386/machdep.c ============================================================================== --- stable/10/sys/i386/i386/machdep.c Fri Aug 3 14:08:39 2018 (r337244) +++ stable/10/sys/i386/i386/machdep.c Fri Aug 3 14:12:37 2018 (r337245) @@ -3780,6 +3780,7 @@ int set_fpregs(struct thread *td, struct fpreg *fpregs) { + critical_enter(); #ifdef CPU_ENABLE_SSE if (cpu_fxsr) set_fpregs_xmm((struct save87 *)fpregs, @@ -3791,6 +3792,7 @@ set_fpregs(struct thread *td, struct fpreg *fpregs) #ifdef DEV_NPX npxuserinited(td); #endif + critical_exit(); return (0); } Modified: stable/10/sys/i386/isa/npx.c ============================================================================== --- stable/10/sys/i386/isa/npx.c Fri Aug 3 14:08:39 2018 (r337244) +++ stable/10/sys/i386/isa/npx.c Fri Aug 3 14:12:37 2018 (r337245) @@ -1037,14 +1037,15 @@ npxgetregs(struct thread *td) return (_MC_FPOWNED_NONE); pcb = td->td_pcb; + critical_enter(); if ((pcb->pcb_flags & PCB_NPXINITDONE) == 0) { bcopy(npx_initialstate, get_pcb_user_save_pcb(pcb), cpu_max_ext_state_size); SET_FPU_CW(get_pcb_user_save_pcb(pcb), pcb->pcb_initial_npxcw); npxuserinited(td); + critical_exit(); return (_MC_FPOWNED_PCB); } - critical_enter(); if (td == PCPU_GET(fpcurthread)) { fpusave(get_pcb_user_save_pcb(pcb)); #ifdef CPU_ENABLE_SSE @@ -1060,7 +1061,6 @@ npxgetregs(struct thread *td) } else { owned = _MC_FPOWNED_PCB; } - critical_exit(); #ifdef CPU_ENABLE_SSE if (use_xsave) { /* @@ -1085,6 +1085,7 @@ npxgetregs(struct thread *td) } } #endif + critical_exit(); return (owned); } @@ -1093,6 +1094,7 @@ npxuserinited(struct thread *td) { struct pcb *pcb; + CRITICAL_ASSERT(td); pcb = td->td_pcb; if (PCB_USER_FPU(pcb)) pcb->pcb_flags |= PCB_NPXINITDONE; @@ -1156,32 +1158,32 @@ npxsetregs(struct thread *td, union savefpu *addr, cha addr->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; #endif pcb = td->td_pcb; + error = 0; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { #ifdef CPU_ENABLE_SSE error = npxsetxstate(td, xfpustate, xfpustate_size); - if (error != 0) { - critical_exit(); - return (error); - } - if (!cpu_fxsr) #endif - fnclex(); /* As in npxdrop(). */ - bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); - fpurstor(get_pcb_user_save_td(td)); - critical_exit(); - pcb->pcb_flags |= PCB_NPXUSERINITDONE | PCB_NPXINITDONE; + if (error == 0) { +#ifdef CPU_ENABLE_SSE + if (!cpu_fxsr) +#endif + fnclex(); /* As in npxdrop(). */ + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); + fpurstor(get_pcb_user_save_td(td)); + pcb->pcb_flags |= PCB_NPXUSERINITDONE | PCB_NPXINITDONE; + } } else { - critical_exit(); #ifdef CPU_ENABLE_SSE error = npxsetxstate(td, xfpustate, xfpustate_size); - if (error != 0) - return (error); #endif - bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); - npxuserinited(td); + if (error == 0) { + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); + npxuserinited(td); + } } - return (0); + critical_exit(); + return (error); } static void @@ -1350,6 +1352,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx return (0); } pcb = td->td_pcb; + critical_enter(); KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == get_pcb_user_save_pcb(pcb), ("mangled pcb_save")); ctx->flags = 0; @@ -1360,6 +1363,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx pcb->pcb_save = fpu_kern_ctx_savefpu(ctx); pcb->pcb_flags |= PCB_KERNNPX; pcb->pcb_flags &= ~PCB_NPXINITDONE; + critical_exit(); return (0); } @@ -1374,7 +1378,6 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx critical_enter(); if (curthread == PCPU_GET(fpcurthread)) npxdrop(); - critical_exit(); pcb->pcb_save = ctx->prev; if (pcb->pcb_save == get_pcb_user_save_pcb(pcb)) { if ((pcb->pcb_flags & PCB_NPXUSERINITDONE) != 0) @@ -1389,6 +1392,7 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx pcb->pcb_flags &= ~PCB_NPXINITDONE; KASSERT(!PCB_USER_FPU(pcb), ("unpaired fpu_kern_leave")); } + critical_exit(); return (0); } From owner-svn-src-stable@freebsd.org Fri Aug 3 14:13:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6202106AFC4; Fri, 3 Aug 2018 14:13:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7AF3283499; Fri, 3 Aug 2018 14:13:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5BDA42179C; Fri, 3 Aug 2018 14:13:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73EDGtx069994; Fri, 3 Aug 2018 14:13:16 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EDFkq069991; Fri, 3 Aug 2018 14:13:15 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031413.w73EDFkq069991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:13:15 +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: r337246 - in stable/10: etc/mtree libexec/tftpd libexec/tftpd/tests X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10: etc/mtree libexec/tftpd libexec/tftpd/tests X-SVN-Commit-Revision: 337246 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:13:17 -0000 Author: asomers Date: Fri Aug 3 14:13:15 2018 New Revision: 337246 URL: https://svnweb.freebsd.org/changeset/base/337246 Log: MFC r330696, r330709, r330742, r331358 r330696: Add some functional tests for tftpd(8) tftpd(8) is difficult to test in isolation due to its relationship with inetd. Create a test program that mimics the behavior of tftp(1) and inetd(8) and verifies tftpd's response in several different scenarios. These test cases cover all of the basic TFTP protocol, but not the optional parts. PR: 157700 PR: 225996 PR: 226004 PR: 226005 Differential Revision: https://reviews.freebsd.org/D14310 r330709: Commit missing file from r330696 X-MFC-With: 330696 r330742: tftpd: fix the build of tests on i386 after 330696 It's those darn printf format specifiers again Reported by: cy, kibab X-MFC-With: 330696 r331358: tftpd: misc Coverity cleanup in the tests A bunch of unchecked return values from open(2) and read(2) Reported by: Coverity CID: 1386900, 1386911, 1386926, 1386928, 1386932, 1386942 CID: 1386961, 1386979 X-MFC-With: 330696 Added: stable/10/libexec/tftpd/tests/ - copied from r330696, head/libexec/tftpd/tests/ Modified: stable/10/etc/mtree/BSD.tests.dist stable/10/libexec/tftpd/Makefile stable/10/libexec/tftpd/tests/functional.c Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Fri Aug 3 14:12:37 2018 (r337245) +++ stable/10/etc/mtree/BSD.tests.dist Fri Aug 3 14:13:15 2018 (r337246) @@ -350,6 +350,8 @@ atf-sh .. .. + tftpd + .. .. sbin dhclient Modified: stable/10/libexec/tftpd/Makefile ============================================================================== --- stable/10/libexec/tftpd/Makefile Fri Aug 3 14:12:37 2018 (r337245) +++ stable/10/libexec/tftpd/Makefile Fri Aug 3 14:13:15 2018 (r337246) @@ -15,4 +15,7 @@ DPADD+= ${LIBWRAP} LDADD+= -lwrap .endif +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Modified: stable/10/libexec/tftpd/tests/functional.c ============================================================================== --- head/libexec/tftpd/tests/functional.c Fri Mar 9 15:30:20 2018 (r330696) +++ stable/10/libexec/tftpd/tests/functional.c Fri Aug 3 14:13:15 2018 (r337246) @@ -224,19 +224,17 @@ do { \ static void cleanup(void) { - int fd = -1; - char buffer[80] = {0}; + FILE *f; pid_t pid; - fd = open(pidfile, O_RDONLY); - if (fd < 0) + f = fopen(pidfile, "r"); + if (f == NULL) return; - if (read(fd, buffer, sizeof(buffer)) > 0) { - sscanf(buffer, "%d", &pid); + if (fscanf(f, "%d", &pid) == 1) { kill(pid, SIGTERM); waitpid(pid, NULL, 0); } - close(fd); + fclose(f); unlink(pidfile); } @@ -248,10 +246,10 @@ require_bufeq(const char *expected, ssize_t expected_l ssize_t i; ATF_REQUIRE_EQ_MSG(expected_len, len, - "Expected %ld bytes but got %ld", expected_len, len); + "Expected %zd bytes but got %zd", expected_len, len); for (i = 0; i < len; i++) { ATF_REQUIRE_EQ_MSG(actual[i], expected[i], - "Expected %#hhx at position %ld; got %hhx instead", + "Expected %#hhx at position %zd; got %hhx instead", expected[i], i, actual[i]); } } @@ -696,6 +694,7 @@ TFTPD_TC_DEFINE(w_flag,, w_flag = 1;) atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("small.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(contents, contents_len, buffer, r); @@ -733,6 +732,7 @@ TFTPD_TC_DEFINE(wrq_dropped_ack,) atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("medium.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq((const char*)contents, 768, buffer, r); @@ -766,6 +766,7 @@ TFTPD_TC_DEFINE(wrq_dropped_data,) atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("small.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(contents, contents_len, buffer, r); @@ -800,6 +801,7 @@ TFTPD_TC_DEFINE(wrq_duped_data,) atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("medium.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq((const char*)contents, 768, buffer, r); @@ -867,6 +869,7 @@ TFTPD_TC_DEFINE(wrq_medium,) atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("medium.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq((const char*)contents, 768, buffer, r); @@ -900,6 +903,7 @@ TFTPD_TC_DEFINE(wrq_netascii,) atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("unix.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(expected, sizeof(expected), buffer, r); @@ -940,6 +944,7 @@ TFTPD_TC_DEFINE(wrq_small,) atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("small.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(contents, contents_len, buffer, r); From owner-svn-src-stable@freebsd.org Fri Aug 3 14:17:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E724106B13E; Fri, 3 Aug 2018 14:17:14 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF33883EFB; Fri, 3 Aug 2018 14:17:13 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 433B8217A3; Fri, 3 Aug 2018 14:17:13 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73EHCmS070284; Fri, 3 Aug 2018 14:17:12 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EHCjw070280; Fri, 3 Aug 2018 14:17:12 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031417.w73EHCjw070280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:17:12 +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: r337247 - in stable/10: libexec/tftpd libexec/tftpd/tests usr.bin/tftp X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10: libexec/tftpd libexec/tftpd/tests usr.bin/tftp X-SVN-Commit-Revision: 337247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:17:14 -0000 Author: asomers Date: Fri Aug 3 14:17:11 2018 New Revision: 337247 URL: https://svnweb.freebsd.org/changeset/base/337247 Log: MFC r330710: tftpd: Flush files as soon as they are fully received On an RRQ, tftpd doesn't exit as soon as it's finished receiving a file. Instead, it waits five seconds just in case the client didn't receive the server's last ACK and decides to resend the final DATA packet. Unfortunately, this created a 5 second delay from when the client thinks it's done sending the file, and when the file is available for other processes. Fix this bug by closing the file as soon as receipt is finished. PR: 157700 Reported by: Barry Mishler Modified: stable/10/libexec/tftpd/tests/functional.c stable/10/libexec/tftpd/tftp-transfer.c stable/10/libexec/tftpd/tftpd.c stable/10/usr.bin/tftp/tftp.c Modified: stable/10/libexec/tftpd/tests/functional.c ============================================================================== --- stable/10/libexec/tftpd/tests/functional.c Fri Aug 3 14:13:15 2018 (r337246) +++ stable/10/libexec/tftpd/tests/functional.c Fri Aug 3 14:17:11 2018 (r337247) @@ -692,7 +692,6 @@ TFTPD_TC_DEFINE(w_flag,, w_flag = 1;) send_data(1, contents, contents_len); recv_ack(1); - atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("small.txt", O_RDONLY); ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); @@ -730,7 +729,6 @@ TFTPD_TC_DEFINE(wrq_dropped_ack,) send_data(2, (const char*)&contents[128], 256); recv_ack(2); - atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("medium.txt", O_RDONLY); ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); @@ -764,7 +762,6 @@ TFTPD_TC_DEFINE(wrq_dropped_data,) send_data(1, contents, contents_len); recv_ack(1); - atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("small.txt", O_RDONLY); ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); @@ -799,7 +796,6 @@ TFTPD_TC_DEFINE(wrq_duped_data,) send_data(2, (const char*)&contents[128], 256); recv_ack(2); - atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("medium.txt", O_RDONLY); ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); @@ -867,7 +863,6 @@ TFTPD_TC_DEFINE(wrq_medium,) send_data(2, (const char*)&contents[128], 256); recv_ack(2); - atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("medium.txt", O_RDONLY); ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); @@ -894,14 +889,13 @@ TFTPD_TC_DEFINE(wrq_netascii,) fd = open("unix.txt", O_RDWR | O_CREAT, 0666); ATF_REQUIRE(fd >= 0); close(fd); - contents_len = strlen(contents) + 1; + contents_len = sizeof(contents); SEND_WRQ("unix.txt", "netascii"); recv_ack(0); send_data(1, contents, contents_len); recv_ack(1); - atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("unix.txt", O_RDONLY); ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); @@ -942,7 +936,6 @@ TFTPD_TC_DEFINE(wrq_small,) send_data(1, contents, contents_len); recv_ack(1); - atf_tc_expect_fail("PR 157700 tftpd expects more data after EOF"); fd = open("small.txt", O_RDONLY); ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); Modified: stable/10/libexec/tftpd/tftp-transfer.c ============================================================================== --- stable/10/libexec/tftpd/tftp-transfer.c Fri Aug 3 14:13:15 2018 (r337246) +++ stable/10/libexec/tftpd/tftp-transfer.c Fri Aug 3 14:17:11 2018 (r337247) @@ -302,6 +302,8 @@ send_ack: gettimeofday(&(ts->tstop), NULL); } while (n_data == segsize); + write_close(); + /* Don't do late packet management for the client implementation */ if (acting_as_client) return; Modified: stable/10/libexec/tftpd/tftpd.c ============================================================================== --- stable/10/libexec/tftpd/tftpd.c Fri Aug 3 14:13:15 2018 (r337246) +++ stable/10/libexec/tftpd/tftpd.c Fri Aug 3 14:17:11 2018 (r337247) @@ -821,7 +821,6 @@ tftp_recvfile(int peer, const char *mode) block = 0; tftp_receive(peer, &block, &ts, NULL, 0); - write_close(); gettimeofday(&now2, NULL); if (debug&DEBUG_SIMPLE) { Modified: stable/10/usr.bin/tftp/tftp.c ============================================================================== --- stable/10/usr.bin/tftp/tftp.c Fri Aug 3 14:13:15 2018 (r337246) +++ stable/10/usr.bin/tftp/tftp.c Fri Aug 3 14:17:11 2018 (r337247) @@ -263,7 +263,6 @@ recvfile(int peer, char *port, int fd, char *name, cha tftp_receive(peer, &block, &tftp_stats, rp, n); } - write_close(); if (tftp_stats.amount > 0) printstats("Received", verbose, &tftp_stats); return; From owner-svn-src-stable@freebsd.org Fri Aug 3 14:18:03 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14F9F106B1E8; Fri, 3 Aug 2018 14:18:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BDD3D84232; Fri, 3 Aug 2018 14:18:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A064B217A6; Fri, 3 Aug 2018 14:18:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73EI25M070452; Fri, 3 Aug 2018 14:18:02 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EI26n070450; Fri, 3 Aug 2018 14:18:02 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031418.w73EI26n070450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:18:02 +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: r337248 - in stable/10/libexec/tftpd: . tests X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10/libexec/tftpd: . tests X-SVN-Commit-Revision: 337248 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:18:03 -0000 Author: asomers Date: Fri Aug 3 14:18:02 2018 New Revision: 337248 URL: https://svnweb.freebsd.org/changeset/base/337248 Log: MFC r330718: tftpd: Verify world-writability for WRQ when using relative paths tftpd(8) says that files may only be written if they already exist and are publicly writable. tftpd.c verifies that a file is publicly writable if it uses an absolute pathname. However, if the pathname is relative, that check is skipped. Fix it. Note that this is not a security vulnerability, because the transfer ultimately doesn't work unless the file already exists and is owned by user nobody. Also, this bug does not affect the default configuration, because the default uses the "-s" option which makes all pathnames absolute. PR: 226004 Modified: stable/10/libexec/tftpd/tests/functional.c stable/10/libexec/tftpd/tftpd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/tftpd/tests/functional.c ============================================================================== --- stable/10/libexec/tftpd/tests/functional.c Fri Aug 3 14:17:11 2018 (r337247) +++ stable/10/libexec/tftpd/tests/functional.c Fri Aug 3 14:18:02 2018 (r337248) @@ -348,6 +348,10 @@ setup(struct sockaddr_storage *to, uint16_t idx) ATF_REQUIRE((client_s = socket(protocol, SOCK_DGRAM, 0)) > 0); break; } + + /* Clear the client's umask. Test cases will specify exact modes */ + umask(0000); + return (client_s); } @@ -713,7 +717,7 @@ TFTPD_TC_DEFINE(wrq_dropped_ack,) for (i = 0; i < nitems(contents); i++) contents[i] = i; - fd = open("medium.txt", O_RDWR | O_CREAT, 0644); + fd = open("medium.txt", O_RDWR | O_CREAT, 0666); ATF_REQUIRE(fd >= 0); close(fd); @@ -747,7 +751,7 @@ TFTPD_TC_DEFINE(wrq_dropped_data,) size_t contents_len; char buffer[1024]; - fd = open("small.txt", O_RDWR | O_CREAT, 0644); + fd = open("small.txt", O_RDWR | O_CREAT, 0666); ATF_REQUIRE(fd >= 0); close(fd); contents_len = strlen(contents) + 1; @@ -783,7 +787,7 @@ TFTPD_TC_DEFINE(wrq_duped_data,) for (i = 0; i < nitems(contents); i++) contents[i] = i; - fd = open("medium.txt", O_RDWR | O_CREAT, 0644); + fd = open("medium.txt", O_RDWR | O_CREAT, 0666); ATF_REQUIRE(fd >= 0); close(fd); @@ -833,7 +837,8 @@ TFTPD_TC_DEFINE(wrq_eaccess_world_readable,) close(fd); SEND_WRQ("empty.txt", "octet"); - atf_tc_expect_fail("PR 226004 with relative pathnames, tftpd doesn't validate world writability"); + atf_tc_expect_fail("PR 225996 tftpd doesn't abort on a WRQ access " + "violation"); RECV_ERROR(2, "Access violation"); } Modified: stable/10/libexec/tftpd/tftpd.c ============================================================================== --- stable/10/libexec/tftpd/tftpd.c Fri Aug 3 14:17:11 2018 (r337247) +++ stable/10/libexec/tftpd/tftpd.c Fri Aug 3 14:18:02 2018 (r337248) @@ -741,8 +741,12 @@ validate_access(int peer, char **filep, int mode) dirp->name, filename); if (stat(pathname, &stbuf) == 0 && (stbuf.st_mode & S_IFMT) == S_IFREG) { - if ((stbuf.st_mode & S_IROTH) != 0) { - break; + if (mode == RRQ) { + if ((stbuf.st_mode & S_IROTH) != 0) + break; + } else { + if ((stbuf.st_mode & S_IWOTH) != 0) + break; } err = EACCESS; } @@ -750,6 +754,8 @@ validate_access(int peer, char **filep, int mode) if (dirp->name != NULL) *filep = filename = pathname; else if (mode == RRQ) + return (err); + else if (err != ENOTFOUND || !create_new) return (err); } From owner-svn-src-stable@freebsd.org Fri Aug 3 14:19:10 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CBBC106B2CF; Fri, 3 Aug 2018 14:19:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 220E984566; Fri, 3 Aug 2018 14:19:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0344D217A8; Fri, 3 Aug 2018 14:19:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73EJ9Bj070775; Fri, 3 Aug 2018 14:19:09 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EJ9Z8070773; Fri, 3 Aug 2018 14:19:09 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031419.w73EJ9Z8070773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:19:09 +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: r337249 - in stable/10/libexec/tftpd: . tests X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10/libexec/tftpd: . tests X-SVN-Commit-Revision: 337249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:19:10 -0000 Author: asomers Date: Fri Aug 3 14:19:09 2018 New Revision: 337249 URL: https://svnweb.freebsd.org/changeset/base/337249 Log: MFC r330719: tftpd: Abort on an WRQ access violation On a WRQ (write request) tftpd checks whether the client has access permission for the file in question. If not, then the write is prevented. However, tftpd doesn't reply with an ERROR packet, nor does it abort. Instead, it tries to receive the packet anyway. The symptom is slightly different depending on the nature of the error. If the target file is nonexistent and tftpd lacks permission to create it, then tftpd will willingly receive the file, but not write it anywhere. If the file exists but is not writable, then tftpd will fail to ACK to WRQ. PR: 225996 Modified: stable/10/libexec/tftpd/tests/functional.c stable/10/libexec/tftpd/tftpd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/tftpd/tests/functional.c ============================================================================== --- stable/10/libexec/tftpd/tests/functional.c Fri Aug 3 14:18:02 2018 (r337248) +++ stable/10/libexec/tftpd/tests/functional.c Fri Aug 3 14:19:09 2018 (r337249) @@ -819,8 +819,6 @@ TFTPD_TC_DEFINE(wrq_eaccess,) close(fd); SEND_WRQ("empty.txt", "octet"); - atf_tc_expect_fail("PR 225996 tftpd doesn't abort on a WRQ access " - "violation"); RECV_ERROR(2, "Access violation"); } @@ -837,8 +835,6 @@ TFTPD_TC_DEFINE(wrq_eaccess_world_readable,) close(fd); SEND_WRQ("empty.txt", "octet"); - atf_tc_expect_fail("PR 225996 tftpd doesn't abort on a WRQ access " - "violation"); RECV_ERROR(2, "Access violation"); } @@ -915,8 +911,6 @@ TFTPD_TC_DEFINE(wrq_netascii,) TFTPD_TC_DEFINE(wrq_nonexistent,) { SEND_WRQ("nonexistent.txt", "octet"); - atf_tc_expect_fail("PR 225996 tftpd doesn't abort on a WRQ access " - "violation"); RECV_ERROR(1, "File not found"); } Modified: stable/10/libexec/tftpd/tftpd.c ============================================================================== --- stable/10/libexec/tftpd/tftpd.c Fri Aug 3 14:18:02 2018 (r337248) +++ stable/10/libexec/tftpd/tftpd.c Fri Aug 3 14:19:09 2018 (r337249) @@ -543,6 +543,10 @@ tftp_wrq(int peer, char *recvbuffer, ssize_t size) filename, errtomsg(ecode)); } + if (ecode) { + send_error(peer, ecode); + exit(1); + } tftp_recvfile(peer, mode); exit(0); } From owner-svn-src-stable@freebsd.org Fri Aug 3 14:19:57 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C9D2106B35C; Fri, 3 Aug 2018 14:19:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 12D8D846C8; Fri, 3 Aug 2018 14:19:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7A70217AA; Fri, 3 Aug 2018 14:19:56 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73EJulC071020; Fri, 3 Aug 2018 14:19:56 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EJuAD071018; Fri, 3 Aug 2018 14:19:56 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031419.w73EJuAD071018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:19:56 +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: r337250 - in stable/10/libexec/tftpd: . tests X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10/libexec/tftpd: . tests X-SVN-Commit-Revision: 337250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:19:57 -0000 Author: asomers Date: Fri Aug 3 14:19:56 2018 New Revision: 337250 URL: https://svnweb.freebsd.org/changeset/base/337250 Log: MFC r330720: tftpd: reject unknown opcodes If tftpd receives a command with an unknown opcode, it simply exits 1. It doesn't send an ERROR packet, and the client will hang waiting for one. Fix it. PR: 226005 Modified: stable/10/libexec/tftpd/tests/functional.c stable/10/libexec/tftpd/tftpd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/tftpd/tests/functional.c ============================================================================== --- stable/10/libexec/tftpd/tests/functional.c Fri Aug 3 14:19:09 2018 (r337249) +++ stable/10/libexec/tftpd/tests/functional.c Fri Aug 3 14:19:56 2018 (r337250) @@ -675,7 +675,6 @@ TFTPD_TC_DEFINE(unknown_opcode,) { /* Looks like an RRQ or WRQ request, but with a bad opcode */ SEND_STR("\0\007foo.txt\0octet\0"); - atf_tc_expect_timeout("PR 226005 tftpd ignores bad opcodes but doesn't reject them"); RECV_ERROR(4, "Illegal TFTP operation"); } Modified: stable/10/libexec/tftpd/tftpd.c ============================================================================== --- stable/10/libexec/tftpd/tftpd.c Fri Aug 3 14:19:09 2018 (r337249) +++ stable/10/libexec/tftpd/tftpd.c Fri Aug 3 14:19:56 2018 (r337250) @@ -419,8 +419,7 @@ main(int argc, char *argv[]) "%s read access denied", peername); exit(1); } - } - if (tp->th_opcode == WRQ) { + } else if (tp->th_opcode == WRQ) { if (allow_wo) tftp_wrq(peer, tp->th_stuff, n - 1); else { @@ -428,7 +427,8 @@ main(int argc, char *argv[]) "%s write access denied", peername); exit(1); } - } + } else + send_error(peer, EBADOP); exit(1); } From owner-svn-src-stable@freebsd.org Fri Aug 3 14:22:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73A53106B65F; Fri, 3 Aug 2018 14:22:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 267E584D2E; Fri, 3 Aug 2018 14:22:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07B2F2192A; Fri, 3 Aug 2018 14:22:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73EMG0a076152; Fri, 3 Aug 2018 14:22:16 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EMGC5076151; Fri, 3 Aug 2018 14:22:16 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031422.w73EMGC5076151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:22:16 +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: r337251 - stable/10/sys/security/audit X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/sys/security/audit X-SVN-Commit-Revision: 337251 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:22:17 -0000 Author: asomers Date: Fri Aug 3 14:22:16 2018 New Revision: 337251 URL: https://svnweb.freebsd.org/changeset/base/337251 Log: MFC r334296: Fix "Bad tailq" panic when auditing auditon(A_SETCLASS, ...) Due to an oversight in r195280, auditon(A_SETCLASS, ...) would cause a tailq element to get added to the tailq twice, resulting in a circular tailq. This panics when INVARIANTS are on. Differential Revision: https://reviews.freebsd.org/D15381 Modified: stable/10/sys/security/audit/audit_bsm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/security/audit/audit_bsm.c ============================================================================== --- stable/10/sys/security/audit/audit_bsm.c Fri Aug 3 14:19:56 2018 (r337250) +++ stable/10/sys/security/audit/audit_bsm.c Fri Aug 3 14:22:16 2018 (r337251) @@ -418,7 +418,6 @@ audit_sys_auditon(struct audit_record *ar, struct au_r break; case A_SETCLASS: - kau_write(rec, tok); tok = au_to_arg32(2, "setclass:ec_event", ar->ar_arg_auditon.au_evclass.ec_number); kau_write(rec, tok); From owner-svn-src-stable@freebsd.org Fri Aug 3 14:23:02 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8437C106B6F1; Fri, 3 Aug 2018 14:23:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 30EE584EE7; Fri, 3 Aug 2018 14:23:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 120952193F; Fri, 3 Aug 2018 14:23:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73EN1QE076236; Fri, 3 Aug 2018 14:23:01 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EN1ok076235; Fri, 3 Aug 2018 14:23:01 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031423.w73EN1ok076235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:23:01 +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: r337252 - stable/10/contrib/openbsm/libbsm X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/contrib/openbsm/libbsm X-SVN-Commit-Revision: 337252 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:23:03 -0000 Author: asomers Date: Fri Aug 3 14:23:01 2018 New Revision: 337252 URL: https://svnweb.freebsd.org/changeset/base/337252 Log: MFC r334390: au_read_rec(3): correct return value in man page Submitted by: aniketp Reviewed by: csjp (earlier version) Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15618 Modified: stable/10/contrib/openbsm/libbsm/au_io.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/openbsm/libbsm/au_io.3 ============================================================================== --- stable/10/contrib/openbsm/libbsm/au_io.3 Fri Aug 3 14:22:16 2018 (r337251) +++ stable/10/contrib/openbsm/libbsm/au_io.3 Fri Aug 3 14:23:01 2018 (r337252) @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 4, 2009 +.Dd May 30, 2018 .Dt AU_IO 3 .Os .Sh NAME @@ -129,14 +129,14 @@ would be used to free the record buffer. Finally, the source stream would be closed by a call to .Xr fclose 3 . .Sh RETURN VALUES -The +On success, .Fn au_fetch_tok -and +returns 0 while .Fn au_read_rec -functions -return 0 on success, or \-1 on failure along with additional error information -returned via -.Va errno . +returns the number of bytes read. +Both functions return \-1 on failure with +.Va errno +set appropriately. .Sh SEE ALSO .Xr free 3 , .Xr libbsm 3 From owner-svn-src-stable@freebsd.org Fri Aug 3 14:23:54 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B329F106B7A7; Fri, 3 Aug 2018 14:23:53 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 388FA8539B; Fri, 3 Aug 2018 14:23:52 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37AE721940; Fri, 3 Aug 2018 14:23:52 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73ENqH4076326; Fri, 3 Aug 2018 14:23:52 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73ENq64076325; Fri, 3 Aug 2018 14:23:52 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031423.w73ENq64076325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:23:52 +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: r337253 - stable/10/share/man/man4 X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/share/man/man4 X-SVN-Commit-Revision: 337253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:23:54 -0000 Author: asomers Date: Fri Aug 3 14:23:51 2018 New Revision: 337253 URL: https://svnweb.freebsd.org/changeset/base/337253 Log: MFC r334394: auditpipe(4): fix some ioctl arguments in the man page Fix the argument types for the AUDITPIPE_[GS]ET_PRESELECT_(NA)?FLAGS ioctls. Also, fix some grammar. [skip ci] PR: 226713 Submitted by: aniketp Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15620 Modified: stable/10/share/man/man4/auditpipe.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/auditpipe.4 ============================================================================== --- stable/10/share/man/man4/auditpipe.4 Fri Aug 3 14:23:01 2018 (r337252) +++ stable/10/share/man/man4/auditpipe.4 Fri Aug 3 14:23:51 2018 (r337253) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 5, 2006 +.Dd May 30, 2018 .Dt AUDITPIPE 4 .Os .Sh NAME @@ -154,7 +154,7 @@ These flags correspond to the field in .Xr audit_control 5 . The ioctl argument should be of type -.Vt u_int . +.Vt au_mask_t . .It Dv AUDITPIPE_SET_PRESELECT_FLAGS Set the current default preselection flags for attributable events on the pipe. @@ -163,7 +163,7 @@ These flags correspond to the field in .Xr audit_control 5 . The ioctl argument should be of type -.Vt u_int . +.Vt au_mask_t . .It Dv AUDITPIPE_GET_PRESELECT_NAFLAGS Retrieve the current default preselection flags for non-attributable events on the pipe. @@ -172,7 +172,7 @@ These flags correspond to the field in .Xr audit_control 5 . The ioctl argument should be of type -.Vt u_int . +.Vt au_mask_t . .It Dv AUDITPIPE_SET_PRESELECT_NAFLAGS Set the current default preselection flags for non-attributable events on the pipe. @@ -181,7 +181,7 @@ These flags correspond to the field in .Xr audit_control 5 . The ioctl argument should be of type -.Vt u_int . +.Vt au_mask_t . .It Dv AUDITPIPE_GET_PRESELECT_AUID Query the current preselection masks for a specific auid on the pipe. The ioctl argument should be of type @@ -245,7 +245,7 @@ manual page for information on audit-related bugs and .Pp The configurable preselection mechanism mirrors the selection model present for the global audit trail. -It might be desirable to provided a more flexible selection model. +It might be desirable to provide a more flexible selection model. .Pp The per-pipe audit event queue is fifo, with drops occurring if either the user thread provides in sufficient for the record on the queue head, or on From owner-svn-src-stable@freebsd.org Fri Aug 3 14:25:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ED86106B8D9; Fri, 3 Aug 2018 14:25:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48CFC8572D; Fri, 3 Aug 2018 14:25:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 295AB21943; Fri, 3 Aug 2018 14:25:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73EPGkl076460; Fri, 3 Aug 2018 14:25:16 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EPGwl076459; Fri, 3 Aug 2018 14:25:16 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031425.w73EPGwl076459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:25:16 +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: r337254 - stable/10/lib/libutil X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/lib/libutil X-SVN-Commit-Revision: 337254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:25:16 -0000 Author: asomers Date: Fri Aug 3 14:25:15 2018 New Revision: 337254 URL: https://svnweb.freebsd.org/changeset/base/337254 Log: MFC r334547: pty.3: Add a HISTORY section These functions were first added in 4.3 BSD-Reno, according to http://unix.superglobalmegacorp.com/ and the CSRG svn repository. Reviewed by: bcr, bjk Differential Revision: https://reviews.freebsd.org/D15652 Modified: stable/10/lib/libutil/pty.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libutil/pty.3 ============================================================================== --- stable/10/lib/libutil/pty.3 Fri Aug 3 14:23:51 2018 (r337253) +++ stable/10/lib/libutil/pty.3 Fri Aug 3 14:25:15 2018 (r337254) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" " -.Dd November 11, 2015 +.Dd June 2, 2018 .Dt PTY 3 .Os .Sh NAME @@ -143,3 +143,18 @@ may set it to any value as described for .Xr pty 4 , .Xr termios 4 , .Xr group 5 +.Sh HISTORY +The +.Fn openpty +and +.Fn forkpty +functions first appeared in +.Bx 4.3 Reno. +.Sh BUGS +.Fn openpty +writes the slave terminal's name to +.Fa name , +but does not check that sufficient space is available. +It is advisable to use +.Xr ptsname 3 +instead. From owner-svn-src-stable@freebsd.org Fri Aug 3 14:36:31 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C368106BDA2; Fri, 3 Aug 2018 14:36:31 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E13E860C5; Fri, 3 Aug 2018 14:36:31 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BBC721B00; Fri, 3 Aug 2018 14:36:31 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73EaUs9081485; Fri, 3 Aug 2018 14:36:30 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EaUCi081481; Fri, 3 Aug 2018 14:36:30 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031436.w73EaUCi081481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:36:30 +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: r337256 - in stable/10: contrib/openbsm/bin/praudit etc/mtree usr.sbin/praudit usr.sbin/praudit/tests X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10: contrib/openbsm/bin/praudit etc/mtree usr.sbin/praudit usr.sbin/praudit/tests X-SVN-Commit-Revision: 337256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:36:32 -0000 Author: asomers Date: Fri Aug 3 14:36:29 2018 New Revision: 337256 URL: https://svnweb.freebsd.org/changeset/base/337256 Log: MFC r335287, r335290 r335287: praudit(1): return 0 on success Cherry pick https://github.com/openbsm/openbsm/commit/ed83bb3 Submitted by: aniketp Reviewed by: rwatson, 0mp Obtained from: OpenBSM Sponsored by: Google, Inc. (GSoC 2018) Pull Request: https://github.com/openbsm/openbsm/pull/32 r335290: praudit(1): add tests Submitted by: aniketp X-MFC-With: 335287 Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15751 Added: stable/10/usr.sbin/praudit/tests/ - copied from r335290, head/usr.sbin/praudit/tests/ Modified: stable/10/contrib/openbsm/bin/praudit/praudit.1 stable/10/contrib/openbsm/bin/praudit/praudit.c stable/10/etc/mtree/BSD.tests.dist stable/10/usr.sbin/praudit/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/openbsm/bin/praudit/praudit.1 ============================================================================== --- stable/10/contrib/openbsm/bin/praudit/praudit.1 Fri Aug 3 14:27:28 2018 (r337255) +++ stable/10/contrib/openbsm/bin/praudit/praudit.1 Fri Aug 3 14:36:29 2018 (r337256) @@ -25,7 +25,7 @@ .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd August 4, 2009 +.Dd June 11, 2018 .Dt PRAUDIT 1 .Os .Sh NAME @@ -88,6 +88,8 @@ Events are displayed as per their descriptions given i .Pa /etc/security/audit_event ; UIDs and GIDs are expanded to their names; dates and times are displayed in human-readable format. +.Sh EXIT STATUS +.Ex -std .Sh FILES .Bl -tag -width ".Pa /etc/security/audit_control" -compact .It Pa /etc/security/audit_class Modified: stable/10/contrib/openbsm/bin/praudit/praudit.c ============================================================================== --- stable/10/contrib/openbsm/bin/praudit/praudit.c Fri Aug 3 14:27:28 2018 (r337255) +++ stable/10/contrib/openbsm/bin/praudit/praudit.c Fri Aug 3 14:36:29 2018 (r337256) @@ -169,5 +169,5 @@ main(int argc, char **argv) if (oflags & AU_OFLAG_XML) au_print_xml_footer(stdout); - return (1); + return (0); } Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Fri Aug 3 14:27:28 2018 (r337255) +++ stable/10/etc/mtree/BSD.tests.dist Fri Aug 3 14:36:29 2018 (r337256) @@ -682,6 +682,8 @@ .. nmtree .. + praudit + .. pw .. rpcbind Modified: stable/10/usr.sbin/praudit/Makefile ============================================================================== --- stable/10/usr.sbin/praudit/Makefile Fri Aug 3 14:27:28 2018 (r337255) +++ stable/10/usr.sbin/praudit/Makefile Fri Aug 3 14:36:29 2018 (r337256) @@ -13,4 +13,7 @@ WARNS?= 3 DPADD= ${LIBBSM} LDADD= -lbsm +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include From owner-svn-src-stable@freebsd.org Fri Aug 3 14:37:24 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B391106BE3C; Fri, 3 Aug 2018 14:37:24 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4F428622D; Fri, 3 Aug 2018 14:37:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CFCF21B01; Fri, 3 Aug 2018 14:37:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73EbN91081579; Fri, 3 Aug 2018 14:37:23 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EbNXg081578; Fri, 3 Aug 2018 14:37:23 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031437.w73EbNXg081578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14: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: r337257 - stable/10/contrib/openbsm/bin/auditd X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/contrib/openbsm/bin/auditd X-SVN-Commit-Revision: 337257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:37:24 -0000 Author: asomers Date: Fri Aug 3 14:37:23 2018 New Revision: 337257 URL: https://svnweb.freebsd.org/changeset/base/337257 Log: MFC r335899: auditd(8): register signal handlers interrutibly auditd_wait_for_events() relies on read(2) being interrupted by signals, but it registers signal handlers with signal(3), which sets SA_RESTART. That breaks asynchronous signal handling. It means that signals don't actually get handled until after an audit(8) trigger is received. Symptoms include: * Sending SIGTERM to auditd doesn't kill it right away; you must send SIGTERM and then send a trigger with auditon(2). * Same with SIGHUP * Zombie child processes don't get reaped until auditd receives a trigger sent by auditon. This includes children created by expiring audit trails at auditd startup. Fix by using sigaction(2) instead of signal(3). Cherry pick https://github.com/openbsm/openbsm/commit/d060887 PR: 229381 Reviewed by: cem Obtained from: OpenBSM Differential Revision: https://github.com/openbsm/openbsm/pull/36 Modified: stable/10/contrib/openbsm/bin/auditd/auditd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/openbsm/bin/auditd/auditd.c ============================================================================== --- stable/10/contrib/openbsm/bin/auditd/auditd.c Fri Aug 3 14:36:29 2018 (r337256) +++ stable/10/contrib/openbsm/bin/auditd/auditd.c Fri Aug 3 14:37:23 2018 (r337257) @@ -415,27 +415,35 @@ close_all(void) static int register_daemon(void) { + struct sigaction action; FILE * pidfile; int fd; pid_t pid; /* Set up the signal hander. */ - if (signal(SIGTERM, auditd_relay_signal) == SIG_ERR) { + action.sa_handler = auditd_relay_signal; + /* + * sa_flags must not include SA_RESTART, so that read(2) will be + * interruptible in auditd_wait_for_events + */ + action.sa_flags = 0; + sigemptyset(&action.sa_mask); + if (sigaction(SIGTERM, &action, NULL) != 0) { auditd_log_err( "Could not set signal handler for SIGTERM"); fail_exit(); } - if (signal(SIGCHLD, auditd_relay_signal) == SIG_ERR) { + if (sigaction(SIGCHLD, &action, NULL) != 0) { auditd_log_err( "Could not set signal handler for SIGCHLD"); fail_exit(); } - if (signal(SIGHUP, auditd_relay_signal) == SIG_ERR) { + if (sigaction(SIGHUP, &action, NULL) != 0) { auditd_log_err( "Could not set signal handler for SIGHUP"); fail_exit(); } - if (signal(SIGALRM, auditd_relay_signal) == SIG_ERR) { + if (sigaction(SIGALRM, &action, NULL) != 0) { auditd_log_err( "Could not set signal handler for SIGALRM"); fail_exit(); From owner-svn-src-stable@freebsd.org Fri Aug 3 14:45:54 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 907B7106C226; Fri, 3 Aug 2018 14:45:54 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 41DE3868F2; Fri, 3 Aug 2018 14:45:54 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2171521CAC; Fri, 3 Aug 2018 14:45:54 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73Ejsg0086935; Fri, 3 Aug 2018 14:45:54 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EjraV086933; Fri, 3 Aug 2018 14:45:53 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031445.w73EjraV086933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:45:53 +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: r337258 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 337258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:45:54 -0000 Author: asomers Date: Fri Aug 3 14:45:53 2018 New Revision: 337258 URL: https://svnweb.freebsd.org/changeset/base/337258 Log: MFC r336205: Don't acquire evclass_lock with a spinlock held When the "pc" audit class is enabled and auditd is running, witness will panic during thread exit because au_event_class tries to lock an rwlock while holding a spinlock acquired upstack by thread_exit. To fix this, move AUDIT_SYSCALL_EXIT futher upstack, before the spinlock is acquired. Of thread_exit's 16 callers, it's only necessary to call AUDIT_SYSCALL_EXIT from two, exit1 (for exiting processes) and kern_thr_exit (for exiting threads). The other callers are all kernel threads, which needen't call AUDIT_SYSCALL_EXIT because since they can't make syscalls there will be nothing to audit. And exit1 already does call AUDIT_SYSCALL_EXIT, making the second call in thread_exit redundant for that case. PR: 228444 Reported by: aniketp Reviewed by: aniketp, kib Differential Revision: https://reviews.freebsd.org/D16210 Modified: stable/10/sys/kern/kern_thr.c stable/10/sys/kern/kern_thread.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_thr.c ============================================================================== --- stable/10/sys/kern/kern_thr.c Fri Aug 3 14:37:23 2018 (r337257) +++ stable/10/sys/kern/kern_thr.c Fri Aug 3 14:45:53 2018 (r337258) @@ -362,6 +362,11 @@ kern_thr_exit(struct thread *td) racct_sub(p, RACCT_NTHR, 1); tdsigcleanup(td); umtx_thread_exit(td); + +#ifdef AUDIT + AUDIT_SYSCALL_EXIT(0, td); +#endif + PROC_SLOCK(p); thread_stopped(p); thread_exit(); Modified: stable/10/sys/kern/kern_thread.c ============================================================================== --- stable/10/sys/kern/kern_thread.c Fri Aug 3 14:37:23 2018 (r337257) +++ stable/10/sys/kern/kern_thread.c Fri Aug 3 14:45:53 2018 (r337258) @@ -418,9 +418,6 @@ thread_exit(void) SDT_PROBE0(proc, , , lwp__exit); KASSERT(TAILQ_EMPTY(&td->td_sigqueue.sq_list), ("signal pending")); -#ifdef AUDIT - AUDIT_SYSCALL_EXIT(0, td); -#endif /* * drop FPU & debug register state storage, or any other * architecture specific resources that From owner-svn-src-stable@freebsd.org Fri Aug 3 14:47:48 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47572106C2A2; Fri, 3 Aug 2018 14:47:48 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED10A86A57; Fri, 3 Aug 2018 14:47:47 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA5B821CAE; Fri, 3 Aug 2018 14:47:47 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73EllQ7087100; Fri, 3 Aug 2018 14:47:47 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73EllVw087099; Fri, 3 Aug 2018 14:47:47 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201808031447.w73EllVw087099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 3 Aug 2018 14:47:47 +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: r337259 - stable/10/sys/security/audit X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/sys/security/audit X-SVN-Commit-Revision: 337259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 14:47:48 -0000 Author: asomers Date: Fri Aug 3 14:47:47 2018 New Revision: 337259 URL: https://svnweb.freebsd.org/changeset/base/337259 Log: MFC r336319: auditon(2): fix A_SETPOLICY with 64-bit values A_SETPOLICY is supposed to work with either 64 or 32-bit values, but due to a typo the 64-bit version has never worked correctly. Submitted by: aniketp Reviewed by: asomers, cem Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D16222 Modified: stable/10/sys/security/audit/audit_syscalls.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/security/audit/audit_syscalls.c ============================================================================== --- stable/10/sys/security/audit/audit_syscalls.c Fri Aug 3 14:45:53 2018 (r337258) +++ stable/10/sys/security/audit/audit_syscalls.c Fri Aug 3 14:47:47 2018 (r337259) @@ -241,7 +241,7 @@ sys_auditon(struct thread *td, struct auditon_args *ua case A_OLDSETPOLICY: case A_SETPOLICY: if (uap->length == sizeof(udata.au_policy64)) { - if (udata.au_policy & (~AUDIT_CNT|AUDIT_AHLT| + if (udata.au_policy & ~(AUDIT_CNT|AUDIT_AHLT| AUDIT_ARGV|AUDIT_ARGE)) return (EINVAL); audit_fail_stop = ((udata.au_policy64 & AUDIT_CNT) == From owner-svn-src-stable@freebsd.org Fri Aug 3 15:42:41 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C9CC106D258; Fri, 3 Aug 2018 15:42:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 12453891C0; Fri, 3 Aug 2018 15:42:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7EF622661; Fri, 3 Aug 2018 15:42:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73FgeQj017600; Fri, 3 Aug 2018 15:42:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73FgdLE017593; Fri, 3 Aug 2018 15:42:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201808031542.w73FgdLE017593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 3 Aug 2018 15:42: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: r337262 - in stable/11/sys: amd64/amd64 i386/i386 kern vm X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 kern vm X-SVN-Commit-Revision: 337262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 15:42:41 -0000 Author: markj Date: Fri Aug 3 15:42:39 2018 New Revision: 337262 URL: https://svnweb.freebsd.org/changeset/base/337262 Log: MFC r336505, r336764 Have preload_delete_name() free pages backing preloaded data. Modified: stable/11/sys/amd64/amd64/machdep.c stable/11/sys/amd64/amd64/pmap.c stable/11/sys/i386/i386/machdep.c stable/11/sys/i386/i386/pmap.c stable/11/sys/kern/subr_module.c stable/11/sys/vm/vm_extern.h stable/11/sys/vm/vm_kern.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/machdep.c Fri Aug 3 15:35:29 2018 (r337261) +++ stable/11/sys/amd64/amd64/machdep.c Fri Aug 3 15:42:39 2018 (r337262) @@ -100,6 +100,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef DDB #ifndef KDB @@ -1229,6 +1230,12 @@ getmemsize(caddr_t kmdp, u_int64_t first) pt_entry_t *pte; quad_t dcons_addr, dcons_size; int page_counter; + + /* + * Tell the physical memory allocator about pages used to store + * the kernel and preloaded data. See kmem_bootstrap_free(). + */ + vm_phys_add_seg((vm_paddr_t)kernphys, trunc_page(first)); bzero(physmap, sizeof(physmap)); physmap_idx = 0; Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Fri Aug 3 15:35:29 2018 (r337261) +++ stable/11/sys/amd64/amd64/pmap.c Fri Aug 3 15:42:39 2018 (r337262) @@ -373,6 +373,8 @@ static u_int64_t DMPDphys; /* phys addr of direct mapp static u_int64_t DMPDPphys; /* phys addr of direct mapped level 3 */ static int ndmpdpphys; /* number of DMPDPphys pages */ +static vm_paddr_t KERNend; /* phys addr of end of bootstrap data */ + /* * pmap_mapdev support pre initialization (i.e. console) */ @@ -938,8 +940,9 @@ create_pagetables(vm_paddr_t *firstaddr) /* Map from zero to end of allocations under 2M pages */ /* This replaces some of the KPTphys entries above */ for (i = 0; (i << PDRSHIFT) < *firstaddr; i++) + /* Preset PG_M and PG_A because demotion expects it. */ pd_p[i] = (i << PDRSHIFT) | X86_PG_RW | X86_PG_V | PG_PS | - pg_g; + X86_PG_M | X86_PG_A | pg_g; /* * Because we map the physical blocks in 2M pages, adjust firstaddr @@ -1015,6 +1018,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr) pt_entry_t *pte; int i; + KERNend = *firstaddr; + if (!pti) pg_g = X86_PG_G; @@ -1247,6 +1252,7 @@ pmap_init(void) * Initialize the vm page array entries for the kernel pmap's * page table pages. */ + PMAP_LOCK(kernel_pmap); for (i = 0; i < nkpt; i++) { mpte = PHYS_TO_VM_PAGE(KPTphys + (i << PAGE_SHIFT)); KASSERT(mpte >= vm_page_array && @@ -1255,7 +1261,11 @@ pmap_init(void) mpte->pindex = pmap_pde_pindex(KERNBASE) + i; mpte->phys_addr = KPTphys + (i << PAGE_SHIFT); mpte->wire_count = 1; + if (i << PDRSHIFT < KERNend && + pmap_insert_pt_page(kernel_pmap, mpte)) + panic("pmap_init: pmap_insert_pt_page failed"); } + PMAP_UNLOCK(kernel_pmap); atomic_add_int(&vm_cnt.v_wire_count, nkpt); /* Modified: stable/11/sys/i386/i386/machdep.c ============================================================================== --- stable/11/sys/i386/i386/machdep.c Fri Aug 3 15:35:29 2018 (r337261) +++ stable/11/sys/i386/i386/machdep.c Fri Aug 3 15:42:39 2018 (r337262) @@ -99,6 +99,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef DDB #ifndef KDB @@ -2074,6 +2075,12 @@ getmemsize(int first) bzero(&vmf, sizeof(vmf)); bzero(physmap, sizeof(physmap)); basemem = 0; + + /* + * Tell the physical memory allocator about pages used to store + * the kernel and preloaded data. See kmem_bootstrap_free(). + */ + vm_phys_add_seg((vm_paddr_t)KERNLOAD, trunc_page(first)); /* * Check if the loader supplied an SMAP memory map. If so, Modified: stable/11/sys/i386/i386/pmap.c ============================================================================== --- stable/11/sys/i386/i386/pmap.c Fri Aug 3 15:35:29 2018 (r337261) +++ stable/11/sys/i386/i386/pmap.c Fri Aug 3 15:42:39 2018 (r337262) @@ -787,6 +787,7 @@ pmap_init(void) * Initialize the vm page array entries for the kernel pmap's * page table pages. */ + PMAP_LOCK(kernel_pmap); for (i = 0; i < NKPT; i++) { mpte = PHYS_TO_VM_PAGE(KPTphys + (i << PAGE_SHIFT)); KASSERT(mpte >= vm_page_array && @@ -794,7 +795,14 @@ pmap_init(void) ("pmap_init: page table page is out of range")); mpte->pindex = i + KPTDI; mpte->phys_addr = KPTphys + (i << PAGE_SHIFT); + mpte->wire_count = 1; + if (pseflag != 0 && + KERNBASE <= i << PDRSHIFT && i << PDRSHIFT < KERNend && + pmap_insert_pt_page(kernel_pmap, mpte)) + panic("pmap_init: pmap_insert_pt_page failed"); } + PMAP_UNLOCK(kernel_pmap); + vm_wire_add(NKPT); /* * Initialize the address space (zone) for the pv entries. Set a Modified: stable/11/sys/kern/subr_module.c ============================================================================== --- stable/11/sys/kern/subr_module.c Fri Aug 3 15:35:29 2018 (r337261) +++ stable/11/sys/kern/subr_module.c Fri Aug 3 15:42:39 2018 (r337262) @@ -31,6 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + /* * Preloaded module support */ @@ -202,29 +205,42 @@ preload_search_info(caddr_t mod, int inf) void preload_delete_name(const char *name) { - caddr_t curp; - uint32_t *hdr; + caddr_t addr, curp; + uint32_t *hdr, sz; int next; int clearing; + + addr = 0; + sz = 0; if (preload_metadata != NULL) { - + clearing = 0; curp = preload_metadata; for (;;) { hdr = (uint32_t *)curp; - if (hdr[0] == 0 && hdr[1] == 0) - break; + if (hdr[0] == MODINFO_NAME || (hdr[0] == 0 && hdr[1] == 0)) { + /* Free memory used to store the file. */ + if (addr != 0 && sz != 0) + kmem_bootstrap_free((vm_offset_t)addr, sz); + addr = 0; + sz = 0; - /* Search for a MODINFO_NAME field */ - if (hdr[0] == MODINFO_NAME) { + if (hdr[0] == 0) + break; if (!strcmp(name, curp + sizeof(uint32_t) * 2)) clearing = 1; /* got it, start clearing */ - else if (clearing) + else if (clearing) { clearing = 0; /* at next one now.. better stop */ + } } - if (clearing) + if (clearing) { + if (hdr[0] == MODINFO_ADDR) + addr = *(caddr_t *)(curp + sizeof(uint32_t) * 2); + else if (hdr[0] == MODINFO_SIZE) + sz = *(uint32_t *)(curp + sizeof(uint32_t) * 2); hdr[0] = MODINFO_EMPTY; + } /* skip to next field */ next = sizeof(uint32_t) * 2 + hdr[1]; Modified: stable/11/sys/vm/vm_extern.h ============================================================================== --- stable/11/sys/vm/vm_extern.h Fri Aug 3 15:35:29 2018 (r337261) +++ stable/11/sys/vm/vm_extern.h Fri Aug 3 15:42:39 2018 (r337262) @@ -65,6 +65,7 @@ int kmem_back(vm_object_t, vm_offset_t, vm_size_t, int void kmem_unback(vm_object_t, vm_offset_t, vm_size_t); /* Bootstrapping. */ +void kmem_bootstrap_free(vm_offset_t, vm_size_t); vm_map_t kmem_suballoc(vm_map_t, vm_offset_t *, vm_offset_t *, vm_size_t, boolean_t); void kmem_init(vm_offset_t, vm_offset_t); Modified: stable/11/sys/vm/vm_kern.c ============================================================================== --- stable/11/sys/vm/vm_kern.c Fri Aug 3 15:35:29 2018 (r337261) +++ stable/11/sys/vm/vm_kern.c Fri Aug 3 15:42:39 2018 (r337262) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -535,6 +536,37 @@ kmem_init(vm_offset_t start, vm_offset_t end) start, VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT); /* ... and ending with the completion of the above `insert' */ vm_map_unlock(m); +} + +/* + * kmem_bootstrap_free: + * + * Free pages backing preloaded data (e.g., kernel modules) to the + * system. Currently only supported on platforms that create a + * vm_phys segment for preloaded data. + */ +void +kmem_bootstrap_free(vm_offset_t start, vm_size_t size) +{ +#if defined(__i386__) || defined(__amd64__) + vm_offset_t end, va; + vm_paddr_t pa; + vm_page_t m; + + end = trunc_page(start + size); + start = round_page(start); + + for (va = start; va < end; va += PAGE_SIZE) { + pa = pmap_kextract(va); + m = PHYS_TO_VM_PAGE(pa); + + mtx_lock(&vm_page_queue_free_mtx); + vm_phys_free_pages(m, 0); + mtx_unlock(&vm_page_queue_free_mtx); + } + pmap_remove(kernel_pmap, start, end); + (void)vmem_add(kernel_arena, start, end - start, M_WAITOK); +#endif } #ifdef DIAGNOSTIC From owner-svn-src-stable@freebsd.org Fri Aug 3 15:43:38 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C0D4106D2FA; Fri, 3 Aug 2018 15:43:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6C7989349; Fri, 3 Aug 2018 15:43:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9855F2266D; Fri, 3 Aug 2018 15:43:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73Fhbmv017693; Fri, 3 Aug 2018 15:43:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73Fhb40017692; Fri, 3 Aug 2018 15:43:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201808031543.w73Fhb40017692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 3 Aug 2018 15:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r337263 - stable/11/sys/amd64/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/amd64/conf X-SVN-Commit-Revision: 337263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 15:43:38 -0000 Author: markj Date: Fri Aug 3 15:43:37 2018 New Revision: 337263 URL: https://svnweb.freebsd.org/changeset/base/337263 Log: MFC r337015: COMPAT_LINUX32 has not depended on COMPAT_43 in some time. Modified: stable/11/sys/amd64/conf/NOTES Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/conf/NOTES ============================================================================== --- stable/11/sys/amd64/conf/NOTES Fri Aug 3 15:42:39 2018 (r337262) +++ stable/11/sys/amd64/conf/NOTES Fri Aug 3 15:43:37 2018 (r337263) @@ -651,7 +651,7 @@ options COMPAT_CLOUDABI64 # Enable Linux ABI emulation #XXX#options COMPAT_LINUX -# Enable 32-bit Linux ABI emulation (requires COMPAT_43 and COMPAT_FREEBSD32) +# Enable 32-bit Linux ABI emulation (requires COMPAT_FREEBSD32). options COMPAT_LINUX32 # Enable the linux-like proc filesystem support (requires COMPAT_LINUX32 From owner-svn-src-stable@freebsd.org Fri Aug 3 17:14:53 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C70A0106F234; Fri, 3 Aug 2018 17:14:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D4AD8CE81; Fri, 3 Aug 2018 17:14:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EFC923585; Fri, 3 Aug 2018 17:14:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73HErWE065643; Fri, 3 Aug 2018 17:14:53 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73HErNw065642; Fri, 3 Aug 2018 17:14:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201808031714.w73HErNw065642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 3 Aug 2018 17:14:53 +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: r337267 - stable/11/sys/i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/i386/i386 X-SVN-Commit-Revision: 337267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 17:14:54 -0000 Author: markj Date: Fri Aug 3 17:14:52 2018 New Revision: 337267 URL: https://svnweb.freebsd.org/changeset/base/337267 Log: Fix a mismerge in r337262. This is a direct commit to stable/11. Modified: stable/11/sys/i386/i386/pmap.c Modified: stable/11/sys/i386/i386/pmap.c ============================================================================== --- stable/11/sys/i386/i386/pmap.c Fri Aug 3 16:44:56 2018 (r337266) +++ stable/11/sys/i386/i386/pmap.c Fri Aug 3 17:14:52 2018 (r337267) @@ -802,7 +802,7 @@ pmap_init(void) panic("pmap_init: pmap_insert_pt_page failed"); } PMAP_UNLOCK(kernel_pmap); - vm_wire_add(NKPT); + atomic_add_int(&vm_cnt.v_wire_count, NKPT); /* * Initialize the address space (zone) for the pv entries. Set a From owner-svn-src-stable@freebsd.org Fri Aug 3 21:59:03 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93C901052939; Fri, 3 Aug 2018 21:59:03 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C4C777201; Fri, 3 Aug 2018 21:59:03 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 107A926308; Fri, 3 Aug 2018 21:59:03 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73Lx2kQ009674; Fri, 3 Aug 2018 21:59:02 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73Lx1p5009667; Fri, 3 Aug 2018 21:59:01 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201808032159.w73Lx1p5009667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 3 Aug 2018 21:59:01 +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: r337274 - stable/11/release/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: manu X-SVN-Commit-Paths: stable/11/release/arm X-SVN-Commit-Revision: 337274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 03 Aug 2018 21:59:03 -0000 Author: manu Date: Fri Aug 3 21:59:01 2018 New Revision: 337274 URL: https://svnweb.freebsd.org/changeset/base/337274 Log: MFC r336997: release: Restore copy of boot.scr for some board This is not a problem for 12-CURRENT as EFI boot works but it doesn't for 11. While here some board arm_install_uboot also copy ubldr.bin et create firstboot files but it's already done in arm_install_boot Reviewed by: gjb Differential Revision: https://reviews.freebsd.org/D16481 Modified: stable/11/release/arm/BANANAPI.conf stable/11/release/arm/BEAGLEBONE.conf stable/11/release/arm/CUBIEBOARD.conf stable/11/release/arm/CUBIEBOARD2.conf stable/11/release/arm/CUBOX-HUMMINGBOARD.conf stable/11/release/arm/PANDABOARD.conf stable/11/release/arm/WANDBOARD.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/release/arm/BANANAPI.conf ============================================================================== --- stable/11/release/arm/BANANAPI.conf Fri Aug 3 20:04:06 2018 (r337273) +++ stable/11/release/arm/BANANAPI.conf Fri Aug 3 21:59:01 2018 (r337274) @@ -20,20 +20,15 @@ export BOARDNAME="BANANAPI" arm_install_uboot() { UBOOT_DIR="/usr/local/share/u-boot/u-boot-bananapi" UBOOT_FILES="u-boot-sunxi-with-spl.bin" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ of=/dev/${mddev} bs=1k seek=8 conv=sync - chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr - chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} - chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ - ${FATMOUNT}/ubldr.bin - chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} - umount_loop ${CHROOTDIR}/${UFSMOUNT} chroot ${CHROOTDIR} rmdir ${FATMOUNT} - chroot ${CHROOTDIR} rmdir ${UFSMOUNT} - + return 0 } Modified: stable/11/release/arm/BEAGLEBONE.conf ============================================================================== --- stable/11/release/arm/BEAGLEBONE.conf Fri Aug 3 20:04:06 2018 (r337273) +++ stable/11/release/arm/BEAGLEBONE.conf Fri Aug 3 21:59:01 2018 (r337274) @@ -30,6 +30,6 @@ arm_install_uboot() { sync umount_loop ${CHROOTDIR}/${FATMOUNT} chroot ${CHROOTDIR} rmdir ${FATMOUNT} - + return 0 } Modified: stable/11/release/arm/CUBIEBOARD.conf ============================================================================== --- stable/11/release/arm/CUBIEBOARD.conf Fri Aug 3 20:04:06 2018 (r337273) +++ stable/11/release/arm/CUBIEBOARD.conf Fri Aug 3 21:59:01 2018 (r337274) @@ -20,21 +20,14 @@ arm_install_uboot() { UBOOT_DIR="/usr/local/share/u-boot/u-boot-cubieboard" UBOOT_FILES="u-boot-sunxi-with-spl.bin" FATMOUNT="${DESTDIR%${KERNEL}}/fat" - UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ of=/dev/${mddev} bs=1k seek=8 conv=sync - chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr - chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} - chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ - ${FATMOUNT}/ubldr.bin - chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} - umount_loop ${CHROOTDIR}/${UFSMOUNT} chroot ${CHROOTDIR} rmdir ${FATMOUNT} - chroot ${CHROOTDIR} rmdir ${UFSMOUNT} - + return 0 } Modified: stable/11/release/arm/CUBIEBOARD2.conf ============================================================================== --- stable/11/release/arm/CUBIEBOARD2.conf Fri Aug 3 20:04:06 2018 (r337273) +++ stable/11/release/arm/CUBIEBOARD2.conf Fri Aug 3 21:59:01 2018 (r337274) @@ -21,23 +21,14 @@ arm_install_uboot() { UBOOT_DIR="/usr/local/share/u-boot/u-boot-cubieboard2" UBOOT_FILES="u-boot-sunxi-with-spl.bin" FATMOUNT="${DESTDIR%${KERNEL}}/fat" - UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ of=/dev/${mddev} bs=1k seek=8 conv=sync - chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr - chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} - chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ - ${FATMOUNT}/ubldr.bin - chroot ${CHROOTDIR} ln ${UFSMOUNT}/boot/dtb/cubieboard2.dtb \ - ${UFSMOUNT}/boot/dtb/sun7i-a20-cubieboard2.dtb - chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} - umount_loop ${CHROOTDIR}/${UFSMOUNT} chroot ${CHROOTDIR} rmdir ${FATMOUNT} - chroot ${CHROOTDIR} rmdir ${UFSMOUNT} - + return 0 } Modified: stable/11/release/arm/CUBOX-HUMMINGBOARD.conf ============================================================================== --- stable/11/release/arm/CUBOX-HUMMINGBOARD.conf Fri Aug 3 20:04:06 2018 (r337273) +++ stable/11/release/arm/CUBOX-HUMMINGBOARD.conf Fri Aug 3 21:59:01 2018 (r337274) @@ -21,21 +21,14 @@ arm_install_uboot() { UBOOT_DIR="/usr/local/share/u-boot/u-boot-cubox-hummingboard" UBOOT_FILES="u-boot.imx" FATMOUNT="${DESTDIR%${KERNEL}}/fat" - UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ of=/dev/${mddev} bs=512 seek=2 conv=sync - chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr - chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} - chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ - ${FATMOUNT}/ubldr.bin - chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} - umount_loop ${CHROOTDIR}/${UFSMOUNT} chroot ${CHROOTDIR} rmdir ${FATMOUNT} - chroot ${CHROOTDIR} rmdir ${UFSMOUNT} - + return 0 } Modified: stable/11/release/arm/PANDABOARD.conf ============================================================================== --- stable/11/release/arm/PANDABOARD.conf Fri Aug 3 20:04:06 2018 (r337273) +++ stable/11/release/arm/PANDABOARD.conf Fri Aug 3 21:59:01 2018 (r337274) @@ -19,21 +19,14 @@ WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x88000000" arm_install_uboot() { UBOOT_DIR="/usr/local/share/u-boot/u-boot-pandaboard" FATMOUNT="${DESTDIR%${KERNEL}}/fat" - UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" - chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} - chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr - chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ - ${FATMOUNT}/ubldr.bin - chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} - umount_loop ${CHROOTDIR}/${UFSMOUNT} chroot ${CHROOTDIR} rmdir ${FATMOUNT} - chroot ${CHROOTDIR} rmdir ${UFSMOUNT} - + return 0 } Modified: stable/11/release/arm/WANDBOARD.conf ============================================================================== --- stable/11/release/arm/WANDBOARD.conf Fri Aug 3 20:04:06 2018 (r337273) +++ stable/11/release/arm/WANDBOARD.conf Fri Aug 3 21:59:01 2018 (r337274) @@ -20,8 +20,15 @@ export BOARDNAME="WANDBOARD" arm_install_uboot() { UBOOT_DIR="/usr/local/share/u-boot/u-boot-wandboard" UBOOT_FILES="u-boot.imx" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ of=/dev/${mddev} bs=512 seek=2 conv=sync - + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" + chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} + chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr + sync + umount_loop ${CHROOTDIR}/${FATMOUNT} + chroot ${CHROOTDIR} rmdir ${FATMOUNT} + return 0 } From owner-svn-src-stable@freebsd.org Sat Aug 4 00:34:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E4A210563C5; Sat, 4 Aug 2018 00:34:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B312E7C5E7; Sat, 4 Aug 2018 00:34:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7136627CC5; Sat, 4 Aug 2018 00:34:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w740YGiV092120; Sat, 4 Aug 2018 00:34:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w740YGEM092119; Sat, 4 Aug 2018 00:34:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201808040034.w740YGEM092119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 4 Aug 2018 00:34: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: r337280 - stable/11/sys/cam X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam X-SVN-Commit-Revision: 337280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 04 Aug 2018 00:34:17 -0000 Author: mav Date: Sat Aug 4 00:34:15 2018 New Revision: 337280 URL: https://svnweb.freebsd.org/changeset/base/337280 Log: MFC r336590: Stop further SCSI recovery attempts after one has failed. We've got a set of probably damaged hard disks, reporting 0x04,0x02 ("Logical unit not ready, initializing command required") in response to READ CAPACITY(16), where attempts to use START STOP UNIT for recovery results in 0x44,0x00 ("Internal target failure") after ~1 second delay. As result of all recovery retries, device open attempt took ~3 seconds before finally reporting to GEOM that device is opened, but has no media. If the open was for writing and since it hasn't formally failed, following close triggered GEOM retaste, opening device few more times with respective delays. This change reduces whole time of this cycle from ~12 seconds to ~3 by giving up on recovery after the first failure. Modified: stable/11/sys/cam/cam_periph.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_periph.c ============================================================================== --- stable/11/sys/cam/cam_periph.c Sat Aug 4 00:03:21 2018 (r337279) +++ stable/11/sys/cam/cam_periph.c Sat Aug 4 00:34:15 2018 (r337280) @@ -1244,7 +1244,7 @@ camperiphdone(struct cam_periph *periph, union ccb *do union ccb *saved_ccb; cam_status status; struct scsi_start_stop_unit *scsi_cmd; - int error_code, sense_key, asc, ascq; + int error = 0, error_code, sense_key, asc, ascq; scsi_cmd = (struct scsi_start_stop_unit *) &done_ccb->csio.cdb_io.cdb_bytes; @@ -1276,8 +1276,9 @@ camperiphdone(struct cam_periph *periph, union ccb *do goto out; } } - if (cam_periph_error(done_ccb, - 0, SF_RETRY_UA | SF_NO_PRINT, NULL) == ERESTART) + error = cam_periph_error(done_ccb, 0, + SF_RETRY_UA | SF_NO_PRINT, NULL); + if (error == ERESTART) goto out; if (done_ccb->ccb_h.status & CAM_DEV_QFRZN) { cam_release_devq(done_ccb->ccb_h.path, 0, 0, 0, 0); @@ -1296,14 +1297,21 @@ camperiphdone(struct cam_periph *periph, union ccb *do } /* - * Perform the final retry with the original CCB so that final - * error processing is performed by the owner of the CCB. + * After recovery action(s) completed, return to the original CCB. + * If the recovery CCB has failed, considering its own possible + * retries and recovery, assume we are back in state where we have + * been originally, but without recovery hopes left. In such case, + * after the final attempt below, we cancel any further retries, + * blocking by that also any new recovery attempts for this CCB, + * and the result will be the final one returned to the CCB owher. */ saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr; bcopy(saved_ccb, done_ccb, sizeof(*done_ccb)); xpt_free_ccb(saved_ccb); if (done_ccb->ccb_h.cbfcnp != camperiphdone) periph->flags &= ~CAM_PERIPH_RECOVERY_INPROG; + if (error != 0) + done_ccb->ccb_h.retry_count = 0; xpt_action(done_ccb); out: From owner-svn-src-stable@freebsd.org Sat Aug 4 12:41:00 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE0C61069E96; Sat, 4 Aug 2018 12:41:00 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 63A8273DDB; Sat, 4 Aug 2018 12:41:00 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45CB2790A; Sat, 4 Aug 2018 12:41:00 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w74Cf0S7065349; Sat, 4 Aug 2018 12:41:00 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w74CexgP065348; Sat, 4 Aug 2018 12:40:59 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201808041240.w74CexgP065348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 4 Aug 2018 12:40:59 +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: r337290 - stable/11/sys/dev/evdev X-SVN-Group: stable-11 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/11/sys/dev/evdev X-SVN-Commit-Revision: 337290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 04 Aug 2018 12:41:00 -0000 Author: wulf Date: Sat Aug 4 12:40:59 2018 New Revision: 337290 URL: https://svnweb.freebsd.org/changeset/base/337290 Log: MFC r334555: [evdev] Sync event codes with Linux kernel 4.16 Modified: stable/11/sys/dev/evdev/input-event-codes.h stable/11/sys/dev/evdev/input.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/evdev/input-event-codes.h ============================================================================== --- stable/11/sys/dev/evdev/input-event-codes.h Sat Aug 4 12:31:19 2018 (r337289) +++ stable/11/sys/dev/evdev/input-event-codes.h Sat Aug 4 12:40:59 2018 (r337290) @@ -421,6 +421,7 @@ #define BTN_TOOL_MOUSE 0x146 #define BTN_TOOL_LENS 0x147 #define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */ +#define BTN_STYLUS3 0x149 #define BTN_TOUCH 0x14a #define BTN_STYLUS 0x14b #define BTN_STYLUS2 0x14c @@ -607,6 +608,7 @@ #define BTN_DPAD_RIGHT 0x223 #define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */ +#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */ #define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */ #define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */ @@ -615,6 +617,7 @@ #define KEY_APPSELECT 0x244 /* AL Select Task/Application */ #define KEY_SCREENSAVER 0x245 /* AL Screen Saver */ #define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */ +#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */ #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ @@ -626,6 +629,38 @@ #define KEY_KBDINPUTASSIST_ACCEPT 0x264 #define KEY_KBDINPUTASSIST_CANCEL 0x265 +/* Diagonal movement keys */ +#define KEY_RIGHT_UP 0x266 +#define KEY_RIGHT_DOWN 0x267 +#define KEY_LEFT_UP 0x268 +#define KEY_LEFT_DOWN 0x269 + +#define KEY_ROOT_MENU 0x26a /* Show Device's Root Menu */ +/* Show Top Menu of the Media (e.g. DVD) */ +#define KEY_MEDIA_TOP_MENU 0x26b +#define KEY_NUMERIC_11 0x26c +#define KEY_NUMERIC_12 0x26d +/* + * Toggle Audio Description: refers to an audio service that helps blind and + * visually impaired consumers understand the action in a program. Note: in + * some countries this is referred to as "Video Description". + */ +#define KEY_AUDIO_DESC 0x26e +#define KEY_3D_MODE 0x26f +#define KEY_NEXT_FAVORITE 0x270 +#define KEY_STOP_RECORD 0x271 +#define KEY_PAUSE_RECORD 0x272 +#define KEY_VOD 0x273 /* Video on Demand */ +#define KEY_UNMUTE 0x274 +#define KEY_FASTREVERSE 0x275 +#define KEY_SLOWREVERSE 0x276 +/* + * Control a data application associated with the currently viewed channel, + * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.) + */ +#define KEY_DATA 0x277 +#define KEY_ONSCREEN_KEYBOARD 0x278 + #define BTN_TRIGGER_HAPPY 0x2c0 #define BTN_TRIGGER_HAPPY1 0x2c0 #define BTN_TRIGGER_HAPPY2 0x2c1 @@ -763,6 +798,7 @@ #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ #define SW_LINEIN_INSERT 0x0d /* set = inserted */ #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ +#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ #define SW_MAX 0x0f #define SW_CNT (SW_MAX+1) Modified: stable/11/sys/dev/evdev/input.h ============================================================================== --- stable/11/sys/dev/evdev/input.h Sat Aug 4 12:31:19 2018 (r337289) +++ stable/11/sys/dev/evdev/input.h Sat Aug 4 12:40:59 2018 (r337290) @@ -38,6 +38,9 @@ #include "input-event-codes.h" +#define input_event_sec time.tv_sec +#define input_event_usec time.tv_usec + struct input_event { struct timeval time; uint16_t type; @@ -138,6 +141,9 @@ struct input_keymap_entry { #define BUS_GSC 0x1A #define BUS_ATARI 0x1B #define BUS_SPI 0x1C +#define BUS_RMI 0x1D +#define BUS_CEC 0x1E +#define BUS_INTEL_ISHTP 0x1F /* * MT_TOOL types From owner-svn-src-stable@freebsd.org Sat Aug 4 12:45:38 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F880106A19A; Sat, 4 Aug 2018 12:45:38 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33EB3743A4; Sat, 4 Aug 2018 12:45:38 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EADD77A7A; Sat, 4 Aug 2018 12:45:37 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w74CjbQZ067370; Sat, 4 Aug 2018 12:45:37 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w74Cjbb9067369; Sat, 4 Aug 2018 12:45:37 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201808041245.w74Cjbb9067369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 4 Aug 2018 12:45:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r337291 - stable/11/sys/dev/usb X-SVN-Group: stable-11 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/11/sys/dev/usb X-SVN-Commit-Revision: 337291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 04 Aug 2018 12:45:38 -0000 Author: wulf Date: Sat Aug 4 12:45:37 2018 New Revision: 337291 URL: https://svnweb.freebsd.org/changeset/base/337291 Log: MFC r336577: Raise "Report Count" value limit in HID descriptor parser. This fixes usage/report size calculation of Microsoft`s "Touch Hardware Quality Assurance" certificate blob found in many touchscreens. While here, join several "c->flags = dval" lines in to single line. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D16357 Modified: stable/11/sys/dev/usb/usb_hid.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/usb_hid.c ============================================================================== --- stable/11/sys/dev/usb/usb_hid.c Sat Aug 4 12:40:59 2018 (r337290) +++ stable/11/sys/dev/usb/usb_hid.c Sat Aug 4 12:45:37 2018 (r337291) @@ -72,6 +72,7 @@ static uint8_t hid_get_byte(struct hid_data *s, const #define MAXUSAGE 64 #define MAXPUSH 4 #define MAXID 16 +#define MAXLOCCNT 1024 struct hid_pos_data { int32_t rid; @@ -89,10 +90,10 @@ struct hid_data { int32_t usage_last; /* last seen usage */ uint32_t loc_size; /* last seen size */ uint32_t loc_count; /* last seen count */ + uint32_t ncount; /* end usage item count */ + uint32_t icount; /* current usage item count */ uint8_t kindset; /* we have 5 kinds so 8 bits are enough */ uint8_t pushlevel; /* current pushlevel */ - uint8_t ncount; /* end usage item count */ - uint8_t icount; /* current usage item count */ uint8_t nusage; /* end "usages_min/max" index */ uint8_t iusage; /* current "usages_min/max" index */ uint8_t ousage; /* current "usages_min/max" offset */ @@ -345,18 +346,19 @@ hid_get_item(struct hid_data *s, struct hid_item *h) switch (bTag) { case 8: /* Input */ c->kind = hid_input; - c->flags = dval; ret: + c->flags = dval; c->loc.count = s->loc_count; c->loc.size = s->loc_size; if (c->flags & HIO_VARIABLE) { /* range check usage count */ - if (c->loc.count > 255) { + if (c->loc.count > MAXLOCCNT) { DPRINTFN(0, "Number of " - "items(%u) truncated to 255\n", - (unsigned)(c->loc.count)); - s->ncount = 255; + "items(%u) truncated to %u\n", + (unsigned)(c->loc.count), + MAXLOCCNT); + s->ncount = MAXLOCCNT; } else s->ncount = c->loc.count; @@ -372,7 +374,6 @@ hid_get_item(struct hid_data *s, struct hid_item *h) case 9: /* Output */ c->kind = hid_output; - c->flags = dval; goto ret; case 10: /* Collection */ c->kind = hid_collection; @@ -383,7 +384,6 @@ hid_get_item(struct hid_data *s, struct hid_item *h) return (1); case 11: /* Feature */ c->kind = hid_feature; - c->flags = dval; goto ret; case 12: /* End collection */ c->kind = hid_endcollection; From owner-svn-src-stable@freebsd.org Sat Aug 4 21:57:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B3031054465; Sat, 4 Aug 2018 21:57:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3F8E8A239; Sat, 4 Aug 2018 21:57:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E99D15405; Sat, 4 Aug 2018 21:57:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w74LvJTi052682; Sat, 4 Aug 2018 21:57:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w74LvHN8052670; Sat, 4 Aug 2018 21:57:17 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201808042157.w74LvHN8052670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 4 Aug 2018 21:57: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: r337333 - in stable/11: . sys/kern sys/sys tools/build usr.sbin/config X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: . sys/kern sys/sys tools/build usr.sbin/config X-SVN-Commit-Revision: 337333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 04 Aug 2018 21:57:20 -0000 Author: kevans Date: Sat Aug 4 21:57:17 2018 New Revision: 337333 URL: https://svnweb.freebsd.org/changeset/base/337333 Log: kenv MFC: r335998, r336019, r336026, r336036, r336217, r336335, r336337, r336415-r336416, r336419 As an aside- this has been slightly altered from the version in head to keep the MD and config-static environments mutually exclusive by default. This difference is a one-line change in init_static_kenv to setup the MD environment if the config-static environment is empty or if loader_env.disabled is explicitly set to 0. r335998: kern_environment: use any provided environments, evict hintmode/envmode At the moment, hintmode and envmode are used to indicate whether static hints or static env have been provided in the kernel config(5) and the static versions are mutually exclusive with loader(8)-provided environment. hintmode *can* be reconfigured later to pull from the dynamic environment, thus taking advantage of the loader(8) or post-kmem environment setting. This changeset fixes both problems at once to move us from a semi-confusing state to a consistent state: if an environment file, hints file, or loader(8) environment are provided, we use them in a well-known order of precedence: - loader(8) environment - static environment - static hints file Once the dynamic environment is setup this becomes a moot point. The loader(8) and static environments are merged (respecting the above order of precedence), and the static hints are merged in on an as-needed basis after the dynamic environment has been setup. Hints lookup are changed to respect all of the above. Before the dynamic environment is setup, lookups use the above-mentioned order and fallback to the next environment if a matching hint is not found. Once the dynamic environment is setup, that is used on its own since it captures all of the above information plus any dynamic kenv settings that came up later in boot. The following tangentially related changes were made to res_find: - A hintp cookie is now passed in so that related searches continue using the chain of environments (or dynamic environment) without relying on global state - All three environments will be searched if they actually have valid hints to use, rather than just choosing the first environment that actually had a hint and rolling with that only The hintmode sysctl has been ripped out. static_{env,hints}.disabled are still honored and will disable their respective environments from being used for hint lookups and from being merged into the dynamic environment, as expected. r336019: config(8): De-dupe hint/env vars within a single file r335653 flipped the order in which hints/env files are concatenated to match the order in which vars are processed by the kernel. This is the other hammer to drop. Use nv(9) to de-dupe entries within a single `hint` or `env` file, using the latest value specified for a key. This leaves some duplicates if a variable is specified in multiple hint/env files or via `envvar` in a kernel config, but the reversed order of concatenation (from r335653) makes this a non-issue as the latest-specified version will be seen first. This change also silently rewrote hint bits to use the same sanitization process that ian@ wrote for r335642. To the kernel, hints and env vars are basically the same thing through early boot, then get merged into the dynamic environment once kmem becomes available and the dynamic environment is created. They should be subjected to the same restrictions. libnv has been added to -legacy for the time being to support the build of config(8) with the new cnvlist API. r336026: config(8): Fix broken ABI r336019 introduced ${SRCTOP}/sys to the include paths in order to pull in a new sys/{c,}nv.h. This is wrong, because the build tree's ABI isn't guaranteed to match what's running on the host system. Fix instead by removing -I${SRCTOP}/sys and installing the libnv headers with `make -C lib/libnv includes`... this may or may not get re-worked in the future so that a userland lib isn't installing includes from sys/. r336036: kern_environment: Fix SYSINIT ordering The dynamic environment was being initialized at SI_SUB_KMEM, SI_ORDER_ANY. I added the hint-merging at SI_SUB_KMEM, SI_ORDER_ANY as well in r335998 - this can only work by coincidence. Re-do both to operate at SI_SUB_KMEM + 1, SI_ORDER_FIRST and SI_ORDER_SECOND respectively to be safe. It's sufficiently obfuscated away as to when in SU_SUB_KMEM malloc will be available, and the dynamic environment cannot be relied upon there anyways since it's initialized at SI_ORDER_ANY. r336217: kern_environment: Give the static environment a chance to disable MD env This variable has been given the name "loader_env.disabled" as it's the primary way most people will have an MD environment. This restores the previously-default behavior of ignoring the loader(8) environment, which may be useful for vendor distributions or other scenarios where inheriting the loader environment may be considered a security issue or potentially breaking of a more locked-down environment. As the change to config(5) indicates, disabling the loader environment should not be a choice made lightly since it may provide ACPI hints and other useful things that the system can rely on to boot. An UPDATING entry has been added to mention an upgrade path for those that may have relied on the previous behavior. r336335 by arichardson: No longer install sys/nv.h and sys/cnv.h in lib/libnv/Makefile Use tools/build/Makefile to install the headers into ${WORLDTMP}/legacy instead. Compared to r336026 this has the minor advantage that it avoids unncessary header installation when building the non-bootstrap libnv. r336337: Unconditionally build libnv in legacy Rather than using a config(8) built from new tree linking libnv built on host. r336415: config(8): Add compatibility shims for r335998 Plumb the %VERSREQ from Makefile. through to the rest of config(8). We've recorded the config(8) version that we're calling "the end of envmode and hintmode," and we'll write them out for earlier versions. Later kernel version bumps will remove envmode/hintmode from the kernel as needed, which is OK since the current kernel does not use them at all. These compatibility shims really need to go away when the major version rolls over... r336416: Fix GCC 4.2 build after r336415, proper declaration and prototype r336419: config(8): Invert checks; envmode/hintmode reflect "env provided" Relnotes: yes (maybe) [The loader environment may now be used with the config-static environment by specifying loader_env.disabled=0 in the config-static environment] Modified: stable/11/Makefile.inc1 stable/11/sys/kern/kern_environment.c stable/11/sys/kern/subr_hints.c stable/11/sys/sys/systm.h stable/11/tools/build/Makefile stable/11/usr.sbin/config/Makefile stable/11/usr.sbin/config/config.5 stable/11/usr.sbin/config/config.h stable/11/usr.sbin/config/config.y stable/11/usr.sbin/config/configvers.h stable/11/usr.sbin/config/main.c stable/11/usr.sbin/config/mkmakefile.c Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/Makefile.inc1 Sat Aug 4 21:57:17 2018 (r337333) @@ -1629,7 +1629,7 @@ legacy: .PHONY @echo "ERROR: Source upgrades from versions prior to ${MINIMUM_SUPPORTED_REL} are not supported."; \ false .endif -.for _tool in tools/build ${_elftoolchain_libs} +.for _tool in tools/build ${_elftoolchain_libs} lib/libnv ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \ cd ${.CURDIR}/${_tool}; \ ${MAKE} DIRPRFX=${_tool}/ obj; \ Modified: stable/11/sys/kern/kern_environment.c ============================================================================== --- stable/11/sys/kern/kern_environment.c Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/sys/kern/kern_environment.c Sat Aug 4 21:57:17 2018 (r337333) @@ -55,14 +55,21 @@ __FBSDID("$FreeBSD$"); #include +static char *_getenv_dynamic_locked(const char *name, int *idx); +static char *_getenv_dynamic(const char *name, int *idx); + static MALLOC_DEFINE(M_KENV, "kenv", "kernel environment"); #define KENV_SIZE 512 /* Maximum number of environment strings */ -/* pointer to the static environment */ +/* pointer to the config-generated static environment */ char *kern_envp; -static int env_len; -static int env_pos; + +/* pointer to the md-static environment */ +char *md_envp; +static int md_env_len; +static int md_env_pos; + static char *kernenv_next(char *); /* dynamic environment variables */ @@ -218,16 +225,9 @@ done: * environment obtained from a boot loader, or to provide an empty buffer into * which MD code can store an initial environment using kern_setenv() calls. * - * When a copy of an initial environment is passed in, we start by scanning that - * env for overrides to the compiled-in envmode and hintmode variables. + * kern_envp is set to the static_env generated by config(8). This implements + * the env keyword described in config(5). * - * If the global envmode is 1, the environment is initialized from the global - * static_env[], regardless of the arguments passed. This implements the env - * keyword described in config(5). In this case env_pos is set to env_len, - * causing kern_setenv() to return -1 (if len > 0) or panic (if len == 0) until - * the dynamic environment is available. The envmode and static_env variables - * are defined in env.c which is generated by config(8). - * * If len is non-zero, the caller is providing an empty buffer. The caller will * subsequently use kern_setenv() to add up to len bytes of initial environment * before the dynamic environment is available. @@ -235,72 +235,126 @@ done: * If len is zero, the caller is providing a pre-loaded buffer containing * environment strings. Additional strings cannot be added until the dynamic * environment is available. The memory pointed to must remain stable at least - * until sysinit runs init_dynamic_kenv(). If no initial environment is - * available from the boot loader, passing a NULL pointer allows the static_env - * to be installed if it is configured. + * until sysinit runs init_dynamic_kenv() and preferably until after SI_SUB_KMEM + * is finished so that subr_hints routines may continue to use it until the + * environments have been fully merged at the end of the pass. If no initial + * environment is available from the boot loader, passing a NULL pointer allows + * the static_env to be installed if it is configured. In this case, any call + * to kern_setenv() prior to the setup of the dynamic environment will result in + * a panic. */ void init_static_kenv(char *buf, size_t len) { - char *cp; - - for (cp = buf; cp != NULL && cp[0] != '\0'; cp += strlen(cp) + 1) { - if (strcmp(cp, "static_env.disabled=1") == 0) - envmode = 0; - if (strcmp(cp, "static_hints.disabled=1") == 0) - hintmode = 0; - } + char *eval; - if (envmode == 1) { - kern_envp = static_env; - env_len = len; - env_pos = len; - } else { - kern_envp = buf; - env_len = len; - env_pos = 0; + /* + * Give the static environment a chance to disable the loader(8) + * environment first. This is done with loader_env.disabled=1. + * + * static_env and static_hints may both be disabled, but in slightly + * different ways. For static_env, we just don't setup kern_envp and + * it's as if a static env wasn't even provided. For static_hints, + * we effectively zero out the buffer to stop the rest of the kernel + * from being able to use it. + * + * We're intentionally setting this up so that static_hints.disabled may + * be specified in either the MD env or the static env. This keeps us + * consistent in our new world view. + * + * As a warning, the static environment may not be disabled in any way + * if the static environment has disabled the loader environment. + */ + kern_envp = static_env; + eval = kern_getenv("loader_env.disabled"); + if (*kern_envp == '\0' || (eval != NULL && strcmp(eval, "0") == 0)) { + md_envp = buf; + md_env_len = len; + md_env_pos = 0; + + eval = kern_getenv("static_env.disabled"); + if (eval != NULL && strcmp(eval, "1") == 0) + *kern_envp = '\0'; } + eval = kern_getenv("static_hints.disabled"); + if (eval != NULL && strcmp(eval, "1") == 0) + *static_hints = '\0'; } -/* - * Setup the dynamic kernel environment. - */ static void -init_dynamic_kenv(void *data __unused) +init_dynamic_kenv_from(char *init_env, int *curpos) { - char *cp, *cpnext; + char *cp, *cpnext, *eqpos, *found; size_t len; int i; - kenvp = malloc((KENV_SIZE + 1) * sizeof(char *), M_KENV, - M_WAITOK | M_ZERO); - i = 0; - if (kern_envp && *kern_envp != '\0') { - for (cp = kern_envp; cp != NULL; cp = cpnext) { + if (init_env && *init_env != '\0') { + found = NULL; + i = *curpos; + for (cp = init_env; cp != NULL; cp = cpnext) { cpnext = kernenv_next(cp); len = strlen(cp) + 1; if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) { printf( "WARNING: too long kenv string, ignoring %s\n", cp); - continue; + goto sanitize; } - if (i < KENV_SIZE) { - kenvp[i] = malloc(len, M_KENV, M_WAITOK); - strcpy(kenvp[i++], cp); - explicit_bzero(cp, strlen(cp)); - } else + eqpos = strchr(cp, '='); + if (eqpos == NULL) { printf( + "WARNING: malformed static env value, ignoring %s\n", + cp); + goto sanitize; + } + *eqpos = 0; + /* + * De-dupe the environment as we go. We don't add the + * duplicated assignments because config(8) will flip + * the order of the static environment around to make + * kernel processing match the order of specification + * in the kernel config. + */ + found = _getenv_dynamic_locked(cp, NULL); + *eqpos = '='; + if (found != NULL) + goto sanitize; + if (i > KENV_SIZE) { + printf( "WARNING: too many kenv strings, ignoring %s\n", cp); + goto sanitize; + } + + kenvp[i] = malloc(len, M_KENV, M_WAITOK); + strcpy(kenvp[i++], cp); +sanitize: + explicit_bzero(cp, len - 1); } + *curpos = i; } - kenvp[i] = NULL; +} +/* + * Setup the dynamic kernel environment. + */ +static void +init_dynamic_kenv(void *data __unused) +{ + int dynamic_envpos; + + kenvp = malloc((KENV_SIZE + 1) * sizeof(char *), M_KENV, + M_WAITOK | M_ZERO); + + dynamic_envpos = 0; + init_dynamic_kenv_from(md_envp, &dynamic_envpos); + init_dynamic_kenv_from(kern_envp, &dynamic_envpos); + kenvp[dynamic_envpos] = NULL; + mtx_init(&kenv_lock, "kernel environment", NULL, MTX_DEF); dynamic_kenv = 1; } -SYSINIT(kenv, SI_SUB_KMEM, SI_ORDER_ANY, init_dynamic_kenv, NULL); +SYSINIT(kenv, SI_SUB_KMEM + 1, SI_ORDER_FIRST, init_dynamic_kenv, NULL); void freeenv(char *env) @@ -316,12 +370,11 @@ freeenv(char *env) * Internal functions for string lookup. */ static char * -_getenv_dynamic(const char *name, int *idx) +_getenv_dynamic_locked(const char *name, int *idx) { char *cp; int len, i; - mtx_assert(&kenv_lock, MA_OWNED); len = strlen(name); for (cp = kenvp[0], i = 0; cp != NULL; cp = kenvp[++i]) { if ((strncmp(cp, name, len) == 0) && @@ -335,12 +388,20 @@ _getenv_dynamic(const char *name, int *idx) } static char * -_getenv_static(const char *name) +_getenv_dynamic(const char *name, int *idx) { + + mtx_assert(&kenv_lock, MA_OWNED); + return (_getenv_dynamic_locked(name, idx)); +} + +static char * +_getenv_static_from(char *chkenv, const char *name) +{ char *cp, *ep; int len; - for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) { + for (cp = chkenv; cp != NULL; cp = kernenv_next(cp)) { for (ep = cp; (*ep != '=') && (*ep != 0); ep++) ; if (*ep != '=') @@ -353,6 +414,20 @@ _getenv_static(const char *name) return (NULL); } +static char * +_getenv_static(const char *name) +{ + char *val; + + val = _getenv_static_from(md_envp, name); + if (val != NULL) + return (val); + val = _getenv_static_from(kern_envp, name); + if (val != NULL) + return (val); + return (NULL); +} + /* * Look up an environment variable by name. * Return a pointer to the string if found. @@ -397,20 +472,25 @@ testenv(const char *name) return (0); } +/* + * Set an environment variable in the MD-static environment. This cannot + * feasibly be done on config(8)-generated static environments as they don't + * generally include space for extra variables. + */ static int setenv_static(const char *name, const char *value) { int len; - if (env_pos >= env_len) + if (md_env_pos >= md_env_len) return (-1); /* Check space for x=y and two nuls */ len = strlen(name) + strlen(value); - if (len + 3 < env_len - env_pos) { - len = sprintf(&kern_envp[env_pos], "%s=%s", name, value); - env_pos += len+1; - kern_envp[env_pos] = '\0'; + if (len + 3 < md_env_len - md_env_pos) { + len = sprintf(&md_envp[md_env_pos], "%s=%s", name, value); + md_env_pos += len+1; + md_envp[md_env_pos] = '\0'; return (0); } else return (-1); @@ -426,7 +506,7 @@ kern_setenv(const char *name, const char *value) char *buf, *cp, *oldenv; int namelen, vallen, i; - if (dynamic_kenv == 0 && env_len > 0) + if (dynamic_kenv == 0 && md_env_len > 0) return (setenv_static(name, value)); KENV_CHECK; Modified: stable/11/sys/kern/subr_hints.c ============================================================================== --- stable/11/sys/kern/subr_hints.c Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/sys/kern/subr_hints.c Sat Aug 4 21:57:17 2018 (r337333) @@ -29,61 +29,36 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include -#define HINTMODE_KENV 0 -#define HINTMODE_STATIC 1 -#define HINTMODE_FALLBACK 2 +#define FBACK_MDENV 0 /* MD env (e.g. loader.conf) */ +#define FBACK_STENV 1 /* Static env */ +#define FBACK_STATIC 2 /* static_hints */ /* - * Access functions for device resources. + * We'll use hintenv_merged to indicate that the dynamic environment has been + * properly prepared for hint usage. This implies that the dynamic environment + * has already been setup (dynamic_kenv) and that we have added any supplied + * static_hints to the dynamic environment. */ +static int hintenv_merged; -static int checkmethod = 1; -static char *hintp; - /* - * Define kern.hintmode sysctl, which only accept value 2, that cause to - * switch from Static KENV mode to Dynamic KENV. So systems that have hints - * compiled into kernel will be able to see/modify KENV (and hints too). + * Access functions for device resources. */ -static int -sysctl_hintmode(SYSCTL_HANDLER_ARGS) +static void +static_hints_to_env(void *data __unused) { const char *cp; char *line, *eq; - int eqidx, error, i, value; + int eqidx, i; - value = hintmode; - - /* Fetch candidate for new hintmode value */ - error = sysctl_handle_int(oidp, &value, 0, req); - if (error || req->newptr == NULL) - return (error); - - if (value != HINTMODE_FALLBACK) - /* Only accept swithing to hintmode 2 */ - return (EINVAL); - - /* - * The rest of the sysctl handler is just making sure that our - * environment is consistent with the world we've already seen. - * If we came from kenv at all, then we have nothing to do: static - * kenv will get merged into dynamic kenv as soon as kmem becomes - * available, dynamic kenv is the environment we'd be setting these - * things in anyways. Therefore, we have nothing left to do unless - * we came from a static hints configuration. - */ - if (hintmode != HINTMODE_STATIC) { - hintmode = value; - return (0); - } - cp = static_hints; while (cp && *cp != '\0') { eq = strchr(cp, '='); @@ -93,103 +68,152 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) eqidx = eq - cp; i = strlen(cp); - line = malloc(i+1, M_TEMP, M_WAITOK); + line = malloc(i + 1, M_TEMP, M_WAITOK); strcpy(line, cp); - line[eqidx] = '\0'; - kern_setenv(line, line + eqidx + 1); + line[eqidx] = line[i] = '\0'; + /* + * Before adding a hint to the dynamic environment, check if + * another value for said hint has already been added. This is + * needed because static environment overrides static hints and + * dynamic environment overrides all. + */ + if (testenv(line) == 0) + kern_setenv(line, line + eqidx + 1); free(line, M_TEMP); cp += i + 1; } - - hintmode = value; - return (0); + hintenv_merged = 1; } -SYSCTL_PROC(_kern, OID_AUTO, hintmode, CTLTYPE_INT|CTLFLAG_RW, - &hintmode, 0, sysctl_hintmode, "I", "Get/set current hintmode"); +/* Any time after dynamic env is setup */ +SYSINIT(hintenv, SI_SUB_KMEM + 1, SI_ORDER_SECOND, static_hints_to_env, NULL); /* + * Checks the environment to see if we even have any hints. If it has no hints, + * then res_find can take the hint that there's no point in searching it and + * either move on to the next environment or fail early. + */ +static bool +_res_checkenv(char *envp) +{ + char *cp; + + cp = envp; + while (cp) { + if (strncmp(cp, "hint.", 5) == 0) + return (true); + while (*cp != '\0') + cp++; + cp++; + if (*cp == '\0') + break; + } + return (false); +} + +/* * Evil wildcarding resource string lookup. * This walks the supplied env string table and returns a match. * The start point can be remembered for incremental searches. */ static int -res_find(int *line, int *startln, +res_find(char **hintp_cookie, int *line, int *startln, const char *name, int *unit, const char *resname, const char *value, const char **ret_name, int *ret_namelen, int *ret_unit, const char **ret_resname, int *ret_resnamelen, const char **ret_value) { - int n = 0, hit, i = 0; + int dyn_used = 0, fbacklvl = FBACK_MDENV, hit, i = 0, n = 0; char r_name[32]; - int r_unit, use_kenv = (hintmode != HINTMODE_STATIC && dynamic_kenv); + int r_unit; char r_resname[32]; char r_value[128]; const char *s, *cp; - char *p; + char *hintp, *p; - if (checkmethod) { - hintp = NULL; - switch (hintmode) { - case HINTMODE_KENV: /* loader hints in environment only */ - break; - case HINTMODE_STATIC: /* static hints only */ - hintp = static_hints; - checkmethod = 0; - break; - case HINTMODE_FALLBACK: /* fallback mode */ - if (dynamic_kenv) { - mtx_lock(&kenv_lock); - cp = kenvp[0]; - for (i = 0; cp != NULL; cp = kenvp[++i]) { - if (!strncmp(cp, "hint.", 5)) { - use_kenv = 1; - checkmethod = 0; - break; - } + /* + * We are expecting that the caller will pass us a hintp_cookie that + * they are tracking. Upon entry, if *hintp_cookie is *not* set, this + * indicates to us that we should be figuring out based on the current + * environment where to search. This keeps us sane throughout the + * entirety of a single search. + */ + if (*hintp_cookie == NULL) { + hintp = NULL; + if (hintenv_merged) { + /* + * static_hints, if it was previously used, has + * already been folded in to the environment + * by this point. + */ + mtx_lock(&kenv_lock); + cp = kenvp[0]; + for (i = 0; cp != NULL; cp = kenvp[++i]) { + if (!strncmp(cp, "hint.", 5)) { + hintp = kenvp[0]; + break; } - mtx_unlock(&kenv_lock); - } else { - cp = kern_envp; - while (cp) { - if (strncmp(cp, "hint.", 5) == 0) { - cp = NULL; - hintp = kern_envp; - break; - } - while (*cp != '\0') - cp++; - cp++; - if (*cp == '\0') { - cp = NULL; - hintp = static_hints; - break; - } - } } - break; - default: - break; - } - if (hintp == NULL) { - if (dynamic_kenv) { - use_kenv = 1; - checkmethod = 0; - } else + mtx_unlock(&kenv_lock); + dyn_used = 1; + } else { + /* + * We'll have a chance to keep coming back here until + * we've actually exhausted all of our possibilities. + * We might have chosen the MD/Static env because it + * had some kind of hints, but perhaps it didn't have + * the hint we are looking for. We don't provide any + * fallback when searching the dynamic environment. + */ +fallback: + if (dyn_used || fbacklvl >= FBACK_STATIC) + return (ENOENT); + + if (fbacklvl <= FBACK_MDENV && + _res_checkenv(md_envp)) { + hintp = md_envp; + goto found; + } + fbacklvl++; + + if (fbacklvl <= FBACK_STENV && + _res_checkenv(kern_envp)) { hintp = kern_envp; + goto found; + } + fbacklvl++; + + /* We'll fallback to static_hints if needed/can */ + if (fbacklvl <= FBACK_STATIC && + _res_checkenv(static_hints)) + hintp = static_hints; +found: + fbacklvl++; } + + if (hintp == NULL) + return (ENOENT); + *hintp_cookie = hintp; + } else { + hintp = *hintp_cookie; + if (hintenv_merged && hintp == kenvp[0]) + dyn_used = 1; + else + /* + * If we aren't using the dynamic environment, we need + * to run through the proper fallback procedure again. + * This is so that we do continuations right if we're + * working with *line and *startln. + */ + goto fallback; } - if (use_kenv) { + if (dyn_used) { mtx_lock(&kenv_lock); i = 0; - cp = kenvp[0]; - if (cp == NULL) { - mtx_unlock(&kenv_lock); - return (ENOENT); - } - } else - cp = hintp; + } + + cp = hintp; while (cp) { hit = 1; (*line)++; @@ -198,25 +222,28 @@ res_find(int *line, int *startln, else n = sscanf(cp, "hint.%32[^.].%d.%32[^=]=%127s", r_name, &r_unit, r_resname, r_value); - if (hit && n != 4) { - printf("CONFIG: invalid hint '%s'\n", cp); - p = strchr(cp, 'h'); - *p = 'H'; - hit = 0; + /* We'll circumvent all of the checks if we already know */ + if (hit) { + if (n != 4) { + printf("CONFIG: invalid hint '%s'\n", cp); + p = strchr(cp, 'h'); + *p = 'H'; + hit = 0; + } + if (hit && startln && *startln >= 0 && *line < *startln) + hit = 0; + if (hit && name && strcmp(name, r_name) != 0) + hit = 0; + if (hit && unit && *unit != r_unit) + hit = 0; + if (hit && resname && strcmp(resname, r_resname) != 0) + hit = 0; + if (hit && value && strcmp(value, r_value) != 0) + hit = 0; + if (hit) + break; } - if (hit && startln && *startln >= 0 && *line < *startln) - hit = 0; - if (hit && name && strcmp(name, r_name) != 0) - hit = 0; - if (hit && unit && *unit != r_unit) - hit = 0; - if (hit && resname && strcmp(resname, r_resname) != 0) - hit = 0; - if (hit && value && strcmp(value, r_value) != 0) - hit = 0; - if (hit) - break; - if (use_kenv) { + if (dyn_used) { cp = kenvp[++i]; if (cp == NULL) break; @@ -230,10 +257,10 @@ res_find(int *line, int *startln, } } } - if (use_kenv) + if (dyn_used) mtx_unlock(&kenv_lock); if (cp == NULL) - return ENOENT; + goto fallback; s = cp; /* This is a bit of a hack, but at least is reentrant */ @@ -271,11 +298,13 @@ resource_find(int *line, int *startln, { int i; int un; + char *hintp; *line = 0; + hintp = NULL; /* Search for exact unit matches first */ - i = res_find(line, startln, name, unit, resname, value, + i = res_find(&hintp, line, startln, name, unit, resname, value, ret_name, ret_namelen, ret_unit, ret_resname, ret_resnamelen, ret_value); if (i == 0) @@ -284,7 +313,7 @@ resource_find(int *line, int *startln, return ENOENT; /* If we are still here, search for wildcard matches */ un = -1; - i = res_find(line, startln, name, &un, resname, value, + i = res_find(&hintp, line, startln, name, &un, resname, value, ret_name, ret_namelen, ret_unit, ret_resname, ret_resnamelen, ret_value); if (i == 0) Modified: stable/11/sys/sys/systm.h ============================================================================== --- stable/11/sys/sys/systm.h Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/sys/sys/systm.h Sat Aug 4 21:57:17 2018 (r337333) @@ -148,11 +148,10 @@ void kassert_panic(const char *fmt, ...) __printflike * XXX most of these variables should be const. */ extern int osreldate; -extern int envmode; -extern int hintmode; /* 0 = off. 1 = config, 2 = fallback */ extern int dynamic_kenv; extern struct mtx kenv_lock; extern char *kern_envp; +extern char *md_envp; extern char static_env[]; extern char static_hints[]; /* by config for now */ Modified: stable/11/tools/build/Makefile ============================================================================== --- stable/11/tools/build/Makefile Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/tools/build/Makefile Sat Aug 4 21:57:17 2018 (r337333) @@ -49,4 +49,7 @@ SRCS= dummy.c SUBDIR= cross-build .endif +# Needed to build config (since it uses libnv) +SYSINCS+= ${SRCTOP}/sys/sys/nv.h ${SRCTOP}/sys/sys/cnv.h + .include Modified: stable/11/usr.sbin/config/Makefile ============================================================================== --- stable/11/usr.sbin/config/Makefile Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/usr.sbin/config/Makefile Sat Aug 4 21:57:17 2018 (r337333) @@ -18,7 +18,7 @@ CFLAGS+= -I. -I${SRCDIR} NO_WMISSING_VARIABLE_DECLARATIONS= -LIBADD= l sbuf +LIBADD= l nv sbuf CLEANFILES+= kernconf.c Modified: stable/11/usr.sbin/config/config.5 ============================================================================== --- stable/11/usr.sbin/config/config.5 Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/usr.sbin/config/config.5 Sat Aug 4 21:57:17 2018 (r337333) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 26, 2018 +.Dd July 11, 2018 .Dt CONFIG 5 .Os .Sh NAME @@ -114,13 +114,36 @@ are defined in the file .Pp .It Ic env Ar filename Specifies a filename containing a kernel environment definition. -The kernel normally uses an environment prepared for it at boot time -by +.Pp +The kernel will augment this compiled-in environment with the environment +prepared for it at boot time by .Xr loader 8 . -This directive makes the kernel ignore the boot environment and use -the compiled-in environment instead, unless the boot environment contains -.Va static_env.disabled=1 . +Environment variables specified in the +.Xr loader 8 +environment will take precedence over environment variables specified in +.Ar filename , +and environment variables specified in the dynamic environment take precedence +over both of these. .Pp +.Va loader_env.disabled=1 +may be specified in the static environment to disable the +.Xr loader 8 +environment. +Disabling the +.Xr loader 8 +should be done with caution and due consideration for whether or not it supplies +environment variables needed for properly booting the system. +.Pp +.Va static_env.disabled=1 +may be specified in the +.Xr loader 8 +environment to disable use of the static environment. +This option has no effect if specified in any environment after the +.Xr loader 8 +environment is processed. +This option is not usable in conjunction with +.Va loader_env.disabled . +.Pp This directive is useful for setting kernel tunables in embedded environments that do not start from .Xr loader 8 . @@ -172,9 +195,28 @@ time (see .Xr device.hints 5 ) . This directive configures the kernel to use the static device configuration listed in -.Ar filename , -unless the boot environment contains -.Va static_hints.disabled=1 . +.Ar filename . +.Pp +Hints provided in this static device configuration will be overwritten in the +order in which they're encountered. +Hints in the compiled-in environment takes precedence over compiled-in hints, +and hints in the environment prepared for the kernel by +.Xr loader 8 +takes precedence over hints in the compiled-in environment. +.Pp +Once the dynamic environment becomes available, all compiled-in hints will be +added to the dynamic environment if they do not already have an override in +the dynamic environment. +The dynamic environment will then be used for all searches of hints. +.Pp +.Va static_hints.disabled=1 +may be specified in either a compiled-in environment or the +.Xr loader 8 +environment to disable use of these hints files. +This option has no effect if specified in any environment after the +.Xr loader 8 +environment is processed. +.Pp The file .Ar filename must conform to the syntax specified by Modified: stable/11/usr.sbin/config/config.h ============================================================================== --- stable/11/usr.sbin/config/config.h Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/usr.sbin/config/config.h Sat Aug 4 21:57:17 2018 (r337333) @@ -177,8 +177,6 @@ SLIST_HEAD(, includepath) includepath; extern char *ident; extern char kernconfstr[]; extern int do_trace; -extern int envmode; -extern int hintmode; extern int incignore; char *get_word(FILE *); @@ -212,6 +210,7 @@ extern int debugging; extern int found_defaults; extern int maxusers; +extern int versreq; extern char *PREFIX; /* Config file name - for error messages */ extern char srcdir[]; /* root of the kernel source tree */ Modified: stable/11/usr.sbin/config/config.y ============================================================================== --- stable/11/usr.sbin/config/config.y Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/usr.sbin/config/config.y Sat Aug 4 21:57:17 2018 (r337333) @@ -80,8 +80,7 @@ struct device_head dtab; char *ident; -int envmode; -int hintmode; +char *env; int yyline; const char *yyfile; struct file_list_head ftab; @@ -199,7 +198,6 @@ Config_spec: err(EXIT_FAILURE, "calloc"); hint->hint_name = $2; STAILQ_INSERT_HEAD(&hints, hint, hint_next); - hintmode = 1; } System_spec: @@ -359,7 +357,6 @@ newenvvar(char *name, bool is_file) envvar->env_str = name; envvar->env_is_file = is_file; STAILQ_INSERT_HEAD(&envvars, envvar, envvar_next); - envmode = 1; } /* Modified: stable/11/usr.sbin/config/configvers.h ============================================================================== --- stable/11/usr.sbin/config/configvers.h Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/usr.sbin/config/configvers.h Sat Aug 4 21:57:17 2018 (r337333) @@ -49,5 +49,8 @@ * * $FreeBSD$ */ -#define CONFIGVERS 600015 +#define CONFIGVERS 600016 #define MAJOR_VERS(x) ((x) / 100000) + +/* Last config(8) version to require envmode/hintmode */ +#define CONFIGVERS_ENVMODE_REQ 600015 Modified: stable/11/usr.sbin/config/main.c ============================================================================== --- stable/11/usr.sbin/config/main.c Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/usr.sbin/config/main.c Sat Aug 4 21:57:17 2018 (r337333) @@ -84,12 +84,14 @@ int incignore; * literally). */ int filebased = 0; +int versreq; static void configfile(void); static void get_srcdir(void); static void usage(void); static void cleanheaders(char *); static void kernconfdump(const char *); +static void badversion(void); static void checkversion(void); extern int yyparse(void); @@ -740,8 +742,8 @@ kernconfdump(const char *file) fclose(fp); } -static void -badversion(int versreq) +static void +badversion(void) { fprintf(stderr, "ERROR: version of config(8) does not match kernel!\n"); fprintf(stderr, "config version = %d, ", CONFIGVERS); @@ -761,7 +763,6 @@ checkversion(void) { FILE *ifp; char line[BUFSIZ]; - int versreq; ifp = open_makefile_template(); while (fgets(line, BUFSIZ, ifp) != 0) { @@ -773,7 +774,7 @@ checkversion(void) if (MAJOR_VERS(versreq) == MAJOR_VERS(CONFIGVERS) && versreq <= CONFIGVERS) continue; - badversion(versreq); + badversion(); } fclose(ifp); } Modified: stable/11/usr.sbin/config/mkmakefile.c ============================================================================== --- stable/11/usr.sbin/config/mkmakefile.c Sat Aug 4 21:54:30 2018 (r337332) +++ stable/11/usr.sbin/config/mkmakefile.c Sat Aug 4 21:57:17 2018 (r337333) @@ -47,6 +47,8 @@ static const char rcsid[] = #include #include #include +#include +#include #include #include "y.tab.h" #include "config.h" @@ -60,6 +62,10 @@ static void do_objs(FILE *); static void do_before_depend(FILE *); static int opteq(const char *, const char *); static void read_files(void); +static void sanitize_envline(char *result, const char *src); +static void process_into_file(char *line, FILE *ofp); +static void process_into_nvlist(char *line, nvlist_t *nvl); +static void dump_nvlist(nvlist_t *nvl, FILE *ofp); static void errout(const char *fmt, ...) { @@ -178,65 +184,6 @@ makefile(void) moveifchanged(path("Makefile.new"), path("Makefile")); } -/* - * Build hints.c from the skeleton - */ -void -makehints(void) -{ - FILE *ifp, *ofp; - char line[BUFSIZ]; - char *s; - struct hint *hint; - - ofp = fopen(path("hints.c.new"), "w"); - if (ofp == NULL) - err(1, "%s", path("hints.c.new")); - fprintf(ofp, "#include \n"); - fprintf(ofp, "#include \n"); - fprintf(ofp, "\n"); - fprintf(ofp, "int hintmode = %d;\n", hintmode); - fprintf(ofp, "char static_hints[] = {\n"); - STAILQ_FOREACH(hint, &hints, hint_next) { - ifp = fopen(hint->hint_name, "r"); - if (ifp == NULL) - err(1, "%s", hint->hint_name); - while (fgets(line, BUFSIZ, ifp) != NULL) { - /* zap trailing CR and/or LF */ - while ((s = strrchr(line, '\n')) != NULL) - *s = '\0'; - while ((s = strrchr(line, '\r')) != NULL) - *s = '\0'; - /* remove # comments */ - s = strchr(line, '#'); - if (s) - *s = '\0'; - /* remove any whitespace and " characters */ - s = line; - while (*s) { - if (*s == ' ' || *s == '\t' || *s == '"') { - while (*s) { - s[0] = s[1]; - s++; - } - /* start over */ - s = line; - continue; - } - s++; - } - /* anything left? */ - if (*line == '\0') - continue; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Sat Aug 4 22:12:13 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C1581054EC6; Sat, 4 Aug 2018 22:12:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C6A4A8AEC9; Sat, 4 Aug 2018 22:12:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7D4A1572E; Sat, 4 Aug 2018 22:12:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w74MCCe7061697; Sat, 4 Aug 2018 22:12:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w74MCC5W061696; Sat, 4 Aug 2018 22:12:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201808042212.w74MCC5W061696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 4 Aug 2018 22:12: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: r337335 - stable/11/usr.sbin/config X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.sbin/config X-SVN-Commit-Revision: 337335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 04 Aug 2018 22:12:13 -0000 Author: kevans Date: Sat Aug 4 22:12:12 2018 New Revision: 337335 URL: https://svnweb.freebsd.org/changeset/base/337335 Log: MFC r336973-r336975 r336973: config(8): Strip comments from env lines Consolidates the small bits of logic required for preprocessing a line before inclusion into a file or nvlist. r336974: Re-insert variable disappeared during mis-application of r336973 r336975: Remove variable re-inserted during mis-application of r336973 Modified: stable/11/usr.sbin/config/mkmakefile.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/config/mkmakefile.c ============================================================================== --- stable/11/usr.sbin/config/mkmakefile.c Sat Aug 4 22:08:24 2018 (r337334) +++ stable/11/usr.sbin/config/mkmakefile.c Sat Aug 4 22:12:12 2018 (r337335) @@ -63,6 +63,7 @@ static void do_before_depend(FILE *); static int opteq(const char *, const char *); static void read_files(void); static void sanitize_envline(char *result, const char *src); +static bool preprocess(char *line, char *result); static void process_into_file(char *line, FILE *ofp); static void process_into_nvlist(char *line, nvlist_t *nvl); static void dump_nvlist(nvlist_t *nvl, FILE *ofp); @@ -241,16 +242,29 @@ sanitize_envline(char *result, const char *src) *dst = 0; } +/* + * Returns true if the caller may use the string. + */ +static bool +preprocess(char *line, char *result) +{ + char *s; + + /* Strip any comments */ + if ((s = strchr(line, '#')) != NULL) + *s = '\0'; + sanitize_envline(result, line); + /* Return true if it's non-empty */ + return (*result != '\0'); +} + static void process_into_file(char *line, FILE *ofp) { char result[BUFSIZ]; - sanitize_envline(result, line); - /* anything left? */ - if (*result == '\0') - return; - fprintf(ofp, "\"%s\\0\"\n", result); + if (preprocess(line, result)) + fprintf(ofp, "\"%s\\0\"\n", result); } static void @@ -258,15 +272,13 @@ process_into_nvlist(char *line, nvlist_t *nvl) { char result[BUFSIZ], *s; - sanitize_envline(result, line); - /* anything left? */ - if (*result == '\0') - return; - s = strchr(result, '='); - *s = 0; - if (nvlist_exists(nvl, result)) - nvlist_free(nvl, result); - nvlist_add_string(nvl, result, s + 1); + if (preprocess(line, result)) { + s = strchr(result, '='); + *s = '\0'; + if (nvlist_exists(nvl, result)) + nvlist_free(nvl, result); + nvlist_add_string(nvl, result, s + 1); + } } static void From owner-svn-src-stable@freebsd.org Sat Aug 4 22:15:06 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 790F7105523D; Sat, 4 Aug 2018 22:15:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2DFC78B2AA; Sat, 4 Aug 2018 22:15:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F1AC1574C; Sat, 4 Aug 2018 22:15:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w74MF5F5062766; Sat, 4 Aug 2018 22:15:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w74MF5uj062762; Sat, 4 Aug 2018 22:15:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201808042215.w74MF5uj062762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 4 Aug 2018 22:15:05 +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: r337336 - in stable/11/sys: kern sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/sys: kern sys X-SVN-Commit-Revision: 337336 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 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, 04 Aug 2018 22:15:06 -0000 Author: kevans Date: Sat Aug 4 22:15:05 2018 New Revision: 337336 URL: https://svnweb.freebsd.org/changeset/base/337336 Log: MFC r336152-r336154, r336157 r336152: subr_hints: Use goto/label instead of series of conditionals r336153: subr_hints: Convert some bool-like ints to bools r336154: subr_hints: Skip static_env and static_hints if they don't contain hints This is possible because, well, they're static. Both the dynamic environment and the MD-environment (generally loader(8) environment) can potentially have room for new variables to be set, and thus do not receive this treatment. r336157: kern_environment: bool'itize dynamic_kenv; fix small style(9) nit Modified: stable/11/sys/kern/kern_environment.c stable/11/sys/kern/subr_hints.c stable/11/sys/sys/systm.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_environment.c ============================================================================== --- stable/11/sys/kern/kern_environment.c Sat Aug 4 22:12:12 2018 (r337335) +++ stable/11/sys/kern/kern_environment.c Sat Aug 4 22:15:05 2018 (r337336) @@ -37,7 +37,6 @@ #include __FBSDID("$FreeBSD$"); -#include #include #include #include @@ -79,7 +78,7 @@ struct mtx kenv_lock; /* * No need to protect this with a mutex since SYSINITS are single threaded. */ -int dynamic_kenv = 0; +bool dynamic_kenv; #define KENV_CHECK if (!dynamic_kenv) \ panic("%s: called before SI_SUB_KMEM", __func__) @@ -98,7 +97,7 @@ sys_kenv(td, uap) size_t len, done, needed, buflen; int error, i; - KASSERT(dynamic_kenv, ("kenv: dynamic_kenv = 0")); + KASSERT(dynamic_kenv, ("kenv: dynamic_kenv = false")); error = 0; if (uap->what == KENV_DUMP) { @@ -352,7 +351,7 @@ init_dynamic_kenv(void *data __unused) kenvp[dynamic_envpos] = NULL; mtx_init(&kenv_lock, "kernel environment", NULL, MTX_DEF); - dynamic_kenv = 1; + dynamic_kenv = true; } SYSINIT(kenv, SI_SUB_KMEM + 1, SI_ORDER_FIRST, init_dynamic_kenv, NULL); @@ -506,7 +505,7 @@ kern_setenv(const char *name, const char *value) char *buf, *cp, *oldenv; int namelen, vallen, i; - if (dynamic_kenv == 0 && md_env_len > 0) + if (!dynamic_kenv && md_env_len > 0) return (setenv_static(name, value)); KENV_CHECK; Modified: stable/11/sys/kern/subr_hints.c ============================================================================== --- stable/11/sys/kern/subr_hints.c Sat Aug 4 22:12:12 2018 (r337335) +++ stable/11/sys/kern/subr_hints.c Sat Aug 4 22:15:05 2018 (r337336) @@ -46,8 +46,10 @@ __FBSDID("$FreeBSD$"); * has already been setup (dynamic_kenv) and that we have added any supplied * static_hints to the dynamic environment. */ -static int hintenv_merged; - +static bool hintenv_merged; +/* Static environment and static hints cannot change, so we'll skip known bad */ +static bool stenv_skip; +static bool sthints_skip; /* * Access functions for device resources. */ @@ -82,7 +84,7 @@ static_hints_to_env(void *data __unused) free(line, M_TEMP); cp += i + 1; } - hintenv_merged = 1; + hintenv_merged = true; } /* Any time after dynamic env is setup */ @@ -122,13 +124,14 @@ res_find(char **hintp_cookie, int *line, int *startln, const char **ret_name, int *ret_namelen, int *ret_unit, const char **ret_resname, int *ret_resnamelen, const char **ret_value) { - int dyn_used = 0, fbacklvl = FBACK_MDENV, hit, i = 0, n = 0; + int fbacklvl = FBACK_MDENV, i = 0, n = 0; char r_name[32]; int r_unit; char r_resname[32]; char r_value[128]; const char *s, *cp; char *hintp, *p; + bool dyn_used = false; /* @@ -155,7 +158,7 @@ res_find(char **hintp_cookie, int *line, int *startln, } } mtx_unlock(&kenv_lock); - dyn_used = 1; + dyn_used = true; } else { /* * We'll have a chance to keep coming back here until @@ -176,17 +179,21 @@ fallback: } fbacklvl++; - if (fbacklvl <= FBACK_STENV && + if (!stenv_skip && fbacklvl <= FBACK_STENV && _res_checkenv(kern_envp)) { hintp = kern_envp; goto found; - } + } else + stenv_skip = true; + fbacklvl++; /* We'll fallback to static_hints if needed/can */ - if (fbacklvl <= FBACK_STATIC && + if (!sthints_skip && fbacklvl <= FBACK_STATIC && _res_checkenv(static_hints)) hintp = static_hints; + else + sthints_skip = true; found: fbacklvl++; } @@ -197,7 +204,7 @@ found: } else { hintp = *hintp_cookie; if (hintenv_merged && hintp == kenvp[0]) - dyn_used = 1; + dyn_used = true; else /* * If we aren't using the dynamic environment, we need @@ -215,34 +222,30 @@ found: cp = hintp; while (cp) { - hit = 1; (*line)++; if (strncmp(cp, "hint.", 5) != 0) - hit = 0; - else - n = sscanf(cp, "hint.%32[^.].%d.%32[^=]=%127s", - r_name, &r_unit, r_resname, r_value); - /* We'll circumvent all of the checks if we already know */ - if (hit) { - if (n != 4) { - printf("CONFIG: invalid hint '%s'\n", cp); - p = strchr(cp, 'h'); - *p = 'H'; - hit = 0; - } - if (hit && startln && *startln >= 0 && *line < *startln) - hit = 0; - if (hit && name && strcmp(name, r_name) != 0) - hit = 0; - if (hit && unit && *unit != r_unit) - hit = 0; - if (hit && resname && strcmp(resname, r_resname) != 0) - hit = 0; - if (hit && value && strcmp(value, r_value) != 0) - hit = 0; - if (hit) - break; + goto nexthint; + n = sscanf(cp, "hint.%32[^.].%d.%32[^=]=%127s", r_name, &r_unit, + r_resname, r_value); + if (n != 4) { + printf("CONFIG: invalid hint '%s'\n", cp); + p = strchr(cp, 'h'); + *p = 'H'; + goto nexthint; } + if (startln && *startln >= 0 && *line < *startln) + goto nexthint; + if (name && strcmp(name, r_name) != 0) + goto nexthint; + if (unit && *unit != r_unit) + goto nexthint; + if (resname && strcmp(resname, r_resname) != 0) + goto nexthint; + if (value && strcmp(value, r_value) != 0) + goto nexthint; + /* Successfully found a hint matching all criteria */ + break; +nexthint: if (dyn_used) { cp = kenvp[++i]; if (cp == NULL) Modified: stable/11/sys/sys/systm.h ============================================================================== --- stable/11/sys/sys/systm.h Sat Aug 4 22:12:12 2018 (r337335) +++ stable/11/sys/sys/systm.h Sat Aug 4 22:15:05 2018 (r337336) @@ -148,7 +148,7 @@ void kassert_panic(const char *fmt, ...) __printflike * XXX most of these variables should be const. */ extern int osreldate; -extern int dynamic_kenv; +extern bool dynamic_kenv; extern struct mtx kenv_lock; extern char *kern_envp; extern char *md_envp;