From owner-svn-src-stable-12@freebsd.org Sun Jan 26 01:42:48 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B8D122AD48; Sun, 26 Jan 2020 01:42:48 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 484wcS37b0z4P4Z; Sun, 26 Jan 2020 01:42:48 +0000 (UTC) (envelope-from truckman@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 66C85199AA; Sun, 26 Jan 2020 01:42:48 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00Q1gmZO040864; Sun, 26 Jan 2020 01:42:48 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00Q1gmcG040863; Sun, 26 Jan 2020 01:42:48 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <202001260142.00Q1gmcG040863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Sun, 26 Jan 2020 01:42:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357132 - stable/12/sbin/swapon X-SVN-Group: stable-12 X-SVN-Commit-Author: truckman X-SVN-Commit-Paths: stable/12/sbin/swapon X-SVN-Commit-Revision: 357132 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jan 2020 01:42:48 -0000 Author: truckman Date: Sun Jan 26 01:42:47 2020 New Revision: 357132 URL: https://svnweb.freebsd.org/changeset/base/357132 Log: MFC r355553 Fix a logic bug in error handling code. It is an error if p == NULL. The linelen tests are only meaningful when p != NULL. Reported by: Coverity Coverity CID: 1368655 Modified: stable/12/sbin/swapon/swapon.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/swapon/swapon.c ============================================================================== --- stable/12/sbin/swapon/swapon.c Sun Jan 26 00:41:38 2020 (r357131) +++ stable/12/sbin/swapon/swapon.c Sun Jan 26 01:42:47 2020 (r357132) @@ -542,7 +542,7 @@ swap_on_off_md(const char *name, char *mntops, int doi goto err; } p = fgetln(sfd, &linelen); - if (p == NULL && + if (p == NULL || (linelen < 2 || linelen > sizeof(linebuf))) { warn("mdconfig (attach) unexpected output"); ret = NULL; From owner-svn-src-stable-12@freebsd.org Mon Jan 27 07:02:53 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C040234372; Mon, 27 Jan 2020 07:02:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 485ggK1C3Wz42bv; Mon, 27 Jan 2020 07:02:53 +0000 (UTC) (envelope-from dim@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 2490F6452; Mon, 27 Jan 2020 07:02:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00R72rDO003728; Mon, 27 Jan 2020 07:02:53 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00R72qbe003726; Mon, 27 Jan 2020 07:02:52 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202001270702.00R72qbe003726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 27 Jan 2020 07:02:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357167 - in stable/12/contrib/llvm-project/llvm/lib: MC Object Target/Mips X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/12/contrib/llvm-project/llvm/lib: MC Object Target/Mips X-SVN-Commit-Revision: 357167 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jan 2020 07:02:53 -0000 Author: dim Date: Mon Jan 27 07:02:52 2020 New Revision: 357167 URL: https://svnweb.freebsd.org/changeset/base/357167 Log: MFC r356789 (by arichardson): Merge commit 894f742acb from llvm git (by me): [MIPS][ELF] Use PC-relative relocations in .eh_frame when possible When compiling position-independent executables, we now use DW_EH_PE_pcrel | DW_EH_PE_sdata4. However, the MIPS ABI does not define a 64-bit PC-relative ELF relocation so we cannot use sdata8 for the large code model case. When using the large code model, we fall back to the previous behaviour of generating absolute relocations. With this change clang-generated .o files can be linked by LLD without having to pass -Wl,-z,notext (which creates text relocations). This is simpler than the approach used by ld.bfd, which rewrites the .eh_frame section to convert absolute relocations into relative references. I saw in D13104 that apparently ld.bfd did not accept pc-relative relocations for MIPS ouput at some point. However, I also checked that recent ld.bfd can process the clang-generated .o files so this no longer seems true. Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D72228 Merge commit 8e8ccf47 from llvm git (by me) [MIPS] Don't emit R_(MICRO)MIPS_JALR relocations against data symbols The R_(MICRO)MIPS_JALR optimization only works when used against functions. Using the relocation against a data symbol (e.g. function pointer) will cause some linkers that don't ignore the hint in this case (e.g. LLD prior to commit 5bab291) to generate a relative branch to the data symbol which crashes at run time. Before this patch, LLVM was erroneously emitting these relocations against local-dynamic TLS function pointers and global function pointers with internal visibility. Reviewers: atanasyan, jrtc27, vstefanovic Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D72571 These two changes should allow using lld for MIPS64 (and maybe also MIPS32) by default. The second commit is not strictly necessary for clang+lld since LLD9 will not perform the R_MIPS_JALR optimization (it was only added for 10) but it is probably required in order to use recent ld.bfd. Reviewed By: dim, emaste Differential Revision: https://reviews.freebsd.org/D23203 Modified: stable/12/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp stable/12/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp stable/12/contrib/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp Directory Properties: stable/12/ (props changed) stable/12/contrib/llvm-project/llvm/ (props changed) Modified: stable/12/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp ============================================================================== --- stable/12/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp Mon Jan 27 06:05:43 2020 (r357166) +++ stable/12/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp Mon Jan 27 07:02:52 2020 (r357167) @@ -303,9 +303,14 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const T case Triple::mipsel: case Triple::mips64: case Triple::mips64el: - FDECFIEncoding = Ctx->getAsmInfo()->getCodePointerSize() == 4 - ? dwarf::DW_EH_PE_sdata4 - : dwarf::DW_EH_PE_sdata8; + // We cannot use DW_EH_PE_sdata8 for the large PositionIndependent case + // since there is no R_MIPS_PC64 relocation (only a 32-bit version). + if (PositionIndependent && !Large) + FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4; + else + FDECFIEncoding = Ctx->getAsmInfo()->getCodePointerSize() == 4 + ? dwarf::DW_EH_PE_sdata4 + : dwarf::DW_EH_PE_sdata8; break; case Triple::ppc64: case Triple::ppc64le: Modified: stable/12/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp ============================================================================== --- stable/12/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp Mon Jan 27 06:05:43 2020 (r357166) +++ stable/12/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp Mon Jan 27 07:02:52 2020 (r357167) @@ -103,6 +103,7 @@ static bool supportsMips64(uint64_t Type) { case ELF::R_MIPS_32: case ELF::R_MIPS_64: case ELF::R_MIPS_TLS_DTPREL64: + case ELF::R_MIPS_PC32: return true; default: return false; @@ -117,6 +118,8 @@ static uint64_t resolveMips64(RelocationRef R, uint64_ return S + getELFAddend(R); case ELF::R_MIPS_TLS_DTPREL64: return S + getELFAddend(R) - 0x8000; + case ELF::R_MIPS_PC32: + return S + getELFAddend(R) - R.getOffset(); default: llvm_unreachable("Invalid relocation type"); } Modified: stable/12/contrib/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp ============================================================================== --- stable/12/contrib/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp Mon Jan 27 06:05:43 2020 (r357166) +++ stable/12/contrib/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp Mon Jan 27 07:02:52 2020 (r357167) @@ -2995,6 +2995,14 @@ void MipsTargetLowering::AdjustInstrPostInstrSelection StringRef Sym; if (const GlobalAddressSDNode *G = dyn_cast_or_null(TargetAddr)) { + // We must not emit the R_MIPS_JALR relocation against data symbols + // since this will cause run-time crashes if the linker replaces the + // call instruction with a relative branch to the data symbol. + if (!isa(G->getGlobal())) { + LLVM_DEBUG(dbgs() << "Not adding R_MIPS_JALR against data symbol " + << G->getGlobal()->getName() << "\n"); + return; + } Sym = G->getGlobal()->getName(); } else if (const ExternalSymbolSDNode *ES = @@ -3007,6 +3015,7 @@ void MipsTargetLowering::AdjustInstrPostInstrSelection MachineFunction *MF = MI.getParent()->getParent(); MCSymbol *S = MF->getContext().getOrCreateSymbol(Sym); + LLVM_DEBUG(dbgs() << "Adding R_MIPS_JALR against " << Sym << "\n"); MI.addOperand(MachineOperand::CreateMCSymbol(S, MipsII::MO_JALR)); } } From owner-svn-src-stable-12@freebsd.org Mon Jan 27 07:03:59 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 517EB2343F7; Mon, 27 Jan 2020 07:03:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 485ghb1Qj5z42k5; Mon, 27 Jan 2020 07:03:59 +0000 (UTC) (envelope-from dim@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 2C1D96455; Mon, 27 Jan 2020 07:03:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00R73xuP003841; Mon, 27 Jan 2020 07:03:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00R73vVo003834; Mon, 27 Jan 2020 07:03:57 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202001270703.00R73vVo003834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 27 Jan 2020 07:03:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357168 - in stable/12/contrib/llvm-project: clang/lib/Basic/Targets clang/lib/Driver/ToolChains/Arch llvm/include/llvm/ADT llvm/lib/Support llvm/lib/Target/PowerPC X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/12/contrib/llvm-project: clang/lib/Basic/Targets clang/lib/Driver/ToolChains/Arch llvm/include/llvm/ADT llvm/lib/Support llvm/lib/Target/PowerPC X-SVN-Commit-Revision: 357168 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jan 2020 07:03:59 -0000 Author: dim Date: Mon Jan 27 07:03:57 2020 New Revision: 357168 URL: https://svnweb.freebsd.org/changeset/base/357168 Log: MFC r356929: Merge commit bc4bc5aa0 from llvm git (by Justin Hibbits): Add 8548 CPU definition and attributes 8548 CPU is GCC's name for the e500v2, so accept this in clang. The e500v2 doesn't support lwsync, so define __NO_LWSYNC__ for this as well, as GCC does. Differential Revision: https://reviews.llvm.org/D67787 Merge commit ff0311c4b from llvm git (by Justin Hibbits): [PowerPC]: Add powerpcspe target triple subarch component Summary: This allows the use of '-target powerpcspe-unknown-linux-gnu' or 'powerpcspe-unknown-freebsd' to be used, instead of '-target powerpc-unknown-linux-gnu -mspe'. Reviewed By: dim Differential Revision: https://reviews.llvm.org/D72014 Merge commit ba91dffaf from llvm git (by Fangrui Song): [Driver][PowerPC] Move powerpcspe logic from cc1 to Driver Follow-up of D72014. It is more appropriate to use a target feature instead of a SubTypeArch to express the difference. Reviewed By: #powerpc, jhibbits Differential Revision: https://reviews.llvm.org/D72433 commit 36eedfcb3 from llvm git (by Justin Hibbits): [PowerPC] Fix powerpcspe subtarget enablement in llvm backend Summary: As currently written, -target powerpcspe will enable SPE regardless of disabling the feature later on in the command line. Instead, change this to just set a default CPU to 'e500' instead of a generic CPU. As part of this, add FeatureSPE to the e500 definition. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D72673 These are needed to unbreak the build for powerpcspe. Requested by: jhibbits Modified: stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h stable/12/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/PPC.cpp stable/12/contrib/llvm-project/llvm/include/llvm/ADT/Triple.h stable/12/contrib/llvm-project/llvm/lib/Support/Triple.cpp stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp Directory Properties: stable/12/ (props changed) stable/12/contrib/llvm-project/clang/ (props changed) stable/12/contrib/llvm-project/llvm/ (props changed) Modified: stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp ============================================================================== --- stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp Mon Jan 27 07:02:52 2020 (r357167) +++ stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp Mon Jan 27 07:03:57 2020 (r357168) @@ -157,6 +157,8 @@ void PPCTargetInfo::getTargetDefines(const LangOptions Builder.defineMacro("_ARCH_A2Q"); Builder.defineMacro("_ARCH_QP"); } + if (ArchDefs & ArchDefineE500) + Builder.defineMacro("__NO_LWSYNC__"); if (getTriple().getVendor() == llvm::Triple::BGQ) { Builder.defineMacro("__bg__"); @@ -312,6 +314,11 @@ bool PPCTargetInfo::initFeatureMap( .Case("pwr8", true) .Default(false); + Features["spe"] = llvm::StringSwitch(CPU) + .Case("8548", true) + .Case("e500", true) + .Default(false); + if (!ppcUserFeaturesCheck(Diags, FeaturesVec)) return false; @@ -449,16 +456,16 @@ ArrayRef PPCTargetInfo::getGC } static constexpr llvm::StringLiteral ValidCPUNames[] = { - {"generic"}, {"440"}, {"450"}, {"601"}, {"602"}, - {"603"}, {"603e"}, {"603ev"}, {"604"}, {"604e"}, - {"620"}, {"630"}, {"g3"}, {"7400"}, {"g4"}, - {"7450"}, {"g4+"}, {"750"}, {"970"}, {"g5"}, - {"a2"}, {"a2q"}, {"e500mc"}, {"e5500"}, {"power3"}, - {"pwr3"}, {"power4"}, {"pwr4"}, {"power5"}, {"pwr5"}, - {"power5x"}, {"pwr5x"}, {"power6"}, {"pwr6"}, {"power6x"}, - {"pwr6x"}, {"power7"}, {"pwr7"}, {"power8"}, {"pwr8"}, - {"power9"}, {"pwr9"}, {"powerpc"}, {"ppc"}, {"powerpc64"}, - {"ppc64"}, {"powerpc64le"}, {"ppc64le"}, + {"generic"}, {"440"}, {"450"}, {"601"}, {"602"}, + {"603"}, {"603e"}, {"603ev"}, {"604"}, {"604e"}, + {"620"}, {"630"}, {"g3"}, {"7400"}, {"g4"}, + {"7450"}, {"g4+"}, {"750"}, {"8548"}, {"970"}, + {"g5"}, {"a2"}, {"a2q"}, {"e500"}, {"e500mc"}, + {"e5500"}, {"power3"}, {"pwr3"}, {"power4"}, {"pwr4"}, + {"power5"}, {"pwr5"}, {"power5x"}, {"pwr5x"}, {"power6"}, + {"pwr6"}, {"power6x"}, {"pwr6x"}, {"power7"}, {"pwr7"}, + {"power8"}, {"pwr8"}, {"power9"}, {"pwr9"}, {"powerpc"}, + {"ppc"}, {"powerpc64"}, {"ppc64"}, {"powerpc64le"}, {"ppc64le"}, }; bool PPCTargetInfo::isValidCPUName(StringRef Name) const { Modified: stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h ============================================================================== --- stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h Mon Jan 27 07:02:52 2020 (r357167) +++ stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h Mon Jan 27 07:03:57 2020 (r357168) @@ -44,7 +44,8 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public T ArchDefinePwr8 = 1 << 12, ArchDefinePwr9 = 1 << 13, ArchDefineA2 = 1 << 14, - ArchDefineA2q = 1 << 15 + ArchDefineA2q = 1 << 15, + ArchDefineE500 = 1 << 16 } ArchDefineTypes; @@ -85,8 +86,7 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public T // Note: GCC recognizes the following additional cpus: // 401, 403, 405, 405fp, 440fp, 464, 464fp, 476, 476fp, 505, 740, 801, - // 821, 823, 8540, 8548, e300c2, e300c3, e500mc64, e6500, 860, cell, - // titan, rs64. + // 821, 823, 8540, e300c2, e300c3, e500mc64, e6500, 860, cell, titan, rs64. bool isValidCPUName(StringRef Name) const override; void fillValidCPUList(SmallVectorImpl &Values) const override; @@ -145,6 +145,7 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public T ArchDefinePwr9 | ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) + .Cases("8548", "e500", ArchDefineE500) .Default(ArchDefineNone); } return CPUKnown; Modified: stable/12/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/PPC.cpp ============================================================================== --- stable/12/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/PPC.cpp Mon Jan 27 07:02:52 2020 (r357167) +++ stable/12/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/PPC.cpp Mon Jan 27 07:03:57 2020 (r357168) @@ -52,10 +52,12 @@ std::string ppc::getPPCTargetCPU(const ArgList &Args) .Case("7450", "7450") .Case("G4+", "g4+") .Case("750", "750") + .Case("8548", "e500") .Case("970", "970") .Case("G5", "g5") .Case("a2", "a2") .Case("a2q", "a2q") + .Case("e500", "e500") .Case("e500mc", "e500mc") .Case("e5500", "e5500") .Case("power3", "pwr3") @@ -100,6 +102,9 @@ const char *ppc::getPPCAsmModeForCPU(StringRef Name) { void ppc::getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple, const ArgList &Args, std::vector &Features) { + if (Triple.getSubArch() == llvm::Triple::PPCSubArch_spe) + Features.push_back("+spe"); + handleTargetFeaturesGroup(Args, Features, options::OPT_m_ppc_Features_Group); ppc::FloatABI FloatABI = ppc::getPPCFloatABI(D, Args); Modified: stable/12/contrib/llvm-project/llvm/include/llvm/ADT/Triple.h ============================================================================== --- stable/12/contrib/llvm-project/llvm/include/llvm/ADT/Triple.h Mon Jan 27 07:02:52 2020 (r357167) +++ stable/12/contrib/llvm-project/llvm/include/llvm/ADT/Triple.h Mon Jan 27 07:03:57 2020 (r357168) @@ -128,7 +128,9 @@ class Triple { (public) KalimbaSubArch_v4, KalimbaSubArch_v5, - MipsSubArch_r6 + MipsSubArch_r6, + + PPCSubArch_spe }; enum VendorType { UnknownVendor, Modified: stable/12/contrib/llvm-project/llvm/lib/Support/Triple.cpp ============================================================================== --- stable/12/contrib/llvm-project/llvm/lib/Support/Triple.cpp Mon Jan 27 07:02:52 2020 (r357167) +++ stable/12/contrib/llvm-project/llvm/lib/Support/Triple.cpp Mon Jan 27 07:03:57 2020 (r357168) @@ -389,7 +389,7 @@ static Triple::ArchType parseArch(StringRef ArchName) // FIXME: Do we need to support these? .Cases("i786", "i886", "i986", Triple::x86) .Cases("amd64", "x86_64", "x86_64h", Triple::x86_64) - .Cases("powerpc", "ppc", "ppc32", Triple::ppc) + .Cases("powerpc", "powerpcspe", "ppc", "ppc32", Triple::ppc) .Cases("powerpc64", "ppu", "ppc64", Triple::ppc64) .Cases("powerpc64le", "ppc64le", Triple::ppc64le) .Case("xscale", Triple::arm) @@ -562,6 +562,9 @@ static Triple::SubArchType parseSubArch(StringRef SubA if (SubArchName.startswith("mips") && (SubArchName.endswith("r6el") || SubArchName.endswith("r6"))) return Triple::MipsSubArch_r6; + + if (SubArchName == "powerpcspe") + return Triple::PPCSubArch_spe; StringRef ARMSubArch = ARM::getCanonicalArchName(SubArchName); Modified: stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td ============================================================================== --- stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td Mon Jan 27 07:02:52 2020 (r357167) +++ stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td Mon Jan 27 07:03:57 2020 (r357168) @@ -378,7 +378,7 @@ def : ProcessorModel<"g5", G5Model, def : ProcessorModel<"e500", PPCE500Model, [DirectiveE500, FeatureICBT, FeatureBookE, - FeatureISEL, FeatureMFTB]>; + FeatureISEL, FeatureMFTB, FeatureSPE]>; def : ProcessorModel<"e500mc", PPCE500mcModel, [DirectiveE500mc, FeatureSTFIWX, FeatureICBT, FeatureBookE, Modified: stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp ============================================================================== --- stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp Mon Jan 27 07:02:52 2020 (r357167) +++ stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp Mon Jan 27 07:03:57 2020 (r357168) @@ -126,6 +126,8 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU // If cross-compiling with -march=ppc64le without -mcpu if (TargetTriple.getArch() == Triple::ppc64le) CPUName = "ppc64le"; + else if (TargetTriple.getSubArch() == Triple::PPCSubArch_spe) + CPUName = "e500"; else CPUName = "generic"; } From owner-svn-src-stable-12@freebsd.org Mon Jan 27 13:12:41 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71BAF1F6125; Mon, 27 Jan 2020 13:12:41 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 485qt12Plmz4Mcg; Mon, 27 Jan 2020 13:12:41 +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 4D171A760; Mon, 27 Jan 2020 13:12:41 +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 00RDCfuG027398; Mon, 27 Jan 2020 13:12:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00RDCfk1027397; Mon, 27 Jan 2020 13:12:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202001271312.00RDCfk1027397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 27 Jan 2020 13:12:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357171 - stable/12/sys/x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/x86/x86 X-SVN-Commit-Revision: 357171 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jan 2020 13:12:41 -0000 Author: kib Date: Mon Jan 27 13:12:40 2020 New Revision: 357171 URL: https://svnweb.freebsd.org/changeset/base/357171 Log: MFC r356919,r357054: x86: Wait for curpcb to be set up as an indicator that the boot stack is no longer used. Modified: stable/12/sys/x86/x86/mp_x86.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/x86/mp_x86.c ============================================================================== --- stable/12/sys/x86/x86/mp_x86.c Mon Jan 27 12:02:47 2020 (r357170) +++ stable/12/sys/x86/x86/mp_x86.c Mon Jan 27 13:12:40 2020 (r357171) @@ -1074,6 +1074,11 @@ init_secondary_tail(void) cpu_initclocks_ap(); #endif + /* + * Assert that smp_after_idle_runnable condition is reasonable. + */ + MPASS(PCPU_GET(curpcb) == NULL); + sched_throw(NULL); panic("scheduler returned us to %s", __func__); @@ -1083,13 +1088,12 @@ init_secondary_tail(void) static void smp_after_idle_runnable(void *arg __unused) { - struct thread *idle_td; + struct pcpu *pc; int cpu; for (cpu = 1; cpu < mp_ncpus; cpu++) { - idle_td = pcpu_find(cpu)->pc_idlethread; - while (idle_td->td_lastcpu == NOCPU && - idle_td->td_oncpu == NOCPU) + pc = pcpu_find(cpu); + while (atomic_load_ptr(&pc->pc_curpcb) == (uintptr_t)NULL) cpu_spinwait(); kmem_free((vm_offset_t)bootstacks[cpu], kstack_pages * PAGE_SIZE); From owner-svn-src-stable-12@freebsd.org Mon Jan 27 22:13:43 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 901332306F0; Mon, 27 Jan 2020 22:13:43 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4863tH3JtFz4GK5; Mon, 27 Jan 2020 22:13:43 +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 6D14618FE2; Mon, 27 Jan 2020 22:13:43 +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 00RMDhCW085713; Mon, 27 Jan 2020 22:13:43 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00RMDhAd085712; Mon, 27 Jan 2020 22:13:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001272213.00RMDhAd085712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 27 Jan 2020 22:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357180 - in stable: 11/include 12/include X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/include 12/include X-SVN-Commit-Revision: 357180 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jan 2020 22:13:43 -0000 Author: kevans Date: Mon Jan 27 22:13:42 2020 New Revision: 357180 URL: https://svnweb.freebsd.org/changeset/base/357180 Log: MFC r356994: Mark rfork(2) as __returns_twice rfork is not generally a built-in that would be recognized as behaving like vfork/fork; provide the hint. Modified: stable/12/include/unistd.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/include/unistd.h Directory Properties: stable/11/ (props changed) Modified: stable/12/include/unistd.h ============================================================================== --- stable/12/include/unistd.h Mon Jan 27 20:47:18 2020 (r357179) +++ stable/12/include/unistd.h Mon Jan 27 22:13:42 2020 (r357180) @@ -551,7 +551,7 @@ char *re_comp(const char *); int re_exec(const char *); int reboot(int); int revoke(const char *); -pid_t rfork(int); +pid_t rfork(int) __returns_twice; pid_t rfork_thread(int, void *, int (*)(void *), void *); int rresvport(int *); int rresvport_af(int *, int); From owner-svn-src-stable-12@freebsd.org Tue Jan 28 02:42:34 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD36E2383CF; Tue, 28 Jan 2020 02:42:34 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4869rV450Dz4XpM; Tue, 28 Jan 2020 02:42:34 +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 876801C20E; Tue, 28 Jan 2020 02:42:34 +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 00S2gY3U046656; Tue, 28 Jan 2020 02:42:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00S2gYXD046654; Tue, 28 Jan 2020 02:42:34 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001280242.00S2gYXD046654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 28 Jan 2020 02:42:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357191 - in stable: 11/stand/lua 12/stand/lua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/lua 12/stand/lua X-SVN-Commit-Revision: 357191 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2020 02:42:34 -0000 Author: kevans Date: Tue Jan 28 02:42:33 2020 New Revision: 357191 URL: https://svnweb.freebsd.org/changeset/base/357191 Log: MFC r357103-r357104: unbreak local.lua, add a modules.loaded hook r357103: loader.lua: re-arrange to load local.lua *after* config loading The major problem with the current ordering is that loader.conf may contain all of the magic we need to actually setup the console, so loading local.lua prior to that can make it excessively difficult and annoying to debug (whoops, sorry Ravi & Warner). The new ordering has some implications, but I suspect they are a non-issue. The first is that it's no longer possible for the local module to inject any logic prior to loading config -- I suspect no one has relied on this. The second implication is that the config.loaded hook is now useless, as the local module will always be included after that hook would have fired. For config.loaded, I will opt to leave it in, just in case we add an early point for local lua to get injected or in case one wants to schedule some deferred logic in a custom loader.lua. The overhead of having it if no hooks will be invoked is relatively minimal. r357104: lua: add modules.loaded hook This may be used for the local module to hook in and load any additional modules that it wants, since it can't modify the modules table internal to config. We may consider adding API to do so at a later time, but I suspect it will be more complicated to use with little return. status is captured but ignored for the purpose of loading the hook. status will be false if *any* module failed to load, but we typically don't let that halt the boot so there's no reason to let it halt hooks. Some vendors or setups may have expected fails that would be actively thwarted by checking it. We may, at a later date, consider adding an API for letting non-config modules check which modules have successfully (or not) loaded in case an unexpected failure *should* halt whatever they are doing. Modified: stable/12/stand/lua/config.lua stable/12/stand/lua/loader.lua Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/stand/lua/config.lua stable/11/stand/lua/loader.lua Directory Properties: stable/11/ (props changed) Modified: stable/12/stand/lua/config.lua ============================================================================== --- stable/12/stand/lua/config.lua Tue Jan 28 01:39:50 2020 (r357190) +++ stable/12/stand/lua/config.lua Tue Jan 28 02:42:33 2020 (r357191) @@ -623,7 +623,7 @@ end function config.loadelf() local xen_kernel = loader.getenv('xen_kernel') local kernel = config.kernel_selected or config.kernel_loaded - local loaded + local loaded, status if xen_kernel ~= nil then print(MSG_XENKERNLOADING) @@ -640,9 +640,12 @@ function config.loadelf() end print(MSG_MODLOADING) - return loadModule(modules, not config.verbose) + status = loadModule(modules, not config.verbose) + hook.runAll("modules.loaded") + return status end hook.registerType("config.loaded") hook.registerType("config.reloaded") +hook.registerType("modules.loaded") return config Modified: stable/12/stand/lua/loader.lua ============================================================================== --- stable/12/stand/lua/loader.lua Tue Jan 28 01:39:50 2020 (r357190) +++ stable/12/stand/lua/loader.lua Tue Jan 28 02:42:33 2020 (r357191) @@ -42,14 +42,14 @@ local password = require("password") -- need it. local menu -try_include("local") - config.load() + -- Our console may have been setup for a different color scheme before we get -- here, so make sure we set the default. if color.isEnabled() then printc(color.default()) end +try_include("local") if not core.isMenuSkipped() then menu = require("menu") end From owner-svn-src-stable-12@freebsd.org Tue Jan 28 02:58:40 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C7B62389A4; Tue, 28 Jan 2020 02:58:40 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 486BC40SSGz4YWl; Tue, 28 Jan 2020 02:58:40 +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 0AF0C1C3E0; Tue, 28 Jan 2020 02:58:40 +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 00S2wdXa053001; Tue, 28 Jan 2020 02:58:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00S2wd7b053000; Tue, 28 Jan 2020 02:58:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001280258.00S2wd7b053000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 28 Jan 2020 02:58:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357192 - in stable: 11/secure/caroot 12/secure/caroot X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/secure/caroot 12/secure/caroot X-SVN-Commit-Revision: 357192 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2020 02:58:40 -0000 Author: kevans Date: Tue Jan 28 02:58:39 2020 New Revision: 357192 URL: https://svnweb.freebsd.org/changeset/base/357192 Log: MFC r357084: caroot: use bsd.obj.mk, not bsd.prog.mk This directory stages certdata into .OBJDIR and processes it, but does not actually build a prog-shaped object; bsd.obj.mk provides the minimal support that we actually need, an .OBJDIR and descent into subdirs. This is admittedly the nittiest of nits. Modified: stable/12/secure/caroot/Makefile Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/secure/caroot/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/12/secure/caroot/Makefile ============================================================================== --- stable/12/secure/caroot/Makefile Tue Jan 28 02:42:33 2020 (r357191) +++ stable/12/secure/caroot/Makefile Tue Jan 28 02:58:39 2020 (r357192) @@ -7,10 +7,9 @@ CLEANFILES+= certdata.txt SUBDIR+= trusted SUBDIR+= blacklisted -.include +.include # To be used by secteam@ to update the trusted certificates - fetchcerts: .PHONY fetch --no-sslv3 --no-tlsv1 -o certdata.txt 'https://hg.mozilla.org/projects/nss/raw-file/tip/lib/ckfw/builtins/certdata.txt' From owner-svn-src-stable-12@freebsd.org Tue Jan 28 07:49:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9D1623F7BA; Tue, 28 Jan 2020 07:49:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 486Jg44YxYz4p5w; Tue, 28 Jan 2020 07:49:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 97E3B1F9EA; Tue, 28 Jan 2020 07:49:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00S7nq8j027202; Tue, 28 Jan 2020 07:49:52 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00S7nqY8027201; Tue, 28 Jan 2020 07:49:52 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202001280749.00S7nqY8027201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jan 2020 07:49:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357196 - stable/12/sbin/fsck_msdosfs X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/12/sbin/fsck_msdosfs X-SVN-Commit-Revision: 357196 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2020 07:49:52 -0000 Author: delphij Date: Tue Jan 28 07:49:52 2020 New Revision: 357196 URL: https://svnweb.freebsd.org/changeset/base/357196 Log: MFC r356629, r356636 r356629: Apply typo fix from NetBSD, we have already applied all NetBSD changes so update the NetBSD tag while I'm there. r356636: Correct off-by-two issue when determining FAT type. In the code we used NumClusters as the upper (non-inclusive) boundary of valid cluster number, so the actual value was 2 (CLUST_FIRST) more than the real number of clusters. This causes a FAT16 media with 65524 clusters be treated as FAT32 and might affect FAT12 media with 4084 clusters as well. To fix this, we increment NumClusters by CLUST_FIRST after the type determination. PR: 243179 Modified: stable/12/sbin/fsck_msdosfs/boot.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/fsck_msdosfs/boot.c ============================================================================== --- stable/12/sbin/fsck_msdosfs/boot.c Tue Jan 28 03:47:29 2020 (r357195) +++ stable/12/sbin/fsck_msdosfs/boot.c Tue Jan 28 07:49:52 2020 (r357196) @@ -28,7 +28,7 @@ #include #ifndef lint -__RCSID("$NetBSD: boot.c,v 1.11 2006/06/05 16:51:18 christos Exp "); +__RCSID("$NetBSD: boot.c,v 1.21 2018/02/08 09:05:17 dholland Exp $"); static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ @@ -269,8 +269,11 @@ readboot(int dosfs, struct bootblock *boot) return FSFATAL; } - boot->NumClusters = (boot->NumSectors - boot->FirstCluster) / boot->bpbSecPerClust + - CLUST_FIRST; + /* + * The number of clusters is derived from available data sectors, divided + * by sectors per cluster. + */ + boot->NumClusters = (boot->NumSectors - boot->FirstCluster) / boot->bpbSecPerClust; if (boot->flags & FAT32) boot->ClustMask = CLUST32_MASK; @@ -296,11 +299,19 @@ readboot(int dosfs, struct bootblock *boot) break; } - if (boot->NumFatEntries < boot->NumClusters - CLUST_FIRST) { + if (boot->NumFatEntries < boot->NumClusters) { pfatal("FAT size too small, %u entries won't fit into %u sectors\n", boot->NumClusters, boot->FATsecs); return FSFATAL; } + + /* + * There are two reserved clusters. To avoid adding CLUST_FIRST every time + * when we perform boundary checks, we increment the NumClusters by 2, + * which is CLUST_FIRST to denote the first out-of-range cluster number. + */ + boot->NumClusters += CLUST_FIRST; + boot->ClusterSize = boot->bpbBytesPerSec * boot->bpbSecPerClust; boot->NumFiles = 1; @@ -342,7 +353,7 @@ writefsinfo(int dosfs, struct bootblock *boot) * support for FAT32) doesn't maintain the FSINFO block * correctly, it has to be fixed pretty often. * - * Therefor, we handle the FSINFO block only informally, + * Therefore, we handle the FSINFO block only informally, * fixing it if necessary, but otherwise ignoring the * fact that it was incorrect. */ From owner-svn-src-stable-12@freebsd.org Tue Jan 28 11:33:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B37851FFDF1; Tue, 28 Jan 2020 11:33:15 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 486Pcq4Fz9z3Jp8; Tue, 28 Jan 2020 11:33:15 +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 8CDE822534; Tue, 28 Jan 2020 11:33:15 +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 00SBXFOS069056; Tue, 28 Jan 2020 11:33:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00SBXDNl069043; Tue, 28 Jan 2020 11:33:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202001281133.00SBXDNl069043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jan 2020 11:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357200 - in stable/12: stand/i386/libi386 sys/amd64/amd64 sys/i386/i386 sys/x86/cpufreq sys/x86/include sys/x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12: stand/i386/libi386 sys/amd64/amd64 sys/i386/i386 sys/x86/cpufreq sys/x86/include sys/x86/x86 X-SVN-Commit-Revision: 357200 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2020 11:33:15 -0000 Author: kib Date: Tue Jan 28 11:33:12 2020 New Revision: 357200 URL: https://svnweb.freebsd.org/changeset/base/357200 Log: MFC r356940: Add support for Hygon Dhyana Family 18h processor. Modified: stable/12/stand/i386/libi386/bootinfo64.c stable/12/sys/amd64/amd64/initcpu.c stable/12/sys/i386/i386/machdep.c stable/12/sys/x86/cpufreq/hwpstate.c stable/12/sys/x86/include/cputypes.h stable/12/sys/x86/include/specialreg.h stable/12/sys/x86/x86/identcpu.c stable/12/sys/x86/x86/local_apic.c stable/12/sys/x86/x86/mca.c stable/12/sys/x86/x86/mp_x86.c stable/12/sys/x86/x86/msi.c stable/12/sys/x86/x86/tsc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/i386/libi386/bootinfo64.c ============================================================================== --- stable/12/stand/i386/libi386/bootinfo64.c Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/stand/i386/libi386/bootinfo64.c Tue Jan 28 11:33:12 2020 (r357200) @@ -158,6 +158,7 @@ bi_checkcpu(void) /* Check for vendors that support AMD features. */ if (strncmp(cpu_vendor, INTEL_VENDOR_ID, 12) != 0 && strncmp(cpu_vendor, AMD_VENDOR_ID, 12) != 0 && + strncmp(cpu_vendor, HYGON_VENDOR_ID, 12) != 0 && strncmp(cpu_vendor, CENTAUR_VENDOR_ID, 12) != 0) return (0); Modified: stable/12/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/12/sys/amd64/amd64/initcpu.c Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/sys/amd64/amd64/initcpu.c Tue Jan 28 11:33:12 2020 (r357200) @@ -171,7 +171,8 @@ init_amd(void) */ if (lower_sharedpage_init == 0) { lower_sharedpage_init = 1; - if (CPUID_TO_FAMILY(cpu_id) == 0x17) { + if (CPUID_TO_FAMILY(cpu_id) == 0x17 || + CPUID_TO_FAMILY(cpu_id) == 0x18) { hw_lower_amd64_sharedpage = 1; } } @@ -259,6 +260,7 @@ initializecpu(void) amd64_syscall_ret_flush_l1d_recalc(); switch (cpu_vendor_id) { case CPU_VENDOR_AMD: + case CPU_VENDOR_HYGON: init_amd(); break; case CPU_VENDOR_CENTAUR: Modified: stable/12/sys/i386/i386/machdep.c ============================================================================== --- stable/12/sys/i386/i386/machdep.c Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/sys/i386/i386/machdep.c Tue Jan 28 11:33:12 2020 (r357200) @@ -1621,8 +1621,9 @@ DB_SHOW_COMMAND(sysregs, db_show_sysregs) if (cpu_feature2 & (CPUID2_VMX | CPUID2_SMX)) db_printf("FEATURES_CTL\t0x%016llx\n", rdmsr(MSR_IA32_FEATURE_CONTROL)); - if ((cpu_vendor_id == CPU_VENDOR_INTEL || - cpu_vendor_id == CPU_VENDOR_AMD) && CPUID_TO_FAMILY(cpu_id) >= 6) + if (((cpu_vendor_id == CPU_VENDOR_INTEL || + cpu_vendor_id == CPU_VENDOR_AMD) && CPUID_TO_FAMILY(cpu_id) >= 6) || + cpu_vendor_id == CPU_VENDOR_HYGON) db_printf("DEBUG_CTL\t0x%016llx\n", rdmsr(MSR_DEBUGCTLMSR)); if (cpu_feature & CPUID_PAT) db_printf("PAT\t0x%016llx\n", rdmsr(MSR_PAT)); Modified: stable/12/sys/x86/cpufreq/hwpstate.c ============================================================================== --- stable/12/sys/x86/cpufreq/hwpstate.c Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/sys/x86/cpufreq/hwpstate.c Tue Jan 28 11:33:12 2020 (r357200) @@ -315,7 +315,8 @@ hwpstate_identify(driver_t *driver, device_t parent) if (device_find_child(parent, "hwpstate", -1) != NULL) return; - if (cpu_vendor_id != CPU_VENDOR_AMD || CPUID_TO_FAMILY(cpu_id) < 0x10) + if ((cpu_vendor_id != CPU_VENDOR_AMD || CPUID_TO_FAMILY(cpu_id) < 0x10) && + cpu_vendor_id != CPU_VENDOR_HYGON) return; /* @@ -446,6 +447,7 @@ hwpstate_get_info_from_msr(device_t dev) hwpstate_set[i].freq = (100 * (fid + 0x10)) >> did; break; case 0x17: + case 0x18: did = AMD_17H_CUR_DID(msr); if (did == 0) { HWPSTATE_DEBUG(dev, "unexpected did: 0\n"); @@ -455,8 +457,10 @@ hwpstate_get_info_from_msr(device_t dev) hwpstate_set[i].freq = (200 * fid) / did; break; default: - HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family" - " 0x%02x CPUs are not supported yet\n", family); + HWPSTATE_DEBUG(dev, "get_info_from_msr: %s family" + " 0x%02x CPUs are not supported yet\n", + cpu_vendor_id == CPU_VENDOR_HYGON ? "Hygon" : "AMD", + family); return (ENXIO); } hwpstate_set[i].pstate_id = i; Modified: stable/12/sys/x86/include/cputypes.h ============================================================================== --- stable/12/sys/x86/include/cputypes.h Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/sys/x86/include/cputypes.h Tue Jan 28 11:33:12 2020 (r357200) @@ -45,5 +45,6 @@ #define CPU_VENDOR_INTEL 0x8086 /* Intel */ #define CPU_VENDOR_RISE 0xdead2bad /* Rise */ #define CPU_VENDOR_CENTAUR CPU_VENDOR_IDT +#define CPU_VENDOR_HYGON 0x1d94 /* Hygon */ #endif /* !_X86_CPUTYPES_H_ */ Modified: stable/12/sys/x86/include/specialreg.h ============================================================================== --- stable/12/sys/x86/include/specialreg.h Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/sys/x86/include/specialreg.h Tue Jan 28 11:33:12 2020 (r357200) @@ -468,6 +468,7 @@ #define SIS_VENDOR_ID "SiS SiS SiS " #define TRANSMETA_VENDOR_ID "GenuineTMx86" #define UMC_VENDOR_ID "UMC UMC UMC " +#define HYGON_VENDOR_ID "HygonGenuine" /* * Model-specific registers for the i386 family Modified: stable/12/sys/x86/x86/identcpu.c ============================================================================== --- stable/12/sys/x86/x86/identcpu.c Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/sys/x86/x86/identcpu.c Tue Jan 28 11:33:12 2020 (r357200) @@ -215,6 +215,7 @@ static struct { } cpu_vendors[] = { { INTEL_VENDOR_ID, CPU_VENDOR_INTEL }, /* GenuineIntel */ { AMD_VENDOR_ID, CPU_VENDOR_AMD }, /* AuthenticAMD */ + { HYGON_VENDOR_ID, CPU_VENDOR_HYGON }, /* HygonGenuine*/ { CENTAUR_VENDOR_ID, CPU_VENDOR_CENTAUR }, /* CentaurHauls */ #ifdef __i386__ { NSC_VENDOR_ID, CPU_VENDOR_NSC }, /* Geode by NSC */ @@ -674,6 +675,18 @@ printcpuinfo(void) } break; #endif + case CPU_VENDOR_HYGON: + strcpy(cpu_model, "Hygon "); +#ifdef __i386__ + strcat(cpu_model, "Unknown"); +#else + if ((cpu_id & 0xf00) == 0xf00) + strcat(cpu_model, "AMD64 Processor"); + else + strcat(cpu_model, "Unknown"); +#endif + break; + default: strcat(cpu_model, "Unknown"); break; @@ -733,6 +746,7 @@ printcpuinfo(void) if (cpu_vendor_id == CPU_VENDOR_INTEL || cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_HYGON || cpu_vendor_id == CPU_VENDOR_CENTAUR || #ifdef __i386__ cpu_vendor_id == CPU_VENDOR_TRANSMETA || @@ -1051,7 +1065,8 @@ printcpuinfo(void) print_svm_info(); if ((cpu_feature & CPUID_HTT) && - cpu_vendor_id == CPU_VENDOR_AMD) + (cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_HYGON)) cpu_feature &= ~CPUID_HTT; /* @@ -1081,7 +1096,8 @@ printcpuinfo(void) printf("\n"); if (bootverbose) { - if (cpu_vendor_id == CPU_VENDOR_AMD) + if (cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_HYGON) print_AMD_info(); else if (cpu_vendor_id == CPU_VENDOR_INTEL) print_INTEL_info(); @@ -1520,6 +1536,7 @@ finishidentcpu(void) if (cpu_high > 0 && (cpu_vendor_id == CPU_VENDOR_INTEL || cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_HYGON || cpu_vendor_id == CPU_VENDOR_TRANSMETA || cpu_vendor_id == CPU_VENDOR_CENTAUR || cpu_vendor_id == CPU_VENDOR_NSC)) { @@ -1530,6 +1547,7 @@ finishidentcpu(void) #else if (cpu_vendor_id == CPU_VENDOR_INTEL || cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_HYGON || cpu_vendor_id == CPU_VENDOR_CENTAUR) { do_cpuid(0x80000000, regs); cpu_exthigh = regs[0]; @@ -1649,7 +1667,8 @@ int pti_get_default(void) { - if (strcmp(cpu_vendor, AMD_VENDOR_ID) == 0) + if (strcmp(cpu_vendor, AMD_VENDOR_ID) == 0 || + strcmp(cpu_vendor, HYGON_VENDOR_ID) == 0) return (0); if ((cpu_ia32_arch_caps & IA32_ARCH_CAP_RDCL_NO) != 0) return (0); Modified: stable/12/sys/x86/x86/local_apic.c ============================================================================== --- stable/12/sys/x86/x86/local_apic.c Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/sys/x86/x86/local_apic.c Tue Jan 28 11:33:12 2020 (r357200) @@ -676,7 +676,8 @@ amd_read_ext_features(void) { uint32_t version; - if (cpu_vendor_id != CPU_VENDOR_AMD) + if (cpu_vendor_id != CPU_VENDOR_AMD && + cpu_vendor_id != CPU_VENDOR_HYGON) return (0); version = lapic_read32(LAPIC_VERSION); if ((version & APIC_VER_AMD_EXT_SPACE) != 0) Modified: stable/12/sys/x86/x86/mca.c ============================================================================== --- stable/12/sys/x86/x86/mca.c Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/sys/x86/x86/mca.c Tue Jan 28 11:33:12 2020 (r357200) @@ -134,7 +134,8 @@ static int amd_elvt = -1; static inline bool amd_thresholding_supported(void) { - if (cpu_vendor_id != CPU_VENDOR_AMD) + if (cpu_vendor_id != CPU_VENDOR_AMD && + cpu_vendor_id != CPU_VENDOR_HYGON) return (false); /* * The RASCap register is wholly reserved in families 0x10-0x15 (through model 1F). Modified: stable/12/sys/x86/x86/mp_x86.c ============================================================================== --- stable/12/sys/x86/x86/mp_x86.c Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/sys/x86/x86/mp_x86.c Tue Jan 28 11:33:12 2020 (r357200) @@ -508,7 +508,8 @@ topo_probe(void) if (mp_ncpus <= 1) ; /* nothing */ - else if (cpu_vendor_id == CPU_VENDOR_AMD) + else if (cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_HYGON) topo_probe_amd(); else if (cpu_vendor_id == CPU_VENDOR_INTEL) topo_probe_intel(); Modified: stable/12/sys/x86/x86/msi.c ============================================================================== --- stable/12/sys/x86/x86/msi.c Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/sys/x86/x86/msi.c Tue Jan 28 11:33:12 2020 (r357200) @@ -319,6 +319,7 @@ msi_init(void) switch (cpu_vendor_id) { case CPU_VENDOR_INTEL: case CPU_VENDOR_AMD: + case CPU_VENDOR_HYGON: break; case CPU_VENDOR_CENTAUR: if (CPUID_TO_FAMILY(cpu_id) == 0x6 && Modified: stable/12/sys/x86/x86/tsc.c ============================================================================== --- stable/12/sys/x86/x86/tsc.c Tue Jan 28 11:29:06 2020 (r357199) +++ stable/12/sys/x86/x86/tsc.c Tue Jan 28 11:33:12 2020 (r357200) @@ -254,6 +254,7 @@ probe_tsc_freq(void) switch (cpu_vendor_id) { case CPU_VENDOR_AMD: + case CPU_VENDOR_HYGON: if ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 || (vm_guest == VM_GUEST_NO && CPUID_TO_FAMILY(cpu_id) >= 0x10)) @@ -517,6 +518,7 @@ retry: if (smp_tsc && tsc_is_invariant) { switch (cpu_vendor_id) { case CPU_VENDOR_AMD: + case CPU_VENDOR_HYGON: /* * Starting with Family 15h processors, TSC clock * source is in the north bridge. Check whether @@ -614,7 +616,8 @@ init: for (shift = 0; shift <= 31 && (tsc_freq >> shift) > max_freq; shift++) ; if ((cpu_feature & CPUID_SSE2) != 0 && mp_ncpus > 1) { - if (cpu_vendor_id == CPU_VENDOR_AMD) { + if (cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_HYGON) { tsc_timecounter.tc_get_timecount = shift > 0 ? tsc_get_timecount_low_mfence : tsc_get_timecount_mfence; From owner-svn-src-stable-12@freebsd.org Tue Jan 28 17:39:03 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB09F235158; Tue, 28 Jan 2020 17:39:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 486Ykv5kCjz4HK9; Tue, 28 Jan 2020 17:39:03 +0000 (UTC) (envelope-from bz@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 BF78D269C0; Tue, 28 Jan 2020 17:39:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00SHd3bw089647; Tue, 28 Jan 2020 17:39:03 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00SHd3cO089645; Tue, 28 Jan 2020 17:39:03 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202001281739.00SHd3cO089645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 28 Jan 2020 17:39:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357206 - in stable/12: share/man/man4 sys/netgraph X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/netgraph X-SVN-Commit-Revision: 357206 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2020 17:39:03 -0000 Author: bz Date: Tue Jan 28 17:39:03 2020 New Revision: 357206 URL: https://svnweb.freebsd.org/changeset/base/357206 Log: MFC r353026,353030,354244 (glebius), r356386: Remove the compile time limit for number of links a ng_bridge node can handle. Instead using an array on node private data, use per-hook private data. Reestablish old ABI. PR: 240787 Submitted by: Lutz Donnerhacke (lutz donnerhacke.de) Modified: stable/12/share/man/man4/ng_bridge.4 stable/12/sys/netgraph/ng_bridge.c stable/12/sys/netgraph/ng_bridge.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ng_bridge.4 ============================================================================== --- stable/12/share/man/man4/ng_bridge.4 Tue Jan 28 17:34:05 2020 (r357205) +++ stable/12/share/man/man4/ng_bridge.4 Tue Jan 28 17:39:03 2020 (r357206) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 5, 2010 +.Dd October 2, 2019 .Dt NG_BRIDGE 4 .Os .Sh NAME @@ -76,9 +76,7 @@ Processing of IP packets via the .Xr ipfirewall 4 mechanism on a per-link basis is not yet implemented. .Sh HOOKS -This node type supports up to -.Dv NG_BRIDGE_MAX_LINKS -hooks. +This node type supports an unlimited number of hooks. Each connected hook represents a bridged link. The hooks are named .Dv link0 , @@ -106,7 +104,6 @@ as an argument: .Bd -literal -offset 0n /* Node configuration structure */ struct ng_bridge_config { - u_char ipfw[NG_BRIDGE_MAX_LINKS]; /* enable ipfw */ u_char debugLevel; /* debug level */ uint32_t loopTimeout; /* link loopback mute time */ uint32_t maxStaleness; /* max host age before nuking */ @@ -114,11 +111,6 @@ struct ng_bridge_config { }; .Ed .Pp -The -.Dv ipfw -array enables -.Xr ipfirewall 4 -processing of IP packets received on the corresponding links. The .Dv debugLevel field sets the debug level on the node. Modified: stable/12/sys/netgraph/ng_bridge.c ============================================================================== --- stable/12/sys/netgraph/ng_bridge.c Tue Jan 28 17:34:05 2020 (r357205) +++ stable/12/sys/netgraph/ng_bridge.c Tue Jan 28 17:39:03 2020 (r357206) @@ -1,7 +1,3 @@ -/* - * ng_bridge.c - */ - /*- * Copyright (c) 2000 Whistle Communications, Inc. * All rights reserved. @@ -101,7 +97,6 @@ struct ng_bridge_link { /* Per-node private data */ struct ng_bridge_private { struct ng_bridge_bucket *tab; /* hash table bucket array */ - struct ng_bridge_link *links[NG_BRIDGE_MAX_LINKS]; struct ng_bridge_config conf; /* node configuration */ node_p node; /* netgraph node */ u_int numHosts; /* num entries in table */ @@ -132,9 +127,9 @@ static ng_disconnect_t ng_bridge_disconnect; /* Other internal functions */ static struct ng_bridge_host *ng_bridge_get(priv_p priv, const u_char *addr); -static int ng_bridge_put(priv_p priv, const u_char *addr, int linkNum); +static int ng_bridge_put(priv_p priv, const u_char *addr, link_p link); static void ng_bridge_rehash(priv_p priv); -static void ng_bridge_remove_hosts(priv_p priv, int linkNum); +static void ng_bridge_remove_hosts(priv_p priv, link_p link); static void ng_bridge_timeout(node_p node, hook_p hook, void *arg1, int arg2); static const char *ng_bridge_nodename(node_p node); @@ -142,9 +137,6 @@ static const char *ng_bridge_nodename(node_p node); static const u_char ng_bridge_bcast_addr[ETHER_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -/* Store each hook's link number in the private field */ -#define LINK_NUM(hook) (*(u_int16_t *)(&(hook)->private)) - /* Compare Ethernet addresses using 32 and 16 bit words instead of bytewise */ #define ETHER_EQUAL(a,b) (((const u_int32_t *)(a))[0] \ == ((const u_int32_t *)(b))[0] \ @@ -200,16 +192,8 @@ static const struct ng_parse_type ng_bridge_host_ary_t }; /* Parse type for struct ng_bridge_config */ -static const struct ng_parse_fixedarray_info ng_bridge_ipfwary_type_info = { - &ng_parse_uint8_type, - NG_BRIDGE_MAX_LINKS -}; -static const struct ng_parse_type ng_bridge_ipfwary_type = { - &ng_parse_fixedarray_type, - &ng_bridge_ipfwary_type_info -}; static const struct ng_parse_struct_field ng_bridge_config_type_fields[] - = NG_BRIDGE_CONFIG_TYPE_INFO(&ng_bridge_ipfwary_type); + = NG_BRIDGE_CONFIG_TYPE_INFO; static const struct ng_parse_type ng_bridge_config_type = { &ng_parse_struct_type, &ng_bridge_config_type_fields @@ -352,26 +336,30 @@ ng_bridge_newhook(node_p node, hook_p hook, const char const priv_p priv = NG_NODE_PRIVATE(node); /* Check for a link hook */ - if (strncmp(name, NG_BRIDGE_HOOK_LINK_PREFIX, - strlen(NG_BRIDGE_HOOK_LINK_PREFIX)) == 0) { - const char *cp; - char *eptr; - u_long linkNum; + if (strlen(name) > strlen(NG_BRIDGE_HOOK_LINK_PREFIX)) { + char linkName[NG_HOOKSIZ]; + u_int32_t linkNum; + link_p link; - cp = name + strlen(NG_BRIDGE_HOOK_LINK_PREFIX); - if (!isdigit(*cp) || (cp[0] == '0' && cp[1] != '\0')) + /* primitive parsing */ + linkNum = strtoul(name + strlen(NG_BRIDGE_HOOK_LINK_PREFIX), + NULL, 10); + /* validation by comparing against the reconstucted name */ + snprintf(linkName, sizeof(linkName), + "%s%u", NG_BRIDGE_HOOK_LINK_PREFIX, + linkNum); + if (strcmp(linkName, name) != 0) return (EINVAL); - linkNum = strtoul(cp, &eptr, 10); - if (*eptr != '\0' || linkNum >= NG_BRIDGE_MAX_LINKS) - return (EINVAL); - if (priv->links[linkNum] != NULL) - return (EISCONN); - priv->links[linkNum] = malloc(sizeof(*priv->links[linkNum]), - M_NETGRAPH_BRIDGE, M_NOWAIT|M_ZERO); - if (priv->links[linkNum] == NULL) + + if(NG_PEER_NODE(hook) == node) + return (ELOOP); + + link = malloc(sizeof(*link), M_NETGRAPH_BRIDGE, + M_WAITOK|M_ZERO); + if (link == NULL) return (ENOMEM); - priv->links[linkNum]->hook = hook; - NG_HOOK_SET_PRIVATE(hook, (void *)linkNum); + link->hook = hook; + NG_HOOK_SET_PRIVATE(hook, link); priv->numLinks++; return (0); } @@ -384,6 +372,18 @@ ng_bridge_newhook(node_p node, hook_p hook, const char * Receive a control message */ static int +ng_bridge_reset_link(hook_p hook, void *arg __unused) +{ + link_p priv = NG_HOOK_PRIVATE(hook); + + priv->loopCount = 0; + bzero(&priv->stats, sizeof(priv->stats)); + + return (1); +} + + +static int ng_bridge_rcvmsg(node_p node, item_p item, hook_p lasthook) { const priv_p priv = NG_NODE_PRIVATE(node); @@ -393,6 +393,72 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p last NGI_GET_MSG(item, msg); switch (msg->header.typecookie) { +#ifdef NGM_BRIDGE_TABLE_ABI + case NGM_BRIDGE_COOKIE_TBL: + switch (msg->header.cmd) { + case NGM_BRIDGE_GET_CONFIG: + { + struct ng_bridge_config_tbl *conf; + + NG_MKRESPONSE(resp, msg, sizeof(*conf), + M_NOWAIT|M_ZERO); + if (resp == NULL) { + error = ENOMEM; + break; + } + conf = (struct ng_bridge_config_tbl *)resp->data; + conf->cfg = priv->conf; + break; + } + case NGM_BRIDGE_SET_CONFIG: + { + struct ng_bridge_config_tbl *conf; + + if (msg->header.arglen != sizeof(*conf)) { + error = EINVAL; + break; + } + conf = (struct ng_bridge_config_tbl *)msg->data; + priv->conf = conf->cfg; + break; + } + case NGM_BRIDGE_GET_TABLE: + { + struct ng_bridge_host_tbl_ary *ary; + struct ng_bridge_hent *hent; + int i, bucket; + + NG_MKRESPONSE(resp, msg, sizeof(*ary) + + (priv->numHosts * sizeof(*ary->hosts)), M_NOWAIT); + if (resp == NULL) { + error = ENOMEM; + break; + } + ary = (struct ng_bridge_host_tbl_ary *)resp->data; + ary->numHosts = priv->numHosts; + i = 0; + for (bucket = 0; bucket < priv->numBuckets; bucket++) { + SLIST_FOREACH(hent, &priv->tab[bucket], next) { + memcpy(ary->hosts[i].addr, + hent->host.addr, + sizeof(ary->hosts[i].addr)); + ary->hosts[i].age = hent->host.age; + ary->hosts[i].staleness = + hent->host.staleness; + ary->hosts[i].linkNum = strtol( + NG_HOOK_NAME(hent->host.link->hook) + + strlen(NG_BRIDGE_HOOK_LINK_PREFIX), + NULL, 10); + i++; + } + } + break; + } + } + /* If already handled break, otherwise use new ABI. */ + if (resp != NULL || error != 0) + break; +#endif /* NGM_BRIDGE_TABLE_ABI */ case NGM_BRIDGE_COOKIE: switch (msg->header.cmd) { case NGM_BRIDGE_GET_CONFIG: @@ -412,7 +478,6 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p last case NGM_BRIDGE_SET_CONFIG: { struct ng_bridge_config *conf; - int i; if (msg->header.arglen != sizeof(struct ng_bridge_config)) { @@ -421,48 +486,42 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p last } conf = (struct ng_bridge_config *)msg->data; priv->conf = *conf; - for (i = 0; i < NG_BRIDGE_MAX_LINKS; i++) - priv->conf.ipfw[i] = !!priv->conf.ipfw[i]; break; } case NGM_BRIDGE_RESET: { - int i; + hook_p rethook; /* Flush all entries in the hash table */ - ng_bridge_remove_hosts(priv, -1); + ng_bridge_remove_hosts(priv, NULL); /* Reset all loop detection counters and stats */ - for (i = 0; i < NG_BRIDGE_MAX_LINKS; i++) { - if (priv->links[i] == NULL) - continue; - priv->links[i]->loopCount = 0; - bzero(&priv->links[i]->stats, - sizeof(priv->links[i]->stats)); - } + NG_NODE_FOREACH_HOOK(node, ng_bridge_reset_link, NULL, + rethook); break; } case NGM_BRIDGE_GET_STATS: case NGM_BRIDGE_CLR_STATS: case NGM_BRIDGE_GETCLR_STATS: { - struct ng_bridge_link *link; - int linkNum; - + hook_p hook; + link_p link; + char linkName[NG_HOOKSIZ]; + /* Get link number */ if (msg->header.arglen != sizeof(u_int32_t)) { error = EINVAL; break; } - linkNum = *((u_int32_t *)msg->data); - if (linkNum < 0 || linkNum >= NG_BRIDGE_MAX_LINKS) { - error = EINVAL; - break; - } - if ((link = priv->links[linkNum]) == NULL) { + snprintf(linkName, sizeof(linkName), + "%s%u", NG_BRIDGE_HOOK_LINK_PREFIX, + *((u_int32_t *)msg->data)); + + if ((hook = ng_findhook(node, linkName)) == NULL) { error = ENOTCONN; break; } + link = NG_HOOK_PRIVATE(hook); /* Get/clear stats */ if (msg->header.cmd != NGM_BRIDGE_CLR_STATS) { @@ -494,8 +553,17 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p last ary = (struct ng_bridge_host_ary *)resp->data; ary->numHosts = priv->numHosts; for (bucket = 0; bucket < priv->numBuckets; bucket++) { - SLIST_FOREACH(hent, &priv->tab[bucket], next) - ary->hosts[i++] = hent->host; + SLIST_FOREACH(hent, &priv->tab[bucket], next) { + memcpy(ary->hosts[i].addr, + hent->host.addr, + sizeof(ary->hosts[i].addr)); + ary->hosts[i].age = hent->host.age; + ary->hosts[i].staleness = hent->host.staleness; + strncpy(ary->hosts[i].hook, + NG_HOOK_NAME(hent->host.link->hook), + sizeof(ary->hosts[i].hook)); + i++; + } } break; } @@ -523,64 +591,118 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p last /* * Receive data on a hook */ +struct ng_bridge_send_ctx { + link_p foundFirst, incoming; + struct mbuf * m; + int manycast, error; +}; + static int +ng_bridge_send_ctx(hook_p dst, void *arg) +{ + struct ng_bridge_send_ctx *ctx = arg; + link_p destLink = NG_HOOK_PRIVATE(dst); + struct mbuf *m2 = NULL; + int error = 0; + + /* Skip incoming link */ + if (destLink == ctx->incoming) { + return (1); + } + + if (ctx->foundFirst == NULL) { + /* + * This is the first usable link we have found. + * Reserve it for the originals. + * If we never find another we save a copy. + */ + ctx->foundFirst = destLink; + return (1); + } + + /* + * It's usable link but not the reserved (first) one. + * Copy mbuf info for sending. + */ + m2 = m_dup(ctx->m, M_NOWAIT); /* XXX m_copypacket() */ + if (m2 == NULL) { + ctx->incoming->stats.memoryFailures++; + ctx->error = ENOBUFS; + return (0); /* abort loop */ + } + + + /* Update stats */ + destLink->stats.xmitPackets++; + destLink->stats.xmitOctets += m2->m_pkthdr.len; + switch (ctx->manycast) { + default: /* unknown unicast */ + break; + case 1: /* multicast */ + destLink->stats.xmitMulticasts++; + break; + case 2: /* broadcast */ + destLink->stats.xmitBroadcasts++; + break; + } + + /* Send packet */ + NG_SEND_DATA_ONLY(error, destLink->hook, m2); + if(error) + ctx->error = error; + return (1); +} + +static int ng_bridge_rcvdata(hook_p hook, item_p item) { const node_p node = NG_HOOK_NODE(hook); const priv_p priv = NG_NODE_PRIVATE(node); struct ng_bridge_host *host; - struct ng_bridge_link *link; struct ether_header *eh; - int error = 0, linkNum, linksSeen; - int manycast; - struct mbuf *m; - struct ng_bridge_link *firstLink; + struct ng_bridge_send_ctx ctx = { 0 }; + hook_p ret; - NGI_GET_M(item, m); - /* Get link number */ - linkNum = (intptr_t)NG_HOOK_PRIVATE(hook); - KASSERT(linkNum >= 0 && linkNum < NG_BRIDGE_MAX_LINKS, - ("%s: linkNum=%u", __func__, linkNum)); - link = priv->links[linkNum]; - KASSERT(link != NULL, ("%s: link%d null", __func__, linkNum)); + NGI_GET_M(item, ctx.m); + ctx.incoming = NG_HOOK_PRIVATE(hook); /* Sanity check packet and pull up header */ - if (m->m_pkthdr.len < ETHER_HDR_LEN) { - link->stats.recvRunts++; + if (ctx.m->m_pkthdr.len < ETHER_HDR_LEN) { + ctx.incoming->stats.recvRunts++; NG_FREE_ITEM(item); - NG_FREE_M(m); + NG_FREE_M(ctx.m); return (EINVAL); } - if (m->m_len < ETHER_HDR_LEN && !(m = m_pullup(m, ETHER_HDR_LEN))) { - link->stats.memoryFailures++; + if (ctx.m->m_len < ETHER_HDR_LEN && !(ctx.m = m_pullup(ctx.m, ETHER_HDR_LEN))) { + ctx.incoming->stats.memoryFailures++; NG_FREE_ITEM(item); return (ENOBUFS); } - eh = mtod(m, struct ether_header *); + eh = mtod(ctx.m, struct ether_header *); if ((eh->ether_shost[0] & 1) != 0) { - link->stats.recvInvalid++; + ctx.incoming->stats.recvInvalid++; NG_FREE_ITEM(item); - NG_FREE_M(m); + NG_FREE_M(ctx.m); return (EINVAL); } /* Is link disabled due to a loopback condition? */ - if (link->loopCount != 0) { - link->stats.loopDrops++; + if (ctx.incoming->loopCount != 0) { + ctx.incoming->stats.loopDrops++; NG_FREE_ITEM(item); - NG_FREE_M(m); + NG_FREE_M(ctx.m); return (ELOOP); /* XXX is this an appropriate error? */ } /* Update stats */ - link->stats.recvPackets++; - link->stats.recvOctets += m->m_pkthdr.len; - if ((manycast = (eh->ether_dhost[0] & 1)) != 0) { + ctx.incoming->stats.recvPackets++; + ctx.incoming->stats.recvOctets += ctx.m->m_pkthdr.len; + if ((ctx.manycast = (eh->ether_dhost[0] & 1)) != 0) { if (ETHER_EQUAL(eh->ether_dhost, ng_bridge_bcast_addr)) { - link->stats.recvBroadcasts++; - manycast = 2; + ctx.incoming->stats.recvBroadcasts++; + ctx.manycast = 2; } else - link->stats.recvMulticasts++; + ctx.incoming->stats.recvMulticasts++; } /* Look up packet's source Ethernet address in hashtable */ @@ -590,7 +712,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item) host->staleness = 0; /* Did host jump to a different link? */ - if (host->linkNum != linkNum) { + if (host->link != ctx.incoming) { /* * If the host's old link was recently established @@ -601,7 +723,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item) /* Log the problem */ if (priv->conf.debugLevel >= 2) { - struct ifnet *ifp = m->m_pkthdr.rcvif; + struct ifnet *ifp = ctx.m->m_pkthdr.rcvif; char suffix[32]; if (ifp != NULL) @@ -616,28 +738,28 @@ ng_bridge_rcvdata(hook_p hook, item_p item) } /* Mark link as linka non grata */ - link->loopCount = priv->conf.loopTimeout; - link->stats.loopDetects++; + ctx.incoming->loopCount = priv->conf.loopTimeout; + ctx.incoming->stats.loopDetects++; /* Forget all hosts on this link */ - ng_bridge_remove_hosts(priv, linkNum); + ng_bridge_remove_hosts(priv, ctx.incoming); /* Drop packet */ - link->stats.loopDrops++; + ctx.incoming->stats.loopDrops++; NG_FREE_ITEM(item); - NG_FREE_M(m); + NG_FREE_M(ctx.m); return (ELOOP); /* XXX appropriate? */ } /* Move host over to new link */ - host->linkNum = linkNum; + host->link = ctx.incoming; host->age = 0; } } else { - if (!ng_bridge_put(priv, eh->ether_shost, linkNum)) { - link->stats.memoryFailures++; + if (!ng_bridge_put(priv, eh->ether_shost, ctx.incoming)) { + ctx.incoming->stats.memoryFailures++; NG_FREE_ITEM(item); - NG_FREE_M(m); + NG_FREE_M(ctx.m); return (ENOMEM); } } @@ -653,109 +775,46 @@ ng_bridge_rcvdata(hook_p hook, item_p item) * If unicast and destination host known, deliver to host's link, * unless it is the same link as the packet came in on. */ - if (!manycast) { + if (!ctx.manycast) { /* Determine packet destination link */ if ((host = ng_bridge_get(priv, eh->ether_dhost)) != NULL) { - struct ng_bridge_link *const destLink - = priv->links[host->linkNum]; + link_p destLink = host->link; /* If destination same as incoming link, do nothing */ - KASSERT(destLink != NULL, - ("%s: link%d null", __func__, host->linkNum)); - if (destLink == link) { + if (destLink == ctx.incoming) { NG_FREE_ITEM(item); - NG_FREE_M(m); + NG_FREE_M(ctx.m); return (0); } /* Deliver packet out the destination link */ destLink->stats.xmitPackets++; - destLink->stats.xmitOctets += m->m_pkthdr.len; - NG_FWD_NEW_DATA(error, item, destLink->hook, m); - return (error); + destLink->stats.xmitOctets += ctx.m->m_pkthdr.len; + NG_FWD_NEW_DATA(ctx.error, item, destLink->hook, ctx.m); + return (ctx.error); } /* Destination host is not known */ - link->stats.recvUnknown++; + ctx.incoming->stats.recvUnknown++; } /* Distribute unknown, multicast, broadcast pkts to all other links */ - firstLink = NULL; - for (linkNum = linksSeen = 0; linksSeen <= priv->numLinks; linkNum++) { - struct ng_bridge_link *destLink; - struct mbuf *m2 = NULL; + NG_NODE_FOREACH_HOOK(node, ng_bridge_send_ctx, &ctx, ret); - /* - * If we have checked all the links then now - * send the original on its reserved link - */ - if (linksSeen == priv->numLinks) { - /* If we never saw a good link, leave. */ - if (firstLink == NULL) { - NG_FREE_ITEM(item); - NG_FREE_M(m); - return (0); - } - destLink = firstLink; - } else { - destLink = priv->links[linkNum]; - if (destLink != NULL) - linksSeen++; - /* Skip incoming link and disconnected links */ - if (destLink == NULL || destLink == link) { - continue; - } - if (firstLink == NULL) { - /* - * This is the first usable link we have found. - * Reserve it for the originals. - * If we never find another we save a copy. - */ - firstLink = destLink; - continue; - } - - /* - * It's usable link but not the reserved (first) one. - * Copy mbuf info for sending. - */ - m2 = m_dup(m, M_NOWAIT); /* XXX m_copypacket() */ - if (m2 == NULL) { - link->stats.memoryFailures++; - NG_FREE_ITEM(item); - NG_FREE_M(m); - return (ENOBUFS); - } - } - - /* Update stats */ - destLink->stats.xmitPackets++; - destLink->stats.xmitOctets += m->m_pkthdr.len; - switch (manycast) { - case 0: /* unicast */ - break; - case 1: /* multicast */ - destLink->stats.xmitMulticasts++; - break; - case 2: /* broadcast */ - destLink->stats.xmitBroadcasts++; - break; - } - - /* Send packet */ - if (destLink == firstLink) { - /* - * If we've sent all the others, send the original - * on the first link we found. - */ - NG_FWD_NEW_DATA(error, item, destLink->hook, m); - break; /* always done last - not really needed. */ - } else { - NG_SEND_DATA_ONLY(error, destLink->hook, m2); - } + /* If we never saw a good link, leave. */ + if (ctx.foundFirst == NULL || ctx.error != 0) { + NG_FREE_ITEM(item); + NG_FREE_M(ctx.m); + return (ctx.error); } - return (error); + + /* + * If we've sent all the others, send the original + * on the first link we found. + */ + NG_FWD_NEW_DATA(ctx.error, item, ctx.foundFirst->hook, ctx.m); + return (ctx.error); } /* @@ -791,20 +850,13 @@ static int ng_bridge_disconnect(hook_p hook) { const priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - int linkNum; + link_p link = NG_HOOK_PRIVATE(hook); - /* Get link number */ - linkNum = (intptr_t)NG_HOOK_PRIVATE(hook); - KASSERT(linkNum >= 0 && linkNum < NG_BRIDGE_MAX_LINKS, - ("%s: linkNum=%u", __func__, linkNum)); - /* Remove all hosts associated with this link */ - ng_bridge_remove_hosts(priv, linkNum); + ng_bridge_remove_hosts(priv, link); /* Free associated link information */ - KASSERT(priv->links[linkNum] != NULL, ("%s: no link", __func__)); - free(priv->links[linkNum], M_NETGRAPH_BRIDGE); - priv->links[linkNum] = NULL; + free(link, M_NETGRAPH_BRIDGE); priv->numLinks--; /* If no more hooks, go away */ @@ -849,7 +901,7 @@ ng_bridge_get(priv_p priv, const u_char *addr) * was a memory allocation failure. */ static int -ng_bridge_put(priv_p priv, const u_char *addr, int linkNum) +ng_bridge_put(priv_p priv, const u_char *addr, link_p link) { const int bucket = HASH(addr, priv->hashMask); struct ng_bridge_hent *hent; @@ -867,7 +919,7 @@ ng_bridge_put(priv_p priv, const u_char *addr, int lin if (hent == NULL) return (0); bcopy(addr, hent->host.addr, ETHER_ADDR_LEN); - hent->host.linkNum = linkNum; + hent->host.link = link; hent->host.staleness = 0; hent->host.age = 0; @@ -943,12 +995,13 @@ ng_bridge_rehash(priv_p priv) MISC FUNCTIONS ******************************************************************/ + /* * Remove all hosts associated with a specific link from the hashtable. * If linkNum == -1, then remove all hosts in the table. */ static void -ng_bridge_remove_hosts(priv_p priv, int linkNum) +ng_bridge_remove_hosts(priv_p priv, link_p link) { int bucket; @@ -958,7 +1011,7 @@ ng_bridge_remove_hosts(priv_p priv, int linkNum) while (*hptr != NULL) { struct ng_bridge_hent *const hent = *hptr; - if (linkNum == -1 || hent->host.linkNum == linkNum) { + if (link == NULL || hent->host.link == link) { *hptr = SLIST_NEXT(hent, next); free(hent, M_NETGRAPH_BRIDGE); priv->numHosts--; @@ -974,13 +1027,33 @@ ng_bridge_remove_hosts(priv_p priv, int linkNum) * a detected loopback condition, and we remove any hosts from * the hashtable whom we haven't heard from in a long while. */ +static int +ng_bridge_unmute(hook_p hook, void *arg) +{ + link_p link = NG_HOOK_PRIVATE(hook); + node_p node = NG_HOOK_NODE(hook); + priv_p priv = NG_NODE_PRIVATE(node); + int *counter = arg; + + if (link->loopCount != 0) { + link->loopCount--; + if (link->loopCount == 0 && priv->conf.debugLevel >= 2) { + log(LOG_INFO, "ng_bridge: %s:" + " restoring looped back %s\n", + ng_bridge_nodename(node), NG_HOOK_NAME(hook)); + } + } + (*counter)++; + return (1); +} + static void ng_bridge_timeout(node_p node, hook_p hook, void *arg1, int arg2) { const priv_p priv = NG_NODE_PRIVATE(node); int bucket; int counter = 0; - int linkNum; + hook_p ret; /* Update host time counters and remove stale entries */ for (bucket = 0; bucket < priv->numBuckets; bucket++) { @@ -989,12 +1062,6 @@ ng_bridge_timeout(node_p node, hook_p hook, void *arg1 while (*hptr != NULL) { struct ng_bridge_hent *const hent = *hptr; - /* Make sure host's link really exists */ - KASSERT(priv->links[hent->host.linkNum] != NULL, - ("%s: host %6D on nonexistent link %d\n", - __func__, hent->host.addr, ":", - hent->host.linkNum)); - /* Remove hosts we haven't heard from in a while */ if (++hent->host.staleness >= priv->conf.maxStaleness) { *hptr = SLIST_NEXT(hent, next); @@ -1015,22 +1082,8 @@ ng_bridge_timeout(node_p node, hook_p hook, void *arg1 ng_bridge_rehash(priv); /* Decrease loop counter on muted looped back links */ - for (counter = linkNum = 0; linkNum < NG_BRIDGE_MAX_LINKS; linkNum++) { - struct ng_bridge_link *const link = priv->links[linkNum]; - - if (link != NULL) { - if (link->loopCount != 0) { - link->loopCount--; - if (link->loopCount == 0 - && priv->conf.debugLevel >= 2) { - log(LOG_INFO, "ng_bridge: %s:" - " restoring looped back link%d\n", - ng_bridge_nodename(node), linkNum); - } - } - counter++; - } - } + counter = 0; + NG_NODE_FOREACH_HOOK(node, ng_bridge_unmute, &counter, ret); KASSERT(priv->numLinks == counter, ("%s: links: %d != %d", __func__, priv->numLinks, counter)); Modified: stable/12/sys/netgraph/ng_bridge.h ============================================================================== --- stable/12/sys/netgraph/ng_bridge.h Tue Jan 28 17:34:05 2020 (r357205) +++ stable/12/sys/netgraph/ng_bridge.h Tue Jan 28 17:39:03 2020 (r357206) @@ -43,29 +43,45 @@ #ifndef _NETGRAPH_NG_BRIDGE_H_ #define _NETGRAPH_NG_BRIDGE_H_ +/* + * Support the older ABI based on fixed size tables. + * ABI is deprecated, to be removed in releases > 12 + * Please note: There is no API support! + * You canno create new messages using the old API but messages conforming the + * old ABI are understood. + */ +#define NGM_BRIDGE_TABLE_ABI + /* Node type name and magic cookie */ #define NG_BRIDGE_NODE_TYPE "bridge" -#define NGM_BRIDGE_COOKIE 967239368 +#define NGM_BRIDGE_COOKIE 1569321993 +#ifdef NGM_BRIDGE_TABLE_ABI +#define NGM_BRIDGE_COOKIE_TBL 967239368 +#define NG_BRIDGE_MAX_LINKS 32 +#endif /* NGM_BRIDGE_TABLE_ABI */ + /* Hook names */ #define NG_BRIDGE_HOOK_LINK_PREFIX "link" /* append decimal integer */ #define NG_BRIDGE_HOOK_LINK_FMT "link%d" /* for use with printf(3) */ -/* Maximum number of supported links */ -#define NG_BRIDGE_MAX_LINKS 32 - /* Node configuration structure */ struct ng_bridge_config { - u_char ipfw[NG_BRIDGE_MAX_LINKS]; /* enable ipfw */ u_char debugLevel; /* debug level */ u_int32_t loopTimeout; /* link loopback mute time */ u_int32_t maxStaleness; /* max host age before nuking */ u_int32_t minStableAge; /* min time for a stable host */ }; +#ifdef NGM_BRIDGE_TABLE_ABI +struct ng_bridge_config_tbl { + u_char ipfw[NG_BRIDGE_MAX_LINKS]; + struct ng_bridge_config cfg; +}; +#endif /* NGM_BRIDGE_TABLE_ABI */ + /* Keep this in sync with the above structure definition */ -#define NG_BRIDGE_CONFIG_TYPE_INFO(ainfo) { \ - { "ipfw", (ainfo) }, \ +#define NG_BRIDGE_CONFIG_TYPE_INFO { \ { "debugLevel", &ng_parse_uint8_type }, \ { "loopTimeout", &ng_parse_uint32_type }, \ { "maxStaleness", &ng_parse_uint32_type }, \ @@ -110,18 +126,37 @@ struct ng_bridge_link_stats { { NULL } \ } +struct ng_bridge_link; +typedef struct ng_bridge_link *link_p; /* Structure describing a single host */ struct ng_bridge_host { u_char addr[6]; /* ethernet address */ + link_p link; /* link where addr can be found */ + u_int16_t age; /* seconds ago entry was created */ + u_int16_t staleness; /* seconds ago host last heard from */ +}; + +#ifdef NGM_BRIDGE_TABLE_ABI +struct ng_bridge_host_tbl { + u_char addr[6]; /* ethernet address */ u_int16_t linkNum; /* link where addr can be found */ u_int16_t age; /* seconds ago entry was created */ u_int16_t staleness; /* seconds ago host last heard from */ }; +#endif /* NGM_BRIDGE_TABLE_ABI */ +/* external representation of the host */ +struct ng_bridge_hostent { + u_char addr[6]; /* ethernet address */ + char hook[NG_HOOKSIZ]; /* link where addr can be found */ + u_int16_t age; /* seconds ago entry was created */ + u_int16_t staleness; /* seconds ago host last heard from */ +}; + /* Keep this in sync with the above structure definition */ #define NG_BRIDGE_HOST_TYPE_INFO(entype) { \ { "addr", (entype) }, \ - { "linkNum", &ng_parse_uint16_type }, \ + { "hook", &ng_parse_hookbuf_type }, \ { "age", &ng_parse_uint16_type }, \ { "staleness", &ng_parse_uint16_type }, \ { NULL } \ @@ -129,8 +164,8 @@ struct ng_bridge_host { /* Structure returned by NGM_BRIDGE_GET_TABLE */ struct ng_bridge_host_ary { - u_int32_t numHosts; - struct ng_bridge_host hosts[]; + u_int32_t numHosts; + struct ng_bridge_hostent hosts[]; }; /* Keep this in sync with the above structure definition */ @@ -139,6 +174,19 @@ struct ng_bridge_host_ary { { "hosts", (harytype) }, \ { NULL } \ } + +#ifdef NGM_BRIDGE_TABLE_ABI +struct ng_bridge_hostent_tbl { + u_char addr[6]; /* ethernet address */ + u_int16_t linkNum; /* link where addr can be found */ + u_int16_t age; /* seconds ago entry was created */ + u_int16_t staleness; /* seconds ago host last heard from */ +}; +struct ng_bridge_host_tbl_ary { + u_int32_t numHosts; + struct ng_bridge_hostent_tbl hosts[]; +}; +#endif /* NGM_BRIDGE_TABLE_ABI */ /* Netgraph control messages */ enum { From owner-svn-src-stable-12@freebsd.org Tue Jan 28 17:48:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72DFA2357AD; Tue, 28 Jan 2020 17:48:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 486YxW2K6Lz4J12; Tue, 28 Jan 2020 17:48:15 +0000 (UTC) (envelope-from bz@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 2DCCC26BA7; Tue, 28 Jan 2020 17:48:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00SHmFSQ095396; Tue, 28 Jan 2020 17:48:15 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00SHmFM3095395; Tue, 28 Jan 2020 17:48:15 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202001281748.00SHmFM3095395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 28 Jan 2020 17:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357207 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 357207 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2020 17:48:15 -0000 Author: bz Date: Tue Jan 28 17:48:14 2020 New Revision: 357207 URL: https://svnweb.freebsd.org/changeset/base/357207 Log: MFC r356662: nd6_rtr: constantly use __func__ for nd6log() Over time one or two hard coded function names did not match the actual function anymore. Consistently use __func__ for nd6log() calls and re-wrap/re-format some messages for consitency. Modified: stable/12/sys/netinet6/nd6_rtr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/nd6_rtr.c ============================================================================== --- stable/12/sys/netinet6/nd6_rtr.c Tue Jan 28 17:39:03 2020 (r357206) +++ stable/12/sys/netinet6/nd6_rtr.c Tue Jan 28 17:48:14 2020 (r357207) @@ -171,7 +171,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) ip6 = mtod(m, struct ip6_hdr *); if (ip6->ip6_hlim != 255) { nd6log((LOG_ERR, - "nd6_rs_input: invalid hlim (%d) from %s to %s on %s\n", + "%s: invalid hlim (%d) from %s to %s on %s\n", __func__, ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src), ip6_sprintf(ip6bufd, &ip6->ip6_dst), if_name(ifp))); goto bad; @@ -199,7 +199,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) nd6_option_init(nd_rs + 1, icmp6len, &ndopts); if (nd6_options(&ndopts) < 0) { nd6log((LOG_INFO, - "nd6_rs_input: invalid ND option, ignored\n")); + "%s: invalid ND option, ignored\n", __func__)); /* nd6_options have incremented stats */ goto freeit; } @@ -213,9 +213,8 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, - "nd6_rs_input: lladdrlen mismatch for %s " - "(if %d, RS packet %d)\n", - ip6_sprintf(ip6bufs, &saddr6), + "%s: lladdrlen mismatch for %s (if %d, RS packet %d)\n", + __func__, ip6_sprintf(ip6bufs, &saddr6), ifp->if_addrlen, lladdrlen - 2)); goto bad; } @@ -267,7 +266,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) ip6 = mtod(m, struct ip6_hdr *); if (ip6->ip6_hlim != 255) { nd6log((LOG_ERR, - "nd6_ra_input: invalid hlim (%d) from %s to %s on %s\n", + "%s: invalid hlim (%d) from %s to %s on %s\n", __func__, ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src), ip6_sprintf(ip6bufd, &ip6->ip6_dst), if_name(ifp))); goto bad; @@ -276,7 +275,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) saddr6 = ip6->ip6_src; if (!IN6_IS_ADDR_LINKLOCAL(&saddr6)) { nd6log((LOG_ERR, - "nd6_ra_input: src %s is not link-local\n", + "%s: src %s is not link-local\n", __func__, ip6_sprintf(ip6bufs, &saddr6))); goto bad; } @@ -295,7 +294,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) nd6_option_init(nd_ra + 1, icmp6len, &ndopts); if (nd6_options(&ndopts) < 0) { nd6log((LOG_INFO, - "nd6_ra_input: invalid ND option, ignored\n")); + "%s: invalid ND option, ignored\n", __func__)); /* nd6_options have incremented stats */ goto freeit; } @@ -369,26 +368,25 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) if (pi->nd_opt_pi_len != 4) { nd6log((LOG_INFO, - "nd6_ra_input: invalid option " - "len %d for prefix information option, " - "ignored\n", pi->nd_opt_pi_len)); + "%s: invalid option len %d for prefix " + "information option, ignored\n", __func__, + pi->nd_opt_pi_len)); continue; } if (128 < pi->nd_opt_pi_prefix_len) { nd6log((LOG_INFO, - "nd6_ra_input: invalid prefix " - "len %d for prefix information option, " - "ignored\n", pi->nd_opt_pi_prefix_len)); + "%s: invalid prefix len %d for prefix " + "information option, ignored\n", __func__, + pi->nd_opt_pi_prefix_len)); continue; } if (IN6_IS_ADDR_MULTICAST(&pi->nd_opt_pi_prefix) || IN6_IS_ADDR_LINKLOCAL(&pi->nd_opt_pi_prefix)) { nd6log((LOG_INFO, - "nd6_ra_input: invalid prefix " - "%s, ignored\n", - ip6_sprintf(ip6bufs, + "%s: invalid prefix %s, ignored\n", + __func__, ip6_sprintf(ip6bufs, &pi->nd_opt_pi_prefix))); continue; } @@ -425,8 +423,8 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) /* lower bound */ if (mtu < IPV6_MMTU) { - nd6log((LOG_INFO, "nd6_ra_input: bogus mtu option " - "mtu=%lu sent from %s, ignoring\n", + nd6log((LOG_INFO, "%s: bogus mtu option mtu=%lu sent " + "from %s, ignoring\n", __func__, mtu, ip6_sprintf(ip6bufs, &ip6->ip6_src))); goto skip; } @@ -444,9 +442,8 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) rt_updatemtu(ifp); } } else { - nd6log((LOG_INFO, "nd6_ra_input: bogus mtu " - "mtu=%lu sent from %s; " - "exceeds maxmtu %lu, ignoring\n", + nd6log((LOG_INFO, "%s: bogus mtu=%lu sent from %s; " + "exceeds maxmtu %lu, ignoring\n", __func__, mtu, ip6_sprintf(ip6bufs, &ip6->ip6_src), maxmtu)); } } @@ -467,8 +464,8 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, - "nd6_ra_input: lladdrlen mismatch for %s " - "(if %d, RA packet %d)\n", ip6_sprintf(ip6bufs, &saddr6), + "%s: lladdrlen mismatch for %s (if %d, RA packet %d)\n", + __func__, ip6_sprintf(ip6bufs, &saddr6), ifp->if_addrlen, lladdrlen - 2)); goto bad; } @@ -1135,9 +1132,9 @@ in6_ifadd(struct nd_prefixctl *pr, int mcast) plen0 = in6_mask2len(&ib->ia_prefixmask.sin6_addr, NULL); if (prefixlen != plen0) { ifa_free(ifa); - nd6log((LOG_INFO, "in6_ifadd: wrong prefixlen for %s " - "(prefix=%d ifid=%d)\n", - if_name(ifp), prefixlen, 128 - plen0)); + nd6log((LOG_INFO, + "%s: wrong prefixlen for %s (prefix=%d ifid=%d)\n", + __func__, if_name(ifp), prefixlen, 128 - plen0)); return NULL; } @@ -1190,7 +1187,7 @@ in6_ifadd(struct nd_prefixctl *pr, int mcast) updateflags |= IN6_IFAUPDATE_DADDELAY; if ((error = in6_update_ifa(ifp, &ifra, NULL, updateflags)) != 0) { nd6log((LOG_ERR, - "in6_ifadd: failed to make ifaddr %s on %s (errno=%d)\n", + "%s: failed to make ifaddr %s on %s (errno=%d)\n", __func__, ip6_sprintf(ip6buf, &ifra.ifra_addr.sin6_addr), if_name(ifp), error)); return (NULL); /* ifaddr must not have been allocated. */ @@ -1292,8 +1289,8 @@ nd6_prelist_add(struct nd_prefixctl *pr, struct nd_def if (new->ndpr_raf_onlink) { ND6_ONLINK_LOCK(); if ((error = nd6_prefix_onlink(new)) != 0) { - nd6log((LOG_ERR, "nd6_prelist_add: failed to make " - "the prefix %s/%d on-link on %s (errno=%d)\n", + nd6log((LOG_ERR, "%s: failed to make the prefix %s/%d " + "on-link on %s (errno=%d)\n", __func__, ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr), pr->ndpr_plen, if_name(pr->ndpr_ifp), error)); /* proceed anyway. XXX: is it correct? */ @@ -1349,8 +1346,8 @@ nd6_prefix_del(struct nd_prefix *pr) ND6_ONLINK_LOCK(); if ((e = nd6_prefix_offlink(pr)) != 0) { nd6log((LOG_ERR, - "nd6_prefix_del: failed to make %s/%d offlink " - "on %s, errno=%d\n", + "%s: failed to make the prefix %s/%d offlink on %s " + "(errno=%d)\n", __func__, ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr), pr->ndpr_plen, if_name(pr->ndpr_ifp), e)); /* what should we do? */ @@ -1421,9 +1418,8 @@ prelist_update(struct nd_prefixctl *new, struct nd_def ND6_ONLINK_LOCK(); if ((error = nd6_prefix_onlink(pr)) != 0) { nd6log((LOG_ERR, - "prelist_update: failed to make " - "the prefix %s/%d on-link on %s " - "(errno=%d)\n", + "%s: failed to make the prefix %s/%d " + "on-link on %s (errno=%d)\n", __func__, ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr), pr->ndpr_plen, if_name(pr->ndpr_ifp), @@ -1443,8 +1439,8 @@ prelist_update(struct nd_prefixctl *new, struct nd_def error = nd6_prelist_add(new, dr, &pr); if (error != 0) { - nd6log((LOG_NOTICE, "prelist_update: " - "nd6_prelist_add failed for %s/%d on %s errno=%d\n", + nd6log((LOG_NOTICE, "%s: nd6_prelist_add() failed for " + "the prefix %s/%d on %s (errno=%d)\n", __func__, ip6_sprintf(ip6buf, &new->ndpr_prefix.sin6_addr), new->ndpr_plen, if_name(new->ndpr_ifp), error)); goto end; /* we should just give up in this case. */ @@ -1644,9 +1640,8 @@ prelist_update(struct nd_prefixctl *new, struct nd_def } if (ifidlen + pr->ndpr_plen != 128) { nd6log((LOG_INFO, - "prelist_update: invalid prefixlen " - "%d for %s, ignored\n", - pr->ndpr_plen, if_name(ifp))); + "%s: invalid prefixlen %d for %s, ignored\n", + __func__, pr->ndpr_plen, if_name(ifp))); goto end; } @@ -1672,10 +1667,9 @@ prelist_update(struct nd_prefixctl *new, struct nd_def if (V_ip6_use_tempaddr) { int e; if ((e = in6_tmpifadd(ia6, 1, 1)) != 0) { - nd6log((LOG_NOTICE, "prelist_update: " - "failed to create a temporary " - "address, errno=%d\n", - e)); + nd6log((LOG_NOTICE, "%s: failed to " + "create a temporary address " + "(errno=%d)\n", __func__, e)); } } ifa_free(&ia6->ia_ifa); @@ -1838,16 +1832,16 @@ restart: if ((flags & NDPRF_ONLINK) != 0 && (e = nd6_prefix_offlink(pr)) != 0) { nd6log((LOG_ERR, - "pfxlist_onlink_check: failed to " - "make %s/%d offlink, errno=%d\n", + "%s: failed to make %s/%d offlink " + "(errno=%d)\n", __func__, ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr), pr->ndpr_plen, e)); } else if ((flags & NDPRF_ONLINK) == 0 && (e = nd6_prefix_onlink(pr)) != 0) { nd6log((LOG_ERR, - "pfxlist_onlink_check: failed to " - "make %s/%d onlink, errno=%d\n", + "%s: failed to make %s/%d onlink " + "(errno=%d)\n", __func__, ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr), pr->ndpr_plen, e)); @@ -1980,9 +1974,9 @@ nd6_prefix_onlink_rtrequest(struct nd_prefix *pr, stru struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *)ifa->ifa_addr; - nd6log((LOG_ERR, "nd6_prefix_onlink: failed to add " + nd6log((LOG_ERR, "%s: failed to add " "route for a prefix (%s/%d) on %s, gw=%s, mask=%s, " - "flags=%lx errno = %d\n", + "flags=%lx errno = %d\n", __func__, ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr), pr->ndpr_plen, if_name(pr->ndpr_ifp), ip6_sprintf(ip6bufg, &sin6->sin6_addr), @@ -2073,8 +2067,8 @@ nd6_prefix_onlink(struct nd_prefix *pr) * interface. This should, of course, be rare though. */ nd6log((LOG_NOTICE, - "nd6_prefix_onlink: failed to find any ifaddr" - " to add route for a prefix(%s/%d) on %s\n", + "%s: failed to find any ifaddr to add route for a " + "prefix(%s/%d) on %s\n", __func__, ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr), pr->ndpr_plen, if_name(ifp))); return (0); @@ -2173,10 +2167,9 @@ restart: ND6_RUNLOCK(); if ((e = nd6_prefix_onlink(opr)) != 0) { nd6log((LOG_ERR, - "nd6_prefix_offlink: failed to " - "recover a prefix %s/%d from %s " - "to %s (errno = %d)\n", - ip6_sprintf(ip6buf, + "%s: failed to recover a prefix " + "%s/%d from %s to %s (errno=%d)\n", + __func__, ip6_sprintf(ip6buf, &opr->ndpr_prefix.sin6_addr), opr->ndpr_plen, if_name(ifp), if_name(opr->ndpr_ifp), e)); @@ -2191,10 +2184,9 @@ restart: } else { /* XXX: can we still set the NDPRF_ONLINK flag? */ nd6log((LOG_ERR, - "nd6_prefix_offlink: failed to delete route: " - "%s/%d on %s (errno = %d)\n", - ip6_sprintf(ip6buf, &sa6.sin6_addr), pr->ndpr_plen, - if_name(ifp), error)); + "%s: failed to delete route: %s/%d on %s (errno=%d)\n", + __func__, ip6_sprintf(ip6buf, &sa6.sin6_addr), + pr->ndpr_plen, if_name(ifp), error)); } if (a_failure) @@ -2230,8 +2222,8 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcege again: if (in6_get_tmpifid(ifp, (u_int8_t *)randid, (const u_int8_t *)&ia0->ia_addr.sin6_addr.s6_addr[8], forcegen)) { - nd6log((LOG_NOTICE, "in6_tmpifadd: failed to find a good " - "random IFID\n")); + nd6log((LOG_NOTICE, "%s: failed to find a good random IFID\n", + __func__)); return (EINVAL); } ifra.ifra_addr.sin6_addr.s6_addr32[2] |= @@ -2253,8 +2245,8 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcege } /* Give up. Something strange should have happened. */ - nd6log((LOG_NOTICE, "in6_tmpifadd: failed to " - "find a unique random IFID\n")); + nd6log((LOG_NOTICE, "%s: failed to find a unique random IFID\n", + __func__)); return (EEXIST); } @@ -2307,8 +2299,8 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcege newia = in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr); if (newia == NULL) { /* XXX: can it happen? */ nd6log((LOG_ERR, - "in6_tmpifadd: ifa update succeeded, but we got " - "no ifaddr\n")); + "%s: ifa update succeeded, but we got no ifaddr\n", + __func__)); return (EINVAL); /* XXX */ } newia->ia6_ndpr = ia0->ia6_ndpr; From owner-svn-src-stable-12@freebsd.org Tue Jan 28 18:08:56 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3711A235F94; Tue, 28 Jan 2020 18:08:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 486ZPN0jXzz4KCM; Tue, 28 Jan 2020 18:08:56 +0000 (UTC) (envelope-from bz@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 13A3426F4F; Tue, 28 Jan 2020 18:08:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00SI8tiw007707; Tue, 28 Jan 2020 18:08:55 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00SI8rcV007696; Tue, 28 Jan 2020 18:08:53 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202001281808.00SI8rcV007696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 28 Jan 2020 18:08:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357210 - in stable/12: libexec/rc/rc.d sys/dev/cxgbe/tom sys/netinet sys/netinet/tcp_stacks sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in stable/12: libexec/rc/rc.d sys/dev/cxgbe/tom sys/netinet sys/netinet/tcp_stacks sys/netinet6 X-SVN-Commit-Revision: 357210 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2020 18:08:56 -0000 Author: bz Date: Tue Jan 28 18:08:53 2020 New Revision: 357210 URL: https://svnweb.freebsd.org/changeset/base/357210 Log: MFC r356527-356528: vnet: virtualise more network stack sysctls. Virtualise tcp_always_keepalive, TCP and UDP log_in_vain. All three are set in the netoptions startup script, which we would love to run for VNETs as well. While virtualising the log_in_vain sysctls seems pointles at first for as long as the kernel message buffer is not virtualised, it at least allows an administrator to debug the base system or an individual jail if needed without turning the logging on for all jails running on a system. Run netoptions startup script in vnet jails. People use rc.conf inside vnet jails to configure networking setups. Presumably because some sysctl were not virtualised up until r356527 the script was not run for vnet jails leaving the rc.conf options without effect for non-obvious reasons. Run the netoptions startup script also for VNET jails now to make the rc.conf options work. PR: 243193 Modified: stable/12/libexec/rc/rc.d/netoptions stable/12/sys/dev/cxgbe/tom/t4_tom.c stable/12/sys/netinet/tcp_input.c stable/12/sys/netinet/tcp_stacks/rack.c stable/12/sys/netinet/tcp_subr.c stable/12/sys/netinet/tcp_timer.c stable/12/sys/netinet/tcp_timer.h stable/12/sys/netinet/tcp_var.h stable/12/sys/netinet/udp_usrreq.c stable/12/sys/netinet/udp_var.h stable/12/sys/netinet6/udp6_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/netoptions ============================================================================== --- stable/12/libexec/rc/rc.d/netoptions Tue Jan 28 18:04:17 2020 (r357209) +++ stable/12/libexec/rc/rc.d/netoptions Tue Jan 28 18:08:53 2020 (r357210) @@ -6,7 +6,7 @@ # PROVIDE: netoptions # REQUIRE: FILESYSTEMS # BEFORE: netif -# KEYWORD: nojail +# KEYWORD: nojailvnet . /etc/rc.subr . /etc/network.subr Modified: stable/12/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_tom.c Tue Jan 28 18:04:17 2020 (r357209) +++ stable/12/sys/dev/cxgbe/tom/t4_tom.c Tue Jan 28 18:08:53 2020 (r357210) @@ -1131,7 +1131,7 @@ init_conn_params(struct vi_info *vi , struct offload_s cp->nagle = tp->t_flags & TF_NODELAY ? 0 : 1; /* TCP Keepalive. */ - if (tcp_always_keepalive || so_options_get(so) & SO_KEEPALIVE) + if (V_tcp_always_keepalive || so_options_get(so) & SO_KEEPALIVE) cp->keepalive = 1; else cp->keepalive = 0; Modified: stable/12/sys/netinet/tcp_input.c ============================================================================== --- stable/12/sys/netinet/tcp_input.c Tue Jan 28 18:04:17 2020 (r357209) +++ stable/12/sys/netinet/tcp_input.c Tue Jan 28 18:08:53 2020 (r357210) @@ -129,9 +129,9 @@ __FBSDID("$FreeBSD$"); const int tcprexmtthresh = 3; -int tcp_log_in_vain = 0; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_in_vain, CTLFLAG_RW, - &tcp_log_in_vain, 0, +VNET_DEFINE(int, tcp_log_in_vain) = 0; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_in_vain, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_log_in_vain), 0, "Log all incoming TCP segments to closed ports"); VNET_DEFINE(int, blackhole) = 0; @@ -886,8 +886,8 @@ findpcb: * Log communication attempts to ports that are not * in use. */ - if ((tcp_log_in_vain == 1 && (thflags & TH_SYN)) || - tcp_log_in_vain == 2) { + if ((V_tcp_log_in_vain == 1 && (thflags & TH_SYN)) || + V_tcp_log_in_vain == 2) { if ((s = tcp_log_vain(NULL, th, (void *)ip, ip6))) log(LOG_INFO, "%s; %s: Connection attempt " "to closed port\n", s, __func__); Modified: stable/12/sys/netinet/tcp_stacks/rack.c ============================================================================== --- stable/12/sys/netinet/tcp_stacks/rack.c Tue Jan 28 18:04:17 2020 (r357209) +++ stable/12/sys/netinet/tcp_stacks/rack.c Tue Jan 28 18:08:53 2020 (r357210) @@ -2357,7 +2357,7 @@ rack_start_hpts_timer(struct tcp_rack *rack, struct tc */ if ((hpts_timeout == 0) && (slot == 0)) { - if ((tcp_always_keepalive || inp->inp_socket->so_options & SO_KEEPALIVE) && + if ((V_tcp_always_keepalive || inp->inp_socket->so_options & SO_KEEPALIVE) && (tp->t_state <= TCPS_CLOSING)) { /* * Ok we have no timer (persists, rack, tlp, rxt or @@ -2789,7 +2789,7 @@ rack_timeout_keepalive(struct tcpcb *tp, struct tcp_ra TCPSTAT_INC(tcps_keeptimeo); if (tp->t_state < TCPS_ESTABLISHED) goto dropit; - if ((tcp_always_keepalive || inp->inp_socket->so_options & SO_KEEPALIVE) && + if ((V_tcp_always_keepalive || inp->inp_socket->so_options & SO_KEEPALIVE) && tp->t_state <= TCPS_CLOSING) { if (ticks - tp->t_rcvtime >= TP_KEEPIDLE(tp) + TP_MAXIDLE(tp)) goto dropit; @@ -6546,7 +6546,7 @@ rack_timer_audit(struct tcpcb *tp, struct tcp_rack *ra * of nothing outstanding and the RXT up (and the hptsi timer). */ return; - } else if (((tcp_always_keepalive || + } else if (((V_tcp_always_keepalive || rack->rc_inp->inp_socket->so_options & SO_KEEPALIVE) && (tp->t_state <= TCPS_CLOSING)) && (tmr_up == PACE_TMR_KEEP) && @@ -6861,7 +6861,7 @@ rack_hpts_do_segment(struct mbuf *m, struct tcphdr *th if (((rack->r_ctl.rc_hpts_flags & PACE_TMR_MASK) == 0) && (SEQ_GT(tp->snd_max, tp->snd_una) || (tp->t_flags & TF_DELACK) || - ((tcp_always_keepalive || rack->rc_inp->inp_socket->so_options & SO_KEEPALIVE) && + ((V_tcp_always_keepalive || rack->rc_inp->inp_socket->so_options & SO_KEEPALIVE) && (tp->t_state <= TCPS_CLOSING)))) { /* We could not send (probably in the hpts but stopped the timer earlier)? */ if ((tp->snd_max == tp->snd_una) && Modified: stable/12/sys/netinet/tcp_subr.c ============================================================================== --- stable/12/sys/netinet/tcp_subr.c Tue Jan 28 18:04:17 2020 (r357209) +++ stable/12/sys/netinet/tcp_subr.c Tue Jan 28 18:08:53 2020 (r357210) @@ -3108,7 +3108,7 @@ tcp_log_vain(struct in_conninfo *inc, struct tcphdr *t { /* Is logging enabled? */ - if (tcp_log_in_vain == 0) + if (V_tcp_log_in_vain == 0) return (NULL); return (tcp_log_addr(inc, th, ip4hdr, ip6hdr)); Modified: stable/12/sys/netinet/tcp_timer.c ============================================================================== --- stable/12/sys/netinet/tcp_timer.c Tue Jan 28 18:04:17 2020 (r357209) +++ stable/12/sys/netinet/tcp_timer.c Tue Jan 28 18:08:53 2020 (r357210) @@ -125,9 +125,10 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_slop, CTLT &tcp_rexmit_slop, 0, sysctl_msec_to_ticks, "I", "Retransmission Timer Slop"); -int tcp_always_keepalive = 1; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, always_keepalive, CTLFLAG_RW, - &tcp_always_keepalive , 0, "Assume SO_KEEPALIVE on all TCP connections"); +VNET_DEFINE(int, tcp_always_keepalive) = 1; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, always_keepalive, CTLFLAG_VNET|CTLFLAG_RW, + &VNET_NAME(tcp_always_keepalive) , 0, + "Assume SO_KEEPALIVE on all TCP connections"); int tcp_fast_finwait2_recycle = 0; SYSCTL_INT(_net_inet_tcp, OID_AUTO, fast_finwait2_recycle, CTLFLAG_RW, @@ -431,7 +432,7 @@ tcp_timer_keep(void *xtp) TCPSTAT_INC(tcps_keeptimeo); if (tp->t_state < TCPS_ESTABLISHED) goto dropit; - if ((tcp_always_keepalive || + if ((V_tcp_always_keepalive || inp->inp_socket->so_options & SO_KEEPALIVE) && tp->t_state <= TCPS_CLOSING) { if (ticks - tp->t_rcvtime >= TP_KEEPIDLE(tp) + TP_MAXIDLE(tp)) Modified: stable/12/sys/netinet/tcp_timer.h ============================================================================== --- stable/12/sys/netinet/tcp_timer.h Tue Jan 28 18:04:17 2020 (r357209) +++ stable/12/sys/netinet/tcp_timer.h Tue Jan 28 18:08:53 2020 (r357210) @@ -203,10 +203,11 @@ extern int tcp_backoff[]; extern int tcp_totbackoff; extern int tcp_rexmit_drop_options; -extern int tcp_always_keepalive; extern int tcp_finwait2_timeout; extern int tcp_fast_finwait2_recycle; +VNET_DECLARE(int, tcp_always_keepalive); +#define V_tcp_always_keepalive VNET(tcp_always_keepalive) VNET_DECLARE(int, tcp_pmtud_blackhole_detect); #define V_tcp_pmtud_blackhole_detect VNET(tcp_pmtud_blackhole_detect) VNET_DECLARE(int, tcp_pmtud_blackhole_mss); Modified: stable/12/sys/netinet/tcp_var.h ============================================================================== --- stable/12/sys/netinet/tcp_var.h Tue Jan 28 18:04:17 2020 (r357209) +++ stable/12/sys/netinet/tcp_var.h Tue Jan 28 18:08:53 2020 (r357210) @@ -745,7 +745,8 @@ SYSCTL_DECL(_net_inet_tcp_sack); MALLOC_DECLARE(M_TCPLOG); #endif -extern int tcp_log_in_vain; +VNET_DECLARE(int, tcp_log_in_vain); +#define V_tcp_log_in_vain VNET(tcp_log_in_vain) /* * Global TCP tunables shared between different stacks. Modified: stable/12/sys/netinet/udp_usrreq.c ============================================================================== --- stable/12/sys/netinet/udp_usrreq.c Tue Jan 28 18:04:17 2020 (r357209) +++ stable/12/sys/netinet/udp_usrreq.c Tue Jan 28 18:08:53 2020 (r357210) @@ -116,9 +116,9 @@ VNET_DEFINE(int, udp_cksum) = 1; SYSCTL_INT(_net_inet_udp, UDPCTL_CHECKSUM, checksum, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(udp_cksum), 0, "compute udp checksum"); -int udp_log_in_vain = 0; -SYSCTL_INT(_net_inet_udp, OID_AUTO, log_in_vain, CTLFLAG_RW, - &udp_log_in_vain, 0, "Log all incoming UDP packets"); +VNET_DEFINE(int, udp_log_in_vain) = 0; +SYSCTL_INT(_net_inet_udp, OID_AUTO, log_in_vain, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(udp_log_in_vain), 0, "Log all incoming UDP packets"); VNET_DEFINE(int, udp_blackhole) = 0; SYSCTL_INT(_net_inet_udp, OID_AUTO, blackhole, CTLFLAG_VNET | CTLFLAG_RW, @@ -688,7 +688,7 @@ udp_input(struct mbuf **mp, int *offp, int proto) ip->ip_dst, uh->uh_dport, INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, ifp, m); if (inp == NULL) { - if (udp_log_in_vain) { + if (V_udp_log_in_vain) { char src[INET_ADDRSTRLEN]; char dst[INET_ADDRSTRLEN]; Modified: stable/12/sys/netinet/udp_var.h ============================================================================== --- stable/12/sys/netinet/udp_var.h Tue Jan 28 18:04:17 2020 (r357209) +++ stable/12/sys/netinet/udp_var.h Tue Jan 28 18:08:53 2020 (r357210) @@ -149,9 +149,10 @@ extern u_long udp_sendspace; extern u_long udp_recvspace; VNET_DECLARE(int, udp_cksum); VNET_DECLARE(int, udp_blackhole); +VNET_DECLARE(int, udp_log_in_vain); #define V_udp_cksum VNET(udp_cksum) #define V_udp_blackhole VNET(udp_blackhole) -extern int udp_log_in_vain; +#define V_udp_log_in_vain VNET(udp_log_in_vain) static __inline struct inpcbinfo * udp_get_inpcbinfo(int protocol) Modified: stable/12/sys/netinet6/udp6_usrreq.c ============================================================================== --- stable/12/sys/netinet6/udp6_usrreq.c Tue Jan 28 18:04:17 2020 (r357209) +++ stable/12/sys/netinet6/udp6_usrreq.c Tue Jan 28 18:08:53 2020 (r357210) @@ -483,7 +483,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif, m); if (inp == NULL) { - if (udp_log_in_vain) { + if (V_udp_log_in_vain) { char ip6bufs[INET6_ADDRSTRLEN]; char ip6bufd[INET6_ADDRSTRLEN]; From owner-svn-src-stable-12@freebsd.org Tue Jan 28 18:40:55 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C84AD2370F6; Tue, 28 Jan 2020 18:40:55 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 486b6H4y5xz4MJR; Tue, 28 Jan 2020 18:40:55 +0000 (UTC) (envelope-from gordon@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 A532827536; Tue, 28 Jan 2020 18:40:55 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00SIetCC028515; Tue, 28 Jan 2020 18:40:55 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00SIet6B028514; Tue, 28 Jan 2020 18:40:55 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <202001281840.00SIet6B028514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Tue, 28 Jan 2020 18:40:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357213 - stable/12/lib/libfetch X-SVN-Group: stable-12 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: stable/12/lib/libfetch X-SVN-Commit-Revision: 357213 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2020 18:40:55 -0000 Author: gordon Date: Tue Jan 28 18:40:55 2020 New Revision: 357213 URL: https://svnweb.freebsd.org/changeset/base/357213 Log: MFC 357212. Fix urldecode buffer overrun. Reported by: Duncan Overbruck Approved by: so Security: FreeBSD-SA-20:01.libfetch Security: CVE-2020-7450 Modified: stable/12/lib/libfetch/fetch.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libfetch/fetch.c ============================================================================== --- stable/12/lib/libfetch/fetch.c Tue Jan 28 18:37:18 2020 (r357212) +++ stable/12/lib/libfetch/fetch.c Tue Jan 28 18:40:55 2020 (r357213) @@ -330,6 +330,8 @@ fetch_pctdecode(char *dst, const char *src, size_t dle } if (dlen-- > 0) *dst++ = c; + else + return (NULL); } return (s); } @@ -377,11 +379,15 @@ fetchParseURL(const char *URL) if (p && *p == '@') { /* username */ q = fetch_pctdecode(u->user, URL, URL_USERLEN); + if (q == NULL) + goto ouch; /* password */ - if (*q == ':') + if (*q == ':') { q = fetch_pctdecode(u->pwd, q + 1, URL_PWDLEN); - + if (q == NULL) + goto ouch; + } p++; } else { p = URL; From owner-svn-src-stable-12@freebsd.org Wed Jan 29 09:33:40 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F15861D115A; Wed, 29 Jan 2020 09:33:40 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 486ywN65shz4Mcd; Wed, 29 Jan 2020 09:33:40 +0000 (UTC) (envelope-from royger@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 B294F9FFB; Wed, 29 Jan 2020 09:33:40 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00T9XeZj065962; Wed, 29 Jan 2020 09:33:40 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00T9Xerx065961; Wed, 29 Jan 2020 09:33:40 GMT (envelope-from royger@FreeBSD.org) Message-Id: <202001290933.00T9Xerx065961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Wed, 29 Jan 2020 09:33:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357251 - stable/12/sys/x86/xen X-SVN-Group: stable-12 X-SVN-Commit-Author: royger X-SVN-Commit-Paths: stable/12/sys/x86/xen X-SVN-Commit-Revision: 357251 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jan 2020 09:33:41 -0000 Author: royger Date: Wed Jan 29 09:33:40 2020 New Revision: 357251 URL: https://svnweb.freebsd.org/changeset/base/357251 Log: MFC r354637: xen: fix dispatching of NMIs Modified: stable/12/sys/x86/xen/xen_apic.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/xen/xen_apic.c ============================================================================== --- stable/12/sys/x86/xen/xen_apic.c Wed Jan 29 08:46:35 2020 (r357250) +++ stable/12/sys/x86/xen/xen_apic.c Wed Jan 29 09:33:40 2020 (r357251) @@ -72,7 +72,6 @@ static driver_filter_t xen_invlcache; static driver_filter_t xen_ipi_bitmap_handler; static driver_filter_t xen_cpustop_handler; static driver_filter_t xen_cpususpend_handler; -static driver_filter_t xen_cpustophard_handler; #endif /*---------------------------------- Macros ----------------------------------*/ @@ -96,7 +95,6 @@ static struct xen_ipi_handler xen_ipis[] = [IPI_TO_IDX(IPI_BITMAP_VECTOR)] = { xen_ipi_bitmap_handler, "b" }, [IPI_TO_IDX(IPI_STOP)] = { xen_cpustop_handler, "st" }, [IPI_TO_IDX(IPI_SUSPEND)] = { xen_cpususpend_handler, "sp" }, - [IPI_TO_IDX(IPI_STOP_HARD)] = { xen_cpustophard_handler, "sth" }, }; #endif @@ -259,12 +257,52 @@ xen_pv_lapic_ipi_raw(register_t icrlo, u_int dest) XEN_APIC_UNSUPPORTED; } +#define PCPU_ID_GET(id, field) (pcpu_find(id)->pc_##field) static void +send_nmi(int dest) +{ + unsigned int cpu; + + /* + * NMIs are not routed over event channels, and instead delivered as on + * native using the exception vector (#2). Triggering them can be done + * using the local APIC, or an hypercall as a shortcut like it's done + * below. + */ + switch(dest) { + case APIC_IPI_DEST_SELF: + HYPERVISOR_vcpu_op(VCPUOP_send_nmi, PCPU_GET(vcpu_id), NULL); + break; + case APIC_IPI_DEST_ALL: + CPU_FOREACH(cpu) + HYPERVISOR_vcpu_op(VCPUOP_send_nmi, + PCPU_ID_GET(cpu, vcpu_id), NULL); + break; + case APIC_IPI_DEST_OTHERS: + CPU_FOREACH(cpu) + if (cpu != PCPU_GET(cpuid)) + HYPERVISOR_vcpu_op(VCPUOP_send_nmi, + PCPU_ID_GET(cpu, vcpu_id), NULL); + break; + default: + HYPERVISOR_vcpu_op(VCPUOP_send_nmi, + PCPU_ID_GET(apic_cpuid(dest), vcpu_id), NULL); + break; + } +} +#undef PCPU_ID_GET + +static void xen_pv_lapic_ipi_vectored(u_int vector, int dest) { xen_intr_handle_t *ipi_handle; int ipi_idx, to_cpu, self; + if (vector >= IPI_NMI_FIRST) { + send_nmi(dest); + return; + } + ipi_idx = IPI_TO_IDX(vector); if (ipi_idx >= nitems(xen_ipis)) panic("IPI out of range"); @@ -519,14 +557,6 @@ xen_cpususpend_handler(void *arg) { cpususpend_handler(); - return (FILTER_HANDLED); -} - -static int -xen_cpustophard_handler(void *arg) -{ - - ipi_nmi_handler(); return (FILTER_HANDLED); } From owner-svn-src-stable-12@freebsd.org Wed Jan 29 22:56:00 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A9081FACA0; Wed, 29 Jan 2020 22:56:00 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 487Jk81bfgz4Kdw; Wed, 29 Jan 2020 22:56:00 +0000 (UTC) (envelope-from vmaffione@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 322A61B921; Wed, 29 Jan 2020 22:56:00 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00TMu0L0049962; Wed, 29 Jan 2020 22:56:00 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00TMu0bo049961; Wed, 29 Jan 2020 22:56:00 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202001292256.00TMu0bo049961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Wed, 29 Jan 2020 22:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357277 - stable/12/sys/dev/netmap X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/dev/netmap X-SVN-Commit-Revision: 357277 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jan 2020 22:56:00 -0000 Author: vmaffione Date: Wed Jan 29 22:55:59 2020 New Revision: 357277 URL: https://svnweb.freebsd.org/changeset/base/357277 Log: MFC r357159 netmap_mem_unmap: fix NULL pointer dereference Modified: stable/12/sys/dev/netmap/netmap_mem2.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/netmap/netmap_mem2.c ============================================================================== --- stable/12/sys/dev/netmap/netmap_mem2.c Wed Jan 29 22:48:18 2020 (r357276) +++ stable/12/sys/dev/netmap/netmap_mem2.c Wed Jan 29 22:55:59 2020 (r357277) @@ -1523,11 +1523,12 @@ static int netmap_mem_unmap(struct netmap_obj_pool *p, struct netmap_adapter *na) { int i, lim = p->objtotal; - struct netmap_lut *lut = &na->na_lut; + struct netmap_lut *lut; if (na == NULL || na->pdev == NULL) return 0; + lut = &na->na_lut; #if defined(__FreeBSD__) /* On FreeBSD mapping and unmapping is performed by the txsync * and rxsync routine, packet by packet. */ From owner-svn-src-stable-12@freebsd.org Thu Jan 30 09:56:57 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D263233973; Thu, 30 Jan 2020 09:56:57 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 487bNm70ZVz3Qb5; Thu, 30 Jan 2020 09:56:56 +0000 (UTC) (envelope-from kp@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 EADD5232D0; Thu, 30 Jan 2020 09:56:56 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00U9uuFF045191; Thu, 30 Jan 2020 09:56:56 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00U9uuse045190; Thu, 30 Jan 2020 09:56:56 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202001300956.00U9uuse045190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 30 Jan 2020 09:56:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357289 - stable/12/usr.sbin/periodic/etc/security X-SVN-Group: stable-12 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/12/usr.sbin/periodic/etc/security X-SVN-Commit-Revision: 357289 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jan 2020 09:56:57 -0000 Author: kp Date: Thu Jan 30 09:56:56 2020 New Revision: 357289 URL: https://svnweb.freebsd.org/changeset/base/357289 Log: MFC r356816: Fix pfdenied not returning any results When _a is empty we end up with an invalid invocation of pfctl, and no output. We must add quotes to make it clear to pfctl that we're passing an empty anchor name. PR: 224415 Submitted by: sigsys AT gmail.com Modified: stable/12/usr.sbin/periodic/etc/security/520.pfdenied Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/periodic/etc/security/520.pfdenied ============================================================================== --- stable/12/usr.sbin/periodic/etc/security/520.pfdenied Thu Jan 30 09:41:48 2020 (r357288) +++ stable/12/usr.sbin/periodic/etc/security/520.pfdenied Thu Jan 30 09:56:56 2020 (r357289) @@ -46,7 +46,7 @@ then TMP=`mktemp -t security` for _a in "" $(pfctl -a "blacklistd" -sA 2>/dev/null) do - pfctl -a ${_a} -sr -v -z 2>/dev/null | \ + pfctl -a "${_a}" -sr -v -z 2>/dev/null | \ nawk '{if (/^block/) {buf=$0; getline; gsub(" +"," ",$0); if ($5 > 0) print buf$0;} }' >> ${TMP} done if [ -s ${TMP} ]; then From owner-svn-src-stable-12@freebsd.org Thu Jan 30 15:00:41 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF5F423BDC7; Thu, 30 Jan 2020 15:00: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 487k7F5fYJz4CsS; Thu, 30 Jan 2020 15:00: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 BD41A26A83; Thu, 30 Jan 2020 15:00:41 +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 00UF0fXH027929; Thu, 30 Jan 2020 15:00:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00UF0f7t027928; Thu, 30 Jan 2020 15:00:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202001301500.00UF0f7t027928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 30 Jan 2020 15:00:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357295 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 357295 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jan 2020 15:00:41 -0000 Author: markj Date: Thu Jan 30 15:00:41 2020 New Revision: 357295 URL: https://svnweb.freebsd.org/changeset/base/357295 Log: MFC r357048: arm64: Don't enable interrupts in init_secondary(). Modified: stable/12/sys/arm64/arm64/mp_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/mp_machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/mp_machdep.c Thu Jan 30 12:35:13 2020 (r357294) +++ stable/12/sys/arm64/arm64/mp_machdep.c Thu Jan 30 15:00:41 2020 (r357295) @@ -306,18 +306,12 @@ init_secondary(uint64_t cpu) dbg_init(); pan_enable(); - /* Enable interrupts */ - intr_enable(); - mtx_lock_spin(&ap_boot_mtx); - atomic_add_rel_32(&smp_cpus, 1); - if (smp_cpus == mp_ncpus) { /* enable IPI's, tlb shootdown, freezes etc */ atomic_store_rel_int(&smp_started, 1); } - mtx_unlock_spin(&ap_boot_mtx); /* Enter the scheduler */ From owner-svn-src-stable-12@freebsd.org Thu Jan 30 16:11:22 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABFBC23D668; Thu, 30 Jan 2020 16:11:22 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 487lhp4hxyz4HrN; Thu, 30 Jan 2020 16:11:22 +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 9BF4727794; Thu, 30 Jan 2020 16:11:22 +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 00UGBMj6067598; Thu, 30 Jan 2020 16:11:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00UGBJWp067583; Thu, 30 Jan 2020 16:11:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202001301611.00UGBJWp067583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 30 Jan 2020 16:11:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357296 - in stable/12: cddl/lib/libdtrace contrib/libxo/tests/gettext contrib/libxo/tests/gettext/po/pig_latin contrib/llvm-project/libcxx/include contrib/openbsm/libbsm contrib/openbs... X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12: cddl/lib/libdtrace contrib/libxo/tests/gettext contrib/libxo/tests/gettext/po/pig_latin contrib/llvm-project/libcxx/include contrib/openbsm/libbsm contrib/openbsm/sys/bsm lib/libc/gen li... X-SVN-Commit-Revision: 357296 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jan 2020 16:11:22 -0000 Author: mav Date: Thu Jan 30 16:11:19 2020 New Revision: 357296 URL: https://svnweb.freebsd.org/changeset/base/357296 Log: MFC r343111,343113-343115 (by mckusick): Create new EINTEGRITY error with message "Integrity check failed". An integrity check such as a check-hash or a cross-correlation failed. The integrity error falls between EINVAL that identifies errors in parameters to a system call and EIO that identifies errors with the underlying storage media. EINTEGRITY is typically raised by intermediate kernel layers such as a filesystem or an in-kernel GEOM subsystem when they detect inconsistencies. Uses include allowing the mount(8) command to return a different exit value to automate the running of fsck(8) during a system boot. These changes make no use of the new error, they just add it. Later commits will be made for the use of the new error number and it will be added to additional manual pages as appropriate. Approved by: mckusick Modified: stable/12/cddl/lib/libdtrace/errno.d stable/12/contrib/libxo/tests/gettext/po/pig_latin/strerror.po stable/12/contrib/libxo/tests/gettext/strerror.pot stable/12/contrib/llvm-project/libcxx/include/__errc stable/12/contrib/llvm-project/libcxx/include/errno.h stable/12/contrib/openbsm/libbsm/bsm_errno.c stable/12/contrib/openbsm/sys/bsm/audit_errno.h stable/12/lib/libc/gen/errlst.c stable/12/lib/libc/nls/C.msg stable/12/lib/libc/sys/intro.2 stable/12/stand/liblua/lerrno.c stable/12/sys/bsm/audit_errno.h stable/12/sys/compat/cloudabi/cloudabi_errno.c stable/12/sys/compat/linux/linux_errno.inc stable/12/sys/security/audit/bsm_errno.c stable/12/sys/sys/errno.h Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/lib/libdtrace/errno.d ============================================================================== --- stable/12/cddl/lib/libdtrace/errno.d Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/cddl/lib/libdtrace/errno.d Thu Jan 30 16:11:19 2020 (r357296) @@ -225,7 +225,9 @@ inline int ENOTRECOVERABLE = 95; #pragma D binding "1.13" ENOTRECOVERABLE inline int EOWNERDEAD = 96; #pragma D binding "1.13" EOWNERDEAD -inline int ELAST = 96; +inline int EINTEGRITY = 96; +#pragma D binding "1.13" EINTEGRITY +inline int ELAST = 97; #pragma D binding "1.0" ELAST inline int ERESTART = -1; #pragma D binding "1.0" ERESTART @@ -340,6 +342,7 @@ inline string strerror[int errno] = errno == ECAPMODE ? "Not permitted in capability mode" : errno == ENOTRECOVERABLE ? "State not recoverable" : errno == EOWNERDEAD ? "Previous owner died" : + errno == EINTEGRITY ? "Integrity check failed" : errno == ERESTART ? "restart syscall" : errno == EJUSTRETURN ? "don't modify regs, just return" : errno == ENOIOCTL ? "ioctl not handled by this layer" : Modified: stable/12/contrib/libxo/tests/gettext/po/pig_latin/strerror.po ============================================================================== --- stable/12/contrib/libxo/tests/gettext/po/pig_latin/strerror.po Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/contrib/libxo/tests/gettext/po/pig_latin/strerror.po Thu Jan 30 16:11:19 2020 (r357296) @@ -457,3 +457,7 @@ msgstr "Atestay otnay ecoverableray" # 96 - EOWNERDEAD msgid "Previous owner died" msgstr "Eviouspray ownerway iedday" + +# 97 - EINTEGRITY +msgid "Integrity check failed" +msgstr "integrityyay eckchay ailedfay" Modified: stable/12/contrib/libxo/tests/gettext/strerror.pot ============================================================================== --- stable/12/contrib/libxo/tests/gettext/strerror.pot Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/contrib/libxo/tests/gettext/strerror.pot Thu Jan 30 16:11:19 2020 (r357296) @@ -466,3 +466,7 @@ msgstr "" # 96 - EOWNERDEAD msgid "Previous owner died" msgstr "" + +# 97 - EINTEGRITY +msgid "Integrity check failed" +msgstr "" Modified: stable/12/contrib/llvm-project/libcxx/include/__errc ============================================================================== --- stable/12/contrib/llvm-project/libcxx/include/__errc Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/contrib/llvm-project/libcxx/include/__errc Thu Jan 30 16:11:19 2020 (r357296) @@ -45,6 +45,7 @@ enum class errc identifier_removed, // EIDRM illegal_byte_sequence, // EILSEQ inappropriate_io_control_operation, // ENOTTY + integrity_check_failed, // EINTEGRITY interrupted, // EINTR invalid_argument, // EINVAL invalid_seek, // ESPIPE @@ -142,6 +143,7 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc) identifier_removed = EIDRM, illegal_byte_sequence = EILSEQ, inappropriate_io_control_operation = ENOTTY, + integrity_check_failed = EINTEGRITY, interrupted = EINTR, invalid_argument = EINVAL, invalid_seek = ESPIPE, Modified: stable/12/contrib/llvm-project/libcxx/include/errno.h ============================================================================== --- stable/12/contrib/llvm-project/libcxx/include/errno.h Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/contrib/llvm-project/libcxx/include/errno.h Thu Jan 30 16:11:19 2020 (r357296) @@ -32,49 +32,79 @@ Macros: #ifdef __cplusplus -#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) +#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) || !defined(EINTEGRITY) -#ifdef ELAST +#if defined(ELAST) static const int __elast1 = ELAST+1; static const int __elast2 = ELAST+2; +static const int __elast3 = ELAST+3; #else static const int __elast1 = 104; static const int __elast2 = 105; +static const int __elast3 = 106; #endif -#ifdef ENOTRECOVERABLE +#if !defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && !defined(EINTEGRITY) +#define ENOTRECOVERABLE __elast1 +#define EOWNERDEAD __elast2 +#define EINTEGRITY __elast3 +#if defined(ELAST) +#undef ELAST +#define ELAST EINTEGRITY +#endif +#elif !defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && defined(EINTEGRITY) +#define ENOTRECOVERABLE __elast1 +#define EOWNERDEAD __elast2 +#if defined(ELAST) +#undef ELAST +#define ELAST EOWNERDEAD +#endif + +#elif !defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && !defined(EINTEGRITY) #define EOWNERDEAD __elast1 +#define EINTEGRITY __elast2 +#if defined(ELAST) +#undef ELAST +#define ELAST EINTEGRITY +#endif -#ifdef ELAST +#elif !defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && defined(EINTEGRITY) +#define EOWNERDEAD __elast1 +#if defined(ELAST) #undef ELAST #define ELAST EOWNERDEAD #endif -#elif defined(EOWNERDEAD) +#elif defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && !defined(EINTEGRITY) +#define ENOTRECOVERABLE __elast1 +#define EINTEGRITY __elast2 +#if defined(ELAST) +#undef ELAST +#define ELAST EINTEGRITY +#endif +#elif defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && defined(EINTEGRITY) #define ENOTRECOVERABLE __elast1 -#ifdef ELAST +#if defined(ELAST) #undef ELAST #define ELAST ENOTRECOVERABLE #endif -#else // defined(EOWNERDEAD) - -#define EOWNERDEAD __elast1 -#define ENOTRECOVERABLE __elast2 -#ifdef ELAST +#elif defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && !defined(EINTEGRITY) +#define EINTEGRITY __elast1 +#if defined(ELAST) #undef ELAST -#define ELAST ENOTRECOVERABLE +#define ELAST EINTEGRITY #endif -#endif // defined(EOWNERDEAD) +#endif // !defined(OWNERDEAD) && !defined(NOTRECOVERABLE) && !defined(INTEGRITY) -#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) +#endif // !defined(OWNERDEAD) || !defined(NOTRECOVERABLE) || !defined(INTEGRITY) // supply errno values likely to be missing, particularly on Windows @@ -390,6 +420,10 @@ static const int __elast2 = 105; #ifndef EMLINK #define EMLINK 9979 +#endif + +#ifndef EINTEGRITY +#define EINTEGRITY 9980 #endif #endif // __cplusplus Modified: stable/12/contrib/openbsm/libbsm/bsm_errno.c ============================================================================== --- stable/12/contrib/openbsm/libbsm/bsm_errno.c Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/contrib/openbsm/libbsm/bsm_errno.c Thu Jan 30 16:11:19 2020 (r357296) @@ -239,6 +239,13 @@ static const struct bsm_errno bsm_errnos[] = { ERRNO_NO_LOCAL_MAPPING, #endif ES("Process died with the lock") }, + { BSM_ERRNO_EINTEGRITY, +#ifdef EINTEGRITY + EINTEGRITY, +#else + ERRNO_NO_LOCAL_MAPPING, +#endif + ES("Integrity check failed") }, { BSM_ERRNO_ENOTRECOVERABLE, #ifdef ENOTRECOVERABLE ENOTRECOVERABLE, Modified: stable/12/contrib/openbsm/sys/bsm/audit_errno.h ============================================================================== --- stable/12/contrib/openbsm/sys/bsm/audit_errno.h Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/contrib/openbsm/sys/bsm/audit_errno.h Thu Jan 30 16:11:19 2020 (r357296) @@ -204,6 +204,7 @@ #define BSM_ERRNO_EKEYREJECTED 222 /* Linux-specific. */ #define BSM_ERRNO_ENOTCAPABLE 223 /* FreeBSD-specific. */ #define BSM_ERRNO_ECAPMODE 224 /* FreeBSD-specific. */ +#define BSM_ERRNO_EINTEGRITY 225 /* FreeBSD-specific. */ /* * In the event that OpenBSM doesn't have a file representation of a local Modified: stable/12/lib/libc/gen/errlst.c ============================================================================== --- stable/12/lib/libc/gen/errlst.c Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/lib/libc/gen/errlst.c Thu Jan 30 16:11:19 2020 (r357296) @@ -158,12 +158,12 @@ const char *const sys_errlist[] = { "Not permitted in capability mode", /* 94 - ECAPMODE */ "State not recoverable", /* 95 - ENOTRECOVERABLE */ "Previous owner died", /* 96 - EOWNERDEAD */ + "Integrity check failed", /* 97 - EINTEGRITY */ /* * Reserved space in sys_errlist, take the next slot for a next error code. * Reserve prevents the array size from changing for some time. */ - __uprefix, /* 97 */ __uprefix, /* 98 */ __uprefix, /* 99 */ __uprefix, /* 100 */ Modified: stable/12/lib/libc/nls/C.msg ============================================================================== --- stable/12/lib/libc/nls/C.msg Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/lib/libc/nls/C.msg Thu Jan 30 16:11:19 2020 (r357296) @@ -197,6 +197,8 @@ $ ENOTRECOVERABLE 95 State not recoverable $ EOWNERDEAD 96 Previous owner died +$ EINTEGRITY +97 Integrity check failed $ $ strsignal() support catalog $ Modified: stable/12/lib/libc/sys/intro.2 ============================================================================== --- stable/12/lib/libc/sys/intro.2 Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/lib/libc/sys/intro.2 Thu Jan 30 16:11:19 2020 (r357296) @@ -472,6 +472,20 @@ The system call or operation is not permitted for capa The state protected by a robust mutex is not recoverable. .It Er 96 EOWNERDEAD Em "Previous owner died" . The owner of a robust mutex terminated while holding the mutex lock. +.It Er 97 EINTEGRITY Em "Integrity check failed" . +An integrity check such as a check-hash or a cross-correlation failed. +The integrity error falls between +.Er EINVAL +that identifies errors in parameters to a system call and +.Er EIO +that identifies errors with the underlying storage media. +It is typically raised by intermediate kernel layers such as a +filesystem or an in-kernel GEOM subsystem when they detect inconsistencies. +Uses include allowing the +.Xr mount 8 +command to return a different exit value to automate the running of +.Xr fsck 8 +during a system boot. .El .Sh DEFINITIONS .Bl -tag -width Ds Modified: stable/12/stand/liblua/lerrno.c ============================================================================== --- stable/12/stand/liblua/lerrno.c Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/stand/liblua/lerrno.c Thu Jan 30 16:11:19 2020 (r357296) @@ -146,6 +146,7 @@ static const struct err_name_number { ENTRY(ECAPMODE), ENTRY(ENOTRECOVERABLE), ENTRY(EOWNERDEAD), + ENTRY(EINTEGRITY), ENTRY(ELAST), ENTRY(ERESTART), ENTRY(EJUSTRETURN), Modified: stable/12/sys/bsm/audit_errno.h ============================================================================== --- stable/12/sys/bsm/audit_errno.h Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/sys/bsm/audit_errno.h Thu Jan 30 16:11:19 2020 (r357296) @@ -208,6 +208,7 @@ #define BSM_ERRNO_EKEYREJECTED 222 /* Linux-specific. */ #define BSM_ERRNO_ENOTCAPABLE 223 /* FreeBSD-specific. */ #define BSM_ERRNO_ECAPMODE 224 /* FreeBSD-specific. */ +#define BSM_ERRNO_EINTEGRITY 225 /* FreeBSD-specific. */ /* * In the event that OpenBSM doesn't have a file representation of a local Modified: stable/12/sys/compat/cloudabi/cloudabi_errno.c ============================================================================== --- stable/12/sys/compat/cloudabi/cloudabi_errno.c Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/sys/compat/cloudabi/cloudabi_errno.c Thu Jan 30 16:11:19 2020 (r357296) @@ -63,6 +63,7 @@ cloudabi_convert_errno(int error) [EIDRM] = CLOUDABI_EIDRM, [EILSEQ] = CLOUDABI_EILSEQ, [EINPROGRESS] = CLOUDABI_EINPROGRESS, + [EINTEGRITY] = CLOUDABI_EINVAL, [EINTR] = CLOUDABI_EINTR, [EINVAL] = CLOUDABI_EINVAL, [EIO] = CLOUDABI_EIO, Modified: stable/12/sys/compat/linux/linux_errno.inc ============================================================================== --- stable/12/sys/compat/linux/linux_errno.inc Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/sys/compat/linux/linux_errno.inc Thu Jan 30 16:11:19 2020 (r357296) @@ -142,7 +142,8 @@ const int linux_errtbl[ELAST + 1] = { -1, /* ECAPMODE -> EPERM */ -131, /* ENOTRECOVERABLE */ -130, /* EOWNERDEAD */ + -22, /* EINTEGRITY -> EINVAL */ }; -_Static_assert(ELAST == 96, +_Static_assert(ELAST == 97, "missing errno entries in linux_errtbl"); Modified: stable/12/sys/security/audit/bsm_errno.c ============================================================================== --- stable/12/sys/security/audit/bsm_errno.c Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/sys/security/audit/bsm_errno.c Thu Jan 30 16:11:19 2020 (r357296) @@ -243,6 +243,13 @@ static const struct bsm_errno bsm_errnos[] = { ERRNO_NO_LOCAL_MAPPING, #endif ES("Process died with the lock") }, + { BSM_ERRNO_EINTEGRITY, +#ifdef EINTEGRITY + EINTEGRITY, +#else + ERRNO_NO_LOCAL_MAPPING, +#endif + ES("Integrity check failed") }, { BSM_ERRNO_ENOTRECOVERABLE, #ifdef ENOTRECOVERABLE ENOTRECOVERABLE, Modified: stable/12/sys/sys/errno.h ============================================================================== --- stable/12/sys/sys/errno.h Thu Jan 30 15:00:41 2020 (r357295) +++ stable/12/sys/sys/errno.h Thu Jan 30 16:11:19 2020 (r357296) @@ -180,10 +180,11 @@ __END_DECLS #define ECAPMODE 94 /* Not permitted in capability mode */ #define ENOTRECOVERABLE 95 /* State not recoverable */ #define EOWNERDEAD 96 /* Previous owner died */ +#define EINTEGRITY 97 /* Integrity check failed */ #endif /* _POSIX_SOURCE */ #ifndef _POSIX_SOURCE -#define ELAST 96 /* Must be equal largest errno */ +#define ELAST 97 /* Must be equal largest errno */ #endif /* _POSIX_SOURCE */ #if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO) From owner-svn-src-stable-12@freebsd.org Thu Jan 30 16:38:41 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6872E23E1D0; Thu, 30 Jan 2020 16:38:41 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 487mJK2BC3z4Kv0; Thu, 30 Jan 2020 16:38:41 +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 460A227CD6; Thu, 30 Jan 2020 16:38:41 +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 00UGcf3S085069; Thu, 30 Jan 2020 16:38:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00UGcfa4085068; Thu, 30 Jan 2020 16:38:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202001301638.00UGcfa4085068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 30 Jan 2020 16:38:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357297 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 357297 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jan 2020 16:38:41 -0000 Author: mav Date: Thu Jan 30 16:38:40 2020 New Revision: 357297 URL: https://svnweb.freebsd.org/changeset/base/357297 Log: MFC r356707: Map ECKSUM and EFRAGS from ZFS onto real errnos. Make it less confusing when, for example, stat sets errno to 122 because a checksum failed in ZFS: Before: getfacl: /foo/bar: stat() failed: Unknown error: 122 After: getfacl: /foo/bar: stat() failed: Integrity check failed Submitted by: Ryan Moeller Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Jan 30 16:11:19 2020 (r357296) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Jan 30 16:38:40 2020 (r357297) @@ -227,12 +227,11 @@ enum zio_wait_type { }; /* - * We'll take the number 122 and 123 to indicate checksum errors and - * fragmentation. Those doesn't collide with any errno values as they - * are greater than ELAST. + * These are bespoke errnos used in ZFS. We map them to their closest FreeBSD + * equivalents. This gives us more useful error messages from strerror(3). */ -#define ECKSUM 122 -#define EFRAGS 123 +#define ECKSUM EINTEGRITY +#define EFRAGS ENOSPC typedef void zio_done_func_t(zio_t *zio); From owner-svn-src-stable-12@freebsd.org Fri Jan 31 10:34:37 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F263923B9CB; Fri, 31 Jan 2020 10:34:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 488D9n690mz4QYd; Fri, 31 Jan 2020 10:34:37 +0000 (UTC) (envelope-from kp@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 CE915CAAB; Fri, 31 Jan 2020 10:34:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00VAYbVR029849; Fri, 31 Jan 2020 10:34:37 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00VAYbWO029846; Fri, 31 Jan 2020 10:34:37 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202001311034.00VAYbWO029846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 31 Jan 2020 10:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357325 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 357325 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jan 2020 10:34:38 -0000 Author: kp Date: Fri Jan 31 10:34:36 2020 New Revision: 357325 URL: https://svnweb.freebsd.org/changeset/base/357325 Log: MFC r357233: epair: Do not abuse params to register the second interface if_epair used the 'params' argument to pass a pointer to the b interface through if_clone_create(). This pointer can be controlled by userspace, which means it could be abused to trigger a panic. While this requires PRIV_NET_IFCREATE privileges those are assigned to vnet jails, which means that vnet jails could panic the system. Reported by: Ilja Van Sprundel Modified: stable/12/sys/net/if_clone.c stable/12/sys/net/if_clone.h stable/12/sys/net/if_epair.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if_clone.c ============================================================================== --- stable/12/sys/net/if_clone.c Fri Jan 31 10:30:13 2020 (r357324) +++ stable/12/sys/net/if_clone.c Fri Jan 31 10:34:36 2020 (r357325) @@ -211,6 +211,18 @@ if_clone_create(char *name, size_t len, caddr_t params return (if_clone_createif(ifc, name, len, params)); } +void +if_clone_addif(struct if_clone *ifc, struct ifnet *ifp) +{ + + if ((ifc->ifc_flags & IFC_NOGROUP) == 0) + if_addgroup(ifp, ifc->ifc_name); + + IF_CLONE_LOCK(ifc); + IFC_IFLIST_INSERT(ifc, ifp); + IF_CLONE_UNLOCK(ifc); +} + /* * Create a clone network interface. */ @@ -233,12 +245,7 @@ if_clone_createif(struct if_clone *ifc, char *name, si if (ifp == NULL) panic("%s: lookup failed for %s", __func__, name); - if ((ifc->ifc_flags & IFC_NOGROUP) == 0) - if_addgroup(ifp, ifc->ifc_name); - - IF_CLONE_LOCK(ifc); - IFC_IFLIST_INSERT(ifc, ifp); - IF_CLONE_UNLOCK(ifc); + if_clone_addif(ifc, ifp); } return (err); Modified: stable/12/sys/net/if_clone.h ============================================================================== --- stable/12/sys/net/if_clone.h Fri Jan 31 10:30:13 2020 (r357324) +++ stable/12/sys/net/if_clone.h Fri Jan 31 10:34:36 2020 (r357325) @@ -79,7 +79,8 @@ int if_clone_list(struct if_clonereq *); struct if_clone *if_clone_findifc(struct ifnet *); void if_clone_addgroup(struct ifnet *, struct if_clone *); -/* The below interface used only by epair(4). */ +/* The below interfaces are used only by epair(4). */ +void if_clone_addif(struct if_clone *, struct ifnet *); int if_clone_destroyif(struct if_clone *, struct ifnet *); #endif /* _KERNEL */ Modified: stable/12/sys/net/if_epair.c ============================================================================== --- stable/12/sys/net/if_epair.c Fri Jan 31 10:30:13 2020 (r357324) +++ stable/12/sys/net/if_epair.c Fri Jan 31 10:34:36 2020 (r357325) @@ -711,6 +711,21 @@ epair_clone_match(struct if_clone *ifc, const char *na return (1); } +static void +epair_clone_add(struct if_clone *ifc, struct epair_softc *scb) +{ + struct ifnet *ifp; + uint8_t eaddr[ETHER_ADDR_LEN]; /* 00:00:00:00:00:00 */ + + ifp = scb->ifp; + /* Copy epairNa etheraddr and change the last byte. */ + memcpy(eaddr, scb->oifp->if_hw_addr, ETHER_ADDR_LEN); + eaddr[5] = 0x0b; + ether_ifattach(ifp, eaddr); + + if_clone_addif(ifc, ifp); +} + static int epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) { @@ -723,24 +738,6 @@ epair_clone_create(struct if_clone *ifc, char *name, s uint32_t hash; uint8_t eaddr[ETHER_ADDR_LEN]; /* 00:00:00:00:00:00 */ - /* - * We are abusing params to create our second interface. - * Actually we already created it and called if_clone_create() - * for it to do the official insertion procedure the moment we knew - * it cannot fail anymore. So just do attach it here. - */ - if (params) { - scb = (struct epair_softc *)params; - ifp = scb->ifp; - /* Copy epairNa etheraddr and change the last byte. */ - memcpy(eaddr, scb->oifp->if_hw_addr, ETHER_ADDR_LEN); - eaddr[5] = 0x0b; - ether_ifattach(ifp, eaddr); - /* Correctly set the name for the cloner list. */ - strlcpy(name, ifp->if_xname, len); - return (0); - } - /* Try to see if a special unit was requested. */ error = ifc_name2unit(name, &unit); if (error != 0) @@ -891,10 +888,11 @@ epair_clone_create(struct if_clone *ifc, char *name, s if_setsendqready(ifp); /* We need to play some tricks here for the second interface. */ strlcpy(name, epairname, len); - error = if_clone_create(name, len, (caddr_t)scb); - if (error) - panic("%s: if_clone_create() for our 2nd iface failed: %d", - __func__, error); + + /* Correctly set the name for the cloner list. */ + strlcpy(name, scb->ifp->if_xname, len); + epair_clone_add(ifc, scb); + scb->if_qflush = ifp->if_qflush; ifp->if_qflush = epair_qflush; ifp->if_transmit = epair_transmit; From owner-svn-src-stable-12@freebsd.org Fri Jan 31 12:38:54 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61DB823F1F1; Fri, 31 Jan 2020 12:38:54 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 488GxB1mDpz4YRV; Fri, 31 Jan 2020 12:38:54 +0000 (UTC) (envelope-from nyan@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 33380E0AC; Fri, 31 Jan 2020 12:38:54 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00VCcsRn003267; Fri, 31 Jan 2020 12:38:54 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00VCcr1A003265; Fri, 31 Jan 2020 12:38:53 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <202001311238.00VCcr1A003265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Fri, 31 Jan 2020 12:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357331 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: nyan X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 357331 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jan 2020 12:38:54 -0000 Author: nyan Date: Fri Jan 31 12:38:53 2020 New Revision: 357331 URL: https://svnweb.freebsd.org/changeset/base/357331 Log: MFC r357043: Fix kernel-tags target. > - A depend-file is broken up into .depend.*.o files. [1] > - Fix an assembly file support. > > PR: 241746 > Submitted by: leres [1] Modified: stable/12/sys/conf/kern.post.mk stable/12/sys/conf/systags.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/kern.post.mk ============================================================================== --- stable/12/sys/conf/kern.post.mk Fri Jan 31 11:33:11 2020 (r357330) +++ stable/12/sys/conf/kern.post.mk Fri Jan 31 12:38:53 2020 (r357331) @@ -355,7 +355,8 @@ kernel-cleandepend: .PHONY rm -f .depend .depend.* ${_ILINKS} kernel-tags: - @[ -f .depend ] || { echo "you must make depend first"; exit 1; } + @ls .depend.* > /dev/null 2>&1 || \ + { echo "you must make depend first"; exit 1; } sh $S/conf/systags.sh kernel-install: .PHONY Modified: stable/12/sys/conf/systags.sh ============================================================================== --- stable/12/sys/conf/systags.sh Fri Jan 31 11:33:11 2020 (r357330) +++ stable/12/sys/conf/systags.sh Fri Jan 31 12:38:53 2020 (r357331) @@ -39,14 +39,14 @@ rm -f tags tags.tmp tags.cfiles tags.sfiles tags.hfiles sed -e "s, machine/, ../../include/,g" \ - -e 's,[a-z][^/ ]*/\.\./,,g' .depend | awk '{ + -e 's,[a-z][^/ ]*/\.\./,,g' .depend.* | awk '{ for (i = 1; i <= NF; ++i) { t = substr($i, length($i) - 1) if (t == ".c") cfiles[$i] = 1; else if (t == ".h") hfiles[$i] = 1; - else if (t == ".s") + else if (t == ".s" || t == ".S") sfiles[$i] = 1; } }; From owner-svn-src-stable-12@freebsd.org Fri Jan 31 13:18:27 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54D0423FD2E; Fri, 31 Jan 2020 13:18:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 488Hpq1ZZpz4bJ3; Fri, 31 Jan 2020 13:18:27 +0000 (UTC) (envelope-from imp@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 2CFE4E89B; Fri, 31 Jan 2020 13:18:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00VDIRWU026739; Fri, 31 Jan 2020 13:18:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00VDIPvk026732; Fri, 31 Jan 2020 13:18:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202001311318.00VDIPvk026732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 31 Jan 2020 13:18:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357333 - in stable/12: etc libexec/rc libexec/rc/rc.d share/man/man5 sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in stable/12: etc libexec/rc libexec/rc/rc.d share/man/man5 sys/sys X-SVN-Commit-Revision: 357333 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jan 2020 13:18:27 -0000 Author: imp Date: Fri Jan 31 13:18:25 2020 New Revision: 357333 URL: https://svnweb.freebsd.org/changeset/base/357333 Log: MFC r354922 > Author: imp > Date: Wed Nov 20 23:45:31 2019 +0000 > > Create /etc/os-release file. > > Each boot, regenerate /var/run/os-release based on the currently running > system. Create a /etc/os-release symlink pointing to this file (so that this > doesn't create a new reason /etc can not be mounted read-only). > > This is compatible with what other systems do and is what the sysutil/os-release > port attempted to do, but in an incomplete way. Linux, Solaris and DragonFly all > implement this natively as well. The complete standard can be found at > https://www.freedesktop.org/software/systemd/man/os-release.html > > Moving this to the base solves both the non-standard location problem with the > port, as well as the lack of update of this file on system update. > > Bump __FreeBSD_version to 1300060 > > PR: 238953 > Differential Revision: https://reviews.freebsd.org/D22271 Execpt bump __FreeBSD_version to 1201511 Added: stable/12/libexec/rc/rc.d/os-release - copied unchanged from r354922, head/libexec/rc/rc.d/os-release stable/12/share/man/man5/os-release.5 - copied unchanged from r354922, head/share/man/man5/os-release.5 Modified: stable/12/etc/Makefile stable/12/libexec/rc/rc.conf stable/12/libexec/rc/rc.d/Makefile stable/12/share/man/man5/Makefile stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/etc/Makefile ============================================================================== --- stable/12/etc/Makefile Fri Jan 31 12:39:51 2020 (r357332) +++ stable/12/etc/Makefile Fri Jan 31 13:18:25 2020 (r357333) @@ -82,6 +82,8 @@ distribution: ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt + ${INSTALL_SYMLINK} ../var/run/os-release \ + ${DESTDIR}/etc/os-release .if ${MK_UNBOUND} != "no" if [ ! -e ${DESTDIR}/etc/unbound ]; then \ ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \ Modified: stable/12/libexec/rc/rc.conf ============================================================================== --- stable/12/libexec/rc/rc.conf Fri Jan 31 12:39:51 2020 (r357332) +++ stable/12/libexec/rc/rc.conf Fri Jan 31 13:18:25 2020 (r357333) @@ -680,6 +680,9 @@ entropy_save_sz="4096" # Size of the entropy cache fil entropy_save_num="8" # Number of entropy cache files to save. harvest_mask="511" # Entropy device harvests all but the very invasive sources. # (See 'sysctl kern.random.harvest' and random(4)) +osrelease_enable="YES" # Update /var/run/os-release on boot (or NO). +osrelease_file="/var/run/os-release" # File to update for os-release. +osrelease_perms="444" # Default permission for os-release file. dmesg_enable="YES" # Save dmesg(8) to /var/run/dmesg.boot watchdogd_enable="NO" # Start the software watchdog daemon watchdogd_flags="" # Flags to watchdogd (if enabled) Modified: stable/12/libexec/rc/rc.d/Makefile ============================================================================== --- stable/12/libexec/rc/rc.d/Makefile Fri Jan 31 12:39:51 2020 (r357332) +++ stable/12/libexec/rc/rc.d/Makefile Fri Jan 31 13:18:25 2020 (r357333) @@ -80,6 +80,7 @@ CONFS= DAEMON \ nsswitch \ ntpdate \ ${_opensm} \ + os-release \ pf \ pflog \ pfsync \ Copied: stable/12/libexec/rc/rc.d/os-release (from r354922, head/libexec/rc/rc.d/os-release) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/libexec/rc/rc.d/os-release Fri Jan 31 13:18:25 2020 (r357333, copy of r354922, head/libexec/rc/rc.d/os-release) @@ -0,0 +1,44 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: os-release +# REQUIRE: mountcritremote FILESYSTEMS +# BEFORE: LOGIN + +. /etc/rc.subr + +: ${osrelease_file:=/var/run/os-release} +: ${osrelease_perms:=444} +name="osrelease" +desc="Update ${osrelease_file}" +start_cmd="osrelease_start" +stop_cmd=":" + +osrelease_start() +{ + local _version _version_id + + check_startmsgs && echo -n "Updating ${osrelease_file} " + _version=$(freebsd-version -u) + _version_id=${_version%%[^0-9.]*} + t=$(mktemp -t os-release) + cat > "$t" <<-__EOF__ + NAME=FreeBSD + VERSION=$_version + VERSION_ID=$_version_id + ID=freebsd + ANSI_COLOR="0;31" + PRETTY_NAME="FreeBSD $_version" + CPE_NAME=cpe:/o:freebsd:freebsd:$_version_id + HOME_URL=https://FreeBSD.org/ + BUG_REPORT_URL=https://bugs.FreeBSD.org/ +__EOF__ + install -C -o root -g wheel -m ${osrelease_perms} "$t" "${osrelease_file}" + rm -f "$t" + check_startmsgs && echo 'done.' +} + +load_rc_config $name +run_rc_command "$1" Modified: stable/12/share/man/man5/Makefile ============================================================================== --- stable/12/share/man/man5/Makefile Fri Jan 31 12:39:51 2020 (r357332) +++ stable/12/share/man/man5/Makefile Fri Jan 31 13:18:25 2020 (r357333) @@ -48,6 +48,7 @@ MAN= acct.5 \ nsmb.conf.5 \ nsswitch.conf.5 \ nullfs.5 \ + os-release.5 \ passwd.5 \ pbm.5 \ periodic.conf.5 \ Copied: stable/12/share/man/man5/os-release.5 (from r354922, head/share/man/man5/os-release.5) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/share/man/man5/os-release.5 Fri Jan 31 13:18:25 2020 (r357333, copy of r354922, head/share/man/man5/os-release.5) @@ -0,0 +1,130 @@ +.\" Copyright (c) 2019 M. Warner Losh. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" 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$ +.\" +.Dd November 9, 2019 +.Dt OS-RELEASE 5 +.Os +.Sh NAME +.Nm os-release +.Nd file describing the current OS and some of its attributes +.Sh DESCRIPTION +The +.Nm +file is a new-line separated list of key value pairs. +The syntax of this file is a reduced +.Xr sh 1 +variable assignment with the +following restrictions: +.Bl -bullet +.It +Strings cannot be concatenated together +.It +No variable expansion is done +.It +All shell special characters must be quoted as documented in +.Xr sh 1 +.It +Variable assignments must be included inside of double quotes +if they contain characters outside of A-Z, a-z and 0-9 +.It +All strings should be UTF-8 format +.It +Non-printable characters should not be used in the strings +.El +.Pp +Lines starting with the character +.Ql # +are ignored as comments. +.Sh VARIABLES +The following variables are defined by the standard. +.Bl -tag -width XXXXXXXXXX -compact +.It Dv NAME +A string describing the preferred OS name. +.It Dv VERSION +Version string for the OS, in its usual and customary format. +.It Dv ID +Lower case version of the name with only a-z, 0-9, +.Ql . , +.Ql - , +and +.Ql _ . +.It Dv VERSION_ID +Lower case version of the version with only a-z, 0-9, +.Ql . , +.Ql - , +and +.Ql _ . +.It Dv PRETTY_NAME +A pretty version of the name presented to the user. +May contain release information. +.It Dv ANSI_COLOR +Suggested color presentation for the OS. +This string should be suitable for inclusion within an ESC [ m ANSI/ECMA-48 +escape sequence to render the OS in its preferred color. +This variable is optional. +.It Dv CPE_NAME +A CPE name for the operating system. +This field shall follow the NIST Common Platform Enumeration specification. +.It Dv HOME_URL +.It Dv SUPPORT_URL +.It Dv BUG_REPORT_URL +.It Dv PRIVACY_POLICY_URL +Links on the internet, in RFC 3986 format for different aspects of this OS. +These variables are optional. +.It Dv BUILD_ID +A string identifying the build. +This variable is optional. +.It Dv VARIANT +A string describing the variant of this operating system. +This variable is optional. +.It Dv VARIANT_ID +Lower case version of the variant with only a-z, 0-9, +.Ql . , +.Ql - , +and +.Ql _ . +This variable is optional. +.El +.Pp +All other variables have no standard-defined meaning. +.Sh FILES +.Bl -tag -width XXXXXXXXXX -compact +.It Pa /etc/os-release +Symbolic link to actual +.Pa os-release +file. +.It Pa /var/run/os-release +Generated os-release file describing the currently running system. +.Sh SEE ALSO +.Bl -tag -width XXXXXXXXXX -compact +.It CPE Specification +.Lk https://csrc.nist.gov/projects/security-content-automation-protocol/scap-specifications/cpe +.It RFC 3986 +.Lk https://tools.ietf.org/html/rfc3986 +.It os-release Specification +.Lk https://www.linux.org/docs/man5/os-release.html +.Sh HISTORY +This file first appeared in +.Fx 13.0 . Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Fri Jan 31 12:39:51 2020 (r357332) +++ stable/12/sys/sys/param.h Fri Jan 31 13:18:25 2020 (r357333) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1201510 /* Master, propagated to newvers */ +#define __FreeBSD_version 1201511 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-12@freebsd.org Fri Jan 31 20:04:33 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 706221EB32A; Fri, 31 Jan 2020 20:04:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 488SqP2Gsfz496B; Fri, 31 Jan 2020 20:04:33 +0000 (UTC) (envelope-from dim@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 2EF511B597; Fri, 31 Jan 2020 20:04:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00VK4XrS074680; Fri, 31 Jan 2020 20:04:33 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00VK4Xas074679; Fri, 31 Jan 2020 20:04:33 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202001312004.00VK4Xas074679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 31 Jan 2020 20:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357351 - in stable: 10/contrib/binutils/bfd 11/contrib/binutils/bfd 12/contrib/binutils/bfd 9/contrib/binutils/bfd X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/contrib/binutils/bfd 11/contrib/binutils/bfd 12/contrib/binutils/bfd 9/contrib/binutils/bfd X-SVN-Commit-Revision: 357351 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jan 2020 20:04:33 -0000 Author: dim Date: Fri Jan 31 20:04:32 2020 New Revision: 357351 URL: https://svnweb.freebsd.org/changeset/base/357351 Log: MFC r357226: Merge r357224 from the clang1000-import branch: Fix the following -Werror warning from clang 10.0.0 in binutils: contrib/binutils/bfd/peicode.h:1356:3: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation] if (efi) ^ contrib/binutils/bfd/peicode.h:1353:8: note: previous statement is here if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch) ^ contrib/binutils/bfd/peicode.h:1370:3: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation] if (!efi) ^ contrib/binutils/bfd/peicode.h:1367:8: note: previous statement is here if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch) ^ Modified: stable/12/contrib/binutils/bfd/peicode.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/binutils/bfd/peicode.h stable/11/contrib/binutils/bfd/peicode.h stable/9/contrib/binutils/bfd/peicode.h Directory Properties: stable/10/ (props changed) stable/11/ (props changed) stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/binutils/ (props changed) Modified: stable/12/contrib/binutils/bfd/peicode.h ============================================================================== --- stable/12/contrib/binutils/bfd/peicode.h Fri Jan 31 19:40:40 2020 (r357350) +++ stable/12/contrib/binutils/bfd/peicode.h Fri Jan 31 20:04:32 2020 (r357351) @@ -1353,13 +1353,13 @@ pe_bfd_object_p (bfd * abfd) if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch) continue; - if (efi) - { - /* TARGET_PTR is an EFI backend. Don't match - TARGET with a EFI file. */ - bfd_set_error (bfd_error_wrong_format); - return NULL; - } + if (efi) + { + /* TARGET_PTR is an EFI backend. Don't match + TARGET with a EFI file. */ + bfd_set_error (bfd_error_wrong_format); + return NULL; + } } else if (bfd_target_pei_p (*target_ptr)) { @@ -1367,13 +1367,13 @@ pe_bfd_object_p (bfd * abfd) if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch) continue; - if (!efi) - { - /* TARGET_PTR is a PE backend. Don't match - TARGET with a PE file. */ - bfd_set_error (bfd_error_wrong_format); - return NULL; - } + if (!efi) + { + /* TARGET_PTR is a PE backend. Don't match + TARGET with a PE file. */ + bfd_set_error (bfd_error_wrong_format); + return NULL; + } } } } From owner-svn-src-stable-12@freebsd.org Fri Jan 31 21:20:22 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9983D1ED14F; Fri, 31 Jan 2020 21:20:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 488VVt3f2tz4F0t; Fri, 31 Jan 2020 21:20:22 +0000 (UTC) (envelope-from dim@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 777D01C26B; Fri, 31 Jan 2020 21:20:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00VLKMhr016432; Fri, 31 Jan 2020 21:20:22 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00VLKMgH016431; Fri, 31 Jan 2020 21:20:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202001312120.00VLKMgH016431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 31 Jan 2020 21:20:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357354 - in stable: 11/stand/i386/gptboot 12/stand/i386/gptboot X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/stand/i386/gptboot 12/stand/i386/gptboot X-SVN-Commit-Revision: 357354 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-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jan 2020 21:20:22 -0000 Author: dim Date: Fri Jan 31 21:20:22 2020 New Revision: 357354 URL: https://svnweb.freebsd.org/changeset/base/357354 Log: MFC r357232: Merge r357231 from the clang1000-import branch: Work around assembler error from clang 10.0.0 in gptboot: stand/i386/gptboot/gptldr.S:141:3: error: value of 36878 is too large for field of 2 bytes. jmp MEM_JMP # Start BTX ^ Use the same construct as in stand/i386/boot2/boot1.S, which ensures the jump distance does not become too large. Modified: stable/12/stand/i386/gptboot/gptldr.S Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/stand/i386/gptboot/gptldr.S Directory Properties: stable/11/ (props changed) Modified: stable/12/stand/i386/gptboot/gptldr.S ============================================================================== --- stable/12/stand/i386/gptboot/gptldr.S Fri Jan 31 21:08:33 2020 (r357353) +++ stable/12/stand/i386/gptboot/gptldr.S Fri Jan 31 21:20:22 2020 (r357354) @@ -138,5 +138,5 @@ seta20.3: sti # Enable interrupts * Save drive number from BIOS so boot2 can see it and start BTX. */ movb %dl,MEM_ARG - jmp MEM_JMP # Start BTX + jmp start+MEM_JMP-MEM_ORG # Start BTX end: