Merge #6350: backport: trivial 2024 10 23 pr7

37389c7d38 Merge bitcoin/bitcoin#28781: depends: latest config.guess & config.sub (fanquake)
3239f1525d Merge bitcoin/bitcoin#28479: build: use _LIBCPP_ENABLE_DEBUG_MODE over ENABLE_ASSERTIONS (fanquake)
45cc44bcf9 Merge bitcoin/bitcoin#27628: build: Fix shared lib linking for darwin with lld (fanquake)
b8ddcd937c Merge bitcoin/bitcoin#27575: Introduce platform-agnostic `ALWAYS_INLINE` macro (fanquake)
71c6d7f6ca Merge bitcoin/bitcoin#26653: test, init: perturb file to ensure failure instead of only deleting them (fanquake)
417f71a587 Merge bitcoin/bitcoin#27422: test: add coverage to rpc_scantxoutset.py (fanquake)
898dcbdc4f Merge bitcoin/bitcoin#27559: doc: clarify processing of mempool-msgs when NODE_BLOOM (glozow)
a4e429cb5a Merge bitcoin/bitcoin#26953: contrib: add ELF OS ABI check to symbol-check.py (fanquake)
deb7de26dd Merge bitcoin/bitcoin#26604: test: add coverage for `-bantime` (fanquake)
f725ed509a Merge bitcoin/bitcoin#26314: test: perturb anchors.dat to test error during initialization (fanquake)
3306f96d80 Merge bitcoin/bitcoin#25937: test: add coverage for rpc error when trying to rescan beyond pruned data (fanquake)
712dcaf86b Merge bitcoin/bitcoin#27516: test: simplify uint256 (de)serialization routines (fanquake)
90d65f25e1 Merge bitcoin/bitcoin#27508: build: use latest config.{guess,sub} in depends (fanquake)
df7be026e4 Merge bitcoin/bitcoin#27506: test: prevent intermittent failures (fanquake)
9b58b2d97b Merge bitcoin/bitcoin#27447: depends: Remove `_LIBCPP_DEBUG` from depends DEBUG mode (fanquake)
07770b77a1 Merge bitcoin/bitcoin#26741: doc: FreeBSD DataDirectoryGroupReadable Setting (fanquake)
5645362f11 Merge bitcoin/bitcoin#27362: test: remove `GetRNGState` lsan suppression (fanquake)
671e8e6851 Merge bitcoin/bitcoin#27368: refactor: Drop no longer used `CNetMsgMaker` instances (fanquake)
a11690bf62 Merge bitcoin/bitcoin#27301: depends: make fontconfig build under clang-16 (fanquake)
0a94b3f27b Merge bitcoin/bitcoin#27328: depends: fix osx build with clang 16 (fanquake)

Pull request description:

  ## Issue being fixed or feature implemented
  Batch of trivial backports

  ## What was done?
  See commits

  ## How Has This Been Tested?
  built locally; large combined merge passed tests locally

  ## Breaking Changes
  Should be none

  ## Checklist:
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK 37389c7d38
  kwvg:
    utACK 37389c7d38

Tree-SHA512: 1ea075a58361f57e037febcf003d380ab845b6c8e1c62d9fcf8954d46cd006046d1951f15a41a5deb9ab7af734df9dafcf89f33d115d78246752f7e2cd13f4ee
This commit is contained in:
pasta 2024-10-25 12:57:10 -05:00
commit e12afdf175
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
21 changed files with 1033 additions and 764 deletions

View File

@ -57,13 +57,24 @@ else
fi fi
AC_PROG_CXX AC_PROG_CXX
dnl By default, libtool for mingw refuses to link static libs into a dll for dnl libtool overrides
dnl fear of mixing pic/non-pic objects, and import/export complications. Since
dnl we have those under control, re-enable that functionality.
case $host in case $host in
*mingw*) *mingw*)
dnl By default, libtool for mingw refuses to link static libs into a dll for
dnl fear of mixing pic/non-pic objects, and import/export complications. Since
dnl we have those under control, re-enable that functionality.
lt_cv_deplibs_check_method="pass_all" lt_cv_deplibs_check_method="pass_all"
;; ;;
*darwin*)
dnl Because it prints a verbose warning, lld fails the following check
dnl for "-Wl,-single_module" from libtool.m4:
dnl # If there is a non-empty error log, and "single_module"
dnl # appears in it, assume the flag caused a linker warning
dnl "-single_module" works fine on ld64 and lld, so just bypass the test.
dnl Failure to set this to "yes" causes libtool to use a very broken
dnl link-line for shared libs.
lt_cv_apple_cc_single_mod="yes"
;;
esac esac
AC_ARG_ENABLE([c++20], AC_ARG_ENABLE([c++20],

View File

@ -75,6 +75,25 @@ ELF_INTERPRETER_NAMES: Dict[lief.ELF.ARCH, Dict[lief.ENDIANNESS, str]] = {
}, },
} }
ELF_ABIS: Dict[lief.ELF.ARCH, Dict[lief.ENDIANNESS, List[int]]] = {
lief.ELF.ARCH.x86_64: {
lief.ENDIANNESS.LITTLE: [3,2,0],
},
lief.ELF.ARCH.ARM: {
lief.ENDIANNESS.LITTLE: [3,2,0],
},
lief.ELF.ARCH.AARCH64: {
lief.ENDIANNESS.LITTLE: [3,7,0],
},
lief.ELF.ARCH.PPC64: {
lief.ENDIANNESS.LITTLE: [3,10,0],
lief.ENDIANNESS.BIG: [3,2,0],
},
lief.ELF.ARCH.RISCV: {
lief.ENDIANNESS.LITTLE: [4,15,0],
},
}
# Allowed NEEDED libraries # Allowed NEEDED libraries
ELF_ALLOWED_LIBRARIES = { ELF_ALLOWED_LIBRARIES = {
# dashd and dash-qt # dashd and dash-qt
@ -248,12 +267,19 @@ def check_ELF_interpreter(binary) -> bool:
return binary.concrete.interpreter == expected_interpreter return binary.concrete.interpreter == expected_interpreter
def check_ELF_ABI(binary) -> bool:
expected_abi = ELF_ABIS[binary.header.machine_type][binary.abstract.header.endianness]
note = binary.concrete.get(lief.ELF.NOTE_TYPES.ABI_TAG)
assert note.details.abi == lief.ELF.NOTE_ABIS.LINUX
return note.details.version == expected_abi
CHECKS = { CHECKS = {
lief.EXE_FORMATS.ELF: [ lief.EXE_FORMATS.ELF: [
('IMPORTED_SYMBOLS', check_imported_symbols), ('IMPORTED_SYMBOLS', check_imported_symbols),
('EXPORTED_SYMBOLS', check_exported_symbols), ('EXPORTED_SYMBOLS', check_exported_symbols),
('LIBRARY_DEPENDENCIES', check_ELF_libraries), ('LIBRARY_DEPENDENCIES', check_ELF_libraries),
('INTERPRETER_NAME', check_ELF_interpreter), ('INTERPRETER_NAME', check_ELF_interpreter),
('ABI', check_ELF_ABI),
], ],
lief.EXE_FORMATS.MACHO: [ lief.EXE_FORMATS.MACHO: [
('DYNAMIC_LIBRARIES', check_MACHO_libraries), ('DYNAMIC_LIBRARIES', check_MACHO_libraries),

1281
depends/config.guess vendored

File diff suppressed because it is too large Load Diff

296
depends/config.sub vendored
View File

@ -1,12 +1,14 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright 1992-2021 Free Software Foundation, Inc. # Copyright 1992-2023 Free Software Foundation, Inc.
timestamp='2021-04-30' # shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2023-09-19'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, but # This program is distributed in the hope that it will be useful, but
@ -50,7 +52,14 @@ timestamp='2021-04-30'
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification. # It is wrong to echo any other type of specification.
me=$(echo "$0" | sed -e 's,.*/,,') # The "shellcheck disable" line above the timestamp inhibits complaints
# about features and limitations of the classic Bourne shell that were
# superseded or lifted in POSIX. However, this script identifies a wide
# variety of pre-POSIX systems that do not have POSIX shells at all, and
# even some reasonably current systems (Solaris 10 as case-in-point) still
# have a pre-POSIX /bin/sh.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\ usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
@ -67,13 +76,13 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright 1992-2021 Free Software Foundation, Inc. Copyright 1992-2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help=" help="
Try \`$me --help' for more information." Try '$me --help' for more information."
# Parse command line # Parse command line
while test $# -gt 0 ; do while test $# -gt 0 ; do
@ -112,14 +121,16 @@ esac
# Split fields of configuration type # Split fields of configuration type
# shellcheck disable=SC2162 # shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read field1 field2 field3 field4 <<EOF IFS="-" read field1 field2 field3 field4 <<EOF
$1 $1
EOF EOF
IFS=$saved_IFS
# Separate into logical components for further validation # Separate into logical components for further validation
case $1 in case $1 in
*-*-*-*-*) *-*-*-*-*)
echo Invalid configuration \`"$1"\': more than four components >&2 echo "Invalid configuration '$1': more than four components" >&2
exit 1 exit 1
;; ;;
*-*-*-*) *-*-*-*)
@ -134,7 +145,8 @@ case $1 in
nto-qnx* | linux-* | uclinux-uclibc* \ nto-qnx* | linux-* | uclinux-uclibc* \
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
| storm-chaos* | os2-emx* | rtmk-nova*) | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \
| windows-* )
basic_machine=$field1 basic_machine=$field1
basic_os=$maybe_os basic_os=$maybe_os
;; ;;
@ -163,6 +175,10 @@ case $1 in
basic_machine=$field1 basic_machine=$field1
basic_os=$field2 basic_os=$field2
;; ;;
zephyr*)
basic_machine=$field1-unknown
basic_os=$field2
;;
# Manufacturers # Manufacturers
dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
@ -769,22 +785,22 @@ case $basic_machine in
vendor=hp vendor=hp
;; ;;
i*86v32) i*86v32)
cpu=$(echo "$1" | sed -e 's/86.*/86/') cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc vendor=pc
basic_os=sysv32 basic_os=sysv32
;; ;;
i*86v4*) i*86v4*)
cpu=$(echo "$1" | sed -e 's/86.*/86/') cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc vendor=pc
basic_os=sysv4 basic_os=sysv4
;; ;;
i*86v) i*86v)
cpu=$(echo "$1" | sed -e 's/86.*/86/') cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc vendor=pc
basic_os=sysv basic_os=sysv
;; ;;
i*86sol2) i*86sol2)
cpu=$(echo "$1" | sed -e 's/86.*/86/') cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc vendor=pc
basic_os=solaris2 basic_os=solaris2
;; ;;
@ -917,16 +933,18 @@ case $basic_machine in
;; ;;
leon-*|leon[3-9]-*) leon-*|leon[3-9]-*)
cpu=sparc cpu=sparc
vendor=$(echo "$basic_machine" | sed 's/-.*//') vendor=`echo "$basic_machine" | sed 's/-.*//'`
;; ;;
*-*) *-*)
# shellcheck disable=SC2162 # shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read cpu vendor <<EOF IFS="-" read cpu vendor <<EOF
$basic_machine $basic_machine
EOF EOF
IFS=$saved_IFS
;; ;;
# We use `pc' rather than `unknown' # We use 'pc' rather than 'unknown'
# because (1) that's what they normally are, and # because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users. # (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64) i*86 | x86_64)
@ -1003,6 +1021,11 @@ case $cpu-$vendor in
;; ;;
# Here we normalize CPU types with a missing or matching vendor # Here we normalize CPU types with a missing or matching vendor
armh-unknown | armh-alt)
cpu=armv7l
vendor=alt
basic_os=${basic_os:-linux-gnueabihf}
;;
dpx20-unknown | dpx20-bull) dpx20-unknown | dpx20-bull)
cpu=rs6000 cpu=rs6000
vendor=bull vendor=bull
@ -1053,7 +1076,7 @@ case $cpu-$vendor in
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
cpu=i586 cpu=i586
;; ;;
pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*) pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*)
cpu=i686 cpu=i686
;; ;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
@ -1084,7 +1107,7 @@ case $cpu-$vendor in
cpu=mipsisa64sb1el cpu=mipsisa64sb1el
;; ;;
sh5e[lb]-*) sh5e[lb]-*)
cpu=$(echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/') cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
;; ;;
spur-*) spur-*)
cpu=spur cpu=spur
@ -1102,9 +1125,9 @@ case $cpu-$vendor in
cpu=x86_64 cpu=x86_64
;; ;;
xscale-* | xscalee[bl]-*) xscale-* | xscalee[bl]-*)
cpu=$(echo "$cpu" | sed 's/^xscale/arm/') cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
;; ;;
arm64-*) arm64-* | aarch64le-*)
cpu=aarch64 cpu=aarch64
;; ;;
@ -1158,14 +1181,14 @@ case $cpu-$vendor in
case $cpu in case $cpu in
1750a | 580 \ 1750a | 580 \
| a29k \ | a29k \
| aarch64 | aarch64_be \ | aarch64 | aarch64_be | aarch64c | arm64ec \
| abacus \ | abacus \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
| alphapca5[67] | alpha64pca5[67] \ | alphapca5[67] | alpha64pca5[67] \
| am33_2.0 \ | am33_2.0 \
| amdgcn \ | amdgcn \
| arc | arceb | arc64 \ | arc | arceb | arc32 | arc64 \
| arm | arm[lb]e | arme[lb] | armv* \ | arm | arm[lb]e | arme[lb] | armv* \
| avr | avr32 \ | avr | avr32 \
| asmjs \ | asmjs \
@ -1177,45 +1200,23 @@ case $cpu-$vendor in
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
| e2k | elxsi | epiphany \ | e2k | elxsi | epiphany \
| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
| javascript \
| h8300 | h8500 \ | h8300 | h8500 \
| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \ | hexagon \
| i370 | i*86 | i860 | i960 | ia16 | ia64 \ | i370 | i*86 | i860 | i960 | ia16 | ia64 \
| ip2k | iq2000 \ | ip2k | iq2000 \
| k1om \ | k1om \
| kvx \
| le32 | le64 \ | le32 | le64 \
| lm32 \ | lm32 \
| loongarch32 | loongarch64 | loongarchx32 \ | loongarch32 | loongarch64 \
| m32c | m32r | m32rle \ | m32c | m32r | m32rle \
| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
| m88110 | m88k | maxq | mb | mcore | mep | metag \ | m88110 | m88k | maxq | mb | mcore | mep | metag \
| microblaze | microblazeel \ | microblaze | microblazeel \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips* \
| mips16 \
| mips64 | mips64eb | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r3 | mipsisa32r3el \
| mipsisa32r5 | mipsisa32r5el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r3 | mipsisa64r3el \
| mipsisa64r5 | mipsisa64r5el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mmix \ | mmix \
| mn10200 | mn10300 \ | mn10200 | mn10300 \
| moxie \ | moxie \
@ -1263,7 +1264,7 @@ case $cpu-$vendor in
;; ;;
*) *)
echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2
exit 1 exit 1
;; ;;
esac esac
@ -1284,38 +1285,45 @@ esac
# Decode manufacturer-specific aliases for certain operating systems. # Decode manufacturer-specific aliases for certain operating systems.
if test x$basic_os != x if test x"$basic_os" != x
then then
# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
# set os. # set os.
obj=
case $basic_os in case $basic_os in
gnu/linux*) gnu/linux*)
kernel=linux kernel=linux
os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|') os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
;; ;;
os2-emx) os2-emx)
kernel=os2 kernel=os2
os=$(echo $basic_os | sed -e 's|os2-emx|emx|') os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
;; ;;
nto-qnx*) nto-qnx*)
kernel=nto kernel=nto
os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|') os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
;; ;;
*-*) *-*)
# shellcheck disable=SC2162 # shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read kernel os <<EOF IFS="-" read kernel os <<EOF
$basic_os $basic_os
EOF EOF
IFS=$saved_IFS
;; ;;
# Default OS when just kernel was specified # Default OS when just kernel was specified
nto*) nto*)
kernel=nto kernel=nto
os=$(echo $basic_os | sed -e 's|nto|qnx|') os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
;; ;;
linux*) linux*)
kernel=linux kernel=linux
os=$(echo $basic_os | sed -e 's|linux|gnu|') os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
;;
managarm*)
kernel=managarm
os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
;; ;;
*) *)
kernel= kernel=
@ -1336,7 +1344,7 @@ case $os in
os=cnk os=cnk
;; ;;
solaris1 | solaris1.*) solaris1 | solaris1.*)
os=$(echo $os | sed -e 's|solaris1|sunos4|') os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
;; ;;
solaris) solaris)
os=solaris2 os=solaris2
@ -1365,7 +1373,7 @@ case $os in
os=sco3.2v4 os=sco3.2v4
;; ;;
sco3.2.[4-9]*) sco3.2.[4-9]*)
os=$(echo $os | sed -e 's/sco3.2./sco3.2v/') os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
;; ;;
sco*v* | scout) sco*v* | scout)
# Don't match below # Don't match below
@ -1395,7 +1403,7 @@ case $os in
os=lynxos os=lynxos
;; ;;
mac[0-9]*) mac[0-9]*)
os=$(echo "$os" | sed -e 's|mac|macos|') os=`echo "$os" | sed -e 's|mac|macos|'`
;; ;;
opened*) opened*)
os=openedition os=openedition
@ -1404,10 +1412,10 @@ case $os in
os=os400 os=os400
;; ;;
sunos5*) sunos5*)
os=$(echo "$os" | sed -e 's|sunos5|solaris2|') os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
;; ;;
sunos6*) sunos6*)
os=$(echo "$os" | sed -e 's|sunos6|solaris3|') os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
;; ;;
wince*) wince*)
os=wince os=wince
@ -1441,7 +1449,7 @@ case $os in
;; ;;
# Preserve the version number of sinix5. # Preserve the version number of sinix5.
sinix5.*) sinix5.*)
os=$(echo $os | sed -e 's|sinix|sysv|') os=`echo "$os" | sed -e 's|sinix|sysv|'`
;; ;;
sinix*) sinix*)
os=sysv4 os=sysv4
@ -1482,10 +1490,16 @@ case $os in
os=eabi os=eabi
;; ;;
*) *)
os=elf os=
obj=elf
;; ;;
esac esac
;; ;;
aout* | coff* | elf* | pe*)
# These are machine code file formats, not OSes
obj=$os
os=
;;
*) *)
# No normalization, but not necessarily accepted, that comes below. # No normalization, but not necessarily accepted, that comes below.
;; ;;
@ -1504,12 +1518,15 @@ else
# system, and we'll never get to this point. # system, and we'll never get to this point.
kernel= kernel=
obj=
case $cpu-$vendor in case $cpu-$vendor in
score-*) score-*)
os=elf os=
obj=elf
;; ;;
spu-*) spu-*)
os=elf os=
obj=elf
;; ;;
*-acorn) *-acorn)
os=riscix1.2 os=riscix1.2
@ -1519,28 +1536,35 @@ case $cpu-$vendor in
os=gnu os=gnu
;; ;;
arm*-semi) arm*-semi)
os=aout os=
obj=aout
;; ;;
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=coff os=
obj=coff
;; ;;
c8051-*) c8051-*)
os=elf os=
obj=elf
;; ;;
clipper-intergraph) clipper-intergraph)
os=clix os=clix
;; ;;
hexagon-*) hexagon-*)
os=elf os=
obj=elf
;; ;;
tic54x-*) tic54x-*)
os=coff os=
obj=coff
;; ;;
tic55x-*) tic55x-*)
os=coff os=
obj=coff
;; ;;
tic6x-*) tic6x-*)
os=coff os=
obj=coff
;; ;;
# This must come before the *-dec entry. # This must come before the *-dec entry.
pdp10-*) pdp10-*)
@ -1562,19 +1586,24 @@ case $cpu-$vendor in
os=sunos3 os=sunos3
;; ;;
m68*-cisco) m68*-cisco)
os=aout os=
obj=aout
;; ;;
mep-*) mep-*)
os=elf os=
obj=elf
;; ;;
mips*-cisco) mips*-cisco)
os=elf os=
obj=elf
;; ;;
mips*-*) mips*-*)
os=elf os=
obj=elf
;; ;;
or32-*) or32-*)
os=coff os=
obj=coff
;; ;;
*-tti) # must be before sparc entry or we get the wrong os. *-tti) # must be before sparc entry or we get the wrong os.
os=sysv3 os=sysv3
@ -1583,7 +1612,8 @@ case $cpu-$vendor in
os=sunos4.1.1 os=sunos4.1.1
;; ;;
pru-*) pru-*)
os=elf os=
obj=elf
;; ;;
*-be) *-be)
os=beos os=beos
@ -1664,10 +1694,12 @@ case $cpu-$vendor in
os=uxpv os=uxpv
;; ;;
*-rom68k) *-rom68k)
os=coff os=
obj=coff
;; ;;
*-*bug) *-*bug)
os=coff os=
obj=coff
;; ;;
*-apple) *-apple)
os=macos os=macos
@ -1685,10 +1717,11 @@ esac
fi fi
# Now, validate our (potentially fixed-up) OS. # Now, validate our (potentially fixed-up) individual pieces (OS, OBJ).
case $os in case $os in
# Sometimes we do "kernel-libc", so those need to count as OSes. # Sometimes we do "kernel-libc", so those need to count as OSes.
musl* | newlib* | uclibc*) musl* | newlib* | relibc* | uclibc*)
;; ;;
# Likewise for "kernel-abi" # Likewise for "kernel-abi"
eabi* | gnueabi*) eabi* | gnueabi*)
@ -1696,6 +1729,9 @@ case $os in
# VxWorks passes extra cpu info in the 4th filed. # VxWorks passes extra cpu info in the 4th filed.
simlinux | simwindows | spe) simlinux | simwindows | spe)
;; ;;
# See `case $cpu-$os` validation below
ghcjs)
;;
# Now accept the basic system types. # Now accept the basic system types.
# The portable systems comes first. # The portable systems comes first.
# Each alternative MUST end in a * to match a version number. # Each alternative MUST end in a * to match a version number.
@ -1704,7 +1740,7 @@ case $os in
| hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
| sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
| hiux* | abug | nacl* | netware* | windows* \ | hiux* | abug | nacl* | netware* | windows* \
| os9* | macos* | osx* | ios* \ | os9* | macos* | osx* | ios* | tvos* | watchos* \
| mpw* | magic* | mmixware* | mon960* | lnews* \ | mpw* | magic* | mmixware* | mon960* | lnews* \
| amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
| aos* | aros* | cloudabi* | sortix* | twizzler* \ | aos* | aros* | cloudabi* | sortix* | twizzler* \
@ -1713,11 +1749,11 @@ case $os in
| mirbsd* | netbsd* | dicos* | openedition* | ose* \ | mirbsd* | netbsd* | dicos* | openedition* | ose* \
| bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
| ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
| bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | bosx* | nextstep* | cxux* | oabi* \
| ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | ptx* | ecoff* | winnt* | domain* | vsta* \
| udi* | lites* | ieee* | go32* | aux* | hcos* \ | udi* | lites* | ieee* | go32* | aux* | hcos* \
| chorusrdb* | cegcc* | glidix* | serenity* \ | chorusrdb* | cegcc* | glidix* | serenity* \
| cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | cygwin* | msys* | moss* | proelf* | rtems* \
| midipix* | mingw32* | mingw64* | mint* \ | midipix* | mingw32* | mingw64* | mint* \
| uxpv* | beos* | mpeix* | udk* | moxiebox* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \
| interix* | uwin* | mks* | rhapsody* | darwin* \ | interix* | uwin* | mks* | rhapsody* | darwin* \
@ -1729,7 +1765,8 @@ case $os in
| skyos* | haiku* | rdos* | toppers* | drops* | es* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
| fiwix* | mlibc* | cos* | mbr* )
;; ;;
# This one is extra strict with allowed versions # This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*) sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@ -1737,40 +1774,99 @@ case $os in
;; ;;
none) none)
;; ;;
kernel* | msvc* )
# Restricted further below
;;
'')
if test x"$obj" = x
then
echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2
fi
;;
*) *)
echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2
exit 1
;;
esac
case $obj in
aout* | coff* | elf* | pe*)
;;
'')
# empty is fine
;;
*)
echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2
exit 1
;;
esac
# Here we handle the constraint that a (synthetic) cpu and os are
# valid only in combination with each other and nowhere else.
case $cpu-$os in
# The "javascript-unknown-ghcjs" triple is used by GHC; we
# accept it here in order to tolerate that, but reject any
# variations.
javascript-ghcjs)
;;
javascript-* | *-ghcjs)
echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2
exit 1 exit 1
;; ;;
esac esac
# As a final step for OS-related things, validate the OS-kernel combination # As a final step for OS-related things, validate the OS-kernel combination
# (given a valid OS), if there is a kernel. # (given a valid OS), if there is a kernel.
case $kernel-$os in case $kernel-$os-$obj in
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) linux-gnu*- | linux-dietlibc*- | linux-android*- | linux-newlib*- \
| linux-musl*- | linux-relibc*- | linux-uclibc*- | linux-mlibc*- )
;; ;;
uclinux-uclibc* ) uclinux-uclibc*- )
;; ;;
-dietlibc* | -newlib* | -musl* | -uclibc* ) managarm-mlibc*- | managarm-kernel*- )
;;
windows*-msvc*-)
;;
-dietlibc*- | -newlib*- | -musl*- | -relibc*- | -uclibc*- | -mlibc*- )
# These are just libc implementations, not actual OSes, and thus # These are just libc implementations, not actual OSes, and thus
# require a kernel. # require a kernel.
echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2
exit 1 exit 1
;; ;;
kfreebsd*-gnu* | kopensolaris*-gnu*) -kernel*- )
echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2
exit 1
;; ;;
vxworks-simlinux | vxworks-simwindows | vxworks-spe) *-kernel*- )
echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2
exit 1
;; ;;
nto-qnx*) *-msvc*- )
echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2
exit 1
;; ;;
os2-emx) kfreebsd*-gnu*- | kopensolaris*-gnu*-)
;; ;;
*-eabi* | *-gnueabi*) vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-)
;; ;;
-*) nto-qnx*-)
;;
os2-emx-)
;;
*-eabi*- | *-gnueabi*-)
;;
none--*)
# None (no kernel, i.e. freestanding / bare metal),
# can be paired with an machine code file format
;;
-*-)
# Blank kernel with real OS is always fine. # Blank kernel with real OS is always fine.
;; ;;
*-*) --*)
echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 # Blank kernel and OS with real machine code file format is always fine.
;;
*-*-*)
echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2
exit 1 exit 1
;; ;;
esac esac
@ -1853,7 +1949,7 @@ case $vendor in
;; ;;
esac esac
echo "$cpu-$vendor-${kernel:+$kernel-}$os" echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}"
exit exit
# Local variables: # Local variables:

View File

@ -99,8 +99,8 @@ darwin_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
$(clang_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \ $(clang_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \ -B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
-isysroot$(OSX_SDK) \ -isysroot$(OSX_SDK) \
-Xclang -internal-externc-isystem$(clang_resource_dir)/include \ -Xclang -internal-externc-isystem -Xclang $(clang_resource_dir)/include \
-Xclang -internal-externc-isystem$(OSX_SDK)/usr/include -Xclang -internal-externc-isystem -Xclang $(OSX_SDK)/usr/include
darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \ -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
-u LIBRARY_PATH \ -u LIBRARY_PATH \
@ -108,8 +108,8 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \ -B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
-isysroot$(OSX_SDK) \ -isysroot$(OSX_SDK) \
-stdlib++-isystem$(OSX_SDK)/usr/include/c++/v1 \ -stdlib++-isystem$(OSX_SDK)/usr/include/c++/v1 \
-Xclang -internal-externc-isystem$(clang_resource_dir)/include \ -Xclang -internal-externc-isystem -Xclang $(clang_resource_dir)/include \
-Xclang -internal-externc-isystem$(OSX_SDK)/usr/include -Xclang -internal-externc-isystem -Xclang $(OSX_SDK)/usr/include
darwin_CFLAGS=-pipe darwin_CFLAGS=-pipe

View File

@ -13,7 +13,7 @@ linux_release_CXXFLAGS=$(linux_release_CFLAGS)
linux_debug_CFLAGS=-O1 linux_debug_CFLAGS=-O1
linux_debug_CXXFLAGS=$(linux_debug_CFLAGS) linux_debug_CXXFLAGS=$(linux_debug_CFLAGS)
linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_LIBCPP_DEBUG=1 linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_LIBCPP_ENABLE_DEBUG_MODE=1
ifeq (86,$(findstring 86,$(build_arch))) ifeq (86,$(findstring 86,$(build_arch)))
i686_linux_CC=gcc -m32 i686_linux_CC=gcc -m32

View File

@ -9,6 +9,7 @@ $(package)_patches=remove_char_width_usage.patch gperf_header_regen.patch
define $(package)_set_vars define $(package)_set_vars
$(package)_config_opts=--disable-docs --disable-static --disable-libxml2 --disable-iconv $(package)_config_opts=--disable-docs --disable-static --disable-libxml2 --disable-iconv
$(package)_config_opts += --disable-dependency-tracking --enable-option-checking $(package)_config_opts += --disable-dependency-tracking --enable-option-checking
$(package)_cflags += -Wno-implicit-function-declaration
endef endef
define $(package)_preprocess_cmds define $(package)_preprocess_cmds

View File

@ -100,19 +100,13 @@ out by default (if not, add them):
ControlPort 9051 ControlPort 9051
CookieAuthentication 1 CookieAuthentication 1
CookieAuthFileGroupReadable 1 CookieAuthFileGroupReadable 1
DataDirectoryGroupReadable 1
``` ```
Add or uncomment those, save, and restart Tor (usually `systemctl restart tor` Add or uncomment those, save, and restart Tor (usually `systemctl restart tor`
or `sudo systemctl restart tor` on most systemd-based systems, including recent or `sudo systemctl restart tor` on most systemd-based systems, including recent
Debian and Ubuntu, or just restart the computer). Debian and Ubuntu, or just restart the computer).
On some systems (such as Arch Linux), you may also need to add the following
line:
```
DataDirectoryGroupReadable 1
```
### Authentication ### Authentication
Connecting to Tor's control socket API requires one of two authentication Connecting to Tor's control socket API requires one of two authentication

View File

@ -16,4 +16,12 @@
# define LIFETIMEBOUND # define LIFETIMEBOUND
#endif #endif
#if defined(__GNUC__)
# define ALWAYS_INLINE inline __attribute__((always_inline))
#elif defined(_MSC_VER)
# define ALWAYS_INLINE __forceinline
#else
# error No known always_inline attribute for this platform.
#endif
#endif // BITCOIN_ATTRIBUTES_H #endif // BITCOIN_ATTRIBUTES_H

View File

@ -7,6 +7,7 @@
#include <stdint.h> #include <stdint.h>
#include <immintrin.h> #include <immintrin.h>
#include <attributes.h>
#include <crypto/common.h> #include <crypto/common.h>
namespace sha256d64_avx2 { namespace sha256d64_avx2 {
@ -36,7 +37,7 @@ __m256i inline sigma0(__m256i x) { return Xor(Or(ShR(x, 7), ShL(x, 25)), Or(ShR(
__m256i inline sigma1(__m256i x) { return Xor(Or(ShR(x, 17), ShL(x, 15)), Or(ShR(x, 19), ShL(x, 13)), ShR(x, 10)); } __m256i inline sigma1(__m256i x) { return Xor(Or(ShR(x, 17), ShL(x, 15)), Or(ShR(x, 19), ShL(x, 13)), ShR(x, 10)); }
/** One round of SHA-256. */ /** One round of SHA-256. */
void inline __attribute__((always_inline)) Round(__m256i a, __m256i b, __m256i c, __m256i& d, __m256i e, __m256i f, __m256i g, __m256i& h, __m256i k) void ALWAYS_INLINE Round(__m256i a, __m256i b, __m256i c, __m256i& d, __m256i e, __m256i f, __m256i g, __m256i& h, __m256i k)
{ {
__m256i t1 = Add(h, Sigma1(e), Ch(e, f, g), k); __m256i t1 = Add(h, Sigma1(e), Ch(e, f, g), k);
__m256i t2 = Add(Sigma0(a), Maj(a, b, c)); __m256i t2 = Add(Sigma0(a), Maj(a, b, c));

View File

@ -7,6 +7,7 @@
#include <stdint.h> #include <stdint.h>
#include <immintrin.h> #include <immintrin.h>
#include <attributes.h>
#include <crypto/common.h> #include <crypto/common.h>
namespace sha256d64_sse41 { namespace sha256d64_sse41 {
@ -36,7 +37,7 @@ __m128i inline sigma0(__m128i x) { return Xor(Or(ShR(x, 7), ShL(x, 25)), Or(ShR(
__m128i inline sigma1(__m128i x) { return Xor(Or(ShR(x, 17), ShL(x, 15)), Or(ShR(x, 19), ShL(x, 13)), ShR(x, 10)); } __m128i inline sigma1(__m128i x) { return Xor(Or(ShR(x, 17), ShL(x, 15)), Or(ShR(x, 19), ShL(x, 13)), ShR(x, 10)); }
/** One round of SHA-256. */ /** One round of SHA-256. */
void inline __attribute__((always_inline)) Round(__m128i a, __m128i b, __m128i c, __m128i& d, __m128i e, __m128i f, __m128i g, __m128i& h, __m128i k) void ALWAYS_INLINE Round(__m128i a, __m128i b, __m128i c, __m128i& d, __m128i e, __m128i f, __m128i g, __m128i& h, __m128i k)
{ {
__m128i t1 = Add(h, Sigma1(e), Ch(e, f, g), k); __m128i t1 = Add(h, Sigma1(e), Ch(e, f, g), k);
__m128i t2 = Add(Sigma0(a), Maj(a, b, c)); __m128i t2 = Add(Sigma0(a), Maj(a, b, c));

View File

@ -11,43 +11,45 @@
#include <stdint.h> #include <stdint.h>
#include <immintrin.h> #include <immintrin.h>
#include <attributes.h>
namespace { namespace {
alignas(__m128i) const uint8_t MASK[16] = {0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c}; alignas(__m128i) const uint8_t MASK[16] = {0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c};
alignas(__m128i) const uint8_t INIT0[16] = {0x8c, 0x68, 0x05, 0x9b, 0x7f, 0x52, 0x0e, 0x51, 0x85, 0xae, 0x67, 0xbb, 0x67, 0xe6, 0x09, 0x6a}; alignas(__m128i) const uint8_t INIT0[16] = {0x8c, 0x68, 0x05, 0x9b, 0x7f, 0x52, 0x0e, 0x51, 0x85, 0xae, 0x67, 0xbb, 0x67, 0xe6, 0x09, 0x6a};
alignas(__m128i) const uint8_t INIT1[16] = {0x19, 0xcd, 0xe0, 0x5b, 0xab, 0xd9, 0x83, 0x1f, 0x3a, 0xf5, 0x4f, 0xa5, 0x72, 0xf3, 0x6e, 0x3c}; alignas(__m128i) const uint8_t INIT1[16] = {0x19, 0xcd, 0xe0, 0x5b, 0xab, 0xd9, 0x83, 0x1f, 0x3a, 0xf5, 0x4f, 0xa5, 0x72, 0xf3, 0x6e, 0x3c};
void inline __attribute__((always_inline)) QuadRound(__m128i& state0, __m128i& state1, uint64_t k1, uint64_t k0) void ALWAYS_INLINE QuadRound(__m128i& state0, __m128i& state1, uint64_t k1, uint64_t k0)
{ {
const __m128i msg = _mm_set_epi64x(k1, k0); const __m128i msg = _mm_set_epi64x(k1, k0);
state1 = _mm_sha256rnds2_epu32(state1, state0, msg); state1 = _mm_sha256rnds2_epu32(state1, state0, msg);
state0 = _mm_sha256rnds2_epu32(state0, state1, _mm_shuffle_epi32(msg, 0x0e)); state0 = _mm_sha256rnds2_epu32(state0, state1, _mm_shuffle_epi32(msg, 0x0e));
} }
void inline __attribute__((always_inline)) QuadRound(__m128i& state0, __m128i& state1, __m128i m, uint64_t k1, uint64_t k0) void ALWAYS_INLINE QuadRound(__m128i& state0, __m128i& state1, __m128i m, uint64_t k1, uint64_t k0)
{ {
const __m128i msg = _mm_add_epi32(m, _mm_set_epi64x(k1, k0)); const __m128i msg = _mm_add_epi32(m, _mm_set_epi64x(k1, k0));
state1 = _mm_sha256rnds2_epu32(state1, state0, msg); state1 = _mm_sha256rnds2_epu32(state1, state0, msg);
state0 = _mm_sha256rnds2_epu32(state0, state1, _mm_shuffle_epi32(msg, 0x0e)); state0 = _mm_sha256rnds2_epu32(state0, state1, _mm_shuffle_epi32(msg, 0x0e));
} }
void inline __attribute__((always_inline)) ShiftMessageA(__m128i& m0, __m128i m1) void ALWAYS_INLINE ShiftMessageA(__m128i& m0, __m128i m1)
{ {
m0 = _mm_sha256msg1_epu32(m0, m1); m0 = _mm_sha256msg1_epu32(m0, m1);
} }
void inline __attribute__((always_inline)) ShiftMessageC(__m128i& m0, __m128i m1, __m128i& m2) void ALWAYS_INLINE ShiftMessageC(__m128i& m0, __m128i m1, __m128i& m2)
{ {
m2 = _mm_sha256msg2_epu32(_mm_add_epi32(m2, _mm_alignr_epi8(m1, m0, 4)), m1); m2 = _mm_sha256msg2_epu32(_mm_add_epi32(m2, _mm_alignr_epi8(m1, m0, 4)), m1);
} }
void inline __attribute__((always_inline)) ShiftMessageB(__m128i& m0, __m128i m1, __m128i& m2) void ALWAYS_INLINE ShiftMessageB(__m128i& m0, __m128i m1, __m128i& m2)
{ {
ShiftMessageC(m0, m1, m2); ShiftMessageC(m0, m1, m2);
ShiftMessageA(m0, m1); ShiftMessageA(m0, m1);
} }
void inline __attribute__((always_inline)) Shuffle(__m128i& s0, __m128i& s1) void ALWAYS_INLINE Shuffle(__m128i& s0, __m128i& s1)
{ {
const __m128i t1 = _mm_shuffle_epi32(s0, 0xB1); const __m128i t1 = _mm_shuffle_epi32(s0, 0xB1);
const __m128i t2 = _mm_shuffle_epi32(s1, 0x1B); const __m128i t2 = _mm_shuffle_epi32(s1, 0x1B);
@ -55,7 +57,7 @@ void inline __attribute__((always_inline)) Shuffle(__m128i& s0, __m128i& s1)
s1 = _mm_blend_epi16(t2, t1, 0xF0); s1 = _mm_blend_epi16(t2, t1, 0xF0);
} }
void inline __attribute__((always_inline)) Unshuffle(__m128i& s0, __m128i& s1) void ALWAYS_INLINE Unshuffle(__m128i& s0, __m128i& s1)
{ {
const __m128i t1 = _mm_shuffle_epi32(s0, 0x1B); const __m128i t1 = _mm_shuffle_epi32(s0, 0x1B);
const __m128i t2 = _mm_shuffle_epi32(s1, 0xB1); const __m128i t2 = _mm_shuffle_epi32(s1, 0xB1);
@ -63,12 +65,12 @@ void inline __attribute__((always_inline)) Unshuffle(__m128i& s0, __m128i& s1)
s1 = _mm_alignr_epi8(t2, t1, 0x08); s1 = _mm_alignr_epi8(t2, t1, 0x08);
} }
__m128i inline __attribute__((always_inline)) Load(const unsigned char* in) __m128i ALWAYS_INLINE Load(const unsigned char* in)
{ {
return _mm_shuffle_epi8(_mm_loadu_si128((const __m128i*)in), _mm_load_si128((const __m128i*)MASK)); return _mm_shuffle_epi8(_mm_loadu_si128((const __m128i*)in), _mm_load_si128((const __m128i*)MASK));
} }
void inline __attribute__((always_inline)) Save(unsigned char* out, __m128i s) void ALWAYS_INLINE Save(unsigned char* out, __m128i s)
{ {
_mm_storeu_si128((__m128i*)out, _mm_shuffle_epi8(s, _mm_load_si128((const __m128i*)MASK))); _mm_storeu_si128((__m128i*)out, _mm_shuffle_epi8(s, _mm_load_si128((const __m128i*)MASK)));
} }

View File

@ -294,7 +294,8 @@ struct Peer {
/** List of non-tx/non-block inventory items */ /** List of non-tx/non-block inventory items */
std::vector<CInv> vInventoryOtherToSend GUARDED_BY(m_tx_inventory_mutex); std::vector<CInv> vInventoryOtherToSend GUARDED_BY(m_tx_inventory_mutex);
/** Whether the peer has requested us to send our complete mempool. Only /** Whether the peer has requested us to send our complete mempool. Only
* permitted if the peer has NetPermissionFlags::Mempool. See BIP35. */ * permitted if the peer has NetPermissionFlags::Mempool or we advertise
* NODE_BLOOM. See BIP35. */
bool m_send_mempool GUARDED_BY(m_tx_inventory_mutex){false}; bool m_send_mempool GUARDED_BY(m_tx_inventory_mutex){false};
/** The last time a BIP35 `mempool` request was serviced. */ /** The last time a BIP35 `mempool` request was serviced. */
std::atomic<std::chrono::seconds> m_last_mempool_req{0s}; std::atomic<std::chrono::seconds> m_last_mempool_req{0s};
@ -2774,8 +2775,6 @@ void PeerManagerImpl::SendBlockTransactions(CNode& pfrom, const CBlock& block, c
void PeerManagerImpl::HandleFewUnconnectingHeaders(CNode& pfrom, Peer& peer, void PeerManagerImpl::HandleFewUnconnectingHeaders(CNode& pfrom, Peer& peer,
const std::vector<CBlockHeader>& headers) const std::vector<CBlockHeader>& headers)
{ {
const CNetMsgMaker msgMaker(pfrom.GetCommonVersion());
LOCK(cs_main); LOCK(cs_main);
CNodeState *nodestate = State(pfrom.GetId()); CNodeState *nodestate = State(pfrom.GetId());
@ -4729,6 +4728,8 @@ void PeerManagerImpl::ProcessMessage(
} }
if (msg_type == NetMsgType::MEMPOOL) { if (msg_type == NetMsgType::MEMPOOL) {
// Only process received mempool messages if we advertise NODE_BLOOM
// or if the peer has mempool permissions.
if (!(peer->m_our_services & NODE_BLOOM) && !pfrom.HasPermission(NetPermissionFlags::Mempool)) if (!(peer->m_our_services & NODE_BLOOM) && !pfrom.HasPermission(NetPermissionFlags::Mempool))
{ {
if (!pfrom.HasPermission(NetPermissionFlags::NoBan)) if (!pfrom.HasPermission(NetPermissionFlags::NoBan))
@ -5166,7 +5167,6 @@ void PeerManagerImpl::ConsiderEviction(CNode& pto, Peer& peer, std::chrono::seco
AssertLockHeld(cs_main); AssertLockHeld(cs_main);
CNodeState &state = *State(pto.GetId()); CNodeState &state = *State(pto.GetId());
const CNetMsgMaker msgMaker(pto.GetCommonVersion());
if (!state.m_chain_sync.m_protect && pto.IsOutboundOrBlockRelayConn() && state.fSyncStarted) { if (!state.m_chain_sync.m_protect && pto.IsOutboundOrBlockRelayConn() && state.fSyncStarted) {
// This is an outbound peer subject to disconnection if they don't // This is an outbound peer subject to disconnection if they don't

View File

@ -258,10 +258,7 @@ BOOST_AUTO_TEST_CASE(addrman_select_special)
// use a non-deterministic addrman to ensure a passing test isn't due to setup // use a non-deterministic addrman to ensure a passing test isn't due to setup
auto addrman = std::make_unique<AddrMan>(EMPTY_NETGROUPMAN, /*deterministic=*/false, GetCheckRatio(m_node)); auto addrman = std::make_unique<AddrMan>(EMPTY_NETGROUPMAN, /*deterministic=*/false, GetCheckRatio(m_node));
// add ipv4 address to the new table
CNetAddr source = ResolveIP("252.2.2.2"); CNetAddr source = ResolveIP("252.2.2.2");
CService addr1 = ResolveService("250.1.1.3", 8333);
BOOST_CHECK(addrman->Add({CAddress(addr1, NODE_NONE)}, source));
// add I2P address to the tried table // add I2P address to the tried table
CAddress i2p_addr; CAddress i2p_addr;
@ -269,6 +266,10 @@ BOOST_AUTO_TEST_CASE(addrman_select_special)
BOOST_CHECK(addrman->Add({i2p_addr}, source)); BOOST_CHECK(addrman->Add({i2p_addr}, source));
BOOST_CHECK(addrman->Good(i2p_addr)); BOOST_CHECK(addrman->Good(i2p_addr));
// add ipv4 address to the new table
CService addr1 = ResolveService("250.1.1.3", 8333);
BOOST_CHECK(addrman->Add({CAddress(addr1, NODE_NONE)}, source));
// since the only ipv4 address is on the new table, ensure that the new // since the only ipv4 address is on the new table, ensure that the new
// table gets selected even if new_only is false. if the table was being // table gets selected even if new_only is false. if the table was being
// selected at random, this test will sporadically fail // selected at random, this test will sporadically fail

View File

@ -62,17 +62,25 @@ class AnchorsTest(BitcoinTestFramework):
self.log.info("Check the addresses in anchors.dat") self.log.info("Check the addresses in anchors.dat")
with open(node_anchors_path, "rb") as file_handler: with open(node_anchors_path, "rb") as file_handler:
anchors = file_handler.read().hex() anchors = file_handler.read()
anchors_hex = anchors.hex()
for port in block_relay_nodes_port: for port in block_relay_nodes_port:
ip_port = ip + port ip_port = ip + port
assert ip_port in anchors assert ip_port in anchors_hex
for port in inbound_nodes_port: for port in inbound_nodes_port:
ip_port = ip + port ip_port = ip + port
assert ip_port not in anchors assert ip_port not in anchors_hex
self.log.info("Start node") self.log.info("Perturb anchors.dat to test it doesn't throw an error during initialization")
self.start_node(0) with self.nodes[0].assert_debug_log(["0 block-relay-only anchors will be tried for connections."]):
with open(node_anchors_path, "wb") as out_file_handler:
tweaked_contents = bytearray(anchors)
tweaked_contents[20:20] = b'1'
out_file_handler.write(bytes(tweaked_contents))
self.log.info("Start node")
self.start_node(0)
self.log.info("When node starts, check if anchors.dat doesn't exist anymore") self.log.info("When node starts, check if anchors.dat doesn't exist anymore")
assert not os.path.exists(node_anchors_path) assert not os.path.exists(node_anchors_path)

View File

@ -42,6 +42,13 @@ class InitStressTest(BitcoinTestFramework):
node.process.terminate() node.process.terminate()
node.process.wait() node.process.wait()
def start_expecting_error(err_fragment):
node.assert_start_raises_init_error(
extra_args=['-txindex=1', '-blockfilterindex=1', '-coinstatsindex=1'],
expected_msg=err_fragment,
match=ErrorMatch.PARTIAL_REGEX,
)
def check_clean_start(): def check_clean_start():
"""Ensure that node restarts successfully after various interrupts.""" """Ensure that node restarts successfully after various interrupts."""
node.start() node.start()
@ -85,36 +92,27 @@ class InitStressTest(BitcoinTestFramework):
self.log.info("Test startup errors after removing certain essential files") self.log.info("Test startup errors after removing certain essential files")
files_to_disturb = { files_to_delete = {
'blocks/index/*.ldb': 'Error opening block database.', 'blocks/index/*.ldb': 'Error opening block database.',
'chainstate/*.ldb': 'Error opening block database.', 'chainstate/*.ldb': 'Error opening block database.',
'blocks/blk*.dat': 'Error loading block database.', 'blocks/blk*.dat': 'Error loading block database.',
} }
for file_patt, err_fragment in files_to_disturb.items(): files_to_perturb = {
'blocks/index/*.ldb': 'Error opening block database.',
'chainstate/*.ldb': 'Error opening block database.',
'blocks/blk*.dat': 'Error opening block database.',
}
for file_patt, err_fragment in files_to_delete.items():
target_files = list(node.chain_path.glob(file_patt)) target_files = list(node.chain_path.glob(file_patt))
for target_file in target_files: for target_file in target_files:
self.log.info(f"Tweaking file to ensure failure {target_file}") self.log.info(f"Deleting file to ensure failure {target_file}")
bak_path = str(target_file) + ".bak" bak_path = str(target_file) + ".bak"
target_file.rename(bak_path) target_file.rename(bak_path)
# TODO: at some point, we should test perturbing the files instead of removing start_expecting_error(err_fragment)
# them, e.g.
#
# contents = target_file.read_bytes()
# tweaked_contents = bytearray(contents)
# tweaked_contents[50:250] = b'1' * 200
# target_file.write_bytes(bytes(tweaked_contents))
#
# At the moment I can't get this to work (bitcoind loads successfully?) so
# investigate doing this later.
node.assert_start_raises_init_error(
extra_args=['-txindex=1', '-blockfilterindex=1', '-coinstatsindex=1'],
expected_msg=err_fragment,
match=ErrorMatch.PARTIAL_REGEX,
)
for target_file in target_files: for target_file in target_files:
bak_path = str(target_file) + ".bak" bak_path = str(target_file) + ".bak"
@ -124,6 +122,18 @@ class InitStressTest(BitcoinTestFramework):
check_clean_start() check_clean_start()
self.stop_node(0) self.stop_node(0)
for file_patt, err_fragment in files_to_perturb.items():
target_files = list(node.chain_path.glob(file_patt))
for target_file in target_files:
self.log.info(f"Perturbing file to ensure failure {target_file}")
with open(target_file, "rb") as tf_read, open(target_file, "wb") as tf_write:
contents = tf_read.read()
tweaked_contents = bytearray(contents)
tweaked_contents[50:250] = b'1' * 200
tf_write.write(bytes(tweaked_contents))
start_expecting_error(err_fragment)
if __name__ == '__main__': if __name__ == '__main__':
InitStressTest().main() InitStressTest().main()

View File

@ -158,6 +158,10 @@ class PruneTest(BitcoinTestFramework):
extra_args=['-prune=550', '-disablegovernance=false'], extra_args=['-prune=550', '-disablegovernance=false'],
) )
def test_rescan_blockchain(self):
self.restart_node(0, ["-prune=550"])
assert_raises_rpc_error(-1, "Can't rescan beyond pruned data. Use RPC call getblockchaininfo to determine your pruned height.", self.nodes[0].rescanblockchain)
def test_height_min(self): def test_height_min(self):
assert os.path.isfile(os.path.join(self.prunedir, "blk00000.dat")), "blk00000.dat is missing, pruning too early" assert os.path.isfile(os.path.join(self.prunedir, "blk00000.dat")), "blk00000.dat is missing, pruning too early"
self.log.info("Success") self.log.info("Success")
@ -494,6 +498,9 @@ class PruneTest(BitcoinTestFramework):
self.log.info("Test wallet re-scan") self.log.info("Test wallet re-scan")
self.wallet_test() self.wallet_test()
self.log.info("Test it's not possible to rescan beyond pruned data")
self.test_rescan_blockchain()
self.log.info("Test invalid pruning command line options") self.log.info("Test invalid pruning command line options")
self.test_invalid_command_line_options() self.test_invalid_command_line_options()

View File

@ -120,6 +120,9 @@ class ScantxoutsetTest(BitcoinTestFramework):
assert_equal(self.nodes[0].scantxoutset("status"), None) assert_equal(self.nodes[0].scantxoutset("status"), None)
assert_equal(self.nodes[0].scantxoutset("abort"), False) assert_equal(self.nodes[0].scantxoutset("abort"), False)
# check that first arg is needed
assert_raises_rpc_error(-1, "scantxoutset \"action\" ( [scanobjects,...] )", self.nodes[0].scantxoutset)
# Check that second arg is needed for start # Check that second arg is needed for start
assert_raises_rpc_error(-1, "scanobjects argument is required for the start action", self.nodes[0].scantxoutset, "start") assert_raises_rpc_error(-1, "scanobjects argument is required for the start action", self.nodes[0].scantxoutset, "start")

View File

@ -7,7 +7,8 @@
from contextlib import ExitStack from contextlib import ExitStack
from test_framework.test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import ( from test_framework.util import (
p2p_port p2p_port,
assert_equal,
) )
class SetBanTests(BitcoinTestFramework): class SetBanTests(BitcoinTestFramework):
@ -77,6 +78,11 @@ class SetBanTests(BitcoinTestFramework):
assert not self.is_banned(node, tor_addr) assert not self.is_banned(node, tor_addr)
assert not self.is_banned(node, ip_addr) assert not self.is_banned(node, ip_addr)
self.log.info("Test -bantime")
self.restart_node(1, ["-bantime=1234"])
self.nodes[1].setban("127.0.0.1", "add")
banned = self.nodes[1].listbanned()[0]
assert_equal(banned['ban_duration'], 1234)
if __name__ == '__main__': if __name__ == '__main__':
SetBanTests().main() SetBanTests().main()

View File

@ -93,6 +93,7 @@ def ser_compact_size(l):
r = struct.pack("<BQ", 255, l) r = struct.pack("<BQ", 255, l)
return r return r
def deser_compact_size(f): def deser_compact_size(f):
nit = struct.unpack("<B", f.read(1))[0] nit = struct.unpack("<B", f.read(1))[0]
if nit == 253: if nit == 253:
@ -103,35 +104,26 @@ def deser_compact_size(f):
nit = struct.unpack("<Q", f.read(8))[0] nit = struct.unpack("<Q", f.read(8))[0]
return nit return nit
def deser_string(f): def deser_string(f):
nit = deser_compact_size(f) nit = deser_compact_size(f)
return f.read(nit) return f.read(nit)
def ser_string(s): def ser_string(s):
return ser_compact_size(len(s)) + s return ser_compact_size(len(s)) + s
def deser_uint256(f): def deser_uint256(f):
r = 0 return int.from_bytes(f.read(32), 'little')
for i in range(8):
t = struct.unpack("<I", f.read(4))[0]
r += t << (i * 32)
return r
def ser_uint256(u): def ser_uint256(u):
rs = b"" return u.to_bytes(32, 'little')
for _ in range(8):
rs += struct.pack("<I", u & 0xFFFFFFFF)
u >>= 32
return rs
def uint256_from_str(s): def uint256_from_str(s):
r = 0 return int.from_bytes(s[:32], 'little')
t = struct.unpack("<IIIIIIII", s[:32])
for i in range(8):
r += t[i] << (i * 32)
return r
def uint256_to_string(uint256): def uint256_to_string(uint256):

View File

@ -1,5 +1,2 @@
# Suppress warnings triggered in dependencies # Suppress warnings triggered in dependencies
leak:libQt5Widgets leak:libQt5Widgets
# false-positive due to use of secure_allocator<>
leak:GetRNGState