This series of patches is introducing a layer that brings a few of user space libraries to the Morello platform under Linux and provides a framework to aid adding more libraries in the future. The purecap libraries live in their own sysroot and exist in parallel with non purecap libraries.
Currently the layer consists of: - postgreslq - zabbix - dependencies required to run the above
See README.md for more details.
Working implementation can be found here [1]
[1] https://github.com/The-Good-Penguin/meta-morello-distro
Pawel Zalewski (27): README: initial commit license: add MIT license kas: initial commit conf: inital commit classes: initial commit openssl-morello: initial commit zabbix-morello: initial commit nginx: appends for zabbix base-passwd-morello: initial commit ncurses-morello: initial commit readline-morello: initial commit util-linux-morello: initial commit zlib-morello: inital commit postgresql-morello: initial commit tcltk-morello: initial commit php: downgrade to 7.4.33 bzip2-morello: initial commit libidn2-morello: initial commit linux: initial commit curl-morello: initial commit libevent-morello: initial commit libpcre-morello: initial commit libunistring-morello: initial commit openldap-morello: initial commit snmp-morello: initial commit image: initial commit ci: initial commit
.github/workflows/workflow.yml | 88 + COPYING.MIT | 17 + README.md | 98 + classes/perl-hacks.bbclass | 53 + classes/purecap-sysroot.bbclass | 59 + classes/purecap-useradd.bbclass | 1 + conf/distro/morello.conf | 18 + conf/layer.conf | 23 + kas/base.yml | 38 + kas/debug-fvp.yml | 20 + kas/debug-soc.yml | 10 + kas/morello-linux-debug.yml | 24 + .../cheri-patches/0001-purecap-patches.patch | 183 ++ ...1-Configure-do-not-tweak-mips-cflags.patch | 36 + ...sysroot-and-debug-prefix-map-from-co.patch | 78 + .../openssl/files/afalg.patch | 31 + recipes-connectivity/openssl/files/run-ptest | 12 + .../openssl/openssl-morello_3.0.8.bb | 164 ++ .../0000-net-fix-provenance-error.patch | 35 + ...000-sysinfo-fix-build-with-musl-libc.patch | 32 + ...emalloc-align-and-work-with-16-not-8.patch | 168 ++ ...002-duktape-set-shift-to-5-for-CHERI.patch | 55 + .../0003-duktape-add-aling-to-16.patch | 121 + ...ed-use-padding-of-16-not-8-for-alloc.patch | 85 + .../0005-embed-fix-alignment-issues.patch | 93 + ...6-duk_config-use-debug-and-self-test.patch | 46 + .../0007-duktape-fix-stack-reallocation.patch | 64 + recipes-connectivity/zabbix/files/COPYING | 341 +++ .../files/zabbix-agentd-morello.service | 15 + .../zabbix/files/zabbix-agentd.conf | 536 +++++ .../zabbix/files/zabbix-proxy.conf | 1461 ++++++++++++ .../zabbix/files/zabbix-proxy.service | 15 + .../files/zabbix-server-morello.service | 20 + .../zabbix/files/zabbix-server.conf | 990 +++++++++ .../zabbix/files/zabbix.conf.php | 59 + .../zabbix/zabbix-agentd-morello_5.0.38.bb | 52 + .../zabbix/zabbix-frontend_5.0.38.bb | 24 + .../zabbix/zabbix-morello.inc | 103 + .../zabbix/zabbix-proxy-morello_5.0.38.bb | 65 + .../zabbix/zabbix-server-morello_5.0.38.bb | 71 + .../base-passwd/base-passwd-morello_3.5.29.bb | 128 ++ .../base-passwd/files/add_shutdown.patch | 19 + .../base-passwd/files/disable-docs.patch | 24 + .../base-passwd/files/disable-shell.patch | 57 + recipes-core/base-passwd/files/input.patch | 22 + recipes-core/base-passwd/files/kvm.patch | 23 + recipes-core/base-passwd/files/nobash.patch | 15 + recipes-core/base-passwd/files/noshadow.patch | 14 + recipes-core/images/morello-image.bb | 73 + ...st-ncurses-silence-capability-misuse.patch | 37 + recipes-core/ncurses/ncurses-morello.inc | 87 + recipes-core/ncurses/ncurses-morello_6.4.bb | 16 + recipes-core/ncurses/site_config/headers | 5 + recipes-core/readline/files/inputrc | 61 + recipes-core/readline/files/rl-native.map | 12 + recipes-core/readline/readline-morello.inc | 68 + .../readline/readline-morello_8.1.2.bb | 7 + .../readline/readline/configure-fix.patch | 35 + recipes-core/readline/readline/norpath.patch | 21 + .../util-linux/util-linux-morello_2.37.4.bb | 23 + recipes-core/zlib/files/run-ptest | 7 + recipes-core/zlib/zlib-morello_1.2.13.bb | 43 + ...gument-order-to-qsort_r-to-match-pos.patch | 45 + ...change-defines-from-freebsd-to-cheri.patch | 57 + ...n-bypass-autoconf-2.69-version-check.patch | 30 + recipes-dbs/postgresql/postgresql-morello.inc | 400 ++++ .../postgresql/postgresql-morello_9.6.bb | 155 ++ recipes-dbs/postgresql/postgresql/pg_config | 15 + .../postgresql/postgresql/postgres-bench | 16 + .../postgresql/postgresql/postgres-test | 49 + .../postgresql/postgresql/postgresql-init | 64 + .../postgresql/postgresql-init.service | 19 + .../postgresql/postgresql-morello.init | 193 ++ .../postgresql/postgresql-morello.service | 29 + .../postgresql/postgresql/postgresql-profile | 4 + .../postgresql/postgresql/postgresql-setup | 73 + .../postgresql/postgresql/postgresql.pam | 4 + .../postgresql/postgresql/test-schedule | 1 + recipes-dbs/postgresql/postgresql_%.bbappend | 7 + recipes-devtools/php/files/pg_config | 15 + recipes-devtools/php/files/php.ini | 1950 +++++++++++++++++ recipes-devtools/php/files/zabbix-fpm.conf | 24 + ...re.ac-don-t-include-build-libtool.m4.patch | 30 + ...001-opcache-config.m4-enable-opcache.patch | 237 ++ ...p-don-t-use-broken-wrapper-for-mkdir.patch | 29 + ...1-php.m4-don-t-unset-cache-variables.patch | 39 + recipes-devtools/php/php/70_mod_php7.conf | 9 + .../php/php/CVE-2023-3247-1.patch | 87 + .../php/php/CVE-2023-3247-2.patch | 29 + recipes-devtools/php/php/CVE-2023-3824.patch | 91 + .../php/php/debian-php-fixheader.patch | 32 + recipes-devtools/php/php/iconv.patch | 41 + .../php/php/imap-fix-autofoo.patch | 41 + recipes-devtools/php/php/pear-makefile.patch | 22 + recipes-devtools/php/php/phar-makefile.patch | 46 + recipes-devtools/php/php/php-fpm-apache.conf | 6 + recipes-devtools/php/php/php-fpm.conf | 510 +++++ recipes-devtools/php/php/php-fpm.service | 10 + .../php/php/php_exec_native.patch | 26 + .../php/php/xfail_two_bug_tests.patch | 34 + recipes-devtools/php/php_%.bbappend | 74 + recipes-devtools/php/php_7.4.33.bb | 276 +++ ...0001-tclCompCmdsSZ-cast-to-uintptr_t.patch | 28 + recipes-devtools/tcltk/tcl-morello_8.6.11.bb | 104 + .../tcltk/tcl/alter-includedir.patch | 56 + .../tcl/fix_issue_with_old_distro_glibc.patch | 39 + .../tcl/fix_non_native_build_issue.patch | 64 + recipes-devtools/tcltk/tcl/interp.patch | 32 + recipes-devtools/tcltk/tcl/run-ptest | 17 + .../tcltk/tcl/tcl-add-soname.patch | 32 + .../tcl-remove-hardcoded-install-path.patch | 32 + recipes-extended/bzip2/bzip2-morello_1.0.8.bb | 72 + recipes-extended/bzip2/files/Makefile.am | 74 + recipes-extended/bzip2/files/configure.ac | 11 + recipes-extended/bzip2/files/run-ptest | 2 + .../libidn2/libidn2-morello_2.3.2.bb | 50 + recipes-httpd/nginx/files/fastcgi-php.conf | 13 + recipes-httpd/nginx/files/http_status.conf | 7 + recipes-httpd/nginx/files/zabbix-web.conf | 79 + recipes-httpd/nginx/nginx_%.bbappend | 29 + ...ow-for-storing-caps-in-shared-memory.patch | 30 + .../linux/files/0003-defconfig-modify.patch | 38 + recipes-kernel/linux/linux-morello_%.bbappend | 6 + .../0001-tools-fix-cheri-provenance.patch | 32 + ..._endpoint_linux-fix-cheri-provenance.patch | 28 + recipes-protocols/net-snmp/files/init | 67 + recipes-protocols/net-snmp/files/snmpd.conf | 422 ++++ .../net-snmp/files/snmptrapd.conf | 18 + ...ath.m4-keep-consistent-between-32bit.patch | 38 + .../0001-config_os_headers-Error-Fix.patch | 35 + ...1-get_pid_from_inode-Include-limit.h.patch | 27 + ....c-Don-t-check-for-return-from-EVP_M.patch | 34 + ...004-configure-fix-incorrect-variable.patch | 28 + .../CVE-2022-44792-CVE-2022-44793.patch | 116 + .../net-snmp-morello/fix-libtool-finish.patch | 34 + ....7.2-fix-engineBoots-value-on-SIGHUP.patch | 44 + ...add-knob-whether-nlist.h-are-checked.patch | 36 + .../net-snmp-fix-for-disable-des.patch | 30 + ...ting-add-the-output-format-for-ptest.patch | 35 + .../reproducibility-have-printcap.patch | 30 + .../net-snmp/net-snmp-morello/run-ptest | 5 + .../net-snmp/net-snmp-morello/snmpd.service | 14 + .../net-snmp-morello/snmptrapd.service | 14 + .../net-snmp/net-snmp-morello_5.9.3.bb | 322 +++ recipes-support/curl/curl-morello_7.82.0.bb | 116 + ...0001-openssl-fix-CN-check-error-code.patch | 38 + .../curl/files/CVE-2022-22576.patch | 145 ++ .../curl/files/CVE-2022-27774-1.patch | 45 + .../curl/files/CVE-2022-27774-2.patch | 80 + .../curl/files/CVE-2022-27774-3.patch | 83 + .../curl/files/CVE-2022-27774-4.patch | 35 + .../curl/files/CVE-2022-27775.patch | 37 + .../curl/files/CVE-2022-27776.patch | 115 + .../curl/files/CVE-2022-27779.patch | 42 + .../curl/files/CVE-2022-27780.patch | 33 + .../curl/files/CVE-2022-27781.patch | 43 + .../curl/files/CVE-2022-27782-1.patch | 458 ++++ .../curl/files/CVE-2022-27782-2.patch | 71 + .../curl/files/CVE-2022-30115.patch | 82 + .../curl/files/CVE-2022-32205.patch | 174 ++ .../curl/files/CVE-2022-32206.patch | 51 + .../curl/files/CVE-2022-32207.patch | 283 +++ .../curl/files/CVE-2022-32208.patch | 67 + .../curl/files/CVE-2022-32221.patch | 28 + .../curl/files/CVE-2022-35252.patch | 72 + .../curl/files/CVE-2022-42915.patch | 53 + .../curl/files/CVE-2022-42916.patch | 136 ++ .../curl/files/CVE-2022-43551.patch | 35 + .../curl/files/CVE-2022-43552.patch | 80 + .../curl/files/CVE-2023-23914_5-1.patch | 280 +++ .../curl/files/CVE-2023-23914_5-2.patch | 23 + .../curl/files/CVE-2023-23914_5-3.patch | 45 + .../curl/files/CVE-2023-23914_5-4.patch | 48 + .../curl/files/CVE-2023-23914_5-5.patch | 118 + ....c-patch-out-tests-that-require-a-wo.patch | 37 + ...ncrease-default-timeval-tolerance-50.patch | 33 + ...-monotonic_prc_fallback-as-retriable.patch | 28 + ...ts-are-marked-failed-only-when-all-a.patch | 81 + .../files/Makefile-missing-test-dir.patch | 27 + recipes-support/libevent/files/run-ptest | 29 + .../libevent/libevent-morello_2.1.12.bb | 64 + ...01-pcre_jit_compile-cheri-provenance.patch | 89 + ...2-sljitNativeARM_64-cheri-provenance.patch | 61 + .../0003-sljitUtils-cheri-provenance.patch | 39 + recipes-support/libpcre/files/Makefile | 183 ++ recipes-support/libpcre/files/run-ptest | 3 + .../libpcre/libpcre-morello_8.45.bb | 91 + .../libunistring/libunistring-morello_1.0.bb | 36 + .../0001-config-fix-provenance-errors.patch | 807 +++++++ .../0002-tpool-remove-errors.patch | 37 + .../0003-config-Remove-format-error.patch | 42 + .../0004-main-Remove-format-error.patch | 28 + ...0005-connection-fix-provenance-error.patch | 67 + .../0006-sets-fix-provenance-error.patch | 36 + ...07-slapd-search-fix-cheri-provenance.patch | 152 ++ .../0001-build-top.mk-unset-STRIP_OPTS.patch | 38 + ...if-filter-fix-parallel-build-failure.patch | 32 + ...-Makefile.in-ignore-the-mkdir-errors.patch | 33 + ...de-ldap_pvt_thread.h-before-redefini.patch | 54 + .../openldap/openldap-morello/initscript | 35 + .../remove-user-host-pwd-from-version.patch | 39 + .../openldap/openldap-morello/slapd.service | 10 + .../openldap-morello/use-urandom.patch | 35 + .../openldap/openldap-morello_2.5.12.bb | 255 +++ 204 files changed, 18661 insertions(+) create mode 100644 .github/workflows/workflow.yml create mode 100644 COPYING.MIT create mode 100644 README.md create mode 100644 classes/perl-hacks.bbclass create mode 100644 classes/purecap-sysroot.bbclass create mode 100644 classes/purecap-useradd.bbclass create mode 100644 conf/distro/morello.conf create mode 100644 conf/layer.conf create mode 100644 kas/base.yml create mode 100644 kas/debug-fvp.yml create mode 100644 kas/debug-soc.yml create mode 100644 kas/morello-linux-debug.yml create mode 100644 recipes-connectivity/openssl/cheri-patches/0001-purecap-patches.patch create mode 100644 recipes-connectivity/openssl/files/0001-Configure-do-not-tweak-mips-cflags.patch create mode 100644 recipes-connectivity/openssl/files/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch create mode 100644 recipes-connectivity/openssl/files/afalg.patch create mode 100644 recipes-connectivity/openssl/files/run-ptest create mode 100644 recipes-connectivity/openssl/openssl-morello_3.0.8.bb create mode 100644 recipes-connectivity/zabbix/cheri-patches/0000-net-fix-provenance-error.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0000-sysinfo-fix-build-with-musl-libc.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0001-memalloc-align-and-work-with-16-not-8.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0002-duktape-set-shift-to-5-for-CHERI.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0003-duktape-add-aling-to-16.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0004-embed-use-padding-of-16-not-8-for-alloc.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0005-embed-fix-alignment-issues.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0006-duk_config-use-debug-and-self-test.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0007-duktape-fix-stack-reallocation.patch create mode 100644 recipes-connectivity/zabbix/files/COPYING create mode 100644 recipes-connectivity/zabbix/files/zabbix-agentd-morello.service create mode 100644 recipes-connectivity/zabbix/files/zabbix-agentd.conf create mode 100644 recipes-connectivity/zabbix/files/zabbix-proxy.conf create mode 100644 recipes-connectivity/zabbix/files/zabbix-proxy.service create mode 100644 recipes-connectivity/zabbix/files/zabbix-server-morello.service create mode 100644 recipes-connectivity/zabbix/files/zabbix-server.conf create mode 100644 recipes-connectivity/zabbix/files/zabbix.conf.php create mode 100644 recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb create mode 100644 recipes-connectivity/zabbix/zabbix-frontend_5.0.38.bb create mode 100644 recipes-connectivity/zabbix/zabbix-morello.inc create mode 100644 recipes-connectivity/zabbix/zabbix-proxy-morello_5.0.38.bb create mode 100644 recipes-connectivity/zabbix/zabbix-server-morello_5.0.38.bb create mode 100644 recipes-core/base-passwd/base-passwd-morello_3.5.29.bb create mode 100644 recipes-core/base-passwd/files/add_shutdown.patch create mode 100644 recipes-core/base-passwd/files/disable-docs.patch create mode 100644 recipes-core/base-passwd/files/disable-shell.patch create mode 100644 recipes-core/base-passwd/files/input.patch create mode 100644 recipes-core/base-passwd/files/kvm.patch create mode 100644 recipes-core/base-passwd/files/nobash.patch create mode 100644 recipes-core/base-passwd/files/noshadow.patch create mode 100644 recipes-core/images/morello-image.bb create mode 100644 recipes-core/ncurses/cheri-patches/0001-test-ncurses-silence-capability-misuse.patch create mode 100644 recipes-core/ncurses/ncurses-morello.inc create mode 100644 recipes-core/ncurses/ncurses-morello_6.4.bb create mode 100644 recipes-core/ncurses/site_config/headers create mode 100644 recipes-core/readline/files/inputrc create mode 100644 recipes-core/readline/files/rl-native.map create mode 100644 recipes-core/readline/readline-morello.inc create mode 100644 recipes-core/readline/readline-morello_8.1.2.bb create mode 100644 recipes-core/readline/readline/configure-fix.patch create mode 100644 recipes-core/readline/readline/norpath.patch create mode 100644 recipes-core/util-linux/util-linux-morello_2.37.4.bb create mode 100644 recipes-core/zlib/files/run-ptest create mode 100644 recipes-core/zlib/zlib-morello_1.2.13.bb create mode 100644 recipes-dbs/postgresql/cheri-patches/0001-port.h-change-argument-order-to-qsort_r-to-match-pos.patch create mode 100644 recipes-dbs/postgresql/cheri-patches/0002-qsort-change-defines-from-freebsd-to-cheri.patch create mode 100644 recipes-dbs/postgresql/files/0003-configure.in-bypass-autoconf-2.69-version-check.patch create mode 100644 recipes-dbs/postgresql/postgresql-morello.inc create mode 100644 recipes-dbs/postgresql/postgresql-morello_9.6.bb create mode 100755 recipes-dbs/postgresql/postgresql/pg_config create mode 100644 recipes-dbs/postgresql/postgresql/postgres-bench create mode 100644 recipes-dbs/postgresql/postgresql/postgres-test create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-init create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-init.service create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-morello.init create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-morello.service create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-profile create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-setup create mode 100644 recipes-dbs/postgresql/postgresql/postgresql.pam create mode 100644 recipes-dbs/postgresql/postgresql/test-schedule create mode 100644 recipes-dbs/postgresql/postgresql_%.bbappend create mode 100755 recipes-devtools/php/files/pg_config create mode 100644 recipes-devtools/php/files/php.ini create mode 100644 recipes-devtools/php/files/zabbix-fpm.conf create mode 100644 recipes-devtools/php/php/0001-configure.ac-don-t-include-build-libtool.m4.patch create mode 100644 recipes-devtools/php/php/0001-opcache-config.m4-enable-opcache.patch create mode 100644 recipes-devtools/php/php/0001-php-don-t-use-broken-wrapper-for-mkdir.patch create mode 100644 recipes-devtools/php/php/0001-php.m4-don-t-unset-cache-variables.patch create mode 100644 recipes-devtools/php/php/70_mod_php7.conf create mode 100644 recipes-devtools/php/php/CVE-2023-3247-1.patch create mode 100644 recipes-devtools/php/php/CVE-2023-3247-2.patch create mode 100644 recipes-devtools/php/php/CVE-2023-3824.patch create mode 100644 recipes-devtools/php/php/debian-php-fixheader.patch create mode 100644 recipes-devtools/php/php/iconv.patch create mode 100644 recipes-devtools/php/php/imap-fix-autofoo.patch create mode 100644 recipes-devtools/php/php/pear-makefile.patch create mode 100644 recipes-devtools/php/php/phar-makefile.patch create mode 100644 recipes-devtools/php/php/php-fpm-apache.conf create mode 100644 recipes-devtools/php/php/php-fpm.conf create mode 100644 recipes-devtools/php/php/php-fpm.service create mode 100644 recipes-devtools/php/php/php_exec_native.patch create mode 100644 recipes-devtools/php/php/xfail_two_bug_tests.patch create mode 100644 recipes-devtools/php/php_%.bbappend create mode 100644 recipes-devtools/php/php_7.4.33.bb create mode 100644 recipes-devtools/tcltk/cheri-patches/0001-tclCompCmdsSZ-cast-to-uintptr_t.patch create mode 100644 recipes-devtools/tcltk/tcl-morello_8.6.11.bb create mode 100644 recipes-devtools/tcltk/tcl/alter-includedir.patch create mode 100644 recipes-devtools/tcltk/tcl/fix_issue_with_old_distro_glibc.patch create mode 100644 recipes-devtools/tcltk/tcl/fix_non_native_build_issue.patch create mode 100644 recipes-devtools/tcltk/tcl/interp.patch create mode 100644 recipes-devtools/tcltk/tcl/run-ptest create mode 100644 recipes-devtools/tcltk/tcl/tcl-add-soname.patch create mode 100644 recipes-devtools/tcltk/tcl/tcl-remove-hardcoded-install-path.patch create mode 100644 recipes-extended/bzip2/bzip2-morello_1.0.8.bb create mode 100644 recipes-extended/bzip2/files/Makefile.am create mode 100644 recipes-extended/bzip2/files/configure.ac create mode 100644 recipes-extended/bzip2/files/run-ptest create mode 100644 recipes-extended/libidn2/libidn2-morello_2.3.2.bb create mode 100644 recipes-httpd/nginx/files/fastcgi-php.conf create mode 100644 recipes-httpd/nginx/files/http_status.conf create mode 100644 recipes-httpd/nginx/files/zabbix-web.conf create mode 100644 recipes-httpd/nginx/nginx_%.bbappend create mode 100644 recipes-kernel/linux/cheri-patches/0001-mman-allow-for-storing-caps-in-shared-memory.patch create mode 100644 recipes-kernel/linux/files/0003-defconfig-modify.patch create mode 100644 recipes-kernel/linux/linux-morello_%.bbappend create mode 100644 recipes-protocols/net-snmp/cheri-patches/0001-tools-fix-cheri-provenance.patch create mode 100644 recipes-protocols/net-snmp/cheri-patches/0002-udp_endpoint_linux-fix-cheri-provenance.patch create mode 100755 recipes-protocols/net-snmp/files/init create mode 100644 recipes-protocols/net-snmp/files/snmpd.conf create mode 100644 recipes-protocols/net-snmp/files/snmptrapd.conf create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/0001-config_os_headers-Error-Fix.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/0001-get_pid_from_inode-Include-limit.h.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/0004-configure-fix-incorrect-variable.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/CVE-2022-44792-CVE-2022-44793.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/fix-libtool-finish.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/net-snmp-add-knob-whether-nlist.h-are-checked.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/net-snmp-fix-for-disable-des.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/net-snmp-testing-add-the-output-format-for-ptest.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/reproducibility-have-printcap.patch create mode 100755 recipes-protocols/net-snmp/net-snmp-morello/run-ptest create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/snmpd.service create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/snmptrapd.service create mode 100644 recipes-protocols/net-snmp/net-snmp-morello_5.9.3.bb create mode 100644 recipes-support/curl/curl-morello_7.82.0.bb create mode 100644 recipes-support/curl/files/0001-openssl-fix-CN-check-error-code.patch create mode 100644 recipes-support/curl/files/CVE-2022-22576.patch create mode 100644 recipes-support/curl/files/CVE-2022-27774-1.patch create mode 100644 recipes-support/curl/files/CVE-2022-27774-2.patch create mode 100644 recipes-support/curl/files/CVE-2022-27774-3.patch create mode 100644 recipes-support/curl/files/CVE-2022-27774-4.patch create mode 100644 recipes-support/curl/files/CVE-2022-27775.patch create mode 100644 recipes-support/curl/files/CVE-2022-27776.patch create mode 100644 recipes-support/curl/files/CVE-2022-27779.patch create mode 100644 recipes-support/curl/files/CVE-2022-27780.patch create mode 100644 recipes-support/curl/files/CVE-2022-27781.patch create mode 100644 recipes-support/curl/files/CVE-2022-27782-1.patch create mode 100644 recipes-support/curl/files/CVE-2022-27782-2.patch create mode 100644 recipes-support/curl/files/CVE-2022-30115.patch create mode 100644 recipes-support/curl/files/CVE-2022-32205.patch create mode 100644 recipes-support/curl/files/CVE-2022-32206.patch create mode 100644 recipes-support/curl/files/CVE-2022-32207.patch create mode 100644 recipes-support/curl/files/CVE-2022-32208.patch create mode 100644 recipes-support/curl/files/CVE-2022-32221.patch create mode 100644 recipes-support/curl/files/CVE-2022-35252.patch create mode 100644 recipes-support/curl/files/CVE-2022-42915.patch create mode 100644 recipes-support/curl/files/CVE-2022-42916.patch create mode 100644 recipes-support/curl/files/CVE-2022-43551.patch create mode 100644 recipes-support/curl/files/CVE-2022-43552.patch create mode 100644 recipes-support/curl/files/CVE-2023-23914_5-1.patch create mode 100644 recipes-support/curl/files/CVE-2023-23914_5-2.patch create mode 100644 recipes-support/curl/files/CVE-2023-23914_5-3.patch create mode 100644 recipes-support/curl/files/CVE-2023-23914_5-4.patch create mode 100644 recipes-support/curl/files/CVE-2023-23914_5-5.patch create mode 100644 recipes-support/libevent/files/0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch create mode 100644 recipes-support/libevent/files/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch create mode 100644 recipes-support/libevent/files/0003-test-mark-util-monotonic_prc_fallback-as-retriable.patch create mode 100644 recipes-support/libevent/files/0004-test-retriable-tests-are-marked-failed-only-when-all-a.patch create mode 100644 recipes-support/libevent/files/Makefile-missing-test-dir.patch create mode 100644 recipes-support/libevent/files/run-ptest create mode 100644 recipes-support/libevent/libevent-morello_2.1.12.bb create mode 100644 recipes-support/libpcre/cheri-patches/0001-pcre_jit_compile-cheri-provenance.patch create mode 100644 recipes-support/libpcre/cheri-patches/0002-sljitNativeARM_64-cheri-provenance.patch create mode 100644 recipes-support/libpcre/cheri-patches/0003-sljitUtils-cheri-provenance.patch create mode 100644 recipes-support/libpcre/files/Makefile create mode 100644 recipes-support/libpcre/files/run-ptest create mode 100644 recipes-support/libpcre/libpcre-morello_8.45.bb create mode 100644 recipes-support/libunistring/libunistring-morello_1.0.bb create mode 100644 recipes-support/openldap/cheri-patches/0001-config-fix-provenance-errors.patch create mode 100644 recipes-support/openldap/cheri-patches/0002-tpool-remove-errors.patch create mode 100644 recipes-support/openldap/cheri-patches/0003-config-Remove-format-error.patch create mode 100644 recipes-support/openldap/cheri-patches/0004-main-Remove-format-error.patch create mode 100644 recipes-support/openldap/cheri-patches/0005-connection-fix-provenance-error.patch create mode 100644 recipes-support/openldap/cheri-patches/0006-sets-fix-provenance-error.patch create mode 100644 recipes-support/openldap/cheri-patches/0007-slapd-search-fix-cheri-provenance.patch create mode 100644 recipes-support/openldap/openldap-morello/0001-build-top.mk-unset-STRIP_OPTS.patch create mode 100644 recipes-support/openldap/openldap-morello/0001-ldif-filter-fix-parallel-build-failure.patch create mode 100644 recipes-support/openldap/openldap-morello/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch create mode 100644 recipes-support/openldap/openldap-morello/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch create mode 100644 recipes-support/openldap/openldap-morello/initscript create mode 100644 recipes-support/openldap/openldap-morello/remove-user-host-pwd-from-version.patch create mode 100644 recipes-support/openldap/openldap-morello/slapd.service create mode 100644 recipes-support/openldap/openldap-morello/use-urandom.patch create mode 100644 recipes-support/openldap/openldap-morello_2.5.12.bb
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- README.md | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 README.md
diff --git a/README.md b/README.md new file mode 100644 index 0000000..65fdcb3 --- /dev/null +++ b/README.md @@ -0,0 +1,98 @@ +meta-morello-distro +=================== + +This layer provides user space libraries machine translated to `Morello` +and recompiled with `purecap` (c64) for the ARM Morello SDK. + +It allows to run purecap and non purecap versions of the libraries +to be tested in parallel. Purecap libraries have a dedicated sysroot. + +# Building images + +``` +$ kas build ./meta-morello-distro/kas/debug-soc.yml +``` + +# Limitations +The purecap libraries are tested to a limited degree. + + +Yocto-wise: +- package Q&A is disabled and runtime dependency checks +- ptest is disabled/ignored +- recipes and package config can be incomplete/broken + +# Structure +Most of the recipes here are copies of existing recipes in other layers +postfixed with `morello`, source of the original recipe is listed +in the `MORELLO_SRC` variable, the original recipe path is preserved, ${PV} +is not. The git hashes of layers that were used as base of these recipes are +stored in `MORELLO_LAYER_SRC_REF` variable in the `layer.conf` file. + +The reason for this is that the c64 versions of the libraries live in +parallel to the a64 on the system, which is a design choice, hence a +simple `*.bbappend` would not cut it. + +The purecap libraries are placed in the purecap sysroot, as defined by +`${PURECAP_SYSROOT_DIR}` in meta-morello [1], which is where the +runtime linker shall look for all dependencies. + +Most of the `CHERI` patches are placed in the...`cheri-patches` folder at the +root of the said recipe. + +Some sources are pulled from `CHERI-BSD` repo and then patched further to +work on Linux. In some cases patches are taken from CHERI-BSD and rebased +on top of different versions of the said libraries. There are cases where +we were patching a library oblivious to the fact that a CHERI port already +exists. Some contributions were not found elsewhere. + +If you see any errors or are the author of these patches/recipes and think +we have missed something (patch authors etc.) please reach out to us and +it shall be fixed ! + +# The current userland libraries consist of: +- postgresql 9.6 +- zabbix 5.0.38 server/agent/proxy (with embedded JS) +- curl/openssl/zlib/ncurses/readline/ et al. + +# Adding new recipes: +- in theory the dev process should be as simple as: + - find existing recipe for the library you want + - copy over its content into library-morello_X.Y.Z.bb + - add: + + ``` + inherit pure-cap-kheaders purecap-sysroot + ... + TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + ``` + - compile + - digest the logs + - create patches and put them in the cheri-patches folder + - repeat the last two steps until there are no errors + - add to the image + - watch it crash at runtime (FVP is reducing the length of the dev loop here) + - run through gdb + - create more cheri-patches + +- if the are no obvious runtime errors you are done + +We tend to stick inherit/requires at the top of the `*.bb` files for readability, +do the same where possible. + +Contributing +------------ + +We accept patches through the mailing list only, the patch should be named [meta-morello-distro] +https://op-lists.linaro.org/mailman3/lists/linux-morello-distros.op-lists.li... + + +References +---------- +[1] https://git.morello-project.org/morello/meta-morello + +maintainers +----------- +* Pawel Zalewski pzalewski@thegoodpenguin.co.uk +* Harrison Carter hcarter@thegoodpenguin.co.uk +
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- COPYING.MIT | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 COPYING.MIT
diff --git a/COPYING.MIT b/COPYING.MIT new file mode 100644 index 0000000..e14c371 --- /dev/null +++ b/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file
Co-authored-by: Harrison Carter hcarter@thegoodpenguin.co.uk Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- kas/base.yml | 38 +++++++++++++++++++++++++++++++++++++ kas/debug-fvp.yml | 20 +++++++++++++++++++ kas/debug-soc.yml | 10 ++++++++++ kas/morello-linux-debug.yml | 24 +++++++++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 kas/base.yml create mode 100644 kas/debug-fvp.yml create mode 100644 kas/debug-soc.yml create mode 100644 kas/morello-linux-debug.yml
diff --git a/kas/base.yml b/kas/base.yml new file mode 100644 index 0000000..e796349 --- /dev/null +++ b/kas/base.yml @@ -0,0 +1,38 @@ +header: + version: 11 + includes: + - repo: meta-morello + file: kas/base.yml + +defaults: + repos: + refspec: kirkstone + +repos: + meta-morello-distro: + + meta-morello: + url: "https://git.morello-project.org/morello/meta-morello.git" + refspec: "431908fa33773d2df2b0fafb72491793f3f33d41" + layers: + meta-morello: + meta-morello-toolchain: + + meta-openembedded: + url: "https://github.com/openembedded/meta-openembedded" + refspec: "278ec081a64e6a7679d6def550101158126cd935" + layers: + meta-oe: + meta-python: + meta-networking: + meta-filesystems: + meta-webserver: + +machine: unset + +target: + - morello-image + +local_conf_header: + base: | + DISTRO = "morello" diff --git a/kas/debug-fvp.yml b/kas/debug-fvp.yml new file mode 100644 index 0000000..a87f06b --- /dev/null +++ b/kas/debug-fvp.yml @@ -0,0 +1,20 @@ +header: + version: 11 + includes: + - base.yml + - morello-linux-debug.yml + +machine: morello-fvp + +local_conf_header: + fvp-config: | + + LICENSE_FLAGS_ACCEPTED:append = " Arm-FVP-EULA" + + INHERIT += "fvpboot" + + CORE_IMAGE_EXTRA_INSTALL:append = " ssh-pregen-hostkeys" + + FVP_CONSOLES[default] = "terminal_uart_ap" +target: + - core-image-minimal \ No newline at end of file diff --git a/kas/debug-soc.yml b/kas/debug-soc.yml new file mode 100644 index 0000000..d6b0638 --- /dev/null +++ b/kas/debug-soc.yml @@ -0,0 +1,10 @@ +header: + version: 11 + includes: + - base.yml + - morello-linux-debug.yml + +machine: morello-soc + +target: + - morello-image diff --git a/kas/morello-linux-debug.yml b/kas/morello-linux-debug.yml new file mode 100644 index 0000000..bbb535e --- /dev/null +++ b/kas/morello-linux-debug.yml @@ -0,0 +1,24 @@ +header: + version: 11 + includes: + - base.yml + +local_conf_header: + + setup: | + LOGIN_PASSWORD = "NOPASSWD:" + + data_collectors: | + DB_USER ?= "admin" + DB_PASSWORD ?= "admin" + + DB_ROOT_PASSWORD ?= "root" + + DB_ZABBIX_USER_SERVER ?= "zabbix" + DB_ZABBIX_USER_AGENT ?= "zabbtx" + DB_ZABBIX_PASSWORD ?= "zabbix" + DB_ZABBIX_NAME ?= "zabbix" + + image: | + EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + IMAGE_INSTALL:append = " nano"
Co-authored-by: Harrison Carter hcarter@thegoodpenguin.co.uk Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- conf/distro/morello.conf | 18 ++++++++++++++++++ conf/layer.conf | 23 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 conf/distro/morello.conf create mode 100644 conf/layer.conf
diff --git a/conf/distro/morello.conf b/conf/distro/morello.conf new file mode 100644 index 0000000..3846ca9 --- /dev/null +++ b/conf/distro/morello.conf @@ -0,0 +1,18 @@ +DISTRO = "morello" + +DISTRO_NAME = "Morello Dev Kit Distro" + +DISTRO_VERSION_BASE = "1.0" +DISTRO_VERSION = "${DISTRO_VERSION_BASE}+snapshot-${DATE}" +DISTRO_CODENAME = "kirkstone-${DISTRO}-r${DISTRO_VERSION_BASE}" + +MAINTAINER = "P Zalewski <pzalewski@thegoodpenguin.co.uk; H Carter hcarter@thegoodpenguin.co.uk" + +CONF_VERSION = "2" + +DISTRO = "morello" + +INIT_MANAGER = "systemd" + +PREFERRED_VERSION_postgresql-morello = "9.6" +PREFERRED_VERSION_php = "7.4.33" diff --git a/conf/layer.conf b/conf/layer.conf new file mode 100644 index 0000000..1b1bf4d --- /dev/null +++ b/conf/layer.conf @@ -0,0 +1,23 @@ +BBPATH := "${BBPATH}:${LAYERDIR}" + +BBFILES := "${BBFILES} \ + ${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "meta-morello-distro" +BBFILE_PATTERN_meta-morello-distro := "^${LAYERDIR}/" +BBFILE_PRIORITY_meta-morello-distro = "5" + +LAYERDEPENDS_meta-morello-distro= " \ + meta-morello \ + openembedded-layer \ + meta-python \ + networking-layer \ + webserver \ + filesystems-layer \ +" +LAYERSERIES_COMPAT_meta-morello-distro = "kirkstone" + +MORELLO_LAYER_SRC_REF[poky] = "407c3e0237d947ec003bdd1af89a226121c7939c" +MORELLO_LAYER_SRC_REF[meta-openembedded] = "278ec081a64e6a7679d6def550101158126cd935" +MORELLO_LAYER_SRC_REF[meta-cloud-services] = "65f6633fe3159fe1fe6cb3701249c76aeccd116a"
purecap-sysroot: override path variables for purecap sysroot purecap-user-add: to be able to add users in purecap sysroot perl-hacks: to account for lack of perl in purecap sysroot
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- classes/perl-hacks.bbclass | 53 +++++++++++++++++++++++++++++ classes/purecap-sysroot.bbclass | 59 +++++++++++++++++++++++++++++++++ classes/purecap-useradd.bbclass | 1 + 3 files changed, 113 insertions(+) create mode 100644 classes/perl-hacks.bbclass create mode 100644 classes/purecap-sysroot.bbclass create mode 100644 classes/purecap-useradd.bbclass
diff --git a/classes/perl-hacks.bbclass b/classes/perl-hacks.bbclass new file mode 100644 index 0000000..b105a3a --- /dev/null +++ b/classes/perl-hacks.bbclass @@ -0,0 +1,53 @@ +# Sourced from poky/meta/classes/perl-version.bbclass - MIT license + +# We do not have perl in the purecap sysroot, thus we use hacks. + +# Determine the staged version of perl from the perl configuration file +# Assign vardepvalue, because otherwise signature is changed before and after +# perl is built (from None to real version in config.sh). +get_perl_version[vardepvalue] = "${PERL_OWN_DIR}" +def get_perl_version(d): + import re + cfg = d.expand('${STAGING_DIR_HOST}/usr/lib${PERL_OWN_DIR}/perl5/config.sh') + try: + f = open(cfg, 'r') + except IOError: + return None + l = f.readlines(); + f.close(); + r = re.compile(r"^version='(\d*.\d*.\d*)'") + for s in l: + m = r.match(s) + if m: + return m.group(1) + return None + +PERLVERSION := "${@get_perl_version(d)}" +PERLVERSION[vardepvalue] = "" + + +# Determine the staged arch of perl from the perl configuration file +# Assign vardepvalue, because otherwise signature is changed before and after +# perl is built (from None to real version in config.sh). +def get_perl_arch(d): + import re + cfg = d.expand('${STAGING_DIR_HOST}/usr/lib${PERL_OWN_DIR}/perl5/config.sh') + try: + f = open(cfg, 'r') + except IOError: + return None + l = f.readlines(); + f.close(); + r = re.compile("^archname='([^']*)'") + for s in l: + m = r.match(s) + if m: + return m.group(1) + return None + +PERLARCH := "${@get_perl_arch(d)}" +PERLARCH[vardepvalue] = "" + + +STAGING_LIBDIR_HACK="${STAGING_DIR_HOST}/usr/lib" +STAGING_BASELIBDIR_HACK="${STAGING_DIR_HOST}/lib" \ No newline at end of file diff --git a/classes/purecap-sysroot.bbclass b/classes/purecap-sysroot.bbclass new file mode 100644 index 0000000..3295d40 --- /dev/null +++ b/classes/purecap-sysroot.bbclass @@ -0,0 +1,59 @@ +# Prefix all of the paths (root AND usr) with ${PURECAP_SYSROOT_DIR}, apart from the systemd. +# We allow non purecap systemd app to manage purecap packages for now (which with further hacks is achievable) + +# Path prefixes +export base_prefix = "${PURECAP_SYSROOT_DIR}" +export prefix = "${PURECAP_SYSROOT_DIR}/usr" +export exec_prefix = "${prefix}" + +root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefix}', '${base_prefix}', d)}" + +# Base paths +export base_bindir = "${root_prefix}/bin" +export base_sbindir = "${root_prefix}/sbin" +export base_libdir = "${root_prefix}/${baselib}" +export nonarch_base_libdir = "${root_prefix}/lib" + +# Architecture independent paths +export sysconfdir = "${base_prefix}/etc" +export servicedir = "${base_prefix}/srv" +export sharedstatedir = "${base_prefix}/com" +export localstatedir = "${base_prefix}/var" +export datadir = "${prefix}/share" +export infodir = "${datadir}/info" +export mandir = "${datadir}/man" +export docdir = "${datadir}/doc" + +export nonarch_libdir = "${exec_prefix}/lib" + +export systemd_user_unitdir = "/lib/systemd/user" +export systemd_unitdir = "/lib/systemd" +export systemd_system_unitdir = "/lib/systemd/system" + +# Architecture dependent paths +export bindir = "${exec_prefix}/bin" +export sbindir = "${exec_prefix}/sbin" +export libdir = "${exec_prefix}/${baselib}" +export libexecdir = "${exec_prefix}/libexec" +export includedir = "${exec_prefix}/include" +export oldincludedir = "${exec_prefix}/include" + +# Disable QA for now +INSANE_SKIP:${PN} += "file-rdeps" +EXCLUDE_FROM_SHLIBS = "1" +do_package_qa[noexec] = "1" + +# Stop debian class creating pkg duplicates +AUTO_LIBNAME_PKGS = "" + +# Debug purecap, worth double checking linkage etc. +PURECAP_DEBUGDIR = "/morello-debug" + +do_install:append:class-target() { + install -d ${D}${PURECAP_DEBUGDIR} +} + +FILES:${PN}-dbg += "${PURECAP_DEBUGDIR}" + +OBJDUMP_COMMAND = "${OBJDUMP} -D" +READELF_COMMAND = "${READELF} -a" diff --git a/classes/purecap-useradd.bbclass b/classes/purecap-useradd.bbclass new file mode 100644 index 0000000..2a0e0da --- /dev/null +++ b/classes/purecap-useradd.bbclass @@ -0,0 +1 @@ +DEPENDS += "base-passwd-morello" \ No newline at end of file
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- .../cheri-patches/0001-purecap-patches.patch | 183 ++++++++++++++++++ ...1-Configure-do-not-tweak-mips-cflags.patch | 36 ++++ ...sysroot-and-debug-prefix-map-from-co.patch | 78 ++++++++ .../openssl/files/afalg.patch | 31 +++ recipes-connectivity/openssl/files/run-ptest | 12 ++ .../openssl/openssl-morello_3.0.8.bb | 164 ++++++++++++++++ 6 files changed, 504 insertions(+) create mode 100644 recipes-connectivity/openssl/cheri-patches/0001-purecap-patches.patch create mode 100644 recipes-connectivity/openssl/files/0001-Configure-do-not-tweak-mips-cflags.patch create mode 100644 recipes-connectivity/openssl/files/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch create mode 100644 recipes-connectivity/openssl/files/afalg.patch create mode 100644 recipes-connectivity/openssl/files/run-ptest create mode 100644 recipes-connectivity/openssl/openssl-morello_3.0.8.bb
diff --git a/recipes-connectivity/openssl/cheri-patches/0001-purecap-patches.patch b/recipes-connectivity/openssl/cheri-patches/0001-purecap-patches.patch new file mode 100644 index 0000000..6102e6d --- /dev/null +++ b/recipes-connectivity/openssl/cheri-patches/0001-purecap-patches.patch @@ -0,0 +1,183 @@ +From c571aa7d659815902276a0c69eba170eb77074a1 Mon Sep 17 00:00:00 2001 +From: Brooks Davis brooks@one-eyed-alien.net +Date: Mon, 3 Apr 2023 11:23:57 +0100 +Subject: [PATCH] Purecap patches from CHERI BSD that are squashed and rebased. + +Re-add side channels [1] + +The branchless assignments use a pattern which results in the lost of tags +on function pointers and odd length corruption for data pointers. For the +current model of function pointers (single PCC) it might be possible to +fix the function pointer case, but this can't work for objects. + +Use more vaddr_t to fix -Wcheri-bitwise-operations [2] + +[1] https://github.com/CTSRD-CHERI/cheribsd/commit/a0eac17db0649fe134bed192bff30... +[2] https://github.com/CTSRD-CHERI/cheribsd/commit/a2a2a118f7944938e1fc5bb53875e... + +Co-authored-by: Brooks Davis brooks@one-eyed-alien.net +Co-authored-by: Alexander Richardson Alexander.Richardson@cl.cam.ac.uk + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + crypto/bn/bn_nist.c | 48 +++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 40 insertions(+), 8 deletions(-) + +diff --git a/crypto/bn/bn_nist.c b/crypto/bn/bn_nist.c +index da10c40..7f5c6bd 100644 +--- a/crypto/bn/bn_nist.c ++++ b/crypto/bn/bn_nist.c +@@ -338,7 +338,7 @@ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, + sizeof(unsigned int)]; + } buf; + BN_ULONG c_d[BN_NIST_192_TOP], *res; +- PTR_SIZE_INT mask; ++ ptraddr_t mask; + static const BIGNUM ossl_bignum_nist_p_192_sqr = { + (BN_ULONG *)_nist_p_192_sqr, + OSSL_NELEM(_nist_p_192_sqr), +@@ -442,10 +442,14 @@ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, + mask = + 0 - (PTR_SIZE_INT) bn_sub_words(c_d, r_d, _nist_p_192[0], + BN_NIST_192_TOP); +- mask &= 0 - (PTR_SIZE_INT) carry; ++ mask &= 0 - (ptraddr_t) carry; ++#ifndef __CHERI_PURE_CAPABILITY__ + res = c_d; + res = (BN_ULONG *) + (((PTR_SIZE_INT) res & ~mask) | ((PTR_SIZE_INT) r_d & mask)); ++#else ++ res = mask ? r_d : c_d; ++#endif + nist_cp_bn(r_d, res, BN_NIST_192_TOP); + r->top = BN_NIST_192_TOP; + bn_correct_top(r); +@@ -479,7 +483,7 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, + sizeof(unsigned int)]; + } buf; + BN_ULONG c_d[BN_NIST_224_TOP], *res; +- PTR_SIZE_INT mask; ++ ptraddr_t mask; + union { + bn_addsub_f f; + PTR_SIZE_INT p; +@@ -616,19 +620,27 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, + carry = + (int)bn_add_words(r_d, r_d, _nist_p_224[-carry - 1], + BN_NIST_224_TOP); ++#ifndef __CHERI_PURE_CAPABILITY__ + mask = 0 - (PTR_SIZE_INT) carry; + u.p = ((PTR_SIZE_INT) bn_sub_words & mask) | + ((PTR_SIZE_INT) bn_add_words & ~mask); ++#else ++ u.f = carry ? bn_sub_words : bn_add_words; ++#endif + } else + carry = 1; + + /* otherwise it's effectively same as in BN_nist_mod_192... */ + mask = + 0 - (PTR_SIZE_INT) (*u.f) (c_d, r_d, _nist_p_224[0], BN_NIST_224_TOP); +- mask &= 0 - (PTR_SIZE_INT) carry; ++ mask &= 0 - (ptraddr_t) carry; ++#ifndef __CHERI_PURE_CAPABILITY__ + res = c_d; + res = (BN_ULONG *)(((PTR_SIZE_INT) res & ~mask) | + ((PTR_SIZE_INT) r_d & mask)); ++#else ++ res = mask ? r_d : c_d; ++#endif + nist_cp_bn(r_d, res, BN_NIST_224_TOP); + r->top = BN_NIST_224_TOP; + bn_correct_top(r); +@@ -660,7 +672,7 @@ int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, + sizeof(unsigned int)]; + } buf; + BN_ULONG c_d[BN_NIST_256_TOP], *res; +- PTR_SIZE_INT mask; ++ ptraddr_t mask; + union { + bn_addsub_f f; + PTR_SIZE_INT p; +@@ -859,18 +871,26 @@ int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, + carry = + (int)bn_add_words(r_d, r_d, _nist_p_256[-carry - 1], + BN_NIST_256_TOP); ++#ifndef __CHERI_PURE_CAPABILITY__ + mask = 0 - (PTR_SIZE_INT) carry; + u.p = ((PTR_SIZE_INT) bn_sub_words & mask) | + ((PTR_SIZE_INT) bn_add_words & ~mask); ++#else ++ u.f = carry ? bn_sub_words : bn_add_words; ++#endif + } else + carry = 1; + + mask = + 0 - (PTR_SIZE_INT) (*u.f) (c_d, r_d, _nist_p_256[0], BN_NIST_256_TOP); +- mask &= 0 - (PTR_SIZE_INT) carry; ++ mask &= 0 - (ptraddr_t) carry; ++#ifndef __CHERI_PURE_CAPABILITY__ + res = c_d; + res = (BN_ULONG *)(((PTR_SIZE_INT) res & ~mask) | + ((PTR_SIZE_INT) r_d & mask)); ++#else ++ res = mask ? r_d : c_d; ++#endif + nist_cp_bn(r_d, res, BN_NIST_256_TOP); + r->top = BN_NIST_256_TOP; + bn_correct_top(r); +@@ -906,7 +926,7 @@ int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, + sizeof(unsigned int)]; + } buf; + BN_ULONG c_d[BN_NIST_384_TOP], *res; +- PTR_SIZE_INT mask; ++ ptraddr_t mask; + union { + bn_addsub_f f; + PTR_SIZE_INT p; +@@ -1140,18 +1160,26 @@ int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, + carry = + (int)bn_add_words(r_d, r_d, _nist_p_384[-carry - 1], + BN_NIST_384_TOP); ++#ifndef __CHERI_PURE_CAPABILITY__ + mask = 0 - (PTR_SIZE_INT) carry; + u.p = ((PTR_SIZE_INT) bn_sub_words & mask) | + ((PTR_SIZE_INT) bn_add_words & ~mask); ++#else ++ u.f = carry ? bn_sub_words : bn_add_words; ++#endif + } else + carry = 1; + + mask = + 0 - (PTR_SIZE_INT) (*u.f) (c_d, r_d, _nist_p_384[0], BN_NIST_384_TOP); +- mask &= 0 - (PTR_SIZE_INT) carry; ++ mask &= 0 - (ptraddr_t) carry; ++#ifndef __CHERI_PURE_CAPABILITY__ + res = c_d; + res = (BN_ULONG *)(((PTR_SIZE_INT) res & ~mask) | + ((PTR_SIZE_INT) r_d & mask)); ++#else ++ res = mask ? r_d : c_d; ++#endif + nist_cp_bn(r_d, res, BN_NIST_384_TOP); + r->top = BN_NIST_384_TOP; + bn_correct_top(r); +@@ -1224,9 +1252,13 @@ int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, + mask = + 0 - (PTR_SIZE_INT) bn_sub_words(t_d, r_d, _nist_p_521, + BN_NIST_521_TOP); ++#ifndef __CHERI_PURE_CAPABILITY__ + res = t_d; + res = (BN_ULONG *)(((PTR_SIZE_INT) res & ~mask) | + ((PTR_SIZE_INT) r_d & mask)); ++#else ++ res = mask ? r_d : t_d; ++#endif + nist_cp_bn(r_d, res, BN_NIST_521_TOP); + r->top = BN_NIST_521_TOP; + bn_correct_top(r); +-- +2.34.1 + diff --git a/recipes-connectivity/openssl/files/0001-Configure-do-not-tweak-mips-cflags.patch b/recipes-connectivity/openssl/files/0001-Configure-do-not-tweak-mips-cflags.patch new file mode 100644 index 0000000..0b7abc3 --- /dev/null +++ b/recipes-connectivity/openssl/files/0001-Configure-do-not-tweak-mips-cflags.patch @@ -0,0 +1,36 @@ +From 326909baf81a638d51fa8be1d8227518784f5cc4 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin alex@linutronix.de +Date: Tue, 14 Sep 2021 12:18:25 +0200 +Subject: [PATCH] Configure: do not tweak mips cflags + +This conflicts with mips machine definitons from yocto, +e.g. +| Error: -mips3 conflicts with the other architecture options, which imply -mips64r2 + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin alex@linutronix.de +--- + Configure | 10 ---------- + 1 file changed, 10 deletions(-) + +Index: openssl-3.0.4/Configure +=================================================================== +--- openssl-3.0.4.orig/Configure ++++ openssl-3.0.4/Configure +@@ -1423,16 +1423,6 @@ if ($target =~ /^mingw/ && `$config{CC} + push @{$config{shared_ldflag}}, "-mno-cygwin"; + } + +-if ($target =~ /linux.*-mips/ && !$disabled{asm} +- && !grep { $_ !~ /-m(ips|arch=)/ } (@{$config{CFLAGS}})) { +- # minimally required architecture flags for assembly modules +- my $value; +- $value = '-mips2' if ($target =~ /mips32/); +- $value = '-mips3' if ($target =~ /mips64/); +- unshift @{$config{cflags}}, $value; +- unshift @{$config{cxxflags}}, $value if $config{CXX}; +-} +- + # If threads aren't disabled, check how possible they are + unless ($disabled{threads}) { + if ($auto_threads) { diff --git a/recipes-connectivity/openssl/files/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch b/recipes-connectivity/openssl/files/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch new file mode 100644 index 0000000..bafdbaa --- /dev/null +++ b/recipes-connectivity/openssl/files/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch @@ -0,0 +1,78 @@ +From 5985253f2c9025d7c127443a3a9938946f80c2a1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= martin@geanix.com +Date: Tue, 6 Nov 2018 14:50:47 +0100 +Subject: [PATCH] buildinfo: strip sysroot and debug-prefix-map from compiler + info +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The openssl build system generates buildinf.h containing the full +compiler command line used to compile objects. This breaks +reproducibility, as the compile command is baked into libcrypto, where +it is used when running `openssl version -f`. + +Add stripped build variables for the compiler and cflags lines, and use +those when generating buildinfo.h. + +This is based on a similar patch for older openssl versions: +https://patchwork.openembedded.org/patch/147229/ + +Upstream-Status: Inappropriate [OE specific] +Signed-off-by: Martin Hundebøll martin@geanix.com + +Update to fix buildpaths qa issue for '-fmacro-prefix-map'. + +Signed-off-by: Kai Kang kai.kang@windriver.com + +Update to fix buildpaths qa issue for '-ffile-prefix-map'. + +Signed-off-by: Khem Raj raj.khem@gmail.com + +--- + Configurations/unix-Makefile.tmpl | 12 +++++++++++- + crypto/build.info | 2 +- + 2 files changed, 12 insertions(+), 2 deletions(-) + +Index: openssl-3.0.4/Configurations/unix-Makefile.tmpl +=================================================================== +--- openssl-3.0.4.orig/Configurations/unix-Makefile.tmpl ++++ openssl-3.0.4/Configurations/unix-Makefile.tmpl +@@ -472,13 +472,23 @@ BIN_LDFLAGS={- join(' ', $target{bin_lfl + '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} + BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) + +-# CPPFLAGS_Q is used for one thing only: to build up buildinf.h ++# *_Q variables are used for one thing only: to build up buildinf.h + CPPFLAGS_Q={- $cppflags1 =~ s|([\"])|\$1|g; + $cppflags2 =~ s|([\"])|\$1|g; + $lib_cppflags =~ s|([\"])|\$1|g; + join(' ', $lib_cppflags || (), $cppflags2 || (), + $cppflags1 || ()) -} + ++CFLAGS_Q={- for (@{$config{CFLAGS}}) { ++ s|-fdebug-prefix-map=[^ ]+|-fdebug-prefix-map=|g; ++ s|-fmacro-prefix-map=[^ ]+|-fmacro-prefix-map=|g; ++ s|-ffile-prefix-map=[^ ]+|-ffile-prefix-map=|g; ++ } ++ join(' ', @{$config{CFLAGS}}) -} ++ ++CC_Q={- $config{CC} =~ s|--sysroot=[^ ]+|--sysroot=recipe-sysroot|g; ++ join(' ', $config{CC}) -} ++ + PERLASM_SCHEME= {- $target{perlasm_scheme} -} + + # For x86 assembler: Set PROCESSOR to 386 if you want to support +Index: openssl-3.0.4/crypto/build.info +=================================================================== +--- openssl-3.0.4.orig/crypto/build.info ++++ openssl-3.0.4/crypto/build.info +@@ -109,7 +109,7 @@ DEFINE[../libcrypto]=$UPLINKDEF + + DEPEND[info.o]=buildinf.h + DEPEND[cversion.o]=buildinf.h +-GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(LIB_CFLAGS) $(CPPFLAGS_Q)" "$(PLATFORM)" ++GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC_Q) $(CFLAGS_Q) $(CPPFLAGS_Q)" "$(PLATFORM)" + + GENERATE[uplink-x86.S]=../ms/uplink-x86.pl + GENERATE[uplink-x86_64.s]=../ms/uplink-x86_64.pl diff --git a/recipes-connectivity/openssl/files/afalg.patch b/recipes-connectivity/openssl/files/afalg.patch new file mode 100644 index 0000000..cf77e87 --- /dev/null +++ b/recipes-connectivity/openssl/files/afalg.patch @@ -0,0 +1,31 @@ +Don't refuse to build afalgeng if cross-compiling or the host kernel is too old. + +Upstream-Status: Submitted [hhttps://github.com/openssl/openssl/pull/7688] +Signed-off-by: Ross Burton ross.burton@intel.com + +Index: openssl-3.0.4/Configure +=================================================================== +--- openssl-3.0.4.orig/Configure ++++ openssl-3.0.4/Configure +@@ -1681,20 +1681,7 @@ $config{CFLAGS} = [ map { $_ eq '--ossl- + unless ($disabled{afalgeng}) { + $config{afalgeng}=""; + if (grep { $_ eq 'afalgeng' } @{$target{enable}}) { +- my $minver = 4*10000 + 1*100 + 0; +- if ($config{CROSS_COMPILE} eq "") { +- my $verstr = `uname -r`; +- my ($ma, $mi1, $mi2) = split("\.", $verstr); +- ($mi2) = $mi2 =~ /(\d+)/; +- my $ver = $ma*10000 + $mi1*100 + $mi2; +- if ($ver < $minver) { +- disable('too-old-kernel', 'afalgeng'); +- } else { +- push @{$config{engdirs}}, "afalg"; +- } +- } else { +- disable('cross-compiling', 'afalgeng'); +- } ++ push @{$config{engdirs}}, "afalg"; + } else { + disable('not-linux', 'afalgeng'); + } diff --git a/recipes-connectivity/openssl/files/run-ptest b/recipes-connectivity/openssl/files/run-ptest new file mode 100644 index 0000000..8dff791 --- /dev/null +++ b/recipes-connectivity/openssl/files/run-ptest @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e + +# Optional arguments are 'list' to lists all tests, or the test name (base name +# ie test_evp, not 03_test_evp.t). + +export TOP=. +# OPENSSL_ENGINES is relative from the test binaries +export OPENSSL_ENGINES=../engines + +perl ./test/run_tests.pl $* | sed -u -r -e '/(.*) .*.ok/ s/^/PASS: /g' -r -e '/Dubious(.*)/ s/^/FAIL: /g' -e '/(.*) .*.skipped: (.*)/ s/^/SKIP: /g' diff --git a/recipes-connectivity/openssl/openssl-morello_3.0.8.bb b/recipes-connectivity/openssl/openssl-morello_3.0.8.bb new file mode 100644 index 0000000..d296ae1 --- /dev/null +++ b/recipes-connectivity/openssl/openssl-morello_3.0.8.bb @@ -0,0 +1,164 @@ +inherit lib_package pkgconfig perlnative pure-cap-kheaders purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-connectivity/openssl/openssl_3.0.8.bb" + +SUMMARY = "Secure Socket Layer" +DESCRIPTION = "Secure Socket Layer (SSL) binary and related cryptographic tools, with rebased patches from CHERI BSD repo." +HOMEPAGE = "http://www.openssl.org/" +BUGTRACKER = "http://www.openssl.org/news/vulnerabilities.html" +SECTION = "libs/network" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +RPROVIDES:${PN} = "openssl-morello" + +FILESEXTRAPATHS:prepend := "${THISDIR}/cheri-patches:" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=c75985e733726beaba57bc5253e96d04" + +SRC_URI = "http://www.openssl.org/source/openssl-3.0.8.tar.gz \ + file://run-ptest \ + file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \ + file://afalg.patch \ + file://0001-Configure-do-not-tweak-mips-cflags.patch \ + file://0001-purecap-patches.patch \ + " + +SRC_URI[sha256sum] = "6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e" + +PACKAGECONFIG ?= "" + +PACKAGECONFIG[no-tls1] = "no-tls1" +PACKAGECONFIG[no-tls1_1] = "no-tls1_1" + +S = "${WORKDIR}/openssl-3.0.8" +B = "${WORKDIR}/build" + +do_configure[cleandirs] = "${B}" + +# no-asm as otherwise crypto wont compile, no-async is needed for musl +EXTRA_OECONF:append = " no-async" +EXTRA_OECONF:append = " no-asm" +EXTRA_OECONF:append = " shared" + +EXTRA_OECONF:remove:toolchain-llvm-morello = "--disable-static" + +# This allows disabling deprecated or undesirable crypto algorithms. +# The default is to trust upstream choices. +DEPRECATED_CRYPTO_FLAGS ?= "" + +do_configure () { + HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \ + perl ${S}/Configure ${EXTRA_OECONF} --prefix=$prefix --openssldir=${libdir}/ssl-3 --libdir=${libdir} linux-aarch64 + perl ${B}/configdata.pm --dump +} + +do_compile () { + oe_runmake +} + +do_install () { + + oe_runmake DESTDIR=${D} install + + libdirssl="${libdir}/ssl-3" + sysconfdirssl="${sysconfdir}/ssl" + + install -d ${D}${sysconfdirssl} + mv ${D}${libdirssl}/certs \ + ${D}${libdirssl}/private \ + ${D}${libdirssl}/openssl.cnf \ + ${D}${sysconfdirssl}/ + + # Although absolute symlinks would be OK for the target, they become + # invalid if native or nativesdk are relocated from sstate. + ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/certs')} ${D}${libdirssl}/certs + ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/private')} ${D}${libdirssl}/private + ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/openssl.cnf')} ${D}${libdirssl}/openssl.cnf +} + +do_install:append() { + ${OBJDUMP_COMMAND} ${D}${libdir}/libssl.so > ${D}${PURECAP_DEBUGDIR}/libssl.dump + ${READELF_COMMAND} ${D}${libdir}/libssl.so > ${D}${PURECAP_DEBUGDIR}/libssl.readelf +} + +PTEST_BUILD_HOST_FILES += "configdata.pm" +PTEST_BUILD_HOST_PATTERN = "perl_version =" +do_install_ptest () { + + local ptest_path = "${D}${PURECAP_SYSROOT_DIR}${PTEST_PATH}" + install -d ${ptest_path} + install -d ${ptest_path}/test + install -m755 ${B}/test/p_test.so ${ptest_path}/test + install -m755 ${B}/test/provider_internal_test.cnf ${ptest_path}/test + + # Prune the build tree + rm -f ${B}/fuzz/*.* ${B}/test/*.* + cp ${S}/Configure ${B}/configdata.pm ${ptest_path} + sed 's|${S}|${ptest_path}|g' -i ${ptest_path}/configdata.pm + cp -r ${S}/external ${B}/test ${S}/test ${B}/fuzz ${S}/util ${B}/util ${ptest_path} + + # For test_shlibload + ln -s ${libdir}/libcrypto.so.1.1 ${ptest_path}/ + ln -s ${libdir}/libssl.so.1.1 ${ptest_path}/ + install -d ${ptest_path}/apps + ln -s ${bindir}/openssl ${ptest_path}/apps + install -m644 ${S}/apps/*.pem ${S}/apps/*.srl ${S}/apps/openssl.cnf ${ptest_path}/apps + install -m755 ${B}/apps/CA.pl ${ptest_path}/apps + install -d ${ptest_path}/engines + install -m755 ${B}/engines/dasync.so ${ptest_path}/engines + install -m755 ${B}/engines/loader_attic.so ${ptest_path}/engines + install -m755 ${B}/engines/ossltest.so ${ptest_path}/engines + install -d ${ptest_path}/providers + install -m755 ${B}/providers/legacy.so ${ptest_path}/providers + install -d ${ptest_path}/Configurations + cp -rf ${S}/Configurations/* ${ptest_path}/Configurations/ + + # seems to be needed with perl 5.32.1 + install -d ${ptest_path}/util/perl/recipes + cp ${ptest_path}/test/recipes/tconversion.pl ${ptest_path}/util/perl/recipes/ + sed 's|${S}|${ptest_path}|g' -i ${ptest_path}/util/wrap.pl +} + +# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto +# package RRECOMMENDS on this package. This will enable the configuration +# file to be installed for both the openssl-bin package and the libcrypto +# package since the openssl-bin package depends on the libcrypto package. + +PACKAGES =+ "libcrypto-morello libssl-morello openssl-morello-conf ${PN}-engines ${PN}-misc ${PN}-ossl-module-legacy" + +FILES:${PN} += "${libdir}/ssl-3/* \ + ${libdir}/ossl-modules/ \ + ${sysconfdir}/ssl \ + " + +FILES:${PN}-bin = "${bindir}/openssl" + +FILES:libcrypto-morello = "${libdir}/libcrypto${SOLIBS}" +FILES:libssl-morello = "${libdir}/libssl${SOLIBS}" +FILES:openssl-morello-conf = "${sysconfdir}/ssl/openssl.cnf \ + ${libdir}/ssl-3/openssl.cnf* \ + " + +FILES:${PN}-engines = "${libdir}/engines-3" + +FILES:${PN}-misc = "${libdir}/ssl-3/misc ${bindir}/c_rehash" +FILES:${PN}-ossl-module-legacy = "${libdir}/ossl-modules/legacy.so" + + +CONFFILES:openssl-morello-conf = "${sysconfdir}/ssl/openssl.cnf" + +RRECOMMENDS:libcrypto-mmorello += "openssl-morello-conf ${PN}-ossl-module-legacy" + +RDEPENDS:${PN}-misc = "perl" +RDEPENDS:${PN}-ptest += "openssl-morello-bin perl perl-modules bash sed" + +RDEPENDS:${PN}-bin += "openssl-morello-conf" + +CVE_PRODUCT = "openssl:openssl" +CVE_VERSION_SUFFIX = "alphabetical" + +# Only affects OpenSSL >= 1.1.1 in combination with Apache < 2.4.37 +# Apache in meta-webserver is already recent enough +CVE_CHECK_IGNORE += "CVE-2019-0190" \ No newline at end of file
Co-authored-by: Harrison Carter hcarter@thegoodpenguin.co.uk Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- recipes-httpd/nginx/files/fastcgi-php.conf | 13 ++++ recipes-httpd/nginx/files/http_status.conf | 7 ++ recipes-httpd/nginx/files/zabbix-web.conf | 79 ++++++++++++++++++++++ recipes-httpd/nginx/nginx_%.bbappend | 29 ++++++++ 4 files changed, 128 insertions(+) create mode 100644 recipes-httpd/nginx/files/fastcgi-php.conf create mode 100644 recipes-httpd/nginx/files/http_status.conf create mode 100644 recipes-httpd/nginx/files/zabbix-web.conf create mode 100644 recipes-httpd/nginx/nginx_%.bbappend
diff --git a/recipes-httpd/nginx/files/fastcgi-php.conf b/recipes-httpd/nginx/files/fastcgi-php.conf new file mode 100644 index 0000000..467a9e7 --- /dev/null +++ b/recipes-httpd/nginx/files/fastcgi-php.conf @@ -0,0 +1,13 @@ +# regex to split $uri to $fastcgi_script_name and $fastcgi_path +fastcgi_split_path_info ^(.+?.php)(/.*)$; + +# Check that the PHP script exists before passing it +try_files $fastcgi_script_name =404; + +# Bypass the fact that try_files resets $fastcgi_path_info +# see: http://trac.nginx.org/nginx/ticket/321 +set $path_info $fastcgi_path_info; +fastcgi_param PATH_INFO $path_info; + +fastcgi_index index.php; +include fastcgi.conf; diff --git a/recipes-httpd/nginx/files/http_status.conf b/recipes-httpd/nginx/files/http_status.conf new file mode 100644 index 0000000..c24d54b --- /dev/null +++ b/recipes-httpd/nginx/files/http_status.conf @@ -0,0 +1,7 @@ +server { + location = /basic_status { + stub_status; + allow 127.0.0.1; + deny all; + } +} \ No newline at end of file diff --git a/recipes-httpd/nginx/files/zabbix-web.conf b/recipes-httpd/nginx/files/zabbix-web.conf new file mode 100644 index 0000000..5e2a639 --- /dev/null +++ b/recipes-httpd/nginx/files/zabbix-web.conf @@ -0,0 +1,79 @@ +server { + listen 8080; + server_name myzabbix.com; + + root /usr/share/zabbix; + + index index.php; + + location = /favicon.ico { + log_not_found off; + } + + location / { + try_files $uri $uri/ =404; + } + + location /assets { + access_log off; + expires 10d; + } + + location ~ /.ht { + deny all; + } + + location ~ /(api/|conf[^.]|include|locale) { + deny all; + return 404; + } + + location /vendor { + deny all; + return 404; + } + + location ~ [^/].php(/|$) { + fastcgi_pass unix:/var/run/php/zabbix.sock; + fastcgi_split_path_info ^(.+.php)(/.+)$; + fastcgi_index index.php; + + fastcgi_param DOCUMENT_ROOT /usr/share/zabbix; + fastcgi_param SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name; + fastcgi_param PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name; + + include fastcgi_params; + fastcgi_param QUERY_STRING $query_string; + fastcgi_param REQUEST_METHOD $request_method; + fastcgi_param CONTENT_TYPE $content_type; + fastcgi_param CONTENT_LENGTH $content_length; + + fastcgi_intercept_errors on; + fastcgi_ignore_client_abort off; + fastcgi_connect_timeout 60; + fastcgi_send_timeout 180; + fastcgi_read_timeout 180; + fastcgi_buffer_size 128k; + fastcgi_buffers 4 256k; + fastcgi_busy_buffers_size 256k; + fastcgi_temp_file_write_size 256k; + } + + # Enable php-fpm status page + location ~ ^/(status|ping)$ { + ## disable access logging for request if you prefer + access_log off; + + ## Only allow trusted IPs for security, deny everyone else + # allow 127.0.0.1; + # allow 1.2.3.4; # your IP here + # deny all; + + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_index index.php; + include fastcgi_params; + ## Now the port or socket of the php-fpm pool we want the status of + fastcgi_pass 127.0.0.1:9000; + # fastcgi_pass unix:/run/php-fpm/your_socket.sock; + } +} diff --git a/recipes-httpd/nginx/nginx_%.bbappend b/recipes-httpd/nginx/nginx_%.bbappend new file mode 100644 index 0000000..ee38f9d --- /dev/null +++ b/recipes-httpd/nginx/nginx_%.bbappend @@ -0,0 +1,29 @@ + +FILESEXTRAPATHS:append := "${THISDIR}/files:" + +SRC_URI:append = " \ + file://http_status.conf \ + file://zabbix-web.conf \ + file://fastcgi-php.conf \ + " + +EXTRA_OECONF+= "\ + --with-http_stub_status_module \ + " + +do_install:append() { + + install -d ${D}${sysconfdir}/nginx/conf.d/ + cp ${WORKDIR}/zabbix-web.conf ${D}${sysconfdir}/nginx/conf.d/zabbix.conf + + install -d ${D}${sysconfdir}/nginx/snippets/ + install -m 0644 ${WORKDIR}/fastcgi-php.conf ${D}${sysconfdir}/nginx/snippets/ + + install -d ${D}${sysconfdir}/${BPN}/conf.d/ + install -m 0644 ${WORKDIR}/http_status.conf ${D}${sysconfdir}/${BPN}/conf.d/ + + install -d ${D}${localstatedir}/lib/php/sessions + chown www-data:www-data -R ${D}${localstatedir}/lib/php/sessions +} + +CONFFILES:${PN} = " http_status.conf "
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- .../base-passwd/base-passwd-morello_3.5.29.bb | 128 ++++++++++++++++++ .../base-passwd/files/add_shutdown.patch | 19 +++ .../base-passwd/files/disable-docs.patch | 24 ++++ .../base-passwd/files/disable-shell.patch | 57 ++++++++ recipes-core/base-passwd/files/input.patch | 22 +++ recipes-core/base-passwd/files/kvm.patch | 23 ++++ recipes-core/base-passwd/files/nobash.patch | 15 ++ recipes-core/base-passwd/files/noshadow.patch | 14 ++ 8 files changed, 302 insertions(+) create mode 100644 recipes-core/base-passwd/base-passwd-morello_3.5.29.bb create mode 100644 recipes-core/base-passwd/files/add_shutdown.patch create mode 100644 recipes-core/base-passwd/files/disable-docs.patch create mode 100644 recipes-core/base-passwd/files/disable-shell.patch create mode 100644 recipes-core/base-passwd/files/input.patch create mode 100644 recipes-core/base-passwd/files/kvm.patch create mode 100644 recipes-core/base-passwd/files/nobash.patch create mode 100644 recipes-core/base-passwd/files/noshadow.patch
diff --git a/recipes-core/base-passwd/base-passwd-morello_3.5.29.bb b/recipes-core/base-passwd/base-passwd-morello_3.5.29.bb new file mode 100644 index 0000000..a65cebe --- /dev/null +++ b/recipes-core/base-passwd/base-passwd-morello_3.5.29.bb @@ -0,0 +1,128 @@ +inherit autotools purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb" + +SUMMARY = "Base system master password/group files" +DESCRIPTION = "The master copies of the user database files (/etc/passwd and /etc/group). The update-passwd tool is also provided to keep the system databases synchronized with these master files." +HOMEPAGE = "https://launchpad.net/base-passwd" +SECTION = "base" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +BPNPASSWD = "base-passwd" +PVPASSWD = "3.5.29" + +RECIPE_NO_UPDATE_REASON = "Version 3.5.38 requires cdebconf for update-passwd utility" + +SRC_URI = "https://launchpad.net/debian/+archive/primary/+files/%24%7BBPNPASSWD%7D_%24%... \ + file://add_shutdown.patch \ + file://nobash.patch \ + file://noshadow.patch \ + file://input.patch \ + file://disable-docs.patch \ + file://kvm.patch \ + file://disable-shell.patch \ + " + +S="${WORKDIR}/${BPNPASSWD}-${PVPASSWD}" + +SRC_URI[md5sum] = "6beccac48083fe8ae5048acd062e5421" +SRC_URI[sha256sum] = "f0b66388b2c8e49c15692439d2bee63bcdd4bbbf7a782c7f64accc55986b6a36" + +# the package is taken from launchpad; that source is static and goes stale +# so we check the latest upstream from a directory that does get updated +UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/b/base-passwd/" + +do_install () { + install -d -m 755 ${D}${sbindir} + install -o root -g root -p -m 755 ${B}/update-passwd ${D}${sbindir}/ + install -d -m 755 ${D}${mandir}/man8 ${D}${mandir}/pl/man8 + install -p -m 644 ${S}/man/update-passwd.8 ${D}${mandir}/man8/ + install -p -m 644 ${S}/man/update-passwd.pl.8 \ + ${D}${mandir}/pl/man8/update-passwd.8 + gzip -9 ${D}${mandir}/man8/* ${D}${mandir}/pl/man8/* + install -d -m 755 ${D}${datadir}/base-passwd + install -o root -g root -p -m 644 ${S}/passwd.master ${D}${datadir}/base-passwd/ + sed -i 's#:/root:#:${ROOT_HOME}:#' ${D}${datadir}/base-passwd/passwd.master + install -o root -g root -p -m 644 ${S}/group.master ${D}${datadir}/base-passwd/ + + install -d -m 755 ${D}${docdir}/${BPNPASSWD} + install -p -m 644 ${S}/debian/changelog ${D}${docdir}/${BPNPASSWD}/ + gzip -9 ${D}${docdir}/${BPNPASSWD}/* + install -p -m 644 ${S}/README ${D}${docdir}/${BPNPASSWD}/ + install -p -m 644 ${S}/debian/copyright ${D}${docdir}/${BPNPASSWD}/ +} + +basepasswd_sysroot_postinst() { +#!/bin/sh + +# Install passwd.master and group.master to sysconfdir +install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir} +for i in passwd group; do + install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/$i.master \ + ${STAGING_DIR_TARGET}${sysconfdir}/$i +done + +# Run any useradd postinsts +for script in ${STAGING_DIR_TARGET}${bindir}/postinst-useradd-*; do + if [ -f $script ]; then + $script + fi +done +} + +SYSROOT_DIRS += "${sysconfdir}" +SYSROOT_PREPROCESS_FUNCS += "base_passwd_tweaksysroot" + +base_passwd_tweaksysroot () { + mkdir -p ${SYSROOT_DESTDIR}${bindir} + dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN} + echo "${basepasswd_sysroot_postinst}" > $dest + chmod 0755 $dest +} + +python populate_packages:prepend() { + # Add in the preinst function for ${PN} + # We have to do this here as prior to this, passwd/group.master + # would be unavailable. We need to create these files at preinst + # time before the files from the package may be available, hence + # storing the data from the files in the preinst directly. + + f = open(d.expand("${STAGING_DATADIR}/base-passwd/passwd.master"), 'r') + passwd = "".join(f.readlines()) + f.close() + f = open(d.expand("${STAGING_DATADIR}/base-passwd/group.master"), 'r') + group = "".join(f.readlines()) + f.close() + + preinst = """#!/bin/sh +mkdir -p $D${sysconfdir} +if [ ! -e $D${sysconfdir}/passwd ]; then +\tcat << 'EOF' > $D${sysconfdir}/passwd +""" + passwd + """EOF +fi +if [ ! -e $D${sysconfdir}/group ]; then +\tcat << 'EOF' > $D${sysconfdir}/group +""" + group + """EOF +fi +""" + d.setVar(d.expand('pkg_preinst:${PN}'), preinst) +} + +addtask do_package after do_populate_sysroot + +ALLOW_EMPTY:${PN} = "1" + +PACKAGES =+ "${PN}-update" +FILES:${PN}-update = "${sbindir}/* ${datadir}/${BPNPASSWD}" + +pkg_postinst:${PN}-update () { +#!/bin/sh +if [ -n "$D" ]; then + exit 0 +fi +${sbindir}/update-passwd +} diff --git a/recipes-core/base-passwd/files/add_shutdown.patch b/recipes-core/base-passwd/files/add_shutdown.patch new file mode 100644 index 0000000..5f357d8 --- /dev/null +++ b/recipes-core/base-passwd/files/add_shutdown.patch @@ -0,0 +1,19 @@ + +We need to have a shutdown group to allow the shutdown icon +to work correctly. Any users that want to use shutdown like +the xuser should be added to this group. + +Upstream-Status: Inappropriate [Embedded] + +Signed-off-by: Saul Wold sgw@linux.intel.com +Index: base-passwd-3.5.26/group.master +=================================================================== +--- base-passwd-3.5.26.orig/group.master ++++ base-passwd-3.5.26/group.master +@@ -36,5 +36,6 @@ sasl:*:45: + plugdev:*:46: + staff:*:50: + games:*:60: ++shutdown:*:70: + users:*:100: + nogroup:*:65534: diff --git a/recipes-core/base-passwd/files/disable-docs.patch b/recipes-core/base-passwd/files/disable-docs.patch new file mode 100644 index 0000000..14c08b7 --- /dev/null +++ b/recipes-core/base-passwd/files/disable-docs.patch @@ -0,0 +1,24 @@ +Disable documentation for now as it uses tools currently not supported +by OE-Core. It uses sgmltools and po4a. + +Upstream-Status: Inappropriate [OE-Core specific] +Signed-off-by: Saul Wold sgw@linux.intel.com + +Index: base-passwd-3.5.28/Makefile.in +=================================================================== +--- base-passwd-3.5.28.orig/Makefile.in ++++ base-passwd-3.5.28/Makefile.in +@@ -25,13 +25,10 @@ gen_configure = config.cache config.stat + confdefhs.h config.h Makefile + + all: update-passwd +- $(MAKE) -C doc all +- $(MAKE) -C man all + + install: all + mkdir -p $(DESTDIR)$(sbindir) + $(INSTALL) update-passwd $(DESTDIR)$(sbindir)/ +- $(MAKE) -C man install + + update-passwd.o: version.h + diff --git a/recipes-core/base-passwd/files/disable-shell.patch b/recipes-core/base-passwd/files/disable-shell.patch new file mode 100644 index 0000000..bfaa786 --- /dev/null +++ b/recipes-core/base-passwd/files/disable-shell.patch @@ -0,0 +1,57 @@ +From 91e0db96741359173ddf2be083aafcc1a3c32472 Mon Sep 17 00:00:00 2001 +From: Jiaqing Zhao jiaqing.zhao@linux.intel.com +Date: Mon, 18 Apr 2022 11:22:43 +0800 +Subject: [PATCH] Disable shell for default users + +Change the shell of all global static users other than root (which +retains /bin/sh) and sync (as /bin/sync is rather harmless) to +/sbin/nologin (as /usr/sbin/nologin does not exist in openembedded) + +Upstream-Status: Backport [https://launchpad.net/ubuntu/+source/base-passwd/3.5.30] +Signed-off-by: Jiaqing Zhao jiaqing.zhao@linux.intel.com +--- + passwd.master | 32 ++++++++++++++++---------------- + 1 file changed, 16 insertions(+), 16 deletions(-) + +diff --git a/passwd.master b/passwd.master +index e1c32ff..0cd5ffd 100644 +--- a/passwd.master ++++ b/passwd.master +@@ -1,18 +1,18 @@ + root::0:0:root:/root:/bin/sh +-daemon:*:1:1:daemon:/usr/sbin:/bin/sh +-bin:*:2:2:bin:/bin:/bin/sh +-sys:*:3:3:sys:/dev:/bin/sh ++daemon:*:1:1:daemon:/usr/sbin:/sbin/nologin ++bin:*:2:2:bin:/bin:/sbin/nologin ++sys:*:3:3:sys:/dev:/sbin/nologin + sync:*:4:65534:sync:/bin:/bin/sync +-games:*:5:60:games:/usr/games:/bin/sh +-man:*:6:12:man:/var/cache/man:/bin/sh +-lp:*:7:7:lp:/var/spool/lpd:/bin/sh +-mail:*:8:8:mail:/var/mail:/bin/sh +-news:*:9:9:news:/var/spool/news:/bin/sh +-uucp:*:10:10:uucp:/var/spool/uucp:/bin/sh +-proxy:*:13:13:proxy:/bin:/bin/sh +-www-data:*:33:33:www-data:/var/www:/bin/sh +-backup:*:34:34:backup:/var/backups:/bin/sh +-list:*:38:38:Mailing List Manager:/var/list:/bin/sh +-irc:*:39:39:ircd:/var/run/ircd:/bin/sh +-gnats:*:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh +-nobody:*:65534:65534:nobody:/nonexistent:/bin/sh ++games:*:5:60:games:/usr/games:/sbin/nologin ++man:*:6:12:man:/var/cache/man:/sbin/nologin ++lp:*:7:7:lp:/var/spool/lpd:/sbin/nologin ++mail:*:8:8:mail:/var/mail:/sbin/nologin ++news:*:9:9:news:/var/spool/news:/sbin/nologin ++uucp:*:10:10:uucp:/var/spool/uucp:/sbin/nologin ++proxy:*:13:13:proxy:/bin:/sbin/nologin ++www-data:*:33:33:www-data:/var/www:/sbin/nologin ++backup:*:34:34:backup:/var/backups:/sbin/nologin ++list:*:38:38:Mailing List Manager:/var/list:/sbin/nologin ++irc:*:39:39:ircd:/var/run/ircd:/sbin/nologin ++gnats:*:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/sbin/nologin ++nobody:*:65534:65534:nobody:/nonexistent:/sbin/nologin +-- +2.32.0 + diff --git a/recipes-core/base-passwd/files/input.patch b/recipes-core/base-passwd/files/input.patch new file mode 100644 index 0000000..3abbcad --- /dev/null +++ b/recipes-core/base-passwd/files/input.patch @@ -0,0 +1,22 @@ +Add an input group for the /dev/input/* devices. + +Upstream-Status: Inappropriate [configuration] + +Signed-off-by: Darren Hart dvhart@linux.intel.com + +--- + group.master | 1 + + 1 file changed, 1 insertion(+) + +Index: base-passwd-3.5.26/group.master +=================================================================== +--- base-passwd-3.5.26.orig/group.master ++++ base-passwd-3.5.26/group.master +@@ -12,6 +12,7 @@ uucp:*:10: + man:*:12: + proxy:*:13: + kmem:*:15: ++input:*:19: + dialout:*:20: + fax:*:21: + voice:*:22: diff --git a/recipes-core/base-passwd/files/kvm.patch b/recipes-core/base-passwd/files/kvm.patch new file mode 100644 index 0000000..113d515 --- /dev/null +++ b/recipes-core/base-passwd/files/kvm.patch @@ -0,0 +1,23 @@ +From 6355278b9f744291864c373a32a8da8f84aaaf37 Mon Sep 17 00:00:00 2001 +From: Jacob Kroon jacob.kroon@gmail.com +Date: Wed, 30 Jan 2019 04:53:48 +0000 +Subject: [PATCH] Add kvm group + +Upstream-Status: Pending +Signed-off-by: Jacob Kroon jacob.kroon@gmail.com +--- + group.master | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/group.master b/group.master +index cea9d60..5b62284 100644 +--- a/group.master ++++ b/group.master +@@ -34,6 +34,7 @@ utmp:*:43: + video:*:44: + sasl:*:45: + plugdev:*:46: ++kvm:*:47: + staff:*:50: + games:*:60: + shutdown:*:70: diff --git a/recipes-core/base-passwd/files/nobash.patch b/recipes-core/base-passwd/files/nobash.patch new file mode 100644 index 0000000..b5a6922 --- /dev/null +++ b/recipes-core/base-passwd/files/nobash.patch @@ -0,0 +1,15 @@ +use /bin/sh instead of /bin/bash, since the latter may not be included in +some images such as minimal + +Upstream-Status: Inappropriate [configuration] + +Signed-off-by: Scott Garman scott.a.garman@intel.com + +--- base-passwd/passwd.master~nobash ++++ base-passwd/passwd.master +@@ -1,4 +1,4 @@ +-root:*:0:0:root:/root:/bin/bash ++root:*:0:0:root:/root:/bin/sh + daemon:*:1:1:daemon:/usr/sbin:/bin/sh + bin:*:2:2:bin:/bin:/bin/sh + sys:*:3:3:sys:/dev:/bin/sh diff --git a/recipes-core/base-passwd/files/noshadow.patch b/recipes-core/base-passwd/files/noshadow.patch new file mode 100644 index 0000000..e27bf7d --- /dev/null +++ b/recipes-core/base-passwd/files/noshadow.patch @@ -0,0 +1,14 @@ +remove "*" for root since we don't have a /etc/shadow so far. + +Upstream-Status: Inappropriate [configuration] + +Signed-off-by: Scott Garman scott.a.garman@intel.com + +--- base-passwd/passwd.master~nobash ++++ base-passwd/passwd.master +@@ -1,4 +1,4 @@ +-root:*:0:0:root:/root:/bin/sh ++root::0:0:root:/root:/bin/sh + daemon:*:1:1:daemon:/usr/sbin:/bin/sh + bin:*:2:2:bin:/bin:/bin/sh + sys:*:3:3:sys:/dev:/bin/sh
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- ...st-ncurses-silence-capability-misuse.patch | 37 ++++++++ recipes-core/ncurses/ncurses-morello.inc | 87 +++++++++++++++++++ recipes-core/ncurses/ncurses-morello_6.4.bb | 16 ++++ recipes-core/ncurses/site_config/headers | 5 ++ 4 files changed, 145 insertions(+) create mode 100644 recipes-core/ncurses/cheri-patches/0001-test-ncurses-silence-capability-misuse.patch create mode 100644 recipes-core/ncurses/ncurses-morello.inc create mode 100644 recipes-core/ncurses/ncurses-morello_6.4.bb create mode 100644 recipes-core/ncurses/site_config/headers
diff --git a/recipes-core/ncurses/cheri-patches/0001-test-ncurses-silence-capability-misuse.patch b/recipes-core/ncurses/cheri-patches/0001-test-ncurses-silence-capability-misuse.patch new file mode 100644 index 0000000..4b13aa6 --- /dev/null +++ b/recipes-core/ncurses/cheri-patches/0001-test-ncurses-silence-capability-misuse.patch @@ -0,0 +1,37 @@ +From 41fce85513400f5fc6324516d5ac23628fc38ae2 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Tue, 11 Apr 2023 15:36:28 +0100 +Subject: [PATCH] test/ncurses: silence capability-misuse + +Cast the data to uintptr_t to silence the warning. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + test/ncurses.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/ncurses.c b/test/ncurses.c +index afa631ad..65040902 100644 +--- a/test/ncurses.c ++++ b/test/ncurses.c +@@ -6392,7 +6392,7 @@ make_field(int frow, int fcol, int rows, int cols, bool secure) + + if (f) { + set_field_back(f, A_UNDERLINE); +- set_field_userptr(f, (void *) 0); ++ set_field_userptr(f, (void *)(uintptr_t)0); + } + return (f); + } +@@ -6487,7 +6487,7 @@ edit_secure(FIELD *me, int c) + break; + } + } +- set_field_userptr(me, (void *) len); ++ set_field_userptr(me, (void *)(uintptr_t)len); + free(temp); + } + } +-- +2.34.1 + diff --git a/recipes-core/ncurses/ncurses-morello.inc b/recipes-core/ncurses/ncurses-morello.inc new file mode 100644 index 0000000..b45aaf1 --- /dev/null +++ b/recipes-core/ncurses/ncurses-morello.inc @@ -0,0 +1,87 @@ +inherit autotools pkgconfig purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-core/ncurses/*" + +SUMMARY = "The New Curses library" +DESCRIPTION = "SVr4 and XSI-Curses compatible curses library and terminfo tools including tic, infocmp, captoinfo. Supports color, multiple highlights, forms-drawing characters, and automatic recognition of keypad and function-key sequences. Extensions include resizable windows and mouse support on both xterm and Linux console using the gpm library." +HOMEPAGE = "http://www.gnu.org/software/ncurses/ncurses.html" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=c5a4600fdef86384c41ca33ecc70a4b8;endline=27" +SECTION = "libs" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +DEPENDS += "ncurses-native" + +do_configure() { + oe_runconf \ + --without-debug \ + --without-ada \ + --without-gpm \ + --enable-termcap \ + --enable-echo \ + --enable-warnings \ + --with-shared \ + --disable-big-core \ + --program-prefix= \ + --with-manpage-format=normal \ + --without-manpage-renames \ + --disable-stripping \ + --disable-rpath-hack \ + --without-cxx-binding \ + --without-cxx \ + --enable-overwrite +} + +do_compile() { + oe_runmake all +} + +do_install:append() { + ${OBJDUMP_COMMAND} ${D}${libdir}/libcurses.so > ${D}${PURECAP_DEBUGDIR}/libcurses.dump + ${READELF_COMMAND} ${D}${libdir}/libcurses.so > ${D}${PURECAP_DEBUGDIR}/libcurses.readelf +} + +PACKAGES += " \ + ${PN}-tools \ + ${PN}-terminfo-base \ + ${PN}-terminfo \ +" + +FILES:${PN} += "\ + ${bindir}/tput \ + ${bindir}/tset \ + ${bindir}/ncurses5-config \ + ${bindir}/ncursesw5-config \ + ${bindir}/ncurses6-config \ + ${bindir}/ncursesw6-config \ + ${datadir}/tabset \ +" + +# This keeps only tput/tset in ncurses +# clear/reset are in already busybox +FILES:${PN}-tools = "\ + ${bindir}/tic \ + ${bindir}/toe \ + ${bindir}/infotocap \ + ${bindir}/captoinfo \ + ${bindir}/infocmp \ + ${bindir}/tack \ + ${bindir}/tabs \ + ${bindir}/clear \ + ${bindir}/reset \ + " + +FILES:${PN}-terminfo = "\ + ${datadir}/terminfo \ + ${libdir}/terminfo \ +" + +FILES:${PN}-terminfo-base = "\ + ${sysconfdir}/terminfo \ +" + +# Putting terminfo into the sysroot adds around 2800 files to +# each recipe specific sysroot. We can live without this, particularly +# as many recipes may have native and target copies. +SYSROOT_DIRS:remove = "${datadir}" \ No newline at end of file diff --git a/recipes-core/ncurses/ncurses-morello_6.4.bb b/recipes-core/ncurses/ncurses-morello_6.4.bb new file mode 100644 index 0000000..6ba7111 --- /dev/null +++ b/recipes-core/ncurses/ncurses-morello_6.4.bb @@ -0,0 +1,16 @@ +require ncurses-morello.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/cheri-patches:" + +SRC_URI += "git://github.com/mirror/ncurses;protocol=https;branch=${SRCBRANCH} \ + file://0001-test-ncurses-silence-capability-misuse.patch \ + " + +SRCBRANCH = "master" +SRCREV = "79b9071f2be20a24c7be031655a5638f6032f29f" + +S = "${WORKDIR}/git" + +RPROVIDES:${PN} = "ncurses-morello" + +RDEPENDS:${PN} += "bash" diff --git a/recipes-core/ncurses/site_config/headers b/recipes-core/ncurses/site_config/headers new file mode 100644 index 0000000..087b7bf --- /dev/null +++ b/recipes-core/ncurses/site_config/headers @@ -0,0 +1,5 @@ +curses.h +ncurses/curses.h +ncurses.h +ncurses/termcap.h +
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- recipes-core/readline/files/inputrc | 61 +++++++++++++++++ recipes-core/readline/files/rl-native.map | 12 ++++ recipes-core/readline/readline-morello.inc | 68 +++++++++++++++++++ .../readline/readline-morello_8.1.2.bb | 7 ++ .../readline/readline/configure-fix.patch | 35 ++++++++++ recipes-core/readline/readline/norpath.patch | 21 ++++++ 6 files changed, 204 insertions(+) create mode 100644 recipes-core/readline/files/inputrc create mode 100644 recipes-core/readline/files/rl-native.map create mode 100644 recipes-core/readline/readline-morello.inc create mode 100644 recipes-core/readline/readline-morello_8.1.2.bb create mode 100644 recipes-core/readline/readline/configure-fix.patch create mode 100644 recipes-core/readline/readline/norpath.patch
diff --git a/recipes-core/readline/files/inputrc b/recipes-core/readline/files/inputrc new file mode 100644 index 0000000..b5c4c8a --- /dev/null +++ b/recipes-core/readline/files/inputrc @@ -0,0 +1,61 @@ +# /etc/inputrc - global inputrc for libreadline +# See readline(3readline) and `info rluserman' for more information. + +# Be 8 bit clean. +set input-meta on +set output-meta on + +# To allow the use of 8bit-characters like the german umlauts, comment out +# the line below. However this makes the meta key not work as a meta key, +# which is annoying to those which don't need to type in 8-bit characters. + +# set convert-meta off + +# try to enable the application keypad when it is called. Some systems +# need this to enable the arrow keys. +# set enable-keypad on + +# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys + +# do not bell on tab-completion +# set bell-style none + +# some defaults / modifications for the emacs mode +$if mode=emacs + +# allow the use of the Home/End keys +# "\e[1~": beginning-of-line +# "\e[4~": end-of-line + +# allow the use of the Delete/Insert keys +# "\e[3~": delete-char +# "\e[2~": quoted-insert + +# mappings for "page up" and "page down" to step to the beginning/end +# of the history +# "\e[5~": beginning-of-history +# "\e[6~": end-of-history + +# alternate mappings for "page up" and "page down" to search the history +# "\e[5~": history-search-backward +# "\e[6~": history-search-forward + +# # mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving +# "\e[5C": forward-word +# "\e[5D": backward-word +# "\e\e[C": forward-word +# "\e\e[D": backward-word + +# $if term=rxvt +# "\e[8~": end-of-line +# $endif + +# for non RH/Debian xterm, can't hurt for RH/DEbian xterm +# "\eOH": beginning-of-line +# "\eOF": end-of-line + +# for freebsd console +# "\e[H": beginning-of-line +# "\e[F": end-of-line + +$endif diff --git a/recipes-core/readline/files/rl-native.map b/recipes-core/readline/files/rl-native.map new file mode 100644 index 0000000..5e7d49c --- /dev/null +++ b/recipes-core/readline/files/rl-native.map @@ -0,0 +1,12 @@ +READLINE_6.3 { + rl_change_environment; + rl_clear_history; + rl_executing_key; + rl_executing_keyseq; + rl_filename_stat_hook; + rl_history_substr_search_backward; + rl_history_substr_search_forward; + rl_input_available_hook; + rl_print_last_kbd_macro; + rl_signal_event_hook; +}; diff --git a/recipes-core/readline/readline-morello.inc b/recipes-core/readline/readline-morello.inc new file mode 100644 index 0000000..9c45b7d --- /dev/null +++ b/recipes-core/readline/readline-morello.inc @@ -0,0 +1,68 @@ +inherit update-alternatives purecap-sysroot +inherit autotools texinfo + +MORELLO_SRC = "poky/meta/recipes-core/readline/readlinge_8.1.2.bb" + +SUMMARY = "Library for editing typed command lines" +DESCRIPTION = "The GNU Readline library provides a set of functions for use by applications that allow users to edit \ +command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes \ +additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those \ +lines, and perform csh-like history expansion on previous commands." +SECTION = "libs" +HOMEPAGE = "https://tiswww.case.edu/php/chet/readline/rltop.html" + +# GPL-2.0-or-later (< 6.0), GPL-3.0-or-later (>= 6.0) +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +DEPENDS += "ncurses-morello" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:${THISDIR}/readline:" + +SRC_URI = "${GNU_MIRROR}/readline/${BPN_READLINE}-${PV_READLINE}.tar.gz;name=archive" +SRC_URI += "file://inputrc" + +S = "${WORKDIR}/${BPN_READLINE}-${PV_READLINE}" +B = "${WORKDIR}/build" + +BPN_READLINE = "readline" +PV_READLINE = "8.1.2" + + +EXTRA_AUTORECONF += "--exclude=autoheader" +EXTRA_OECONF += "bash_cv_termcap_lib=ncurses" + +LEAD_SONAME = "libreadline.so" + +do_configure:prepend () { + if [ ! -e ${S}/acinclude.m4 ]; then + cat ${S}/aclocal.m4 > ${S}/acinclude.m4 + fi +} + +do_install:append() { + + # Make install doesn't properly install these + oe_libinstall -so -C shlib libhistory ${D}${libdir} + oe_libinstall -so -C shlib libreadline ${D}${libdir} + + rmdir ${D}${bindir} + rm -rf ${D}${datadir}/${BPN_READLINE}/*.c + rmdir ${D}${datadir}/${BPN_READLINE} || true + + install -m 0755 -d ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/inputrc ${D}${sysconfdir}/inputrc +} + +CONFFILES:${PN} += "${sysconfdir}/inputrc" + +ALTERNATIVE_PRIORITY = "100" +ALTERNATIVE:${PN}-doc = "history.3" +ALTERNATIVE_LINK_NAME[history.3] = "${mandir}/man3/history.3" + +# OpenSuse injects versions into libreadline leading to conficits between our native one and theirs +# see their spec file for where this is injected. Extra versioning is harmless so we just do the same. +SRC_URI:append:class-native = " file://rl-native.map" +LDFLAGS:append:class-native = " -Wl,--version-script=${WORKDIR}/rl-native.map" diff --git a/recipes-core/readline/readline-morello_8.1.2.bb b/recipes-core/readline/readline-morello_8.1.2.bb new file mode 100644 index 0000000..99f25e8 --- /dev/null +++ b/recipes-core/readline/readline-morello_8.1.2.bb @@ -0,0 +1,7 @@ +require readline-morello.inc + +SRC_URI += "file://configure-fix.patch \ + file://norpath.patch \ + " + +SRC_URI[archive.sha256sum] = "7589a2381a8419e68654a47623ce7dfcb756815c8fee726b98f90bf668af7bc6" diff --git a/recipes-core/readline/readline/configure-fix.patch b/recipes-core/readline/readline/configure-fix.patch new file mode 100644 index 0000000..ef3104f --- /dev/null +++ b/recipes-core/readline/readline/configure-fix.patch @@ -0,0 +1,35 @@ +Upstream-Status: Pending + +Without this it fails to link against libtermcap causing various missing +symbols issues. + +RP - 8/10/08 + +Support 6.3 which uses configure.ac rather than configure.in. +Signed-off-by: Hongxu Jia hongxu.jia@windriver.com +--- + configure.ac | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/configure.ac b/configure.ac +index cea8f91..9075b8f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -218,10 +218,10 @@ if test -f ${srcdir}/support/shobj-conf; then + AC_MSG_CHECKING(configuration for building shared libraries) + eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}` + +-# case "$SHLIB_LIBS" in +-# *curses*|*termcap*|*termlib*) ;; +-# *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;; +-# esac ++ case "$SHLIB_LIBS" in ++ *curses*|*termcap*|*termlib*) ;; ++ *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;; ++ esac + + AC_SUBST(SHOBJ_CC) + AC_SUBST(SHOBJ_CFLAGS) +-- +1.8.1.2 + diff --git a/recipes-core/readline/readline/norpath.patch b/recipes-core/readline/readline/norpath.patch new file mode 100644 index 0000000..5d71582 --- /dev/null +++ b/recipes-core/readline/readline/norpath.patch @@ -0,0 +1,21 @@ +This support script ends up hardcoding unnecessary rpaths into the libraries. We +will search $libdir automatically so this is just wastes space. There may be some +cases this is necessary but our use cases aren't one of them. + +Upstream-Status: Inappropriate + +RP 2012/2/23 + +Index: readline-6.2/support/shobj-conf +=================================================================== +--- readline-6.2.orig/support/shobj-conf 2012-02-23 11:06:37.193179379 +0000 ++++ readline-6.2/support/shobj-conf 2012-02-23 11:06:50.049178918 +0000 +@@ -114,7 +114,7 @@ + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' + +- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`' ++ SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; +
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- .../util-linux/util-linux-morello_2.37.4.bb | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 recipes-core/util-linux/util-linux-morello_2.37.4.bb
diff --git a/recipes-core/util-linux/util-linux-morello_2.37.4.bb b/recipes-core/util-linux/util-linux-morello_2.37.4.bb new file mode 100644 index 0000000..98ad321 --- /dev/null +++ b/recipes-core/util-linux/util-linux-morello_2.37.4.bb @@ -0,0 +1,23 @@ +require recipes-core/util-linux/util-linux.inc + +inherit autotools gettext pkgconfig pure-cap-kheaders purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-core/util-linux/util-linux_2.37.4.bb" + +SUMMARY = "A suite of basic system administration utilities" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +PV = "2.37.4" + +S = "${WORKDIR}/util-linux-${PV}" +EXTRA_OECONF += "--disable-all-programs --enable-libuuid" +LICENSE = "BSD-3-Clause" + +do_install() { + install_dir="${D}" + install -d ${install_dir} + oe_runmake DESTDIR=${install_dir} install + rm -rf ${install_dir}${datadir} ${install_dir}${bindir} ${install_dir}${base_bindir} \ + ${install_dir}${sbindir} ${install_dir}${base_sbindir} ${install_dir}${exec_prefix}/sbin +} \ No newline at end of file
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- recipes-core/zlib/files/run-ptest | 7 ++++ recipes-core/zlib/zlib-morello_1.2.13.bb | 43 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 recipes-core/zlib/files/run-ptest create mode 100644 recipes-core/zlib/zlib-morello_1.2.13.bb
diff --git a/recipes-core/zlib/files/run-ptest b/recipes-core/zlib/files/run-ptest new file mode 100644 index 0000000..065863e --- /dev/null +++ b/recipes-core/zlib/files/run-ptest @@ -0,0 +1,7 @@ +#!/bin/sh + +if ./examplesh ; then + echo "PASS: zlib" +else + echo "FAIL: zlib" +fi diff --git a/recipes-core/zlib/zlib-morello_1.2.13.bb b/recipes-core/zlib/zlib-morello_1.2.13.bb new file mode 100644 index 0000000..adf961c --- /dev/null +++ b/recipes-core/zlib/zlib-morello_1.2.13.bb @@ -0,0 +1,43 @@ +inherit ptest purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-core/zlib/zlib_1.2.11.bb" + +SUMMARY = "Zlib Compression Library" +DESCRIPTION = "Zlib is a general-purpose, patent-free, lossless data compression \ +library which is used by many different programs." + +HOMEPAGE = "http://zlib.net/" +SECTION = "libs" +LICENSE = "Zlib" +LIC_FILES_CHKSUM = "file://zlib.h;beginline=6;endline=23;md5=5377232268e952e9ef63bc555f7aa6c0" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +SRC_URI = "git://github.com/madler/zlib;protocol=https;branch=${SRCBRANCH} \ + file://run-ptest \ + " +SRCREV = "04f42ceca40f73e2978b50e93806c2a18c1281fc" +SRCBRANCH = "master" + +CFLAGS += "-D_REENTRANT" + +RDEPENDS:${PN}-ptest += "make" + +S = "${WORKDIR}/git" + +do_configure() { + LDCONFIG=true ./configure --prefix=${prefix} --libdir=${libdir} --uname=GNU +} + +do_compile() { + oe_runmake shared +} + +do_install() { + oe_runmake DESTDIR=${D} install +} + +do_install_ptest() { + install -d ${D}${PURECAP_SYSROOT_DIR}${PTEST_PATH} + install ${B}/examplesh ${D}${PURECAP_SYSROOT_DIR}${PTEST_PATH} +} \ No newline at end of file
Co-authored-by: Harrison Carter hcarter@thegoodpenguin.co.uk Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- ...gument-order-to-qsort_r-to-match-pos.patch | 45 ++ ...change-defines-from-freebsd-to-cheri.patch | 57 +++ ...n-bypass-autoconf-2.69-version-check.patch | 30 ++ recipes-dbs/postgresql/postgresql-morello.inc | 400 ++++++++++++++++++ .../postgresql/postgresql-morello_9.6.bb | 155 +++++++ recipes-dbs/postgresql/postgresql/pg_config | 15 + .../postgresql/postgresql/postgres-bench | 16 + .../postgresql/postgresql/postgres-test | 49 +++ .../postgresql/postgresql/postgresql-init | 64 +++ .../postgresql/postgresql-init.service | 19 + .../postgresql/postgresql-morello.init | 193 +++++++++ .../postgresql/postgresql-morello.service | 29 ++ .../postgresql/postgresql/postgresql-profile | 4 + .../postgresql/postgresql/postgresql-setup | 73 ++++ .../postgresql/postgresql/postgresql.pam | 4 + .../postgresql/postgresql/test-schedule | 1 + recipes-dbs/postgresql/postgresql_%.bbappend | 7 + 17 files changed, 1161 insertions(+) create mode 100644 recipes-dbs/postgresql/cheri-patches/0001-port.h-change-argument-order-to-qsort_r-to-match-pos.patch create mode 100644 recipes-dbs/postgresql/cheri-patches/0002-qsort-change-defines-from-freebsd-to-cheri.patch create mode 100644 recipes-dbs/postgresql/files/0003-configure.in-bypass-autoconf-2.69-version-check.patch create mode 100644 recipes-dbs/postgresql/postgresql-morello.inc create mode 100644 recipes-dbs/postgresql/postgresql-morello_9.6.bb create mode 100755 recipes-dbs/postgresql/postgresql/pg_config create mode 100644 recipes-dbs/postgresql/postgresql/postgres-bench create mode 100644 recipes-dbs/postgresql/postgresql/postgres-test create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-init create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-init.service create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-morello.init create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-morello.service create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-profile create mode 100644 recipes-dbs/postgresql/postgresql/postgresql-setup create mode 100644 recipes-dbs/postgresql/postgresql/postgresql.pam create mode 100644 recipes-dbs/postgresql/postgresql/test-schedule create mode 100644 recipes-dbs/postgresql/postgresql_%.bbappend
diff --git a/recipes-dbs/postgresql/cheri-patches/0001-port.h-change-argument-order-to-qsort_r-to-match-pos.patch b/recipes-dbs/postgresql/cheri-patches/0001-port.h-change-argument-order-to-qsort_r-to-match-pos.patch new file mode 100644 index 0000000..a88b780 --- /dev/null +++ b/recipes-dbs/postgresql/cheri-patches/0001-port.h-change-argument-order-to-qsort_r-to-match-pos.patch @@ -0,0 +1,45 @@ +From daa2184cb2d3df09e1911402e768685ff456cc1f Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Fri, 10 Nov 2023 14:12:37 +0000 +Subject: [PATCH] port.h: change argument order to qsort_r to match posix + +The original codebase is aimed at FreeBSD OS. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk + +--- + src/include/port.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/include/port.h b/src/include/port.h +index 10c8ba1194..bddb510e8a 100644 +--- a/src/include/port.h ++++ b/src/include/port.h +@@ -440,7 +440,7 @@ extern void pg_qsort(void *base, size_t nel, size_t elsize, + /* Use ifdef FreeBSD and not __CHERI_PURE_CAPABILITY__ so that we use the same code path for MIPS and CHERI */ + #ifdef __FreeBSD__ + /* Postgres qsort_arg is broken for capabilities so we replace it with qsort_r but that uses a different parameter order for cmp */ +-typedef int (*qsort_arg_comparator) (void *arg, const void *a, const void *b); ++typedef int (*qsort_arg_comparator) (const void *a, const void *b, void *arg); + /* + * XXXAR: the postgres version of qsort_arg does not work with capabilities (swap + * is broken) so we have to make sure to use the libc function qsort_r instead +@@ -448,15 +448,15 @@ typedef int (*qsort_arg_comparator) (void *arg, const void *a, const void *b); + static inline void + qsort_arg(void *a, size_t n, size_t es, qsort_arg_comparator cmp, void *arg) + { +- qsort_r(a, n, es, arg, cmp); ++ qsort_r(a, n, es, cmp, arg); + } + // NOTE: FreeBSD and Linux qsort_r are completely incompatible due to different argument order + // Generating a non-obvious function name avoids stupid errors like in tsrank.c where the function is then called wrongly + + #define QSORT_ARG_COMPARATOR_FUNC(name, a, b) \ +- int _##name##_freebsd_cmp(void *arg, const void *a, const void *b) ++ int _##name##_freebsd_cmp(const void *a, const void *b, void *arg) + #define QSORT_ARG_COMPARATOR_PTR(name) &_##name##_freebsd_cmp +-#define CALL_QSORT_ARG_COMPARATOR(name, a, b, arg) _##name##_freebsd_cmp(arg, a, b) ++#define CALL_QSORT_ARG_COMPARATOR(name, a, b, arg) _##name##_freebsd_cmp(a, b, arg) + #else + /* #warning "Using postgres qsort" */ + #define qsort(a,b,c,d) pg_qsort(a,b,c,d) diff --git a/recipes-dbs/postgresql/cheri-patches/0002-qsort-change-defines-from-freebsd-to-cheri.patch b/recipes-dbs/postgresql/cheri-patches/0002-qsort-change-defines-from-freebsd-to-cheri.patch new file mode 100644 index 0000000..0267382 --- /dev/null +++ b/recipes-dbs/postgresql/cheri-patches/0002-qsort-change-defines-from-freebsd-to-cheri.patch @@ -0,0 +1,57 @@ +From d7c33a58cd02ae15ebdcc6585f568f5f3d8914bd Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Thu, 11 May 2023 15:37:01 +0100 +Subject: [PATCH] qsort: change defines from freebsd to cheri + +This is not FreeBSD OS, so the pre-processor will not do what it should +and the postgres qsrot will be used. + +Lets fix it without due care. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk + +--- + src/include/port.h | 2 +- + src/port/qsort.c | 2 +- + src/port/qsort_arg.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/include/port.h b/src/include/port.h +index bddb510e8a..27e7dad9c2 100644 +--- a/src/include/port.h ++++ b/src/include/port.h +@@ -438,7 +438,7 @@ extern void pg_qsort(void *base, size_t nel, size_t elsize, + int (*cmp) (const void *, const void *)); + + /* Use ifdef FreeBSD and not __CHERI_PURE_CAPABILITY__ so that we use the same code path for MIPS and CHERI */ +-#ifdef __FreeBSD__ ++#ifdef __CHERI_PURE_CAPABILITY__ + /* Postgres qsort_arg is broken for capabilities so we replace it with qsort_r but that uses a different parameter order for cmp */ + typedef int (*qsort_arg_comparator) (const void *a, const void *b, void *arg); + /* +diff --git a/src/port/qsort.c b/src/port/qsort.c +index 8a75ff492e..50af3ebb02 100644 +--- a/src/port/qsort.c ++++ b/src/port/qsort.c +@@ -46,7 +46,7 @@ + + #include "c.h" + +-#ifdef __FreeBSD__ ++#ifdef __CHERI_PURE_CAPABILITY__ + /* + * XXXAR: the postgres version of qsort does not work with capabilities (swap + * is broken) so we have to make sure to use the libc version +diff --git a/src/port/qsort_arg.c b/src/port/qsort_arg.c +index 90bbf16541..fb1d5fc6ff 100644 +--- a/src/port/qsort_arg.c ++++ b/src/port/qsort_arg.c +@@ -46,7 +46,7 @@ + + #include "c.h" + +-#ifndef __FreeBSD__ ++#ifndef __CHERI_PURE_CAPABILITY__ + #warning "using postgres custom qsort_arg function" + + static char *med3(char *a, char *b, char *c, diff --git a/recipes-dbs/postgresql/files/0003-configure.in-bypass-autoconf-2.69-version-check.patch b/recipes-dbs/postgresql/files/0003-configure.in-bypass-autoconf-2.69-version-check.patch new file mode 100644 index 0000000..d845b95 --- /dev/null +++ b/recipes-dbs/postgresql/files/0003-configure.in-bypass-autoconf-2.69-version-check.patch @@ -0,0 +1,30 @@ +From 632f02e741878b3e3d3b156cf33595c5f8329e27 Mon Sep 17 00:00:00 2001 +From: Yi Fan Yu yifan.yu@windriver.com +Date: Fri, 5 Feb 2021 17:15:42 -0500 +Subject: [PATCH] configure.ac: bypass autoconf 2.69 version check + +for upgrade to autoconf 2.71 + +Upstream-Status: Inappropriate [disable feature] + +Signed-off-by: Yi Fan Yu yifan.yu@windriver.com + +--- + configure.in | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/configure.in b/configure.in +index c669ff2a21..ff1b326eb7 100644 +--- a/configure.in ++++ b/configure.in +@@ -19,10 +19,6 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros + + AC_INIT([PostgreSQL], [9.6.14], [pgsql-bugs@postgresql.org]) + +-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required. +-Untested combinations of 'autoconf' and PostgreSQL versions are not +-recommended. You can remove the check from 'configure.in' but it is then +-your responsibility whether the result works or not.])]) + AC_COPYRIGHT([Copyright (c) 1996-2016, PostgreSQL Global Development Group]) + AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c]) + AC_CONFIG_AUX_DIR(config) diff --git a/recipes-dbs/postgresql/postgresql-morello.inc b/recipes-dbs/postgresql/postgresql-morello.inc new file mode 100644 index 0000000..e4bccbe --- /dev/null +++ b/recipes-dbs/postgresql/postgresql-morello.inc @@ -0,0 +1,400 @@ +inherit autotools pkgconfig perlnative python3native python3targetconfig +inherit useradd update-rc.d systemd gettext cpan-base pure-cap-kheaders purecap-sysroot purecap-useradd +inherit perl-hacks + +MORELLO_SRC = "meta-openembedded/meta-oe/recipes-dbs/postgresql/postgresql_14.5" +MORELLO_SRC += "meta-cloud-services/meta-openstack/recipes-dbs/postgresql/*" + +SUMMARY = "PostgreSQL is a powerful, open source relational database system" +DESCRIPTION = "\ + PostgreSQL is an advanced Object-Relational database management system \ + (DBMS) that supports almost all SQL constructs (including \ + transactions, subselects and user-defined types and functions). The \ + postgresql package includes the client programs and libraries that \ + you'll need to access a PostgreSQL DBMS server. These PostgreSQL \ + client programs are programs that directly manipulate the internal \ + structure of PostgreSQL databases on a PostgreSQL server. These client \ + programs can be located on the same machine with the PostgreSQL \ + server, or may be on a remote machine which accesses a PostgreSQL \ + server over a network connection. This package contains the docs \ + in HTML for the whole package, as well as command-line utilities for \ + managing PostgreSQL databases on a PostgreSQL server. \ + \ + If you want to manipulate a PostgreSQL database on a local or remote \ + PostgreSQL server, you need this package. You also need to install \ + this package if you're installing the postgresql-server package. \ + \ +" +HOMEPAGE = "http://www.postgresql.com" +LICENSE = "0BSD" + +DEPENDS += "readline-morello zlib-morello openssl-morello util-linux-morello tcl-morello" +DEPENDS += "libnsl2 tzcode-native" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +BPN_POSTGRESQL="postgresql" + +ARM_INSTRUCTION_SET = "arm" + +# used for hacking +MORELLO = "-morello" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:${THISDIR}/postgresql:" + +S = "${WORKDIR}/postgresql-${PV}" + +LEAD_SONAME = "libpq.so" + +# LDFLAGS for shared libraries +export LDFLAGS_SL = "${LDFLAGS}" + +CFLAGS += "-I${STAGING_DIR_HOST}/usr/include/${PYTHON_DIR} -I${STAGING_INCDIR}/tcl8.6 -Wno-unused-function -pipe -msoft-float -integrated-as -O0 -g" +CLAGS += "-Wno-deprecated-declarations -Wno-compound-token-split-by-macro" +LDFLAGS += "-pthread" + +SYSTEMD_SERVICE:${PN} = "postgresql.service" +SYSTEMD_AUTO_ENABLE:${PN} = "disable" + +pkg_postinst:${PN} () { + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then + if [ -n "$D" ]; then + OPTS="--root=$D" + fi + systemctl $OPTS mask postgresql-server.service + fi +} + +PACKAGECONFIG ??= " \ + ${@bb.utils.filter('DISTRO_FEATURES', 'pam systemd', d)} \ + openssl uuid tcl perl zlib \ +" + +EXTRA_OECONF += "--enable-thread-safety \ + --datadir=${datadir}/${BPN_POSTGRESQL} \ + --sysconfdir=${sysconfdir}/${BPN_POSTGRESQL} \ + --enable-debug \ + --without-systemd \ +" + +CFLAGS += "-DUSE_ASSERT_CHECKING" + +PACKAGES_DYNAMIC += "^${PN}-plperl \ + ^${PN}-pltcl \ + ^${PN}-plpython \ +" + +python populate_packages:prepend() { + + def fill_more(name): + if name is None or name.strip() == "": + return + + fpack=d.getVar('PACKAGES', False) or "" + fpack="${PN}-" + name + " " + fpack + d.setVar('PACKAGES', fpack) + + conf=(d.getVar('PACKAGECONFIG') or "").split() + pack=d.getVar('PACKAGES', False) or "" + bb.debug(1, "PACKAGECONFIG=%s" % conf) + bb.debug(1, "PACKAGES1=%s" % pack ) + + if "perl" in conf : + fill_more("plperl") + + if "tcl" in conf: + fill_more("pltcl") + + if "python" in conf: + fill_more("plpython") + + pack=d.getVar('PACKAGES') or "" + bb.debug(1, "PACKAGES2=%s" % pack) + +} + +# This will make native perl use target settings (for include dirs etc.) +# there is no perl in purecap, so yet another hack: hardcode the version and target +export PERLCONFIGTARGET = "${@is_target(d)}" +export PERL_ARCHLIB = "${STAGING_LIBDIR_HACK}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}" + +do_configure() { + + # do_configure + autotools_do_configure + + # do_configure:append + # workaround perl package related bugs + sed -i -e "s:-L/usr/local/lib:-L=/usr/local/lib:g" \ + ${B}/src/Makefile.global + LIBPNA="${STAGING_LIBDIR_NATIVE}/perl-native" + LIBNA="${STAGING_LIBDIR_NATIVE}" + BLIBNA="${STAGING_BASE_LIBDIR_NATIVE}" + sed -i -e "/^perl_archlibexp/s:${LIBPNA}:${STAGING_LIBDIR_HACK}:g" \ + ${B}/src/Makefile.global + sed -i -e "/^perl_privlibexp/s:/usr/lib:${STAGING_LIBDIR_HACK}:g" \ + ${B}/src/Makefile.global + # remove the rpath, replace with correct lib path + sed -i \ + -e "/^perl_embed_ldflags/s:-Wl,-rpath,${LIBNA}::g" \ + -e "/^perl_embed_ldflags/s:-Wl,-rpath,${BLIBNA}::g" \ + -e "/^perl_embed_ldflags/s:-Wl,-rpath-link,${LIBNA}::g" \ + -e "/^perl_embed_ldflags/s:-Wl,-rpath-link,${BLIBNA}::g" \ + -e "/^perl_embed_ldflags/s:${LIBPNA}:${STAGING_LIBDIR_HACK}:g" \ + -e "/^perl_embed_ldflags/s:${LIBNA}:${STAGING_LIBDIR_HACK}:g" \ + -e "/^perl_embed_ldflags/s:${BLIBNA}:${STAGING_BASELIBDIR_HACK}:g" \ + -e "/^TCLSH/s:=.*:= /usr/bin/tclsh:g" \ + ${B}/src/Makefile.global + + if ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'true', 'false', d)}; then + # workaround perl package's libperl.so problem + # we are using perlnative so this perl should have same version + perl_version=`perl -v 2>/dev/null | \ + sed -n 's/This is perl.*v[a-z ]*([0-9].[0-9][0-9.]*).*$/\1/p'` + if [ ! -h "${STAGING_LIBDIR_HACK}/perl/$perl_version/CORE/libperl.so" -a \ + ! -h "${STAGING_LIBDIR_HACK}/libperl.so" ]; then + ln -sf ../../../libperl.so.5 \ + ${STAGING_LIBDIR_HACK}/perl/$perl_version/CORE/libperl.so + fi + fi +} + +do_compile:append() { + oe_runmake -C contrib all +} + +# server needs to configure user and group +usernum = "28" +groupnum = "28" +USERADD_PACKAGES = "${PN}" +USERADD_PARAM:${PN} = "-M -g postgres -o -r -d ${localstatedir}/lib/${BPN_POSTGRESQL} \ + -s /bin/sh -c 'PostgreSQL Server' -u ${usernum} postgres" +GROUPADD_PARAM:${PN} = "-g ${groupnum} -o -r postgres" + +INITSCRIPT_PACKAGES = "${PN}" +INITSCRIPT_NAME = "${BPN}-server" +INITSCRIPT_PARAMS = "start 64 . stop 36 0 1 2 3 4 5 6 ." + +do_install() { + + install_dir="${D}" + + install -d ${install_dir} + oe_runmake DESTDIR=${install_dir} install + + # install contrib + oe_runmake DESTDIR=${install_dir} -C contrib install + # install tutorial + install -d -m 0755 ${install_dir}${libdir}/${BPN_POSTGRESQL}/tutorial + install ${B}/src/tutorial/* ${install_dir}${libdir}/${BPN_POSTGRESQL}/tutorial + + # install COPYRIGHT README HISTORY + install -d -m 0755 ${install_dir}${docdir}/${BPN_POSTGRESQL} + for i in ${B}/COPYRIGHT ${B}/README ${B}/HISTORY ${B}/doc/KNOWN_BUGS ${B}/doc/MISSING_FEATURES ${B}/doc/README* ${B}/doc/bug.template; do + [ -f $i ] && install $i ${install_dir}${docdir}/${BPN_POSTGRESQL} + done + + # install dirs and server init + install -d ${install_dir}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/postgresql-morello.init ${install_dir}${sysconfdir}/init.d/${BPN}-server + sed -i -e "s/^PGVERSION=.*$/PGVERSION=${PVBASE}/g" ${install_dir}${sysconfdir}/init.d/${BPN}-server + install -m 0755 ${WORKDIR}/postgresql-setup ${install_dir}${bindir}/${BPN}-setup + + install -d -m 700 ${install_dir}${localstatedir}/lib/${BPN_POSTGRESQL}/data + install -d -m 700 ${install_dir}${localstatedir}/lib/${BPN_POSTGRESQL}/backups + install -m 644 ${WORKDIR}/postgresql-profile ${install_dir}${localstatedir}/lib/${BPN_POSTGRESQL}/.profile + + chown -R postgres:postgres ${install_dir}${localstatedir}/lib/${BPN_POSTGRESQL} + + # multiple server config directory + install -d -m 700 ${install_dir}${sysconfdir}/default/${BPN_POSTGRESQL} + + if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then + install -d ${install_dir}${sysconfdir}/pam.d + install -m 644 ${WORKDIR}/postgresql.pam ${install_dir}${sysconfdir}/pam.d/postgresql + fi + + # Remove the build path + if [ -f ${install_dir}${libdir}/${BPN_POSTGRESQL}/pgxs/src/Makefile.global ]; then + sed -i -e 's#${RECIPE_SYSROOT}##g' \ + -e 's#${RECIPE_SYSROOT_NATIVE}##g' \ + -e 's#${WORKDIR}##g' \ + -e 's#${TMPDIR}##g' \ + ${install_dir}${libdir}/${BPN_POSTGRESQL}/pgxs/src/Makefile.global + fi + + install -d ${install_dir}${libdir}/${BPN_POSTGRESQL}/pgxs/src/test/regress + cp -rf ${S}/src/test/regress ${install_dir}${libdir}/${BPN_POSTGRESQL}/pgxs/src/test +} + +do_install:append() { + # we need a fake pg_config as some lib configs will try to run pg_config... + # probably could do with a native flavour + + install -d ${D}${bindir}/pgconfig + install -m 755 ${WORKDIR}/pg_config ${D}${bindir}/pgconfig/pg_config +} + +SSTATE_SCAN_FILES += "Makefile.global" +SSTATE_SCAN_FILES:remove = "*_config" + +PACKAGES =+ "${PN}-client ${PN}-server-dev ${PN}-timezone \ + libecpg${MORELLO}compat libecpg${MORELLO}-compat-dev \ + libecpg${MORELLO} libecpg${MORELLO}-dev libecpg${MORELLO}-staticdev libecpg${MORELLO}-doc \ + libpq${MORELLO} libpq${MORELLO}-dev libpq${MORELLO}-staticdev \ + libpgtypes${MORELLO} libpgtypes${MORELLO}-staticdev libpgtypes${MORELLO}-dev \ + ${PN}-contrib \ +" + +RPROVIDES:${PN}-dbg += "libecpg${MORELLO}-compat-dbg \ + libecpg${MORELLO}-dbg \ + libpq${MORELLO}-dbg \ + libpgtypes${MORELLO}-dbg \ + ${PN}-contrib-dbg \ + ${PN}-pltcl-dbg \ + ${PN}-plpython-dbg \ + ${PN}-plperl-dbg \ + " + +FILES:${PN} += "${sysconfdir}/${BPN_POSTGRESQL} ${libdir} ${bindir}/pg_config_fake \ + ${sysconfdir}/init.d/${BPN}-server \ + ${localstatedir}/lib/${BPN_POSTGRESQL}/data ${localstatedir}/lib/${BPN_POSTGRESQL}/backups \ + ${localstatedir}/lib/${BPN_POSTGRESQL}/.profile ${sysconfdir}/default/${BPN_POSTGRESQL} \ + ${libdir}/${BPN_POSTGRESQL}/dict_snowball.so ${libdir}/${BPN_POSTGRESQL}/plpgsql.so \ + ${libdir}/${BPN_POSTGRESQL}/euc2004_sjis2004.so \ + ${libdir}/${BPN_POSTGRESQL}/libpqwalreceiver.so \ + ${libdir}/${BPN_POSTGRESQL}/*_and_*.so \ + ${@'${sysconfdir}/pam.d/postgresql-morello' \ + if 'pam' == d.getVar('enable_pam') \ + else ''} \ + ${datadir} \ +" + +FILES:${PN}-client = "${bindir}/clusterdb \ + ${bindir}/createdb \ + ${bindir}/createuser \ + ${bindir}/dropdb \ + ${bindir}/dropuser \ + ${bindir}/pg_dump \ + ${bindir}/pg_dumpall \ + ${bindir}/pg_restore \ + ${bindir}/psql \ + ${bindir}/reindexdb \ + ${bindir}/vacuumdb \ + ${bindir}/vacuumlo \ + ${datadir}/${BPN_POSTGRESQL}/psqlrc.sample \ +" +FILES:${PN}-client-doc = "${mandir}/man1/clusterdb.* \ + ${mandir}/man1/createdb.* ${mandir}/man1/createlang.* \ + ${mandir}/man1/createuser.* ${mandir}/man1/dropdb.* \ + ${mandir}/man1/droplang.* ${mandir}/man1/dropuser.* \ + ${mandir}/man1/pg_dump.* ${mandir}/man1/pg_dumpall.* \ + ${mandir}/man1/pg_restore.* ${mandir}/man1/psql.* \ + ${mandir}/man1/reindexdb.* ${mandir}/man1/vacuumdb.* \ + ${mandir}/man7/* \ +" +FILES:${PN}-doc += "${docdir}/${BPN_POSTGRESQL}/html ${libdir}/${BPN_POSTGRESQL}/tutorial/ \ + ${mandir}/man1/initdb.* ${mandir}/man1/pg_controldata.* \ + ${mandir}/man1/pg_ctl.* ${mandir}/man1/pg_resetxlog.* \ + ${mandir}/man1/postgres.* ${mandir}/man1/postmaster.* \ + ${mandir} ${docdir} \ +" +FILES:${PN}-timezone = "${datadir}/${BPN_POSTGRESQL}/timezone \ + ${datadir}/${BPN_POSTGRESQL}/timezonesets \ +" + +FILES:${PN}-server-dev = "${includedir}/${BPN_POSTGRESQL}/server \ + ${libdir}/${BPN_POSTGRESQL}/pgxs \ +" + +FILES:libecpg${MORELLO} = "${libdir}/libecpg*${SOLIBS}" +FILES:libecpg${MORELLO}-dev = "${libdir}/libecpg*${SOLIBSDEV} \ + ${libdir}/libpgtypes*${SOLIBSDEV} \ + ${includedir}/ecpg*.h ${includedir}/${BPN_POSTGRESQL}/ecpg*.h \ + ${includedir}/pgtypes*.h ${includedir}/${BPN_POSTGRESQL}/informix \ + ${includedir}/sql3types.h ${includedir}/sqlca.h \ +" + +FILES:libecpg${MORELLO}-doc = "${mandir}/man1/ecpg.*" +FILES:libecpg${MORELLO}-staticdev = "${libdir}/libecpg*.a" +SECTION:libecpg${MORELLO}-staticdev = "devel" +RDEPENDS:libecpg${MORELLO}-staticdev = "libecpg${MORELLO}-dev (= ${EXTENDPKGV})" + +FILES:libpq${MORELLO} = "${libdir}/libpq*${SOLIBS}" +FILES:libpq${MORELLO}-dev = "${libdir}/libpq*${SOLIBSDEV} \ + ${includedir} \ +" +FILES:libpq${MORELLO}-staticdev = "${libdir}/libpq*.a ${libdir}/libpgport.a" +SECTION:libpq${MORELLO}-staticdev = "devel" +RDEPENDS:libpq${MORELLO}-staticdev = "libpq${MORELLO}-dev (= ${EXTENDPKGV})" + +FILES:libecpg${MORELLO}-compat = "${libdir}/libecpg_compat*${SOLIBS}" +FILES:libecpg${MORELLO}-compat-dev = "${libdir}/libecpg_compat*${SOLIBS}" +FILES:libpgtypes${MORELLO} = "${libdir}/libpgtypes*${SOLIBS}" +FILES:libpgtypes${MORELLO}-staticdev = "${libdir}/libpgtypes*.a" +FILES:libpgtypes${MORELLO}-dev = "${libdir}/libpgtypes*${SOLIBS} ${includedir}/pgtypes*.h" + +FILES:${PN}-contrib = " ${bindir}/oid2name ${bindir}/pg_standby \ + ${S}/contrib/spi/*.example \ + ${libdir}/${BPN_POSTGRESQL}/_int.so ${libdir}/${BPN_POSTGRESQL}/adminpack.so \ + ${libdir}/${BPN_POSTGRESQL}/autoinc.so ${libdir}/${BPN_POSTGRESQL}/auto_explain.so \ + ${libdir}/${BPN_POSTGRESQL}/auth_delay.so ${libdir}/${BPN_POSTGRESQL}/btree_gin.so \ + ${libdir}/${BPN_POSTGRESQL}/btree_gist.so ${libdir}/${BPN_POSTGRESQL}/.so \ + ${libdir}/${BPN_POSTGRESQL}/chkpass.so ${libdir}/${BPN_POSTGRESQL}/citext.so \ + ${libdir}/${BPN_POSTGRESQL}/cube.so ${libdir}/${BPN_POSTGRESQL}/dblink.so \ + ${libdir}/${BPN_POSTGRESQL}/dict_int.so ${libdir}/${BPN_POSTGRESQL}/dict_xsyn.so \ + ${libdir}/${BPN_POSTGRESQL}/dummy_seclabel.so ${libdir}/${BPN_POSTGRESQL}/earthdistance.so \ + ${libdir}/${BPN_POSTGRESQL}/file_fdw.so ${libdir}/${BPN_POSTGRESQL}/fuzzystrmatch.so \ + ${libdir}/${BPN_POSTGRESQL}/hstore.so ${libdir}/${BPN_POSTGRESQL}/insert_username.so \ + ${libdir}/${BPN_POSTGRESQL}/isn.so ${libdir}/${BPN_POSTGRESQL}/lo.so \ + ${libdir}/${BPN_POSTGRESQL}/ltree.so ${libdir}/${BPN_POSTGRESQL}/moddatetime.so \ + ${libdir}/${BPN_POSTGRESQL}/pageinspect.so ${libdir}/${BPN_POSTGRESQL}/pg_buffercache.so \ + ${libdir}/${BPN_POSTGRESQL}/pg_freespacemap.so ${libdir}/${BPN_POSTGRESQL}/pg_trgm.so \ + ${libdir}/${BPN_POSTGRESQL}/pgcrypto.so ${libdir}/${BPN_POSTGRESQL}/pgrowlocks.so \ + ${libdir}/${BPN_POSTGRESQL}/pgstattuple.so ${libdir}/${BPN_POSTGRESQL}/pg_stat_statements.so \ + ${libdir}/${BPN_POSTGRESQL}/refint.so ${libdir}/${BPN_POSTGRESQL}/seg.so \ + ${libdir}/${BPN_POSTGRESQL}/sslinfo.so \ + ${libdir}/${BPN_POSTGRESQL}/tablefunc.so \ + ${libdir}/${BPN_POSTGRESQL}/test_parser.so ${libdir}/${BPN_POSTGRESQL}/timetravel.so \ + ${libdir}/${BPN_POSTGRESQL}/uuid-ossp.so \ + ${libdir}/${BPN_POSTGRESQL}/pgxml.so ${libdir}/${BPN_POSTGRESQL}/passwordcheck.so \ + ${libdir}/${BPN_POSTGRESQL}/pg_upgrade_support.so ${libdir}/${BPN_POSTGRESQL}/.so \ + ${libdir}/${BPN_POSTGRESQL}/unaccent.so \ +" +DESCRIPTION:${PN}-contrib = "The postgresql-contrib package contains \ + contributed packages that are included in the PostgreSQL distribution." + +FILES:${PN}-pltcl = "${libdir}/${BPN_POSTGRESQL}/pltcl.so ${bindir}/pltcl_delmod \ + ${binddir}/pltcl_listmod ${bindir}/pltcl_loadmod \ + ${datadir}/${BPN_POSTGRESQL}/unknown.pltcl" +SUMMARY:${PN}-pltcl = "The Tcl procedural language for PostgreSQL" +DESCRIPTION:${PN}-pltcl = "PostgreSQL is an advanced Object-Relational \ + database management system. The postgresql-pltcl package contains the PL/Tcl \ + procedural language for the backend." + +FILES:${PN}-plperl = "${libdir}/${BPN_POSTGRESQL}/plperl.so" +SUMMARY:${PN}-plperl = "The Perl procedural language for PostgreSQL" +DESCRIPTION:${PN}-plperl = "PostgreSQL is an advanced Object-Relational \ + database management system. The postgresql-plperl package contains the \ + PL/Perl procedural language for the backend." + +# In version 8, it will be plpython.so +# In version 9, it might be plpython{2,3}.so depending on python2 or 3 +FILES:${PN}-plpython = "${libdir}/${BPN_POSTGRESQL}/plpython*.so" +SUMMARY:${PN}-plpython = "The Python procedural language for PostgreSQL" +DESCRIPTION:${PN}-plpython = "PostgreSQL is an advanced Object-Relational \ + database management system. The postgresql-plpython package contains \ + the PL/Python procedural language for the backend." + + +FILES:${PN}-dbg += "gdb_debug \ + ${bindir}/pgbench \ + ${libdir}/${BPN_POSTGRESQL}/pgxs/src/test/regress/* \ + " + + +CVE_CHECK_IGNORE += "\ + CVE-2017-8806 \ +" + +SYSROOT_DIRS += "${bindir}/pgconfig" \ No newline at end of file diff --git a/recipes-dbs/postgresql/postgresql-morello_9.6.bb b/recipes-dbs/postgresql/postgresql-morello_9.6.bb new file mode 100644 index 0000000..6ca7934 --- /dev/null +++ b/recipes-dbs/postgresql/postgresql-morello_9.6.bb @@ -0,0 +1,155 @@ +require postgresql-morello.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/postgresql:${THISDIR}/cheri-patches:" + +PVBASE = "9.6" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=87da2b84884860b71f5f24ab37e7da78" + +SRC_URI = "git://github.com/CTSRD-CHERI/postgres;protocol=https;branch=${SRCBRANCH} \ + file://0003-configure.in-bypass-autoconf-2.69-version-check.patch \ + file://postgresql-morello.init \ + file://postgresql-profile \ + file://postgresql.pam \ + file://postgresql-setup \ + file://pg_config \ +" + +SRC_URI += "\ + file://0001-port.h-change-argument-order-to-qsort_r-to-match-pos.patch \ + file://0002-qsort-change-defines-from-freebsd-to-cheri.patch \ +" + +SRC_URI += " \ + file://postgresql-init \ + file://postgresql-init.service \ + file://postgresql-morello.service \ + " + +SRC_URI += "\ + file://postgres-test \ + file://postgres-bench \ + file://test-schedule \ + " + +SRC_URI[sha256sum] = "d4f72cb5fb857c9a9f75ec8cf091a1771272802f2178f0b2e65b7b6ff64f4a30" + +SRCBRANCH = "96-cheri" +SRCREV = "e94e514cac6a8ae2277b3e44970c734c9a066f34" + +S = "${WORKDIR}/git" + +CFLAGS:remove = "-O2" + +SYSTEMD_AUTO_ENABLE:${PN} = "enable" + +DB_DATADIR = "/var/lib/postgresql/data" + +PACKAGECONFIG[tcl] = "--with-tcl --with-tclconfig=${STAGING_BINDIR_CROSS},--without-tcl,tcl-morello tcl-native," +# PACKAGECONFIG[perl] = "--with-perl,--without-perl,perl,perl" +# PACKAGECONFIG[python] = "--with-python,--without-python,python3,python3" +# PACKAGECONFIG[gssapi] = "--with-gssapi,--without-gssapi,krb5" +# PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam" +PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap-morello" +#PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd systemd-systemctl-native" +#PACKAGECONFIG[uuid] = "--with-uuid=e2fs,--without-uuid,util-linux" +#PACKAGECONFIG[libxml] = "--with-libxml,--without-libxml,libxml2,libxml2" +# PACKAGECONFIG[libxslt] = "--with-libxslt,--without-libxslt,libxslt" +PACKAGECONFIG[zlib] = "--with-zlib,--without-zlib,zlib-morello" +PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl-morello," + +export PRINTF_SIZE_T_SUPPORT="yes" + +do_install:append() { + + install_dir="${D}" + + D_DEST_DIR=${install_dir}${sysconfdir}/${BPN_POSTGRESQL} + + install -d ${D_DEST_DIR} + install -m 0755 ${WORKDIR}/postgresql-init ${D_DEST_DIR}/postgresql-init + + sed -e "s:%DB_DATADIR%:${DB_DATADIR}:g" -i ${D_DEST_DIR}/postgresql-init + sed -e "s:%PGINSTALLDIR%:${prefix}:g" -i ${D_DEST_DIR}/postgresql-init + sed -e "s:%BINDIR%:${bindir}:g" -i ${D_DEST_DIR}/postgresql-init + sed -e "s:%SYSCONFDIR%:${sysconfdir}:g" -i ${D_DEST_DIR}/postgresql-init + + install -d ${D}${systemd_unitdir}/system/ + + PG_INIT_SERVICE_FILE=${D}${systemd_unitdir}/system/postgresql-init.service + install -m 644 ${WORKDIR}/postgresql-init.service ${PG_INIT_SERVICE_FILE} + + sed -e "s:%PGINSTALLDIR%:${prefix}:g" -i ${PG_INIT_SERVICE_FILE} + + sed -e "s:%SYSCONFIGDIR%:${sysconfdir}:g" -i ${PG_INIT_SERVICE_FILE} + sed -e "s:%SYSCONFIGDIR%:${sysconfdir}:g" -i ${PG_INIT_SERVICE_FILE} + + sed -e "s:%DB_USER%:${DB_USER}:g" -i ${PG_INIT_SERVICE_FILE} + sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" -i ${PG_INIT_SERVICE_FILE} + + PG_SERVICE_FILE=${D}${systemd_unitdir}/system/postgresql.service + install -m 644 ${WORKDIR}/postgresql-morello.service ${PG_SERVICE_FILE} + + sed -e 's,%BINDIR%,${bindir},g' -i ${PG_SERVICE_FILE} + sed -e "s:%PGINSTALLDIR%:${prefix}:g" -i ${PG_SERVICE_FILE} + + # Update PGDATA throughout + files="${install_dir}${localstatedir}/lib/${BPN_POSTGRESQL}/.profile" + files="$files ${D}${systemd_unitdir}/system/postgresql.service" + files="$files ${install_dir}${bindir}/${BPN}-setup" + files="$files ${install_dir}${sysconfdir}/init.d/${BPN}-server" + for f in $files + do + sed -e "s:(PGDATA=).*$:\1${DB_DATADIR}:g" -i $f + done + + # Ensure DB is initialize before we attempt to start the service + FILE=${D}${systemd_unitdir}/system/postgresql.service + sed -e '/ExecStart=.*/i ExecStartPre=${sysconfdir}/${BPN_POSTGRESQL}/postgresql-init initdb' -i $FILE + sed -e '/ExecStartPre=.*/i PermissionsStartOnly=true' -i $FILE + + # Install test scripts + BENCH_SCRIPT=${D}/postgres-bench.sh + install -m 0755 ${WORKDIR}/postgres-bench ${BENCH_SCRIPT} + + sed -e "s:%BINDIR%:${bindir}:g" -i ${BENCH_SCRIPT} + sed -e "s:%LIBDIR%:${libdir}:g" -i ${BENCH_SCRIPT} + + TEST_SCRIPT=${D}/postgres-test.sh + install -m 0755 ${WORKDIR}/postgres-test ${TEST_SCRIPT} + + sed -e "s:%BINDIR%:${bindir}:g" -i ${TEST_SCRIPT} + sed -e "s:%LIBDIR%:${libdir}:g" -i ${TEST_SCRIPT} + + install -d ${install_dir}${libdir}/${BPN_POSTGRESQL}/pgxs/src/test/regress + install -m 644 ${WORKDIR}/test-schedule ${install_dir}${libdir}/${BPN_POSTGRESQL}/pgxs/src/test/regress/test_schedule +} + +do_install:append () { + + install -d "${D}${libdir}" + cp ${B}/src/test/regress/*.so ${D}${libdir} +} + +do_install:append() { + ${OBJDUMP_COMMAND} ${D}${bindir}/pg_ctl > ${D}${PURECAP_DEBUGDIR}/pgctl.dump + ${READELF_COMMAND} ${D}${bindir}/pg_ctl > ${D}${PURECAP_DEBUGDIR}/pgctl.readelf + ${OBJDUMP_COMMAND} ${D}${bindir}/postgres > ${D}${PURECAP_DEBUGDIR}/postgres.dump + ${READELF_COMMAND} ${D}${bindir}/postgres > ${D}${PURECAP_DEBUGDIR}/postgres.readelf +} + +PACKAGES += " ${PN}-setup" + +SYSTEMD_PACKAGES += "${PN}-setup" +SYSTEMD_SERVICE:${PN}-setup = "postgresql-init.service" + +FILES:${PN}-setup = " \ + ${systemd_unitdir}/system \ +" + +FILES:${PN}-dbg += " \ + postgres-test.sh \ + postgres-bench.sh \ + ${libdir}/${BPN_POSTGRESQL}/pgxs/src/test/regress/test-schedule \ +" + +FILES:${PN}-gdb-debug += "/gdb_debug" \ No newline at end of file diff --git a/recipes-dbs/postgresql/postgresql/pg_config b/recipes-dbs/postgresql/postgresql/pg_config new file mode 100755 index 0000000..1c147d2 --- /dev/null +++ b/recipes-dbs/postgresql/postgresql/pg_config @@ -0,0 +1,15 @@ +#!/bin/bash + +if [[ "${1}" == "--includedir" ]]; then + + echo "${STAGING_DIR_TARGET}${includedir}" + +elif [[ "${1}" == "--libdir" ]]; then + + echo "${STAGING_DIR_TARGET}${libdir}" + +elif [[ "${1}" == "--version" ]]; then + + echo "9.6" + +fi \ No newline at end of file diff --git a/recipes-dbs/postgresql/postgresql/postgres-bench b/recipes-dbs/postgresql/postgresql/postgres-bench new file mode 100644 index 0000000..d9c1830 --- /dev/null +++ b/recipes-dbs/postgresql/postgresql/postgres-bench @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ -z "$1" ]; then + echo "Usage: ./postgres-bench.sh EXISTING_DB_NAME" + exit 1 +fi + +BINDIR=%BINDIR% +LIBDIR=%LIBDIR% +PURECAPLD="LD_LIBRARY_PATH=${LIBDIR}" +DB_NAME=$1 + +export ${PURECAPLD} + +${BINDIR}/pgbench -i ${DB_NAME} -U postgres +${BINDIR}/pgbench -U postgres -c 2 -T 180 ${DB_NAME} 2>&1 | tee /tmp/pgbench-results.txt \ No newline at end of file diff --git a/recipes-dbs/postgresql/postgresql/postgres-test b/recipes-dbs/postgresql/postgresql/postgres-test new file mode 100644 index 0000000..00b57c2 --- /dev/null +++ b/recipes-dbs/postgresql/postgresql/postgres-test @@ -0,0 +1,49 @@ +#!/bin/sh +# stolen from postgresql-cheri + +BINDIR=%BINDIR% +LIBDIR=%LIBDIR% +PURECAPLD="LD_LIBRARY_PATH=${LIBDIR}" +LD_CHERI_LIBRARY_PATH=${LIBDIR} + +POSTGRES_INSTANCE="/tmp/postgres-test-cheri/instance" + +PG_REGRESS=${LIBDIR}/postgresql/pgxs/src/test/regress/pg_regress + +SCHEDULE_NAME=${SCHEDULE_NAME:-serial_schedule} + +OUTPUT_DIR="/tmp/pg_test" + +rm -rf $OUTPUT_DIR + +mkdir -p $OUTPUT_DIR +mkdir -p $OUTPUT_DIR/log +mkdir -p $OUTPUT_DIR/sql +mkdir -p $OUTPUT_DIR/expected +mkdir -p $OUTPUT_DIR/results +mkdir -p $OUTPUT_DIR/testtablespace +mkdir -p $POSTGRES_INSTANCE + +cd $OUTPUT_DIR + +if "${PG_REGRESS}" "--inputdir=${LIBDIR}/postgresql/pgxs/src/test/regress" "--bindir=${BINDIR}" "--dlpath=${LIBDIR}" "--schedule=${LIBDIR}/postgresql/pgxs/src/test/regress/${SCHEDULE_NAME}" "--outputdir=$OUTPUT_DIR" "--temp-instance=$POSTGRES_INSTANCE" "$@" +then + echo "TESTS SUCCCEEDED" +else + if [ "$?" = 1 ]; then + echo "TESTS UNSTABLE" + echo "CHECKING FOR ASSERTION FAILURES:" + grep TRAP "$OUTPUT_DIR/log/postmaster.log" || true + exit 0 + else + echo "Got test failures, reading initdb log: $OUTPUT_DIR/log/initdb.log" + cat "$OUTPUT_DIR/log/initdb.log" + false + fi +fi + +sudo cp /tmp/pg_test/regression.diffs regression.diffs +sudo cp /tmp/pg_test/regression.out regression.out +sudo cp -rf /tmp/pg_test/expected . +sudo cp -rf /tmp/pg_test/results . +sudo cp /tmp/pg_test/log/postmaster.log postmaster.log diff --git a/recipes-dbs/postgresql/postgresql/postgresql-init b/recipes-dbs/postgresql/postgresql/postgresql-init new file mode 100644 index 0000000..34e77ef --- /dev/null +++ b/recipes-dbs/postgresql/postgresql/postgresql-init @@ -0,0 +1,64 @@ +#!/bin/sh +# set -x + +PN=postgresql-morello +DATA_DIR=%DB_DATADIR% +BIN_DIR=%BINDIR% +SYSCONF_DIR=%SYSCONFDIR% + +# called by postgresql.service.. +initdb(){ + + if [ ! -e $DATA_DIR ]; then + mkdir -p $DATA_DIR + chown postgres $DATA_DIR + fi + + if [ -e $DATA_DIR/PG_VERSION ]; then + # the database has already been initialized, return + exit 0 + fi + + # Create the DB + sudo -u postgres ${BIN_DIR}/initdb -D $DATA_DIR + + if [ $? -ne 0 ]; then + echo "[INFO] postgres: failed to initalise the DB" + exit 1 + fi + + # Allow readers/writers + echo "listen_addresses = '*'" >> $DATA_DIR/postgresql.conf + echo "local root all password" >> $DATA_DIR/pg_hba.conf +} + +if [ "$1" == "initdb" ]; then + initdb + exit 0 +fi + +count=0 +done=0 +while [ $count -le 10 ] && [ $done -eq 0 ]; do + + sudo -u postgres ${BIN_DIR}/psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '${DB_PASSWORD}'" 2> /dev/null + + if [ $? -ne 0 ]; then + echo "[INFO] postgres: failed to create account for ${DB_USER}, trying again" + systemctl stop postresql + sleep 3 + systemctl start postgresql + sleep 3 + else + echo "[INFO] postgres: created account for ${DB_USER}, continuing .. " + done=1 + fi + count=`expr $count + 1` +done + +if [ $done -eq 0 ]; then + echo "[ERROR] postgres: unable to create admin account" + exit 1 +fi + +ln -s /usr/share/zoneinfo %PGINSTALLDIR%/usr/share/postgresql/timezone || true diff --git a/recipes-dbs/postgresql/postgresql/postgresql-init.service b/recipes-dbs/postgresql/postgresql/postgresql-init.service new file mode 100644 index 0000000..d140c26 --- /dev/null +++ b/recipes-dbs/postgresql/postgresql/postgresql-init.service @@ -0,0 +1,19 @@ +[Unit] +Description=Postgresql setup +Wants=postgresql.service +After=postgresql.service + +[Service] +Type=oneshot + +Environment=DB_USER=%DB_USER% +Environment=DB_PASSWORD=%DB_PASSWORD% + +Environment=PGROOT=%PGINSTALLDIR% + +ExecStart=%SYSCONFIGDIR%/postgresql/postgresql-init +ExecStartPost=/bin/bash -c '/bin/systemctl --no-reload disable postgresql-init.service' +RemainAfterExit=No + +[Install] +WantedBy=multi-user.target diff --git a/recipes-dbs/postgresql/postgresql/postgresql-morello.init b/recipes-dbs/postgresql/postgresql/postgresql-morello.init new file mode 100644 index 0000000..cb9b683 --- /dev/null +++ b/recipes-dbs/postgresql/postgresql/postgresql-morello.init @@ -0,0 +1,193 @@ +#!/bin/sh +# +# postgresql This is the init script for starting up the PostgreSQL +# server. +# +# chkconfig: - 64 36 +# description: PostgreSQL database server. +# processname: postmaster +# pidfile: /var/run/postmaster.PORT.pid + +# This script is slightly unusual in that the name of the daemon (postmaster) +# is not the same as the name of the subsystem (postgresql) + +# PGVERSION is the full package version, e.g., 8.4.0 +# Note: the specfile inserts the correct value during package build +PGVERSION=9.2.4 +# PGMAJORVERSION is major version, e.g., 10 (this should match PG_VERSION) +PGMAJORVERSION=`echo "$PGVERSION" | sed 's/^([0-9]*).*$/\1/'` + +# Source function library. +. /etc/init.d/functions + +# Find the name of the script +NAME=`basename $0` +if [ ${NAME:0:1} = "S" -o ${NAME:0:1} = "K" ] +then + NAME=${NAME:3} +fi + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + + +# Set defaults for configuration variables +PGENGINE=/usr/bin +PGPORT=5432 +PGDATA=/var/lib/postgresql/data +PGLOG=/var/lib/postgresql/pgstartup.log +# Value to set as postmaster process's oom_adj +PG_OOM_ADJ=-17 + +# Override defaults from /etc/sysconfig/postgresql if file is present +[ -f /etc/default/postgresql/${NAME} ] && . /etc/default/postgresql/${NAME} + +export PGDATA +export PGPORT + +lockfile="/var/lock/subsys/${NAME}" +pidfile="/var/run/postmaster.${PGPORT}.pid" + +script_result=0 + +start(){ + [ -x "$PGENGINE/postmaster" ] || exit 5 + + PSQL_START=$"Starting ${NAME} service: " + + # Make sure startup-time log file is valid + if [ ! -e "$PGLOG" -a ! -h "$PGLOG" ] + then + touch "$PGLOG" || exit 4 + chown postgres:postgres "$PGLOG" + chmod go-rwx "$PGLOG" + [ -x /sbin/restorecon ] && /sbin/restorecon "$PGLOG" + fi + + # Check for the PGDATA structure + if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ] + then + # Check version of existing PGDATA + if [ x`cat "$PGDATA/PG_VERSION"` != x"$PGMAJORVERSION" ] + then + SYSDOCDIR="(Your System's documentation directory)" + if [ -d "/usr/doc/postgresql-$PGVERSION" ] + then + SYSDOCDIR=/usr/doc + fi + if [ -d "/usr/share/doc/postgresql-$PGVERSION" ] + then + SYSDOCDIR=/usr/share/doc + fi + if [ -d "/usr/doc/packages/postgresql-$PGVERSION" ] + then + SYSDOCDIR=/usr/doc/packages + fi + if [ -d "/usr/share/doc/packages/postgresql-$PGVERSION" ] + then + SYSDOCDIR=/usr/share/doc/packages + fi + echo + echo $"An old version of the database format was found." + echo $"You need to upgrade the data format before using PostgreSQL." + echo $"See $SYSDOCDIR/postgresql-$PGVERSION/README.rpm-dist for more information." + exit 1 + fi + else + # No existing PGDATA! Warn the user to initdb it. + echo + echo "$PGDATA is missing. Use "postgresql-setup initdb" to initialize the cluster first." + echo -n " [FAILED] " + echo + exit 1 + fi + + echo -n "$PSQL_START" + test x"$PG_OOM_ADJ" != x && echo "$PG_OOM_ADJ" > /proc/self/oom_score_adj + $SU -l postgres -c "$PGENGINE/postmaster -p '$PGPORT' -D '$PGDATA' ${PGOPTS} &" >> "$PGLOG" 2>&1 < /dev/null + sleep 2 + pid=`head -n 1 "$PGDATA/postmaster.pid" 2>/dev/null` + if [ "x$pid" != x ] + then + echo -n " [ OK ]" + touch "$lockfile" + echo $pid > "$pidfile" + echo + else + echo -n " [FAILED]" + echo + script_result=1 + fi +} + +stop(){ + echo -n $"Stopping ${NAME} service: " + if [ -e "$lockfile" ] + then + $SU -l postgres -c "$PGENGINE/pg_ctl stop -D '$PGDATA' -s -m fast" > /dev/null 2>&1 < /dev/null + ret=$? + if [ $ret -eq 0 ] + then + echo -n " [ OK ] " + rm -f "$pidfile" + rm -f "$lockfile" + else + echo -n " [FAILED] " + script_result=1 + fi + else + # not running; per LSB standards this is "ok" + echo -n " [ OK ] " + fi + echo +} + +restart(){ + stop + start +} + +condrestart(){ + [ -e "$lockfile" ] && restart || : +} + +reload(){ + $SU -l postgres -c "$PGENGINE/pg_ctl reload -D '$PGDATA' -s" > /dev/null 2>&1 < /dev/null +} + + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status postmaster + script_result=$? + ;; + restart) + restart + ;; + condrestart|try-restart) + condrestart + ;; + reload) + reload + ;; + force-reload) + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 +esac + +exit $script_result \ No newline at end of file diff --git a/recipes-dbs/postgresql/postgresql/postgresql-morello.service b/recipes-dbs/postgresql/postgresql/postgresql-morello.service new file mode 100644 index 0000000..bce29b8 --- /dev/null +++ b/recipes-dbs/postgresql/postgresql/postgresql-morello.service @@ -0,0 +1,29 @@ +[Unit] +Description=PostgreSQL database server +After=network.target + +[Service] +Type=forking +User=postgres +Group=postgres + +# Port number for server to listen on +Environment=PGPORT=5432 + +# Location of database directory +Environment=PGDATA=/var/lib/postgresql/data + +Environment=PGROOT=%PGINSTALLDIR% + +# Disable OOM kill on the postmaster +OOMScoreAdjust=-17 + +ExecStart=/bin/bash -c '%BINDIR%/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300' +ExecStop=/bin/bash -c '%BINDIR%/pg_ctl stop -D ${PGDATA} -s -m fast' +ExecReload=/bin/bash -c '%BINDIR%/pg_ctl reload -D ${PGDATA} -s' + +# Give a reasonable amount of time for the server to start up/shut down +TimeoutSec=300 + +[Install] +WantedBy=multi-user.target diff --git a/recipes-dbs/postgresql/postgresql/postgresql-profile b/recipes-dbs/postgresql/postgresql/postgresql-profile new file mode 100644 index 0000000..1c931f3 --- /dev/null +++ b/recipes-dbs/postgresql/postgresql/postgresql-profile @@ -0,0 +1,4 @@ +[ -f /etc/profile ] && source /etc/profile + +PGDATA=/var/lib/postgresql/data +export PGDATA diff --git a/recipes-dbs/postgresql/postgresql/postgresql-setup b/recipes-dbs/postgresql/postgresql/postgresql-setup new file mode 100644 index 0000000..75bb01e --- /dev/null +++ b/recipes-dbs/postgresql/postgresql/postgresql-setup @@ -0,0 +1,73 @@ +#!/bin/sh +# +# postgresql-setup Initialization operation for PostgreSQL + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +PGENGINE=/usr/bin +PGDATA=/var/lib/postgresql/data +PGLOG=/var/lib/postgresql/pgstartup.log +script_result=0 + +initdb(){ + if [ -f "$PGDATA/PG_VERSION" ] + then + echo -n "Data directory is not empty!" + echo -n " [FAILED] " + echo + script_result=1 + else + echo -n "Initializing database: " + if [ ! -e "$PGDATA" -a ! -h "$PGDATA" ] + then + mkdir -p "$PGDATA" || exit 1 + chown postgres:postgres "$PGDATA" + chmod go-rwx "$PGDATA" + fi + # Clean up SELinux tagging for PGDATA + [ -x /sbin/restorecon ] && /sbin/restorecon "$PGDATA" + + # Make sure the startup-time log file is OK, too + if [ ! -e "$PGLOG" -a ! -h "$PGLOG" ] + then + touch "$PGLOG" || exit 1 + chown postgres:postgres "$PGLOG" + chmod go-rwx "$PGLOG" + [ -x /sbin/restorecon ] && /sbin/restorecon "$PGLOG" + fi + + # Initialize the database + $SU -l postgres -c "$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident'" >> "$PGLOG" 2>&1 < /dev/null + + # Create directory for postmaster log + mkdir "$PGDATA/pg_log" + chown postgres:postgres "$PGDATA/pg_log" + chmod go-rwx "$PGDATA/pg_log" + + if [ -f "$PGDATA/PG_VERSION" ] + then + echo -n " [ OK ] " + else + echo -n " [FAILED] " + script_result=1 + fi + echo + fi +} + +case "$1" in + initdb) + initdb + ;; + *) + echo "Usage: $0 initdb" + exit 2 +esac + +exit $script_result diff --git a/recipes-dbs/postgresql/postgresql/postgresql.pam b/recipes-dbs/postgresql/postgresql/postgresql.pam new file mode 100644 index 0000000..0b6fdc5 --- /dev/null +++ b/recipes-dbs/postgresql/postgresql/postgresql.pam @@ -0,0 +1,4 @@ +#%PAM-1.0 +auth include common-auth +account include common-account +password include common-password diff --git a/recipes-dbs/postgresql/postgresql/test-schedule b/recipes-dbs/postgresql/postgresql/test-schedule new file mode 100644 index 0000000..b8808c9 --- /dev/null +++ b/recipes-dbs/postgresql/postgresql/test-schedule @@ -0,0 +1 @@ +test: type_sanity \ No newline at end of file diff --git a/recipes-dbs/postgresql/postgresql_%.bbappend b/recipes-dbs/postgresql/postgresql_%.bbappend new file mode 100644 index 0000000..66e03de --- /dev/null +++ b/recipes-dbs/postgresql/postgresql_%.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/postgresql:" + +SYSTEMD_AUTO_ENABLE:${PN} = "disable" + +PROVIDES += "libpq" + +FILES:libpq = "${libdir}/libpq*${SOLIBS} ${includedir}"
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- ...0001-tclCompCmdsSZ-cast-to-uintptr_t.patch | 28 +++++ recipes-devtools/tcltk/tcl-morello_8.6.11.bb | 104 ++++++++++++++++++ .../tcltk/tcl/alter-includedir.patch | 56 ++++++++++ .../tcl/fix_issue_with_old_distro_glibc.patch | 39 +++++++ .../tcl/fix_non_native_build_issue.patch | 64 +++++++++++ recipes-devtools/tcltk/tcl/interp.patch | 32 ++++++ recipes-devtools/tcltk/tcl/run-ptest | 17 +++ .../tcltk/tcl/tcl-add-soname.patch | 32 ++++++ .../tcl-remove-hardcoded-install-path.patch | 32 ++++++ 9 files changed, 404 insertions(+) create mode 100644 recipes-devtools/tcltk/cheri-patches/0001-tclCompCmdsSZ-cast-to-uintptr_t.patch create mode 100644 recipes-devtools/tcltk/tcl-morello_8.6.11.bb create mode 100644 recipes-devtools/tcltk/tcl/alter-includedir.patch create mode 100644 recipes-devtools/tcltk/tcl/fix_issue_with_old_distro_glibc.patch create mode 100644 recipes-devtools/tcltk/tcl/fix_non_native_build_issue.patch create mode 100644 recipes-devtools/tcltk/tcl/interp.patch create mode 100644 recipes-devtools/tcltk/tcl/run-ptest create mode 100644 recipes-devtools/tcltk/tcl/tcl-add-soname.patch create mode 100644 recipes-devtools/tcltk/tcl/tcl-remove-hardcoded-install-path.patch
diff --git a/recipes-devtools/tcltk/cheri-patches/0001-tclCompCmdsSZ-cast-to-uintptr_t.patch b/recipes-devtools/tcltk/cheri-patches/0001-tclCompCmdsSZ-cast-to-uintptr_t.patch new file mode 100644 index 0000000..b781e60 --- /dev/null +++ b/recipes-devtools/tcltk/cheri-patches/0001-tclCompCmdsSZ-cast-to-uintptr_t.patch @@ -0,0 +1,28 @@ +From f184b339449f07e82a9c515a99e179fb7f602e8d Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Tue, 16 Jan 2024 12:51:08 +0000 +Subject: [PATCH] tclCompCmdsSZ: cheri provenance + +Cast int values that are used in pointer arithmetic to uintptr_t. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + generic/tclCompCmdsSZ.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c +index ddfe0dc..b48f2b6 100644 +--- a/generic/tclCompCmdsSZ.c ++++ b/generic/tclCompCmdsSZ.c +@@ -2383,7 +2383,7 @@ IssueSwitchJumpTable( + * point to here. + */ + +- Tcl_SetHashValue(hPtr, CurrentOffset(envPtr) - jumpLocation); ++ Tcl_SetHashValue(hPtr, CurrentOffset(envPtr) - (uintptr_t)jumpLocation); + } + Tcl_DStringFree(&buffer); + } else { +-- +2.34.1 + diff --git a/recipes-devtools/tcltk/tcl-morello_8.6.11.bb b/recipes-devtools/tcltk/tcl-morello_8.6.11.bb new file mode 100644 index 0000000..dfced55 --- /dev/null +++ b/recipes-devtools/tcltk/tcl-morello_8.6.11.bb @@ -0,0 +1,104 @@ +inherit autotools ptest binconfig purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-devtools/tcltk/tcl_8.6.11.bb" + +SUMMARY = "Tool Command Language - CHERI: sourced from poky/meta" +HOMEPAGE = "http://tcl.sourceforge.net" +DESCRIPTION = "Tool Command Language, is an open-source multi-purpose C library which includes a powerful dynamic scripting language. Together they provide ideal cross-platform development environment for any programming project." +SECTION = "devel/tcltk" + + +FILESEXTRAPATHS:prepend := "${THISDIR}/tcl:${THISDIR}/cheri-patches:" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +# http://www.tcl.tk/software/tcltk/license.html +LICENSE = "TCL & BSD-3-Clause" +LIC_FILES_CHKSUM = "file://license.terms;md5=058f6229798281bbcac4239c788cfa38 \ + file://compat/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ + file://library/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ + file://macosx/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ + file://tests/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ + file://win/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ +" + +DEPENDS = "tcl-native zlib-morello" + +PVTCL = "8.6.11" +BPNTCL = "tcl" + +BASE_SRC_URI = "${SOURCEFORGE_MIRROR}/tcl/tcl-core${PVTCL}-src.tar.gz \ + file://tcl-add-soname.patch" + +SRC_URI = "${BASE_SRC_URI} \ + file://fix_non_native_build_issue.patch \ + file://fix_issue_with_old_distro_glibc.patch \ + file://tcl-remove-hardcoded-install-path.patch \ + file://alter-includedir.patch \ + file://interp.patch \ + file://run-ptest \ +" + +SRC_URI += "file://0001-tclCompCmdsSZ-cast-to-uintptr_t.patch" + +SRC_URI[sha256sum] = "cfb49aab82bd179651e23eeeb69606f51b0ddc575ca55c3d35e2457469024cfa" + +SRC_URI:class-native = "${BASE_SRC_URI}" + +# Upstream don't believe this is an exploitable issue +# https://core.tcl-lang.org/tcl/info/7079e4f91601e9c7 +CVE_CHECK_IGNORE += "CVE-2021-35331" + +UPSTREAM_CHECK_REGEX = "tcl(?P<pver>\d+(.\d+)+)-src" + +S = "${WORKDIR}/${BPNTCL}${PVTCL}" + +VER = "${PVTCL}" + +AUTOTOOLS_SCRIPT_PATH = "${S}/unix" +EXTRA_OECONF = "--enable-threads --enable-man-suffix" + +do_install() { + autotools_do_install + oe_runmake 'DESTDIR=${D}' install-private-headers + ln -sf ./tclsh${VER} ${D}${bindir}/tclsh + ln -sf tclsh8.6 ${D}${bindir}/tclsh${VER} + sed -i "s;-L${B};-L${STAGING_LIBDIR};g" tclConfig.sh + sed -i "s;'${WORKDIR};'${STAGING_INCDIR};g" tclConfig.sh + install -d ${D}${bindir_crossscripts} + install -m 0755 tclConfig.sh ${D}${bindir_crossscripts} + install -m 0755 tclConfig.sh ${D}${libdir} + for dir in compat generic unix; do + install -d ${D}${includedir}/${BPNTCL}${VER}/$dir + install -m 0644 ${S}/$dir/*.h ${D}${includedir}/${BPNTCL}${VER}/$dir/ + done +} + +SYSROOT_DIRS += "${bindir_crossscripts}" + +PACKAGES =+ "tcl-lib-morello" +FILES:tcl-lib-morello = "${libdir}/libtcl8.6.so.*" +FILES:${PN} += "${libdir}/tcl${VER} ${libdir}/tcl8.6 ${libdir}/tcl8" +FILES:${PN}-dev += "${libdir}/tclConfig.sh ${libdir}/tclooConfig.sh" + +# isn't getting picked up by shlibs code +RDEPENDS:${PN} += "tcl-lib-morello" + +# Fix some paths that might be used by Tcl extensions +BINCONFIG_GLOB = "*Config.sh" + +# Fix the path in sstate +SSTATE_SCAN_FILES += "*Config.sh" + +# Cleanup host path from ${libdir}/tclConfig.sh and remove the +# ${bindir_crossscripts}/tclConfig.sh from target +PACKAGE_PREPROCESS_FUNCS += "tcl_package_preprocess" +tcl_package_preprocess() { + sed -i -e "s;${DEBUG_PREFIX_MAP};;g" \ + -e "s;-L${STAGING_LIBDIR};-L${libdir};g" \ + -e "s;${STAGING_INCDIR};${includedir};g" \ + -e "s;--sysroot=${RECIPE_SYSROOT};;g" \ + ${PKGD}${libdir}/tclConfig.sh + + rm -f ${PKGD}${bindir_crossscripts}/tclConfig.sh +} diff --git a/recipes-devtools/tcltk/tcl/alter-includedir.patch b/recipes-devtools/tcltk/tcl/alter-includedir.patch new file mode 100644 index 0000000..5b25af2 --- /dev/null +++ b/recipes-devtools/tcltk/tcl/alter-includedir.patch @@ -0,0 +1,56 @@ +Lets install the include header and private header files into +usr/include/tcl8.6 when version of tcl is 8.6.x + +Upstream-Status: Inappropriate [Configuration Specific] + +Signed-off-by: Khem Raj raj.khem@gmai.com + +Fixed the TCL_INCLUDE_SPEC + +Signed-off-by: Robert Yang liezhi.yang@windriver.com +Signed-off-by: Yi Zhao yi.zhao@windriver.com + +--- + Makefile.in | 2 +- + configure | 4 ++-- + configure.in | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index 0370491..daa569a 100644 +--- a/unix/Makefile.in ++++ b/unix/Makefile.in +@@ -57,7 +57,7 @@ SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TCL_LIBRARY) + MODULE_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)/../tcl8 + + # Directory in which to install the include file tcl.h: +-INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(includedir) ++INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(includedir)/tcl$(VERSION) + + # Path to the private tcl header dir: + PRIVATE_INCLUDE_DIR = @PRIVATE_INCLUDE_DIR@ +diff --git a/configure.in b/configure.in +index 9f96e2b..e323e02 100644 +--- a/unix/configure.in ++++ b/unix/configure.in +@@ -773,7 +773,7 @@ eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}" + eval "TCL_LIB_FILE=${TCL_LIB_FILE}" + + test -z "$TCL_LIBRARY" && TCL_LIBRARY='$(libdir)/tcl$(VERSION)' +-PRIVATE_INCLUDE_DIR='$(includedir)' ++PRIVATE_INCLUDE_DIR='$(includedir)/tcl$(VERSION)' + HTML_DIR='$(DISTDIR)/html' + + # Note: in the following variable, it's important to use the absolute +@@ -894,7 +894,7 @@ TCL_BUILD_STUB_LIB_PATH="`pwd`/${TCL_STUB_LIB_FILE}" + TCL_STUB_LIB_PATH="${TCL_STUB_LIB_DIR}/${TCL_STUB_LIB_FILE}" + + # Install time header dir can be set via --includedir +-eval "TCL_INCLUDE_SPEC="-I${includedir}"" ++eval "TCL_INCLUDE_SPEC="-I${includedir}/tcl${VERSION}"" + + #------------------------------------------------------------------------ + # tclConfig.sh refers to this by a different name +-- +2.25.1 + diff --git a/recipes-devtools/tcltk/tcl/fix_issue_with_old_distro_glibc.patch b/recipes-devtools/tcltk/tcl/fix_issue_with_old_distro_glibc.patch new file mode 100644 index 0000000..2c31cec --- /dev/null +++ b/recipes-devtools/tcltk/tcl/fix_issue_with_old_distro_glibc.patch @@ -0,0 +1,39 @@ +Upstream-Status: Inappropriate [embedded specific] + +Fixes tcl target recipe build on old distros which have glibc older than 2.14 + +| + echo 'NOTE: make DESTDIR=/srv/home/nitin/builds/build-gcc47/tmp/work/x86_64-poky-linux/tcl-8.5.11-r5/image install' +| NOTE: make DESTDIR=/srv/home/nitin/builds/build-gcc47/tmp/work/x86_64-poky-linux/tcl-8.5.11-r5/image install +| + make DESTDIR=/srv/home/nitin/builds/build-gcc47/tmp/work/x86_64-poky-linux/tcl-8.5.11-r5/image install +| Making directory /srv/home/nitin/builds/build-gcc47/tmp/work/x86_64-poky-linux/tcl-8.5.11-r5/image/usr/lib +| Installing message catalogs +| Making directory /srv/home/nitin/builds/build-gcc47/tmp/work/x86_64-poky-linux/tcl-8.5.11-r5/image/usr/share/man +| tclsh: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /srv/home/nitin/builds/build-gcc47/tmp/work/x86_64-poky-linux/tcl-8.5.11-r5/tcl8.5.11/unix/libtcl8.5.so) +| Making directory /srv/home/nitin/builds/build-gcc47/tmp/work/x86_64-poky-linux/tcl-8.5.11-r5/image/usr/bin +| make: *** [install-msgs] Error 1 + +Signed-off-by: Nitin A Kamble nitin.a.kamble@intel.com +2012/04/26 + +Index: unix/Makefile.in +=================================================================== +--- a/unix.orig/Makefile.in 2013-11-10 23:38:01.787425628 -0800 ++++ b/unix/Makefile.in 2013-11-10 23:37:59.807425578 -0800 +@@ -686,7 +686,7 @@ + # tcltest executable gets the build directory burned into its ld search path. + # This keeps tcltest from picking up an already installed version of the Tcl + # library. +-SHELL_ENV = @LD_LIBRARY_PATH_VAR@=`pwd`:${@LD_LIBRARY_PATH_VAR@} \ ++SHELL_ENV = @LD_LIBRARY_PATH_VAR@=${@LD_LIBRARY_PATH_VAR@} \ + TCLLIBPATH="@abs_builddir@/pkgs" \ + TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}" + +@@ -712,7 +712,7 @@ + $(SHELL_ENV) ${TCLTEST_EXE} $(TOP_DIR)/tests/all.tcl $(TESTFLAGS) + + gdb-test: ${TCLTEST_EXE} +- @echo "set env @LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}" > gdb.run ++ @echo "set env @LD_LIBRARY_PATH_VAR@=$${@LD_LIBRARY_PATH_VAR@}" > gdb.run + @echo "set env TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" >> gdb.run + @echo "set args $(TOP_DIR)/tests/all.tcl $(TESTFLAGS) -singleproc 1" >> gdb.run + $(GDB) ${TCLTEST_EXE} --command=gdb.run diff --git a/recipes-devtools/tcltk/tcl/fix_non_native_build_issue.patch b/recipes-devtools/tcltk/tcl/fix_non_native_build_issue.patch new file mode 100644 index 0000000..5a10c93 --- /dev/null +++ b/recipes-devtools/tcltk/tcl/fix_non_native_build_issue.patch @@ -0,0 +1,64 @@ +Upstream-Status: Inappropriate [upstream does not support installed tests] + +Index: unix/Makefile.in +=================================================================== +--- a/unix.orig/Makefile.in 2013-11-10 23:37:34.243424934 -0800 ++++ b/unix/Makefile.in 2013-11-10 23:37:34.243424934 -0800 +@@ -709,23 +709,23 @@ + test: test-tcl test-packages + + test-tcl: ${TCLTEST_EXE} +- $(SHELL_ENV) ./${TCLTEST_EXE} $(TOP_DIR)/tests/all.tcl $(TESTFLAGS) ++ $(SHELL_ENV) ${TCLTEST_EXE} $(TOP_DIR)/tests/all.tcl $(TESTFLAGS) + + gdb-test: ${TCLTEST_EXE} + @echo "set env @LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}" > gdb.run + @echo "set env TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" >> gdb.run + @echo "set args $(TOP_DIR)/tests/all.tcl $(TESTFLAGS) -singleproc 1" >> gdb.run +- $(GDB) ./${TCLTEST_EXE} --command=gdb.run ++ $(GDB) ${TCLTEST_EXE} --command=gdb.run + rm gdb.run + + # Useful target to launch a built tcltest with the proper path,... + runtest: ${TCLTEST_EXE} +- $(SHELL_ENV) ./${TCLTEST_EXE} ++ $(SHELL_ENV) ${TCLTEST_EXE} + + # Useful target for running the test suite with an unwritable current + # directory... + ro-test: ${TCLTEST_EXE} +- echo 'exec chmod -w .;package require tcltest;tcltest::temporaryDirectory /tmp;source ../tests/all.tcl;exec chmod +w .' | $(SHELL_ENV) ./${TCLTEST_EXE} ++ echo 'exec chmod -w .;package require tcltest;tcltest::temporaryDirectory /tmp;source ../tests/all.tcl;exec chmod +w .' | $(SHELL_ENV) ${TCLTEST_EXE} + + # The following target generates the shared libraries in dltest/ that are used + # for testing; they are included as part of the "tcltest" target (via the +@@ -743,23 +743,23 @@ + # This target can be used to run tclsh from the build directory + # via `make shell SCRIPT=/tmp/foo.tcl` + shell: ${TCL_EXE} +- $(SHELL_ENV) ./${TCL_EXE} $(SCRIPT) ++ $(SHELL_ENV) ${TCL_EXE} $(SCRIPT) + + # This target can be used to run tclsh inside either gdb or insight + gdb: ${TCL_EXE} +- $(SHELL_ENV) $(GDB) ./${TCL_EXE} ++ $(SHELL_ENV) $(GDB) ${TCL_EXE} + + valgrind: ${TCL_EXE} ${TCLTEST_EXE} +- $(SHELL_ENV) $(VALGRIND) $(VALGRINDARGS) ./${TCLTEST_EXE} $(TOP_DIR)/tests/all.tcl -singleproc 1 -constraints valgrind $(TESTFLAGS) ++ $(SHELL_ENV) $(VALGRIND) $(VALGRINDARGS) ${TCLTEST_EXE} $(TOP_DIR)/tests/all.tcl -singleproc 1 -constraints valgrind $(TESTFLAGS) + + valgrindshell: ${TCL_EXE} +- $(SHELL_ENV) $(VALGRIND) $(VALGRINDARGS) ./${TCL_EXE} $(SCRIPT) ++ $(SHELL_ENV) $(VALGRIND) $(VALGRINDARGS) ${TCL_EXE} $(SCRIPT) + + trace-shell: ${TCL_EXE} +- $(SHELL_ENV) ${TRACE} $(TRACE_OPTS) ./${TCL_EXE} $(SCRIPT) ++ $(SHELL_ENV) ${TRACE} $(TRACE_OPTS) ${TCL_EXE} $(SCRIPT) + + trace-test: ${TCLTEST_EXE} +- $(SHELL_ENV) ${TRACE} $(TRACE_OPTS) ./${TCLTEST_EXE} $(TOP_DIR)/tests/all.tcl -singleproc 1 $(TESTFLAGS) ++ $(SHELL_ENV) ${TRACE} $(TRACE_OPTS) ${TCLTEST_EXE} $(TOP_DIR)/tests/all.tcl -singleproc 1 $(TESTFLAGS) + + #-------------------------------------------------------------------------- + # Installation rules diff --git a/recipes-devtools/tcltk/tcl/interp.patch b/recipes-devtools/tcltk/tcl/interp.patch new file mode 100644 index 0000000..95d6318 --- /dev/null +++ b/recipes-devtools/tcltk/tcl/interp.patch @@ -0,0 +1,32 @@ +The interp-36.7 patch has race conditions and is missing cleanup. This patch by +a Tcl maintainer should improve matters. + +Upstream-Status: Pending +Signed-off-by: Ross Burton ross.burton@arm.com + +diff --git a/tests/interp.test b/tests/interp.test +index d7424847f..fc90990f3 100644 +--- a/tests/interp.test ++++ b/tests/interp.test +@@ -3595,17 +3595,18 @@ test interp-36.7 {ChildBgerror sets error handler of child [1999035]} -setup { + variable result + set result [lindex $args 0] + } ++ set tout [after 5000 {set result timeout}] + } -body { + child eval { + variable done {} + after 0 error foo +- after 10 [list ::set [namespace which -variable done] {}] +- vwait [namespace which -variable done] + } ++ vwait result + set result + } -cleanup { ++ after cancel $tout + variable result {} +- unset -nocomplain result ++ unset -nocomplain result tout + interp delete child + } -result foo + diff --git a/recipes-devtools/tcltk/tcl/run-ptest b/recipes-devtools/tcltk/tcl/run-ptest new file mode 100644 index 0000000..a62b703 --- /dev/null +++ b/recipes-devtools/tcltk/tcl/run-ptest @@ -0,0 +1,17 @@ +#!/bin/sh + +# clock.test needs a timezone to be set +export TZ="Europe/London" +export TCL_LIBRARY=library + +for i in `ls tests/*.test | awk -F/ '{print $2}'`; do + ./tcltest tests/all.tcl -file $i >$i.log 2>&1 + grep -q -F -e "Files with failing tests:" -e "Test files exiting with errors:" $i.log + if [ $? -eq 0 ]; then + echo "FAIL: $i" + cat $i.log + else + echo "PASS: $i" + fi + rm -f $i.log +done diff --git a/recipes-devtools/tcltk/tcl/tcl-add-soname.patch b/recipes-devtools/tcltk/tcl/tcl-add-soname.patch new file mode 100644 index 0000000..c4283c4 --- /dev/null +++ b/recipes-devtools/tcltk/tcl/tcl-add-soname.patch @@ -0,0 +1,32 @@ +Upstream-Status: Pending + +Index: unix/tcl.m4 +=================================================================== +--- a/unix.orig/tcl.m4 2013-09-19 13:17:13.000000000 -0700 ++++ b/unix/tcl.m4 2013-11-11 00:17:24.263485123 -0800 +@@ -1415,6 +1415,9 @@ + # get rid of the warnings. + #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" + ++ # following line added by CW for Debian GNU/Linux ++ TCL_SHLIB_LD_EXTRAS="-Wl,-soname,${TCL_LIB_FILE}.0" ++ + SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" +Index: unix/Makefile.in +=================================================================== +--- a/unix.orig/Makefile.in 2013-09-19 13:17:13.000000000 -0700 ++++ b/unix/Makefile.in 2013-11-11 00:20:32.423489861 -0800 +@@ -796,7 +796,10 @@ + done; + @echo "Installing $(LIB_FILE) to $(DLL_INSTALL_DIR)/" + @@INSTALL_LIB@ +- @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" ++ mv "$(DLL_INSTALL_DIR)"/$(LIB_FILE) "$(DLL_INSTALL_DIR)"/$(LIB_FILE).0 ++ ln -sf $(LIB_FILE).0 "$(DLL_INSTALL_DIR)"/$(LIB_FILE) ++ ln -sf "$(DLL_INSTALL_DIR)"/$(LIB_FILE).0 ./ ++ @chmod 555 "$(DLL_INSTALL_DIR)"/$(LIB_FILE).0 + @echo "Installing ${TCL_EXE} as $(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" + @$(INSTALL_PROGRAM) ${TCL_EXE} "$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" + @echo "Installing tclConfig.sh to $(CONFIG_INSTALL_DIR)/" diff --git a/recipes-devtools/tcltk/tcl/tcl-remove-hardcoded-install-path.patch b/recipes-devtools/tcltk/tcl/tcl-remove-hardcoded-install-path.patch new file mode 100644 index 0000000..99c5faf --- /dev/null +++ b/recipes-devtools/tcltk/tcl/tcl-remove-hardcoded-install-path.patch @@ -0,0 +1,32 @@ +From 6efc98774681795712073c2b91e5e9d1763239b8 Mon Sep 17 00:00:00 2001 +From: "Song.Li" Song.Li@windriver.com +Date: Wed, 1 Aug 2012 19:05:51 +0800 +Subject: [PATCH] tcl:install tcl to lib64 instead of lib on 64bit target + +Remove hardcoded library install path. Change $(prefix)/lib/ to ${libdir}. + +[YOCTO #2876] + +Upstream-Status: Pending + +Signed-off-by: Song.Li Song.Li@windriver.com +Signed-off-by: Kai Kang kai.kang@windriver.com +Signed-off-by: Yi Zhao yi.zhao@windriver.com +--- + configure | 2 +- + configure.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +Index: unix/configure.in +=================================================================== +--- a/unix.orig/configure.in 2013-11-10 23:20:50.000000000 -0800 ++++ b/unix/configure.in 2013-11-10 23:39:41.199428131 -0800 +@@ -790,7 +790,7 @@ + + eval "TCL_LIB_FILE=${TCL_LIB_FILE}" + +-test -z "$TCL_LIBRARY" && TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)' ++test -z "$TCL_LIBRARY" && TCL_LIBRARY='$(libdir)/tcl$(VERSION)' + PRIVATE_INCLUDE_DIR='$(includedir)' + HTML_DIR='$(DISTDIR)/html' +
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- recipes-extended/bzip2/bzip2-morello_1.0.8.bb | 72 ++++++++++++++++++ recipes-extended/bzip2/files/Makefile.am | 74 +++++++++++++++++++ recipes-extended/bzip2/files/configure.ac | 11 +++ recipes-extended/bzip2/files/run-ptest | 2 + 4 files changed, 159 insertions(+) create mode 100644 recipes-extended/bzip2/bzip2-morello_1.0.8.bb create mode 100644 recipes-extended/bzip2/files/Makefile.am create mode 100644 recipes-extended/bzip2/files/configure.ac create mode 100644 recipes-extended/bzip2/files/run-ptest
diff --git a/recipes-extended/bzip2/bzip2-morello_1.0.8.bb b/recipes-extended/bzip2/bzip2-morello_1.0.8.bb new file mode 100644 index 0000000..f526263 --- /dev/null +++ b/recipes-extended/bzip2/bzip2-morello_1.0.8.bb @@ -0,0 +1,72 @@ +inherit autotools update-alternatives ptest relative_symlinks purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-extended/bzip2/bzip2_1.0.8.bb" + +SUMMARY = "Very high-quality data compression program - CHERI: sourced from poky/meta" +DESCRIPTION = "bzip2 compresses files using the Burrows-Wheeler block-sorting text compression algorithm, and \ +Huffman coding. Compression is generally considerably better than that achieved by more conventional \ +LZ77/LZ78-based compressors, and approaches the performance of the PPM family of statistical compressors." +HOMEPAGE = "https://sourceware.org/bzip2/" +SECTION = "console/utils" +LICENSE = "bzip2-1.0.6 & GPL-3.0-or-later & Apache-2.0 & MS-PL & BSD-3-Clause & Zlib" +LICENSE:${PN} = "bzip2-1.0.6" +LICENSE:${PN}-dev = "bzip2-1.0.6" +LICENSE:${PN}-dbg = "bzip2-1.0.6" +LICENSE:${PN}-doc = "bzip2-1.0.6" +LICENSE:${PN}-src = "bzip2-1.0.6" +LICENSE:libbz2 = "bzip2-1.0.6" +LICENSE:${PN}-ptest = "bzip2-1.0.6 & GPL-3.0-or-later & Apache-2.0 & MS-PL & BSD-3-Clause & Zlib" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +BPN_BZIP2 = "bzip2" + +LIC_FILES_CHKSUM = "file://LICENSE;beginline=4;endline=37;md5=600af43c50f1fcb82e32f19b32df4664 \ + file://${WORKDIR}/git/commons-compress/LICENSE.txt;md5=86d3f3a95c324c9479bd8986968f4327 \ + file://${WORKDIR}/git/dotnetzip/License.txt;md5=9cb56871eed4e748c3bc7e8ff352a54f \ + file://${WORKDIR}/git/dotnetzip/License.zlib.txt;md5=cc421ccd22eeb2e5db6b79e6de0a029f \ + file://${WORKDIR}/git/go/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707 \ + file://${WORKDIR}/git/lbzip2/COPYING;md5=d32239bcb673463ab874e80d47fae504 \ +" + +SRC_URI = "https://sourceware.org/pub/%24%7BBPN_BZIP2%7D/%24%7BBPN_BZIP2%7D-%24%7BPV%7D... \ + git://sourceware.org/git/bzip2-tests.git;name=bzip2-tests;branch=master \ + file://configure.ac;subdir=${BPN_BZIP2}-${PV} \ + file://Makefile.am;subdir=${BPN_BZIP2}-${PV} \ + file://run-ptest \ + " + +S = "${WORKDIR}/${BPN_BZIP2}-${PV}" + +SRC_URI[md5sum] = "67e051268d0c475ea773822f7500d0e5" +SRC_URI[sha256sum] = "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269" + +SRCREV_bzip2-tests = "f9061c030a25de5b6829e1abf373057309c734c0" + +UPSTREAM_CHECK_URI = "https://www.sourceware.org/pub/bzip2/" + +PACKAGES =+ "libbz2-morello" + +CFLAGS:append = " -fPIC -fpic -Winline -fno-strength-reduce -D_FILE_OFFSET_BITS=64" + +ALTERNATIVE_PRIORITY = "100" + +do_configure:prepend () { + sed -i -e "s|%BZIP2_VERSION%|${PV}|" ${S}/configure.ac +} + +PTEST_PATH = "${libdir}/bzip2/ptest" + +do_install_ptest () { + install -d ${D}${PTEST_PATH}/bzip2-tests + cp -r ${WORKDIR}/git/commons-compress ${D}${PTEST_PATH}/bzip2-tests/commons-compress + cp -r ${WORKDIR}/git/dotnetzip ${D}${PTEST_PATH}/bzip2-tests/dotnetzip + cp -r ${WORKDIR}/git/go ${D}${PTEST_PATH}/bzip2-tests/go + cp -r ${WORKDIR}/git/lbzip2 ${D}${PTEST_PATH}/bzip2-tests/lbzip2 + cp -r ${WORKDIR}/git/pyflate ${D}${PTEST_PATH}/bzip2-tests/pyflate + cp ${WORKDIR}/git/README ${D}${PTEST_PATH}/bzip2-tests/ + cp ${WORKDIR}/git/run-tests.sh ${D}${PTEST_PATH}/bzip2-tests/ + sed -i -e "s|^Makefile:|_Makefile:|" ${D}${PTEST_PATH}/Makefile +} + +RDEPENDS:${PN}-ptest += "make bash" \ No newline at end of file diff --git a/recipes-extended/bzip2/files/Makefile.am b/recipes-extended/bzip2/files/Makefile.am new file mode 100644 index 0000000..d12d3a4 --- /dev/null +++ b/recipes-extended/bzip2/files/Makefile.am @@ -0,0 +1,74 @@ + +lib_LTLIBRARIES = libbz2.la +libbz2_la_LDFLAGS = -version-info 1:8:0 + +libbz2_la_SOURCES = blocksort.c \ + huffman.c \ + crctable.c \ + randtable.c \ + compress.c \ + decompress.c \ + bzlib.c + +bin_PROGRAMS = bzip2 bzip2recover + +bzip2_SOURCES = bzip2.c +bzip2_LDADD = libbz2.la +bzip2_DEPENDENCIES = libbz2.la + +include_HEADERS = bzlib.h + +bzip2recover_SOURCES = bzip2recover.c +bzip2recover_LDADD = libbz2.la +bzip2recover_DEPENDENCIES = libbz2.la + +bin_SCRIPTS = bzgrep bzmore bzdiff + +man_MANS = bzip2.1 bzgrep.1 bzmore.1 bzdiff.1 +EXTRA_DIST = $(man_MANS) + +runtest: + ./bzip2 -1 < sample1.ref > sample1.rb2 + ./bzip2 -2 < sample2.ref > sample2.rb2 + ./bzip2 -3 < sample3.ref > sample3.rb2 + ./bzip2 -d < sample1.bz2 > sample1.tst + ./bzip2 -d < sample2.bz2 > sample2.tst + ./bzip2 -ds < sample3.bz2 > sample3.tst + @if cmp sample1.bz2 sample1.rb2; then echo "PASS: sample1 compress";\ + else echo "FAIL: sample1 compress"; fi + @if cmp sample2.bz2 sample2.rb2; then echo "PASS: sample2 compress";\ + else echo "FAIL: sample2 compress"; fi + @if cmp sample3.bz2 sample3.rb2; then echo "PASS: sample3 compress";\ + else echo "FAIL: sample3 compress"; fi + @if cmp sample1.tst sample1.ref; then echo "PASS: sample1 decompress";\ + else echo "FAIL: sample1 decompress"; fi + @if cmp sample2.tst sample2.ref; then echo "PASS: sample2 decompress";\ + else echo "FAIL: sample2 decompress"; fi + @if cmp sample3.tst sample3.ref; then echo "PASS: sample3 decompress";\ + else echo "FAIL: sample3 decompress"; fi + ./bzip2-tests/run-tests.sh --without-valgrind --tests-dir="$(PWD)/bzip2-tests" + +install-ptest: + sed -n '/^runtest:/,/^install-ptest:/{/^install-ptest:/!p}' \ + $(srcdir)/Makefile.am > $(DESTDIR)/Makefile + cp $(srcdir)/sample1.ref $(DESTDIR)/ + cp $(srcdir)/sample2.ref $(DESTDIR)/ + cp $(srcdir)/sample3.ref $(DESTDIR)/ + cp $(srcdir)/sample1.bz2 $(DESTDIR)/ + cp $(srcdir)/sample2.bz2 $(DESTDIR)/ + cp $(srcdir)/sample3.bz2 $(DESTDIR)/ + ln -s $(bindir)/bzip2 $(DESTDIR)/bzip2 + +install-exec-hook: + ln -s $(bindir)/bzip2$(EXEEXT) $(DESTDIR)$(bindir)/bunzip2$(EXEEXT) + ln -s $(bindir)/bzip2$(EXEEXT) $(DESTDIR)$(bindir)/bzcat$(EXEEXT) + ln -s $(bindir)/bzgrep$(EXEEXT) $(DESTDIR)$(bindir)/bzegrep$(EXEEXT) + ln -s $(bindir)/bzgrep$(EXEEXT) $(DESTDIR)$(bindir)/bzfgrep$(EXEEXT) + ln -s $(bindir)/bzmore$(EXEEXT) $(DESTDIR)$(bindir)/bzless$(EXEEXT) + ln -s $(bindir)/bzdiff$(EXEEXT) $(DESTDIR)$(bindir)/bzcmp$(EXEEXT) + +install-data-hook: + echo ".so man1/bzgrep.1" > $(DESTDIR)$(mandir)/man1/bzegrep.1 + echo ".so man1/bzgrep.1" > $(DESTDIR)$(mandir)/man1/bzfgrep.1 + echo ".so man1/bzmore.1" > $(DESTDIR)$(mandir)/man1/bzless.1 + echo ".so man1/bzdiff.1" > $(DESTDIR)$(mandir)/man1/bzcmp.1 diff --git a/recipes-extended/bzip2/files/configure.ac b/recipes-extended/bzip2/files/configure.ac new file mode 100644 index 0000000..b8abade --- /dev/null +++ b/recipes-extended/bzip2/files/configure.ac @@ -0,0 +1,11 @@ +AC_PREREQ([2.57]) + +AC_INIT(bzip2, %BZIP2_VERSION%) +AM_INIT_AUTOMAKE(foreign) +AM_MAINTAINER_MODE + +AC_PROG_CC +AC_PROG_LIBTOOL + +AC_OUTPUT([Makefile]) + diff --git a/recipes-extended/bzip2/files/run-ptest b/recipes-extended/bzip2/files/run-ptest new file mode 100644 index 0000000..3b20fce --- /dev/null +++ b/recipes-extended/bzip2/files/run-ptest @@ -0,0 +1,2 @@ +#!/bin/sh +make -k runtest
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- .../libidn2/libidn2-morello_2.3.2.bb | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 recipes-extended/libidn2/libidn2-morello_2.3.2.bb
diff --git a/recipes-extended/libidn2/libidn2-morello_2.3.2.bb b/recipes-extended/libidn2/libidn2-morello_2.3.2.bb new file mode 100644 index 0000000..e821c63 --- /dev/null +++ b/recipes-extended/libidn2/libidn2-morello_2.3.2.bb @@ -0,0 +1,50 @@ +inherit pkgconfig autotools gettext texinfo gtk-doc lib_package purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-extended/libidn/libidn2_2.3.2.bb" + +SUMMARY = "Internationalized Domain Name support library" +DESCRIPTION = "Implementation of the Stringprep, Punycode and IDNA specifications defined by the IETF Internationalized Domain Names (IDN) working group." +HOMEPAGE = "http://www.gnu.org/software/libidn/" +SECTION = "libs" +LICENSE = "(GPL-2.0-or-later | LGPL-3.0-only) & GPL-3.0-or-later & Unicode-DFS-2016" +LIC_FILES_CHKSUM = "file://COPYING;md5=2d834ea7d480438ada04e5d846152395 \ + file://COPYING.LESSERv3;md5=e6a600fd5e1d9cbde2d983680233ad02 \ + file://COPYINGv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.unicode;md5=684cf5f7e3fded3546679424528261a9 \ + file://src/idn2.c;endline=16;md5=e4b6d628a84a55f1fd8ae4c76c5f6509 \ + file://lib/idn2.h.in;endline=27;md5=d0fc8ec628be130a1d5b889107e92477" + +SRC_URI = "${GNU_MIRROR}/libidn/libidn2-${PV}.tar.gz" +SRC_URI[sha256sum] = "76940cd4e778e8093579a9d195b25fff5e936e9dc6242068528b437a76764f91" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +S = "${WORKDIR}/libidn2-${PV}" + +DEPENDS = "virtual/libiconv libunistring-morello" + + +EXTRA_OECONF += "--disable-rpath \ + --with-libunistring-prefix=${STAGING_EXECPREFIXDIR} \ + " + +do_install() { + install -d ${D} + oe_runmake DESTDIR=${D} install +} + +do_install:append() { + # Need to remove any duplicate whitespace too for reproducibility + sed -i -e 's|-L${STAGING_DIR_TARGET}${libdir}||' -e 's/ */ /g' ${D}${libdir}/pkgconfig/libidn2.pc +} + +do_install:append() { + rm -rf ${D}${datadir}/emacs +} + +do_install:append() { + ${READELF_COMMAND} ${D}${libdir}/libidn2.so > ${D}${PURECAP_DEBUGDIR}/libidn2.so.readelf +} + +LICENSE:${PN} = "(GPL-2.0-or-later | LGPL-3.0-only) & Unicode-DFS-2016" +LICENSE:${PN}-bin = "GPL-3.0-or-later"
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- ...ow-for-storing-caps-in-shared-memory.patch | 30 +++++++++++++++ .../linux/files/0003-defconfig-modify.patch | 38 +++++++++++++++++++ recipes-kernel/linux/linux-morello_%.bbappend | 6 +++ 3 files changed, 74 insertions(+) create mode 100644 recipes-kernel/linux/cheri-patches/0001-mman-allow-for-storing-caps-in-shared-memory.patch create mode 100644 recipes-kernel/linux/files/0003-defconfig-modify.patch create mode 100644 recipes-kernel/linux/linux-morello_%.bbappend
diff --git a/recipes-kernel/linux/cheri-patches/0001-mman-allow-for-storing-caps-in-shared-memory.patch b/recipes-kernel/linux/cheri-patches/0001-mman-allow-for-storing-caps-in-shared-memory.patch new file mode 100644 index 0000000..9a2d208 --- /dev/null +++ b/recipes-kernel/linux/cheri-patches/0001-mman-allow-for-storing-caps-in-shared-memory.patch @@ -0,0 +1,30 @@ +From c3c49bd74d4d0b8b30c25841ba1ccca3fd3fe6b5 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Thu, 20 Apr 2023 15:32:50 +0100 +Subject: [PATCH] mman: allow for storing caps in shared memory + +This is a temporary hack to keep the work with postgresql +going. It does require for sharing pointers in this way. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + arch/arm64/include/asm/mman.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/include/asm/mman.h b/arch/arm64/include/asm/mman.h +index 39b1023ac9bc..ccea9fa3d3df 100644 +--- a/arch/arm64/include/asm/mman.h ++++ b/arch/arm64/include/asm/mman.h +@@ -44,7 +44,8 @@ static inline unsigned long arch_calc_vm_flag_bits(unsigned long flags) + * tags. Might need to explicitly allow or explicitly disallow certain + * filesystems. + */ +- if (system_supports_morello() && ((flags & MAP_TYPE) == 0x02 /* MAP_PRIVATE */)) ++ if (system_supports_morello() && ((flags & MAP_TYPE) == 0x02 ++ || (flags & MAP_TYPE) == 0x01 )) /* MAP_PRIVATE | MAP_SHARED */ + ret |= VM_READ_CAPS | VM_WRITE_CAPS; + + return ret; +-- +2.34.1 + diff --git a/recipes-kernel/linux/files/0003-defconfig-modify.patch b/recipes-kernel/linux/files/0003-defconfig-modify.patch new file mode 100644 index 0000000..7b81a05 --- /dev/null +++ b/recipes-kernel/linux/files/0003-defconfig-modify.patch @@ -0,0 +1,38 @@ +From 2c53215daa9c483f823a9313243347394f8c40ae Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Mon, 24 Apr 2023 10:11:21 +0100 +Subject: [PATCH] defconfig: modify + +Add more debug. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + arch/arm64/configs/morello_transitional_pcuabi_defconfig | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/configs/morello_transitional_pcuabi_defconfig b/arch/arm64/configs/morello_transitional_pcuabi_defconfig +index 515e50ce58aa..d19bbe4d1790 100644 +--- a/arch/arm64/configs/morello_transitional_pcuabi_defconfig ++++ b/arch/arm64/configs/morello_transitional_pcuabi_defconfig +@@ -165,3 +165,18 @@ CONFIG_DEBUG_FS=y + # CONFIG_FTRACE is not set + CONFIG_CORESIGHT=y + CONFIG_MEMTEST=y ++ ++CONFIG_FTRACE=y ++CONFIG_BOOTTIME_TRACING=y ++CONFIG_FUNCTION_TRACER=y ++CONFIG_STACK_TRACER=y ++CONFIG_IRQSOFF_TRACER=y ++CONFIG_PREEMPT_TRACER=y ++CONFIG_SCHED_TRACER=y ++CONFIG_HWLAT_TRACER=y ++CONFIG_OSNOISE_TRACER=y ++CONFIG_TIMERLAT_TRACER=y ++CONFIG_ENABLE_DEFAULT_TRACERS=y ++CONFIG_FTRACE_SYSCALLS=y ++CONFIG_TRACER_SNAPSHOT=y ++CONFIG_DYNAMIC_DEBUG=y +-- +2.34.1 + diff --git a/recipes-kernel/linux/linux-morello_%.bbappend b/recipes-kernel/linux/linux-morello_%.bbappend new file mode 100644 index 0000000..9c0d986 --- /dev/null +++ b/recipes-kernel/linux/linux-morello_%.bbappend @@ -0,0 +1,6 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}:${THISDIR}/cheri-patches:" + +SRC_URI += "\ + file://0001-mman-allow-for-storing-caps-in-shared-memory.patch \ + file://files/0003-defconfig-modify.patch \ + "
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- ....c-patch-out-tests-that-require-a-wo.patch | 37 +++++++++ ...ncrease-default-timeval-tolerance-50.patch | 33 ++++++++ ...-monotonic_prc_fallback-as-retriable.patch | 28 +++++++ ...ts-are-marked-failed-only-when-all-a.patch | 81 +++++++++++++++++++ .../files/Makefile-missing-test-dir.patch | 27 +++++++ recipes-support/libevent/files/run-ptest | 29 +++++++ .../libevent/libevent-morello_2.1.12.bb | 64 +++++++++++++++ 7 files changed, 299 insertions(+) create mode 100644 recipes-support/libevent/files/0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch create mode 100644 recipes-support/libevent/files/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch create mode 100644 recipes-support/libevent/files/0003-test-mark-util-monotonic_prc_fallback-as-retriable.patch create mode 100644 recipes-support/libevent/files/0004-test-retriable-tests-are-marked-failed-only-when-all-a.patch create mode 100644 recipes-support/libevent/files/Makefile-missing-test-dir.patch create mode 100644 recipes-support/libevent/files/run-ptest create mode 100644 recipes-support/libevent/libevent-morello_2.1.12.bb
diff --git a/recipes-support/libevent/files/0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch b/recipes-support/libevent/files/0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch new file mode 100644 index 0000000..505153d --- /dev/null +++ b/recipes-support/libevent/files/0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch @@ -0,0 +1,37 @@ +From 7c17967b8fd2d18b74a8934fd9bb8212ebd6a271 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin alex.kanavin@gmail.com +Date: Thu, 9 Jan 2020 13:22:46 +0100 +Subject: [PATCH] test/regress_dns.c: patch out tests that require a working + DNS + +This is not guaranteed for ptests under qemu, and in the absence +of a DNS that can reach to the internet, these tests fail. + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin alex.kanavin@gmail.com +--- + test/regress_dns.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/test/regress_dns.c b/test/regress_dns.c +index d2084b7..a1a8f3b 100644 +--- a/test/regress_dns.c ++++ b/test/regress_dns.c +@@ -2394,8 +2394,6 @@ struct testcase_t dns_testcases[] = { + { "reissue_disable_when_inactive", dns_reissue_disable_when_inactive_test, + TT_FORK|TT_NEED_BASE|TT_NO_LOGS, &basic_setup, NULL }, + { "inflight", dns_inflight_test, TT_FORK|TT_NEED_BASE, &basic_setup, NULL }, +- { "bufferevent_connect_hostname", test_bufferevent_connect_hostname, +- TT_FORK|TT_NEED_BASE, &basic_setup, NULL }, + #ifdef EVENT__HAVE_SETRLIMIT + { "bufferevent_connect_hostname_emfile", test_bufferevent_connect_hostname, + TT_FORK|TT_NEED_BASE, &basic_setup, (char*)"emfile" }, +@@ -2405,8 +2403,6 @@ struct testcase_t dns_testcases[] = { + { "disable_when_inactive_no_ns", dns_disable_when_inactive_no_ns_test, + TT_FORK|TT_NEED_BASE|TT_NO_LOGS, &basic_setup, NULL }, + +- { "initialize_nameservers", dns_initialize_nameservers_test, +- TT_FORK|TT_NEED_BASE, &basic_setup, NULL }, + #ifndef _WIN32 + { "nameservers_no_default", dns_nameservers_no_default_test, + TT_FORK|TT_NEED_BASE, &basic_setup, NULL }, diff --git a/recipes-support/libevent/files/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch b/recipes-support/libevent/files/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch new file mode 100644 index 0000000..0b20eda --- /dev/null +++ b/recipes-support/libevent/files/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch @@ -0,0 +1,33 @@ +From dff8fd27edb23bc1486809186c6a4fe1f75f2179 Mon Sep 17 00:00:00 2001 +From: Yi Fan Yu yifan.yu@windriver.com +Date: Thu, 22 Apr 2021 22:35:59 -0400 +Subject: [PATCH] test/regress.h: Increase default timeval tolerance 50 ms -> + 100 ms + +The default timeout tolerance is 50 ms, +which causes intermittent failure in many the +related tests in arm64 QEMU. + +See: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14163 +(The root cause seems to be a heavy load) + +Upstream-Status: Submitted [https://github.com/libevent/libevent/pull/1157] + +Signed-off-by: Yi Fan Yu yifan.yu@windriver.com +--- + test/regress.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/regress.h b/test/regress.h +index f06a7669..829af4a7 100644 +--- a/test/regress.h ++++ b/test/regress.h +@@ -127,7 +127,7 @@ int test_ai_eq_(const struct evutil_addrinfo *ai, const char *sockaddr_port, + tt_int_op(labs(timeval_msec_diff((tv1), (tv2)) - diff), <=, tolerance) + + #define test_timeval_diff_eq(tv1, tv2, diff) \ +- test_timeval_diff_leq((tv1), (tv2), (diff), 50) ++ test_timeval_diff_leq((tv1), (tv2), (diff), 100) + + long timeval_msec_diff(const struct timeval *start, const struct timeval *end); + diff --git a/recipes-support/libevent/files/0003-test-mark-util-monotonic_prc_fallback-as-retriable.patch b/recipes-support/libevent/files/0003-test-mark-util-monotonic_prc_fallback-as-retriable.patch new file mode 100644 index 0000000..ddc19c4 --- /dev/null +++ b/recipes-support/libevent/files/0003-test-mark-util-monotonic_prc_fallback-as-retriable.patch @@ -0,0 +1,28 @@ +From d01a57a998798da977c470f3b8d6a457c1adb144 Mon Sep 17 00:00:00 2001 +From: Azat Khuzhin azat@libevent.org +Date: Sun, 19 Sep 2021 00:57:31 +0300 +Subject: [PATCH] test: mark util/monotonic_prc_fallback as retriable + +Refs: #1193 + +Upstream-Status: Backport +--- + test/regress_util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/regress_util.c b/test/regress_util.c +index 45caa2700a40..a9e80db20149 100644 +--- a/test/regress_util.c ++++ b/test/regress_util.c +@@ -1672,7 +1672,7 @@ struct testcase_t util_testcases[] = { + { "monotonic_res_fallback", test_evutil_monotonic_res, TT_OFF_BY_DEFAULT, &basic_setup, (void*)"fallback" }, + { "monotonic_prc", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"" }, + { "monotonic_prc_precise", test_evutil_monotonic_prc, TT_RETRIABLE, &basic_setup, (void*)"precise" }, +- { "monotonic_prc_fallback", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"fallback" }, ++ { "monotonic_prc_fallback", test_evutil_monotonic_prc, TT_RETRIABLE, &basic_setup, (void*)"fallback" }, + { "date_rfc1123", test_evutil_date_rfc1123, 0, NULL, NULL }, + { "evutil_v4addr_is_local", test_evutil_v4addr_is_local, 0, NULL, NULL }, + { "evutil_v6addr_is_local", test_evutil_v6addr_is_local, 0, NULL, NULL }, +-- +2.31.1 + diff --git a/recipes-support/libevent/files/0004-test-retriable-tests-are-marked-failed-only-when-all-a.patch b/recipes-support/libevent/files/0004-test-retriable-tests-are-marked-failed-only-when-all-a.patch new file mode 100644 index 0000000..ea17e87 --- /dev/null +++ b/recipes-support/libevent/files/0004-test-retriable-tests-are-marked-failed-only-when-all-a.patch @@ -0,0 +1,81 @@ +From 36ebd92fa53c0097f1e2f9ec5aa5b5c6ec1b411d Mon Sep 17 00:00:00 2001 +From: Thomas Perrot thomas.perrot@bootlin.com +Date: Wed, 29 Sep 2021 13:50:35 +0200 +Subject: [PATCH] test: retriable tests are marked failed only when all + attempts have failed + +Fixes: #1193 + +Upstream-Status: Accepted + +Signed-off-by: Thomas Perrot thomas.perrot@bootlin.com +--- + test/tinytest.c | 13 ++++++------- + test/tinytest.h | 2 +- + 2 files changed, 7 insertions(+), 8 deletions(-) + +diff --git a/test/tinytest.c b/test/tinytest.c +index 85dfe74a720e..bf2882418eb6 100644 +--- a/test/tinytest.c ++++ b/test/tinytest.c +@@ -310,7 +310,8 @@ testcase_run_forked_(const struct testgroup_t *group, + + int + testcase_run_one(const struct testgroup_t *group, +- const struct testcase_t *testcase) ++ const struct testcase_t *testcase, ++ const int test_attempts) + { + enum outcome outcome; + +@@ -348,7 +349,7 @@ testcase_run_one(const struct testgroup_t *group, + if (opt_verbosity>0 && !opt_forked) + puts("SKIPPED"); + } else { +- if (!opt_forked) ++ if (!opt_forked && (testcase->flags & TT_RETRIABLE) && !test_attempts) + printf("\n [%s FAILED]\n", testcase->name); + } + +@@ -525,22 +526,20 @@ tinytest_main(int c, const char **v, struct testgroup_t *groups) + struct testgroup_t *group = &groups[i]; + for (j = 0; group->cases[j].name; ++j) { + struct testcase_t *testcase = &group->cases[j]; +- int test_attempts = 3; ++ int test_attempts = (testcase->flags & TT_RETRIABLE) ? 3: 1; + int test_ret_err; + + if (!(testcase->flags & TT_ENABLED_)) + continue; + + for (;;) { +- test_ret_err = testcase_run_one(group, testcase); ++ test_ret_err = testcase_run_one(group, testcase, test_attempts); + + if (test_ret_err == OK) + break; +- if (!(testcase->flags & TT_RETRIABLE)) ++ if (!--test_attempts) + break; + printf("\n [RETRYING %s (%i)]\n", testcase->name, test_attempts); +- if (!test_attempts--) +- break; + } + + switch (test_ret_err) { +diff --git a/test/tinytest.h b/test/tinytest.h +index d321dd467542..c276b5339331 100644 +--- a/test/tinytest.h ++++ b/test/tinytest.h +@@ -92,7 +92,7 @@ char *tinytest_format_hex_(const void *, unsigned long); + tinytest_set_flag_(groups, named, 1, TT_SKIP) + + /** Run a single testcase in a single group. */ +-int testcase_run_one(const struct testgroup_t *,const struct testcase_t *); ++int testcase_run_one(const struct testgroup_t *,const struct testcase_t *, const int test_attempts); + + void tinytest_set_aliases(const struct testlist_alias_t *aliases); + +-- +2.31.1 + diff --git a/recipes-support/libevent/files/Makefile-missing-test-dir.patch b/recipes-support/libevent/files/Makefile-missing-test-dir.patch new file mode 100644 index 0000000..8880bd0 --- /dev/null +++ b/recipes-support/libevent/files/Makefile-missing-test-dir.patch @@ -0,0 +1,27 @@ +Fix missing test directory creation. + +GCC used in OE-core has "dependency tracking" disabled and +libevent has problem with this. +Due to removed makefile.am/in files in test/sample/include +directories, output directories are not created in +configuration step. Compilation step will fails, when +trying to write to non-existing directory. + +Upstream-Status: Inappropriate [Other] +Workaround specific to our build system. + +Signed-off-by: Andrej Valek andrej.valek@siemens.com +Signed-off-by: Pascal Bach pascal.bach@siemens.com + +diff --git a/libevent-2.1.8-stable/test/include.am b/libevent-2.1.8-stable/test/include.am +index eea249f..d323dff 100644 +--- a/test/include.am ++++ b/test/include.am +@@ -161,6 +161,7 @@ test_bench_httpclient_LDADD = $(LIBEVENT_GC_SECTIONS) libevent_core.la + test/regress.gen.c test/regress.gen.h: test/rpcgen-attempted + + test/rpcgen-attempted: test/regress.rpc event_rpcgen.py test/rpcgen_wrapper.sh ++ @$(MKDIR_P) test + $(AM_V_GEN)date -u > $@ + $(AM_V_at)if $(srcdir)/test/rpcgen_wrapper.sh $(srcdir)/test; then \ + true; \ diff --git a/recipes-support/libevent/files/run-ptest b/recipes-support/libevent/files/run-ptest new file mode 100644 index 0000000..ef4260d --- /dev/null +++ b/recipes-support/libevent/files/run-ptest @@ -0,0 +1,29 @@ +#!/bin/sh + +# run-ptest - 'ptest' test infrastructure shell script that +# wraps the libevent test scripts +# +# Trevor Gamblin trevor.gamblin@windriver.com +############################################################### +LIBEVENTLIB=@libdir@/libevent +LOG="${LIBEVENTLIB}/ptest/libevent_ptest_$(date +%Y%m%d-%H%M%S).log" + +cd ${LIBEVENTLIB}/ptest + +# Run only the libevent "regress" test. All other test scripts in the +# libevent "test" folder are related to performance, e.g. read/write +# rates, and/or do not provide a pass/fail output that can be recorded +# in the ptest log. +./test/regress 2>&1| sed -e '/TESTS/d' -e '/tests/d' -e '/OK/ s/^/PASS: / ; /FAILED/ s/^/FAIL: / ; /SKIPPED/ s/^/SKIP: / ; /DISABLED/ s/^/SKIP: /' | cut -f1,2 -d ':' | tee -a ${LOG} + +passed=`grep PASS: ${LOG}|wc -l` +failed=`grep FAIL: ${LOG}|wc -l` +skipped=`grep -E SKIP: ${LOG}|wc -l` +all=$((passed + failed + skipped)) + +( echo "=== Test Summary ===" + echo "TOTAL: ${all}" + echo "PASSED: ${passed}" + echo "FAILED: ${failed}" + echo "SKIPPED: ${skipped}" +) | tee -a ${LOG} diff --git a/recipes-support/libevent/libevent-morello_2.1.12.bb b/recipes-support/libevent/libevent-morello_2.1.12.bb new file mode 100644 index 0000000..fa5e5ff --- /dev/null +++ b/recipes-support/libevent/libevent-morello_2.1.12.bb @@ -0,0 +1,64 @@ +inherit autotools ptest purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-support/libevent/libevent_2.1.12.bb" + +SUMMARY = "An asynchronous event notification library" +DESCRIPTION = "A software library that provides asynchronous event \ +notification. The libevent API provides a mechanism to execute a callback \ +function when a specific event occurs on a file descriptor or after a \ +timeout has been reached. libevent also supports callbacks triggered \ +by signals and regular timeouts" +HOMEPAGE = "http://libevent.org/" +BUGTRACKER = "https://github.com/libevent/libevent/issues" +SECTION = "libs" + +FILESEXTRAPATHS:prepend := "${THISDIR}/patches:" +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +LICENSE = "BSD-3-Clause & MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=17f20574c0b154d12236d5fbe964f549" + +SRC_URI = "https://github.com/libevent/libevent/releases/download/release-%24%7BPV%7D-s... \ + file://Makefile-missing-test-dir.patch \ + file://run-ptest \ + file://0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch \ + file://0002-test-regress.h-Increase-default-timeval-tolerance-50.patch \ + file://0003-test-mark-util-monotonic_prc_fallback-as-retriable.patch \ + file://0004-test-retriable-tests-are-marked-failed-only-when-all-a.patch \ + " + +SRC_URI[sha256sum] = "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb" + +UPSTREAM_CHECK_URI = "http://libevent.org/" + +S = "${WORKDIR}/libevent-${PV}-stable" + +PACKAGECONFIG ??= "" +PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl-morello" + +# Needed for Debian packaging +LEAD_SONAME = "libevent-2.1.so" + +PACKAGES_DYNAMIC = "^${PN}-.*$" +python split_libevent_libs () { + do_split_packages(d, '${libdir}', r'^libevent_([a-z]*)-.*.so..*', 'libevent-%s', '${SUMMARY} (%s)', prepend=True, allow_links=True) +} +PACKAGESPLITFUNCS:prepend = "split_libevent_libs " + +PTEST_PATH = "${libdir}/libevent/ptest" + +do_install:append() { + rm ${D}${bindir}/event_rpcgen.py + rmdir ${D}${bindir} +} + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/test + for file in ${B}/test/.libs/regress ${B}/test/.libs/test* + do + install -m 0755 $file ${D}${PTEST_PATH}/test + done + + # handle multilib + sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest +} \ No newline at end of file
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- ...01-pcre_jit_compile-cheri-provenance.patch | 89 +++++++++ ...2-sljitNativeARM_64-cheri-provenance.patch | 61 ++++++ .../0003-sljitUtils-cheri-provenance.patch | 39 ++++ recipes-support/libpcre/files/Makefile | 183 ++++++++++++++++++ recipes-support/libpcre/files/run-ptest | 3 + .../libpcre/libpcre-morello_8.45.bb | 91 +++++++++ 6 files changed, 466 insertions(+) create mode 100644 recipes-support/libpcre/cheri-patches/0001-pcre_jit_compile-cheri-provenance.patch create mode 100644 recipes-support/libpcre/cheri-patches/0002-sljitNativeARM_64-cheri-provenance.patch create mode 100644 recipes-support/libpcre/cheri-patches/0003-sljitUtils-cheri-provenance.patch create mode 100644 recipes-support/libpcre/files/Makefile create mode 100644 recipes-support/libpcre/files/run-ptest create mode 100644 recipes-support/libpcre/libpcre-morello_8.45.bb
diff --git a/recipes-support/libpcre/cheri-patches/0001-pcre_jit_compile-cheri-provenance.patch b/recipes-support/libpcre/cheri-patches/0001-pcre_jit_compile-cheri-provenance.patch new file mode 100644 index 0000000..7677c0e --- /dev/null +++ b/recipes-support/libpcre/cheri-patches/0001-pcre_jit_compile-cheri-provenance.patch @@ -0,0 +1,89 @@ +From 69e5f4de49027e37d3a232cfc9ec882038091a13 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Thu, 9 Nov 2023 11:50:36 +0000 +Subject: [PATCH 1/3] pcre_jit_compile: cheri provenance + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + pcre_jit_compile.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/pcre_jit_compile.c b/pcre_jit_compile.c +index 4dcf8fc..b7b2cbc 100644 +--- a/pcre_jit_compile.c ++++ b/pcre_jit_compile.c +@@ -2486,7 +2486,7 @@ while (current != NULL) + break; + + case type_mark: +- if (STRCMP_UC_UC(skip_arg, (pcre_uchar *)current[2]) == 0) ++ if (STRCMP_UC_UC(skip_arg, (pcre_uchar *)(uintptr_t)current[2]) == 0) + return current[3]; + break; + +@@ -2495,7 +2495,7 @@ while (current != NULL) + break; + } + SLJIT_ASSERT(current[0] == 0 || current < (sljit_sw*)current[0]); +- current = (sljit_sw*)current[0]; ++ current = (sljit_sw*)(uintptr_t)current[0]; + } + return 0; + } +@@ -3683,7 +3683,7 @@ while (TRUE) + + case OP_DIGIT: + #if defined SUPPORT_UTF && defined COMPILE_PCRE8 +- if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_digit, FALSE)) ++ if (common->utf && !is_char7_bitset((const sljit_u8 *)(uintptr_t)(common->ctypes - cbit_length + cbit_digit), FALSE)) + return consumed; + #endif + any = TRUE; +@@ -3692,7 +3692,7 @@ while (TRUE) + + case OP_WHITESPACE: + #if defined SUPPORT_UTF && defined COMPILE_PCRE8 +- if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_space, FALSE)) ++ if (common->utf && !is_char7_bitset((const sljit_u8 *)(uintptr_t)(common->ctypes - cbit_length + cbit_space), FALSE)) + return consumed; + #endif + any = TRUE; +@@ -3701,7 +3701,7 @@ while (TRUE) + + case OP_WORDCHAR: + #if defined SUPPORT_UTF && defined COMPILE_PCRE8 +- if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_word, FALSE)) ++ if (common->utf && !is_char7_bitset((const sljit_u8 *)(uintptr_t)(common->ctypes - cbit_length + cbit_word), FALSE)) + return consumed; + #endif + any = TRUE; +@@ -6422,7 +6422,7 @@ switch(type) + if (check_str_ptr) + detect_partial_match(common, backtracks); + #if defined SUPPORT_UTF && defined COMPILE_PCRE8 +- if (common->utf && is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_digit, FALSE)) ++ if (common->utf && is_char7_bitset((const sljit_u8 *)(uintptr_t)(common->ctypes - cbit_length + cbit_digit), FALSE)) + read_char7_type(common, type == OP_NOT_DIGIT); + else + #endif +@@ -6437,7 +6437,7 @@ switch(type) + if (check_str_ptr) + detect_partial_match(common, backtracks); + #if defined SUPPORT_UTF && defined COMPILE_PCRE8 +- if (common->utf && is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_space, FALSE)) ++ if (common->utf && is_char7_bitset((const sljit_u8 *)(uintptr_t)(common->ctypes - cbit_length + cbit_space), FALSE)) + read_char7_type(common, type == OP_NOT_WHITESPACE); + else + #endif +@@ -6451,7 +6451,7 @@ switch(type) + if (check_str_ptr) + detect_partial_match(common, backtracks); + #if defined SUPPORT_UTF && defined COMPILE_PCRE8 +- if (common->utf && is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_word, FALSE)) ++ if (common->utf && is_char7_bitset((const sljit_u8 *)(uintptr_t)(common->ctypes - cbit_length + cbit_word), FALSE)) + read_char7_type(common, type == OP_NOT_WORDCHAR); + else + #endif +-- +2.34.1 + diff --git a/recipes-support/libpcre/cheri-patches/0002-sljitNativeARM_64-cheri-provenance.patch b/recipes-support/libpcre/cheri-patches/0002-sljitNativeARM_64-cheri-provenance.patch new file mode 100644 index 0000000..9c0880c --- /dev/null +++ b/recipes-support/libpcre/cheri-patches/0002-sljitNativeARM_64-cheri-provenance.patch @@ -0,0 +1,61 @@ +From b6c4c1121f09698ff8bc5c491898aeda33b449c8 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Thu, 9 Nov 2023 11:50:55 +0000 +Subject: [PATCH 2/3] sljitNativeARM_64: cheri provenance + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + sljit/sljitNativeARM_64.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/sljit/sljitNativeARM_64.c b/sljit/sljitNativeARM_64.c +index e15b345..6d450f1 100644 +--- a/sljit/sljitNativeARM_64.c ++++ b/sljit/sljitNativeARM_64.c +@@ -24,6 +24,7 @@ + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + ++#include <stdint.h> + SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void) + { + return "ARM-64" SLJIT_CPUINFO; +@@ -324,7 +325,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil + while (jump) { + do { + addr = (jump->flags & JUMP_LABEL) ? jump->u.label->addr : jump->u.target; +- buf_ptr = (sljit_ins *)jump->addr; ++ buf_ptr = (sljit_ins *)(uintptr_t)jump->addr; + + if (jump->flags & PATCH_B) { + addr = (sljit_sw)(addr - (sljit_uw)SLJIT_ADD_EXEC_OFFSET(buf_ptr, executable_offset)) >> 2; +@@ -358,7 +359,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil + put_label = compiler->put_labels; + while (put_label) { + addr = put_label->label->addr; +- buf_ptr = (sljit_ins *)put_label->addr; ++ buf_ptr = (sljit_ins *)(uintptr_t)put_label->addr; + + buf_ptr[0] |= (addr & 0xffff) << 5; + buf_ptr[1] |= ((addr >> 16) & 0xffff) << 5; +@@ -2020,7 +2021,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct slj + + SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset) + { +- sljit_ins* inst = (sljit_ins*)addr; ++ sljit_ins* inst = (sljit_ins*)(uintptr_t)addr; + modify_imm64_const(inst, new_target); + inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset); + SLJIT_CACHE_FLUSH(inst, inst + 4); +@@ -2028,7 +2029,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_ta + + SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_constant, sljit_sw executable_offset) + { +- sljit_ins* inst = (sljit_ins*)addr; ++ sljit_ins* inst = (sljit_ins*)(uintptr_t)addr; + modify_imm64_const(inst, new_constant); + inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset); + SLJIT_CACHE_FLUSH(inst, inst + 4); +-- +2.34.1 + diff --git a/recipes-support/libpcre/cheri-patches/0003-sljitUtils-cheri-provenance.patch b/recipes-support/libpcre/cheri-patches/0003-sljitUtils-cheri-provenance.patch new file mode 100644 index 0000000..5fb8b5c --- /dev/null +++ b/recipes-support/libpcre/cheri-patches/0003-sljitUtils-cheri-provenance.patch @@ -0,0 +1,39 @@ +From ac44bb2ccdf9c926c2a217e1002f5c4a49c549a8 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Thu, 9 Nov 2023 14:07:09 +0000 +Subject: [PATCH 3/3] sljitUtils: cheri provenance + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + sljit/sljitUtils.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sljit/sljitUtils.c b/sljit/sljitUtils.c +index 857492a..094cb5a 100644 +--- a/sljit/sljitUtils.c ++++ b/sljit/sljitUtils.c +@@ -312,7 +312,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_u8 *SLJIT_FUNC sljit_stack_resize(struct sljit_st + return NULL; + } + else { +- if (!VirtualFree((void*)aligned_old_start, aligned_new_start - aligned_old_start, MEM_DECOMMIT)) ++ if (!VirtualFree((void*)(uintptr_t)aligned_old_start, aligned_new_start - aligned_old_start, MEM_DECOMMIT)) + return NULL; + } + } +@@ -323,10 +323,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_u8 *SLJIT_FUNC sljit_stack_resize(struct sljit_st + /* If madvise is available, we release the unnecessary space. */ + #if defined(MADV_DONTNEED) + if (aligned_new_start > aligned_old_start) +- madvise((void*)aligned_old_start, aligned_new_start - aligned_old_start, MADV_DONTNEED); ++ madvise((void*)(uintptr_t)aligned_old_start, aligned_new_start - aligned_old_start, MADV_DONTNEED); + #elif defined(POSIX_MADV_DONTNEED) + if (aligned_new_start > aligned_old_start) +- posix_madvise((void*)aligned_old_start, aligned_new_start - aligned_old_start, POSIX_MADV_DONTNEED); ++ posix_madvise((void*)(uintptr_t)aligned_old_start, aligned_new_start - aligned_old_start, POSIX_MADV_DONTNEED); + #endif + } + #endif +-- +2.34.1 + diff --git a/recipes-support/libpcre/files/Makefile b/recipes-support/libpcre/files/Makefile new file mode 100644 index 0000000..708d807 --- /dev/null +++ b/recipes-support/libpcre/files/Makefile @@ -0,0 +1,183 @@ +TESTS = pcre_stringpiece_unittest RunTest RunGrepTest +subdir = . +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red='[0;31m'; \ + grn='[0;32m'; \ + lgn='[1;32m'; \ + blu='[1;34m'; \ + mgn='[0;35m'; \ + brg='[1m'; \ + std='[m'; \ + fi; \ +} +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +am__sh_e_setup = case $$- in *e*) set +e;; esac +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +MKDIR_P = /bin/mkdir -p +PACKAGE_STRING = PCRE 8.36 +SHELL = /bin/sh +srcdir = . +top_srcdir = . +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done; \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +pcre_stringpiece_unittest.log: pcre_stringpiece_unittest$(EXEEXT) + @p='pcre_stringpiece_unittest$(EXEEXT)'; \ + b='pcre_stringpiece_unittest'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) -- "$$tst" +RunTest.log: RunTest + @p='RunTest'; \ + b='RunTest'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) -- "$$tst" +RunGrepTest.log: RunGrepTest + @p='RunGrepTest'; \ + b='RunGrepTest'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) -- "$$tst" diff --git a/recipes-support/libpcre/files/run-ptest b/recipes-support/libpcre/files/run-ptest new file mode 100644 index 0000000..990d4a1 --- /dev/null +++ b/recipes-support/libpcre/files/run-ptest @@ -0,0 +1,3 @@ +#!/bin/sh + +make check-TESTS diff --git a/recipes-support/libpcre/libpcre-morello_8.45.bb b/recipes-support/libpcre/libpcre-morello_8.45.bb new file mode 100644 index 0000000..82e8c38 --- /dev/null +++ b/recipes-support/libpcre/libpcre-morello_8.45.bb @@ -0,0 +1,91 @@ +inherit autotools binconfig-disabled ptest purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-support/libpcre/libpcre_8.45.bb" + +DESCRIPTION = "The PCRE library is a set of functions that implement regular \ +expression pattern matching using the same syntax and semantics as Perl 5. PCRE \ +has its own native API, as well as a set of wrapper functions that correspond \ +to the POSIX regular expression API." +SUMMARY = "Perl Compatible Regular Expressions" +HOMEPAGE = "http://www.pcre.org" +SECTION = "devel" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENCE;md5=b5d5d1a69a24ea2718263f1ff85a1c58" + +FILESEXTRAPATHS:prepend := "${THISDIR}/cheri-patches:" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +SRC_URI = "${SOURCEFORGE_MIRROR}/pcre/pcre-${PV}.tar.bz2 \ + file://run-ptest \ + file://Makefile \ + " + +SRC_URI += "file://0001-pcre_jit_compile-cheri-provenance.patch \ + file://0002-sljitNativeARM_64-cheri-provenance.patch \ + file://0003-sljitUtils-cheri-provenance.patch \ + " + +SRC_URI[sha256sum] = "4dae6fdcd2bb0bb6c37b5f97c33c2be954da743985369cddac3546e3218bffb8" + +CVE_PRODUCT = "pcre" + +S = "${WORKDIR}/pcre-${PV}" + +PROVIDES += "pcre-morello" +DEPENDS += "bzip2-morello zlib-morello" + +PACKAGECONFIG ??= "pcre8 unicode-properties jit" + +PACKAGECONFIG[pcre8] = "--enable-pcre8,--disable-pcre8" +PACKAGECONFIG[pcre16] = "--enable-pcre16,--disable-pcre16" +PACKAGECONFIG[pcre32] = "--enable-pcre32,--disable-pcre32" +PACKAGECONFIG[pcretest-readline] = "--enable-pcretest-libreadline,--disable-pcretest-libreadline,readline-morello," +PACKAGECONFIG[unicode-properties] = "--enable-unicode-properties,--disable-unicode-properties" +PACKAGECONFIG[jit] = "--enable-jit=auto,--disable-jit" + +BINCONFIG = "${bindir}/pcre-config" + +EXTRA_OECONF = "--enable-utf --disable-cpp" + +PACKAGES =+ "libpcrecpp-morello libpcreposix-morello pcregrep-morello pcregrep-doc-morello pcretest-morello pcretest-doc-morello" + +SUMMARY:libpcrecpp-morello = "${SUMMARY} - C++ wrapper functions" +SUMMARY:libpcreposix-morello = "${SUMMARY} - C wrapper functions based on the POSIX regex API" +SUMMARY:pcregrep-morello = "grep utility that uses perl 5 compatible regexes" +SUMMARY:pcregrep-doc-morello = "grep utility that uses perl 5 compatible regexes - docs" +SUMMARY:pcretest-morello = "program for testing Perl-comatible regular expressions" +SUMMARY:pcretest-doc-morello = "program for testing Perl-comatible regular expressions - docs" + + +FILES:libpcrecpp-morello = "${libdir}/libpcrecpp.so.*" +FILES:libpcreposix-morello = "${libdir}/libpcreposix.so.*" +FILES:pcregrep-morello = "${bindir}/pcregrep" +FILES:pcregrep-doc-morello = "${mandir}/man1/pcregrep.1" +FILES:pcretest-morello = "${bindir}/pcretest" +FILES:pcretest-doc-morello = "${mandir}/man1/pcretest.1" + +do_install:append() { + ${OBJDUMP_COMMAND} ${D}${libdir}/libpcre.so.1.2.13 > ${D}${PURECAP_DEBUGDIR}/libpcre.dump + ${READELF_COMMAND} ${D}${libdir}/libpcre.so.1.2.13 > ${D}${PURECAP_DEBUGDIR}/libpcre.readelf +} + +PTEST_PATH = "${libdir}/libpcre/ptest" + +do_install_ptest() { + t=${D}${PTEST_PATH} + cp ${WORKDIR}/Makefile $t + cp -r ${S}/testdata $t + for i in pcre_stringpiece_unittest pcregrep pcretest; \ + do cp ${B}/.libs/$i $t; \ + done + for i in RunTest RunGrepTest test-driver; \ + do cp ${S}/$i $t; \ + done + # Skip the fr_FR locale test. If the locale fr_FR is found, it is tested. + # If not found, the test is skipped. The test program assumes fr_FR is non-UTF-8 + # locale so the test fails if fr_FR is UTF-8 locale. + sed -i -e 's:do3=yes:do3=no:g' ${D}${PTEST_PATH}/RunTest +} + +RDEPENDS:${PN}-ptest += "make" \ No newline at end of file
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- .../libunistring/libunistring-morello_1.0.bb | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 recipes-support/libunistring/libunistring-morello_1.0.bb
diff --git a/recipes-support/libunistring/libunistring-morello_1.0.bb b/recipes-support/libunistring/libunistring-morello_1.0.bb new file mode 100644 index 0000000..9ea0490 --- /dev/null +++ b/recipes-support/libunistring/libunistring-morello_1.0.bb @@ -0,0 +1,36 @@ +inherit autotools texinfo purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-support/libunistring/libunistring_1.0.bb" + +SUMMARY = "Library for manipulating C and Unicode strings" +DESCRIPTION = "Text files are nowadays usually encoded in Unicode, and may\ + consist of very different scripts from Latin letters to Chinese Hanzi\ + with many kinds of special characters accents, right-to-left writing\ + marks, hyphens, Roman numbers, and much more. But the POSIX platform\ + APIs for text do not contain adequate functions for dealing with\ + particular properties of many Unicode characters. In fact, the POSIX\ + APIs for text have several assumptions at their base which don't hold\ + for Unicode text. This library provides functions for manipulating\ + Unicode strings and for manipulating C strings according to the Unicode\ + standard. This package contains documentation." + +HOMEPAGE = "http://www.gnu.org/software/libunistring/" +SECTION = "devel" +LICENSE = "LGPL-3.0-or-later | GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \ + file://README;beginline=45;endline=65;md5=3a896a943b4da2c551e6be1af27eff8d \ + file://doc/libunistring.texi;md5=266e4297d7c18f197be3d9622ba99685 \ + " +DEPENDS = "gperf-native" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +S = "${WORKDIR}/libunistring-${PV}" + + +SRC_URI = "${GNU_MIRROR}/libunistring/libunistring-${PV}.tar.gz" +SRC_URI[sha256sum] = "3c0184c0e492d7c208ce31d25dd1d2c58f0c3ed6cbbe032c5b248cddad318544" + +do_install:append() { + ${READELF_COMMAND} ${D}${libdir}/libunistring.so > ${D}${PURECAP_DEBUGDIR}/libunistring.so.readelf +}
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- .../0001-config-fix-provenance-errors.patch | 807 ++++++++++++++++++ .../0002-tpool-remove-errors.patch | 37 + .../0003-config-Remove-format-error.patch | 42 + .../0004-main-Remove-format-error.patch | 28 + ...0005-connection-fix-provenance-error.patch | 67 ++ .../0006-sets-fix-provenance-error.patch | 36 + ...07-slapd-search-fix-cheri-provenance.patch | 152 ++++ .../0001-build-top.mk-unset-STRIP_OPTS.patch | 38 + ...if-filter-fix-parallel-build-failure.patch | 32 + ...-Makefile.in-ignore-the-mkdir-errors.patch | 33 + ...de-ldap_pvt_thread.h-before-redefini.patch | 54 ++ .../openldap/openldap-morello/initscript | 35 + .../remove-user-host-pwd-from-version.patch | 39 + .../openldap/openldap-morello/slapd.service | 10 + .../openldap-morello/use-urandom.patch | 35 + .../openldap/openldap-morello_2.5.12.bb | 255 ++++++ 16 files changed, 1700 insertions(+) create mode 100644 recipes-support/openldap/cheri-patches/0001-config-fix-provenance-errors.patch create mode 100644 recipes-support/openldap/cheri-patches/0002-tpool-remove-errors.patch create mode 100644 recipes-support/openldap/cheri-patches/0003-config-Remove-format-error.patch create mode 100644 recipes-support/openldap/cheri-patches/0004-main-Remove-format-error.patch create mode 100644 recipes-support/openldap/cheri-patches/0005-connection-fix-provenance-error.patch create mode 100644 recipes-support/openldap/cheri-patches/0006-sets-fix-provenance-error.patch create mode 100644 recipes-support/openldap/cheri-patches/0007-slapd-search-fix-cheri-provenance.patch create mode 100644 recipes-support/openldap/openldap-morello/0001-build-top.mk-unset-STRIP_OPTS.patch create mode 100644 recipes-support/openldap/openldap-morello/0001-ldif-filter-fix-parallel-build-failure.patch create mode 100644 recipes-support/openldap/openldap-morello/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch create mode 100644 recipes-support/openldap/openldap-morello/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch create mode 100644 recipes-support/openldap/openldap-morello/initscript create mode 100644 recipes-support/openldap/openldap-morello/remove-user-host-pwd-from-version.patch create mode 100644 recipes-support/openldap/openldap-morello/slapd.service create mode 100644 recipes-support/openldap/openldap-morello/use-urandom.patch create mode 100644 recipes-support/openldap/openldap-morello_2.5.12.bb
diff --git a/recipes-support/openldap/cheri-patches/0001-config-fix-provenance-errors.patch b/recipes-support/openldap/cheri-patches/0001-config-fix-provenance-errors.patch new file mode 100644 index 0000000..b7a40d3 --- /dev/null +++ b/recipes-support/openldap/cheri-patches/0001-config-fix-provenance-errors.patch @@ -0,0 +1,807 @@ +From f3bf7b22898961bb1ff3bdc0fe7d24a1ee1b8e6e Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Thu, 6 Jul 2023 17:19:19 +0100 +Subject: [PATCH 1/7] config: fix provenance errors + +Cast to uintptr_t. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + build/openldap.m4 | 13 +++- + configure | 189 ++++++++++++++++++++++++++++++++++++++-------- + configure.ac | 9 +++ + 3 files changed, 176 insertions(+), 35 deletions(-) + +diff --git a/build/openldap.m4 b/build/openldap.m4 +index c7fa19e..6945c1d 100644 +--- a/build/openldap.m4 ++++ b/build/openldap.m4 +@@ -296,6 +296,9 @@ dnl -------------------------------------------------------------------- + AC_DEFUN([OL_PTHREAD_TEST_INCLUDES], [[ + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -306,7 +309,7 @@ AC_DEFUN([OL_PTHREAD_TEST_INCLUDES], [[ + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + ]]) + AC_DEFUN([OL_PTHREAD_TEST_FUNCTION],[[ +@@ -407,6 +410,9 @@ AC_DEFUN([OL_HEADER_GNU_PTH_PTHREAD_H], [ + [ol_cv_header_gnu_pth_pthread_h], + [AC_EGREP_CPP(__gnu_pth__, + [#include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #ifdef _POSIX_THREAD_IS_GNU_PTH + __gnu_pth__; + #endif +@@ -437,7 +443,10 @@ AC_DEFUN([OL_HEADER_LINUX_THREADS], [ + AC_CACHE_CHECK([for LinuxThreads pthread.h], + [ol_cv_header_linux_threads], + [AC_EGREP_CPP(pthread_kill_other_threads_np, +- [#include <pthread.h>], ++ [#include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++], + [ol_cv_header_linux_threads=yes], + [ol_cv_header_linux_threads=no]) + ]) +diff --git a/configure b/configure +index bea23a1..7236a75 100755 +--- a/configure ++++ b/configure +@@ -17688,6 +17688,9 @@ if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +@@ -17717,6 +17720,9 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +@@ -17777,6 +17783,9 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "pthread_kill_other_threads_np" >/dev/null 2>&1; then : +@@ -17805,6 +17814,9 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #ifdef _POSIX_THREAD_IS_GNU_PTH + __gnu_pth__; + #endif +@@ -17852,6 +17864,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -17862,7 +17877,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -17932,6 +17947,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -17942,7 +17960,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -18037,6 +18055,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -18047,7 +18068,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -18117,6 +18138,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -18127,7 +18151,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -18227,6 +18251,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -18237,7 +18264,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -18307,6 +18334,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -18317,7 +18347,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -18417,6 +18447,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -18427,7 +18460,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -18497,6 +18530,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -18507,7 +18543,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -18607,6 +18643,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -18617,7 +18656,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -18687,6 +18726,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -18697,7 +18739,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -18797,6 +18839,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -18807,7 +18852,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -18877,6 +18922,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -18887,7 +18935,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -18988,6 +19036,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -18998,7 +19049,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -19068,6 +19119,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -19078,7 +19132,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -19178,6 +19232,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -19188,7 +19245,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -19258,6 +19315,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -19268,7 +19328,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -19369,6 +19429,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -19379,7 +19442,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -19449,6 +19512,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -19459,7 +19525,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -19560,6 +19626,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -19570,7 +19639,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -19640,6 +19709,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -19650,7 +19722,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -19750,6 +19822,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -19760,7 +19835,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -19830,6 +19905,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -19840,7 +19918,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -19941,6 +20019,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -19951,7 +20032,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -20021,6 +20102,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -20031,7 +20115,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -20132,6 +20216,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -20142,7 +20229,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -20212,6 +20299,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -20222,7 +20312,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -20322,6 +20412,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -20332,7 +20425,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -20402,6 +20495,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -20412,7 +20508,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -20512,6 +20608,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -20522,7 +20621,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -20592,6 +20691,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -20602,7 +20704,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -20703,6 +20805,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -20713,7 +20818,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + int +@@ -20783,6 +20888,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -20793,7 +20901,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -20974,6 +21082,9 @@ else + /* end confdefs.h. */ + + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + pthread_rwlock_t rwlock; + + int +@@ -21011,6 +21122,9 @@ else + /* end confdefs.h. */ + + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #ifndef NULL + #define NULL (void*)0 + #endif +@@ -21125,6 +21239,9 @@ else + + /* pthread test headers */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #if HAVE_PTHREADS < 7 + #include <errno.h> + #endif +@@ -21135,7 +21252,7 @@ else + static void *task(p) + void *p; + { +- return (void *) (p == NULL); ++ return (void *) ((uintptr_t)(p == NULL)); + } + + +@@ -21235,6 +21352,9 @@ else + #include <sys/time.h> + #include <unistd.h> + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #ifndef NULL + #define NULL (void*) 0 + #endif +@@ -21552,6 +21672,9 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "pthread_kill_other_threads_np" >/dev/null 2>&1; then : +diff --git a/configure.ac b/configure.ac +index 0978eeb..8f5d122 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1452,6 +1452,9 @@ dnl [ol_cv_pthread_lpthread_lexc]) + dnl save the flags + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + pthread_rwlock_t rwlock; + ]], [[pthread_rwlock_destroy(&rwlock);]])],[ol_cv_func_pthread_rwlock_destroy=yes],[ol_cv_func_pthread_rwlock_destroy=no]) + ]) +@@ -1467,6 +1470,9 @@ pthread_rwlock_t rwlock; + dnl save the flags + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #ifndef NULL + #define NULL (void*)0 + #endif +@@ -1529,6 +1535,9 @@ dnl esac + #include <sys/time.h> + #include <unistd.h> + #include <pthread.h> ++#include <stdio.h> ++#include <stdint.h> ++ + #ifndef NULL + #define NULL (void*) 0 + #endif +-- +2.34.1 + diff --git a/recipes-support/openldap/cheri-patches/0002-tpool-remove-errors.patch b/recipes-support/openldap/cheri-patches/0002-tpool-remove-errors.patch new file mode 100644 index 0000000..4f2a878 --- /dev/null +++ b/recipes-support/openldap/cheri-patches/0002-tpool-remove-errors.patch @@ -0,0 +1,37 @@ +From cbf9e2e7eccb51ebfa3036c81b3c08691b19ef13 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Thu, 6 Jul 2023 17:42:48 +0100 +Subject: [PATCH 2/7] tpool: remove errors + +Cast the RHS to uintptr_t. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + libraries/libldap/tpool.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libraries/libldap/tpool.c b/libraries/libldap/tpool.c +index 797d59e..ce4a840 100644 +--- a/libraries/libldap/tpool.c ++++ b/libraries/libldap/tpool.c +@@ -258,7 +258,7 @@ ldap_pvt_thread_pool_init_q ( + LDAP_FREE(pool); + return(-1); + } +- pool->ltp_wqs[i] = (struct ldap_int_thread_poolq_s *)(((size_t)ptr + CACHELINE-1) & ~(CACHELINE-1)); ++ pool->ltp_wqs[i] = (struct ldap_int_thread_poolq_s *)((uintptr_t)(((size_t)ptr + CACHELINE-1) & ~(CACHELINE-1))); + pool->ltp_wqs[i]->ltp_free = ptr; + } + +@@ -594,7 +594,7 @@ ldap_pvt_thread_pool_queues( + pool->ltp_wqs[i] = NULL; + return(-1); + } +- pq = (struct ldap_int_thread_poolq_s *)(((size_t)ptr + CACHELINE-1) & ~(CACHELINE-1)); ++ pq = (struct ldap_int_thread_poolq_s *)((uintptr_t)(((size_t)ptr + CACHELINE-1) & ~(CACHELINE-1))); + pq->ltp_free = ptr; + pool->ltp_wqs[i] = pq; + pq->ltp_pool = pool; +-- +2.34.1 + diff --git a/recipes-support/openldap/cheri-patches/0003-config-Remove-format-error.patch b/recipes-support/openldap/cheri-patches/0003-config-Remove-format-error.patch new file mode 100644 index 0000000..a30a231 --- /dev/null +++ b/recipes-support/openldap/cheri-patches/0003-config-Remove-format-error.patch @@ -0,0 +1,42 @@ +From 9d3e1f69ccd087fb219bebd578252aafc82f224a Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Fri, 7 Jul 2023 09:37:26 +0100 +Subject: [PATCH 3/7] config: Remove format error. + +Cast to unsigned char * + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + servers/lloadd/config.c | 2 +- + servers/slapd/config.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/servers/lloadd/config.c b/servers/lloadd/config.c +index 12b4406..56a69ca 100644 +--- a/servers/lloadd/config.c ++++ b/servers/lloadd/config.c +@@ -2113,7 +2113,7 @@ lload_config_find_keyword( ConfigTable *Conf, ConfigArgs *c ) + size_t decode_len = LUTIL_BASE64_DECODE_LEN( c->linelen ); + ch_free( c->tline ); + c->tline = ch_malloc( decode_len + 1 ); +- c->linelen = lutil_b64_pton( c->line, c->tline, decode_len ); ++ c->linelen = lutil_b64_pton( c->line, (unsigned char *)c->tline, decode_len ); + if ( c->linelen < 0 ) { + ch_free( c->tline ); + c->tline = NULL; +diff --git a/servers/slapd/config.c b/servers/slapd/config.c +index 8823c74..3ae7d1f 100644 +--- a/servers/slapd/config.c ++++ b/servers/slapd/config.c +@@ -134,7 +134,7 @@ ConfigTable *config_find_keyword(ConfigTable *Conf, ConfigArgs *c) { + size_t decode_len = LUTIL_BASE64_DECODE_LEN(c->linelen); + ch_free( c->tline ); + c->tline = ch_malloc( decode_len+1 ); +- c->linelen = lutil_b64_pton( c->line, c->tline, decode_len ); ++ c->linelen = lutil_b64_pton( c->line, (unsigned char *)c->tline, decode_len ); + if ( c->linelen < 0 ) + { + ch_free( c->tline ); +-- +2.34.1 + diff --git a/recipes-support/openldap/cheri-patches/0004-main-Remove-format-error.patch b/recipes-support/openldap/cheri-patches/0004-main-Remove-format-error.patch new file mode 100644 index 0000000..e55ab08 --- /dev/null +++ b/recipes-support/openldap/cheri-patches/0004-main-Remove-format-error.patch @@ -0,0 +1,28 @@ +From ace0b9cd1c47662133e599a2f77597dfd184a5d0 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Fri, 7 Jul 2023 09:47:39 +0100 +Subject: [PATCH 4/7] main: Remove format error. + +cast to unsigned int + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + servers/slapd/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/servers/slapd/main.c b/servers/slapd/main.c +index 11e7a8f..6f69087 100644 +--- a/servers/slapd/main.c ++++ b/servers/slapd/main.c +@@ -396,7 +396,7 @@ static void debug_print( const char *data ) + + buf[sizeof(buf)-1] = '\0'; + snprintf( buf, sizeof(buf)-1, "%lx." TS " %p %s", +- (long)tv.tv_sec, Tfrac, (void *)ldap_pvt_thread_self(), data ); ++ (long)tv.tv_sec, (unsigned int)Tfrac, (void *)ldap_pvt_thread_self(), data ); + ber_logger( buf ); + } + +-- +2.34.1 + diff --git a/recipes-support/openldap/cheri-patches/0005-connection-fix-provenance-error.patch b/recipes-support/openldap/cheri-patches/0005-connection-fix-provenance-error.patch new file mode 100644 index 0000000..04451a2 --- /dev/null +++ b/recipes-support/openldap/cheri-patches/0005-connection-fix-provenance-error.patch @@ -0,0 +1,67 @@ +From b9d319b8e5a71eb036937959da051d3780f9c27d Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Fri, 7 Jul 2023 09:59:36 +0100 +Subject: [PATCH 5/7] connection: fix provenance error + +Use uintptr_t not int for pointers. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + servers/slapd/connection.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c +index b8ea92a..33a6c13 100644 +--- a/servers/slapd/connection.c ++++ b/servers/slapd/connection.c +@@ -25,6 +25,7 @@ + + #include "portable.h" + ++#include <stdint.h> + #include <stdio.h> + #ifdef HAVE_LIMITS_H + #include <limits.h> +@@ -1246,7 +1247,7 @@ static int connection_read( ber_socket_t s, conn_readinfo *cri ); + + static void* connection_read_thread( void* ctx, void* argv ) + { +- int rc ; ++ int rc; + conn_readinfo cri = { NULL, NULL, NULL, NULL, 0 }; + ber_socket_t s = (long)argv; + +@@ -1257,17 +1258,17 @@ static void* connection_read_thread( void* ctx, void* argv ) + cri.ctx = ctx; + if( ( rc = connection_read( s, &cri ) ) < 0 ) { + Debug( LDAP_DEBUG_CONNS, "connection_read(%d) error\n", s ); +- return (void*)(long)rc; ++ return (void*)(uintptr_t)rc; + } + + /* execute a single queued request in the same thread */ + if( cri.op && !cri.nullop ) { +- rc = (long)connection_operation( ctx, cri.op ); ++ rc = connection_operation( ctx, cri.op ); + } else if ( cri.func ) { +- rc = (long)cri.func( ctx, cri.arg ); ++ rc = cri.func( ctx, cri.arg ); + } + +- return (void*)(long)rc; ++ return (void*)(uintptr_t)rc; + } + + int connection_read_activate( ber_socket_t s ) +@@ -1284,7 +1285,7 @@ int connection_read_activate( ber_socket_t s ) + return rc; + + rc = ldap_pvt_thread_pool_submit( &connection_pool, +- connection_read_thread, (void *)(long)s ); ++ connection_read_thread, (void *)(uintptr_t)s ); + + if( rc != 0 ) { + Debug( LDAP_DEBUG_ANY, +-- +2.34.1 + diff --git a/recipes-support/openldap/cheri-patches/0006-sets-fix-provenance-error.patch b/recipes-support/openldap/cheri-patches/0006-sets-fix-provenance-error.patch new file mode 100644 index 0000000..cb6b1d0 --- /dev/null +++ b/recipes-support/openldap/cheri-patches/0006-sets-fix-provenance-error.patch @@ -0,0 +1,36 @@ +From e0fbb1b9512e85f33497a96d7a9ade87be9d170e Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Fri, 7 Jul 2023 10:52:37 +0100 +Subject: [PATCH 6/7] sets: fix provenance error + +Use uintptr_t not int for pointers. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + servers/slapd/sets.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/servers/slapd/sets.c b/servers/slapd/sets.c +index 9ab2b36..8a2dc58 100644 +--- a/servers/slapd/sets.c ++++ b/servers/slapd/sets.c +@@ -15,6 +15,7 @@ + + #include "portable.h" + ++#include <stdint.h> + #include <stdio.h> + #include <ac/string.h> + +@@ -553,7 +554,7 @@ slap_set_filter( SLAP_SET_GATHER gatherer, + #define SF_POP() ( (BerVarray)( ( stp < 0 ) ? 0 : stack[ stp-- ] ) ) + #define SF_PUSH(x) do { \ + if ( stp >= ( STACK_SIZE - 1 ) ) SF_ERROR( overflow ); \ +- stack[ ++stp ] = (BerVarray)(long)(x); \ ++ stack[ ++stp ] = (BerVarray)(uintptr_t)(x); \ + } while ( 0 ) + + BerVarray set, lset; +-- +2.34.1 + diff --git a/recipes-support/openldap/cheri-patches/0007-slapd-search-fix-cheri-provenance.patch b/recipes-support/openldap/cheri-patches/0007-slapd-search-fix-cheri-provenance.patch new file mode 100644 index 0000000..08fea7e --- /dev/null +++ b/recipes-support/openldap/cheri-patches/0007-slapd-search-fix-cheri-provenance.patch @@ -0,0 +1,152 @@ +From 2d39482eea00f2afe2598ed5c469d7bffc097ebc Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Fri, 14 Jul 2023 08:00:42 +0100 +Subject: [PATCH 7/7] slapd:search: fix cheri provenance + +Pre-cast the integer to uintptr_t. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + servers/slapd/back-meta/search.c | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c +index cfd2f4b..28dcbd4 100644 +--- a/servers/slapd/back-meta/search.c ++++ b/servers/slapd/back-meta/search.c +@@ -868,7 +868,7 @@ getconn:; + + case META_SEARCH_ERR: + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + send_ldap_result( op, rs ); + op->o_private = savepriv; + rc = -1; +@@ -995,7 +995,7 @@ getconn:; + rc = rs->sr_err = op->o_protocol >= LDAP_VERSION3 ? + LDAP_ADMINLIMIT_EXCEEDED : LDAP_OTHER; + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + send_ldap_result( op, rs ); + op->o_private = savepriv; + goto finish; +@@ -1008,7 +1008,7 @@ getconn:; + doabandon = 1; + rc = rs->sr_err = LDAP_TIMELIMIT_EXCEEDED; + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + send_ldap_result( op, rs ); + op->o_private = savepriv; + goto finish; +@@ -1047,7 +1047,7 @@ getconn:; + candidates[ i ].sr_err = rs->sr_err; + if ( META_BACK_ONERR_STOP( mi ) ) { + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + send_ldap_result( op, rs ); + op->o_private = savepriv; + goto finish; +@@ -1076,7 +1076,7 @@ getconn:; + candidates[ i ].sr_err = rs->sr_err; + if ( META_BACK_ONERR_STOP( mi ) ) { + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + send_ldap_result( op, rs ); + op->o_private = savepriv; + goto finish; +@@ -1161,7 +1161,7 @@ really_bad:; + candidates[ i ].sr_err = rs->sr_err; + if ( META_BACK_ONERR_STOP( mi ) ) { + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + send_ldap_result( op, rs ); + op->o_private = savepriv; + goto finish; +@@ -1189,7 +1189,7 @@ really_bad:; + candidates[ i ].sr_err = rs->sr_err; + if ( META_BACK_ONERR_STOP( mi ) ) { + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + send_ldap_result( op, rs ); + op->o_private = savepriv; + goto finish; +@@ -1236,13 +1236,13 @@ really_bad:; + + e = ldap_first_entry( msc->msc_ld, msg ); + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + rs->sr_err = meta_send_entry( op, rs, mc, i, e ); + + switch ( rs->sr_err ) { + case LDAP_SIZELIMIT_EXCEEDED: + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + send_ldap_result( op, rs ); + op->o_private = savepriv; + rs->sr_err = LDAP_SUCCESS; +@@ -1311,7 +1311,7 @@ really_bad:; + if ( rs->sr_ref != NULL && !BER_BVISNULL( &rs->sr_ref[ 0 ] ) ) { + /* ignore return value by now */ + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + ( void )send_search_reference( op, rs ); + op->o_private = savepriv; + +@@ -1580,7 +1580,7 @@ err_pr:; + candidates[ i ].sr_err = rs->sr_err; + if ( META_BACK_ONERR_STOP( mi ) ) { + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + send_ldap_result( op, rs ); + op->o_private = savepriv; + ldap_controls_free( ctrls ); +@@ -1629,7 +1629,7 @@ err_pr:; + got_err: + save_text = rs->sr_text; + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + rs->sr_text = candidates[ i ].sr_text; + send_ldap_result( op, rs ); + rs->sr_text = save_text; +@@ -1682,7 +1682,7 @@ got_err: + candidates[ i ].sr_err = rs->sr_err; + if ( META_BACK_ONERR_STOP( mi ) ) { + savepriv = op->o_private; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + send_ldap_result( op, rs ); + op->o_private = savepriv; + ldap_msgfree( res ); +@@ -1806,7 +1806,7 @@ free_message:; + * FIXME: only the last one gets caught! + */ + savepriv = op->o_private; +- op->o_private = (void *)(long)mi->mi_ntargets; ++ op->o_private = (void *)(uintptr_t)mi->mi_ntargets; + if ( candidate_match > 0 ) { + struct berval pmatched = BER_BVNULL; + +@@ -1844,7 +1844,7 @@ free_message:; + op->o_tmpfree( pmatched.bv_val, op->o_tmpmemctx ); + } + pmatched = pbv; +- op->o_private = (void *)i; ++ op->o_private = (void *)(uintptr_t)i; + + } else { + op->o_tmpfree( pbv.bv_val, op->o_tmpmemctx ); +-- +2.34.1 + diff --git a/recipes-support/openldap/openldap-morello/0001-build-top.mk-unset-STRIP_OPTS.patch b/recipes-support/openldap/openldap-morello/0001-build-top.mk-unset-STRIP_OPTS.patch new file mode 100644 index 0000000..9d25f2c --- /dev/null +++ b/recipes-support/openldap/openldap-morello/0001-build-top.mk-unset-STRIP_OPTS.patch @@ -0,0 +1,38 @@ +From 321839cbd1d57f12d3d6695254d2003473d8dd1a Mon Sep 17 00:00:00 2001 +From: Yi Zhao yi.zhao@windriver.com +Date: Wed, 8 Dec 2021 16:58:55 +0800 +Subject: [PATCH] build/top.mk: unset STRIP_OPTS + +Unset STRIP_OPTS to disable strip to fix QA errors: + +ERROR: openldap-2.5.9-r0 do_package: QA Issue: File +'/usr/bin/ldapcompare' from openldap was already stripped, this will +prevent future debugging! [already-stripped] + +ERROR: openldap-2.5.9-r0 do_package: QA Issue: File +'/usr/bin/ldapdelete' from openldap was already stripped, this will +prevent future debugging! [already-stripped] + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Yi Zhao yi.zhao@windriver.com +--- + build/top.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/build/top.mk b/build/top.mk +index 38ce146..6e9fe1f 100644 +--- a/build/top.mk ++++ b/build/top.mk +@@ -60,7 +60,7 @@ INSTALL_PROGRAM = $(INSTALL) + INSTALL_DATA = $(INSTALL) -m 644 + INSTALL_SCRIPT = $(INSTALL) + +-STRIP_OPTS = -s ++STRIP_OPTS = + + LINT = lint + 5LINT = 5lint +-- +2.17.1 + diff --git a/recipes-support/openldap/openldap-morello/0001-ldif-filter-fix-parallel-build-failure.patch b/recipes-support/openldap/openldap-morello/0001-ldif-filter-fix-parallel-build-failure.patch new file mode 100644 index 0000000..b42bd97 --- /dev/null +++ b/recipes-support/openldap/openldap-morello/0001-ldif-filter-fix-parallel-build-failure.patch @@ -0,0 +1,32 @@ +From 9e4ccd1e78ceac8de1ab66ee62ee216f1fbd4956 Mon Sep 17 00:00:00 2001 +From: Yi Zhao yi.zhao@windriver.com +Date: Thu, 2 Dec 2021 11:38:15 +0800 +Subject: [PATCH] ldif-filter: fix parallel build failure + +Add slapd-common.o as dependency for ldif-filter to fix the parallel +build failure: + ld: cannot find slapd-common.o: No such file or directory + +Upstream-Status: Pending + +Signed-off-by: Yi Zhao yi.zhao@windriver.com +--- + tests/progs/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/progs/Makefile.in b/tests/progs/Makefile.in +index 13f1e8be2..e4f4ccf98 100644 +--- a/tests/progs/Makefile.in ++++ b/tests/progs/Makefile.in +@@ -56,7 +56,7 @@ slapd-modify: slapd-modify.o $(OBJS) $(XLIBS) + slapd-bind: slapd-bind.o $(OBJS) $(XLIBS) + $(LTLINK) -o $@ slapd-bind.o $(OBJS) $(LIBS) + +-ldif-filter: ldif-filter.o $(XLIBS) ++ldif-filter: ldif-filter.o $(OBJS) $(XLIBS) + $(LTLINK) -o $@ ldif-filter.o $(OBJS) $(LIBS) + + slapd-mtread: slapd-mtread.o $(OBJS) $(XLIBS) +-- +2.25.1 + diff --git a/recipes-support/openldap/openldap-morello/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch b/recipes-support/openldap/openldap-morello/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch new file mode 100644 index 0000000..552726b --- /dev/null +++ b/recipes-support/openldap/openldap-morello/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch @@ -0,0 +1,33 @@ +From 690f69791eb6cd0d7e94b4d73219ee864de27f62 Mon Sep 17 00:00:00 2001 +From: Yi Zhao yi.zhao@windriver.com +Date: Mon, 10 Jan 2022 10:13:51 +0800 +Subject: [PATCH] libraries/Makefile.in: ignore the mkdir errors + +Ignore the mkdir errors to fix the parallel build failure: + +../../build/shtool mkdir -p TOPDIR/tmp-glibc/work/cortexa15t2hf-neon-wrs-linux-gnueabi/openldap/2.5.9-r0/image/usr/lib +mkdir: cannot create directory 'TOPDIR/tmp-glibc/work/cortexa15t2hf-neon-wrs-linux-gnueabi/openldap/2.5.9-r0/image/usr/lib': File exists + +Upstream-Status: Pending + +Signed-off-by: Yi Zhao yi.zhao@windriver.com +--- + libraries/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libraries/Makefile.in b/libraries/Makefile.in +index d9cb2ff..c6b251f 100644 +--- a/libraries/Makefile.in ++++ b/libraries/Makefile.in +@@ -24,7 +24,7 @@ PKGCONFIG_DIR=$(DESTDIR)$(libdir)/pkgconfig + PKGCONFIG_SRCDIRS=liblber libldap + + install-local: +- @$(MKDIR) $(PKGCONFIG_DIR) ++ @-$(MKDIR) $(PKGCONFIG_DIR) + @for i in $(PKGCONFIG_SRCDIRS); do \ + $(INSTALL_DATA) $$i/*.pc $(PKGCONFIG_DIR); \ + done +-- +2.17.1 + diff --git a/recipes-support/openldap/openldap-morello/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch b/recipes-support/openldap/openldap-morello/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch new file mode 100644 index 0000000..bcd1525 --- /dev/null +++ b/recipes-support/openldap/openldap-morello/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch @@ -0,0 +1,54 @@ +From 79381ab335898c9184e22dd25b544adefa9bf6c5 Mon Sep 17 00:00:00 2001 +From: Khem Raj raj.khem@gmail.com +Date: Mon, 7 Feb 2022 16:26:57 -0800 +Subject: [PATCH] librewrite: include ldap_pvt_thread.h before redefining + calloc + +This helps compiling with musl, where sched.h is included by +ldap_pvt_thread.h which provides prototype for calloc() and conflicts + +/usr/include/sched.h:84:7: error: conflicting types for 'ber_memcalloc' +| void *calloc(size_t, size_t); +| ^1 +| warning and 1 error generated. +| ./rewrite-int.h:44:21: note: expanded from macro 'calloc' +| #define calloc(x,y) ber_memcalloc(x,y) +| ^ + +Upstream-Status: Pending +Signed-off-by: Khem Raj raj.khem@gmail.com +--- + libraries/librewrite/rewrite-int.h | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/libraries/librewrite/rewrite-int.h b/libraries/librewrite/rewrite-int.h +index 4481dd3..5ec226d 100644 +--- a/libraries/librewrite/rewrite-int.h ++++ b/libraries/librewrite/rewrite-int.h +@@ -40,6 +40,11 @@ + + #include <rewrite.h> + ++#ifndef NO_THREADS ++#define USE_REWRITE_LDAP_PVT_THREADS ++#include <ldap_pvt_thread.h> ++#endif ++ + #define malloc(x) ber_memalloc(x) + #define calloc(x,y) ber_memcalloc(x,y) + #define realloc(x,y) ber_memrealloc(x,y) +@@ -47,11 +52,6 @@ + #undef strdup + #define strdup(x) ber_strdup(x) + +-#ifndef NO_THREADS +-#define USE_REWRITE_LDAP_PVT_THREADS +-#include <ldap_pvt_thread.h> +-#endif +- + /* + * For details, see RATIONALE. + */ +-- +2.35.1 + diff --git a/recipes-support/openldap/openldap-morello/initscript b/recipes-support/openldap/openldap-morello/initscript new file mode 100644 index 0000000..08d1067 --- /dev/null +++ b/recipes-support/openldap/openldap-morello/initscript @@ -0,0 +1,35 @@ +#! /bin/sh +# +# This is an init script for openembedded +# Copy it to /etc/init.d/openldap and type +# > update-rc.d openldap defaults 60 +# + +# Source function library. +. /etc/init.d/functions + +slapd=/usr/sbin/slapd +test -x "$slapd" || exit 0 + + +case "$1" in + start) + echo -n "Starting OpenLDAP: " + start-stop-daemon --start --quiet --exec $slapd + echo "." + ;; + stop) + echo -n "Stopping OpenLDAP: " + start-stop-daemon --stop --quiet --pidfile /var/run/slapd.pid + echo "." + ;; + status) + status $slapd; + exit $? + ;; + *) + echo "Usage: /etc/init.d/openldap {start|stop|status}" + exit 1 +esac + +exit 0 diff --git a/recipes-support/openldap/openldap-morello/remove-user-host-pwd-from-version.patch b/recipes-support/openldap/openldap-morello/remove-user-host-pwd-from-version.patch new file mode 100644 index 0000000..7a1b5aa --- /dev/null +++ b/recipes-support/openldap/openldap-morello/remove-user-host-pwd-from-version.patch @@ -0,0 +1,39 @@ +From 868a04b0596e2df708ba14ed70815b1411db3db1 Mon Sep 17 00:00:00 2001 +From: Changqing Li changqing.li@windriver.com +Date: Thu, 21 Feb 2019 11:33:24 +0800 +Subject: [PATCH] mkversion: remove user host pwd from version + +Upstream-Status: Pending + +Update this patch to version 2.4.47 + +Signed-off-by: Changqing Li changqing.li@windriver.com +--- + build/mkversion | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/build/mkversion ++++ b/build/mkversion +@@ -53,8 +53,12 @@ APPLICATION=$1 + # Reproducible builds set SOURCE_DATE_EPOCH, want constant strings + if [ -n "${SOURCE_DATE_EPOCH}" ]; then + WHOWHERE="openldap" ++ DATE=$(date -d@$SOURCE_DATE_EPOCH +' %b %d %Y ') ++ TIME=$(date -d@$SOURCE_DATE_EPOCH +' %H:%M:%S ') + else +- WHOWHERE="$USER@$(uname -n):$(pwd)" ++ WHOWHERE="openldap" ++ DATE='" __DATE__ "' ++ TIME='" __TIME__ "' + fi + + cat << __EOF__ +@@ -77,7 +81,7 @@ static const char copyright[] = + "COPYING RESTRICTIONS APPLY\n"; + + $static $const char $SYMBOL[] = +-"@(#) $$PACKAGE: $APPLICATION $VERSION (" __DATE__ " " __TIME__ ") $\n" ++"@(#) $$PACKAGE: $APPLICATION $VERSION ($DATE $TIME) $\n" + "\t$WHOWHERE\n"; + + __EOF__ diff --git a/recipes-support/openldap/openldap-morello/slapd.service b/recipes-support/openldap/openldap-morello/slapd.service new file mode 100644 index 0000000..f5f83fd --- /dev/null +++ b/recipes-support/openldap/openldap-morello/slapd.service @@ -0,0 +1,10 @@ +[Unit] +Description=Standalone LDAP Daemon +After=syslog.target network.target + +[Service] +Type=forking +ExecStart=@SBINDIR@/slapd + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/openldap/openldap-morello/use-urandom.patch b/recipes-support/openldap/openldap-morello/use-urandom.patch new file mode 100644 index 0000000..0b7e3a2 --- /dev/null +++ b/recipes-support/openldap/openldap-morello/use-urandom.patch @@ -0,0 +1,35 @@ +openldap: assume /dev/urandom exists + +When we are cross-compiling, we want to assume +that /dev/urandom exists. We could change the source +code to look for it, but this is the easy way out. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Joe Slater jslater@windriver.com + +--- a/configure.ac ++++ b/configure.ac +@@ -2117,6 +2117,7 @@ AC_SUBST(systemdsystemunitdir) + + dnl ---------------------------------------------------------------- + dnl Check for entropy sources ++dev=no + if test $cross_compiling != yes && test "$ac_cv_mingw32" != yes ; then + dev=no + if test -r /dev/urandom ; then +@@ -2131,9 +2132,11 @@ if test $cross_compiling != yes && test "$ac_cv_mingw32" != yes ; then + dev="/idev/random"; + fi + +- if test $dev != no ; then +- AC_DEFINE_UNQUOTED(URANDOM_DEVICE,"$dev",[set to urandom device]) +- fi ++elif test $cross_compiling == yes ; then ++ dev="/dev/urandom"; ++fi ++if test $dev != no ; then ++ AC_DEFINE_UNQUOTED(URANDOM_DEVICE,"$dev",[set to urandom device]) + fi + + dnl ---------------------------------------------------------------- diff --git a/recipes-support/openldap/openldap-morello_2.5.12.bb b/recipes-support/openldap/openldap-morello_2.5.12.bb new file mode 100644 index 0000000..34ac852 --- /dev/null +++ b/recipes-support/openldap/openldap-morello_2.5.12.bb @@ -0,0 +1,255 @@ +inherit autotools-brokensep update-rc.d systemd pkgconfig pure-cap-kheaders purecap-sysroot + +MORELLO_SRC = "meta-openembedded/meta-oe/recipes-support/openldap/openldap_2.5.12.bb" + +SUMMARY = "OpenLDAP Directory Service" + +DESCRIPTION = "OpenLDAP Software is an open source implementation of the Lightweight Directory Access Protocol." +HOMEPAGE = "http://www.OpenLDAP.org/license.html" +# The OpenLDAP Public License - see the HOMEPAGE - defines +# the license. www.openldap.org claims this is Open Source +# (see http://www.openldap.org), the license appears to be +# basically BSD. opensource.org does not record this license +# at present (so it is apparently not OSI certified). +LICENSE = "OpenLDAP" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=beceb5ac7100b6430640c61655b25c1f \ + file://LICENSE;md5=153d07ef052c4a37a8fac23bc6031972 \ + " +SECTION = "libs" + +BPN_LDAP = "openldap" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" +FILESEXTRAPATHS:prepend := "${THISDIR}/cheri-patches:" + +LDAP_VER = "${@'.'.join(d.getVar('PV').split('.')[0:2])}" + +SRC_URI = "http://www.openldap.org/software/download/OpenLDAP/openldap-release/%24%7BBP... \ + file://use-urandom.patch \ + file://initscript \ + file://slapd.service \ + file://remove-user-host-pwd-from-version.patch \ + file://0001-ldif-filter-fix-parallel-build-failure.patch \ + file://0001-build-top.mk-unset-STRIP_OPTS.patch \ + file://0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch \ + file://0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch \ +" + +SRC_URI += "\ + file://0001-config-fix-provenance-errors.patch \ + file://0002-tpool-remove-errors.patch \ + file://0003-config-Remove-format-error.patch \ + file://0004-main-Remove-format-error.patch \ + file://0005-connection-fix-provenance-error.patch \ + file://0006-sets-fix-provenance-error.patch \ + file://0007-slapd-search-fix-cheri-provenance.patch \ +" + +SRC_URI[sha256sum] = "d5086cbfc49597fa7d0670a429a9054552d441b16ee8b2435412797ab0e37b96" + +S = "${WORKDIR}/${BPN_LDAP}-${PV}" + +DEPENDS += "util-linux-morello groff-native libtool-native openssl-morello" +RDEPENDS:${PN} += "openssl-morello" + +# CV SETTINGS +# Required to work round AC_FUNC_MEMCMP which gets the wrong answer +# when cross compiling (should be in site?) +EXTRA_OECONF += "ac_cv_func_memcmp_working=yes" + +# CONFIG DEFINITIONS +# The following is necessary because it cannot be determined for a +# cross compile automagically. Select should yield fine on all OE +# systems... +EXTRA_OECONF += "--with-yielding-select=yes" +# Shared libraries are nice... +EXTRA_OECONF += "-disable-modules -disable-static" + +PACKAGECONFIG ??= "asyncmeta gnutls modules \ + mdb ldap meta null passwd proxycache dnssrv \ + ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ +" +#--with-tls with TLS/SSL support auto|openssl|gnutls [auto] +PACKAGECONFIG[openssl] = "--with-tls=openssl,,openssl-morello" + +PACKAGECONFIG[sasl] = "--with-cyrus-sasl,--without-cyrus-sasl,cyrus-sasl" +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6" + +# SLAPD options +# +# UNIX crypt(3) passwd support: +EXTRA_OECONF += "--enable-crypt" + + +# SLAPD BACKEND +# +# The backend must be set by the configuration. This controls the +# required database. +# +# Backends="asyncmeta dnssrv ldap mdb meta ndb null passwd perl relay sock sql wt" +# +# Note that multiple backends can be built. The ldbm backend requires a +# build-time choice of database API. To use the gdbm (or other) API the +# Berkely database module must be removed from the build. +md = "${libexecdir}/openldap" + +# #--enable-asyncmeta enable asyncmeta backend no|yes|mod no +PACKAGECONFIG[asyncmeta] = "--enable-asyncmeta=yes,--enable-asyncmeta=no" + +# #--enable-dnssrv enable dnssrv backend no|yes|mod no +PACKAGECONFIG[dnssrv] = "--enable-dnssrv=yes,--enable-dnssrv=no" + +# #--enable-ldap enable ldap backend no|yes|mod no +PACKAGECONFIG[ldap] = "--enable-ldap=yes,--enable-ldap=no," + +# #--enable-mdb enable mdb database backend no|yes|mod [yes] +PACKAGECONFIG[mdb] = "--enable-mdb=yes,--enable-mdb=no," + +# #--enable-meta enable metadirectory backend no|yes|mod no +PACKAGECONFIG[meta] = "--enable-meta=yes,--enable-meta=no," + +# #--enable-ndb enable MySQL NDB Cluster backend no|yes|mod [no] +PACKAGECONFIG[ndb] = "--enable-ndb=yes,--enable-ndb=no," + +# #--enable-null enable null backend no|yes|mod no +PACKAGECONFIG[null] = "--enable-null=yes,--enable-null=no," + +# #--enable-passwd enable passwd backend no|yes|mod no +PACKAGECONFIG[passwd] = "--enable-passwd=yes,--enable-passwd=no," + +# #--enable-perl enable perl backend no|yes|mod no +# # This requires a loadable perl dynamic library, if enabled without +# # doing something appropriate (building perl?) the build will pick +# # up the build machine perl - not good (inherit perlnative?) +PACKAGECONFIG[perl] = "--enable-perl=yes,--enable-perl=no,perl" + +# #--enable-relay enable relay backend no|yes|mod [yes] +PACKAGECONFIG[relay] = "--enable-relay=yes,--enable-relay=no," + +# #--enable-sock enable sock backend no|yes|mod [no] +PACKAGECONFIG[sock] = "--enable-sock=yes,--enable-sock=no," + +# #--enable-sql enable sql backend no|yes|mod no +# # sql requires some sql backend which provides sql.h, sqlite* provides +# # sqlite.h (which may be compatible but hasn't been tried.) +PACKAGECONFIG[sql] = "--enable-sql=yes,--enable-sql=no,sqlite3" + +# #--enable-wt enable wt backend no|yes|mod no +# # back-wt is marked currently as experimental +PACKAGECONFIG[wt] = "--enable-wt=yes,--enable-wt=no" + +# #--enable-dyngroup Dynamic Group overlay no|yes|mod no +# # This is a demo, Proxy Cache defines init_module which conflicts with the +# # same symbol in dyngroup +PACKAGECONFIG[dyngroup] = "--enable-dyngroup=yes,--enable-dyngroup=no," + +# #--enable-proxycache Proxy Cache overlay no|yes|mod no +PACKAGECONFIG[proxycache] = "--enable-proxycache=yes,--enable-proxycache=no," +FILES:${PN}-overlay-proxycache = "${md}/pcache-*.so.*" +PACKAGES += "${PN}-overlay-proxycache" + +# Append URANDOM_DEVICE='/dev/urandom' to CPPFLAGS: +# This allows tls to obtain random bits from /dev/urandom, by default +# it was disabled for cross-compiling. +CPPFLAGS:append = " -D_GNU_SOURCE -DURANDOM_DEVICE='/dev/urandom' -fPIC" + +LDFLAGS:append = " -pthread" + +do_configure() { + + export CPPFLAGS="${CPPFLAGS} ${CC_PURECAP_FLAGS}" + + rm -f ${S}/libtool + aclocal + libtoolize --force --copy + gnu-configize + cp ${STAGING_DATADIR_NATIVE}/libtool/build-aux/ltmain.sh ${S}/build + cp ${STAGING_DATADIR_NATIVE}/libtool/build-aux/missing ${S}/build + cp ${STAGING_DATADIR_NATIVE}/libtool/build-aux/compile ${S}/build + autoconf + oe_runconf +} + +do_install:append() { + install -d ${D}${sysconfdir}/init.d + cat ${WORKDIR}/initscript > ${D}${sysconfdir}/init.d/openldap + chmod 755 ${D}${sysconfdir}/init.d/openldap + # This is duplicated in /etc/openldap and is for slapd + rm -f ${D}{localstatedir}/openldap-data/DB_CONFIG.example + + # Installing slapd under ${sbin} is more FHS and LSB compliance + mv ${D}${libexecdir}/slapd ${D}${sbindir}/slapd + rmdir --ignore-fail-on-non-empty ${D}${libexecdir} + SLAPTOOLS="slapadd slapcat slapdn slapindex slappasswd slaptest slapauth slapacl slapschema slapmodify" + cd ${D}${sbindir}/ + rm -f ${SLAPTOOLS} + for i in ${SLAPTOOLS}; do ln -sf slapd $i; done + + rmdir "${D}${localstatedir}/run" + rmdir --ignore-fail-on-non-empty "${D}${localstatedir}" + + install -d ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/slapd.service ${D}${systemd_unitdir}/system/slapd-morello.service + sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/*.service + + # Uses mdm as the database + # and localstatedir as data directory ... + sed -e 's/# modulepath/modulepath/' \ + -e 's/# moduleload\s*back_bdb.*/moduleload back_mdb/' \ + -e 's/database\s*bdb/database mdb/' \ + -e 's%^directory\s*.*%directory ${localstatedir}/${BPN_LDAP}/data/%' \ + -i ${D}${sysconfdir}/openldap/slapd.conf + + mkdir -p ${D}${localstatedir}/${BPN_LDAP}/data +} + +do_install:append() { + ${OBJDUMP_COMMAND} ${D}${libdir}/libldap-2.5.so.0 > ${D}${PURECAP_DEBUGDIR}/libldap-2.5.dump + ${READELF_COMMAND} ${D}${libdir}/libldap-2.5.so.0 > ${D}${PURECAP_DEBUGDIR}/libldap-2.5.readelf + + ${OBJDUMP_COMMAND} ${D}${libdir}/liblber-2.5.so.0 > ${D}${PURECAP_DEBUGDIR}/liblber-2.5.dump + ${READELF_COMMAND} ${D}${libdir}/liblber-2.5.so.0 > ${D}${PURECAP_DEBUGDIR}/liblber-2.5.readelf +} + +LEAD_SONAME = "libldap-${LDAP_VER}.so.*" + +# The executables go in a separate package. This allows the +# installation of the libraries with no daemon support. +# Each module also has its own package - see above. +PACKAGES += "${PN}-slapd ${PN}-slurpd ${PN}-bin" + +# Package contents - shift most standard contents to -bin +FILES:${PN} = "${libdir}/lib*.so.* ${sysconfdir}/openldap/ldap.* \ + ${localstatedir}/${BPN_LDAP}/data ${libdir} \ + " +FILES:${PN}-slapd = "${sysconfdir}/init.d ${libexecdir}/slapd ${sbindir} ${localstatedir}/run ${localstatedir}/volatile/run \ + ${sysconfdir}/openldap/slapd.* ${sysconfdir}/openldap/schema \ + ${sysconfdir}/openldap/DB_CONFIG.example ${systemd_unitdir}/system/*" +FILES:${PN}-slurpd = "${libexecdir}/slurpd ${localstatedir}/openldap-slurp" +FILES:${PN}-bin = "${bindir}" +FILES:${PN}-dev = "${includedir} ${libdir}/lib*.so ${libdir}/*.la ${libexecdir}/openldap/*.a ${libexecdir}/openldap/*.la ${libexecdir}/openldap/*.so ${libdir}/pkgconfig/*.pc" +FILES:${PN}-dbg += "${libexecdir}/openldap/.debug ${datadir}" + +FILES:${PN}-static-dev = "${libdir}/libldap.a ${libdir}/liblber.a" + +INITSCRIPT_PACKAGES = "${PN}-slapd" +INITSCRIPT_NAME:${PN}-slapd = "openldap" +INITSCRIPT_PARAMS:${PN}-slapd = "defaults" + +SYSTEMD_PACKAGES = "${PN}-slapd" +SYSTEMD_SERVICE:${PN}-slapd = "slapd-morello.service" +SYSTEMD_AUTO_ENABLE:${PN}-slapd ?= "disable" + +PACKAGES_DYNAMIC += "^${PN}-backends.* ^${PN}-backend-.*" + +# The modules require their .so to be dynamicaly loaded +INSANE_SKIP:${PN}-backend-asyncmeta += "dev-so" +INSANE_SKIP:${PN}-backend-dnssrv += "dev-so" +INSANE_SKIP:${PN}-backend-ldap += "dev-so" +INSANE_SKIP:${PN}-backend-meta += "dev-so" +INSANE_SKIP:${PN}-backend-mdb += "dev-so" +INSANE_SKIP:${PN}-backend-null += "dev-so" +INSANE_SKIP:${PN}-backend-passwd += "dev-so" + +# CVE-2015-3276 has no target code. +CVE_CHECK_IGNORE += "CVE-2015-3276"
Co-authored-by: Harrison Carter hcarter@thegoodpenguin.co.uk Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- .../0001-tools-fix-cheri-provenance.patch | 32 ++ ..._endpoint_linux-fix-cheri-provenance.patch | 28 ++ recipes-protocols/net-snmp/files/init | 67 +++ recipes-protocols/net-snmp/files/snmpd.conf | 422 ++++++++++++++++++ .../net-snmp/files/snmptrapd.conf | 18 + ...ath.m4-keep-consistent-between-32bit.patch | 38 ++ .../0001-config_os_headers-Error-Fix.patch | 35 ++ ...1-get_pid_from_inode-Include-limit.h.patch | 27 ++ ....c-Don-t-check-for-return-from-EVP_M.patch | 34 ++ ...004-configure-fix-incorrect-variable.patch | 28 ++ .../CVE-2022-44792-CVE-2022-44793.patch | 116 +++++ .../net-snmp-morello/fix-libtool-finish.patch | 34 ++ ....7.2-fix-engineBoots-value-on-SIGHUP.patch | 44 ++ ...add-knob-whether-nlist.h-are-checked.patch | 36 ++ .../net-snmp-fix-for-disable-des.patch | 30 ++ ...ting-add-the-output-format-for-ptest.patch | 35 ++ .../reproducibility-have-printcap.patch | 30 ++ .../net-snmp/net-snmp-morello/run-ptest | 5 + .../net-snmp/net-snmp-morello/snmpd.service | 14 + .../net-snmp-morello/snmptrapd.service | 14 + .../net-snmp/net-snmp-morello_5.9.3.bb | 322 +++++++++++++ 21 files changed, 1409 insertions(+) create mode 100644 recipes-protocols/net-snmp/cheri-patches/0001-tools-fix-cheri-provenance.patch create mode 100644 recipes-protocols/net-snmp/cheri-patches/0002-udp_endpoint_linux-fix-cheri-provenance.patch create mode 100755 recipes-protocols/net-snmp/files/init create mode 100644 recipes-protocols/net-snmp/files/snmpd.conf create mode 100644 recipes-protocols/net-snmp/files/snmptrapd.conf create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/0001-config_os_headers-Error-Fix.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/0001-get_pid_from_inode-Include-limit.h.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/0004-configure-fix-incorrect-variable.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/CVE-2022-44792-CVE-2022-44793.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/fix-libtool-finish.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/net-snmp-add-knob-whether-nlist.h-are-checked.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/net-snmp-fix-for-disable-des.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/net-snmp-testing-add-the-output-format-for-ptest.patch create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/reproducibility-have-printcap.patch create mode 100755 recipes-protocols/net-snmp/net-snmp-morello/run-ptest create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/snmpd.service create mode 100644 recipes-protocols/net-snmp/net-snmp-morello/snmptrapd.service create mode 100644 recipes-protocols/net-snmp/net-snmp-morello_5.9.3.bb
diff --git a/recipes-protocols/net-snmp/cheri-patches/0001-tools-fix-cheri-provenance.patch b/recipes-protocols/net-snmp/cheri-patches/0001-tools-fix-cheri-provenance.patch new file mode 100644 index 0000000..011c058 --- /dev/null +++ b/recipes-protocols/net-snmp/cheri-patches/0001-tools-fix-cheri-provenance.patch @@ -0,0 +1,32 @@ +From af83d85774efe2d4114430fc178e8835346dcfea Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Mon, 10 Jul 2023 12:59:45 +0100 +Subject: [PATCH] tools: fix cheri provenance + +Replace the cast size_t with uintptr_t, it is safe to do +so as this macro is used only with pointers. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + include/net-snmp/library/tools.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/net-snmp/library/tools.h b/include/net-snmp/library/tools.h +index 2b69d63..ed9cda7 100644 +--- a/include/net-snmp/library/tools.h ++++ b/include/net-snmp/library/tools.h +@@ -88,9 +88,9 @@ extern "C" { + */ + #if defined(__GNUC__) + #define NETSNMP_REMOVE_CONST(t, e) \ +- (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; })) ++ (__extension__ ({ const t tmp = (e); (t)(uintptr_t)tmp; })) + #else +-#define NETSNMP_REMOVE_CONST(t, e) ((t)(size_t)(e)) ++#define NETSNMP_REMOVE_CONST(t, e) ((t)(uintptr_t)(e)) + #endif + + +-- +2.34.1 + diff --git a/recipes-protocols/net-snmp/cheri-patches/0002-udp_endpoint_linux-fix-cheri-provenance.patch b/recipes-protocols/net-snmp/cheri-patches/0002-udp_endpoint_linux-fix-cheri-provenance.patch new file mode 100644 index 0000000..a6e89c2 --- /dev/null +++ b/recipes-protocols/net-snmp/cheri-patches/0002-udp_endpoint_linux-fix-cheri-provenance.patch @@ -0,0 +1,28 @@ +From 16d13618f3ae71394be8247a5de2aadace40a31b Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Mon, 10 Jul 2023 13:30:38 +0100 +Subject: [PATCH 2/2] udp_endpoint_linux: fix cheri provenance + +Cast the size to uintptr_t. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c b/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c +index f0c92d8..c6f6e9f 100644 +--- a/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c ++++ b/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c +@@ -303,7 +303,7 @@ _load6(netsnmp_container *container, u_int load_flags) + memset(&lpi, 0x0, sizeof(lpi)); + lpi.mem_size = sizeof(netsnmp_udp_endpoint_entry); + lpi.process = _process_line_udp_ep; +- lpi.user_context = (void*)CONTAINER_SIZE(container); ++ lpi.user_context = (void*)(uintptr_t)CONTAINER_SIZE(container); + + container = netsnmp_file_text_parse(fp, container, PM_USER_FUNCTION, + 0, &lpi); +-- +2.34.1 + diff --git a/recipes-protocols/net-snmp/files/init b/recipes-protocols/net-snmp/files/init new file mode 100755 index 0000000..046c624 --- /dev/null +++ b/recipes-protocols/net-snmp/files/init @@ -0,0 +1,67 @@ +#! /bin/sh +# /etc/init.d/snmpd: start snmp daemon. + +. /etc/init.d/functions + +# Defaults +PURECAP_DIR=%PURECAP_DIR% +export MIBDIRS=${PURECAP_DIR}/usr/share/snmp/mibs +SNMPDRUN=yes +SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid' +TRAPDRUN=no +TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid' +PIDFILE=/var/run/snmpd.pid +SPIDFILE=/var/run/snmptrapd.pid + +# Reads config file if exists (will override defaults above) +[ -r /etc/default/snmpd ] && . /etc/default/snmpd + +[ "$SNMPDRUN" = "yes" ] && { test -x ${PURECAP_DIR}/usr/sbin/snmpd || exit 0; } +[ "$TRAPDRUN" = "yes" ] && { test -x ${PURECAP_DIR}/usr/sbin/snmptrapd || exit 0; } + +case "$1" in + start) + echo -n "Starting network management services:" + if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf -a ! -f "$PIDFILE" ]; then + start-stop-daemon -o --start --quiet --name snmpd --pidfile "$PIDFILE" \ + --exec ${PURECAP_DIR}/usr/sbin/snmpd -- $SNMPDOPTS + echo -n " snmpd" + fi + if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf -a ! -f "$SPIDFILE" ]; then + start-stop-daemon -o --start --quiet --name snmptrapd --pidfile "$SPIDFILE" \ + --exec ${PURECAP_DIR}/usr/sbin/snmptrapd -- $TRAPDOPTS + echo -n " snmptrapd" + fi + echo "." + + test ! -x /sbin/restorecon || /sbin/restorecon -FR /var/lib/net-snmp + ;; + stop) + echo -n "Stopping network management services:" + if [ -f "$PIDFILE" ] ; then + start-stop-daemon -o --stop --quiet --pidfile $PIDFILE --name snmpd + fi + echo -n " snmpd" + if [ -f "$SPIDFILE" ] ; then + start-stop-daemon -o --stop --quiet --pidfile $SPIDFILE --name snmptrapd + rm -rf $SPIDFILE + fi + echo -n " snmptrapd" + echo "." + ;; + status) + status ${PURECAP_DIR}/usr/sbin/snmpd; + exit $? + ;; + restart|reload|force-reload) + $0 stop + # Allow the daemons time to exit completely. + sleep 2 + $0 start + ;; + *) + echo "Usage: /etc/init.d/snmpd {start|stop|status|restart|reload|force-reload}" + exit 1 +esac + +exit 0 diff --git a/recipes-protocols/net-snmp/files/snmpd.conf b/recipes-protocols/net-snmp/files/snmpd.conf new file mode 100644 index 0000000..728171c --- /dev/null +++ b/recipes-protocols/net-snmp/files/snmpd.conf @@ -0,0 +1,422 @@ +############################################################################### +# +# EXAMPLE.conf: +# An example configuration file for configuring the ucd-snmp snmpd agent. +# +############################################################################### +# +# This file is intended to only be an example. If, however, you want +# to use it, it should be placed in /etc/snmp/snmpd.conf. +# When the snmpd agent starts up, this is where it will look for it. +# +# You might be interested in generating your own snmpd.conf file using +# the "snmpconf" program (perl script) instead. It's a nice menu +# based interface to writing well commented configuration files. Try it! +# +# Note: This file is automatically generated from EXAMPLE.conf.def. +# Do NOT read the EXAMPLE.conf.def file! Instead, after you have run +# configure & make, and then make sure you read the EXAMPLE.conf file +# instead, as it will tailor itself to your configuration. + +# All lines beginning with a '#' are comments and are intended for you +# to read. All other lines are configuration commands for the agent. + +# +# PLEASE: read the snmpd.conf(5) manual page as well! +# + + +############################################################################### +# Access Control +############################################################################### + +# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY +# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO +# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE. + +# By far, the most common question I get about the agent is "why won't +# it work?", when really it should be "how do I configure the agent to +# allow me to access it?" +# +# By default, the agent responds to the "public" community for read +# only access, if run out of the box without any configuration file in +# place. The following examples show you other ways of configuring +# the agent so that you can change the community names, and give +# yourself write access as well. +# +# The following lines change the access permissions of the agent so +# that the COMMUNITY string provides read-only access to your entire +# NETWORK (EG: 10.10.10.0/24), and read/write access to only the +# localhost (127.0.0.1, not its real ipaddress). +# +# For more information, read the FAQ as well as the snmpd.conf(5) +# manual page. + +#### +# First, map the community name (COMMUNITY) into a security name +# (local and mynetwork, depending on where the request is coming +# from): + +# sec.name source community +com2sec paranoid default public +#com2sec readonly default public +#com2sec readwrite default private + +#### +# Second, map the security names into group names: + +# sec.model sec.name +group MyROSystem v1 paranoid +group MyROSystem v2c paranoid +group MyROSystem usm paranoid +group MyROGroup v1 readonly +group MyROGroup v2c readonly +group MyROGroup usm readonly +group MyRWGroup v1 readwrite +group MyRWGroup v2c readwrite +group MyRWGroup usm readwrite + +#### +# Third, create a view for us to let the groups have rights to: + +# incl/excl subtree mask +view all included .1 80 +view system included .iso.org.dod.internet.mgmt.mib-2.system + +#### +# Finally, grant the 2 groups access to the 1 view with different +# write permissions: + +# context sec.model sec.level match read write notif +access MyROSystem "" any noauth exact system none none +access MyROGroup "" any noauth exact all none none +access MyRWGroup "" any noauth exact all all none + +# ----------------------------------------------------------------------------- + + +############################################################################### +# System contact information +# + +# It is also possible to set the sysContact and sysLocation system +# variables through the snmpd.conf file. **PLEASE NOTE** that setting +# the value of these objects here makes these objects READ-ONLY +# (regardless of any access control settings). Any attempt to set the +# value of an object whose value is given here will fail with an error +# status of notWritable. + +syslocation Unknown (configure /etc/snmp/snmpd.local.conf) +syscontact Root root@localhost (configure /etc/snmp/snmpd.local.conf) + +# Example output of snmpwalk: +# % snmpwalk -v 1 -c public localhost system +# system.sysDescr.0 = "SunOS name sun4c" +# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4 +# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55 +# system.sysContact.0 = "Me me@somewhere.org" +# system.sysName.0 = "name" +# system.sysLocation.0 = "Right here, right now." +# system.sysServices.0 = 72 + + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Process checks. +# +# The following are examples of how to use the agent to check for +# processes running on the host. The syntax looks something like: +# +# proc NAME [MAX=0] [MIN=0] +# +# NAME: the name of the process to check for. It must match +# exactly (ie, http will not find httpd processes). +# MAX: the maximum number allowed to be running. Defaults to 0. +# MIN: the minimum number to be running. Defaults to 0. + +# +# Examples: +# + +# Make sure mountd is running +#proc mountd + +# Make sure there are no more than 4 ntalkds running, but 0 is ok too. +#proc ntalkd 4 + +# Make sure at least one sendmail, but less than or equal to 10 are running. +#proc sendmail 10 1 + +# A snmpwalk of the prTable would look something like this: +# +# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.2 +# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2 +# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3 +# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd" +# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd" +# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail" +# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4 +# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10 +# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running." +# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = "" +# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = "" +# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0 +# +# Note that the errorFlag for mountd is set to 1 because one is not +# running (in this case an rpc.mountd is, but thats not good enough), +# and the ErrMessage tells you what's wrong. The configuration +# imposed in the snmpd.conf file is also shown. +# +# Special Case: When the min and max numbers are both 0, it assumes +# you want a max of infinity and a min of 1. +# + + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Executables/scripts +# + +# +# You can also have programs run by the agent that return a single +# line of output and an exit code. Here are two examples. +# +# exec NAME PROGRAM [ARGS ...] +# +# NAME: A generic name. +# PROGRAM: The program to run. Include the path! +# ARGS: optional arguments to be passed to the program + +# a simple hello world +#exec echotest /bin/echo hello world + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +#exec shelltest /bin/sh /tmp/shtest + +# Then, +# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.8 +# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1 +# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2 +# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest" +# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest" +# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world" +# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35 +# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0 + +# Note that the second line of the /tmp/shtest shell script is cut +# off. Also note that the exit status of 35 was returned. + +# ----------------------------------------------------------------------------- + + +############################################################################### +# disk checks +# + +# The agent can check the amount of available disk space, and make +# sure it is above a set limit. + +# disk PATH [MIN=DEFDISKMINIMUMSPACE] +# +# PATH: mount path to the disk in question. +# MIN: Disks with space below this value will have the Mib's errorFlag set. +# Default value = DEFDISKMINIMUMSPACE. + +# Check the / partition and make sure it contains at least 10 megs. + +#disk / 10000 + +# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.9 +# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F +# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0" +# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000 +# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130 +# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325 +# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092 +# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# load average checks +# + +# load [1MAX=DEFMAXLOADAVE] [5MAX=DEFMAXLOADAVE] [15MAX=DEFMAXLOADAVE] +# +# 1MAX: If the 1 minute load average is above this limit at query +# time, the errorFlag will be set. +# 5MAX: Similar, but for 5 min average. +# 15MAX: Similar, but for 15 min average. + +# Check for loads: +#load 12 14 14 + +# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.10 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3 +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15" +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36 +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Extensible sections. +# + +# This alleviates the multiple line output problem found in the +# previous executable mib by placing each mib in its own mib table: + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest + +# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.50 +# enterprises.ucdavis.50.1.1 = 1 +# enterprises.ucdavis.50.2.1 = "shelltest" +# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.50.100.1 = 35 +# enterprises.ucdavis.50.101.1 = "hello world." +# enterprises.ucdavis.50.101.2 = "hi there." +# enterprises.ucdavis.50.102.1 = 0 + +# Now the Output has grown to two lines, and we can see the 'hi +# there.' output as the second line from our shell script. +# +# Note that you must alter the mib.txt file to be correct if you want +# the .50.* outputs above to change to reasonable text descriptions. + +# Other ideas: +# +# exec .1.3.6.1.4.1.2021.51 ps /bin/ps +# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top +# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Pass through control. +# + +# Usage: +# pass MIBOID EXEC-COMMAND +# +# This will pass total control of the mib underneath the MIBOID +# portion of the mib to the EXEC-COMMAND. +# +# Note: You'll have to change the path of the passtest script to your +# source directory or install it in the given location. +# +# Example: (see the script for details) +# (commented out here since it requires that you place the +# script in the right location. (its not installed by default)) + +# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/passtest + +# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255 +# enterprises.ucdavis.255.1 = "life the universe and everything" +# enterprises.ucdavis.255.2.1 = 42 +# enterprises.ucdavis.255.2.2 = OID: 42.42.42 +# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42 +# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1 +# enterprises.ucdavis.255.5 = 42 +# enterprises.ucdavis.255.6 = Gauge: 42 +# +# % snmpget -v 1 -c public localhost .1.3.6.1.4.1.2021.255.5 +# enterprises.ucdavis.255.5 = 42 +# +# % snmpset -v 1 -c public localhost .1.3.6.1.4.1.2021.255.1 s "New string" +# enterprises.ucdavis.255.1 = "New string" +# + +# For specific usage information, see the man/snmpd.conf.5 manual page +# as well as the local/passtest script used in the above example. + +############################################################################### +# Subagent control +# + +# The agent can support subagents using a number of extension mechanisms. +# From the 4.2.1 release, AgentX support is being compiled in by default. +# However, this is still experimental code, so should not be used on +# critical production systems. +# Please see the file README.agentx for more details. +# +# If having read, marked, learnt and inwardly digested this information, +# you decide that you do wish to make use of this mechanism, simply +# uncomment the following directive. +# +# master agentx +# +# I repeat - this is *NOT* regarded as suitable for front-line production +# systems, though it is probably stable enough for day-to-day use. +# Probably. +# +# No refunds will be given. + +############################################################################### +# Further Information +# +# See the snmpd.conf manual page, and the output of "snmpd -H". +# MUCH more can be done with the snmpd.conf than is shown as an +# example here. diff --git a/recipes-protocols/net-snmp/files/snmptrapd.conf b/recipes-protocols/net-snmp/files/snmptrapd.conf new file mode 100644 index 0000000..8d2e437 --- /dev/null +++ b/recipes-protocols/net-snmp/files/snmptrapd.conf @@ -0,0 +1,18 @@ +############################################################################### +# +# EXAMPLE.conf: +# An example configuration file for configuring the ucd-snmp snmptrapd agent. +# +############################################################################### +# +# This file is intended to only be an example. If, however, you want +# to use it, it should be placed in /etc/snmp/snmptrapd.conf. +# When the snmptrapd agent starts up, this is where it will look for it. +# +# All lines beginning with a '#' are comments and are intended for you +# to read. All other lines are configuration commands for the agent. + +# +# PLEASE: read the snmptrapd.conf(5) manual page as well! +# + diff --git a/recipes-protocols/net-snmp/net-snmp-morello/0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch b/recipes-protocols/net-snmp/net-snmp-morello/0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch new file mode 100644 index 0000000..0eeddf7 --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch @@ -0,0 +1,38 @@ +From 98c62e24fdd05d7e8bd8149840bad8eb0feb3fb1 Mon Sep 17 00:00:00 2001 +From: Mingli Yu mingli.yu@windriver.com +Date: Fri, 29 Jan 2021 08:49:15 +0000 +Subject: [PATCH] ac_add_search_path.m4: keep consistent between 32bit and + 64bit + +With configure option "--with-openssl=${STAGING_EXECPREFIXDIR}", it behaves +differently between 32bit and 64bit system as the openssl lib resides under +/build/tmp/work/corei7-64-wrs-linux/net-snmp/5.9-r0/recipe-sysroot/usr/lib64 +for 64bit system, but resides under [1] for 32bit system. + +So add the patch to fix the gap between 32bit and 64bit system. + +[1] /build/tmp/work/corei7-64-wrs-linux/net-snmp/5.9-r0/recipe-sysroot/usr/lib + +Upstream-Status: Inappropriate [configuration specific] + +Signed-off-by: Mingli Yu mingli.yu@windriver.com + +--- + m4/ac_add_search_path.m4 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/m4/ac_add_search_path.m4 b/m4/ac_add_search_path.m4 +index 8e0a819..e9585bc 100644 +--- a/m4/ac_add_search_path.m4 ++++ b/m4/ac_add_search_path.m4 +@@ -3,8 +3,8 @@ dnl Add a search path to the LIBS and CPPFLAGS variables + dnl + AC_DEFUN([AC_ADD_SEARCH_PATH],[ + if test "x$1" != x -a -d $1; then +- if test -d $1/lib; then +- LDFLAGS="-L$1/lib $LDFLAGS" ++ if test -d $1/${libdir:5}; then ++ LDFLAGS="-L$1/${libdir:5} $LDFLAGS" + fi + if test -d $1/include; then + CPPFLAGS="-I$1/include $CPPFLAGS" diff --git a/recipes-protocols/net-snmp/net-snmp-morello/0001-config_os_headers-Error-Fix.patch b/recipes-protocols/net-snmp/net-snmp-morello/0001-config_os_headers-Error-Fix.patch new file mode 100644 index 0000000..f8a52a6 --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/0001-config_os_headers-Error-Fix.patch @@ -0,0 +1,35 @@ +From e86d5fd52f19b85da0b7cce660c6e65ec4c0f9bb Mon Sep 17 00:00:00 2001 +From: Li xin lixin.fnst@cn.fujitsu.com +Date: Fri, 21 Aug 2015 18:23:13 +0900 +Subject: [PATCH] config_os_headers: Error Fix + +ERROR: This autoconf log indicates errors, it looked at host include +and/or library paths while determining system capabilities. +cc1: warning: include location "/usr/local/include" is unsafe for cross-compilation [-Wpoison-system-directories] +conftest.c:168:17: fatal error: pkg.h: No such file or directory + #include <pkg.h> + ^ + +Upstream-Status: pending + +Signed-off-by: Li Xin lixin.fnst@cn.fujitsu.com + +--- + configure.d/config_os_headers | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure.d/config_os_headers b/configure.d/config_os_headers +index 01c3376..6edd85f 100644 +--- a/configure.d/config_os_headers ++++ b/configure.d/config_os_headers +@@ -395,8 +395,8 @@ then + unset ac_cv_header_pkg_h + netsnmp_save_CPPFLAGS="$CPPFLAGS" + netsnmp_save_LDFLAGS="$LDFLAGS" +- CPPFLAGS="$CPPFLAGS -I/usr/local/include" +- LDFLAGS="$LDFLAGS -L/usr/local/lib" ++ CPPFLAGS="$CPPFLAGS" ++ LDFLAGS="$LDFLAGS" + AC_CHECK_HEADERS(pkg.h, + NETSNMP_SEARCH_LIBS(pkg_init, pkg, + AC_DEFINE(HAVE_LIBPKG, 1, [define if you have BSD pkg-ng]))) diff --git a/recipes-protocols/net-snmp/net-snmp-morello/0001-get_pid_from_inode-Include-limit.h.patch b/recipes-protocols/net-snmp/net-snmp-morello/0001-get_pid_from_inode-Include-limit.h.patch new file mode 100644 index 0000000..a7881a8 --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/0001-get_pid_from_inode-Include-limit.h.patch @@ -0,0 +1,27 @@ +From 8097734b27fd146f358a4edd0d1a0d28309bd9a4 Mon Sep 17 00:00:00 2001 +From: Khem Raj raj.khem@gmail.com +Date: Fri, 22 Jul 2016 18:34:39 +0000 +Subject: [PATCH] get_pid_from_inode: Include limit.h + +PATH_MAX and NAME_MAX are required by this file + +Upstream-Status: Pending + +Signed-off-by: Khem Raj raj.khem@gmail.com + +--- + agent/mibgroup/util_funcs/get_pid_from_inode.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/agent/mibgroup/util_funcs/get_pid_from_inode.c b/agent/mibgroup/util_funcs/get_pid_from_inode.c +index 5788e1d..ea380a6 100644 +--- a/agent/mibgroup/util_funcs/get_pid_from_inode.c ++++ b/agent/mibgroup/util_funcs/get_pid_from_inode.c +@@ -6,6 +6,7 @@ + #include <net-snmp/output_api.h> + + #include <ctype.h> ++#include <limits.h> + #include <stdio.h> + #ifdef HAVE_STDLIB_H + #include <stdlib.h> diff --git a/recipes-protocols/net-snmp/net-snmp-morello/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch b/recipes-protocols/net-snmp/net-snmp-morello/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch new file mode 100644 index 0000000..af6334f --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch @@ -0,0 +1,34 @@ +From f4e1acd4f509dd26cf88da872bd5adcf884f4a5f Mon Sep 17 00:00:00 2001 +From: Khem Raj raj.khem@gmail.com +Date: Fri, 18 Sep 2015 00:28:45 -0400 +Subject: [PATCH] snmplib/keytools.c: Don't check for return from + + EVP_MD_CTX_init() + +EVP_MD_CTX_init() API returns void, it fixes errors with new compilers + +snmplib/keytools.c: In function 'generate_Ku': error: invalid use of void expression + +Signed-off-by: Khem Raj raj.khem@gmail.com +Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com + +--- + snmplib/keytools.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/snmplib/keytools.c b/snmplib/keytools.c +index 14a452a..fb1694b 100644 +--- a/snmplib/keytools.c ++++ b/snmplib/keytools.c +@@ -183,10 +183,7 @@ generate_Ku(const oid * hashtype, u_int hashtype_len, + ctx = EVP_MD_CTX_create(); + #else + ctx = malloc(sizeof(*ctx)); +- if (!EVP_MD_CTX_init(ctx)) { +- rval = SNMPERR_GENERR; +- goto generate_Ku_quit; +- } ++ EVP_MD_CTX_init(ctx); + #endif + if (!EVP_DigestInit(ctx, hashfn)) { + rval = SNMPERR_GENERR; diff --git a/recipes-protocols/net-snmp/net-snmp-morello/0004-configure-fix-incorrect-variable.patch b/recipes-protocols/net-snmp/net-snmp-morello/0004-configure-fix-incorrect-variable.patch new file mode 100644 index 0000000..6e22418 --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/0004-configure-fix-incorrect-variable.patch @@ -0,0 +1,28 @@ +From 6d655ba677563ac9d62d4d8eee59fdb39d486c02 Mon Sep 17 00:00:00 2001 +From: Wenlin Kang wenlin.kang@windriver.com +Date: Wed, 24 May 2017 17:10:20 +0800 +Subject: [PATCH] configure: fix incorrect variable + +For cross compile platform, this variable will not be correct, so fix it. + +Upstream-Status: Inappropriate [cross compile specific] + +Signed-off-by: Wenlin Kang wenlin.kang@windriver.com + +--- + Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.in b/Makefile.in +index f1cbbf5..1545be3 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -173,7 +173,7 @@ OTHERCLEANTODOS=perlclean @PYTHONCLEANTARGS@ cleanfeatures perlcleanfeatures pyt + # + # override LD_RUN_PATH to avoid dependencies on the build directory + perlmodules: perlmakefiles subdirs +- @(cd perl ; $(MAKE) LD_RUN_PATH="$(libdir):`$(PERL) -e 'use Config; print qq($$Config{archlibexp}/CORE);'`") ; \ ++ @(cd perl ; $(MAKE) LD_RUN_PATH="$(libdir):`$(PERL) -e 'use Config; print qq($$Config{installprivlib}/CORE);'`") ; \ + if test $$? != 0 ; then \ + exit 1 ; \ + fi diff --git a/recipes-protocols/net-snmp/net-snmp-morello/CVE-2022-44792-CVE-2022-44793.patch b/recipes-protocols/net-snmp/net-snmp-morello/CVE-2022-44792-CVE-2022-44793.patch new file mode 100644 index 0000000..ce7e342 --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/CVE-2022-44792-CVE-2022-44793.patch @@ -0,0 +1,116 @@ +From 4589352dac3ae111c7621298cf231742209efd9b Mon Sep 17 00:00:00 2001 +From: Bill Fenner fenner@gmail.com +Date: Fri, 25 Nov 2022 08:41:24 -0800 +Subject: [PATCH ] snmp_agent: disallow SET with NULL varbind + +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/be804106fd0771a7d05236cff36e199a...] +CVE: CVE-2022-44792 & CVE-2022-44793 +Signed-off-by: Hitendra Prajapati hprajapati@mvista.com +--- + agent/snmp_agent.c | 32 +++++++++++++++++++ + apps/snmpset.c | 1 + + .../default/T0142snmpv2csetnull_simple | 31 ++++++++++++++++++ + 3 files changed, 64 insertions(+) + create mode 100644 testing/fulltests/default/T0142snmpv2csetnull_simple + +diff --git a/agent/snmp_agent.c b/agent/snmp_agent.c +index 3376357..f51c252 100644 +--- a/agent/snmp_agent.c ++++ b/agent/snmp_agent.c +@@ -3719,12 +3719,44 @@ netsnmp_handle_request(netsnmp_agent_session *asp, int status) + return 1; + } + ++static int ++check_set_pdu_for_null_varbind(netsnmp_agent_session *asp) ++{ ++ int i; ++ netsnmp_variable_list *v = NULL; ++ ++ for (i = 1, v = asp->pdu->variables; v != NULL; i++, v = v->next_variable) { ++ if (v->type == ASN_NULL) { ++ /* ++ * Protect SET implementations that do not protect themselves ++ * against wrong type. ++ */ ++ DEBUGMSGTL(("snmp_agent", "disallowing SET with NULL var for varbind %d\n", i)); ++ asp->index = i; ++ return SNMP_ERR_WRONGTYPE; ++ } ++ } ++ return SNMP_ERR_NOERROR; ++} ++ + int + handle_pdu(netsnmp_agent_session *asp) + { + int status, inclusives = 0; + netsnmp_variable_list *v = NULL; + ++#ifndef NETSNMP_NO_WRITE_SUPPORT ++ /* ++ * Check for ASN_NULL in SET request ++ */ ++ if (asp->pdu->command == SNMP_MSG_SET) { ++ status = check_set_pdu_for_null_varbind(asp); ++ if (status != SNMP_ERR_NOERROR) { ++ return status; ++ } ++ } ++#endif /* NETSNMP_NO_WRITE_SUPPORT */ ++ + /* + * for illegal requests, mark all nodes as ASN_NULL + */ +diff --git a/apps/snmpset.c b/apps/snmpset.c +index 50f33db..387a51d 100644 +--- a/apps/snmpset.c ++++ b/apps/snmpset.c +@@ -182,6 +182,7 @@ main(int argc, char *argv[]) + case 'x': + case 'd': + case 'b': ++ case 'n': /* undocumented */ + #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES + case 'I': + case 'U': +diff --git a/testing/fulltests/default/T0142snmpv2csetnull_simple b/testing/fulltests/default/T0142snmpv2csetnull_simple +new file mode 100644 +index 0000000..0f1b8f3 +--- /dev/null ++++ b/testing/fulltests/default/T0142snmpv2csetnull_simple +@@ -0,0 +1,31 @@ ++#!/bin/sh ++ ++. ../support/simple_eval_tools.sh ++ ++HEADER SNMPv2c set of system.sysContact.0 with NULL varbind ++ ++SKIPIF NETSNMP_DISABLE_SET_SUPPORT ++SKIPIF NETSNMP_NO_WRITE_SUPPORT ++SKIPIF NETSNMP_DISABLE_SNMPV2C ++SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE ++ ++# ++# Begin test ++# ++ ++# standard V2C configuration: testcomunnity ++snmp_write_access='all' ++. ./Sv2cconfig ++STARTAGENT ++ ++CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0" ++ ++CHECK ".1.3.6.1.2.1.1.4.0 = STRING:" ++ ++CAPTURE "snmpset -On $SNMP_FLAGS -c testcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0 n x" ++ ++CHECK "Reason: wrongType" ++ ++STOPAGENT ++ ++FINISHED +-- +2.25.1 + diff --git a/recipes-protocols/net-snmp/net-snmp-morello/fix-libtool-finish.patch b/recipes-protocols/net-snmp/net-snmp-morello/fix-libtool-finish.patch new file mode 100644 index 0000000..409c1e0 --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/fix-libtool-finish.patch @@ -0,0 +1,34 @@ +From ab1d77c52e84746e75506a2870783806bc77f396 Mon Sep 17 00:00:00 2001 +From: "Roy.Li" rongqing.li@windriver.com +Date: Fri, 16 Jan 2015 14:14:01 +0800 +Subject: [PATCH] net-snmp: fix "libtool --finish" + +LIB_LDCONFIG_CMD failed since it is using a host dir $(libdir) +which is /usr/lib64 does not exist on host when compile 64bit +image. + +In fact, configuring dynamic linker run-time bindings is meaningless +at this step, If it is needed, Poky would write ldconfig scripts to +rpm-postinst for each recipe while do_package, in package.bbclass. + +Upstream-Status: Inappropriate [cross compile specific] + +Signed-off-by: Roy.Li rongqing.li@windriver.com + +--- + Makefile.top | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.top b/Makefile.top +index a962c54..1ba5607 100644 +--- a/Makefile.top ++++ b/Makefile.top +@@ -89,7 +89,7 @@ LIBREVISION = 0 + LIB_LD_CMD = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) @LD_NO_UNDEFINED@ -o + LIB_EXTENSION = la + LIB_VERSION = +-LIB_LDCONFIG_CMD = $(LIBTOOL) --mode=finish $(INSTALL_PREFIX)$(libdir) ++LIB_LDCONFIG_CMD = echo "do not ldconfig\n" + LINK = $(LIBTOOL) --mode=link $(LINKCC) + # RANLIB = @RANLIB@ + RANLIB = : diff --git a/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch b/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch new file mode 100644 index 0000000..35e93d6 --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch @@ -0,0 +1,44 @@ +From 5ad4eab43c1ea63ff343bba64d576440e8783e75 Mon Sep 17 00:00:00 2001 +From: Zheng Ruoqin zhengrq.fnst@fujitsu.com +Date: Wed, 9 Jun 2021 15:47:30 +0900 +Subject: [PATCH] net snmp: fix engineBoots value on SIGHUP + +Upstream-Status: Pending + +Signed-off-by: Marian Florea marian.florea@windriver.com +Signed-off-by: Li Zhou li.zhou@windriver.com +Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com + +--- + agent/snmpd.c | 1 + + snmplib/snmpv3.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/agent/snmpd.c b/agent/snmpd.c +index 90de12d..1ccc4db 100644 +--- a/agent/snmpd.c ++++ b/agent/snmpd.c +@@ -1169,6 +1169,7 @@ snmpd_reconfig(void) + snmp_log(LOG_INFO, "NET-SNMP version %s restarted\n", + netsnmp_get_version()); + update_config(); ++ snmp_store(app_name); + send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 3); + #ifdef HAVE_SIGPROCMASK + ret = sigprocmask(SIG_UNBLOCK, &set, NULL); +diff --git a/snmplib/snmpv3.c b/snmplib/snmpv3.c +index 7b1746b..4a17e0d 100644 +--- a/snmplib/snmpv3.c ++++ b/snmplib/snmpv3.c +@@ -1059,9 +1059,9 @@ init_snmpv3_post_config(int majorid, int minorid, void *serverarg, + /* + * if our engineID has changed at all, the boots record must be set to 1 + */ +- if (engineIDLen != oldEngineIDLength || ++ if (oldEngineIDLength != (size_t)0 && (engineIDLen != oldEngineIDLength || + oldEngineID == NULL || c_engineID == NULL || +- memcmp(oldEngineID, c_engineID, engineIDLen) != 0) { ++ memcmp(oldEngineID, c_engineID, engineIDLen) != 0)) { + engineBoots = 1; + } + diff --git a/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-add-knob-whether-nlist.h-are-checked.patch b/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-add-knob-whether-nlist.h-are-checked.patch new file mode 100644 index 0000000..c5a453a --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-add-knob-whether-nlist.h-are-checked.patch @@ -0,0 +1,36 @@ +From ad65b106d3cb3c6e595381be1c45a73c1ef6eb5e Mon Sep 17 00:00:00 2001 +From: Chong Lu Chong.Lu@windriver.com +Date: Thu, 28 May 2020 09:46:34 -0500 +Subject: [PATCH] net-snmp: add knob whether nlist.h are checked + +Previously, it still was checked when there was no nlish.h in sysroots directory. +Add knob to decide whether nlist.h are checked or not. + +Upstream-status: Pending + +Signed-off-by: Chong Lu Chong.Lu@windriver.com + +--- + configure.d/config_os_headers | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/configure.d/config_os_headers b/configure.d/config_os_headers +index b9c8c31..01c3376 100644 +--- a/configure.d/config_os_headers ++++ b/configure.d/config_os_headers +@@ -37,6 +37,7 @@ AC_CHECK_HEADERS([getopt.h pthread.h regex.h ] dnl + [sys/timeb.h ]) + + # Library and Agent: ++if test "x$with_elf" != "xno"; then + AC_CHECK_HEADERS([nlist.h],,,[ + AC_INCLUDES_DEFAULT + [ +@@ -44,6 +45,7 @@ AC_INCLUDES_DEFAULT + #define LIBBSD_DISABLE_DEPRECATED 1 + #endif + ]]) ++fi + + # Library: + AC_CHECK_HEADERS([crt_externs.h ] dnl diff --git a/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-fix-for-disable-des.patch b/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-fix-for-disable-des.patch new file mode 100644 index 0000000..c382c02 --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-fix-for-disable-des.patch @@ -0,0 +1,30 @@ +From b1b9980853b1083f0c8b9f628f8b4c3a484d4f91 Mon Sep 17 00:00:00 2001 +From: Jackie Huang jackie.huang@windriver.com +Date: Thu, 22 Jun 2017 10:25:08 +0800 +Subject: [PATCH] net-snmp: fix for --disable-des + +Include des.h only if it's found in openssl so that +the --disable-des works correctly. + +Upstream-Status: Submitted [net-snmp-coders@lists.sourceforge.net] + +Signed-off-by: Jackie Huang jackie.huang@windriver.com + +--- + snmplib/scapi.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/snmplib/scapi.c b/snmplib/scapi.c +index 54fdd5c..0f7e931 100644 +--- a/snmplib/scapi.c ++++ b/snmplib/scapi.c +@@ -85,7 +85,9 @@ netsnmp_feature_child_of(usm_scapi, usm_support); + #include <openssl/hmac.h> + #include <openssl/evp.h> + #include <openssl/rand.h> ++#ifdef HAVE_OPENSSL_DES_H + #include <openssl/des.h> ++#endif + #ifdef HAVE_AES + #include <openssl/aes.h> + #endif diff --git a/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-testing-add-the-output-format-for-ptest.patch b/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-testing-add-the-output-format-for-ptest.patch new file mode 100644 index 0000000..09ca532 --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/net-snmp-testing-add-the-output-format-for-ptest.patch @@ -0,0 +1,35 @@ +From 36a5656db7ea75dd15f35a6c1728937c6e2b901c Mon Sep 17 00:00:00 2001 +From: Jackie Huang jackie.huang@windriver.com +Date: Wed, 14 Jan 2015 15:10:06 +0800 +Subject: [PATCH] testing: add the output format for ptest + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Jackie Huang jackie.huang@windriver.com + +--- + testing/RUNTESTS | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/testing/RUNTESTS b/testing/RUNTESTS +index 6715831..a2b6fb8 100755 +--- a/testing/RUNTESTS ++++ b/testing/RUNTESTS +@@ -17,13 +17,17 @@ failed_count=0 + rm -f failed_tests + for i in "${srcdir}"/testing/fulltests/default/T*$1*; do + echo "RUNNING $i" ++ test_name=`basename $i` + ${srcdir}/testing/fulltests/support/simple_run $i + if [ $? = 0 ]; then ++ echo "PASS: $test_name" + success_count=`expr $success_count + 1` + else ++ echo "FAIL: $test_name" + failed_count=`expr $failed_count + 1` + echo "$i" >> failed_tests + fi ++ echo + done + + if [ -f failed_tests ]; then diff --git a/recipes-protocols/net-snmp/net-snmp-morello/reproducibility-have-printcap.patch b/recipes-protocols/net-snmp/net-snmp-morello/reproducibility-have-printcap.patch new file mode 100644 index 0000000..c0b51c5 --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/reproducibility-have-printcap.patch @@ -0,0 +1,30 @@ +From b923cd38e2503b86aedf66b767fd7f51c9f25645 Mon Sep 17 00:00:00 2001 +From: "douglas.royds" douglas.royds@taitradio.com +Date: Wed, 21 Nov 2018 13:52:18 +1300 +Subject: [PATCH] net-snmp: Reproducibility: Don't check build host for + +Reproducible build: Don't check for /etc/printcap on the build machine when +cross-compiling. Use AC_CHECK_FILE to set the cached variable +ac_cv_file__etc_printcap instead. When cross-compiling, this variable should be +set in the environment to "yes" or "no" as appropriate for the target platform. + +--- + configure.d/config_os_misc4 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure.d/config_os_misc4 b/configure.d/config_os_misc4 +index b6864d9..07ca922 100644 +--- a/configure.d/config_os_misc4 ++++ b/configure.d/config_os_misc4 +@@ -99,9 +99,9 @@ if test x$LPSTAT_PATH != x; then + [Path to the lpstat command]) + AC_DEFINE(HAVE_LPSTAT, 1, [Set if the lpstat command is available]) + fi +-if test -r /etc/printcap; then ++AC_CHECK_FILE([/etc/printcap], + AC_DEFINE(HAVE_PRINTCAP, 1, [Set if /etc/printcap exists]) +-fi ++) + + + # Check ps args diff --git a/recipes-protocols/net-snmp/net-snmp-morello/run-ptest b/recipes-protocols/net-snmp/net-snmp-morello/run-ptest new file mode 100755 index 0000000..76514c2 --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/run-ptest @@ -0,0 +1,5 @@ +#!/bin/sh + +workdir=$(dirname `realpath $0`) +cd ${workdir}/testing +./RUNTESTS diff --git a/recipes-protocols/net-snmp/net-snmp-morello/snmpd.service b/recipes-protocols/net-snmp/net-snmp-morello/snmpd.service new file mode 100644 index 0000000..79f67bd --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/snmpd.service @@ -0,0 +1,14 @@ +[Unit] +Description=Simple Network Management Protocol (SNMP) Daemon. +After=syslog.target network.target + +[Service] +Type=notify +Environment=PURECAP_DIR=%PURECAP_DIR% +Environment=OPTIONS="-Ls0-6d" +EnvironmentFile=-/etc/default/snmpd +ExecStart=${PURECAP_DIR}/usr/sbin/snmpd $OPTIONS -a -f +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/recipes-protocols/net-snmp/net-snmp-morello/snmptrapd.service b/recipes-protocols/net-snmp/net-snmp-morello/snmptrapd.service new file mode 100644 index 0000000..4daf94d --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello/snmptrapd.service @@ -0,0 +1,14 @@ +[Unit] +Description=Simple Network Management Protocol (SNMP) Trap Daemon. +After=syslog.target network.target + +[Service] +Type=notify +Environment=PURECAP_DIR=%PURECAP_DIR% +Environment=OPTIONS="-Lsd" +EnvironmentFile=-/etc/default/snmptrapd +ExecStart=${PURECAP_DIR}/usr/sbin/snmptrapd $OPTIONS -f +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/recipes-protocols/net-snmp/net-snmp-morello_5.9.3.bb b/recipes-protocols/net-snmp/net-snmp-morello_5.9.3.bb new file mode 100644 index 0000000..3f661fe --- /dev/null +++ b/recipes-protocols/net-snmp/net-snmp-morello_5.9.3.bb @@ -0,0 +1,322 @@ +inherit autotools-brokensep update-rc.d siteinfo systemd pkgconfig perlnative ptest purecap-sysroot + +MORELLO_SRC = "meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb" + +SUMMARY = "Various tools relating to the Simple Network Management Protocol" +HOMEPAGE = "http://www.net-snmp.org/" +SECTION = "net" +LICENSE = "BSD-3-Clause & MIT" + +LIC_FILES_CHKSUM = "file://COPYING;md5=9d100a395a38584f2ec18a8275261687" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" +FILESEXTRAPATHS:prepend := "${THISDIR}/cheri-patches:" + +DEPENDS += "openssl-morello" +DEPENDS:append:class-target = " pciutils" + +SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ + file://init \ + file://snmpd.conf \ + file://snmptrapd.conf \ + file://snmpd.service \ + file://snmptrapd.service \ + file://net-snmp-add-knob-whether-nlist.h-are-checked.patch \ + file://fix-libtool-finish.patch \ + file://net-snmp-testing-add-the-output-format-for-ptest.patch \ + file://run-ptest \ + file://0001-config_os_headers-Error-Fix.patch \ + file://0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch \ + file://0001-get_pid_from_inode-Include-limit.h.patch \ + file://0004-configure-fix-incorrect-variable.patch \ + file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \ + file://net-snmp-fix-for-disable-des.patch \ + file://reproducibility-have-printcap.patch \ + file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \ + file://CVE-2022-44792-CVE-2022-44793.patch \ + " + +SRC_URI += "\ + file://0001-tools-fix-cheri-provenance.patch \ + file://0002-udp_endpoint_linux-fix-cheri-provenance.patch \ + " + +SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a" + +S = "${WORKDIR}/net-snmp-${PV}" + +BPPNNETSNMP = "net-snmp" + +SNMP_INSTALL_DIR = "snmp" + +UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/net-snmp/files/net-snmp/" +UPSTREAM_CHECK_REGEX = "/net-snmp/(?P<pver>\d+(.\d+)+)/" + +EXTRA_OEMAKE = "OTHERLDFLAGS='${LDFLAGS}' HOST_CPPFLAGS='${BUILD_CPPFLAGS}'" + +PARALLEL_MAKE = "" +CCACHE = "" +CLEANBROKEN = "1" + +TARGET_CC_ARCH += "${LDFLAGS}" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 systemd', d)} des smux" +PACKAGECONFIG[des] = "--enable-des, --disable-des" +# PACKAGECONFIG[elfutils] = "--with-elf, --without-elf, elfutils" +PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6" +# PACKAGECONFIG[libnl] = "--with-nl, --without-nl, libnl" +PACKAGECONFIG[smux] = "" +PACKAGECONFIG[systemd] = "--with-systemd, --without-systemd" + +EXTRA_OECONF = " \ + --enable-shared \ + --disable-manuals \ + --with-defaults \ + --with-install-prefix=${prefix} \ + --with-persistent-directory=${localstatedir}/lib/net-snmp \ + --with-endianness=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ + --with-mib-modules='${MIB_MODULES}' \ + --disable-embedded-perl \ + --with-perl-modules=no \ +" + +MIB_MODULES = "" +MIB_MODULES:append = " ${@bb.utils.filter('PACKAGECONFIG', 'smux', d)}" + +CACHED_CONFIGUREVARS = " \ + ac_cv_header_valgrind_valgrind_h=no \ + ac_cv_header_valgrind_memcheck_h=no \ + ac_cv_ETC_MNTTAB=/etc/mtab \ + lt_cv_shlibpath_overrides_runpath=yes \ + ac_cv_path_UNAMEPROG=${base_bindir}/uname \ + ac_cv_path_PSPROG=${base_bindir}/ps \ + ac_cv_file__etc_printcap=no \ + NETSNMP_CONFIGURE_OPTIONS= \ +" + +PERLPROG = "/usr/bin/env perl" + +PERLPROG:class-native = "${bindir_native}/env perl" +PERLPROG:append = "${@bb.utils.contains('PACKAGECONFIG', 'perl', ' -I${WORKDIR}', '', d)}" +export PERLPROG + +HAS_PERL = "0" + +PTEST_BUILD_HOST_FILES += "net-snmp-config gen-variables" + +do_configure:prepend() { + sed -i -e "s|I/usr/include|I${STAGING_DIR_TARGET}${includedir}|g" \ + "${S}"/configure \ + "${S}"/configure.d/config_os_libs2 + if [ "${HAS_PERL}" = "1" ]; then + # this may need to be changed when package perl has any change. + cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl?/*/Config.pm ${WORKDIR}/ + cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl?/*/*/Config_heavy.pl ${WORKDIR}/ + sed -e "s@libpth => '/usr/lib.*@libpth => '${STAGING_DIR_TARGET}/${libdir} ${STAGING_DIR_TARGET}/${base_libdir}',@g" \ + -e "s@privlibexp => '/usr@privlibexp => '${STAGING_DIR_TARGET}/usr@g" \ + -e "s@scriptdir => '/usr@scriptdir => '${STAGING_DIR_TARGET}/usr@g" \ + -e "s@sitearchexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \ + -e "s@sitelibexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \ + -e "s@vendorarchexp => '/usr@vendorarchexp => '${STAGING_DIR_TARGET}/usr@g" \ + -e "s@vendorlibexp => '/usr@vendorlibexp => '${STAGING_DIR_TARGET}/usr@g" \ + -i ${WORKDIR}/Config.pm + fi + +} + +do_configure:append() { + sed -e "s@^NSC_INCLUDEDIR=.*@NSC_INCLUDEDIR=${STAGING_DIR_TARGET}${includedir}@g" \ + -e "s@^NSC_LIBDIR=-L.*@NSC_LIBDIR=-L${STAGING_DIR_TARGET}${libdir}@g" \ + -e "s@^NSC_LDFLAGS="-L.* @NSC_LDFLAGS="-L${STAGING_DIR_TARGET}${libdir} @g" \ + -i ${B}/net-snmp-config +} + +do_install:append() { + install -d ${D}${sysconfdir}/${SNMP_INSTALL_DIR} + install -d ${D}${sysconfdir}/init.d + + install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/snmpd + install -m 644 ${WORKDIR}/snmpd.conf ${D}${sysconfdir}/${SNMP_INSTALL_DIR}/ + install -m 644 ${WORKDIR}/snmptrapd.conf ${D}${sysconfdir}/${SNMP_INSTALL_DIR}/ + + install -d ${D}${systemd_unitdir}/system + + install -m 0644 ${WORKDIR}/snmpd.service ${D}${systemd_unitdir}/system/snmpd.service + install -m 0644 ${WORKDIR}/snmptrapd.service ${D}${systemd_unitdir}/system/snmptrapd.service + + sed -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \ + -i ${D}${bindir}/net-snmp-create-v3-user + sed -e 's@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g' \ + -e 's@[^ ]*-ffile-prefix-map=[^ "]*@@g' \ + -e 's@[^ ]*-fdebug-prefix-map=[^ "]*@@g' \ + -e 's@[^ ]*-fmacro-prefix-map=[^ "]*@@g' \ + -e 's@[^ ]*--sysroot=[^ "]*@@g' \ + -e 's@[^ ]*--with-libtool-sysroot=[^ "]*@@g' \ + -e 's@[^ ]*--with-install-prefix=[^ "]*@@g' \ + -e 's@[^ ]*PKG_CONFIG_PATH=[^ "]*@@g' \ + -e 's@[^ ]*PKG_CONFIG_LIBDIR=[^ "]*@@g' \ + -i ${D}${bindir}/net-snmp-config + + sed -e 's@[^ ]*-ffile-prefix-map=[^ "]*@@g' \ + -e 's@[^ ]*-fdebug-prefix-map=[^ "]*@@g' \ + -e 's@[^ ]*-fmacro-prefix-map=[^ "]*@@g' \ + -i ${D}${libdir}/pkgconfig/netsnmp*.pc + + sed -e "s:%PURECAP_DIR%:${base_prefix}:g" -i ${D}${sysconfdir}/init.d/snmpd + sed -e "s:%PURECAP_DIR%:${base_prefix}:g" -i ${D}${systemd_unitdir}/system/snmpd.service + sed -e "s:%PURECAP_DIR%:${base_prefix}:g" -i ${D}${systemd_unitdir}/system/snmptrapd.service + + # ${STAGING_DIR_HOST} is empty for native builds, and the sed command below + # will result in errors if run for native. + if [ "${STAGING_DIR_HOST}" ]; then + sed -e 's@${STAGING_DIR_HOST}@@g' \ + -i ${D}${bindir}/net-snmp-config ${D}${libdir}/pkgconfig/netsnmp*.pc + fi + + sed -e "s@^NSC_INCLUDEDIR=.*@NSC_INCLUDEDIR=${base_prefix}${includedir}@g" \ + -e "s@^NSC_LIBDIR=-L.*@NSC_LIBDIR=-L${base_prefix}${libdir}@g" \ + -e "s@^NSC_LDFLAGS="-L.* @NSC_LDFLAGS="-L${base_prefix}${libdir} @g" \ + -i ${D}${bindir}/net-snmp-config + + # oe_multilib_header net-snmp/net-snmp-config.h + + if [ "${HAS_PERL}" = "1" ]; then + find ${D}${libdir}/ -type f -name "perllocal.pod" | xargs rm -f + fi +} + +do_install:append() { + ${OBJDUMP} -D ${D}${libdir}/libnetsnmp.so > ${D}${PURECAP_DEBUGDIR}/libnetsnmp.so.dump + ${READELF} -a ${D}${libdir}/libnetsnmp.so > ${D}${PURECAP_DEBUGDIR}/libnetsnmp.so.readelf +} + +PTEST_PATH = "${libdir}/netsnmp/ptest" + +do_install_ptest() { + install -d ${D}${PTEST_PATH} + for i in ${S}/dist ${S}/include ${B}/include ${S}/mibs ${S}/configure \ + ${B}/net-snmp-config ${S}/testing; do + if [ -e "$i" ]; then + cp -R --no-dereference --preserve=mode,links -v "$i" ${D}${PTEST_PATH} + fi + done + echo `autoconf -V|awk '/autoconf/{print $NF}'` > ${D}${PTEST_PATH}/dist/autoconf-version + + rmdlist="${D}${PTEST_PATH}/dist/net-snmp-solaris-build" + for i in $rmdlist; do + if [ -d "$i" ]; then + rm -rf "$i" + fi + done +} + +SYSROOT_PREPROCESS_FUNCS += "net_snmp_sysroot_preprocess" +SNMP_DBGDIR = "${PURECAP_SYSROOT_DIR}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" + +net_snmp_sysroot_preprocess () { + if [ -e ${D}${bindir}/net-snmp-config ]; then + install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ + install -m 755 ${D}${bindir}/net-snmp-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ + sed -e "s@-I/usr/include@-I${STAGING_INCDIR}@g" \ + -e "s@^prefix=.*@prefix=${STAGING_DIR_HOST}${prefix}@g" \ + -e "s@^exec_prefix=.*@exec_prefix=${STAGING_EXECPREFIXDIR}@g" \ + -e "s@^includedir=.*@includedir=${STAGING_INCDIR}@g" \ + -e "s@^libdir=.*@libdir=${STAGING_LIBDIR}@g" \ + -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=${S}@g" \ + -e "s@-ffile-prefix-map=${SNMP_DBGDIR}@-ffile-prefix-map=${WORKDIR}=${SNMP_DBGDIR}@g" \ + -e "s@-fdebug-prefix-map=${SNMP_DBGDIR}@-fdebug-prefix-map=${WORKDIR}=${SNMP_DBGDIR}@g" \ + -e "s@-fdebug-prefix-map= -fdebug-prefix-map=@-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ + -fdebug-prefix-map=${STAGING_DIR_HOST}=@g" \ + -e "s@--sysroot=@--sysroot=${STAGING_DIR_HOST}@g" \ + -e "s@--with-libtool-sysroot=@--with-libtool-sysroot=${STAGING_DIR_HOST}@g" \ + -e "s@--with-install-prefix=@--with-install-prefix=${D}@g" \ + -i ${SYSROOT_DESTDIR}${bindir_crossscripts}/net-snmp-config + fi +} + +PACKAGES += "${PN}-libs ${PN}-mibs ${PN}-server ${PN}-client \ + ${PN}-server-snmpd ${PN}-server-snmptrapd \ + ${PN}-lib-netsnmp ${PN}-lib-agent ${PN}-lib-helpers \ + ${PN}-lib-mibs ${PN}-lib-trapd" + +# perl module +PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl-modules', '', d)}" + +ALLOW_EMPTY:${PN} = "1" +ALLOW_EMPTY:${PN}-server = "1" +ALLOW_EMPTY:${PN}-libs = "1" + +FILES:${PN}-perl-modules = "${libdir}/perl?/*" +RDEPENDS:${PN}-perl-modules = "perl" + +FILES:${PN}-libs = "" +FILES:${PN}-mibs = "${datadir}/snmp/mibs" +FILES:${PN}-server-snmpd = "${sbindir}/snmpd \ + ${sysconfdir}/${SNMP_INSTALL_DIR}/snmpd.conf \ + ${sysconfdir}/init.d \ + ${systemd_unitdir}/system/snmpd.service \ +" + +FILES:${PN}-server-snmptrapd = "${sbindir}/snmptrapd \ + ${sysconfdir}/${SNMP_INSTALL_DIR}/snmptrapd.conf \ + ${systemd_unitdir}/system/snmptrapd.service \ +" + +FILES:${PN}-lib-netsnmp = "${libdir}/libnetsnmp${SOLIBS}" +FILES:${PN}-lib-agent = "${libdir}/libnetsnmpagent${SOLIBS}" +FILES:${PN}-lib-helpers = "${libdir}/libnetsnmphelpers${SOLIBS}" +FILES:${PN}-lib-mibs = "${libdir}/libnetsnmpmibs${SOLIBS}" +FILES:${PN}-lib-trapd = "${libdir}/libnetsnmptrapd${SOLIBS}" + +FILES:${PN} = "${includedir} ${libdir}" +FILES:${PN}-client = "${bindir}/* ${datadir}/snmp/" +FILES:${PN}-dbg += "${libdir}/.debug/ ${sbindir}/.debug/ ${bindir}/.debug/" +FILES:${PN}-dev += "${bindir}/mib2c \ + ${bindir}/mib2c-update \ + ${bindir}/net-snmp-config \ + ${bindir}/net-snmp-create-v3-user \ +" + +CONFFILES:${PN}-server-snmpd = "${sysconfdir}/${SNMP_INSTALL_DIR}/snmpd.conf" +CONFFILES:${PN}-server-snmptrapd = "${sysconfdir}/${SNMP_INSTALL_DIR}/snmptrapd.conf" + +INITSCRIPT_PACKAGES = "${PN}-server-snmpd" +INITSCRIPT_NAME:${PN}-server-snmpd = "snmpd" +INITSCRIPT_PARAMS:${PN}-server-snmpd = "start 90 2 3 4 5 . stop 60 0 1 6 ." + +SYSTEMD_PACKAGES = "${PN}-server-snmpd \ + ${PN}-server-snmptrapd" + +SYSTEMD_SERVICE:${PN}-server-snmpd = "snmpd.service" +SYSTEMD_SERVICE:${PN}-server-snmptrapd = "snmptrapd.service" + +# RDEPENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'net-snmp-perl-modules', '', d)}" +# RDEPENDS:${PN} += "${PN}-client" +# RDEPENDS:${PN}-server-snmpd += "${PN}-mibs" +# RDEPENDS:${PN}-server-snmptrapd += "${PN}-server-snmpd ${PN}-lib-trapd" +# RDEPENDS:${PN}-server += "${PN}-server-snmpd ${PN}-server-snmptrapd" +# RDEPENDS:${PN}-client += "${PN}-mibs ${PN}-libs" +# RDEPENDS:${PN}-libs += "libpci \ +# ${PN}-lib-netsnmp \ +# ${PN}-lib-agent \ +# ${PN}-lib-helpers \ +# ${PN}-lib-mibs \ +# " + +RRECOMMENDS:${PN}-dbg = "${PN}-client (= ${EXTENDPKGV}) ${PN}-server (= ${EXTENDPKGV})" + +RPROVIDES:${PN}-server-snmpd += "net-snmp-server-snmpd-systemd" +RREPLACES:${PN}-server-snmpd += "net-snmp-server-snmpd-systemd" +RCONFLICTS:${PN}-server-snmpd += "net-snmp-server-snmpd-systemd" + +RPROVIDES:${PN}-server-snmptrapd += "net-snmp-server-snmptrapd-systemd" +RREPLACES:${PN}-server-snmptrapd += "net-snmp-server-snmptrapd-systemd" +RCONFLICTS:${PN}-server-snmptrapd += "net-snmp-server-snmptrapd-systemd" + +LEAD_SONAME = "libnetsnmp.so" + +MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/net-snmp-config" + +SYSTEMD_AUTO_ENABLE:${PN} = "enable" + +SYSROOT_DIRS += "${bindir}" \ No newline at end of file
Co-authored-by: Harrison Carter hcarter@thegoodpenguin.co.uk Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- recipes-core/images/morello-image.bb | 73 ++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 recipes-core/images/morello-image.bb
diff --git a/recipes-core/images/morello-image.bb b/recipes-core/images/morello-image.bb new file mode 100644 index 0000000..3d2517e --- /dev/null +++ b/recipes-core/images/morello-image.bb @@ -0,0 +1,73 @@ +inherit core-image +inherit extrausers + +SUMMARY = "Morello SDK demo image" +LICENSE = "MIT" + +IMAGE_FSTYPES += "wic tar.bz2" + +IMAGE_LINGUAS = " en-us en-gb " +IMAGE_ROOTFS_SIZE ?= "8192" +IMAGE_ROOTFS_EXTRA_SPACE:append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "", d)}" +IMAGE_OVERHEAD_FACTOR = "1.5" + +IMAGE_INSTALL = "packagegroup-core-boot ${CORE_IMAGE_EXTRA_INSTALL}" + +IMAGE_INSTALL:append = " \ + tzdata \ + localedef \ + sudo \ + " + +IMAGE_INSTALL:append = " \ + net-tools \ + netplan \ + iputils \ + iproute2 \ + openssh \ + nginx \ + " + +IMAGE_INSTALL:append = " \ + libpq \ + " + +IMAGE_INSTALL:append = " \ + php \ + php-cli \ + php-dev \ + php-fpm \ + " + +IMAGE_INSTALL:append = " \ + zlib-morello \ + ncurses-morello \ + openssl-morello \ + readline-morello \ + zabbix-server-morello \ + zabbix-agentd-morello \ + zabbix-frontend \ + net-snmp-morello \ + net-snmp-morello-mibs \ + net-snmp-morello-server-snmptrapd \ + openldap-morello \ + libevent-morello \ + libpcre-morello \ + postgresql-morello \ + libpq-morello\ + libpgtypes-morello \ + postgresql-morello-contrib \ + postgresql-morello-server-dev \ + postgresql-morello-client \ + postgresql-morello-timezone \ + postgresql-morello-setup \ + postgresql-morello-timezone \ + postgresql-morello-dbg \ + curl-morello \ + libcurl-morello \ + libidn2-morello \ + libunistring-morello \ + tcl-morello \ + base-passwd-morello \ + util-linux-morello \ + "
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- .github/workflows/workflow.yml | 88 ++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/workflow.yml
diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 0000000..d8657cc --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,88 @@ +name: meta-morello-distro + +on: + push: + branches: + - 'master' + +env: + BUILD_DIR: ${{github.workspace}}/volatile + +jobs: + + check-layers: + runs-on: [tgp-aws] + + container: + image: pwltgp/yocto:22.04 + + steps: + - name: Set up environment + run: | + echo HOME=/home/ci | sudo tee -a $GITHUB_ENV + ln -sf /home/ci $GITHUB_WORKSPACE/volatile + + sudo apt-get update + sudo apt install -yy libc++-13-dev libc++abi-13-dev + sudo apt-get install -yy libtinfo5 + + - name: Checkout + uses: actions/checkout@v3 + with: + path: ${{env.BUILD_DIR}}/meta-morello-distro + + - name: Run check-layers + run: | + cd $BUILD_DIR + kas shell --update --force-checkout meta-morello-distro/kas/base.yml --command "yocto-check-layer-wrapper $BUILD_DIR/meta-morello-distro -n --dependency $BUILD_DIR/meta-* $BUILD_DIR/meta-arm/meta-arm $BUILD_DIR/meta-arm/meta-arm-toolchain $BUILD_DIR/meta-morello/meta-morello $BUILD_DIR/meta-morello/meta-morello-toolchain $BUILD_DIR/meta-openembedded/meta-oe $BUILD_DIR/meta-openembedded/meta-networking $BUILD_DIR/meta-openembedded/meta-webserver $BUILD_DIR/meta-openembedded/meta-filesystems $BUILD_DIR/meta-openembedded/meta-python" + + build: + runs-on: [tgp-aws] + + container: + image: pwltgp/yocto:22.04 + + steps: + - name: Set up environment + run: | + + echo HOME=/home/ci | sudo tee -a $GITHUB_ENV + ln -sf /home/ci $GITHUB_WORKSPACE/volatile + + sudo apt-get update + sudo apt install -yy libc++-13-dev libc++abi-13-dev + sudo apt install -yy libtinfo5 sed + + - name: Checkout + uses: actions/checkout@v3 + with: + path: ${{env.BUILD_DIR}}/meta-morello-distro + + - name: Build meta-morello-distro soc + run: | + cd $BUILD_DIR + + kas build ./meta-morello-distro/kas/debug-soc.yml + + - name: Upload build logs on failure + if: failure() + uses: actions/upload-artifact@v3 + with: + name: failure-logs + path: | + ${{env.BUILD_DIR}}/build/tmp*/work*/**/temp/*.do_*.* + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: morello_artifacts_wic + path: | + ${{env.BUILD_DIR}}/build/tmp-soc/deploy/images/morello-soc/usb-image-morello-soc.wic + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: morello_artifacts_firmware + path: | + ${{env.BUILD_DIR}}/build/tmp-soc/deploy/images/morello-soc/board-firmware-sd-image.img +
Co-authored-by: Harrison Carter hcarter@thegoodpenguin.co.uk Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- .../0000-net-fix-provenance-error.patch | 35 + ...000-sysinfo-fix-build-with-musl-libc.patch | 32 + ...emalloc-align-and-work-with-16-not-8.patch | 168 ++ ...002-duktape-set-shift-to-5-for-CHERI.patch | 55 + .../0003-duktape-add-aling-to-16.patch | 121 ++ ...ed-use-padding-of-16-not-8-for-alloc.patch | 85 + .../0005-embed-fix-alignment-issues.patch | 93 ++ ...6-duk_config-use-debug-and-self-test.patch | 46 + .../0007-duktape-fix-stack-reallocation.patch | 64 + recipes-connectivity/zabbix/files/COPYING | 341 ++++ .../files/zabbix-agentd-morello.service | 15 + .../zabbix/files/zabbix-agentd.conf | 536 ++++++ .../zabbix/files/zabbix-proxy.conf | 1461 +++++++++++++++++ .../zabbix/files/zabbix-proxy.service | 15 + .../files/zabbix-server-morello.service | 20 + .../zabbix/files/zabbix-server.conf | 990 +++++++++++ .../zabbix/files/zabbix.conf.php | 59 + .../zabbix/zabbix-agentd-morello_5.0.38.bb | 52 + .../zabbix/zabbix-frontend_5.0.38.bb | 24 + .../zabbix/zabbix-morello.inc | 103 ++ .../zabbix/zabbix-proxy-morello_5.0.38.bb | 65 + .../zabbix/zabbix-server-morello_5.0.38.bb | 71 + 22 files changed, 4451 insertions(+) create mode 100644 recipes-connectivity/zabbix/cheri-patches/0000-net-fix-provenance-error.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0000-sysinfo-fix-build-with-musl-libc.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0001-memalloc-align-and-work-with-16-not-8.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0002-duktape-set-shift-to-5-for-CHERI.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0003-duktape-add-aling-to-16.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0004-embed-use-padding-of-16-not-8-for-alloc.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0005-embed-fix-alignment-issues.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0006-duk_config-use-debug-and-self-test.patch create mode 100644 recipes-connectivity/zabbix/cheri-patches/0007-duktape-fix-stack-reallocation.patch create mode 100644 recipes-connectivity/zabbix/files/COPYING create mode 100644 recipes-connectivity/zabbix/files/zabbix-agentd-morello.service create mode 100644 recipes-connectivity/zabbix/files/zabbix-agentd.conf create mode 100644 recipes-connectivity/zabbix/files/zabbix-proxy.conf create mode 100644 recipes-connectivity/zabbix/files/zabbix-proxy.service create mode 100644 recipes-connectivity/zabbix/files/zabbix-server-morello.service create mode 100644 recipes-connectivity/zabbix/files/zabbix-server.conf create mode 100644 recipes-connectivity/zabbix/files/zabbix.conf.php create mode 100644 recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb create mode 100644 recipes-connectivity/zabbix/zabbix-frontend_5.0.38.bb create mode 100644 recipes-connectivity/zabbix/zabbix-morello.inc create mode 100644 recipes-connectivity/zabbix/zabbix-proxy-morello_5.0.38.bb create mode 100644 recipes-connectivity/zabbix/zabbix-server-morello_5.0.38.bb
diff --git a/recipes-connectivity/zabbix/cheri-patches/0000-net-fix-provenance-error.patch b/recipes-connectivity/zabbix/cheri-patches/0000-net-fix-provenance-error.patch new file mode 100644 index 0000000..844484a --- /dev/null +++ b/recipes-connectivity/zabbix/cheri-patches/0000-net-fix-provenance-error.patch @@ -0,0 +1,35 @@ +From 79323bc3b45a0fb67168dd91dc1cc72e200e7392 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Fri, 7 Jul 2023 17:10:02 +0100 +Subject: [PATCH 4/4] net: fix provenance error + +Socket expects an int, just cast the NULL to an int. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + src/libs/zbxsysinfo/linux/net.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/libs/zbxsysinfo/linux/net.c b/src/libs/zbxsysinfo/linux/net.c +index 9e9fe73..55e2986 100644 +--- a/src/libs/zbxsysinfo/linux/net.c ++++ b/src/libs/zbxsysinfo/linux/net.c +@@ -112,13 +112,13 @@ static int find_tcp_port_by_state_nl(unsigned short port, int state, int *found) + + struct sockaddr_nl s_sa = { AF_NETLINK, 0, 0, 0 }; + struct iovec s_io[1] = { { &request, sizeof(request) } }; +- struct msghdr s_msg = { (void *)&s_sa, sizeof(struct sockaddr_nl), s_io, 1, NULL, 0, 0}; ++ struct msghdr s_msg = { (void *)&s_sa, sizeof(struct sockaddr_nl), s_io, 1, (int)NULL, 0, 0}; + + char buffer[BUFSIZ] = { 0 }; + + struct sockaddr_nl r_sa = { AF_NETLINK, 0, 0, 0 }; + struct iovec r_io[1] = { { buffer, BUFSIZ } }; +- struct msghdr r_msg = { (void *)&r_sa, sizeof(struct sockaddr_nl), r_io, 1, NULL, 0, 0}; ++ struct msghdr r_msg = { (void *)&r_sa, sizeof(struct sockaddr_nl), r_io, 1, (int)NULL, 0, 0}; + + struct nlmsghdr *r_hdr; + +-- +2.34.1 + diff --git a/recipes-connectivity/zabbix/cheri-patches/0000-sysinfo-fix-build-with-musl-libc.patch b/recipes-connectivity/zabbix/cheri-patches/0000-sysinfo-fix-build-with-musl-libc.patch new file mode 100644 index 0000000..e0ba5e2 --- /dev/null +++ b/recipes-connectivity/zabbix/cheri-patches/0000-sysinfo-fix-build-with-musl-libc.patch @@ -0,0 +1,32 @@ +From d35e95600ee80e4c526a7ed1ab6bbda2bc0c8427 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Fri, 7 Jul 2023 15:21:23 +0100 +Subject: [PATCH 1/4] sysinfo: fix build with musl libc + +If we use <sys/sysinfo.h> and a musl libc we will get +redefinition error of the sysinfo struct due to <linux/kernel.h> + +Include <linux/const.h> and <linux/types.h> directly instead. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + include/sysinc.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/include/sysinc.h b/include/sysinc.h +index 1400ca8..f34356d 100644 +--- a/include/sysinc.h ++++ b/include/sysinc.h +@@ -131,7 +131,8 @@ + #endif + + #ifdef HAVE_LINUX_KERNEL_H +-# include <linux/kernel.h> ++# include <linux/const.h> ++# include <linux/types.h> + #endif + + #ifdef HAVE_ARPA_NAMESER_H +-- +2.34.1 + diff --git a/recipes-connectivity/zabbix/cheri-patches/0001-memalloc-align-and-work-with-16-not-8.patch b/recipes-connectivity/zabbix/cheri-patches/0001-memalloc-align-and-work-with-16-not-8.patch new file mode 100644 index 0000000..9740767 --- /dev/null +++ b/recipes-connectivity/zabbix/cheri-patches/0001-memalloc-align-and-work-with-16-not-8.patch @@ -0,0 +1,168 @@ +From ff061121e98773c7e144e884bf1f8fa96c5dd0a7 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Mon, 13 Nov 2023 12:11:16 +0000 +Subject: [PATCH 1/7] memalloc: align and work with 16, not 8 + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + include/memalloc.h | 2 +- + src/libs/zbxmemory/memalloc.c | 42 ++++++++++++++++++++++------------- + 2 files changed, 28 insertions(+), 16 deletions(-) + +diff --git a/include/memalloc.h b/include/memalloc.h +index 858c509..f449cd1 100644 +--- a/include/memalloc.h ++++ b/include/memalloc.h +@@ -23,7 +23,7 @@ + #include "common.h" + #include "mutexs.h" + +-#define MEM_MIN_ALLOC 24 /* should be a multiple of 8 and at least (2 * ZBX_PTR_SIZE) */ ++#define MEM_MIN_ALLOC (3*ZBX_PTR_SIZE) /* should be a multiple of 8 and at least (2 * ZBX_PTR_SIZE) */ + + #define MEM_MIN_BUCKET_SIZE MEM_MIN_ALLOC + #define MEM_MAX_BUCKET_SIZE 256 /* starting from this size all free chunks are put into the same bucket */ +diff --git a/src/libs/zbxmemory/memalloc.c b/src/libs/zbxmemory/memalloc.c +index f3d9618..1d88dfd 100644 +--- a/src/libs/zbxmemory/memalloc.c ++++ b/src/libs/zbxmemory/memalloc.c +@@ -92,6 +92,7 @@ + + static void *ALIGN4(void *ptr); + static void *ALIGN8(void *ptr); ++static void *ALIGN16(void *ptr); + static void *ALIGNPTR(void *ptr); + + static zbx_uint64_t mem_proper_alloc_size(zbx_uint64_t size); +@@ -114,7 +115,7 @@ static void *__mem_malloc(zbx_mem_info_t *info, zbx_uint64_t size); + static void *__mem_realloc(zbx_mem_info_t *info, void *old, zbx_uint64_t size); + static void __mem_free(zbx_mem_info_t *info, void *ptr); + +-#define MEM_SIZE_FIELD sizeof(zbx_uint64_t) ++#define MEM_SIZE_FIELD (ZBX_PTR_SIZE) + + #define MEM_FLG_USED ((__UINT64_C(1))<<63) + +@@ -136,19 +137,30 @@ static void *ALIGN8(void *ptr) + return (void *)((uintptr_t)((char *)ptr + 7) & (uintptr_t)~7); + } + ++static void *ALIGN16(void *ptr) ++{ ++#if __has_builtin(__builtin_align_up) ++ return __builtin_align_up(ptr, 16); ++#else ++ return (void *)((uintptr_t)((char *)ptr + 15) & (uintptr_t)~15); ++#endif ++} ++ + static void *ALIGNPTR(void *ptr) + { + if (4 == ZBX_PTR_SIZE) + return ALIGN4(ptr); + if (8 == ZBX_PTR_SIZE) + return ALIGN8(ptr); ++ if (16 == ZBX_PTR_SIZE) ++ return ALIGN16(ptr); + assert(0); + } + + static zbx_uint64_t mem_proper_alloc_size(zbx_uint64_t size) + { + if (size >= MEM_MIN_ALLOC) +- return size + ((8 - (size & 7)) & 7); /* allocate in multiples of 8... */ ++ return size + ((16 - (size & 15)) & 15); /* allocate in multiples of 16... */ + else + return MEM_MIN_ALLOC; /* ...and at least MEM_MIN_ALLOC */ + } +@@ -158,7 +170,7 @@ static int mem_bucket_by_size(zbx_uint64_t size) + if (size < MEM_MIN_BUCKET_SIZE) + return 0; + if (size < MEM_MAX_BUCKET_SIZE) +- return (size - MEM_MIN_BUCKET_SIZE) >> 3; ++ return (size - MEM_MIN_BUCKET_SIZE) >> 4; + return MEM_BUCKET_COUNT - 1; + } + +@@ -196,7 +208,7 @@ static void mem_set_next_chunk(void *chunk, void *next) + + static void **mem_ptr_to_prev_field(void *chunk) + { +- return (NULL != chunk ? (void **)((char *)chunk + MEM_SIZE_FIELD) : NULL); ++ return (NULL != chunk ? (void **)((char *)chunk + MEM_SIZE_FIELD) : (uintptr_t)NULL); + } + + static void **mem_ptr_to_next_field(void *chunk, void **first_chunk) +@@ -545,9 +557,9 @@ int zbx_mem_create(zbx_mem_info_t **info, zbx_uint64_t size, const char *descr, + + /* allocate shared memory */ + +- if (4 != ZBX_PTR_SIZE && 8 != ZBX_PTR_SIZE) ++ if (4 != ZBX_PTR_SIZE && 8 != ZBX_PTR_SIZE && 16 != ZBX_PTR_SIZE) + { +- *error = zbx_dsprintf(*error, "failed assumption about pointer size (" ZBX_FS_SIZE_T " not in {4, 8})", ++ *error = zbx_dsprintf(*error, "failed assumption about pointer size (" ZBX_FS_SIZE_T " not in {4, 8, 16})", + (zbx_fs_size_t)ZBX_PTR_SIZE); + goto out; + } +@@ -579,7 +591,7 @@ int zbx_mem_create(zbx_mem_info_t **info, zbx_uint64_t size, const char *descr, + + /* allocate zbx_mem_info_t structure, its buckets, and description inside shared memory */ + +- *info = (zbx_mem_info_t *)ALIGN8(base); ++ *info = (zbx_mem_info_t *)ALIGN16(base); + (*info)->shm_id = shm_id; + (*info)->orig_size = size; + size -= (char *)(*info + 1) - (char *)base; +@@ -604,8 +616,8 @@ int zbx_mem_create(zbx_mem_info_t **info, zbx_uint64_t size, const char *descr, + (*info)->allow_oom = allow_oom; + + /* prepare shared memory for further allocation by creating one big chunk */ +- (*info)->lo_bound = ALIGN8(base); +- (*info)->hi_bound = ALIGN8((char *)base + size - 8); ++ (*info)->lo_bound = ALIGN16(base); ++ (*info)->hi_bound = ALIGN16((char *)base + size - 16); + + (*info)->total_size = (zbx_uint64_t)((char *)((*info)->hi_bound) - (char *)((*info)->lo_bound) - + 2 * MEM_SIZE_FIELD); +@@ -613,8 +625,8 @@ int zbx_mem_create(zbx_mem_info_t **info, zbx_uint64_t size, const char *descr, + index = mem_bucket_by_size((*info)->total_size); + (*info)->buckets[index] = (*info)->lo_bound; + mem_set_chunk_size((*info)->buckets[index], (*info)->total_size); +- mem_set_prev_chunk((*info)->buckets[index], NULL); +- mem_set_next_chunk((*info)->buckets[index], NULL); ++ mem_set_prev_chunk((*info)->buckets[index], (void*)(uintptr_t)NULL); ++ mem_set_next_chunk((*info)->buckets[index], (void*)(uintptr_t)NULL); + + (*info)->used_size = 0; + (*info)->free_size = (*info)->total_size; +@@ -776,7 +788,7 @@ void zbx_mem_dump_stats(int level, zbx_mem_info_t *info) + continue; + + zabbix_log(level, "free chunks of size %2s %3d bytes: %8u", i == MEM_BUCKET_COUNT - 1 ? ">=" : "", +- MEM_MIN_BUCKET_SIZE + 8 * i, stats.chunks_num[i]); ++ MEM_MIN_BUCKET_SIZE + 16 * i, stats.chunks_num[i]); + } + + zabbix_log(level, "min chunk size: %10llu bytes", (unsigned long long)stats.min_chunk_size); +@@ -806,14 +818,14 @@ size_t zbx_mem_required_size(int chunks_num, const char *descr, const char *para + /* that we will be able to get ourselves 'chunks_num' pieces of memory with a */ + /* total size of 'size', given that we also have to store 'descr' and 'param'? */ + +- size += 7; /* ensure we allocate enough to 8-align zbx_mem_info_t */ ++ size += 15; /* ensure we allocate enough to 16-align zbx_mem_info_t */ + size += sizeof(zbx_mem_info_t); + size += ZBX_PTR_SIZE - 1; /* ensure we allocate enough to align bucket pointers */ + size += ZBX_PTR_SIZE * MEM_BUCKET_COUNT; + size += strlen(descr) + 1; + size += strlen(param) + 1; +- size += (MEM_SIZE_FIELD - 1) + 8; /* ensure we allocate enough to align the first chunk */ +- size += (MEM_SIZE_FIELD - 1) + 8; /* ensure we allocate enough to align right size field */ ++ size += (MEM_SIZE_FIELD - 1) + 16; /* ensure we allocate enough to align the first chunk */ ++ size += (MEM_SIZE_FIELD - 1) + 16; /* ensure we allocate enough to align right size field */ + + size += (chunks_num - 1) * MEM_SIZE_FIELD * 2; /* each additional chunk requires 16 bytes of overhead */ + size += chunks_num * (MEM_MIN_ALLOC - 1); /* each chunk has size of at least MEM_MIN_ALLOC bytes */ +-- +2.34.1 + diff --git a/recipes-connectivity/zabbix/cheri-patches/0002-duktape-set-shift-to-5-for-CHERI.patch b/recipes-connectivity/zabbix/cheri-patches/0002-duktape-set-shift-to-5-for-CHERI.patch new file mode 100644 index 0000000..8e479aa --- /dev/null +++ b/recipes-connectivity/zabbix/cheri-patches/0002-duktape-set-shift-to-5-for-CHERI.patch @@ -0,0 +1,55 @@ +From 564a236360252558b2ac360e30d5d141b8c8ed1a Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Tue, 28 Nov 2023 10:43:58 +0000 +Subject: [PATCH 2/7] duktape: set shift to 5 for CHERI + +The duk_tval struct is of size 5 now + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + src/libs/zbxembed/duktape.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/libs/zbxembed/duktape.c b/src/libs/zbxembed/duktape.c +index da87cb0..e3b439f 100644 +--- a/src/libs/zbxembed/duktape.c ++++ b/src/libs/zbxembed/duktape.c +@@ -51113,6 +51113,11 @@ duk_heap *duk_heap_alloc(duk_alloc_function alloc_func, + * This will be optimized away in practice; unfortunately a + * warning is generated on some compilers as a result. + */ ++#ifdef __CHERI_PURE_CAPABILITY__ ++ if (sizeof(duk_tval) != 32) { ++ fatal_func(heap_udata, "sizeof(duk_tval) not 32, cannot use DUK_USE_EXEC_REGCONST_OPTIMIZE option"); ++ } ++#else + #if defined(DUK_USE_PACKED_TVAL) + if (sizeof(duk_tval) != 8) { + #else +@@ -51120,6 +51125,7 @@ duk_heap *duk_heap_alloc(duk_alloc_function alloc_func, + #endif + fatal_func(heap_udata, "sizeof(duk_tval) not 8 or 16, cannot use DUK_USE_EXEC_REGCONST_OPTIMIZE option"); + } ++#endif + #endif /* DUK_USE_EXEC_REGCONST_OPTIMIZE */ + + /* +@@ -79960,11 +79966,15 @@ DUK_LOCAL duk_bool_t duk__executor_handle_call(duk_hthread *thr, duk_idx_t idx, + #define DUK__RCBIT_B DUK_BC_REGCONST_B + #define DUK__RCBIT_C DUK_BC_REGCONST_C + #if defined(DUK_USE_EXEC_REGCONST_OPTIMIZE) ++#ifdef __CHERI_PURE_CAPABILITY__ ++#define DUK__TVAL_SHIFT 5 /* sizeof(duk_tval) == 32 */ ++#else + #if defined(DUK_USE_PACKED_TVAL) + #define DUK__TVAL_SHIFT 3 /* sizeof(duk_tval) == 8 */ + #else + #define DUK__TVAL_SHIFT 4 /* sizeof(duk_tval) == 16; not always the case so also asserted for */ + #endif ++#endif + #define DUK__SHIFT_A (DUK_BC_SHIFT_A - DUK__TVAL_SHIFT) + #define DUK__SHIFT_B (DUK_BC_SHIFT_B - DUK__TVAL_SHIFT) + #define DUK__SHIFT_C (DUK_BC_SHIFT_C - DUK__TVAL_SHIFT) +-- +2.34.1 + diff --git a/recipes-connectivity/zabbix/cheri-patches/0003-duktape-add-aling-to-16.patch b/recipes-connectivity/zabbix/cheri-patches/0003-duktape-add-aling-to-16.patch new file mode 100644 index 0000000..0a2169a --- /dev/null +++ b/recipes-connectivity/zabbix/cheri-patches/0003-duktape-add-aling-to-16.patch @@ -0,0 +1,121 @@ +From de0a642da6f8fe57f0174c6e11d3c75152869041 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Tue, 28 Nov 2023 14:02:26 +0000 +Subject: [PATCH 3/7] duktape: add aling to 16 + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + src/libs/zbxembed/duk_config.h | 4 +++- + src/libs/zbxembed/duktape.c | 25 +++++++++++++++++++++++++ + 2 files changed, 28 insertions(+), 1 deletion(-) + +diff --git a/src/libs/zbxembed/duk_config.h b/src/libs/zbxembed/duk_config.h +index e172f6a..e336fa7 100644 +--- a/src/libs/zbxembed/duk_config.h ++++ b/src/libs/zbxembed/duk_config.h +@@ -2590,6 +2590,8 @@ typedef struct duk_hthread duk_context; + * compiler/architecture specific. + */ + ++#define DUK_USE_ALIGN_BY 16 ++ + /* If not forced, use safe default for alignment. */ + #if !defined(DUK_USE_ALIGN_BY) + #define DUK_USE_ALIGN_BY 8 +@@ -2969,7 +2971,7 @@ typedef struct duk_hthread duk_context; + #undef DUK_USE_EXEC_PREFER_SIZE + #define DUK_USE_EXEC_REGCONST_OPTIMIZE + #undef DUK_USE_EXEC_TIMEOUT_CHECK +-#undef DUK_USE_EXPLICIT_NULL_INIT ++#define DUK_USE_EXPLICIT_NULL_INIT + #undef DUK_USE_EXTSTR_FREE + #undef DUK_USE_EXTSTR_INTERN_CHECK + #undef DUK_USE_FASTINT +diff --git a/src/libs/zbxembed/duktape.c b/src/libs/zbxembed/duktape.c +index e3b439f..6611a6e 100644 +--- a/src/libs/zbxembed/duktape.c ++++ b/src/libs/zbxembed/duktape.c +@@ -6933,6 +6933,8 @@ DUK_INTERNAL_DECL void duk_hobject_assert_valid(duk_hobject *h); + #define DUK_HOBJECT_E_FLAG_PADDING(e_sz) ((8 - (e_sz)) & 0x07) + #elif (DUK_USE_ALIGN_BY == 1) + #define DUK_HOBJECT_E_FLAG_PADDING(e_sz) 0 ++#elif (DUK_USE_ALIGN_BY == 16) ++#define DUK_HOBJECT_E_FLAG_PADDING(e_sz) ((16 - (e_sz)) & 0xF) + #else + #error invalid DUK_USE_ALIGN_BY + #endif +@@ -7242,6 +7244,8 @@ DUK_INTERNAL_DECL void duk_hobject_assert_valid(duk_hobject *h); + #define DUK_HOBJECT_ALIGN_TARGET 8 + #elif (DUK_USE_ALIGN_BY == 1) + #define DUK_HOBJECT_ALIGN_TARGET 1 ++#elif (DUK_USE_ALIGN_BY == 16) ++#define DUK_HOBJECT_ALIGN_TARGET 16 + #else + #error invalid DUK_USE_ALIGN_BY + #endif +@@ -8793,6 +8797,9 @@ struct duk_hbuffer { + #if (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_MSVC_PRAGMA) + #pragma pack(push, 8) + #endif ++#if (DUK_USE_ALIGN_BY == 16) && defined(DUK_USE_PACK_MSVC_PRAGMA) ++#pragma pack(push, 16) ++#endif + struct duk_hbuffer_fixed { + /* A union is used here as a portable struct size / alignment trick: + * by adding a 32-bit or a 64-bit (unused) union member, the size of +@@ -8813,9 +8820,15 @@ struct duk_hbuffer_fixed { + duk_uint32_t dummy_for_align4; + #elif (DUK_USE_ALIGN_BY == 8) + duk_double_t dummy_for_align8_1; ++#elif (DUK_USE_ALIGN_BY == 16) ++ duk_uint8_t dummy_for_align16_1[16]; + #if defined(DUK_USE_64BIT_OPS) ++#if (DUK_USE_ALIGN_BY == 16) ++ duk_uint64_t dummy_for_align16_2[2]; ++#else + duk_uint64_t dummy_for_align8_2; + #endif ++#endif + #elif (DUK_USE_ALIGN_BY == 1) + /* no extra padding */ + #else +@@ -8840,10 +8853,16 @@ struct duk_hbuffer_fixed { + __attribute__((aligned(8))) + #elif (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_CLANG_ATTR) + __attribute__((aligned(8))) ++#elif (DUK_USE_ALIGN_BY == 16) && defined(DUK_USE_PACK_GCC_ATTR) ++__attribute__((aligned(16))) ++#elif (DUK_USE_ALIGN_BY == 16) && defined(DUK_USE_PACK_CLANG_ATTR) ++__attribute__((aligned(16))) + #endif + ; + #if (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_MSVC_PRAGMA) + #pragma pack(pop) ++#elif (DUK_USE_ALIGN_BY == 16) && defined(DUK_USE_PACK_MSVC_PRAGMA) ++#pragma pack(pop) + #endif + + /* Dynamic buffer with 'curr_alloc' pointing to a dynamic area allocated using +@@ -65392,6 +65411,8 @@ DUK_INTERNAL void duk_hthread_create_builtin_objects(duk_hthread *thr) { + "a8" + #elif (DUK_USE_ALIGN_BY == 1) + "a1" ++#elif (DUK_USE_ALIGN_BY == 16) ++ "a16" + #else + #error invalid DUK_USE_ALIGN_BY + #endif +@@ -93466,6 +93487,10 @@ DUK_LOCAL duk_uint_t duk__selftest_struct_align(void) { + if ((sizeof(duk_hbuffer_fixed) % 8) != 0) { + DUK__FAILED("sizeof(duk_hbuffer_fixed) not aligned to 8"); + } ++#elif (DUK_USE_ALIGN_BY == 16) ++ if ((sizeof(duk_hbuffer_fixed) % 16) != 0) { ++ DUK__FAILED("sizeof(duk_hbuffer_fixed) not aligned to 16"); ++ } + #elif (DUK_USE_ALIGN_BY == 1) + /* no check */ + #else +-- +2.34.1 + diff --git a/recipes-connectivity/zabbix/cheri-patches/0004-embed-use-padding-of-16-not-8-for-alloc.patch b/recipes-connectivity/zabbix/cheri-patches/0004-embed-use-padding-of-16-not-8-for-alloc.patch new file mode 100644 index 0000000..873aa1e --- /dev/null +++ b/recipes-connectivity/zabbix/cheri-patches/0004-embed-use-padding-of-16-not-8-for-alloc.patch @@ -0,0 +1,85 @@ +From 309955f76bf0252ee73ca234d94d0419371d7e83 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Mon, 27 Nov 2023 10:32:37 +0000 +Subject: [PATCH 4/7] embed: use padding of 16 not 8 for allocators + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + src/libs/zbxembed/embed.c | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +diff --git a/src/libs/zbxembed/embed.c b/src/libs/zbxembed/embed.c +index 0e1b349..23b0d47 100644 +--- a/src/libs/zbxembed/embed.c ++++ b/src/libs/zbxembed/embed.c +@@ -28,8 +28,10 @@ + + #include "duktape.h" + +-#define ZBX_ES_MEMORY_LIMIT (1024 * 1024 * 64) +-#define ZBX_ES_STACK_LIMIT 1000 ++#define ZBX_ES_MEMORY_LIMIT (1024 * 1024 * 128) ++#define ZBX_ES_STACK_LIMIT (1000*2) ++ ++#define ZBX_ES_PAD (16) + + /* maximum number of consequent runtime errors after which it's treated as fatal error */ + #define ZBX_ES_MAX_CONSEQUENT_RT_ERROR 3 +@@ -64,7 +66,7 @@ static void *es_malloc(void *udata, duk_size_t size) + zbx_es_env_t *env = (zbx_es_env_t *)udata; + uint64_t *uptr; + +- if (env->total_alloc + size + 8 > ZBX_ES_MEMORY_LIMIT) ++ if (env->total_alloc + size + ZBX_ES_PAD > ZBX_ES_MEMORY_LIMIT) + { + if (NULL == env->ctx) + env->error = zbx_strdup(env->error, "cannot allocate memory"); +@@ -72,8 +74,8 @@ static void *es_malloc(void *udata, duk_size_t size) + return NULL; + } + +- env->total_alloc += (size + 8); +- uptr = zbx_malloc(NULL, size + 8); ++ env->total_alloc += (size + ZBX_ES_PAD); ++ uptr = zbx_malloc(NULL, size + ZBX_ES_PAD); + *uptr++ = size; + + return uptr; +@@ -88,12 +90,12 @@ static void *es_realloc(void *udata, void *ptr, duk_size_t size) + if (NULL != uptr) + { + --uptr; +- old_size = *uptr + 8; ++ old_size = *uptr + ZBX_ES_PAD; + } + else + old_size = 0; + +- if (env->total_alloc + size + 8 - old_size > ZBX_ES_MEMORY_LIMIT) ++ if (env->total_alloc + size + ZBX_ES_PAD - old_size > ZBX_ES_MEMORY_LIMIT) + { + if (NULL == env->ctx) + env->error = zbx_strdup(env->error, "cannot allocate memory"); +@@ -101,8 +103,8 @@ static void *es_realloc(void *udata, void *ptr, duk_size_t size) + return NULL; + } + +- env->total_alloc += size + 8 - old_size; +- uptr = zbx_realloc(uptr, size + 8); ++ env->total_alloc += size + ZBX_ES_PAD - old_size; ++ uptr = zbx_realloc(uptr, size + ZBX_ES_PAD); + *uptr++ = size; + + return uptr; +@@ -115,7 +117,7 @@ static void es_free(void *udata, void *ptr) + + if (NULL != ptr) + { +- env->total_alloc -= (*(--uptr) + 8); ++ env->total_alloc -= (*(--uptr) + ZBX_ES_PAD); + zbx_free(uptr); + } + } +-- +2.34.1 + diff --git a/recipes-connectivity/zabbix/cheri-patches/0005-embed-fix-alignment-issues.patch b/recipes-connectivity/zabbix/cheri-patches/0005-embed-fix-alignment-issues.patch new file mode 100644 index 0000000..36b8638 --- /dev/null +++ b/recipes-connectivity/zabbix/cheri-patches/0005-embed-fix-alignment-issues.patch @@ -0,0 +1,93 @@ +From f6c3242099c8ee29ed5e9d9bfb0ee65661f5321f Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Tue, 28 Nov 2023 09:50:06 +0000 +Subject: [PATCH 5/7] embed: fix alignment issues + +The zabbix internal embed allocators will take a properly aligned +pointer, cast it to u64 pointer store the allocated size in its +first memory chunk and then use u64 pointer aritchmetic to increment the +pointer. This is then returned as the base address for the allocated heap. + +In CHERI this means that the base adress of the memory area which is then +interpreted as an address of a capability will be misalligned as +mod 16 will not be zero. This can be fixed by using align/up down but +preferably a data object should be created here with [.size, .pdata] + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + src/libs/zbxembed/embed.c | 29 +++++++++++++++++++++++------ + 1 file changed, 23 insertions(+), 6 deletions(-) + +diff --git a/src/libs/zbxembed/embed.c b/src/libs/zbxembed/embed.c +index 23b0d47..f4b3a22 100644 +--- a/src/libs/zbxembed/embed.c ++++ b/src/libs/zbxembed/embed.c +@@ -39,6 +39,22 @@ + #define ZBX_ES_SCRIPT_HEADER "function(value){" + #define ZBX_ES_SCRIPT_FOOTER "\n}" + ++#if __has_builtin(__builtin_align_up) ++#define TYPEALIGN(ALIGNVAL,LEN) \ ++ (__builtin_align_up((LEN), ALIGNVAL)) ++#else ++#define TYPEALIGN(ALIGNVAL,LEN) \ ++ (((uintptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((uintptr_t) ((ALIGNVAL) - 1))) ++#endif ++ ++#if __has_builtin(__builtin_align_down) ++#define TYPEALIGN_DOWN(ALIGNVAL,LEN) \ ++ (__builtin_align_down((LEN), ALIGNVAL)) ++#else ++#define TYPEALIGN_DOWN(ALIGNVAL,LEN) \ ++ (((uintptr_t) (LEN)) & ~((uintptr_t) ((ALIGNVAL) - 1))) ++#endif ++ + /****************************************************************************** + * * + * Function: es_handle_error * +@@ -78,7 +94,7 @@ static void *es_malloc(void *udata, duk_size_t size) + uptr = zbx_malloc(NULL, size + ZBX_ES_PAD); + *uptr++ = size; + +- return uptr; ++ return TYPEALIGN(16,uptr); + } + + static void *es_realloc(void *udata, void *ptr, duk_size_t size) +@@ -90,7 +106,7 @@ static void *es_realloc(void *udata, void *ptr, duk_size_t size) + if (NULL != uptr) + { + --uptr; +- old_size = *uptr + ZBX_ES_PAD; ++ old_size = *TYPEALIGN_DOWN(16,uptr) + ZBX_ES_PAD; + } + else + old_size = 0; +@@ -104,10 +120,10 @@ static void *es_realloc(void *udata, void *ptr, duk_size_t size) + } + + env->total_alloc += size + ZBX_ES_PAD - old_size; +- uptr = zbx_realloc(uptr, size + ZBX_ES_PAD); ++ uptr = zbx_realloc(TYPEALIGN_DOWN(16,uptr), size + ZBX_ES_PAD); + *uptr++ = size; + +- return uptr; ++ return TYPEALIGN(16, uptr); + } + + static void es_free(void *udata, void *ptr) +@@ -117,8 +133,9 @@ static void es_free(void *udata, void *ptr) + + if (NULL != ptr) + { +- env->total_alloc -= (*(--uptr) + ZBX_ES_PAD); +- zbx_free(uptr); ++ env->total_alloc -= (*(TYPEALIGN_DOWN(16,--uptr)) + ZBX_ES_PAD); ++ void * ptr_aligned = TYPEALIGN_DOWN(16,uptr); ++ zbx_free(ptr_aligned); + } + } + +-- +2.34.1 + diff --git a/recipes-connectivity/zabbix/cheri-patches/0006-duk_config-use-debug-and-self-test.patch b/recipes-connectivity/zabbix/cheri-patches/0006-duk_config-use-debug-and-self-test.patch new file mode 100644 index 0000000..1e3253e --- /dev/null +++ b/recipes-connectivity/zabbix/cheri-patches/0006-duk_config-use-debug-and-self-test.patch @@ -0,0 +1,46 @@ +From ce62aabf204b39cde2dae5e62a7ff0d5cc3236b8 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Tue, 28 Nov 2023 08:18:20 +0000 +Subject: [PATCH 6/7] duk_config: use debug and self test + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + src/libs/zbxembed/duk_config.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/libs/zbxembed/duk_config.h b/src/libs/zbxembed/duk_config.h +index e336fa7..90e6b7a 100644 +--- a/src/libs/zbxembed/duk_config.h ++++ b/src/libs/zbxembed/duk_config.h +@@ -2938,7 +2938,7 @@ typedef struct duk_hthread duk_context; + #undef DUK_USE_DATE_GET_NOW + #undef DUK_USE_DATE_PARSE_STRING + #undef DUK_USE_DATE_PRS_GETDATE +-#undef DUK_USE_DEBUG ++#define DUK_USE_DEBUG + #undef DUK_USE_DEBUGGER_DUMPHEAP + #undef DUK_USE_DEBUGGER_INSPECT + #undef DUK_USE_DEBUGGER_PAUSE_UNCAUGHT +@@ -2946,8 +2946,8 @@ typedef struct duk_hthread duk_context; + #define DUK_USE_DEBUGGER_THROW_NOTIFY + #undef DUK_USE_DEBUGGER_TRANSPORT_TORTURE + #define DUK_USE_DEBUG_BUFSIZE 65536L +-#define DUK_USE_DEBUG_LEVEL 0 +-#undef DUK_USE_DEBUG_WRITE ++#define DUK_USE_DEBUG_LEVEL 1 ++#define DUK_USE_DEBUG_WRITE + #define DUK_USE_DOUBLE_LINKED_HEAP + #define DUK_USE_DUKTAPE_BUILTIN + #define DUK_USE_ENCODING_BUILTINS +@@ -3063,7 +3063,7 @@ typedef struct duk_hthread duk_context; + #define DUK_USE_ROM_PTRCOMP_FIRST 63488L + #undef DUK_USE_ROM_STRINGS + #define DUK_USE_SECTION_B +-#undef DUK_USE_SELF_TESTS ++#define DUK_USE_SELF_TESTS + #define DUK_USE_SHEBANG_COMMENTS + #undef DUK_USE_SHUFFLE_TORTURE + #define DUK_USE_SOURCE_NONBMP +-- +2.34.1 + diff --git a/recipes-connectivity/zabbix/cheri-patches/0007-duktape-fix-stack-reallocation.patch b/recipes-connectivity/zabbix/cheri-patches/0007-duktape-fix-stack-reallocation.patch new file mode 100644 index 0000000..da1d07f --- /dev/null +++ b/recipes-connectivity/zabbix/cheri-patches/0007-duktape-fix-stack-reallocation.patch @@ -0,0 +1,64 @@ +From ca89c8d2ae32f4ecfbcfe5be59acfd6e1ecaf16e Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Tue, 28 Nov 2023 16:37:48 +0000 +Subject: [PATCH 7/7] duk_api_stack: fix stack reallocation + +The ptr_diff is taken between the post reallocation new_valstack pointer +and pre-allocation thr->valstack pointer variables and then added to the +old base pointer. This will not work in CHERI and is also not officialy +supported by the C standard. + +Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +--- + src/libs/zbxembed/duktape.c | 24 +++++++++++++++++------- + 1 file changed, 17 insertions(+), 7 deletions(-) + +diff --git a/src/libs/zbxembed/duktape.c b/src/libs/zbxembed/duktape.c +index 6611a6e..425bf43 100644 +--- a/src/libs/zbxembed/duktape.c ++++ b/src/libs/zbxembed/duktape.c +@@ -19380,7 +19380,10 @@ DUK_LOCAL DUK_COLD DUK_NOINLINE duk_bool_t duk__resize_valstack(duk_hthread *thr + duk_tval *pre_top; + duk_tval *pre_end; + duk_tval *pre_alloc_end; +- duk_ptrdiff_t ptr_diff; ++ duk_ptrdiff_t diff_bottom; ++ duk_ptrdiff_t diff_top; ++ duk_ptrdiff_t diff_end; ++ duk_ptrdiff_t diff_alloc_end; + duk_tval *new_valstack; + duk_size_t new_alloc_size; + duk_tval *tv_prev_alloc_end; +@@ -19476,16 +19479,23 @@ DUK_LOCAL DUK_COLD DUK_NOINLINE duk_bool_t duk__resize_valstack(duk_hthread *thr + DUK_ASSERT(thr->valstack_alloc_end >= thr->valstack_end); + + /* Write new pointers. Most pointers can be handled as a pointer +- * difference. ++ * difference. + */ +- ptr_diff = (duk_ptrdiff_t) ((duk_uint8_t *) new_valstack - (duk_uint8_t *) thr->valstack); +- tv_prev_alloc_end = (duk_tval *) (void *) ((duk_uint8_t *) thr->valstack_alloc_end + ptr_diff); ++ ++ diff_bottom = (duk_ptrdiff_t) ((duk_uint8_t *) thr->valstack_bottom - (duk_uint8_t *) thr->valstack); ++ diff_top = (duk_ptrdiff_t) ((duk_uint8_t *) thr->valstack_top - (duk_uint8_t *) thr->valstack); ++ diff_end = (duk_ptrdiff_t) ((duk_uint8_t *) thr->valstack_end - (duk_uint8_t *) thr->valstack); ++ diff_alloc_end = (duk_ptrdiff_t) ((duk_uint8_t *) thr->valstack_alloc_end - (duk_uint8_t *) thr->valstack); ++ tv_prev_alloc_end = (duk_tval *) (void *) ((duk_uint8_t *) new_valstack + diff_alloc_end); ++ + thr->valstack = new_valstack; +- thr->valstack_bottom = (duk_tval *) (void *) ((duk_uint8_t *) thr->valstack_bottom + ptr_diff); +- thr->valstack_top = (duk_tval *) (void *) ((duk_uint8_t *) thr->valstack_top + ptr_diff); +- thr->valstack_end = (duk_tval *) (void *) ((duk_uint8_t *) thr->valstack_end + ptr_diff); ++ ++ thr->valstack_bottom = (duk_tval *) (void *) ((duk_uint8_t *) new_valstack + diff_bottom); ++ thr->valstack_top = (duk_tval *) (void *) ((duk_uint8_t *) new_valstack + diff_top); ++ thr->valstack_end = (duk_tval *) (void *) ((duk_uint8_t *) new_valstack + diff_end); + thr->valstack_alloc_end = (duk_tval *) (void *) ((duk_uint8_t *) new_valstack + new_alloc_size); + ++ + /* Assertions: pointer sanity after pointer updates. */ + DUK_ASSERT(thr->valstack_bottom >= thr->valstack); + DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); +-- +2.34.1 + diff --git a/recipes-connectivity/zabbix/files/COPYING b/recipes-connectivity/zabbix/files/COPYING new file mode 100644 index 0000000..c1002d5 --- /dev/null +++ b/recipes-connectivity/zabbix/files/COPYING @@ -0,0 +1,341 @@ + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/recipes-connectivity/zabbix/files/zabbix-agentd-morello.service b/recipes-connectivity/zabbix/files/zabbix-agentd-morello.service new file mode 100644 index 0000000..df38c1a --- /dev/null +++ b/recipes-connectivity/zabbix/files/zabbix-agentd-morello.service @@ -0,0 +1,15 @@ +[Unit] +Description=Zabbix Agent + +[Service] +Environment="CONFFILE=%SYSCONFDIR%/zabbix/zabbix-agentd.conf" +EnvironmentFile=-%SYSCONFDIR%/default/zabbix-agent +Type=forking +Restart=on-failure +KillMode=control-group +ExecStart=/bin/bash -c '%SBINDIR%/zabbix_agentd -c $CONFFILE' +ExecStop=/bin/sh -c '[ -n "$1" ] && kill -s TERM "$1"' -- "$MAINPID" +RestartSec=10s + +[Install] +WantedBy=multi-user.target diff --git a/recipes-connectivity/zabbix/files/zabbix-agentd.conf b/recipes-connectivity/zabbix/files/zabbix-agentd.conf new file mode 100644 index 0000000..52dc1b3 --- /dev/null +++ b/recipes-connectivity/zabbix/files/zabbix-agentd.conf @@ -0,0 +1,536 @@ +# This is a configuration file for Zabbix agent daemon (Unix) +# To get more information about Zabbix, visit http://www.zabbix.com + +############ GENERAL PARAMETERS ################# + +### Option: PidFile +# Name of PID file. +# +# Mandatory: no +# Default: +# PidFile=/tmp/zabbix_agentd.pid + +### Option: LogType +# Specifies where log messages are written to: +# system - syslog +# file - file specified with LogFile parameter +# console - standard output +# +# Mandatory: no +# Default: +# LogType=file + +### Option: LogFile +# Log file name for LogType 'file' parameter. +# +# Mandatory: yes, if LogType is set to file, otherwise no +# Default: +# LogFile= + +LogFile=/tmp/zabbix_agentd.log + +### Option: LogFileSize +# Maximum size of log file in MB. +# 0 - disable automatic log rotation. +# +# Mandatory: no +# Range: 0-1024 +# Default: +# LogFileSize=1 + +### Option: DebugLevel +# Specifies debug level: +# 0 - basic information about starting and stopping of Zabbix processes +# 1 - critical information +# 2 - error information +# 3 - warnings +# 4 - for debugging (produces lots of information) +# 5 - extended debugging (produces even more information) +# +# Mandatory: no +# Range: 0-5 +# Default: +# DebugLevel=3 + +### Option: SourceIP +# Source IP address for outgoing connections. +# +# Mandatory: no +# Default: +# SourceIP= + +### Option: AllowKey +# Allow execution of item keys matching pattern. +# Multiple keys matching rules may be defined in combination with DenyKey. +# Key pattern is wildcard expression, which support "*" character to match any number of any characters in certain position. It might be used in both key name and key arguments. +# Parameters are processed one by one according their appearance order. +# If no AllowKey or DenyKey rules defined, all keys are allowed. +# +# Mandatory: no + +### Option: DenyKey +# Deny execution of items keys matching pattern. +# Multiple keys matching rules may be defined in combination with AllowKey. +# Key pattern is wildcard expression, which support "*" character to match any number of any characters in certain position. It might be used in both key name and key arguments. +# Parameters are processed one by one according their appearance order. +# If no AllowKey or DenyKey rules defined, all keys are allowed. +# Unless another system.run[*] rule is specified DenyKey=system.run[*] is added by default. +# +# Mandatory: no +# Default: +# DenyKey=system.run[*] + +### Option: EnableRemoteCommands - Deprecated, use AllowKey=system.run[*] or DenyKey=system.run[*] instead +# Internal alias for AllowKey/DenyKey parameters depending on value: +# 0 - DenyKey=system.run[*] +# 1 - AllowKey=system.run[*] +# +# Mandatory: no + +### Option: LogRemoteCommands +# Enable logging of executed shell commands as warnings. +# 0 - disabled +# 1 - enabled +# +# Mandatory: no +# Default: +# LogRemoteCommands=0 + +##### Passive checks related + +### Option: Server +# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies. +# Incoming connections will be accepted only from the hosts listed here. +# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally +# and '::/0' will allow any IPv4 or IPv6 address. +# '0.0.0.0/0' can be used to allow any IPv4 address. +# Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com +# +# Mandatory: yes, if StartAgents is not explicitly set to 0 +# Default: +# Server= + +Server=127.0.0.1 + +### Option: ListenPort +# Agent will listen on this port for connections from the server. +# +# Mandatory: no +# Range: 1024-32767 +# Default: +# ListenPort=10050 + +### Option: ListenIP +# List of comma delimited IP addresses that the agent should listen on. +# First IP address is sent to Zabbix server if connecting to it to retrieve list of active checks. +# +# Mandatory: no +# Default: +# ListenIP=0.0.0.0 + +### Option: StartAgents +# Number of pre-forked instances of zabbix_agentd that process passive checks. +# If set to 0, disables passive checks and the agent will not listen on any TCP port. +# +# Mandatory: no +# Range: 0-100 +# Default: +# StartAgents=3 + +##### Active checks related + +### Option: ServerActive +# Zabbix server/proxy address or cluster configuration to get active checks from. +# Server/proxy address is IP address or DNS name and optional port separated by colon. +# Cluster configuration is one or more server addresses separated by semicolon. +# Multiple Zabbix servers/clusters and Zabbix proxies can be specified, separated by comma. +# More than one Zabbix proxy should not be specified from each Zabbix server/cluster. +# If Zabbix proxy is specified then Zabbix server/cluster for that proxy should not be specified. +# Multiple comma-delimited addresses can be provided to use several independent Zabbix servers in parallel. Spaces are allowed. +# If port is not specified, default port is used. +# IPv6 addresses must be enclosed in square brackets if port for that host is specified. +# If port is not specified, square brackets for IPv6 addresses are optional. +# If this parameter is not specified, active checks are disabled. +# Example for Zabbix proxy: +# ServerActive=127.0.0.1:10051 +# Example for multiple servers: +# ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1] +# Example for high availability: +# ServerActive=zabbix.cluster.node1;zabbix.cluster.node2:20051;zabbix.cluster.node3 +# Example for high availability with two clusters and one server: +# ServerActive=zabbix.cluster.node1;zabbix.cluster.node2:20051,zabbix.cluster2.node1;zabbix.cluster2.node2,zabbix.domain +# +# Mandatory: no +# Default: +# ServerActive= +# ServerActive=127.0.0.1 + +### Option: Hostname +# List of comma delimited unique, case sensitive hostnames. +# Required for active checks and must match hostnames as configured on the server. +# Value is acquired from HostnameItem if undefined. +# +# Mandatory: no +# Default: +# Hostname= + +# Hostname=localhost + +### Option: HostnameItem +# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined. +# Does not support UserParameters or aliases. +# +# Mandatory: no +# Default: +# HostnameItem=system.hostname + +### Option: HostMetadata +# Optional parameter that defines host metadata. +# Host metadata is used at host auto-registration process. +# An agent will issue an error and not start if the value is over limit of 255 characters. +# If not defined, value will be acquired from HostMetadataItem. +# +# Mandatory: no +# Range: 0-255 characters +# Default: +# HostMetadata= + +### Option: HostMetadataItem +# Optional parameter that defines an item used for getting host metadata. +# Host metadata is used at host auto-registration process. +# During an auto-registration request an agent will log a warning message if +# the value returned by specified item is over limit of 255 characters. +# This option is only used when HostMetadata is not defined. +# +# Mandatory: no +# Default: +# HostMetadataItem= + +### Option: HostInterface +# Optional parameter that defines host interface. +# Host interface is used at host auto-registration process. +# An agent will issue an error and not start if the value is over limit of 255 characters. +# If not defined, value will be acquired from HostInterfaceItem. +# +# Mandatory: no +# Range: 0-255 characters +# Default: +# HostInterface= + +### Option: HostInterfaceItem +# Optional parameter that defines an item used for getting host interface. +# Host interface is used at host auto-registration process. +# During an auto-registration request an agent will log a warning message if +# the value returned by specified item is over limit of 255 characters. +# This option is only used when HostInterface is not defined. +# +# Mandatory: no +# Default: +# HostInterfaceItem= + +### Option: RefreshActiveChecks +# How often list of active checks is refreshed, in seconds. +# +# Mandatory: no +# Range: 60-3600 +# Default: +# RefreshActiveChecks=120 + +### Option: BufferSend +# Do not keep data longer than N seconds in buffer. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# BufferSend=5 + +### Option: BufferSize +# Maximum number of values in a memory buffer. The agent will send +# all collected data to Zabbix Server or Proxy if the buffer is full. +# +# Mandatory: no +# Range: 2-65535 +# Default: +# BufferSize=100 + +### Option: MaxLinesPerSecond +# Maximum number of new lines the agent will send per second to Zabbix Server +# or Proxy processing 'log' and 'logrt' active checks. +# The provided value will be overridden by the parameter 'maxlines', +# provided in 'log' or 'logrt' item keys. +# +# Mandatory: no +# Range: 1-1000 +# Default: +# MaxLinesPerSecond=20 + +############ ADVANCED PARAMETERS ################# + +### Option: Alias +# Sets an alias for an item key. It can be used to substitute long and complex item key with a smaller and simpler one. +# Multiple Alias parameters may be present. Multiple parameters with the same Alias key are not allowed. +# Different Alias keys may reference the same item key. +# For example, to retrieve the ID of user 'zabbix': +# Alias=zabbix.userid:vfs.file.regexp[/etc/passwd,^zabbix:.:([0-9]+),,,,\1] +# Now shorthand key zabbix.userid may be used to retrieve data. +# Aliases can be used in HostMetadataItem but not in HostnameItem parameters. +# +# Mandatory: no +# Range: +# Default: + +### Option: Timeout +# Spend no more than Timeout seconds on processing +# +# Mandatory: no +# Range: 1-30 +# Default: +# Timeout=3 + +### Option: AllowRoot +# Allow the agent to run as 'root'. If disabled and the agent is started by 'root', the agent +# will try to switch to the user specified by the User configuration option instead. +# Has no effect if started under a regular user. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Default: +# AllowRoot=0 + +### Option: User +# Drop privileges to a specific, existing user on the system. +# Only has effect if run as 'root' and AllowRoot is disabled. +# +# Mandatory: no +# Default: +User=%ZABBIX_USER_NAME% + +### Option: Include +# You may include individual files or all files in a directory in the configuration file. +# Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time. +# +# Mandatory: no +# Default: +# Include= + +# Include=/usr/local/etc/zabbix_agentd.userparams.conf +# Include=/usr/local/etc/zabbix_agentd.conf.d/ +# Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf + +####### USER-DEFINED MONITORED PARAMETERS ####### + +### Option: UnsafeUserParameters +# Allow all characters to be passed in arguments to user-defined parameters. +# The following characters are not allowed: +# \ ' " ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @ +# Additionally, newline characters are not allowed. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Range: 0-1 +# Default: +# UnsafeUserParameters=0 + +### Option: UserParameter +# User-defined parameter to monitor. There can be several user-defined parameters. +# Format: UserParameter=<key>,<shell command> +# See 'zabbix_agentd' directory for examples. +# +# Mandatory: no +# Default: +# UserParameter= + +### Option: UserParameterDir +# Directory to execute UserParameter commands from. Only one entry is allowed. +# When executing UserParameter commands the agent will change the working directory to the one +# specified in the UserParameterDir option. +# This way UserParameter commands can be specified using the relative ./ prefix. +# +# Mandatory: no +# Default: +# UserParameterDir= + +####### LOADABLE MODULES ####### + +### Option: LoadModulePath +# Full path to location of agent modules. +# Default depends on compilation options. +# To see the default path run command "zabbix_agentd --help". +# +# Mandatory: no +# Default: +# LoadModulePath=${libdir}/modules + +### Option: LoadModule +# Module to load at agent startup. Modules are used to extend functionality of the agent. +# Formats: +# LoadModule=<module.so> +# LoadModule=<path/module.so> +# LoadModule=</abs_path/module.so> +# Either the module must be located in directory specified by LoadModulePath or the path must precede the module name. +# If the preceding path is absolute (starts with '/') then LoadModulePath is ignored. +# It is allowed to include multiple LoadModule parameters. +# +# Mandatory: no +# Default: +# LoadModule= + +####### TLS-RELATED PARAMETERS ####### + +### Option: TLSConnect +# How the agent should connect to server or proxy. Used for active checks. +# Only one value can be specified: +# unencrypted - connect without encryption +# psk - connect using TLS and a pre-shared key +# cert - connect using TLS and a certificate +# +# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection) +# Default: +# TLSConnect=unencrypted + +### Option: TLSAccept +# What incoming connections to accept. +# Multiple values can be specified, separated by comma: +# unencrypted - accept connections without encryption +# psk - accept connections secured with TLS and a pre-shared key +# cert - accept connections secured with TLS and a certificate +# +# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection) +# Default: +# TLSAccept=unencrypted + +### Option: TLSCAFile +# Full pathname of a file containing the top-level CA(s) certificates for +# peer certificate verification. +# +# Mandatory: no +# Default: +# TLSCAFile= + +### Option: TLSCRLFile +# Full pathname of a file containing revoked certificates. +# +# Mandatory: no +# Default: +# TLSCRLFile= + +### Option: TLSServerCertIssuer +# Allowed server certificate issuer. +# +# Mandatory: no +# Default: +# TLSServerCertIssuer= + +### Option: TLSServerCertSubject +# Allowed server certificate subject. +# +# Mandatory: no +# Default: +# TLSServerCertSubject= + +### Option: TLSCertFile +# Full pathname of a file containing the agent certificate or certificate chain. +# +# Mandatory: no +# Default: +# TLSCertFile= + +### Option: TLSKeyFile +# Full pathname of a file containing the agent private key. +# +# Mandatory: no +# Default: +# TLSKeyFile= + +### Option: TLSPSKIdentity +# Unique, case sensitive string used to identify the pre-shared key. +# +# Mandatory: no +# Default: +# TLSPSKIdentity= + +### Option: TLSPSKFile +# Full pathname of a file containing the pre-shared key. +# +# Mandatory: no +# Default: +# TLSPSKFile= + +####### For advanced users - TLS ciphersuite selection criteria ####### + +### Option: TLSCipherCert13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# +# Mandatory: no +# Default: +# TLSCipherCert13= + +### Option: TLSCipherCert +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128 +# +# Mandatory: no +# Default: +# TLSCipherCert= + +### Option: TLSCipherPSK13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example: +# TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherPSK13= + +### Option: TLSCipherPSK +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL +# Example for OpenSSL: +# kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherPSK= + +### Option: TLSCipherAll13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example: +# TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherAll13= + +### Option: TLSCipherAll +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128:kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherAll= + +####### For advanced users - TCP-related fine-tuning parameters ####### + +## Option: ListenBacklog +# The maximum number of pending connections in the queue. This parameter is passed to +# listen() function as argument 'backlog' (see "man listen"). +# +# Mandatory: no +# Range: 0 - INT_MAX (depends on system, too large values may be silently truncated to implementation-specified maximum) +# Default: SOMAXCONN (hard-coded constant, depends on system) +# ListenBacklog= diff --git a/recipes-connectivity/zabbix/files/zabbix-proxy.conf b/recipes-connectivity/zabbix/files/zabbix-proxy.conf new file mode 100644 index 0000000..b5bc0d5 --- /dev/null +++ b/recipes-connectivity/zabbix/files/zabbix-proxy.conf @@ -0,0 +1,1461 @@ +# This is a configuration file for Zabbix agent daemon (Unix) +# To get more information about Zabbix, visit http://www.zabbix.com + +############ GENERAL PARAMETERS ################# + +### Option: PidFile +# Name of PID file.# This is a configuration file for Zabbix proxy daemon +# To get more information about Zabbix, visit http://www.zabbix.com + +############ GENERAL PARAMETERS ################# + +### Option: ProxyMode +# Proxy operating mode. +# 0 - proxy in the active mode +# 1 - proxy in the passive mode +# +# Mandatory: no +# Default: +ProxyMode=0 + +### Option: Server +# If ProxyMode is set to active mode: +# IP address or DNS name (address:port) or cluster (address:port;address2:port) of Zabbix server to get configuration data from and send data to. +# If port is not specified, default port is used. +# Cluster nodes need to be separated by semicolon. +# If ProxyMode is set to passive mode: +# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix server. +# Incoming connections will be accepted only from the addresses listed here. +# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally +# and '::/0' will allow any IPv4 or IPv6 address. +# '0.0.0.0/0' can be used to allow any IPv4 address. +# Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com +# +# Mandatory: yes +# Default: +# Server= + +Server=%ZABBIX_SERVER_IPS% + +### Option: Hostname +# Unique, case sensitive Proxy name. Make sure the Proxy name is known to the server! +# Value is acquired from HostnameItem if undefined. +# +# Mandatory: no +# Default: +# Hostname= + +### Option: HostnameItem +# Item used for generating Hostname if it is undefined. +# Ignored if Hostname is defined. +# +# Mandatory: no +# Default: +# HostnameItem=system.hostname + +### Option: ListenPort +# Listen port for trapper. +# +# Mandatory: no +# Range: 1024-32767 +# Default: +# ListenPort=10051 +ListenPort=161 + +### Option: SourceIP +# Source IP address for outgoing connections. +# +# Mandatory: no +# Default: +# SourceIP= + +### Option: LogType +# Specifies where log messages are written to: +# system - syslog +# file - file specified with LogFile parameter +# console - standard output +# +# Mandatory: no +# Default: +# LogType=file + +### Option: LogFile +# Log file name for LogType 'file' parameter. +# +# Mandatory: yes, if LogType is set to file, otherwise no +# Default: +# LogFile= + +LogFile=/tmp/zabbix_proxy.log + +### Option: LogFileSize +# Maximum size of log file in MB. +# 0 - disable automatic log rotation. +# +# Mandatory: no +# Range: 0-1024 +# Default: +# LogFileSize=1 + +### Option: DebugLevel +# Specifies debug level: +# 0 - basic information about starting and stopping of Zabbix processes +# 1 - critical information +# 2 - error information +# 3 - warnings +# 4 - for debugging (produces lots of information) +# 5 - extended debugging (produces even more information) +# +# Mandatory: no +# Range: 0-5 +# Default: +# DebugLevel=3 + +### Option: EnableRemoteCommands +# Whether remote commands from Zabbix server are allowed. +# 0 - not allowed +# 1 - allowed +# +# Mandatory: no +# Default: +# EnableRemoteCommands=0 + +### Option: LogRemoteCommands +# Enable logging of executed shell commands as warnings. +# 0 - disabled +# 1 - enabled +# +# Mandatory: no +# Default: +# LogRemoteCommands=0 + +### Option: PidFile +# Name of PID file. +# +# Mandatory: no +# Default: +# PidFile=/tmp/zabbix_proxy.pid + +### Option: SocketDir +# IPC socket directory. +# Directory to store IPC sockets used by internal Zabbix services. +# +# Mandatory: no +# Default: +# SocketDir=/tmp + +### Option: DBHost +# Database host name. +# If set to localhost, socket is used for MySQL. +# If set to empty string, socket is used for PostgreSQL. +# If set to empty string, the Net Service Name connection method is used to connect to Oracle database; also see +# the TNS_ADMIN environment variable to specify the directory where the tnsnames.ora file is located. +# +# Mandatory: no +# Default: + +### Option: DBName +# Database name. +# For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored. +# If the Net Service Name connection method is used to connect to Oracle database, specify the service name from +# the tnsnames.ora file or set to empty string; also see the TWO_TASK environment variable if DBName is set to +# empty string. +# Warning: do not attempt to use the same database Zabbix server is using. +# +# Mandatory: yes +# Default: +# DBName= + +DBName=%DB_ZABBIX_NAME%_proxy + +### Option: DBSchema +# Schema name. Used for PostgreSQL. +# +# Mandatory: no +# Default: +DBSchema= + +### Option: DBUser +# Database user. Ignored for SQLite. +# +# Default: +# DBUser= + +DBUser=%DB_ZABBIX_USER_PROXY% + +### Option: DBPassword +# Database password. Ignored for SQLite. +# Comment this line if no password is used. +# +# Mandatory: no +# Default: +# DBPassword= +DBPassword=%DB_ZABBIX_PASSWORD% + +### Option: DBSocket +# Path to MySQL socket. +# +# Mandatory: no +# Default: +# DBSocket= + +# Option: DBPort +# Database port when not using local socket. Ignored for SQLite. +# If the Net Service Name connection method is used to connect to Oracle database, the port number from the +# tnsnames.ora file will be used. The port number set here will be ignored. +# +# Mandatory: no +# Default: +# DBPort= + +### Option: AllowUnsupportedDBVersions +# Allow proxy to work with unsupported database versions. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Default: +# AllowUnsupportedDBVersions=0 + +######### PROXY SPECIFIC PARAMETERS ############# + +### Option: ProxyLocalBuffer +# Proxy will keep data locally for N hours, even if the data have already been synced with the server. +# This parameter may be used if local data will be used by third party applications. +# +# Mandatory: no +# Range: 0-720 +# Default: +# ProxyLocalBuffer=0 + +### Option: ProxyOfflineBuffer +# Proxy will keep data for N hours in case if no connectivity with Zabbix Server. +# Older data will be lost. +# +# Mandatory: no +# Range: 1-720 +# Default: +# ProxyOfflineBuffer=1 + +### Option: HeartbeatFrequency +# Frequency of heartbeat messages in seconds. +# Used for monitoring availability of Proxy on server side. +# 0 - heartbeat messages disabled. +# For a proxy in the passive mode this parameter will be ignored. +# +# Mandatory: no +# Range: 0-3600 +# Default: +# HeartbeatFrequency=60 + +### Option: ConfigFrequency +# How often proxy retrieves configuration data from Zabbix Server in seconds. +# For a proxy in the passive mode this parameter will be ignored. +# +# Mandatory: no +# Range: 1-3600*24*7 +# Default: +# ConfigFrequency=3600 + +### Option: DataSenderFrequency +# Proxy will send collected data to the Server every N seconds. +# For a proxy in the passive mode this parameter will be ignored. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# DataSenderFrequency=1 + +############ ADVANCED PARAMETERS ################ + +### Option: StartPollers +# Number of pre-forked instances of pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPollers=5 + +### Option: StartIPMIPollers +# Number of pre-forked instances of IPMI pollers. +# The IPMI manager process is automatically started when at least one IPMI poller is started. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartIPMIPollers=0 + +### Option: StartPreprocessors +# Number of pre-forked instances of preprocessing workers. +# The preprocessing manager process is automatically started when preprocessor worker is started. +# +# Mandatory: no +# Range: 1-1000 +# Default: +# StartPreprocessors=3 + +### Option: StartPollersUnreachable +# Number of pre-forked instances of pollers for unreachable hosts (including IPMI and Java). +# At least one poller for unreachable hosts must be running if regular, IPMI or Java pollers +# are started. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPollersUnreachable=1 + +### Option: StartHistoryPollers +# Number of pre-forked instances of history pollers. +# Only required for internal checks. +# A database connection is required for each history poller instance. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartHistoryPollers=1 + +### Option: StartTrappers +# Number of pre-forked instances of trappers. +# Trappers accept incoming connections from Zabbix sender and active agents. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartTrappers=5 + +### Option: StartPingers +# Number of pre-forked instances of ICMP pingers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPingers=1 + +### Option: StartDiscoverers +# Number of pre-forked instances of discoverers. +# +# Mandatory: no +# Range: 0-250 +# Default: +# StartDiscoverers=1 + +### Option: StartHTTPPollers +# Number of pre-forked instances of HTTP pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartHTTPPollers=1 + +### Option: JavaGateway +# IP address (or hostname) of Zabbix Java gateway. +# Only required if Java pollers are started. +# +# Mandatory: no +# Default: +# JavaGateway= + +### Option: JavaGatewayPort +# Port that Zabbix Java gateway listens on. +# +# Mandatory: no +# Range: 1024-32767 +# Default: +# JavaGatewayPort=10052 + +### Option: StartJavaPollers +# Number of pre-forked instances of Java pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartJavaPollers=0 + +### Option: StartVMwareCollectors +# Number of pre-forked vmware collector instances. +# +# Mandatory: no +# Range: 0-250 +# Default: +# StartVMwareCollectors=0 + +### Option: VMwareFrequency +# How often Zabbix will connect to VMware service to obtain a new data. +# +# Mandatory: no +# Range: 10-86400 +# Default: +# VMwareFrequency=60 + +### Option: VMwarePerfFrequency +# How often Zabbix will connect to VMware service to obtain performance data. +# +# Mandatory: no +# Range: 10-86400 +# Default: +# VMwarePerfFrequency=60 + +### Option: VMwareCacheSize +# Size of VMware cache, in bytes. +# Shared memory size for storing VMware data. +# Only used if VMware collectors are started. +# +# Mandatory: no +# Range: 256K-2G +# Default: +# VMwareCacheSize=8M + +### Option: VMwareTimeout +# Specifies how many seconds vmware collector waits for response from VMware service. +# +# Mandatory: no +# Range: 1-300 +# Default: +# VMwareTimeout=10 + +### Option: SNMPTrapperFile +# Temporary file used for passing data from SNMP trap daemon to the proxy. +# Must be the same as in zabbix_trap_receiver.pl or SNMPTT configuration file. +# +# Mandatory: no +# Default: +SNMPTrapperFile=/tmp/zabbix_traps.tmp + +### Option: StartSNMPTrapper +# If 1, SNMP trapper process is started. +# +# Mandatory: no +# Range: 0-1 +# Default: +StartSNMPTrapper=1 + +### Option: ListenIP +# List of comma delimited IP addresses that the trapper should listen on. +# Trapper will listen on all network interfaces if this parameter is missing. +# +# Mandatory: no +# Default: + +### Option: HousekeepingFrequency +# How often Zabbix will perform housekeeping procedure (in hours). +# Housekeeping is removing outdated information from the database. +# To prevent Housekeeper from being overloaded, no more than 4 times HousekeepingFrequency +# hours of outdated information are deleted in one housekeeping cycle. +# To lower load on proxy startup housekeeping is postponed for 30 minutes after proxy start. +# With HousekeepingFrequency=0 the housekeeper can be only executed using the runtime control option. +# In this case the period of outdated information deleted in one housekeeping cycle is 4 times the +# period since the last housekeeping cycle, but not less than 4 hours and not greater than 4 days. +# +# Mandatory: no +# Range: 0-24 +# Default: +# HousekeepingFrequency=1 + +### Option: CacheSize +# Size of configuration cache, in bytes. +# Shared memory size, for storing hosts and items data. +# +# Mandatory: no +# Range: 128K-64G +# Default: +# CacheSize=8M + +### Option: StartDBSyncers +# Number of pre-forked instances of DB Syncers. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartDBSyncers=4 + +### Option: HistoryCacheSize +# Size of history cache, in bytes. +# Shared memory size for storing history data. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# HistoryCacheSize=16M + +### Option: HistoryIndexCacheSize +# Size of history index cache, in bytes. +# Shared memory size for indexing history cache. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# HistoryIndexCacheSize=4M + +### Option: Timeout +# Specifies how long we wait for agent, SNMP device or external check (in seconds). +# +# Mandatory: no +# Range: 1-30 +# Default: +# Timeout=3 + +Timeout=4 + +### Option: TrapperTimeout +# Specifies how many seconds trapper may spend processing new data. +# +# Mandatory: no +# Range: 1-300 +# Default: +# TrapperTimeout=300 + +### Option: UnreachablePeriod +# After how many seconds of unreachability treat a host as unavailable. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnreachablePeriod=45 + +### Option: UnavailableDelay +# How often host is checked for availability during the unavailability period, in seconds. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnavailableDelay=60 + +### Option: UnreachableDelay +# How often host is checked for availability during the unreachability period, in seconds. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnreachableDelay=15 + +## Option: StartODBCPollers +# Number of pre-forked ODBC poller instances. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartODBCPollers=1 + +### Option: ExternalScripts +# Full path to location of external scripts. +# Default depends on compilation options. +# To see the default path run command "zabbix_proxy --help". +# +# Mandatory: no +# Default: +# ExternalScripts=${datadir}/zabbix/externalscripts + +### Option: FpingLocation +# Location of fping. +# Make sure that fping binary has root ownership and SUID flag set. +# +# Mandatory: no +# Default: +# FpingLocation=/usr/sbin/fping + +### Option: Fping6Location +# Location of fping6. +# Make sure that fping6 binary has root ownership and SUID flag set. +# Make empty if your fping utility is capable to process IPv6 addresses. +# +# Mandatory: no +# Default: +# Fping6Location=/usr/sbin/fping6 + +### Option: SSHKeyLocation +# Location of public and private keys for SSH checks and actions. +# +# Mandatory: no +# Default: +# SSHKeyLocation= + +### Option: LogSlowQueries +# How long a database query may take before being logged (in milliseconds). +# Only works if DebugLevel set to 3 or 4. +# 0 - don't log slow queries. +# +# Mandatory: no +# Range: 1-3600000 +# Default: +# LogSlowQueries=0 + +LogSlowQueries=3000 + +### Option: TmpDir +# Temporary directory. +# +# Mandatory: no +# Default: +TmpDir=/tmp + +### Option: AllowRoot +# Allow the proxy to run as 'root'. If disabled and the proxy is started by 'root', the proxy +# will try to switch to the user specified by the User configuration option instead. +# Has no effect if started under a regular user. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Default: +# AllowRoot=0 + +### Option: User +# Drop privileges to a specific, existing user on the system. +# Only has effect if run as 'root' and AllowRoot is disabled. +# +# Mandatory: no +# Default: +# User=zabbix + +### Option: Include +# You may include individual files or all files in a directory in the configuration file. +# Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time. +# +# Mandatory: no +# Default: +# Include= + +# Include=/usr/local/etc/zabbix_proxy.general.conf +# Include=/usr/local/etc/zabbix_proxy.conf.d/ +# Include=/usr/local/etc/zabbix_proxy.conf.d/*.conf + +### Option: SSLCertLocation +# Location of SSL client certificates. +# This parameter is used only in web monitoring. +# Default depends on compilation options. +# To see the default path run command "zabbix_proxy --help". +# +# Mandatory: no +# Default: +# SSLCertLocation=${datadir}/zabbix/ssl/certs + +### Option: SSLKeyLocation +# Location of private keys for SSL client certificates. +# This parameter is used only in web monitoring. +# Default depends on compilation options. +# To see the default path run command "zabbix_proxy --help". +# +# Mandatory: no +# Default: +# SSLKeyLocation=${datadir}/zabbix/ssl/keys + +### Option: SSLCALocation +# Location of certificate authority (CA) files for SSL server certificate verification. +# If not set, system-wide directory will be used. +# This parameter is used in web monitoring, HTTP agent items and for communication with Vault. +# +# Mandatory: no +# Default: +# SSLCALocation= + +####### LOADABLE MODULES ####### + +### Option: LoadModulePath +# Full path to location of proxy modules. +# Default depends on compilation options. +# To see the default path run command "zabbix_proxy --help". +# +# Mandatory: no +# Default: +# LoadModulePath=${libdir}/modules + +### Option: LoadModule +# Module to load at proxy startup. Modules are used to extend functionality of the proxy. +# Formats: +# LoadModule=<module.so> +# LoadModule=<path/module.so> +# LoadModule=</abs_path/module.so> +# Either the module must be located in directory specified by LoadModulePath or the path must precede the module name. +# If the preceding path is absolute (starts with '/') then LoadModulePath is ignored. +# It is allowed to include multiple LoadModule parameters. +# +# Mandatory: no +# Default: +# LoadModule= + +### Option: StatsAllowedIP +# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of external Zabbix instances. +# Stats request will be accepted only from the addresses listed here. If this parameter is not set no stats requests +# will be accepted. +# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally +# and '::/0' will allow any IPv4 or IPv6 address. +# '0.0.0.0/0' can be used to allow any IPv4 address. +# Example: StatsAllowedIP=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com +# +# Mandatory: no +# Default: +# StatsAllowedIP= +StatsAllowedIP=%STATS_ALLOWED_IPS% + +####### TLS-RELATED PARAMETERS ####### + +### Option: TLSConnect +# How the proxy should connect to Zabbix server. Used for an active proxy, ignored on a passive proxy. +# Only one value can be specified: +# unencrypted - connect without encryption +# psk - connect using TLS and a pre-shared key +# cert - connect using TLS and a certificate +# +# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection) +# Default: +# TLSConnect=unencrypted + +### Option: TLSAccept +# What incoming connections to accept from Zabbix server. Used for a passive proxy, ignored on an active proxy. +# Multiple values can be specified, separated by comma: +# unencrypted - accept connections without encryption +# psk - accept connections secured with TLS and a pre-shared key +# cert - accept connections secured with TLS and a certificate +# +# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection) +# Default: +# TLSAccept=unencrypted + +### Option: TLSCAFile +# Full pathname of a file containing the top-level CA(s) certificates for +# peer certificate verification. +# +# Mandatory: no +# Default: +# TLSCAFile= + +### Option: TLSCRLFile +# Full pathname of a file containing revoked certificates. +# +# Mandatory: no +# Default: +# TLSCRLFile= + +### Option: TLSServerCertIssuer +# Allowed server certificate issuer. +# +# Mandatory: no +# Default: +# TLSServerCertIssuer= + +### Option: TLSServerCertSubject +# Allowed server certificate subject. +# +# Mandatory: no +# Default: +# TLSServerCertSubject= + +### Option: TLSCertFile +# Full pathname of a file containing the proxy certificate or certificate chain. +# +# Mandatory: no +# Default: +# TLSCertFile= + +### Option: TLSKeyFile +# Full pathname of a file containing the proxy private key. +# +# Mandatory: no +# Default: +# TLSKeyFile= + +### Option: TLSPSKIdentity +# Unique, case sensitive string used to identify the pre-shared key. +# +# Mandatory: no +# Default: +# TLSPSKIdentity= + +### Option: TLSPSKFile +# Full pathname of a file containing the pre-shared key. +# +# Mandatory: no +# Default: +# TLSPSKFile= + +####### For advanced users - TLS ciphersuite selection criteria ####### + +### Option: TLSCipherCert13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# +# Mandatory: no +# Default: +# TLSCipherCert13= + +### Option: TLSCipherCert +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128 +# +# Mandatory: no +# Default: +# TLSCipherCert= + +### Option: TLSCipherPSK13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example: +# TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherPSK13= + +### Option: TLSCipherPSK +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL +# Example for OpenSSL: +# kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherPSK= + +### Option: TLSCipherAll13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example: +# TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherAll13= + +### Option: TLSCipherAll +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128:kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherAll= + +### Option: DBTLSConnect +# Setting this option enforces to use TLS connection to database. +# required - connect using TLS +# verify_ca - connect using TLS and verify certificate +# verify_full - connect using TLS, verify certificate and verify that database identity specified by DBHost +# matches its certificate +# On MySQL starting from 5.7.11 and PostgreSQL following values are supported: "required", "verify_ca" and +# "verify_full". +# On MariaDB starting from version 10.2.6 "required" and "verify_full" values are supported. +# Default is not to set any option and behavior depends on database configuration +# +# Mandatory: no +# Default: +# DBTLSConnect= + +### Option: DBTLSCAFile +# Full pathname of a file containing the top-level CA(s) certificates for database certificate verification. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# (yes, if DBTLSConnect set to one of: verify_ca, verify_full) +# Default: +# DBTLSCAFile= + +### Option: DBTLSCertFile +# Full pathname of file containing Zabbix proxy certificate for authenticating to database. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# Default: +# DBTLSCertFile= + +### Option: DBTLSKeyFile +# Full pathname of file containing the private key for authenticating to database. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# Default: +# DBTLSKeyFile= + +### Option: DBTLSCipher +# The list of encryption ciphers that Zabbix proxy permits for TLS protocols up through TLSv1.2 +# Supported only for MySQL +# +# Mandatory no +# Default: +# DBTLSCipher= + +### Option: DBTLSCipher13 +# The list of encryption ciphersuites that Zabbix proxy permits for TLSv1.3 protocol +# Supported only for MySQL, starting from version 8.0.16 +# +# Mandatory no +# Default: +# DBTLSCipher13= + +### Option: VaultToken +# Vault authentication token that should have been generated exclusively for Zabbix proxy with read only permission to path +# specified in optional VaultDBPath configuration parameter. +# It is an error if VaultToken and VAULT_TOKEN environment variable are defined at the same time. +# +# Mandatory: no +# Default: +# VaultToken= + +### Option: VaultURL +# Vault server HTTP[S] URL. System-wide CA certificates directory will be used if SSLCALocation is not specified. +# +# Mandatory: no +# Default: +# VaultURL=https://127.0.0.1:8200 + +### Option: VaultDBPath +# Vault path from where credentials for database will be retrieved by keys 'password' and 'username'. +# Example: secret/zabbix/database +# This option can only be used if DBUser and DBPassword are not specified. +# +# Mandatory: no +# Default: +# VaultDBPath= + +####### For advanced users - TCP-related fine-tuning parameters ####### + +## Option: ListenBacklog +# The maximum number of pending connections in the queue. This parameter is passed to +# listen() function as argument 'backlog' (see "man listen"). +# +# Mandatory: no +# Range: 0 - INT_MAX (depends on system, too large values may be silently truncated to implementation-specified maximum) +# Default: SOMAXCONN (hard-coded constant, depends on system) +# ListenBacklog= + +# +# Mandatory: no +# Default: +# PidFile=/tmp/zabbix_agentd.pid +PidFile=/tmp/zabbix_proxy.pid + +### Option: LogType +# Specifies where log messages are written to: +# system - syslog +# file - file specified with LogFile parameter +# console - standard output +# +# Mandatory: no +# Default: +# LogType=file + +### Option: LogFile +# Log file name for LogType 'file' parameter. +# +# Mandatory: yes, if LogType is set to file, otherwise no +# Default: +# LogFile= + +LogFile=/tmp/zabbix_proxy.log + +### Option: LogFileSize +# Maximum size of log file in MB. +# 0 - disable automatic log rotation. +# +# Mandatory: no +# Range: 0-1024 +# Default: +# LogFileSize=1 + +### Option: DebugLevel +# Specifies debug level: +# 0 - basic information about starting and stopping of Zabbix processes +# 1 - critical information +# 2 - error information +# 3 - warnings +# 4 - for debugging (produces lots of information) +# 5 - extended debugging (produces even more information) +# +# Mandatory: no +# Range: 0-5 +# Default: +# DebugLevel=3 + +### Option: SourceIP +# Source IP address for outgoing connections. +# +# Mandatory: no +# Default: +# SourceIP= + +### Option: AllowKey +# Allow execution of item keys matching pattern. +# Multiple keys matching rules may be defined in combination with DenyKey. +# Key pattern is wildcard expression, which support "*" character to match any +# number of any characters in certain position. It might be used in both key name and key arguments. +# Parameters are processed one by one according their appearance order. +# If no AllowKey or DenyKey rules defined, all keys are allowed. +# +# Mandatory: no + +### Option: DenyKey +# Deny execution of items keys matching pattern. +# Multiple keys matching rules may be defined in combination with AllowKey. +# Key pattern is wildcard expression, which support "*" character to match any +# number of any characters in certain position. It might be used in both key name and key arguments. +# Parameters are processed one by one according their appearance order. +# If no AllowKey or DenyKey rules defined, all keys are allowed. +# Unless another system.run[*] rule is specified DenyKey=system.run[*] is added by default. +# +# Mandatory: no +# Default: +# DenyKey=system.run[*] + +### Option: EnableRemoteCommands - Deprecated, use AllowKey=system.run[*] or DenyKey=system.run[*] instead +# Internal alias for AllowKey/DenyKey parameters depending on value: +# 0 - DenyKey=system.run[*] +# 1 - AllowKey=system.run[*] +# +# Mandatory: no + +### Option: LogRemoteCommands +# Enable logging of executed shell commands as warnings. +# 0 - disabled +# 1 - enabled +# +# Mandatory: no +# Default: +# LogRemoteCommands=0 + + +##### Passive checks related ##### Passive checks related ##### Passive checks related ##### Passive checks related ##### Passive checks related ##### Passive checks related ##### Passive checks related ##### Passive checks related ##### Passive checks related ##### Passive checks related ##### Passive checks related ##### Passive checks related ##### Passive checks related + +### Option: Server +# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies. +# Incoming connections will be accepted only from the hosts listed here. +# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally +# and '::/0' will allow any IPv4 or IPv6 address. +# '0.0.0.0/0' can be used to allow any IPv4 address. +# Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com +# +# Mandatory: yes, if StartAgents is not explicitly set to 0 +# Default: +# Server= + +Server=%ZABBIX_SERVER_IPS% + +### Option: ListenPort +# Agent will listen on this port for connections from the server. +# +# Mandatory: no +# Range: 1024-32767 +# Default: +# ListenPort=10050 + +### Option: ListenIP +# List of comma delimited IP addresses that the agent should listen on. +# First IP address is sent to Zabbix server if connecting to it to retrieve list of active checks. +# +# Mandatory: no +# Default: +# ListenIP=0.0.0.0 + +### Option: StartAgents +# Number of pre-forked instances of zabbix_agentd that process passive checks. +# If set to 0, disables passive checks and the agent will not listen on any TCP port. +# +# Mandatory: no +# Range: 0-100 +# Default: +# StartAgents=3 + +##### Active checks related + +### Option: ServerActive +# Zabbix server/proxy address or cluster configuration to get active checks from. +# Server/proxy address is IP address or DNS name and optional port separated by colon. +# Cluster configuration is one or more server addresses separated by semicolon. +# Multiple Zabbix servers/clusters and Zabbix proxies can be specified, separated by comma. +# More than one Zabbix proxy should not be specified from each Zabbix server/cluster. +# If Zabbix proxy is specified then Zabbix server/cluster for that proxy should not be specified. +# Multiple comma-delimited addresses can be provided to use several independent Zabbix servers in parallel. Spaces are allowed. +# If port is not specified, default port is used. +# IPv6 addresses must be enclosed in square brackets if port for that host is specified. +# If port is not specified, square brackets for IPv6 addresses are optional. +# If this parameter is not specified, active checks are disabled. +# Example for Zabbix proxy: +# ServerActive=127.0.0.1:10051 +# Example for multiple servers: +# ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1] +# Example for high availability: +# ServerActive=zabbix.cluster.node1;zabbix.cluster.node2:20051;zabbix.cluster.node3 +# Example for high availability with two clusters and one server: +# ServerActive=zabbix.cluster.node1;zabbix.cluster.node2:20051,zabbix.cluster2.node1;zabbix.cluster2.node2,zabbix.domain +# +# Mandatory: no +# Default: +# ServerActive= +# ServerActive=127.0.0.1 + +### Option: Hostname +# List of comma delimited unique, case sensitive hostnames. +# Required for active checks and must match hostnames as configured on the server. +# Value is acquired from HostnameItem if undefined. +# +# Mandatory: no +# Default: +# Hostname= + +# Hostname=localhost + +### Option: HostnameItem +# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined. +# Does not support UserParameters or aliases. +# +# Mandatory: no +# Default: +# HostnameItem=system.hostname + +### Option: HostMetadata +# Optional parameter that defines host metadata. +# Host metadata is used at host auto-registration process. +# An agent will issue an error and not start if the value is over limit of 255 characters. +# If not defined, value will be acquired from HostMetadataItem. +# +# Mandatory: no +# Range: 0-255 characters +# Default: +# HostMetadata= + +### Option: HostMetadataItem +# Optional parameter that defines an item used for getting host metadata. +# Host metadata is used at host auto-registration process. +# During an auto-registration request an agent will log a warning message if +# the value returned by specified item is over limit of 255 characters. +# This option is only used when HostMetadata is not defined. +# +# Mandatory: no +# Default: +# HostMetadataItem= + +### Option: HostInterface +# Optional parameter that defines host interface. +# Host interface is used at host auto-registration process. +# An agent will issue an error and not start if the value is over limit of 255 characters. +# If not defined, value will be acquired from HostInterfaceItem. +# +# Mandatory: no +# Range: 0-255 characters +# Default: +# HostInterface= + +### Option: HostInterfaceItem +# Optional parameter that defines an item used for getting host interface. +# Host interface is used at host auto-registration process. +# During an auto-registration request an agent will log a warning message if +# the value returned by specified item is over limit of 255 characters. +# This option is only used when HostInterface is not defined. +# +# Mandatory: no +# Default: +# HostInterfaceItem= + +### Option: RefreshActiveChecks +# How often list of active checks is refreshed, in seconds. +# +# Mandatory: no +# Range: 60-3600 +# Default: +# RefreshActiveChecks=120 + +### Option: BufferSend +# Do not keep data longer than N seconds in buffer. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# BufferSend=5 + +### Option: BufferSize +# Maximum number of values in a memory buffer. The agent will send +# all collected data to Zabbix Server or Proxy if the buffer is full. +# +# Mandatory: no +# Range: 2-65535 +# Default: +# BufferSize=100 + +### Option: MaxLinesPerSecond +# Maximum number of new lines the agent will send per second to Zabbix Server +# or Proxy processing 'log' and 'logrt' active checks. +# The provided value will be overridden by the parameter 'maxlines', +# provided in 'log' or 'logrt' item keys. +# +# Mandatory: no +# Range: 1-1000 +# Default: +# MaxLinesPerSecond=20 + +############ ADVANCED PARAMETERS ################# + +### Option: Alias +# Sets an alias for an item key. It can be used to substitute long and complex item key with a smaller and simpler one. +# Multiple Alias parameters may be present. Multiple parameters with the same Alias key are not allowed. +# Different Alias keys may reference the same item key. +# For example, to retrieve the ID of user 'zabbix': +# Alias=zabbix.userid:vfs.file.regexp[/etc/passwd,^zabbix:.:([0-9]+),,,,\1] +# Now shorthand key zabbix.userid may be used to retrieve data. +# Aliases can be used in HostMetadataItem but not in HostnameItem parameters. +# +# Mandatory: no +# Range: +# Default: + +### Option: Timeout +# Spend no more than Timeout seconds on processing +# +# Mandatory: no +# Range: 1-30 +# Default: +# Timeout=3 + +### Option: AllowRoot +# Allow the agent to run as 'root'. If disabled and the agent is started by 'root', the agent +# will try to switch to the user specified by the User configuration option instead. +# Has no effect if started under a regular user. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Default: +# AllowRoot=0 + +### Option: User +# Drop privileges to a specific, existing user on the system. +# Only has effect if run as 'root' and AllowRoot is disabled. +# +# Mandatory: no +# Default: +User=%ZABBIX_USER_NAME% + +### Option: Include +# You may include individual files or all files in a directory in the configuration file. +# Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time. +# +# Mandatory: no +# Default: +# Include= + +# Include=/usr/local/etc/zabbix_agentd.userparams.conf +# Include=/usr/local/etc/zabbix_agentd.conf.d/ +# Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf + +####### USER-DEFINED MONITORED PARAMETERS ####### + +### Option: UnsafeUserParameters +# Allow all characters to be passed in arguments to user-defined parameters. +# The following characters are not allowed: +# \ ' " ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @ +# Additionally, newline characters are not allowed. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Range: 0-1 +# Default: +# UnsafeUserParameters=0 + +### Option: UserParameter +# User-defined parameter to monitor. There can be several user-defined parameters. +# Format: UserParameter=<key>,<shell command> +# See 'zabbix_agentd' directory for examples. +# +# Mandatory: no +# Default: +# UserParameter= + +### Option: UserParameterDir +# Directory to execute UserParameter commands from. Only one entry is allowed. +# When executing UserParameter commands the agent will change the working directory to the one +# specified in the UserParameterDir option. +# This way UserParameter commands can be specified using the relative ./ prefix. +# +# Mandatory: no +# Default: +# UserParameterDir= + +####### LOADABLE MODULES ####### + +### Option: LoadModulePath +# Full path to location of agent modules. +# Default depends on compilation options. +# To see the default path run command "zabbix_agentd --help". +# +# Mandatory: no +# Default: +# LoadModulePath=${libdir}/modules + +### Option: LoadModule +# Module to load at agent startup. Modules are used to extend functionality of the agent. +# Formats: +# LoadModule=<module.so> +# LoadModule=<path/module.so> +# LoadModule=</abs_path/module.so> +# Either the module must be located in directory specified by LoadModulePath or the path must precede the module name. +# If the preceding path is absolute (starts with '/') then LoadModulePath is ignored. +# It is allowed to include multiple LoadModule parameters. +# +# Mandatory: no +# Default: +# LoadModule= + +####### TLS-RELATED PARAMETERS ####### + +### Option: TLSConnect +# How the agent should connect to server or proxy. Used for active checks. +# Only one value can be specified: +# unencrypted - connect without encryption +# psk - connect using TLS and a pre-shared key +# cert - connect using TLS and a certificate +# +# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection) +# Default: +# TLSConnect=unencrypted + +### Option: TLSAccept +# What incoming connections to accept. +# Multiple values can be specified, separated by comma: +# unencrypted - accept connections without encryption +# psk - accept connections secured with TLS and a pre-shared key +# cert - accept connections secured with TLS and a certificate +# +# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection) +# Default: +# TLSAccept=unencrypted + +### Option: TLSCAFile +# Full pathname of a file containing the top-level CA(s) certificates for +# peer certificate verification. +# +# Mandatory: no +# Default: +# TLSCAFile= + +### Option: TLSCRLFile +# Full pathname of a file containing revoked certificates. +# +# Mandatory: no +# Default: +# TLSCRLFile= + +### Option: TLSServerCertIssuer +# Allowed server certificate issuer. +# +# Mandatory: no +# Default: +# TLSServerCertIssuer= + +### Option: TLSServerCertSubject +# Allowed server certificate subject. +# +# Mandatory: no +# Default: +# TLSServerCertSubject= + +### Option: TLSCertFile +# Full pathname of a file containing the agent certificate or certificate chain. +# +# Mandatory: no +# Default: +# TLSCertFile= + +### Option: TLSKeyFile +# Full pathname of a file containing the agent private key. +# +# Mandatory: no +# Default: +# TLSKeyFile= + +### Option: TLSPSKIdentity +# Unique, case sensitive string used to identify the pre-shared key. +# +# Mandatory: no +# Default: +# TLSPSKIdentity= + +### Option: TLSPSKFile +# Full pathname of a file containing the pre-shared key. +# +# Mandatory: no +# Default: +# TLSPSKFile= + +####### For advanced users - TLS ciphersuite selection criteria ####### + +### Option: TLSCipherCert13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# +# Mandatory: no +# Default: +# TLSCipherCert13= + +### Option: TLSCipherCert +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128 +# +# Mandatory: no +# Default: +# TLSCipherCert= + +### Option: TLSCipherPSK13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example: +# TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherPSK13= + +### Option: TLSCipherPSK +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL +# Example for OpenSSL: +# kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherPSK= + +### Option: TLSCipherAll13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example: +# TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherAll13= + +### Option: TLSCipherAll +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128:kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherAll= + +####### For advanced users - TCP-related fine-tuning parameters ####### + +## Option: ListenBacklog +# The maximum number of pending connections in the queue. This parameter is passed to +# listen() function as argument 'backlog' (see "man listen"). +# +# Mandatory: no +# Range: 0 - INT_MAX (depends on system, too large values may be silently truncated to implementation-specified maximum) +# Default: SOMAXCONN (hard-coded constant, depends on system) +# ListenBacklog= diff --git a/recipes-connectivity/zabbix/files/zabbix-proxy.service b/recipes-connectivity/zabbix/files/zabbix-proxy.service new file mode 100644 index 0000000..7dd77b6 --- /dev/null +++ b/recipes-connectivity/zabbix/files/zabbix-proxy.service @@ -0,0 +1,15 @@ +[Unit] +Description=Zabbix Proxy + +[Service] +Environment="CONFFILE=%ZABBIX_PROXY_CONF%" +EnvironmentFile=-%SYSCONFDIR%/default/zabbix-proxy +Type=forking +Restart=on-failure +KillMode=control-group +ExecStart=%SBINDIR%/zabbix_proxy -c $CONFFILE +ExecStop=/bin/sh -c '[ -n "$1" ] && kill -s TERM "$1"' -- "$MAINPID" +RestartSec=10s + +[Install] +WantedBy=multi-user.target diff --git a/recipes-connectivity/zabbix/files/zabbix-server-morello.service b/recipes-connectivity/zabbix/files/zabbix-server-morello.service new file mode 100644 index 0000000..3327b4b --- /dev/null +++ b/recipes-connectivity/zabbix/files/zabbix-server-morello.service @@ -0,0 +1,20 @@ +[Unit] +Description=Zabbix Server +Wants=postgresql.service +After=postgresql.service +After=postgresql-init.service +After=php-fpm.service + +[Service] +Environment="CONFFILE=%SYSCONFDIR%/zabbix/zabbix-server.conf" +Environment="DB_ZABBIX_USER_SERVER=%DB_ZABBIX_USER_SERVER%" +Environment="DB_ZABBIX_PASSWORD=%DB_ZABBIX_PASSWORD%" +EnvironmentFile=-%SYSCONFDIR%/default/zabbix-server +Type=forking +KillMode=control-group +ExecStart=/bin/bash -c '%SBINDIR%/zabbix_server -c ${CONFFILE}' +ExecStop=/bin/sh -c '[ -n "$1" ] && kill -s TERM "$1"' -- "$MAINPID" +RestartSec=10s + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/recipes-connectivity/zabbix/files/zabbix-server.conf b/recipes-connectivity/zabbix/files/zabbix-server.conf new file mode 100644 index 0000000..390fe6f --- /dev/null +++ b/recipes-connectivity/zabbix/files/zabbix-server.conf @@ -0,0 +1,990 @@ +# This is a configuration file for Zabbix server daemon +# To get more information about Zabbix, visit http://www.zabbix.com + +############ GENERAL PARAMETERS ################# + +### Option: ListenPort +# Listen port for trapper. +# +# Mandatory: no +# Range: 1024-32767 +# Default: +# ListenPort=10051 + +### Option: SourceIP +# Source IP address for outgoing connections. +# +# Mandatory: no +# Default: +# SourceIP= + +### Option: LogType +# Specifies where log messages are written to: +# system - syslog +# file - file specified with LogFile parameter +# console - standard output +# +# Mandatory: no +# Default: +# LogType=file + +### Option: LogFile +# Log file name for LogType 'file' parameter. +# +# Mandatory: yes, if LogType is set to file, otherwise no +# Default: +# LogFile= + +LogFile=/tmp/zabbix_server.log + +### Option: LogFileSize +# Maximum size of log file in MB. +# 0 - disable automatic log rotation. +# +# Mandatory: no +# Range: 0-1024 +# Default: +# LogFileSize=1 + +### Option: DebugLevel +# Specifies debug level: +# 0 - basic information about starting and stopping of Zabbix processes +# 1 - critical information +# 2 - error information +# 3 - warnings +# 4 - for debugging (produces lots of information) +# 5 - extended debugging (produces even more information) +# +# Mandatory: no +# Range: 0-5 +# Default: +DebugLevel=5 + +### Option: PidFile +# Name of PID file. +# +# Mandatory: no +# Default: +# PidFile=/tmp/zabbix_server.pid + +### Option: SocketDir +# IPC socket directory. +# Directory to store IPC sockets used by internal Zabbix services. +# +# Mandatory: no +# Default: +# SocketDir=/tmp +SocketDir=%ZABBIX_SOCKET_DIR% + +### Option: DBHost +# Database host name. +# If set to localhost, socket is used for MySQL. +# If set to empty string, socket is used for PostgreSQL. +# If set to empty string, the Net Service Name connection method is used to connect to Oracle database; also see +# the TNS_ADMIN environment variable to specify the directory where the tnsnames.ora file is located. +# +# Mandatory: no +# Default: +# DBHost=localhost + +### Option: DBName +# Database name. +# If the Net Service Name connection method is used to connect to Oracle database, specify the service name from +# the tnsnames.ora file or set to empty string; also see the TWO_TASK environment variable if DBName is set to +# empty string. +# +# Mandatory: yes +# Default: +# DBName= + +DBName=%DB_ZABBIX_NAME% + +### Option: DBSchema +# Schema name. Used for PostgreSQL. +# +# Mandatory: no +# Default: +# DBSchema= + +### Option: DBUser +# Database user. +# +# Mandatory: no +# Default: +# DBUser= + +DBUser=%DB_ZABBIX_USER_SERVER% + +### Option: DBPassword +# Database password. +# Comment this line if no password is used. +# +# Mandatory: no +# Default: +# DBPassword= + +DBPassword=%DB_ZABBIX_PASSWORD% + +### Option: DBSocket +# Path to MySQL socket. +# +# Mandatory: no +# Default: +# DBSocket= + +### Option: DBPort +# Database port when not using local socket. +# If the Net Service Name connection method is used to connect to Oracle database, the port number from the +# tnsnames.ora file will be used. The port number set here will be ignored. +# +# Mandatory: no +# Range: 1024-65535 +# Default: +# DBPort= + +### Option: AllowUnsupportedDBVersions +# Allow server to work with unsupported database versions. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Default: +# AllowUnsupportedDBVersions=0 + +### Option: HistoryStorageURL +# History storage HTTP[S] URL. +# +# Mandatory: no +# Default: +# HistoryStorageURL= + +### Option: HistoryStorageTypes +# Comma separated list of value types to be sent to the history storage. +# +# Mandatory: no +# Default: +# HistoryStorageTypes=uint,dbl,str,log,text + +### Option: HistoryStorageDateIndex +# Enable preprocessing of history values in history storage to store values in different indices based on date. +# 0 - disable +# 1 - enable +# +# Mandatory: no +# Default: +# HistoryStorageDateIndex=0 + +### Option: ExportDir +# Directory for real time export of events, history and trends in newline delimited JSON format. +# If set, enables real time export. +# +# Mandatory: no +# Default: +# ExportDir= + +### Option: ExportFileSize +# Maximum size per export file in bytes. +# Only used for rotation if ExportDir is set. +# +# Mandatory: no +# Range: 1M-1G +# Default: +# ExportFileSize=1G + +### Option: ExportType +# List of comma delimited types of real time export - allows to control export entities by their +# type (events, history, trends) individually. +# Valid only if ExportDir is set. +# +# Mandatory: no +# Default: +# ExportType=events,history,trends + +############ ADVANCED PARAMETERS ################ + +### Option: StartPollers +# Number of pre-forked instances of pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPollers=5 + +### Option: StartIPMIPollers +# Number of pre-forked instances of IPMI pollers. +# The IPMI manager process is automatically started when at least one IPMI poller is started. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartIPMIPollers=0 + +### Option: StartPreprocessors +# Number of pre-forked instances of preprocessing workers. +# The preprocessing manager process is automatically started when preprocessor worker is started. +# +# Mandatory: no +# Range: 1-1000 +# Default: +# StartPreprocessors=3 + +### Option: StartPollersUnreachable +# Number of pre-forked instances of pollers for unreachable hosts (including IPMI and Java). +# At least one poller for unreachable hosts must be running if regular, IPMI or Java pollers +# are started. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPollersUnreachable=1 + +### Option: StartHistoryPollers +# Number of pre-forked instances of history pollers. +# Only required for calculated and internal checks. +# A database connection is required for each history poller instance. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartHistoryPollers=5 + +### Option: StartTrappers +# Number of pre-forked instances of trappers. +# Trappers accept incoming connections from Zabbix sender, active agents and active proxies. +# At least one trapper process must be running to display server availability and view queue +# in the frontend. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartTrappers=5 + +### Option: StartPingers +# Number of pre-forked instances of ICMP pingers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPingers=1 + +### Option: StartDiscoverers +# Number of pre-forked instances of discoverers. +# +# Mandatory: no +# Range: 0-250 +# Default: +# StartDiscoverers=1 + +### Option: StartHTTPPollers +# Number of pre-forked instances of HTTP pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartHTTPPollers=1 + +### Option: StartTimers +# Number of pre-forked instances of timers. +# Timers process maintenance periods. +# Only the first timer process handles host maintenance updates. Problem suppression updates are shared +# between all timers. +# +# Mandatory: no +# Range: 1-1000 +# Default: +# StartTimers=1 + +### Option: StartEscalators +# Number of pre-forked instances of escalators. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartEscalators=1 + +### Option: StartAlerters +# Number of pre-forked instances of alerters. +# Alerters send the notifications created by action operations. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartAlerters=3 + +### Option: JavaGateway +# IP address (or hostname) of Zabbix Java gateway. +# Only required if Java pollers are started. +# +# Mandatory: no +# Default: +# JavaGateway= + +### Option: JavaGatewayPort +# Port that Zabbix Java gateway listens on. +# +# Mandatory: no +# Range: 1024-32767 +# Default: +# JavaGatewayPort=10052 + +### Option: StartJavaPollers +# Number of pre-forked instances of Java pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartJavaPollers=0 + +### Option: StartVMwareCollectors +# Number of pre-forked vmware collector instances. +# +# Mandatory: no +# Range: 0-250 +# Default: +# StartVMwareCollectors=0 + +### Option: VMwareFrequency +# How often Zabbix will connect to VMware service to obtain a new data. +# +# Mandatory: no +# Range: 10-86400 +# Default: +# VMwareFrequency=60 + +### Option: VMwarePerfFrequency +# How often Zabbix will connect to VMware service to obtain performance data. +# +# Mandatory: no +# Range: 10-86400 +# Default: +# VMwarePerfFrequency=60 + +### Option: VMwareCacheSize +# Size of VMware cache, in bytes. +# Shared memory size for storing VMware data. +# Only used if VMware collectors are started. +# +# Mandatory: no +# Range: 256K-2G +# Default: +# VMwareCacheSize=8M + +### Option: VMwareTimeout +# Specifies how many seconds vmware collector waits for response from VMware service. +# +# Mandatory: no +# Range: 1-300 +# Default: +# VMwareTimeout=10 + +### Option: SNMPTrapperFile +# Temporary file used for passing data from SNMP trap daemon to the server. +# Must be the same as in zabbix_trap_receiver.pl or SNMPTT configuration file. +# +# Mandatory: no +# Default: +# SNMPTrapperFile=/tmp/zabbix_traps.tmp +SNMPTrapperFile=/tmp/zabbix_traps.tmp + +### Option: StartSNMPTrapper +# If 1, SNMP trapper process is started. +# +# Mandatory: no +# Range: 0-1 +# Default: +StartSNMPTrapper=0 + +### Option: ListenIP +# List of comma delimited IP addresses that the trapper should listen on. +# Trapper will listen on all network interfaces if this parameter is missing. +# +# Mandatory: no +# Default: +# ListenIP=0.0.0.0 + +### Option: HousekeepingFrequency +# How often Zabbix will perform housekeeping procedure (in hours). +# Housekeeping is removing outdated information from the database. +# To prevent Housekeeper from being overloaded, no more than 4 times HousekeepingFrequency +# hours of outdated information are deleted in one housekeeping cycle, for each item. +# To lower load on server startup housekeeping is postponed for 30 minutes after server start. +# With HousekeepingFrequency=0 the housekeeper can be only executed using the runtime control option. +# In this case the period of outdated information deleted in one housekeeping cycle is 4 times the +# period since the last housekeeping cycle, but not less than 4 hours and not greater than 4 days. +# +# Mandatory: no +# Range: 0-24 +# Default: +# HousekeepingFrequency=1 + +### Option: MaxHousekeeperDelete +# The table "housekeeper" contains "tasks" for housekeeping procedure in the format: +# [housekeeperid], [tablename], [field], [value]. +# No more than 'MaxHousekeeperDelete' rows (corresponding to [tablename], [field], [value]) +# will be deleted per one task in one housekeeping cycle. +# If set to 0 then no limit is used at all. In this case you must know what you are doing! +# +# Mandatory: no +# Range: 0-1000000 +# Default: +# MaxHousekeeperDelete=5000 + +### Option: CacheSize +# Size of configuration cache, in bytes. +# Shared memory size for storing host, item and trigger data. +# +# Mandatory: no +# Range: 128K-64G +# Default: +# CacheSize=32M + +### Option: CacheUpdateFrequency +# How often Zabbix will perform update of configuration cache, in seconds. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# CacheUpdateFrequency=60 + +### Option: StartDBSyncers +# Number of pre-forked instances of DB Syncers. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartDBSyncers=4 + +### Option: HistoryCacheSize +# Size of history cache, in bytes. +# Shared memory size for storing history data. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# HistoryCacheSize=16M + +### Option: HistoryIndexCacheSize +# Size of history index cache, in bytes. +# Shared memory size for indexing history cache. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# HistoryIndexCacheSize=4M + +### Option: TrendCacheSize +# Size of trend write cache, in bytes. +# Shared memory size for storing trends data. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# TrendCacheSize=4M + +### Option: TrendFunctionCacheSize +# Size of trend function cache, in bytes. +# Shared memory size for caching calculated trend function data. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# TrendFunctionCacheSize=4M + +### Option: ValueCacheSize +# Size of history value cache, in bytes. +# Shared memory size for caching item history data requests. +# Setting to 0 disables value cache. +# +# Mandatory: no +# Range: 0,128K-64G +# Default: +# ValueCacheSize=8M + +### Option: Timeout +# Specifies how long we wait for agent, SNMP device or external check (in seconds). +# +# Mandatory: no +# Range: 1-30 +# Default: +# Timeout=3 + +Timeout=4 + +### Option: TrapperTimeout +# Specifies how many seconds trapper may spend processing new data. +# +# Mandatory: no +# Range: 1-300 +# Default: +# TrapperTimeout=300 + +### Option: UnreachablePeriod +# After how many seconds of unreachability treat a host as unavailable. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnreachablePeriod=45 + +### Option: UnavailableDelay +# How often host is checked for availability during the unavailability period, in seconds. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnavailableDelay=60 + +### Option: UnreachableDelay +# How often host is checked for availability during the unreachability period, in seconds. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnreachableDelay=15 + +### Option: AlertScriptsPath +# Full path to location of custom alert scripts. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# AlertScriptsPath=${datadir}/zabbix/alertscripts + +### Option: ExternalScripts +# Full path to location of external scripts. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# ExternalScripts=${datadir}/zabbix/externalscripts + +### Option: FpingLocation +# Location of fping. +# Make sure that fping binary has root ownership and SUID flag set. +# +# Mandatory: no +# Default: +# FpingLocation=/usr/sbin/fping + +### Option: Fping6Location +# Location of fping6. +# Make sure that fping6 binary has root ownership and SUID flag set. +# Make empty if your fping utility is capable to process IPv6 addresses. +# +# Mandatory: no +# Default: +# Fping6Location=/usr/sbin/fping6 + +### Option: SSHKeyLocation +# Location of public and private keys for SSH checks and actions. +# +# Mandatory: no +# Default: +# SSHKeyLocation= + +### Option: LogSlowQueries +# How long a database query may take before being logged (in milliseconds). +# Only works if DebugLevel set to 3, 4 or 5. +# 0 - don't log slow queries. +# +# Mandatory: no +# Range: 1-3600000 +# Default: +# LogSlowQueries=0 + +LogSlowQueries=3000 + +### Option: TmpDir +# Temporary directory. +# +# Mandatory: no +# Default: +# TmpDir=/tmp + +### Option: StartProxyPollers +# Number of pre-forked instances of pollers for passive proxies. +# +# Mandatory: no +# Range: 0-250 +# Default: +# StartProxyPollers=1 + +### Option: ProxyConfigFrequency +# How often Zabbix Server sends configuration data to a Zabbix Proxy in seconds. +# This parameter is used only for proxies in the passive mode. +# +# Mandatory: no +# Range: 1-3600*24*7 +# Default: +# ProxyConfigFrequency=3600 + +### Option: ProxyDataFrequency +# How often Zabbix Server requests history data from a Zabbix Proxy in seconds. +# This parameter is used only for proxies in the passive mode. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# ProxyDataFrequency=1 + +### Option: StartLLDProcessors +# Number of pre-forked instances of low level discovery processors. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartLLDProcessors=2 + +### Option: AllowRoot +# Allow the server to run as 'root'. If disabled and the server is started by 'root', the server +# will try to switch to the user specified by the User configuration option instead. +# Has no effect if started under a regular user. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Default: +# AllowRoot=0 + +### Option: User +# Drop privileges to a specific, existing user on the system. +# Only has effect if run as 'root' and AllowRoot is disabled. +# +# Mandatory: no +# Default: +# User=zabbix + +### Option: Include +# You may include individual files or all files in a directory in the configuration file. +# Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time. +# +# Mandatory: no +# Default: +# Include= + +# Include=/usr/local/etc/zabbix_server.general.conf +# Include=/usr/local/etc/zabbix_server.conf.d/ +# Include=/usr/local/etc/zabbix_server.conf.d/*.conf + +### Option: SSLCertLocation +# Location of SSL client certificates. +# This parameter is used only in web monitoring. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# SSLCertLocation=${datadir}/zabbix/ssl/certs + +### Option: SSLKeyLocation +# Location of private keys for SSL client certificates. +# This parameter is used only in web monitoring. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# SSLKeyLocation=${datadir}/zabbix/ssl/keys + +### Option: SSLCALocation +# Override the location of certificate authority (CA) files for SSL server certificate verification. +# If not set, system-wide directory will be used. +# This parameter is used in web monitoring, SMTP authentication, HTTP agent items and for communication with Vault. +# +# Mandatory: no +# Default: +# SSLCALocation= + +### Option: StatsAllowedIP +# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of external Zabbix instances. +# Stats request will be accepted only from the addresses listed here. If this parameter is not set no stats requests +# will be accepted. +# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally +# and '::/0' will allow any IPv4 or IPv6 address. +# '0.0.0.0/0' can be used to allow any IPv4 address. +# Example: StatsAllowedIP=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com +# +# Mandatory: no +# Default: +# StatsAllowedIP= +StatsAllowedIP=127.0.0.1 + +####### LOADABLE MODULES ####### + +### Option: LoadModulePath +# Full path to location of server modules. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# LoadModulePath=${libdir}/modules + +### Option: LoadModule +# Module to load at server startup. Modules are used to extend functionality of the server. +# Formats: +# LoadModule=<module.so> +# LoadModule=<path/module.so> +# LoadModule=</abs_path/module.so> +# Either the module must be located in directory specified by LoadModulePath or the path must precede the module name. +# If the preceding path is absolute (starts with '/') then LoadModulePath is ignored. +# It is allowed to include multiple LoadModule parameters. +# +# Mandatory: no +# Default: +# LoadModule= + +####### TLS-RELATED PARAMETERS ####### + +### Option: TLSCAFile +# Full pathname of a file containing the top-level CA(s) certificates for +# peer certificate verification. +# +# Mandatory: no +# Default: +# TLSCAFile= + +### Option: TLSCRLFile +# Full pathname of a file containing revoked certificates. +# +# Mandatory: no +# Default: +# TLSCRLFile= + +### Option: TLSCertFile +# Full pathname of a file containing the server certificate or certificate chain. +# +# Mandatory: no +# Default: +# TLSCertFile= + +### Option: TLSKeyFile +# Full pathname of a file containing the server private key. +# +# Mandatory: no +# Default: +# TLSKeyFile= + +####### For advanced users - TLS ciphersuite selection criteria ####### + +### Option: TLSCipherCert13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# +# Mandatory: no +# Default: +# TLSCipherCert13= + +### Option: TLSCipherCert +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128 +# +# Mandatory: no +# Default: +# TLSCipherCert= + +### Option: TLSCipherPSK13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example: +# TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherPSK13= + +### Option: TLSCipherPSK +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL +# Example for OpenSSL: +# kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherPSK= + +### Option: TLSCipherAll13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example: +# TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherAll13= + +### Option: TLSCipherAll +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128:kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherAll= + +### Option: DBTLSConnect +# Setting this option enforces to use TLS connection to database. +# required - connect using TLS +# verify_ca - connect using TLS and verify certificate +# verify_full - connect using TLS, verify certificate and verify that database identity specified by DBHost +# matches its certificate +# On MySQL starting from 5.7.11 and PostgreSQL following values are supported: "required", "verify_ca" and +# "verify_full". +# On MariaDB starting from version 10.2.6 "required" and "verify_full" values are supported. +# Default is not to set any option and behavior depends on database configuration +# +# Mandatory: no +# Default: +# DBTLSConnect= + +### Option: DBTLSCAFile +# Full pathname of a file containing the top-level CA(s) certificates for database certificate verification. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# (yes, if DBTLSConnect set to one of: verify_ca, verify_full) +# Default: +# DBTLSCAFile= + +### Option: DBTLSCertFile +# Full pathname of file containing Zabbix server certificate for authenticating to database. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# Default: +# DBTLSCertFile= + +### Option: DBTLSKeyFile +# Full pathname of file containing the private key for authenticating to database. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# Default: +# DBTLSKeyFile= + +### Option: DBTLSCipher +# The list of encryption ciphers that Zabbix server permits for TLS protocols up through TLSv1.2 +# Supported only for MySQL +# +# Mandatory no +# Default: +# DBTLSCipher= + +### Option: DBTLSCipher13 +# The list of encryption ciphersuites that Zabbix server permits for TLSv1.3 protocol +# Supported only for MySQL, starting from version 8.0.16 +# +# Mandatory no +# Default: +# DBTLSCipher13= + +### Option: VaultToken +# Vault authentication token that should have been generated exclusively for Zabbix server with read only permission +# to paths specified in Vault macros and read only permission to path specified in optional VaultDBPath +# configuration parameter. +# It is an error if VaultToken and VAULT_TOKEN environment variable are defined at the same time. +# +# Mandatory: no +# Default: +# VaultToken= + +### Option: VaultURL +# Vault server HTTP[S] URL. System-wide CA certificates directory will be used if SSLCALocation is not specified. +# +# Mandatory: no +# Default: +# VaultURL=https://127.0.0.1:8200 + +### Option: VaultDBPath +# Vault path from where credentials for database will be retrieved by keys 'password' and 'username'. +# Example: secret/zabbix/database +# This option can only be used if DBUser and DBPassword are not specified. +# +# Mandatory: no +# Default: +# VaultDBPath= + +### Option: StartReportWriters +# Number of pre-forked report writer instances. +# +# Mandatory: no +# Range: 0-100 +# Default: +# StartReportWriters=0 + +### Option: WebServiceURL +# URL to Zabbix web service, used to perform web related tasks. +# Example: http://localhost:10053/report +# +# Mandatory: no +# Default: +# WebServiceURL= + +### Option: ServiceManagerSyncFrequency +# How often Zabbix will synchronize configuration of a service manager (in seconds). +# +# Mandatory: no +# Range: 1-3600 +# Default: +# ServiceManagerSyncFrequency=60 + +### Option: ProblemHousekeepingFrequency +# How often Zabbix will delete problems for deleted triggers (in seconds). +# +# Mandatory: no +# Range: 1-3600 +# Default: +# ProblemHousekeepingFrequency=60 + +## Option: StartODBCPollers +# Number of pre-forked ODBC poller instances. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartODBCPollers=1 + +####### For advanced users - TCP-related fine-tuning parameters ####### + +## Option: ListenBacklog +# The maximum number of pending connections in the queue. This parameter is passed to +# listen() function as argument 'backlog' (see "man listen"). +# +# Mandatory: no +# Range: 0 - INT_MAX (depends on system, too large values may be silently truncated to implementation-specified maximum) +# Default: SOMAXCONN (hard-coded constant, depends on system) +# ListenBacklog= + + +####### High availability cluster parameters ####### + +## Option: HANodeName +# The high availability cluster node name. +# When empty, server is working in standalone mode; a node with empty name is registered with address for the frontend to connect to. +# +# Mandatory: no +# Default: +# HANodeName= + +## Option: NodeAddress +# IP or hostname with optional port to specify how frontend should connect to the server. +# Format: <address>[:<port>] +# +# If IP or hostname is not set, then ListenIP value will be used. In case ListenIP is not set, localhost will be used. +# If port is not set, then ListenPort value will be used. In case ListenPort is not set, 10051 will be used. +# This option can be overridden by address specified in frontend configuration. +# +# Mandatory: no +# Default: +# NodeAddress=localhost:10051 diff --git a/recipes-connectivity/zabbix/files/zabbix.conf.php b/recipes-connectivity/zabbix/files/zabbix.conf.php new file mode 100644 index 0000000..4442d3f --- /dev/null +++ b/recipes-connectivity/zabbix/files/zabbix.conf.php @@ -0,0 +1,59 @@ +<?php +// Zabbix GUI configuration file. + +$DB['TYPE'] = 'POSTGRESQL'; +$DB['SERVER'] = 'localhost'; +$DB['PORT'] = '0'; +$DB['DATABASE'] = 'zabbix'; +$DB['USER'] = 'zabbix'; +$DB['PASSWORD'] = 'zabbix'; + +// Schema name. Used for PostgreSQL. +$DB['SCHEMA'] = ''; + +// Used for TLS connection. +$DB['ENCRYPTION'] = true; +$DB['KEY_FILE'] = ''; +$DB['CERT_FILE'] = ''; +$DB['CA_FILE'] = ''; +$DB['VERIFY_HOST'] = false; +$DB['CIPHER_LIST'] = ''; + +// Vault configuration. Used if database credentials are stored in Vault secrets manager. +$DB['VAULT'] = ''; +$DB['VAULT_URL'] = ''; +$DB['VAULT_DB_PATH'] = ''; +$DB['VAULT_TOKEN'] = ''; +$DB['VAULT_CERT_FILE'] = ''; +$DB['VAULT_KEY_FILE'] = ''; +// Uncomment to bypass local caching of credentials. +// $DB['VAULT_CACHE'] = true; + +// Use IEEE754 compatible value range for 64-bit Numeric (float) history values. +// This option is enabled by default for new Zabbix installations. +// For upgraded installations, please read database upgrade notes before enabling this option. +$DB['DOUBLE_IEEE754'] = true; + +// Uncomment and set to desired values to override Zabbix hostname/IP and port. +// $ZBX_SERVER = ''; +// $ZBX_SERVER_PORT = ''; + +$ZBX_SERVER_NAME = 'myzabbix'; + +$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; + +// Uncomment this block only if you are using Elasticsearch. +// Elasticsearch url (can be string if same url is used for all types). +//$HISTORY['url'] = [ +// 'uint' => 'http://localhost:9200', +// 'text' => 'http://localhost:9200' +//]; +// Value types stored in Elasticsearch. +//$HISTORY['types'] = ['uint', 'text']; + +// Used for SAML authentication. +// Uncomment to override the default paths to SP private key, SP and IdP X.509 certificates, and to set extra settings. +//$SSO['SP_KEY'] = 'conf/certs/sp.key'; +//$SSO['SP_CERT'] = 'conf/certs/sp.crt'; +//$SSO['IDP_CERT'] = 'conf/certs/idp.crt'; +//$SSO['SETTINGS'] = []; diff --git a/recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb b/recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb new file mode 100644 index 0000000..b7084e2 --- /dev/null +++ b/recipes-connectivity/zabbix/zabbix-agentd-morello_5.0.38.bb @@ -0,0 +1,52 @@ +inherit perlnative autotools-brokensep pure-cap-kheaders pkgconfig systemd useradd +inherit purecap-sysroot purecap-useradd + +require zabbix-morello.inc + +SRC_URI += " \ + file://zabbix-agentd-morello.service \ + file://zabbix-agentd.conf \ + " + +# Seperate user for agent for security reasons. If the user is shared the agent +# will have full access to the server's DB. +USERADD_PACKAGES += " \ + ${PN} \ +" + +EXTRA_OECONF += "--enable-agent" + +GROUPADD_PARAM:${PN} = "-r ${DB_ZABBIX_USER_AGENT} " +USERADD_PARAM:${PN} = "-r -g ${DB_ZABBIX_USER_AGENT} -d /var/lib/${DB_ZABBIX_USER_AGENT} \ + -s /sbin/nologin -c "Zabbix Monitoring System" ${DB_ZABBIX_USER_AGENT} \ +" +RPROVIDES:${PN} += "zabbix-agentd" + +BPN_ZABBIX = "zabbix-agentd" + +do_install:append() { + + install -d ${D}${systemd_system_unitdir} ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/${BPN}.service ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + + sed -i -e 's#%SBINDIR%#${sbindir}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + sed -i -e 's#%SYSCONFDIR%#${sysconfdir}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + + install -d ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf.d/ + install -m 0644 ${WORKDIR}/${BPN_ZABBIX}.conf ${D}${sysconfdir}/zabbix/ + + sed -i -e 's#%DB_ZABBIX_USER_AGENT%#${DB_ZABBIX_USER_AGENT}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + sed -i -e 's#%DB_ZABBIX_USER_AGENT%#${DB_ZABBIX_USER_AGENT}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf + sed -i -e 's#%ZABBIX_USER_NAME%#${DB_ZABBIX_USER_AGENT}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf + +} + +do_install:append() { + ${OBJDUMP} -D ${D}${sbindir}/zabbix_agentd > ${D}${PURECAP_DEBUGDIR}/zabbix_agentd.dump + ${READELF} -a ${D}${sbindir}/zabbix_agentd > ${D}${PURECAP_DEBUGDIR}/zabbix_agentd.readelf +} + +FILES:${PN} += " ${libdir} \ + ${systemd_system_unitdir}/${BPN_ZABBIX}.service \ + " +FILES:${PN}-dbg += "${datadir}" \ No newline at end of file diff --git a/recipes-connectivity/zabbix/zabbix-frontend_5.0.38.bb b/recipes-connectivity/zabbix/zabbix-frontend_5.0.38.bb new file mode 100644 index 0000000..7395799 --- /dev/null +++ b/recipes-connectivity/zabbix/zabbix-frontend_5.0.38.bb @@ -0,0 +1,24 @@ +require zabbix-morello.inc + +SRC_URI:append = " \ + file://zabbix.conf.php \ +" + +SYSTEMD_SERVICE:${PN} = "" + +DEPENDS = "" +RDEPENDS:${PN} += "bash" + +do_compile[noexec] = "1" +do_configure[noexec] = "1" + +do_install() { + + ZABBIX_WWW_LOC=${D}${datadir}/zabbix + install -d ${ZABBIX_WWW_LOC} + cp -r ${S}/ui/* ${ZABBIX_WWW_LOC}/ + + install -m 0644 ${WORKDIR}/zabbix.conf.php ${ZABBIX_WWW_LOC}/conf/ +} + +FILES:${PN} += "${datadir}/zabbix" \ No newline at end of file diff --git a/recipes-connectivity/zabbix/zabbix-morello.inc b/recipes-connectivity/zabbix/zabbix-morello.inc new file mode 100644 index 0000000..71fa5e3 --- /dev/null +++ b/recipes-connectivity/zabbix/zabbix-morello.inc @@ -0,0 +1,103 @@ +SUMMARY = "Open-source monitoring solution for your IT infrastructure" + +MORELLO_SRC = "meta-openembedded/meta-oe/recipes-connectivity/zabbix/zabbix_5.4.12.bb" + +DESCRIPTION = "\ +ZABBIX is software that monitors numerous parameters of a network and the \ +health and integrity of servers. ZABBIX uses a flexible notification \ +mechanism that allows users to configure e-mail based alerts for virtually \ +any event. This allows a fast reaction to server problems. ZABBIX offers \ +excellent reporting and data visualisation features based on the stored \ +data. This makes ZABBIX ideal for capacity planning. \ +\ +ZABBIX supports both polling and trapping. All ZABBIX reports and \ +statistics, as well as configuration parameters are accessed through a \ +web-based front end. A web-based front end ensures that the status of \ +your network and the health of your servers can be assessed from any \ +location. Properly configured, ZABBIX can play an important role in \ +monitoring IT infrastructure. This is equally true for small \ +organisations with a few servers and for large companies with a \ +multitude of servers." +HOMEPAGE = "http://www.zabbix.com/" +SECTION = "Applications/Internet" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=300e938ad303147fede2294ed78fe02e" + +FILESEXTRAPATHS:prepend := "${THISDIR}/cheri-patches:" +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +PV = "5.0.38" +PNPV = "zabbix-${PV}" +SRC_URI = " \ + https://cdn.zabbix.com/zabbix/sources/stable/5.0/%24%7BPNPV%7D.tar.gz \ + " + +SRC_URI += "file://0000-sysinfo-fix-build-with-musl-libc.patch \ + file://0000-net-fix-provenance-error.patch \ + file://0001-memalloc-align-and-work-with-16-not-8.patch \ + file://0002-duktape-set-shift-to-5-for-CHERI.patch \ + file://0003-duktape-add-aling-to-16.patch \ + file://0004-embed-use-padding-of-16-not-8-for-alloc.patch \ + file://0005-embed-fix-alignment-issues.patch \ + file://0006-duk_config-use-debug-and-self-test.patch \ + file://0007-duktape-fix-stack-reallocation.patch \ + " + +S = "${WORKDIR}/zabbix-${PV}" + +SRC_URI[md5sum] = "0d314f8626cf5e914204c7e0c4f9ca78" +SRC_URI[sha256sum] = "765c36aa0fc9dbf27f9eab06ccfe4e71023264d398d361b1dae0a3c1fe4c1a26" + +DEPENDS += "postgresql-morello zlib-morello net-snmp-morello openldap-morello libpcre-morello libevent-morello" +DEPENDS += "curl-morello" + +RDEPENDS:${PN} = " \ + logrotate \ + " + + +PACKAGECONFIG:append = " net-snmp libevent ldap zlib libpthread iconv curl libpcre openssl" + +PACKAGECONFIG[openssl] = "--with-openssl=${STAGING_EXECPREFIXDIR},--without-openssl,openssl-morello" +PACKAGECONFIG[net-snmp] = "--with-net-snmp=${STAGING_BINDIR}/net-snmp-config,--without-net-snmp,net-snmp-morello" +PACKAGECONFIG[libevent] = "--with-libevent=${STAGING_EXECPREFIXDIR},--without-libevent,libevent-morello" +PACKAGECONFIG[ldap] = "--with-ldap=${STAGING_EXECPREFIXDIR},--without-ldap,openldap-morello" +PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_EXECPREFIXDIR},--without-zlib,zlib-morello" +PACKAGECONFIG[libpthread] = "--with-libpthread=${STAGING_EXECPREFIXDIR},--without-libpthread," +PACKAGECONFIG[libpcre] = "--with-libpcre=${STAGING_EXECPREFIXDIR},--without-libpcre,libpcre-morello" +PACKAGECONFIG[curl] = "--with-libcurl=${STAGING_BINDIR}/curl-config, --without-libcurl, curl-morello" +PACKAGECONFIG[iconv] = "--with-iconv=${STAGING_EXECPREFIXDIR},--without-iconv,virtual/libiconv" + +EXTRA_OECONF = " \ + --disable-option-checking \ + --enable-dependency-tracking \ + --enable-ipv6 \ + --disable-static \ + --with-postgresql=${STAGING_BINDIR}/pgconfig/pg_config \ + --prefix=${prefix} \ + --libdir=${libdir} \ +" + +CFLAGS:append = " -I${S}/include" +LDFLAGS += "-pthread -lnetsnmp" + +# Lost interest in these errors for now, too many to handle +CC:remove:toolchain-llvm-morello:class-target = "-Werror=format" + +KERNEL_VERSION = "6.5" + +ZABBIX_IP_ADDR = "127.0.0.1" + +do_configure:prepend() { + export KERNEL_VERSION="${KERNEL_VERSION}" +} + +do_install:append() { + rm -f ${D}${bindir}/.debug + rm -f ${D}${bindir}/.debug/zabbix_sender + rm -f ${D}${bindir}/.debug/zabbix_get + rm -f ${D}${sbindir}/.debug + rm -f ${D}${sbindir}/.debug/zabbix_agentd +} + +SYSROOT_DIRS:remove = "${datadir}" \ No newline at end of file diff --git a/recipes-connectivity/zabbix/zabbix-proxy-morello_5.0.38.bb b/recipes-connectivity/zabbix/zabbix-proxy-morello_5.0.38.bb new file mode 100644 index 0000000..a5867e0 --- /dev/null +++ b/recipes-connectivity/zabbix/zabbix-proxy-morello_5.0.38.bb @@ -0,0 +1,65 @@ +inherit perlnative autotools-brokensep pure-cap-kheaders pkgconfig systemd useradd +inherit purecap-sysroot purecap-useradd + +require zabbix-morello.inc + +SRC_URI:append = " \ + file://zabbix-proxy.conf \ + file://zabbix-proxy.service \ +" + +# Seperate user for agent for security reasons. If the user is shared the agent +# will have full access to the server's DB. +USERADD_PACKAGES += " \ + ${PN} \ +" + +EXTRA_OECONF += "--enable-proxy" + +USERADD_PARAM:${PN} = "-r -g ${DB_ZABBIX_USER_SERVER} -d ${localstatedir}/lib/${DB_ZABBIX_USER_SERVER} \ + -s /sbin/nologin -c 'Zabbix Monitoring System' ${DB_ZABBIX_USER_SERVER} \ +" +GROUPADD_PARAM:${PN} = "-r ${DB_ZABBIX_USER_SERVER}" + +RPROVIDES:${PN} += "zabbix-proxy" + +BPN_ZABBIX = "zabbix-proxy" + +SYSTEMD_AUTO_ENABLE:${PN} = "enable" +SYSTEMD_SERVICE:${PN} = "zabbix-proxy.service" + +do_install:append() { + + install -d ${D}${systemd_system_unitdir} + install -d ${D}${sbindir} + install -d ${D}${sysconfdir} + + SERVICE_FILE="${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service" + install -m 0644 ${WORKDIR}/${BPN_ZABBIX}.service ${SERVICE_FILE} + sed -i -e 's#%SBINDIR%#${sbindir}#g' ${SERVICE_FILE} + sed -i -e 's#%SYSCONFDIR%#${sbindir}#g' ${SERVICE_FILE} + sed -i -e 's#%ZABBIX_PROXY_CONF%#${sysconfdir}/zabbix-proxy.conf#g' ${SERVICE_FILE} + + # N.B. For release use Access Tokens or similiar + sed -i -e 's#%DB_ZABBIX_USER_SERVER%#Admin#g' ${SERVICE_FILE} + sed -i -e 's#%DB_ZABBIX_PASSWORD%#${DB_ZABBIX_PASSWORD}#g' ${SERVICE_FILE} + + ZABBIX_CONF_DIR="${D}${sysconfdir}/zabbix/" + install -d ${ZABBIX_CONF_DIR} + install -m 0644 ${WORKDIR}/${BPN_ZABBIX}.conf ${ZABBIX_CONF_DIR} + + sed -i -e 's#%DB_ZABBIX_NAME%#${DB_ZABBIX_NAME}#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf + sed -i -e 's#%DB_ZABBIX_USER_PROXY%#${DB_ZABBIX_USER_PROXY}#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf + sed -i -e 's#%DB_ZABBIX_PASSWORD%#${DB_ZABBIX_PASSWORD}#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf + sed -i -e 's#%ZABBIX_SERVER_IPS%#${ZABBIX_IP_ADDR}#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf + sed -i -e 's#%STATS_ALLOWED_IPS%#${ZABBIX_IP_ADDR}#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf + + sed -i -e 's#%ZABBIX_SOCKET_DIR%#/tmp/#g' ${ZABBIX_CONF_DIR}/${BPN_ZABBIX}.conf + +} + + +FILES:${PN} += "${libdir} \ + ${systemd_system_unitdir}/${BPN_ZABBIX}.service \ + " +FILES:${PN}-dbg += "${datadir}" \ No newline at end of file diff --git a/recipes-connectivity/zabbix/zabbix-server-morello_5.0.38.bb b/recipes-connectivity/zabbix/zabbix-server-morello_5.0.38.bb new file mode 100644 index 0000000..941fad6 --- /dev/null +++ b/recipes-connectivity/zabbix/zabbix-server-morello_5.0.38.bb @@ -0,0 +1,71 @@ +inherit perlnative autotools-brokensep pure-cap-kheaders pkgconfig systemd useradd +inherit purecap-sysroot purecap-useradd + +require zabbix-morello.inc + +SRC_URI:append = " \ + file://zabbix-server.conf \ + file://zabbix-server-morello.service \ +" + +# Seperate user for agent for security reasons. If the user is shared the agent +# will have full access to the server's DB. +USERADD_PACKAGES += " \ + ${PN} \ +" + +EXTRA_OECONF += "--enable-server" + +USERADD_PARAM:${PN} = "-r -g ${DB_ZABBIX_USER_SERVER} -d ${localstatedir}/lib/${DB_ZABBIX_USER_SERVER} \ + -s /sbin/nologin -c 'Zabbix Monitoring System' ${DB_ZABBIX_USER_SERVER} \ +" +GROUPADD_PARAM:${PN} = "-r ${DB_ZABBIX_USER_SERVER}" + +RPROVIDES:${PN} += "zabbix-server" +RDEPENDS:${PN} += " busybox bash " + +BPN_ZABBIX = "zabbix-server" + +SYSTEMD_AUTO_ENABLE:${PN} = "enable" +SYSTEMD_SERVICE:${PN} = "zabbix-server.service" + + +do_install:append() { + + install -d ${D}${systemd_system_unitdir} ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/${BPN}.service ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + + sed -i -e 's#%SBINDIR%#${sbindir}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + sed -i -e 's#%SYSCONFDIR%#${sysconfdir}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + + sed -i -e 's#%DB_ZABBIX_USER_SERVER%#Admin#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + sed -i -e 's#%DB_ZABBIX_PASSWORD%#${DB_ZABBIX_PASSWORD}#g' ${D}${systemd_system_unitdir}/${BPN_ZABBIX}.service + + install -d ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf.d/ + install -m 0644 ${WORKDIR}/${BPN_ZABBIX}.conf ${D}${sysconfdir}/zabbix/ + + install -d ${D}${sysconfdir}/zabbix/schema + + sed -i -e 's#%DB_ZABBIX_NAME%#${DB_ZABBIX_NAME}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf + sed -i -e 's#%DB_ZABBIX_USER_SERVER%#${DB_ZABBIX_USER_SERVER}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf + sed -i -e 's#%DB_ZABBIX_PASSWORD%#${DB_ZABBIX_PASSWORD}#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf + + sed -i -e 's#%ZABBIX_SOCKET_DIR%#/tmp/#g' ${D}${sysconfdir}/zabbix/${BPN_ZABBIX}.conf + + ZABBIX_SCHEMA_LOC=${D}${sysconfdir}/zabbix/schema + + install -d ${ZABBIX_SCHEMA_LOC} + install -m 0644 ${S}/database/postgresql/schema.sql ${ZABBIX_SCHEMA_LOC} + install -m 0644 ${S}/database/postgresql/images.sql ${ZABBIX_SCHEMA_LOC} + install -m 0644 ${S}/database/postgresql/data.sql ${ZABBIX_SCHEMA_LOC} +} + +do_install:append() { + ${OBJDUMP} -D ${D}${sbindir}/zabbix_server > ${D}${PURECAP_DEBUGDIR}/zabbix_server.dump + ${READELF} -a ${D}${sbindir}/zabbix_server > ${D}${PURECAP_DEBUGDIR}/zabbix_server.readelf +} + +FILES:${PN} += " ${libdir} \ + ${systemd_system_unitdir}/${BPN_ZABBIX}.service \ + " +FILES:${PN}-dbg += "${datadir}" \ No newline at end of file
Co-authored-by: Harrison Carter hcarter@thegoodpenguin.co.uk Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- recipes-devtools/php/files/pg_config | 15 + recipes-devtools/php/files/php.ini | 1950 +++++++++++++++++ recipes-devtools/php/files/zabbix-fpm.conf | 24 + ...re.ac-don-t-include-build-libtool.m4.patch | 30 + ...001-opcache-config.m4-enable-opcache.patch | 237 ++ ...p-don-t-use-broken-wrapper-for-mkdir.patch | 29 + ...1-php.m4-don-t-unset-cache-variables.patch | 39 + recipes-devtools/php/php/70_mod_php7.conf | 9 + .../php/php/CVE-2023-3247-1.patch | 87 + .../php/php/CVE-2023-3247-2.patch | 29 + recipes-devtools/php/php/CVE-2023-3824.patch | 91 + .../php/php/debian-php-fixheader.patch | 32 + recipes-devtools/php/php/iconv.patch | 41 + .../php/php/imap-fix-autofoo.patch | 41 + recipes-devtools/php/php/pear-makefile.patch | 22 + recipes-devtools/php/php/phar-makefile.patch | 46 + recipes-devtools/php/php/php-fpm-apache.conf | 6 + recipes-devtools/php/php/php-fpm.conf | 510 +++++ recipes-devtools/php/php/php-fpm.service | 10 + .../php/php/php_exec_native.patch | 26 + .../php/php/xfail_two_bug_tests.patch | 34 + recipes-devtools/php/php_%.bbappend | 74 + recipes-devtools/php/php_7.4.33.bb | 276 +++ 23 files changed, 3658 insertions(+) create mode 100755 recipes-devtools/php/files/pg_config create mode 100644 recipes-devtools/php/files/php.ini create mode 100644 recipes-devtools/php/files/zabbix-fpm.conf create mode 100644 recipes-devtools/php/php/0001-configure.ac-don-t-include-build-libtool.m4.patch create mode 100644 recipes-devtools/php/php/0001-opcache-config.m4-enable-opcache.patch create mode 100644 recipes-devtools/php/php/0001-php-don-t-use-broken-wrapper-for-mkdir.patch create mode 100644 recipes-devtools/php/php/0001-php.m4-don-t-unset-cache-variables.patch create mode 100644 recipes-devtools/php/php/70_mod_php7.conf create mode 100644 recipes-devtools/php/php/CVE-2023-3247-1.patch create mode 100644 recipes-devtools/php/php/CVE-2023-3247-2.patch create mode 100644 recipes-devtools/php/php/CVE-2023-3824.patch create mode 100644 recipes-devtools/php/php/debian-php-fixheader.patch create mode 100644 recipes-devtools/php/php/iconv.patch create mode 100644 recipes-devtools/php/php/imap-fix-autofoo.patch create mode 100644 recipes-devtools/php/php/pear-makefile.patch create mode 100644 recipes-devtools/php/php/phar-makefile.patch create mode 100644 recipes-devtools/php/php/php-fpm-apache.conf create mode 100644 recipes-devtools/php/php/php-fpm.conf create mode 100644 recipes-devtools/php/php/php-fpm.service create mode 100644 recipes-devtools/php/php/php_exec_native.patch create mode 100644 recipes-devtools/php/php/xfail_two_bug_tests.patch create mode 100644 recipes-devtools/php/php_%.bbappend create mode 100644 recipes-devtools/php/php_7.4.33.bb
diff --git a/recipes-devtools/php/files/pg_config b/recipes-devtools/php/files/pg_config new file mode 100755 index 0000000..d31f437 --- /dev/null +++ b/recipes-devtools/php/files/pg_config @@ -0,0 +1,15 @@ +#!/bin/bash + +if [[ "${1}" == "--includedir" ]]; then + + echo "${INCLUDEDIR_IN}" + +elif [[ "${1}" == "--libdir" ]]; then + + echo "${LIBDIR_IN}" + +elif [[ "${1}" == "--version" ]]; then + + echo "${VERSION_IN}" + +fi \ No newline at end of file diff --git a/recipes-devtools/php/files/php.ini b/recipes-devtools/php/files/php.ini new file mode 100644 index 0000000..ab72673 --- /dev/null +++ b/recipes-devtools/php/files/php.ini @@ -0,0 +1,1950 @@ +[PHP] + +;;;;;;;;;;;;;;;;;;; +; About php.ini ; +;;;;;;;;;;;;;;;;;;; +; PHP's initialization file, generally called php.ini, is responsible for +; configuring many of the aspects of PHP's behavior. + +; PHP attempts to find and load this configuration from a number of locations. +; The following is a summary of its search order: +; 1. SAPI module specific location. +; 2. The PHPRC environment variable. (As of PHP 5.2.0) +; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0) +; 4. Current working directory (except CLI) +; 5. The web server's directory (for SAPI modules), or directory of PHP +; (otherwise in Windows) +; 6. The directory from the --with-config-file-path compile time option, or the +; Windows directory (usually C:\windows) +; See the PHP docs for more specific information. +; https://php.net/configuration.file + +; The syntax of the file is extremely simple. Whitespace and lines +; beginning with a semicolon are silently ignored (as you probably guessed). +; Section headers (e.g. [Foo]) are also silently ignored, even though +; they might mean something in the future. + +; Directives following the section heading [PATH=/www/mysite] only +; apply to PHP files in the /www/mysite directory. Directives +; following the section heading [HOST=www.example.com] only apply to +; PHP files served from www.example.com. Directives set in these +; special sections cannot be overridden by user-defined INI files or +; at runtime. Currently, [PATH=] and [HOST=] sections only work under +; CGI/FastCGI. +; https://php.net/ini.sections + +; Directives are specified using the following syntax: +; directive = value +; Directive names are *case sensitive* - foo=bar is different from FOO=bar. +; Directives are variables used to configure PHP or PHP extensions. +; There is no name validation. If PHP can't find an expected +; directive because it is not set or is mistyped, a default value will be used. + +; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one +; of the INI constants (On, Off, True, False, Yes, No and None) or an expression +; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a +; previously set variable or directive (e.g. ${foo}) + +; Expressions in the INI file are limited to bitwise operators and parentheses: +; | bitwise OR +; ^ bitwise XOR +; & bitwise AND +; ~ bitwise NOT +; ! boolean NOT + +; Boolean flags can be turned on using the values 1, On, True or Yes. +; They can be turned off using the values 0, Off, False or No. + +; An empty string can be denoted by simply not writing anything after the equal +; sign, or by using the None keyword: + +; foo = ; sets foo to an empty string +; foo = None ; sets foo to an empty string +; foo = "None" ; sets foo to the string 'None' + +; If you use constants in your value, and these constants belong to a +; dynamically loaded extension (either a PHP extension or a Zend extension), +; you may only use these constants *after* the line that loads the extension. + +;;;;;;;;;;;;;;;;;;; +; About this file ; +;;;;;;;;;;;;;;;;;;; +; PHP comes packaged with two INI files. One that is recommended to be used +; in production environments and one that is recommended to be used in +; development environments. + +; php.ini-production contains settings which hold security, performance and +; best practices at its core. But please be aware, these settings may break +; compatibility with older or less security conscience applications. We +; recommending using the production ini in production and testing environments. + +; php.ini-development is very similar to its production variant, except it is +; much more verbose when it comes to errors. We recommend using the +; development version only in development environments, as errors shown to +; application users can inadvertently leak otherwise secure information. + +; This is the php.ini-production INI file. + +;;;;;;;;;;;;;;;;;;; +; Quick Reference ; +;;;;;;;;;;;;;;;;;;; + +; The following are all the settings which are different in either the production +; or development versions of the INIs with respect to PHP's default behavior. +; Please see the actual settings later in the document for more details as to why +; we recommend these changes in PHP's behavior. + +; display_errors +; Default Value: On +; Development Value: On +; Production Value: Off + +; display_startup_errors +; Default Value: On +; Development Value: On +; Production Value: Off + +; error_reporting +; Default Value: E_ALL +; Development Value: E_ALL +; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT + +; log_errors +; Default Value: Off +; Development Value: On +; Production Value: On + +; max_input_time +; Default Value: -1 (Unlimited) +; Development Value: 60 (60 seconds) +; Production Value: 60 (60 seconds) + +; output_buffering +; Default Value: Off +; Development Value: 4096 +; Production Value: 4096 + +; register_argc_argv +; Default Value: On +; Development Value: Off +; Production Value: Off + +; request_order +; Default Value: None +; Development Value: "GP" +; Production Value: "GP" + +; session.gc_divisor +; Default Value: 100 +; Development Value: 1000 +; Production Value: 1000 + +; session.sid_bits_per_character +; Default Value: 4 +; Development Value: 5 +; Production Value: 5 + +; short_open_tag +; Default Value: On +; Development Value: Off +; Production Value: Off + +; variables_order +; Default Value: "EGPCS" +; Development Value: "GPCS" +; Production Value: "GPCS" + +; zend.exception_ignore_args +; Default Value: Off +; Development Value: Off +; Production Value: On + +; zend.exception_string_param_max_len +; Default Value: 15 +; Development Value: 15 +; Production Value: 0 + +;;;;;;;;;;;;;;;;;;;; +; php.ini Options ; +;;;;;;;;;;;;;;;;;;;; +; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini" +;user_ini.filename = ".user.ini" + +; To disable this feature set this option to an empty value +;user_ini.filename = + +; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) +;user_ini.cache_ttl = 300 + +;;;;;;;;;;;;;;;;;;;; +; Language Options ; +;;;;;;;;;;;;;;;;;;;; + +; Enable the PHP scripting language engine under Apache. +; https://php.net/engine +engine = On + +; This directive determines whether or not PHP will recognize code between +; <? and ?> tags as PHP source which should be processed as such. It is +; generally recommended that <?php and ?> should be used and that this feature +; should be disabled, as enabling it may result in issues when generating XML +; documents, however this remains supported for backward compatibility reasons. +; Note that this directive does not control the <?= shorthand tag, which can be +; used regardless of this directive. +; Default Value: On +; Development Value: Off +; Production Value: Off +; https://php.net/short-open-tag +short_open_tag = Off + +; The number of significant digits displayed in floating point numbers. +; https://php.net/precision +precision = 14 + +; Output buffering is a mechanism for controlling how much output data +; (excluding headers and cookies) PHP should keep internally before pushing that +; data to the client. If your application's output exceeds this setting, PHP +; will send that data in chunks of roughly the size you specify. +; Turning on this setting and managing its maximum buffer size can yield some +; interesting side-effects depending on your application and web server. +; You may be able to send headers and cookies after you've already sent output +; through print or echo. You also may see performance benefits if your server is +; emitting less packets due to buffered output versus PHP streaming the output +; as it gets it. On production servers, 4096 bytes is a good setting for performance +; reasons. +; Note: Output buffering can also be controlled via Output Buffering Control +; functions. +; Possible Values: +; On = Enabled and buffer is unlimited. (Use with caution) +; Off = Disabled +; Integer = Enables the buffer and sets its maximum size in bytes. +; Note: This directive is hardcoded to Off for the CLI SAPI +; Default Value: Off +; Development Value: 4096 +; Production Value: 4096 +; https://php.net/output-buffering +output_buffering = 4096 + +; You can redirect all of the output of your scripts to a function. For +; example, if you set output_handler to "mb_output_handler", character +; encoding will be transparently converted to the specified encoding. +; Setting any output handler automatically turns on output buffering. +; Note: People who wrote portable scripts should not depend on this ini +; directive. Instead, explicitly set the output handler using ob_start(). +; Using this ini directive may cause problems unless you know what script +; is doing. +; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler" +; and you cannot use both "ob_gzhandler" and "zlib.output_compression". +; Note: output_handler must be empty if this is set 'On' !!!! +; Instead you must use zlib.output_handler. +; https://php.net/output-handler +;output_handler = + +; URL rewriter function rewrites URL on the fly by using +; output buffer. You can set target tags by this configuration. +; "form" tag is special tag. It will add hidden input tag to pass values. +; Refer to session.trans_sid_tags for usage. +; Default Value: "form=" +; Development Value: "form=" +; Production Value: "form=" +;url_rewriter.tags + +; URL rewriter will not rewrite absolute URL nor form by default. To enable +; absolute URL rewrite, allowed hosts must be defined at RUNTIME. +; Refer to session.trans_sid_hosts for more details. +; Default Value: "" +; Development Value: "" +; Production Value: "" +;url_rewriter.hosts + +; Transparent output compression using the zlib library +; Valid values for this option are 'off', 'on', or a specific buffer size +; to be used for compression (default is 4KB) +; Note: Resulting chunk size may vary due to nature of compression. PHP +; outputs chunks that are few hundreds bytes each as a result of +; compression. If you prefer a larger chunk size for better +; performance, enable output_buffering in addition. +; Note: You need to use zlib.output_handler instead of the standard +; output_handler, or otherwise the output will be corrupted. +; https://php.net/zlib.output-compression +zlib.output_compression = Off + +; https://php.net/zlib.output-compression-level +;zlib.output_compression_level = -1 + +; You cannot specify additional output handlers if zlib.output_compression +; is activated here. This setting does the same as output_handler but in +; a different order. +; https://php.net/zlib.output-handler +;zlib.output_handler = + +; Implicit flush tells PHP to tell the output layer to flush itself +; automatically after every output block. This is equivalent to calling the +; PHP function flush() after each and every call to print() or echo() and each +; and every HTML block. Turning this option on has serious performance +; implications and is generally recommended for debugging purposes only. +; https://php.net/implicit-flush +; Note: This directive is hardcoded to On for the CLI SAPI +implicit_flush = Off + +; The unserialize callback function will be called (with the undefined class' +; name as parameter), if the unserializer finds an undefined class +; which should be instantiated. A warning appears if the specified function is +; not defined, or if the function doesn't include/implement the missing class. +; So only set this entry, if you really want to implement such a +; callback-function. +unserialize_callback_func = + +; The unserialize_max_depth specifies the default depth limit for unserialized +; structures. Setting the depth limit too high may result in stack overflows +; during unserialization. The unserialize_max_depth ini setting can be +; overridden by the max_depth option on individual unserialize() calls. +; A value of 0 disables the depth limit. +;unserialize_max_depth = 4096 + +; When floats & doubles are serialized, store serialize_precision significant +; digits after the floating point. The default value ensures that when floats +; are decoded with unserialize, the data will remain the same. +; The value is also used for json_encode when encoding double values. +; If -1 is used, then dtoa mode 0 is used which automatically select the best +; precision. +serialize_precision = -1 + +; open_basedir, if set, limits all file operations to the defined directory +; and below. This directive makes most sense if used in a per-directory +; or per-virtualhost web server configuration file. +; Note: disables the realpath cache +; https://php.net/open-basedir +;open_basedir = + +; This directive allows you to disable certain functions. +; It receives a comma-delimited list of function names. +; https://php.net/disable-functions +disable_functions = + +; This directive allows you to disable certain classes. +; It receives a comma-delimited list of class names. +; https://php.net/disable-classes +disable_classes = + +; Colors for Syntax Highlighting mode. Anything that's acceptable in +; <span style="color: ???????"> would work. +; https://php.net/syntax-highlighting +;highlight.string = #DD0000 +;highlight.comment = #FF9900 +;highlight.keyword = #007700 +;highlight.default = #0000BB +;highlight.html = #000000 + +; If enabled, the request will be allowed to complete even if the user aborts +; the request. Consider enabling it if executing long requests, which may end up +; being interrupted by the user or a browser timing out. PHP's default behavior +; is to disable this feature. +; https://php.net/ignore-user-abort +;ignore_user_abort = On + +; Determines the size of the realpath cache to be used by PHP. This value should +; be increased on systems where PHP opens many files to reflect the quantity of +; the file operations performed. +; Note: if open_basedir is set, the cache is disabled +; https://php.net/realpath-cache-size +;realpath_cache_size = 4096k + +; Duration of time, in seconds for which to cache realpath information for a given +; file or directory. For systems with rarely changing files, consider increasing this +; value. +; https://php.net/realpath-cache-ttl +;realpath_cache_ttl = 120 + +; Enables or disables the circular reference collector. +; https://php.net/zend.enable-gc +zend.enable_gc = On + +; If enabled, scripts may be written in encodings that are incompatible with +; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such +; encodings. To use this feature, mbstring extension must be enabled. +;zend.multibyte = Off + +; Allows to set the default encoding for the scripts. This value will be used +; unless "declare(encoding=...)" directive appears at the top of the script. +; Only affects if zend.multibyte is set. +;zend.script_encoding = + +; Allows to include or exclude arguments from stack traces generated for exceptions. +; In production, it is recommended to turn this setting on to prohibit the output +; of sensitive information in stack traces +; Default Value: Off +; Development Value: Off +; Production Value: On +zend.exception_ignore_args = On + +; Allows setting the maximum string length in an argument of a stringified stack trace +; to a value between 0 and 1000000. +; This has no effect when zend.exception_ignore_args is enabled. +; Default Value: 15 +; Development Value: 15 +; Production Value: 0 +; In production, it is recommended to set this to 0 to reduce the output +; of sensitive information in stack traces. +zend.exception_string_param_max_len = 0 + +;;;;;;;;;;;;;;;;; +; Miscellaneous ; +;;;;;;;;;;;;;;;;; + +; Decides whether PHP may expose the fact that it is installed on the server +; (e.g. by adding its signature to the Web server header). It is no security +; threat in any way, but it makes it possible to determine whether you use PHP +; on your server or not. +; https://php.net/expose-php +expose_php = On + +;;;;;;;;;;;;;;;;;;; +; Resource Limits ; +;;;;;;;;;;;;;;;;;;; + +; Maximum execution time of each script, in seconds +; https://php.net/max-execution-time +; Note: This directive is hardcoded to 0 for the CLI SAPI +max_execution_time = 300 + +; Maximum amount of time each script may spend parsing request data. It's a good +; idea to limit this time on productions servers in order to eliminate unexpectedly +; long running scripts. +; Note: This directive is hardcoded to -1 for the CLI SAPI +; Default Value: -1 (Unlimited) +; Development Value: 60 (60 seconds) +; Production Value: 60 (60 seconds) +; https://php.net/max-input-time +max_input_time = 60 + +; Maximum input variable nesting level +; https://php.net/max-input-nesting-level +;max_input_nesting_level = 64 + +; How many GET/POST/COOKIE input variables may be accepted +;max_input_vars = 1000 + +; Maximum amount of memory a script may consume +; https://php.net/memory-limit +memory_limit = 128M + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Error handling and logging ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; This directive informs PHP of which errors, warnings and notices you would like +; it to take action for. The recommended way of setting values for this +; directive is through the use of the error level constants and bitwise +; operators. The error level constants are below here for convenience as well as +; some common settings and their meanings. +; By default, PHP is set to take action on all errors, notices and warnings EXCEPT +; those related to E_NOTICE and E_STRICT, which together cover best practices and +; recommended coding standards in PHP. For performance reasons, this is the +; recommend error reporting setting. Your production server shouldn't be wasting +; resources complaining about best practices and coding standards. That's what +; development servers and development settings are for. +; Note: The php.ini-development file has this setting as E_ALL. This +; means it pretty much reports everything which is exactly what you want during +; development and early testing. +; +; Error Level Constants: +; E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0) +; E_ERROR - fatal run-time errors +; E_RECOVERABLE_ERROR - almost fatal run-time errors +; E_WARNING - run-time warnings (non-fatal errors) +; E_PARSE - compile-time parse errors +; E_NOTICE - run-time notices (these are warnings which often result +; from a bug in your code, but it's possible that it was +; intentional (e.g., using an uninitialized variable and +; relying on the fact it is automatically initialized to an +; empty string) +; E_STRICT - run-time notices, enable to have PHP suggest changes +; to your code which will ensure the best interoperability +; and forward compatibility of your code +; E_CORE_ERROR - fatal errors that occur during PHP's initial startup +; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's +; initial startup +; E_COMPILE_ERROR - fatal compile-time errors +; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) +; E_USER_ERROR - user-generated error message +; E_USER_WARNING - user-generated warning message +; E_USER_NOTICE - user-generated notice message +; E_DEPRECATED - warn about code that will not work in future versions +; of PHP +; E_USER_DEPRECATED - user-generated deprecation warnings +; +; Common Values: +; E_ALL (Show all errors, warnings and notices including coding standards.) +; E_ALL & ~E_NOTICE (Show all errors, except for notices) +; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.) +; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) +; Default Value: E_ALL +; Development Value: E_ALL +; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT +; https://php.net/error-reporting +error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT + +; This directive controls whether or not and where PHP will output errors, +; notices and warnings too. Error output is very useful during development, but +; it could be very dangerous in production environments. Depending on the code +; which is triggering the error, sensitive information could potentially leak +; out of your application such as database usernames and passwords or worse. +; For production environments, we recommend logging errors rather than +; sending them to STDOUT. +; Possible Values: +; Off = Do not display any errors +; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) +; On or stdout = Display errors to STDOUT +; Default Value: On +; Development Value: On +; Production Value: Off +; https://php.net/display-errors +display_errors = Off + +; The display of errors which occur during PHP's startup sequence are handled +; separately from display_errors. We strongly recommend you set this to 'off' +; for production servers to avoid leaking configuration details. +; Default Value: On +; Development Value: On +; Production Value: Off +; https://php.net/display-startup-errors +display_startup_errors = Off + +; Besides displaying errors, PHP can also log errors to locations such as a +; server-specific log, STDERR, or a location specified by the error_log +; directive found below. While errors should not be displayed on productions +; servers they should still be monitored and logging is a great way to do that. +; Default Value: Off +; Development Value: On +; Production Value: On +; https://php.net/log-errors +log_errors = On + +; Do not log repeated messages. Repeated errors must occur in same file on same +; line unless ignore_repeated_source is set true. +; https://php.net/ignore-repeated-errors +ignore_repeated_errors = Off + +; Ignore source of message when ignoring repeated messages. When this setting +; is On you will not log errors with repeated messages from different files or +; source lines. +; https://php.net/ignore-repeated-source +ignore_repeated_source = Off + +; If this parameter is set to Off, then memory leaks will not be shown (on +; stdout or in the log). This is only effective in a debug compile, and if +; error reporting includes E_WARNING in the allowed list +; https://php.net/report-memleaks +report_memleaks = On + +; This setting is off by default. +;report_zend_debug = 0 + +; Turn off normal error reporting and emit XML-RPC error XML +; https://php.net/xmlrpc-errors +;xmlrpc_errors = 0 + +; An XML-RPC faultCode +;xmlrpc_error_number = 0 + +; When PHP displays or logs an error, it has the capability of formatting the +; error message as HTML for easier reading. This directive controls whether +; the error message is formatted as HTML or not. +; Note: This directive is hardcoded to Off for the CLI SAPI +; https://php.net/html-errors +;html_errors = On + +; If html_errors is set to On *and* docref_root is not empty, then PHP +; produces clickable error messages that direct to a page describing the error +; or function causing the error in detail. +; You can download a copy of the PHP manual from https://php.net/docs +; and change docref_root to the base URL of your local copy including the +; leading '/'. You must also specify the file extension being used including +; the dot. PHP's default behavior is to leave these settings empty, in which +; case no links to documentation are generated. +; Note: Never use this feature for production boxes. +; https://php.net/docref-root +; Examples +;docref_root = "/phpmanual/" + +; https://php.net/docref-ext +;docref_ext = .html + +; String to output before an error message. PHP's default behavior is to leave +; this setting blank. +; https://php.net/error-prepend-string +; Example: +;error_prepend_string = "<span style='color: #ff0000'>" + +; String to output after an error message. PHP's default behavior is to leave +; this setting blank. +; https://php.net/error-append-string +; Example: +;error_append_string = "</span>" + +; Log errors to specified file. PHP's default behavior is to leave this value +; empty. +; https://php.net/error-log +; Example: +;error_log = php_errors.log +; Log errors to syslog (Event Log on Windows). +;error_log = syslog + +; The syslog ident is a string which is prepended to every message logged +; to syslog. Only used when error_log is set to syslog. +;syslog.ident = php + +; The syslog facility is used to specify what type of program is logging +; the message. Only used when error_log is set to syslog. +;syslog.facility = user + +; Set this to disable filtering control characters (the default). +; Some loggers only accept NVT-ASCII, others accept anything that's not +; control characters. If your logger accepts everything, then no filtering +; is needed at all. +; Allowed values are: +; ascii (all printable ASCII characters and NL) +; no-ctrl (all characters except control characters) +; all (all characters) +; raw (like "all", but messages are not split at newlines) +; https://php.net/syslog.filter +;syslog.filter = ascii + +;windows.show_crt_warning +; Default value: 0 +; Development value: 0 +; Production value: 0 + +;;;;;;;;;;;;;;;;; +; Data Handling ; +;;;;;;;;;;;;;;;;; + +; The separator used in PHP generated URLs to separate arguments. +; PHP's default setting is "&". +; https://php.net/arg-separator.output +; Example: +;arg_separator.output = "&" + +; List of separator(s) used by PHP to parse input URLs into variables. +; PHP's default setting is "&". +; NOTE: Every character in this directive is considered as separator! +; https://php.net/arg-separator.input +; Example: +;arg_separator.input = ";&" + +; This directive determines which super global arrays are registered when PHP +; starts up. G,P,C,E & S are abbreviations for the following respective super +; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty +; paid for the registration of these arrays and because ENV is not as commonly +; used as the others, ENV is not recommended on productions servers. You +; can still get access to the environment variables through getenv() should you +; need to. +; Default Value: "EGPCS" +; Development Value: "GPCS" +; Production Value: "GPCS"; +; https://php.net/variables-order +variables_order = "GPCS" + +; This directive determines which super global data (G,P & C) should be +; registered into the super global array REQUEST. If so, it also determines +; the order in which that data is registered. The values for this directive +; are specified in the same manner as the variables_order directive, +; EXCEPT one. Leaving this value empty will cause PHP to use the value set +; in the variables_order directive. It does not mean it will leave the super +; globals array REQUEST empty. +; Default Value: None +; Development Value: "GP" +; Production Value: "GP" +; https://php.net/request-order +request_order = "GP" + +; This directive determines whether PHP registers $argv & $argc each time it +; runs. $argv contains an array of all the arguments passed to PHP when a script +; is invoked. $argc contains an integer representing the number of arguments +; that were passed when the script was invoked. These arrays are extremely +; useful when running scripts from the command line. When this directive is +; enabled, registering these variables consumes CPU cycles and memory each time +; a script is executed. For performance reasons, this feature should be disabled +; on production servers. +; Note: This directive is hardcoded to On for the CLI SAPI +; Default Value: On +; Development Value: Off +; Production Value: Off +; https://php.net/register-argc-argv +register_argc_argv = Off + +; When enabled, the ENV, REQUEST and SERVER variables are created when they're +; first used (Just In Time) instead of when the script starts. If these +; variables are not used within a script, having this directive on will result +; in a performance gain. The PHP directive register_argc_argv must be disabled +; for this directive to have any effect. +; https://php.net/auto-globals-jit +auto_globals_jit = On + +; Whether PHP will read the POST data. +; This option is enabled by default. +; Most likely, you won't want to disable this option globally. It causes $_POST +; and $_FILES to always be empty; the only way you will be able to read the +; POST data will be through the php://input stream wrapper. This can be useful +; to proxy requests or to process the POST data in a memory efficient fashion. +; https://php.net/enable-post-data-reading +;enable_post_data_reading = Off + +; Maximum size of POST data that PHP will accept. +; Its value may be 0 to disable the limit. It is ignored if POST data reading +; is disabled through enable_post_data_reading. +; https://php.net/post-max-size +post_max_size = 16M + +; Automatically add files before PHP document. +; https://php.net/auto-prepend-file +auto_prepend_file = + +; Automatically add files after PHP document. +; https://php.net/auto-append-file +auto_append_file = + +; By default, PHP will output a media type using the Content-Type header. To +; disable this, simply set it to be empty. +; +; PHP's built-in default media type is set to text/html. +; https://php.net/default-mimetype +default_mimetype = "text/html" + +; PHP's default character set is set to UTF-8. +; https://php.net/default-charset +default_charset = "UTF-8" + +; PHP internal character encoding is set to empty. +; If empty, default_charset is used. +; https://php.net/internal-encoding +;internal_encoding = + +; PHP input character encoding is set to empty. +; If empty, default_charset is used. +; https://php.net/input-encoding +;input_encoding = + +; PHP output character encoding is set to empty. +; If empty, default_charset is used. +; See also output_buffer. +; https://php.net/output-encoding +;output_encoding = + +;;;;;;;;;;;;;;;;;;;;;;;;; +; Paths and Directories ; +;;;;;;;;;;;;;;;;;;;;;;;;; + +; UNIX: "/path1:/path2" +;include_path = ".:/php/includes" +; +; Windows: "\path1;\path2" +;include_path = ".;c:\php\includes" +; +; PHP's default setting for include_path is ".;/path/to/php/pear" +; https://php.net/include-path + +; The root of the PHP pages, used only if nonempty. +; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root +; if you are running php as a CGI under any web server (other than IIS) +; see documentation for security issues. The alternate is to use the +; cgi.force_redirect configuration below +; https://php.net/doc-root +doc_root = + +; The directory under which PHP opens the script using /~username used only +; if nonempty. +; https://php.net/user-dir +user_dir = + +; Directory in which the loadable extensions (modules) reside. +; https://php.net/extension-dir +;extension_dir = "./" +; On windows: +;extension_dir = "ext" + +; Directory where the temporary files should be placed. +; Defaults to the system default (see sys_get_temp_dir) +;sys_temp_dir = "/tmp" + +; Whether or not to enable the dl() function. The dl() function does NOT work +; properly in multithreaded servers, such as IIS or Zeus, and is automatically +; disabled on them. +; https://php.net/enable-dl +enable_dl = Off + +; cgi.force_redirect is necessary to provide security running PHP as a CGI under +; most web servers. Left undefined, PHP turns this on by default. You can +; turn it off here AT YOUR OWN RISK +; **You CAN safely turn this off for IIS, in fact, you MUST.** +; https://php.net/cgi.force-redirect +;cgi.force_redirect = 1 + +; if cgi.nph is enabled it will force cgi to always sent Status: 200 with +; every request. PHP's default behavior is to disable this feature. +;cgi.nph = 1 + +; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape +; (iPlanet) web servers, you MAY need to set an environment variable name that PHP +; will look for to know it is OK to continue execution. Setting this variable MAY +; cause security issues, KNOW WHAT YOU ARE DOING FIRST. +; https://php.net/cgi.redirect-status-env +;cgi.redirect_status_env = + +; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's +; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok +; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting +; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting +; of zero causes PHP to behave as before. Default is 1. You should fix your scripts +; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. +; https://php.net/cgi.fix-pathinfo +;cgi.fix_pathinfo=1 + +; if cgi.discard_path is enabled, the PHP CGI binary can safely be placed outside +; of the web tree and people will not be able to circumvent .htaccess security. +;cgi.discard_path=1 + +; FastCGI under IIS supports the ability to impersonate +; security tokens of the calling client. This allows IIS to define the +; security context that the request runs under. mod_fastcgi under Apache +; does not currently support this feature (03/17/2002) +; Set to 1 if running under IIS. Default is zero. +; https://php.net/fastcgi.impersonate +;fastcgi.impersonate = 1 + +; Disable logging through FastCGI connection. PHP's default behavior is to enable +; this feature. +;fastcgi.logging = 0 + +; cgi.rfc2616_headers configuration option tells PHP what type of headers to +; use when sending HTTP response code. If set to 0, PHP sends Status: header that +; is supported by Apache. When this option is set to 1, PHP will send +; RFC2616 compliant header. +; Default is zero. +; https://php.net/cgi.rfc2616-headers +;cgi.rfc2616_headers = 0 + +; cgi.check_shebang_line controls whether CGI PHP checks for line starting with #! +; (shebang) at the top of the running script. This line might be needed if the +; script support running both as stand-alone script and via PHP CGI<. PHP in CGI +; mode skips this line and ignores its content if this directive is turned on. +; https://php.net/cgi.check-shebang-line +;cgi.check_shebang_line=1 + +;;;;;;;;;;;;;;;; +; File Uploads ; +;;;;;;;;;;;;;;;; + +; Whether to allow HTTP file uploads. +; https://php.net/file-uploads +file_uploads = On + +; Temporary directory for HTTP uploaded files (will use system default if not +; specified). +; https://php.net/upload-tmp-dir +;upload_tmp_dir = + +; Maximum allowed size for uploaded files. +; https://php.net/upload-max-filesize +upload_max_filesize = 2M + +; Maximum number of files that can be uploaded via a single request +max_file_uploads = 20 + +;;;;;;;;;;;;;;;;;; +; Fopen wrappers ; +;;;;;;;;;;;;;;;;;; + +; Whether to allow the treatment of URLs (like http:// or ftp://) as files. +; https://php.net/allow-url-fopen +allow_url_fopen = On + +; Whether to allow include/require to open URLs (like https:// or ftp://) as files. +; https://php.net/allow-url-include +allow_url_include = Off + +; Define the anonymous ftp password (your email address). PHP's default setting +; for this is empty. +; https://php.net/from +;from="john@doe.com" + +; Define the User-Agent string. PHP's default setting for this is empty. +; https://php.net/user-agent +;user_agent="PHP" + +; Default timeout for socket based streams (seconds) +; https://php.net/default-socket-timeout +default_socket_timeout = 60 + +; If your scripts have to deal with files from Macintosh systems, +; or you are running on a Mac and need to deal with files from +; unix or win32 systems, setting this flag will cause PHP to +; automatically detect the EOL character in those files so that +; fgets() and file() will work regardless of the source of the file. +; https://php.net/auto-detect-line-endings +;auto_detect_line_endings = Off + +;;;;;;;;;;;;;;;;;;;;;; +; Dynamic Extensions ; +;;;;;;;;;;;;;;;;;;;;;; + +; If you wish to have an extension loaded automatically, use the following +; syntax: +; +; extension=modulename +; +; For example: +; +; extension=mysqli +; +; When the extension library to load is not located in the default extension +; directory, You may specify an absolute path to the library file: +; +; extension=/path/to/extension/mysqli.so +; +; Note : The syntax used in previous PHP versions ('extension=<ext>.so' and +; 'extension='php_<ext>.dll') is supported for legacy reasons and may be +; deprecated in a future PHP major version. So, when it is possible, please +; move to the new ('extension=<ext>) syntax. +; +; Notes for Windows environments : +; +; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+) +; extension folders as well as the separate PECL DLL download (PHP 5+). +; Be sure to appropriately set the extension_dir directive. +; +;extension=bz2 +;extension=curl +;extension=ffi +;extension=ftp +;extension=fileinfo +;extension=gd +;extension=gettext +;extension=gmp +;extension=intl +;extension=imap +;extension=ldap +;extension=mbstring +;extension=exif ; Must be after mbstring as it depends on it +;extension=mysqli +;extension=oci8_12c ; Use with Oracle Database 12c Instant Client +;extension=oci8_19 ; Use with Oracle Database 19 Instant Client +;extension=odbc +;extension=openssl +;extension=pdo_firebird +;extension=pdo_mysql +;extension=pdo_oci +;extension=pdo_odbc +;extension=pdo_pgsql +;extension=pdo_sqlite +;extension=pgsql +;extension=shmop + +; The MIBS data available in the PHP distribution must be installed. +; See https://www.php.net/manual/en/snmp.installation.php +;extension=snmp + +;extension=soap +;extension=sockets +;extension=sodium +;extension=sqlite3 +;extension=tidy +;extension=xsl + +;zend_extension=opcache + +;;;;;;;;;;;;;;;;;;; +; Module Settings ; +;;;;;;;;;;;;;;;;;;; + +[CLI Server] +; Whether the CLI web server uses ANSI color coding in its terminal output. +cli_server.color = On + +[Date] +; Defines the default timezone used by the date functions +; https://php.net/date.timezone +date.timezone = GMT + +; https://php.net/date.default-latitude +;date.default_latitude = 31.7667 + +; https://php.net/date.default-longitude +;date.default_longitude = 35.2333 + +; https://php.net/date.sunrise-zenith +;date.sunrise_zenith = 90.833333 + +; https://php.net/date.sunset-zenith +;date.sunset_zenith = 90.833333 + +[filter] +; https://php.net/filter.default +;filter.default = unsafe_raw + +; https://php.net/filter.default-flags +;filter.default_flags = + +[iconv] +; Use of this INI entry is deprecated, use global input_encoding instead. +; If empty, default_charset or input_encoding or iconv.input_encoding is used. +; The precedence is: default_charset < input_encoding < iconv.input_encoding +;iconv.input_encoding = + +; Use of this INI entry is deprecated, use global internal_encoding instead. +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding +;iconv.internal_encoding = + +; Use of this INI entry is deprecated, use global output_encoding instead. +; If empty, default_charset or output_encoding or iconv.output_encoding is used. +; The precedence is: default_charset < output_encoding < iconv.output_encoding +; To use an output encoding conversion, iconv's output handler must be set +; otherwise output encoding conversion cannot be performed. +;iconv.output_encoding = + +[imap] +; rsh/ssh logins are disabled by default. Use this INI entry if you want to +; enable them. Note that the IMAP library does not filter mailbox names before +; passing them to rsh/ssh command, thus passing untrusted data to this function +; with rsh/ssh enabled is insecure. +;imap.enable_insecure_rsh=0 + +[intl] +;intl.default_locale = +; This directive allows you to produce PHP errors when some error +; happens within intl functions. The value is the level of the error produced. +; Default is 0, which does not produce any errors. +;intl.error_level = E_WARNING +;intl.use_exceptions = 0 + +[sqlite3] +; Directory pointing to SQLite3 extensions +; https://php.net/sqlite3.extension-dir +;sqlite3.extension_dir = + +; SQLite defensive mode flag (only available from SQLite 3.26+) +; When the defensive flag is enabled, language features that allow ordinary +; SQL to deliberately corrupt the database file are disabled. This forbids +; writing directly to the schema, shadow tables (eg. FTS data tables), or +; the sqlite_dbpage virtual table. +; https://www.sqlite.org/c3ref/c_dbconfig_defensive.html +; (for older SQLite versions, this flag has no use) +;sqlite3.defensive = 1 + +[Pcre] +; PCRE library backtracking limit. +; https://php.net/pcre.backtrack-limit +;pcre.backtrack_limit=100000 + +; PCRE library recursion limit. +; Please note that if you set this value to a high number you may consume all +; the available process stack and eventually crash PHP (due to reaching the +; stack size limit imposed by the Operating System). +; https://php.net/pcre.recursion-limit +;pcre.recursion_limit=100000 + +; Enables or disables JIT compilation of patterns. This requires the PCRE +; library to be compiled with JIT support. +;pcre.jit=1 + +[Pdo] +; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" +; https://php.net/pdo-odbc.connection-pooling +;pdo_odbc.connection_pooling=strict + +[Pdo_mysql] +; Default socket name for local MySQL connects. If empty, uses the built-in +; MySQL defaults. +pdo_mysql.default_socket= + +[Phar] +; https://php.net/phar.readonly +;phar.readonly = On + +; https://php.net/phar.require-hash +;phar.require_hash = On + +;phar.cache_list = + +[mail function] +; For Win32 only. +; https://php.net/smtp +SMTP = localhost +; https://php.net/smtp-port +smtp_port = 25 + +; For Win32 only. +; https://php.net/sendmail-from +;sendmail_from = me@example.com + +; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). +; https://php.net/sendmail-path +;sendmail_path = + +; Force the addition of the specified parameters to be passed as extra parameters +; to the sendmail binary. These parameters will always replace the value of +; the 5th parameter to mail(). +;mail.force_extra_parameters = + +; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename +mail.add_x_header = Off + +; The path to a log file that will log all mail() calls. Log entries include +; the full path of the script, line number, To address and headers. +;mail.log = +; Log mail to syslog (Event Log on Windows). +;mail.log = syslog + +[ODBC] +; https://php.net/odbc.default-db +;odbc.default_db = Not yet implemented + +; https://php.net/odbc.default-user +;odbc.default_user = Not yet implemented + +; https://php.net/odbc.default-pw +;odbc.default_pw = Not yet implemented + +; Controls the ODBC cursor model. +; Default: SQL_CURSOR_STATIC (default). +;odbc.default_cursortype + +; Allow or prevent persistent links. +; https://php.net/odbc.allow-persistent +odbc.allow_persistent = On + +; Check that a connection is still valid before reuse. +; https://php.net/odbc.check-persistent +odbc.check_persistent = On + +; Maximum number of persistent links. -1 means no limit. +; https://php.net/odbc.max-persistent +odbc.max_persistent = -1 + +; Maximum number of links (persistent + non-persistent). -1 means no limit. +; https://php.net/odbc.max-links +odbc.max_links = -1 + +; Handling of LONG fields. Returns number of bytes to variables. 0 means +; passthru. +; https://php.net/odbc.defaultlrl +odbc.defaultlrl = 4096 + +; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. +; See the documentation on odbc_binmode and odbc_longreadlen for an explanation +; of odbc.defaultlrl and odbc.defaultbinmode +; https://php.net/odbc.defaultbinmode +odbc.defaultbinmode = 1 + +[MySQLi] + +; Maximum number of persistent links. -1 means no limit. +; https://php.net/mysqli.max-persistent +mysqli.max_persistent = -1 + +; Allow accessing, from PHP's perspective, local files with LOAD DATA statements +; https://php.net/mysqli.allow_local_infile +;mysqli.allow_local_infile = On + +; It allows the user to specify a folder where files that can be sent via LOAD DATA +; LOCAL can exist. It is ignored if mysqli.allow_local_infile is enabled. +;mysqli.local_infile_directory = + +; Allow or prevent persistent links. +; https://php.net/mysqli.allow-persistent +mysqli.allow_persistent = On + +; Maximum number of links. -1 means no limit. +; https://php.net/mysqli.max-links +mysqli.max_links = -1 + +; Default port number for mysqli_connect(). If unset, mysqli_connect() will use +; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the +; compile-time value defined MYSQL_PORT (in that order). Win32 will only look +; at MYSQL_PORT. +; https://php.net/mysqli.default-port +mysqli.default_port = 3306 + +; Default socket name for local MySQL connects. If empty, uses the built-in +; MySQL defaults. +; https://php.net/mysqli.default-socket +mysqli.default_socket = + +; Default host for mysqli_connect() (doesn't apply in safe mode). +; https://php.net/mysqli.default-host +mysqli.default_host = + +; Default user for mysqli_connect() (doesn't apply in safe mode). +; https://php.net/mysqli.default-user +mysqli.default_user = + +; Default password for mysqli_connect() (doesn't apply in safe mode). +; Note that this is generally a *bad* idea to store passwords in this file. +; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") +; and reveal this password! And of course, any users with read access to this +; file will be able to reveal the password as well. +; https://php.net/mysqli.default-pw +mysqli.default_pw = + +; Allow or prevent reconnect +mysqli.reconnect = Off + +; If this option is enabled, closing a persistent connection will rollback +; any pending transactions of this connection, before it is put back +; into the persistent connection pool. +;mysqli.rollback_on_cached_plink = Off + +[mysqlnd] +; Enable / Disable collection of general statistics by mysqlnd which can be +; used to tune and monitor MySQL operations. +mysqlnd.collect_statistics = On + +; Enable / Disable collection of memory usage statistics by mysqlnd which can be +; used to tune and monitor MySQL operations. +mysqlnd.collect_memory_statistics = Off + +; Records communication from all extensions using mysqlnd to the specified log +; file. +; https://php.net/mysqlnd.debug +;mysqlnd.debug = + +; Defines which queries will be logged. +;mysqlnd.log_mask = 0 + +; Default size of the mysqlnd memory pool, which is used by result sets. +;mysqlnd.mempool_default_size = 16000 + +; Size of a pre-allocated buffer used when sending commands to MySQL in bytes. +;mysqlnd.net_cmd_buffer_size = 2048 + +; Size of a pre-allocated buffer used for reading data sent by the server in +; bytes. +;mysqlnd.net_read_buffer_size = 32768 + +; Timeout for network requests in seconds. +;mysqlnd.net_read_timeout = 31536000 + +; SHA-256 Authentication Plugin related. File with the MySQL server public RSA +; key. +;mysqlnd.sha256_server_public_key = + +[OCI8] + +; Connection: Enables privileged connections using external +; credentials (OCI_SYSOPER, OCI_SYSDBA) +; https://php.net/oci8.privileged-connect +;oci8.privileged_connect = Off + +; Connection: The maximum number of persistent OCI8 connections per +; process. Using -1 means no limit. +; https://php.net/oci8.max-persistent +;oci8.max_persistent = -1 + +; Connection: The maximum number of seconds a process is allowed to +; maintain an idle persistent connection. Using -1 means idle +; persistent connections will be maintained forever. +; https://php.net/oci8.persistent-timeout +;oci8.persistent_timeout = -1 + +; Connection: The number of seconds that must pass before issuing a +; ping during oci_pconnect() to check the connection validity. When +; set to 0, each oci_pconnect() will cause a ping. Using -1 disables +; pings completely. +; https://php.net/oci8.ping-interval +;oci8.ping_interval = 60 + +; Connection: Set this to a user chosen connection class to be used +; for all pooled server requests with Oracle 11g Database Resident +; Connection Pooling (DRCP). To use DRCP, this value should be set to +; the same string for all web servers running the same application, +; the database pool must be configured, and the connection string must +; specify to use a pooled server. +;oci8.connection_class = + +; High Availability: Using On lets PHP receive Fast Application +; Notification (FAN) events generated when a database node fails. The +; database must also be configured to post FAN events. +;oci8.events = Off + +; Tuning: This option enables statement caching, and specifies how +; many statements to cache. Using 0 disables statement caching. +; https://php.net/oci8.statement-cache-size +;oci8.statement_cache_size = 20 + +; Tuning: Enables statement prefetching and sets the default number of +; rows that will be fetched automatically after statement execution. +; https://php.net/oci8.default-prefetch +;oci8.default_prefetch = 100 + +; Compatibility. Using On means oci_close() will not close +; oci_connect() and oci_new_connect() connections. +; https://php.net/oci8.old-oci-close-semantics +;oci8.old_oci_close_semantics = Off + +[PostgreSQL] +; Allow or prevent persistent links. +; https://php.net/pgsql.allow-persistent +pgsql.allow_persistent = On + +; Detect broken persistent links always with pg_pconnect(). +; Auto reset feature requires a little overheads. +; https://php.net/pgsql.auto-reset-persistent +pgsql.auto_reset_persistent = Off + +; Maximum number of persistent links. -1 means no limit. +; https://php.net/pgsql.max-persistent +pgsql.max_persistent = -1 + +; Maximum number of links (persistent+non persistent). -1 means no limit. +; https://php.net/pgsql.max-links +pgsql.max_links = -1 + +; Ignore PostgreSQL backends Notice message or not. +; Notice message logging require a little overheads. +; https://php.net/pgsql.ignore-notice +pgsql.ignore_notice = 0 + +; Log PostgreSQL backends Notice message or not. +; Unless pgsql.ignore_notice=0, module cannot log notice message. +; https://php.net/pgsql.log-notice +pgsql.log_notice = 0 + +[bcmath] +; Number of decimal digits for all bcmath functions. +; https://php.net/bcmath.scale +bcmath.scale = 0 + +[browscap] +; https://php.net/browscap +;browscap = extra/browscap.ini + +[Session] +; Handler used to store/retrieve data. +; https://php.net/session.save-handler +session.save_handler = files + +; Argument passed to save_handler. In the case of files, this is the path +; where data files are stored. Note: Windows users have to change this +; variable in order to use PHP's session functions. +; +; The path can be defined as: +; +; session.save_path = "N;/path" +; +; where N is an integer. Instead of storing all the session files in +; /path, what this will do is use subdirectories N-levels deep, and +; store the session data in those directories. This is useful if +; your OS has problems with many files in one directory, and is +; a more efficient layout for servers that handle many sessions. +; +; NOTE 1: PHP will not create this directory structure automatically. +; You can use the script in the ext/session dir for that purpose. +; NOTE 2: See the section on garbage collection below if you choose to +; use subdirectories for session storage +; +; The file storage module creates files using mode 600 by default. +; You can change that by using +; +; session.save_path = "N;MODE;/path" +; +; where MODE is the octal representation of the mode. Note that this +; does not overwrite the process's umask. +; https://php.net/session.save-path +;session.save_path = "/tmp" + +; Whether to use strict session mode. +; Strict session mode does not accept an uninitialized session ID, and +; regenerates the session ID if the browser sends an uninitialized session ID. +; Strict mode protects applications from session fixation via a session adoption +; vulnerability. It is disabled by default for maximum compatibility, but +; enabling it is encouraged. +; https://wiki.php.net/rfc/strict_sessions +session.use_strict_mode = 0 + +; Whether to use cookies. +; https://php.net/session.use-cookies +session.use_cookies = 1 + +; https://php.net/session.cookie-secure +;session.cookie_secure = + +; This option forces PHP to fetch and use a cookie for storing and maintaining +; the session id. We encourage this operation as it's very helpful in combating +; session hijacking when not specifying and managing your own session id. It is +; not the be-all and end-all of session hijacking defense, but it's a good start. +; https://php.net/session.use-only-cookies +session.use_only_cookies = 1 + +; Name of the session (used as cookie name). +; https://php.net/session.name +session.name = PHPSESSID + +; Initialize session on request startup. +; https://php.net/session.auto-start +session.auto_start = 0 + +; Lifetime in seconds of cookie or, if 0, until browser is restarted. +; https://php.net/session.cookie-lifetime +session.cookie_lifetime = 0 + +; The path for which the cookie is valid. +; https://php.net/session.cookie-path +session.cookie_path = / + +; The domain for which the cookie is valid. +; https://php.net/session.cookie-domain +session.cookie_domain = + +; Whether or not to add the httpOnly flag to the cookie, which makes it +; inaccessible to browser scripting languages such as JavaScript. +; https://php.net/session.cookie-httponly +session.cookie_httponly = + +; Add SameSite attribute to cookie to help mitigate Cross-Site Request Forgery (CSRF/XSRF) +; Current valid values are "Strict", "Lax" or "None". When using "None", +; make sure to include the quotes, as `none` is interpreted like `false` in ini files. +; https://tools.ietf.org/html/draft-west-first-party-cookies-07 +session.cookie_samesite = + +; Handler used to serialize data. php is the standard serializer of PHP. +; https://php.net/session.serialize-handler +session.serialize_handler = php + +; Defines the probability that the 'garbage collection' process is started on every +; session initialization. The probability is calculated by using gc_probability/gc_divisor, +; e.g. 1/100 means there is a 1% chance that the GC process starts on each request. +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; https://php.net/session.gc-probability +session.gc_probability = 1 + +; Defines the probability that the 'garbage collection' process is started on every +; session initialization. The probability is calculated by using gc_probability/gc_divisor, +; e.g. 1/100 means there is a 1% chance that the GC process starts on each request. +; For high volume production servers, using a value of 1000 is a more efficient approach. +; Default Value: 100 +; Development Value: 1000 +; Production Value: 1000 +; https://php.net/session.gc-divisor +session.gc_divisor = 1000 + +; After this number of seconds, stored data will be seen as 'garbage' and +; cleaned up by the garbage collection process. +; https://php.net/session.gc-maxlifetime +session.gc_maxlifetime = 1440 + +; NOTE: If you are using the subdirectory option for storing session files +; (see session.save_path above), then garbage collection does *not* +; happen automatically. You will need to do your own garbage +; collection through a shell script, cron entry, or some other method. +; For example, the following script is the equivalent of setting +; session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): +; find /path/to/sessions -cmin +24 -type f | xargs rm + +; Check HTTP Referer to invalidate externally stored URLs containing ids. +; HTTP_REFERER has to contain this substring for the session to be +; considered as valid. +; https://php.net/session.referer-check +session.referer_check = + +; Set to {nocache,private,public,} to determine HTTP caching aspects +; or leave this empty to avoid sending anti-caching headers. +; https://php.net/session.cache-limiter +session.cache_limiter = nocache + +; Document expires after n minutes. +; https://php.net/session.cache-expire +session.cache_expire = 180 + +; trans sid support is disabled by default. +; Use of trans sid may risk your users' security. +; Use this option with caution. +; - User may send URL contains active session ID +; to other person via. email/irc/etc. +; - URL that contains active session ID may be stored +; in publicly accessible computer. +; - User may access your site with the same session ID +; always using URL stored in browser's history or bookmarks. +; https://php.net/session.use-trans-sid +session.use_trans_sid = 0 + +; Set session ID character length. This value could be between 22 to 256. +; Shorter length than default is supported only for compatibility reason. +; Users should use 32 or more chars. +; https://php.net/session.sid-length +; Default Value: 32 +; Development Value: 26 +; Production Value: 26 +session.sid_length = 26 + +; The URL rewriter will look for URLs in a defined set of HTML tags. +; <form> is special; if you include them here, the rewriter will +; add a hidden <input> field with the info which is otherwise appended +; to URLs. <form> tag's action attribute URL will not be modified +; unless it is specified. +; Note that all valid entries require a "=", even if no value follows. +; Default Value: "a=href,area=href,frame=src,form=" +; Development Value: "a=href,area=href,frame=src,form=" +; Production Value: "a=href,area=href,frame=src,form=" +; https://php.net/url-rewriter.tags +session.trans_sid_tags = "a=href,area=href,frame=src,form=" + +; URL rewriter does not rewrite absolute URLs by default. +; To enable rewrites for absolute paths, target hosts must be specified +; at RUNTIME. i.e. use ini_set() +; <form> tags is special. PHP will check action attribute's URL regardless +; of session.trans_sid_tags setting. +; If no host is defined, HTTP_HOST will be used for allowed host. +; Example value: php.net,www.php.net,wiki.php.net +; Use "," for multiple hosts. No spaces are allowed. +; Default Value: "" +; Development Value: "" +; Production Value: "" +;session.trans_sid_hosts="" + +; Define how many bits are stored in each character when converting +; the binary hash data to something readable. +; Possible values: +; 4 (4 bits: 0-9, a-f) +; 5 (5 bits: 0-9, a-v) +; 6 (6 bits: 0-9, a-z, A-Z, "-", ",") +; Default Value: 4 +; Development Value: 5 +; Production Value: 5 +; https://php.net/session.hash-bits-per-character +session.sid_bits_per_character = 5 + +; Enable upload progress tracking in $_SESSION +; Default Value: On +; Development Value: On +; Production Value: On +; https://php.net/session.upload-progress.enabled +;session.upload_progress.enabled = On + +; Cleanup the progress information as soon as all POST data has been read +; (i.e. upload completed). +; Default Value: On +; Development Value: On +; Production Value: On +; https://php.net/session.upload-progress.cleanup +;session.upload_progress.cleanup = On + +; A prefix used for the upload progress key in $_SESSION +; Default Value: "upload_progress_" +; Development Value: "upload_progress_" +; Production Value: "upload_progress_" +; https://php.net/session.upload-progress.prefix +;session.upload_progress.prefix = "upload_progress_" + +; The index name (concatenated with the prefix) in $_SESSION +; containing the upload progress information +; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" +; https://php.net/session.upload-progress.name +;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" + +; How frequently the upload progress should be updated. +; Given either in percentages (per-file), or in bytes +; Default Value: "1%" +; Development Value: "1%" +; Production Value: "1%" +; https://php.net/session.upload-progress.freq +;session.upload_progress.freq = "1%" + +; The minimum delay between updates, in seconds +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; https://php.net/session.upload-progress.min-freq +;session.upload_progress.min_freq = "1" + +; Only write session data when session data is changed. Enabled by default. +; https://php.net/session.lazy-write +;session.lazy_write = On + +[Assertion] +; Switch whether to compile assertions at all (to have no overhead at run-time) +; -1: Do not compile at all +; 0: Jump over assertion at run-time +; 1: Execute assertions +; Changing from or to a negative value is only possible in php.ini! (For turning assertions on and off at run-time, see assert.active, when zend.assertions = 1) +; Default Value: 1 +; Development Value: 1 +; Production Value: -1 +; https://php.net/zend.assertions +zend.assertions = -1 + +; Assert(expr); active by default. +; https://php.net/assert.active +;assert.active = On + +; Throw an AssertionError on failed assertions +; https://php.net/assert.exception +;assert.exception = On + +; Issue a PHP warning for each failed assertion. (Overridden by assert.exception if active) +; https://php.net/assert.warning +;assert.warning = On + +; Don't bail out by default. +; https://php.net/assert.bail +;assert.bail = Off + +; User-function to be called if an assertion fails. +; https://php.net/assert.callback +;assert.callback = 0 + +[COM] +; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs +; https://php.net/com.typelib-file +;com.typelib_file = + +; allow Distributed-COM calls +; https://php.net/com.allow-dcom +;com.allow_dcom = true + +; autoregister constants of a component's typelib on com_load() +; https://php.net/com.autoregister-typelib +;com.autoregister_typelib = true + +; register constants casesensitive +; https://php.net/com.autoregister-casesensitive +;com.autoregister_casesensitive = false + +; show warnings on duplicate constant registrations +; https://php.net/com.autoregister-verbose +;com.autoregister_verbose = true + +; The default character set code-page to use when passing strings to and from COM objects. +; Default: system ANSI code page +;com.code_page= + +; The version of the .NET framework to use. The value of the setting are the first three parts +; of the framework's version number, separated by dots, and prefixed with "v", e.g. "v4.0.30319". +;com.dotnet_version= + +[mbstring] +; language for internal character representation. +; This affects mb_send_mail() and mbstring.detect_order. +; https://php.net/mbstring.language +;mbstring.language = Japanese + +; Use of this INI entry is deprecated, use global internal_encoding instead. +; internal/script encoding. +; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding +;mbstring.internal_encoding = + +; Use of this INI entry is deprecated, use global input_encoding instead. +; http input encoding. +; mbstring.encoding_translation = On is needed to use this setting. +; If empty, default_charset or input_encoding or mbstring.input is used. +; The precedence is: default_charset < input_encoding < mbstring.http_input +; https://php.net/mbstring.http-input +;mbstring.http_input = + +; Use of this INI entry is deprecated, use global output_encoding instead. +; http output encoding. +; mb_output_handler must be registered as output buffer to function. +; If empty, default_charset or output_encoding or mbstring.http_output is used. +; The precedence is: default_charset < output_encoding < mbstring.http_output +; To use an output encoding conversion, mbstring's output handler must be set +; otherwise output encoding conversion cannot be performed. +; https://php.net/mbstring.http-output +;mbstring.http_output = + +; enable automatic encoding translation according to +; mbstring.internal_encoding setting. Input chars are +; converted to internal encoding by setting this to On. +; Note: Do _not_ use automatic encoding translation for +; portable libs/applications. +; https://php.net/mbstring.encoding-translation +;mbstring.encoding_translation = Off + +; automatic encoding detection order. +; "auto" detect order is changed according to mbstring.language +; https://php.net/mbstring.detect-order +;mbstring.detect_order = auto + +; substitute_character used when character cannot be converted +; one from another +; https://php.net/mbstring.substitute-character +;mbstring.substitute_character = none + +; Enable strict encoding detection. +;mbstring.strict_detection = Off + +; This directive specifies the regex pattern of content types for which mb_output_handler() +; is activated. +; Default: mbstring.http_output_conv_mimetypes=^(text/|application/xhtml\+xml) +;mbstring.http_output_conv_mimetypes= + +; This directive specifies maximum stack depth for mbstring regular expressions. It is similar +; to the pcre.recursion_limit for PCRE. +;mbstring.regex_stack_limit=100000 + +; This directive specifies maximum retry count for mbstring regular expressions. It is similar +; to the pcre.backtrack_limit for PCRE. +;mbstring.regex_retry_limit=1000000 + +[gd] +; Tell the jpeg decode to ignore warnings and try to create +; a gd image. The warning will then be displayed as notices +; disabled by default +; https://php.net/gd.jpeg-ignore-warning +;gd.jpeg_ignore_warning = 1 + +[exif] +; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. +; With mbstring support this will automatically be converted into the encoding +; given by corresponding encode setting. When empty mbstring.internal_encoding +; is used. For the decode settings you can distinguish between motorola and +; intel byte order. A decode setting cannot be empty. +; https://php.net/exif.encode-unicode +;exif.encode_unicode = ISO-8859-15 + +; https://php.net/exif.decode-unicode-motorola +;exif.decode_unicode_motorola = UCS-2BE + +; https://php.net/exif.decode-unicode-intel +;exif.decode_unicode_intel = UCS-2LE + +; https://php.net/exif.encode-jis +;exif.encode_jis = + +; https://php.net/exif.decode-jis-motorola +;exif.decode_jis_motorola = JIS + +; https://php.net/exif.decode-jis-intel +;exif.decode_jis_intel = JIS + +[Tidy] +; The path to a default tidy configuration file to use when using tidy +; https://php.net/tidy.default-config +;tidy.default_config = /usr/local/lib/php/default.tcfg + +; Should tidy clean and repair output automatically? +; WARNING: Do not use this option if you are generating non-html content +; such as dynamic images +; https://php.net/tidy.clean-output +tidy.clean_output = Off + +[soap] +; Enables or disables WSDL caching feature. +; https://php.net/soap.wsdl-cache-enabled +soap.wsdl_cache_enabled=1 + +; Sets the directory name where SOAP extension will put cache files. +; https://php.net/soap.wsdl-cache-dir +soap.wsdl_cache_dir="/tmp" + +; (time to live) Sets the number of second while cached file will be used +; instead of original one. +; https://php.net/soap.wsdl-cache-ttl +soap.wsdl_cache_ttl=86400 + +; Sets the size of the cache limit. (Max. number of WSDL files to cache) +soap.wsdl_cache_limit = 5 + +[sysvshm] +; A default size of the shared memory segment +;sysvshm.init_mem = 10000 + +[ldap] +; Sets the maximum number of open links or -1 for unlimited. +ldap.max_links = -1 + +[dba] +;dba.default_handler= + +[opcache] +; Determines if Zend OPCache is enabled +;opcache.enable=1 + +; Determines if Zend OPCache is enabled for the CLI version of PHP +;opcache.enable_cli=0 + +; The OPcache shared memory storage size. +;opcache.memory_consumption=128 + +; The amount of memory for interned strings in Mbytes. +;opcache.interned_strings_buffer=8 + +; The maximum number of keys (scripts) in the OPcache hash table. +; Only numbers between 200 and 1000000 are allowed. +;opcache.max_accelerated_files=10000 + +; The maximum percentage of "wasted" memory until a restart is scheduled. +;opcache.max_wasted_percentage=5 + +; When this directive is enabled, the OPcache appends the current working +; directory to the script key, thus eliminating possible collisions between +; files with the same name (basename). Disabling the directive improves +; performance, but may break existing applications. +;opcache.use_cwd=1 + +; When disabled, you must reset the OPcache manually or restart the +; webserver for changes to the filesystem to take effect. +;opcache.validate_timestamps=1 + +; How often (in seconds) to check file timestamps for changes to the shared +; memory storage allocation. ("1" means validate once per second, but only +; once per request. "0" means always validate) +;opcache.revalidate_freq=2 + +; Enables or disables file search in include_path optimization +;opcache.revalidate_path=0 + +; If disabled, all PHPDoc comments are dropped from the code to reduce the +; size of the optimized code. +;opcache.save_comments=1 + +; If enabled, compilation warnings (including notices and deprecations) will +; be recorded and replayed each time a file is included. Otherwise, compilation +; warnings will only be emitted when the file is first cached. +;opcache.record_warnings=0 + +; Allow file existence override (file_exists, etc.) performance feature. +;opcache.enable_file_override=0 + +; A bitmask, where each bit enables or disables the appropriate OPcache +; passes +;opcache.optimization_level=0x7FFFBFFF + +;opcache.dups_fix=0 + +; The location of the OPcache blacklist file (wildcards allowed). +; Each OPcache blacklist file is a text file that holds the names of files +; that should not be accelerated. The file format is to add each filename +; to a new line. The filename may be a full path or just a file prefix +; (i.e., /var/www/x blacklists all the files and directories in /var/www +; that start with 'x'). Line starting with a ; are ignored (comments). +;opcache.blacklist_filename= + +; Allows exclusion of large files from being cached. By default all files +; are cached. +;opcache.max_file_size=0 + +; Check the cache checksum each N requests. +; The default value of "0" means that the checks are disabled. +;opcache.consistency_checks=0 + +; How long to wait (in seconds) for a scheduled restart to begin if the cache +; is not being accessed. +;opcache.force_restart_timeout=180 + +; OPcache error_log file name. Empty string assumes "stderr". +;opcache.error_log= + +; All OPcache errors go to the Web server log. +; By default, only fatal errors (level 0) or errors (level 1) are logged. +; You can also enable warnings (level 2), info messages (level 3) or +; debug messages (level 4). +;opcache.log_verbosity_level=1 + +; Preferred Shared Memory back-end. Leave empty and let the system decide. +;opcache.preferred_memory_model= + +; Protect the shared memory from unexpected writing during script execution. +; Useful for internal debugging only. +;opcache.protect_memory=0 + +; Allows calling OPcache API functions only from PHP scripts which path is +; started from specified string. The default "" means no restriction +;opcache.restrict_api= + +; Mapping base of shared memory segments (for Windows only). All the PHP +; processes have to map shared memory into the same address space. This +; directive allows to manually fix the "Unable to reattach to base address" +; errors. +;opcache.mmap_base= + +; Facilitates multiple OPcache instances per user (for Windows only). All PHP +; processes with the same cache ID and user share an OPcache instance. +;opcache.cache_id= + +; Enables and sets the second level cache directory. +; It should improve performance when SHM memory is full, at server restart or +; SHM reset. The default "" disables file based caching. +;opcache.file_cache= + +; Enables or disables opcode caching in shared memory. +;opcache.file_cache_only=0 + +; Enables or disables checksum validation when script loaded from file cache. +;opcache.file_cache_consistency_checks=1 + +; Implies opcache.file_cache_only=1 for a certain process that failed to +; reattach to the shared memory (for Windows only). Explicitly enabled file +; cache is required. +;opcache.file_cache_fallback=1 + +; Enables or disables copying of PHP code (text segment) into HUGE PAGES. +; This should improve performance, but requires appropriate OS configuration. +;opcache.huge_code_pages=1 + +; Validate cached file permissions. +;opcache.validate_permission=0 + +; Prevent name collisions in chroot'ed environment. +;opcache.validate_root=0 + +; If specified, it produces opcode dumps for debugging different stages of +; optimizations. +;opcache.opt_debug_level=0 + +; Specifies a PHP script that is going to be compiled and executed at server +; start-up. +; https://php.net/opcache.preload +;opcache.preload= + +; Preloading code as root is not allowed for security reasons. This directive +; facilitates to let the preloading to be run as another user. +; https://php.net/opcache.preload_user +;opcache.preload_user= + +; Prevents caching files that are less than this number of seconds old. It +; protects from caching of incompletely updated files. In case all file updates +; on your site are atomic, you may increase performance by setting it to "0". +;opcache.file_update_protection=2 + +; Absolute path used to store shared lockfiles (for *nix only). +;opcache.lockfile_path=/tmp + +[curl] +; A default value for the CURLOPT_CAINFO option. This is required to be an +; absolute path. +;curl.cainfo = + +[openssl] +; The location of a Certificate Authority (CA) file on the local filesystem +; to use when verifying the identity of SSL/TLS peers. Most users should +; not specify a value for this directive as PHP will attempt to use the +; OS-managed cert stores in its absence. If specified, this value may still +; be overridden on a per-stream basis via the "cafile" SSL stream context +; option. +;openssl.cafile= + +; If openssl.cafile is not specified or if the CA file is not found, the +; directory pointed to by openssl.capath is searched for a suitable +; certificate. This value must be a correctly hashed certificate directory. +; Most users should not specify a value for this directive as PHP will +; attempt to use the OS-managed cert stores in its absence. If specified, +; this value may still be overridden on a per-stream basis via the "capath" +; SSL stream context option. +;openssl.capath= + +[ffi] +; FFI API restriction. Possible values: +; "preload" - enabled in CLI scripts and preloaded files (default) +; "false" - always disabled +; "true" - always enabled +;ffi.enable=preload + +; List of headers files to preload, wildcard patterns allowed. +;ffi.preload= diff --git a/recipes-devtools/php/files/zabbix-fpm.conf b/recipes-devtools/php/files/zabbix-fpm.conf new file mode 100644 index 0000000..fd96aa1 --- /dev/null +++ b/recipes-devtools/php/files/zabbix-fpm.conf @@ -0,0 +1,24 @@ +[zabbix] +user = www-data +group = www-data + +listen = /var/run/php/zabbix.sock +listen.owner = www-data +listen.allowed_clients = 127.0.0.1 + +pm = dynamic +pm.max_children = 50 +pm.start_servers = 5 +pm.min_spare_servers = 5 +pm.max_spare_servers = 35 +pm.max_requests = 200 + +php_value[session.save_handler] = files +php_value[session.save_path] = /var/lib/php/sessions/ + +php_value[max_execution_time] = 300 +php_value[memory_limit] = 128M +php_value[post_max_size] = 16M +php_value[upload_max_filesize] = 2M +php_value[max_input_time] = 300 +php_value[max_input_vars] = 10000 diff --git a/recipes-devtools/php/php/0001-configure.ac-don-t-include-build-libtool.m4.patch b/recipes-devtools/php/php/0001-configure.ac-don-t-include-build-libtool.m4.patch new file mode 100644 index 0000000..2861366 --- /dev/null +++ b/recipes-devtools/php/php/0001-configure.ac-don-t-include-build-libtool.m4.patch @@ -0,0 +1,30 @@ +From f5a34e771532b8433f307b679500c26af328ba35 Mon Sep 17 00:00:00 2001 +From: Changqing Li <changqing.li@windriver.com> +Date: Fri, 17 Apr 2020 15:01:57 +0800 +Subject: [PATCH] configure.ac: don't include build/libtool.m4 + +we delete build/libtool.m4 before do_configure, +we will use libtool.m4 under ACLOCALDIR + +Upstream-Status: Inappropriate [oe-specific] + +Signed-off-by: Changqing Li <changqing.li@windriver.com> +--- + configure.ac | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 06c6a27..f85144e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -6,7 +6,6 @@ dnl ---------------------------------------------------------------------------- + m4_include([build/ax_check_compile_flag.m4]) + m4_include([build/ax_func_which_gethostbyname_r.m4]) + m4_include([build/ax_gcc_func_attribute.m4]) +-m4_include([build/libtool.m4]) + m4_include([build/php_cxx_compile_stdcxx.m4]) + m4_include([build/php.m4]) + m4_include([build/pkg.m4]) +-- +2.7.4 + diff --git a/recipes-devtools/php/php/0001-opcache-config.m4-enable-opcache.patch b/recipes-devtools/php/php/0001-opcache-config.m4-enable-opcache.patch new file mode 100644 index 0000000..1f3e683 --- /dev/null +++ b/recipes-devtools/php/php/0001-opcache-config.m4-enable-opcache.patch @@ -0,0 +1,237 @@ +From a74b42098aededd296ec6a3cd4cf5a17e59d6f29 Mon Sep 17 00:00:00 2001 +From: Claude Bing <cbing@cybernetics.com> +Date: Fri, 8 May 2020 10:15:32 -0400 +Subject: [PATCH] opcache/config.m4: enable opcache + +We can't use AC_TRY_RUN to run programs in a cross compile environment. +Set +the variables directly instead since we know that we'd be running on +latest +enough linux kernel. + +Upstream-Status: Inappropriate [Configuration] + +Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> + +update patch to version 7.4.4 +Signed-off-by: Changqing Li <changqing.li@windriver.com> + +fix issue linking with librt +Signed-off-by: Claude Bing <cbing@cybernetics.com> +--- + ext/opcache/config.m4 | 195 +----------------------------------------- + 1 file changed, 4 insertions(+), 191 deletions(-) + +diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 +index 6c40cafc1c..6569aa9e1c 100644 +--- a/ext/opcache/config.m4 ++++ b/ext/opcache/config.m4 +@@ -23,201 +23,14 @@ if test "$PHP_OPCACHE" != "no"; then + AC_CHECK_FUNCS([mprotect]) + + AC_MSG_CHECKING(for sysvipc shared memory support) +- AC_RUN_IFELSE([AC_LANG_SOURCE([[ +-#include <sys/types.h> +-#include <sys/wait.h> +-#include <sys/ipc.h> +-#include <sys/shm.h> +-#include <unistd.h> +-#include <string.h> +- +-int main() { +- pid_t pid; +- int status; +- int ipc_id; +- char *shm; +- struct shmid_ds shmbuf; +- +- ipc_id = shmget(IPC_PRIVATE, 4096, (IPC_CREAT | SHM_R | SHM_W)); +- if (ipc_id == -1) { +- return 1; +- } +- +- shm = shmat(ipc_id, NULL, 0); +- if (shm == (void *)-1) { +- shmctl(ipc_id, IPC_RMID, NULL); +- return 2; +- } +- +- if (shmctl(ipc_id, IPC_STAT, &shmbuf) != 0) { +- shmdt(shm); +- shmctl(ipc_id, IPC_RMID, NULL); +- return 3; +- } +- +- shmbuf.shm_perm.uid = getuid(); +- shmbuf.shm_perm.gid = getgid(); +- shmbuf.shm_perm.mode = 0600; +- +- if (shmctl(ipc_id, IPC_SET, &shmbuf) != 0) { +- shmdt(shm); +- shmctl(ipc_id, IPC_RMID, NULL); +- return 4; +- } +- +- shmctl(ipc_id, IPC_RMID, NULL); +- +- strcpy(shm, "hello"); +- +- pid = fork(); +- if (pid < 0) { +- return 5; +- } else if (pid == 0) { +- strcpy(shm, "bye"); +- return 6; +- } +- if (wait(&status) != pid) { +- return 7; +- } +- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { +- return 8; +- } +- if (strcmp(shm, "bye") != 0) { +- return 9; +- } +- return 0; +-} +-]])],[dnl +- AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support]) +- msg=yes],[msg=no],[msg=no]) +- AC_MSG_RESULT([$msg]) ++ AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support]) + + AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support) +- AC_RUN_IFELSE([AC_LANG_SOURCE([[ +-#include <sys/types.h> +-#include <sys/wait.h> +-#include <sys/mman.h> +-#include <unistd.h> +-#include <string.h> +- +-#ifndef MAP_ANON +-# ifdef MAP_ANONYMOUS +-# define MAP_ANON MAP_ANONYMOUS +-# endif +-#endif +-#ifndef MAP_FAILED +-# define MAP_FAILED ((void*)-1) +-#endif ++ AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) + +-int main() { +- pid_t pid; +- int status; +- char *shm; +- +- shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); +- if (shm == MAP_FAILED) { +- return 1; +- } +- +- strcpy(shm, "hello"); +- +- pid = fork(); +- if (pid < 0) { +- return 5; +- } else if (pid == 0) { +- strcpy(shm, "bye"); +- return 6; +- } +- if (wait(&status) != pid) { +- return 7; +- } +- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { +- return 8; +- } +- if (strcmp(shm, "bye") != 0) { +- return 9; +- } +- return 0; +-} +-]])],[dnl +- AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) +- msg=yes],[msg=no],[msg=no]) +- AC_MSG_RESULT([$msg]) +- +- PHP_CHECK_FUNC_LIB(shm_open, rt) + AC_MSG_CHECKING(for mmap() using shm_open() shared memory support) +- AC_RUN_IFELSE([AC_LANG_SOURCE([[ +-#include <sys/types.h> +-#include <sys/wait.h> +-#include <sys/mman.h> +-#include <sys/stat.h> +-#include <fcntl.h> +-#include <unistd.h> +-#include <string.h> +-#include <stdlib.h> +-#include <stdio.h> +- +-#ifndef MAP_FAILED +-# define MAP_FAILED ((void*)-1) +-#endif +- +-int main() { +- pid_t pid; +- int status; +- int fd; +- char *shm; +- char tmpname[4096]; +- +- sprintf(tmpname,"/opcache.test.shm.%dXXXXXX", getpid()); +- if (mktemp(tmpname) == NULL) { +- return 1; +- } +- fd = shm_open(tmpname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); +- if (fd == -1) { +- return 2; +- } +- if (ftruncate(fd, 4096) < 0) { +- close(fd); +- shm_unlink(tmpname); +- return 3; +- } +- +- shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); +- if (shm == MAP_FAILED) { +- return 4; +- } +- shm_unlink(tmpname); +- close(fd); +- +- strcpy(shm, "hello"); +- +- pid = fork(); +- if (pid < 0) { +- return 5; +- } else if (pid == 0) { +- strcpy(shm, "bye"); +- return 6; +- } +- if (wait(&status) != pid) { +- return 7; +- } +- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { +- return 8; +- } +- if (strcmp(shm, "bye") != 0) { +- return 9; +- } +- return 0; +-} +-]])],[dnl +- AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) +- AC_MSG_RESULT([yes]) +- PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)]) +- ],[ +- AC_MSG_RESULT([no]) +- ],[ +- AC_MSG_RESULT([no]) +- ]) ++ AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) ++ PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)]) + + PHP_NEW_EXTENSION(opcache, + ZendAccelerator.c \ +-- +2.17.1 + diff --git a/recipes-devtools/php/php/0001-php-don-t-use-broken-wrapper-for-mkdir.patch b/recipes-devtools/php/php/0001-php-don-t-use-broken-wrapper-for-mkdir.patch new file mode 100644 index 0000000..d687373 --- /dev/null +++ b/recipes-devtools/php/php/0001-php-don-t-use-broken-wrapper-for-mkdir.patch @@ -0,0 +1,29 @@ +From ebc101e0728b9db6c687cff525e5dfc8eb0edbf3 Mon Sep 17 00:00:00 2001 +From: Koen Kooi <koen@dominion.thruhere.net> +Date: Thu, 3 Nov 2011 14:27:15 +0100 +Subject: [PATCH 2/8] php: don't use broken wrapper for mkdir + +Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> + +update patch to version 7.4.4 +Signed-off-by: Changqing Li <changqing.li@windriver.com> +--- + +Upstream-Status: Inappropriate + + build/Makefile.global | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/build/Makefile.global b/build/Makefile.global +index ff858c2..ae554b4 100644 +--- a/build/Makefile.global ++++ b/build/Makefile.global +@@ -1,4 +1,4 @@ +-mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p ++mkinstalldirs = mkdir -p + INSTALL = $(top_srcdir)/build/shtool install -c + INSTALL_DATA = $(INSTALL) -m 644 + +-- +1.9.3 + diff --git a/recipes-devtools/php/php/0001-php.m4-don-t-unset-cache-variables.patch b/recipes-devtools/php/php/0001-php.m4-don-t-unset-cache-variables.patch new file mode 100644 index 0000000..0d721ec --- /dev/null +++ b/recipes-devtools/php/php/0001-php.m4-don-t-unset-cache-variables.patch @@ -0,0 +1,39 @@ +php.m4: don't unset cache variables + +Unsetting prevents cache variable from being passed to configure. + +Upstream-Status: Inappropriate [OE-specific] + +Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> + +update this patch to 7.4.4, acinclude.m4 move to build/php.m4 +Signed-off-by: Changqing Li <changqing.li@windriver.com> +--- + build/php.m4 | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/build/php.m4 b/build/php.m4 +index 5c45d13..218ec47 100644 +--- a/build/php.m4 ++++ b/build/php.m4 +@@ -1587,8 +1587,6 @@ dnl PHP_CHECK_FUNC_LIB + dnl + AC_DEFUN([PHP_CHECK_FUNC_LIB],[ + ifelse($2,,:,[ +- unset ac_cv_lib_$2[]_$1 +- unset ac_cv_lib_$2[]___$1 + unset found + AC_CHECK_LIB($2, $1, [found=yes], [ + AC_CHECK_LIB($2, __$1, [found=yes], [found=no]) +@@ -1620,8 +1618,6 @@ dnl and as a fall back in the specified library. Defines HAVE_func and + dnl HAVE_library if found and adds the library to LIBS. + dnl + AC_DEFUN([PHP_CHECK_FUNC],[ +- unset ac_cv_func_$1 +- unset ac_cv_func___$1 + unset found + + AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ]) +-- +2.7.4 + diff --git a/recipes-devtools/php/php/70_mod_php7.conf b/recipes-devtools/php/php/70_mod_php7.conf new file mode 100644 index 0000000..d206265 --- /dev/null +++ b/recipes-devtools/php/php/70_mod_php7.conf @@ -0,0 +1,9 @@ +LoadModule php7_module lib/apache2/modules/libphp7.so + +<FilesMatch "\.ph(p[2-7]?|tml)$"> + SetHandler application/x-httpd-php +</FilesMatch> + +<FilesMatch "\.phps$"> + SetHandler application/x-httpd-php-source +</FilesMatch> diff --git a/recipes-devtools/php/php/CVE-2023-3247-1.patch b/recipes-devtools/php/php/CVE-2023-3247-1.patch new file mode 100644 index 0000000..db9e417 --- /dev/null +++ b/recipes-devtools/php/php/CVE-2023-3247-1.patch @@ -0,0 +1,87 @@ +From ac4254ad764c70cb1f05c9270d8d12689fc3aeb6 Mon Sep 17 00:00:00 2001 +From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> +Date: Sun, 16 Apr 2023 15:05:03 +0200 +Subject: [PATCH] Fix missing randomness check and insufficient random bytes + for SOAP HTTP Digest +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If php_random_bytes_throw fails, the nonce will be uninitialized, but +still sent to the server. The client nonce is intended to protect +against a malicious server. See section 5.10 and 5.12 of RFC 7616 [1], +and bullet point 2 below. + +Tim pointed out that even though it's the MD5 of the nonce that gets sent, +enumerating 31 bits is trivial. So we have still a stack information leak +of 31 bits. + +Furthermore, Tim found the following issues: +* The small size of cnonce might cause the server to erroneously reject + a request due to a repeated (cnonce, nc) pair. As per the birthday + problem 31 bits of randomness will return a duplication with 50% + chance after less than 55000 requests and nc always starts counting at 1. +* The cnonce is intended to protect the client and password against a + malicious server that returns a constant server nonce where the server + precomputed a rainbow table between passwords and correct client response. + As storage is fairly cheap, a server could precompute the client responses + for (a subset of) client nonces and still have a chance of reversing the + client response with the same probability as the cnonce duplication. + + Precomputing the rainbow table for all 2^31 cnonces increases the rainbow + table size by factor 2 billion, which is infeasible. But precomputing it + for 2^14 cnonces only increases the table size by factor 16k and the server + would still have a 10% chance of successfully reversing a password with a + single client request. + +This patch fixes the issues by increasing the nonce size, and checking +the return value of php_random_bytes_throw(). In the process we also get +rid of the MD5 hashing of the nonce. + +[1] RFC 7616: https://www.rfc-editor.org/rfc/rfc7616 + +Co-authored-by: Tim Düsterhus <timwolla@php.net> + +Upstream-Status: Backport [https://github.com/php/php-src/commit/ac4254ad764c70cb1f05c9270d8d12689fc3aeb6] +CVE: CVE-2023-3247 +Signed-off-by: Ashish Sharma <asharma@mvista.com> + + ext/soap/php_http.c | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c +index 1da286ad875f..e796dba9619a 100644 +--- a/ext/soap/php_http.c ++++ b/ext/soap/php_http.c +@@ -664,18 +664,23 @@ int make_http_soap_request(zval *this_ptr, + if ((digest = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest")-1)) != NULL) { + if (Z_TYPE_P(digest) == IS_ARRAY) { + char HA1[33], HA2[33], response[33], cnonce[33], nc[9]; +- zend_long nonce; ++ unsigned char nonce[16]; + PHP_MD5_CTX md5ctx; + unsigned char hash[16]; + +- php_random_bytes_throw(&nonce, sizeof(nonce)); +- nonce &= 0x7fffffff; ++ if (UNEXPECTED(php_random_bytes_throw(&nonce, sizeof(nonce)) != SUCCESS)) { ++ ZEND_ASSERT(EG(exception)); ++ php_stream_close(stream); ++ convert_to_null(Z_CLIENT_HTTPURL_P(this_ptr)); ++ convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr)); ++ convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr)); ++ smart_str_free(&soap_headers_z); ++ smart_str_free(&soap_headers); ++ return FALSE; ++ } + +- PHP_MD5Init(&md5ctx); +- snprintf(cnonce, sizeof(cnonce), ZEND_LONG_FMT, nonce); +- PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, strlen(cnonce)); +- PHP_MD5Final(hash, &md5ctx); +- make_digest(cnonce, hash); ++ php_hash_bin2hex(cnonce, nonce, sizeof(nonce)); ++ cnonce[32] = 0; + + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nc", sizeof("nc")-1)) != NULL && + Z_TYPE_P(tmp) == IS_LONG) { diff --git a/recipes-devtools/php/php/CVE-2023-3247-2.patch b/recipes-devtools/php/php/CVE-2023-3247-2.patch new file mode 100644 index 0000000..80c1961 --- /dev/null +++ b/recipes-devtools/php/php/CVE-2023-3247-2.patch @@ -0,0 +1,29 @@ +From 32c7c433ac1983c4497349051681a4f361d3d33e Mon Sep 17 00:00:00 2001 +From: Pierrick Charron <pierrick@php.net> +Date: Tue, 6 Jun 2023 18:49:32 -0400 +Subject: [PATCH] Fix wrong backporting of previous soap patch + +Upstream-Status: Backport [https://github.com/php/php-src/commit/32c7c433ac1983c4497349051681a4f361d3d33e] +CVE: CVE-2023-3247 +Signed-off-by: Ashish Sharma <asharma@mvista.com> + + ext/soap/php_http.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c +index 77ed21d4f0f4..37250a6bdcd1 100644 +--- a/ext/soap/php_http.c ++++ b/ext/soap/php_http.c +@@ -672,9 +672,9 @@ int make_http_soap_request(zval *this_ptr, + if (UNEXPECTED(php_random_bytes_throw(&nonce, sizeof(nonce)) != SUCCESS)) { + ZEND_ASSERT(EG(exception)); + php_stream_close(stream); +- convert_to_null(Z_CLIENT_HTTPURL_P(this_ptr)); +- convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr)); +- convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr)); ++ zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl")-1); ++ zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1); ++ zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1); + smart_str_free(&soap_headers_z); + smart_str_free(&soap_headers); + return FALSE; diff --git a/recipes-devtools/php/php/CVE-2023-3824.patch b/recipes-devtools/php/php/CVE-2023-3824.patch new file mode 100644 index 0000000..953b525 --- /dev/null +++ b/recipes-devtools/php/php/CVE-2023-3824.patch @@ -0,0 +1,91 @@ +From 80316123f3e9dcce8ac419bd9dd43546e2ccb5ef Mon Sep 17 00:00:00 2001 +From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> +Date: Mon, 10 Jul 2023 13:25:34 +0200 +Subject: [PATCH] Fix buffer mismanagement in phar_dir_read() + +Fixes GHSA-jqcx-ccgc-xwhv. + +Upstream-Status: Backport from [https://github.com/php/php-src/commit/80316123f3e9dcce8ac419bd9dd43546e2ccb5ef] +CVE: CVE-2023-3824 +Signed-off-by: Siddharth Doshi <sdoshi@mvista.com> +--- + ext/phar/dirstream.c | 15 ++++++++------ + ext/phar/tests/GHSA-jqcx-ccgc-xwhv.phpt | 27 +++++++++++++++++++++++++ + 2 files changed, 36 insertions(+), 6 deletions(-) + create mode 100644 ext/phar/tests/GHSA-jqcx-ccgc-xwhv.phpt + +diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c +index 4710703c..490b1452 100644 +--- a/ext/phar/dirstream.c ++++ b/ext/phar/dirstream.c +@@ -91,25 +91,28 @@ static int phar_dir_seek(php_stream *stream, zend_off_t offset, int whence, zend + */ + static ssize_t phar_dir_read(php_stream *stream, char *buf, size_t count) /* {{{ */ + { +- size_t to_read; + HashTable *data = (HashTable *)stream->abstract; + zend_string *str_key; + zend_ulong unused; + ++ if (count != sizeof(php_stream_dirent)) { ++ return -1; ++ } ++ + if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key(data, &str_key, &unused)) { + return 0; + } + + zend_hash_move_forward(data); +- to_read = MIN(ZSTR_LEN(str_key), count); + +- if (to_read == 0 || count < ZSTR_LEN(str_key)) { ++ php_stream_dirent *dirent = (php_stream_dirent *) buf; ++ ++ if (sizeof(dirent->d_name) <= ZSTR_LEN(str_key)) { + return 0; + } + +- memset(buf, 0, sizeof(php_stream_dirent)); +- memcpy(((php_stream_dirent *) buf)->d_name, ZSTR_VAL(str_key), to_read); +- ((php_stream_dirent *) buf)->d_name[to_read + 1] = '\0'; ++ memset(dirent, 0, sizeof(php_stream_dirent)); ++ PHP_STRLCPY(dirent->d_name, ZSTR_VAL(str_key), sizeof(dirent->d_name), ZSTR_LEN(str_key)); + + return sizeof(php_stream_dirent); + } +diff --git a/ext/phar/tests/GHSA-jqcx-ccgc-xwhv.phpt b/ext/phar/tests/GHSA-jqcx-ccgc-xwhv.phpt +new file mode 100644 +index 00000000..4e12f05f +--- /dev/null ++++ b/ext/phar/tests/GHSA-jqcx-ccgc-xwhv.phpt +@@ -0,0 +1,27 @@ ++--TEST-- ++GHSA-jqcx-ccgc-xwhv (Buffer overflow and overread in phar_dir_read()) ++--SKIPIF-- ++<?php if (!extension_loaded("phar")) die("skip"); ?> ++--INI-- ++phar.readonly=0 ++--FILE-- ++<?php ++$phar = new Phar(__DIR__. '/GHSA-jqcx-ccgc-xwhv.phar'); ++$phar->startBuffering(); ++$phar->addFromString(str_repeat('A', PHP_MAXPATHLEN - 1), 'This is the content of file 1.'); ++$phar->addFromString(str_repeat('B', PHP_MAXPATHLEN - 1).'C', 'This is the content of file 2.'); ++$phar->stopBuffering(); ++ ++$handle = opendir('phar://' . __DIR__ . '/GHSA-jqcx-ccgc-xwhv.phar'); ++var_dump(strlen(readdir($handle))); ++// Must not be a string of length PHP_MAXPATHLEN+1 ++var_dump(readdir($handle)); ++closedir($handle); ++?> ++--CLEAN-- ++<?php ++unlink(__DIR__. '/GHSA-jqcx-ccgc-xwhv.phar'); ++?> ++--EXPECTF-- ++int(%d) ++bool(false) +-- +2.24.4 + diff --git a/recipes-devtools/php/php/debian-php-fixheader.patch b/recipes-devtools/php/php/debian-php-fixheader.patch new file mode 100644 index 0000000..a4804d1 --- /dev/null +++ b/recipes-devtools/php/php/debian-php-fixheader.patch @@ -0,0 +1,32 @@ +From 1234a8ef7c5ab88e24bc5908f0ccfd55af21aa39 Mon Sep 17 00:00:00 2001 +From: Leon Anavi leon.anavi@konsulko.com +Date: Mon, 31 Aug 2020 16:03:27 +0300 +Subject: [PATCH] php: remove host specific info from header file + +Based on: +https://sources.debian.org/data/main/p/php7.3/7.3.6-1/debian/patches/ + 0036-php-5.4.9-fixheader.patch + +Upstream-Status: Inappropriate [not author] +Signed-off-by: Joe Slater joe.slater@windriver.com +Signed-off-by: Leon Anavi leon.anavi@konsulko.com +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 2a474ba36d..6d22a21630 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1323,7 +1323,7 @@ PHP_BUILD_DATE=`date -u +%Y-%m-%d` + fi + AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date]) + +-UNAME=`uname -a | xargs` ++UNAME=`uname | xargs` + PHP_UNAME=${PHP_UNAME:-$UNAME} + AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output]) + PHP_OS=`uname | xargs` +-- +2.17.1 + diff --git a/recipes-devtools/php/php/iconv.patch b/recipes-devtools/php/php/iconv.patch new file mode 100644 index 0000000..9ec8a89 --- /dev/null +++ b/recipes-devtools/php/php/iconv.patch @@ -0,0 +1,41 @@ +Subject: [PATCH] From 17cc5645f3acf943a5a06465d09d0ebcfea987bd Mon Sep 17 + 00:00:00 2001 From: Koen Kooi koen@dominion.thruhere.net Date: Wed, 2 Nov + 2011 16:54:57 +0100 Subject: [PATCH] Upstream-Status: Pending + +update patch to version 7.4.4 +Signed-off-by: Changqing Li changqing.li@windriver.com +--- + build/php.m4 | 3 ++- + ext/iconv/config.m4 | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/build/php.m4 b/build/php.m4 +index 7392876..5c45d13 100644 +--- a/build/php.m4 ++++ b/build/php.m4 +@@ -1950,7 +1950,8 @@ AC_DEFUN([PHP_SETUP_ICONV], [ + echo > ext/iconv/php_iconv_supports_errno.h + + dnl Check libc first if no path is provided in --with-iconv. +- if test "$PHP_ICONV" = "yes"; then ++ dnl must check against no, not against yes as PHP_ICONV can also include a path, which implies yes ++ if test "$PHP_ICONV" != "no"; then + dnl Reset LIBS temporarily as it may have already been included -liconv in. + LIBS_save="$LIBS" + LIBS= +diff --git a/ext/iconv/config.m4 b/ext/iconv/config.m4 +index fe9b47a..b6b632f 100644 +--- a/ext/iconv/config.m4 ++++ b/ext/iconv/config.m4 +@@ -14,7 +14,7 @@ if test "$PHP_ICONV" != "no"; then + + if test "$iconv_avail" != "no"; then + if test -z "$ICONV_DIR"; then +- for i in /usr/local /usr; do ++ for i in $PHP_ICONV /usr/local /usr; do + if test -f "$i/include/iconv.h" || test -f "$i/include/giconv.h"; then + PHP_ICONV_PREFIX="$i" + break +-- +2.7.4 + diff --git a/recipes-devtools/php/php/imap-fix-autofoo.patch b/recipes-devtools/php/php/imap-fix-autofoo.patch new file mode 100644 index 0000000..ebe5f6a --- /dev/null +++ b/recipes-devtools/php/php/imap-fix-autofoo.patch @@ -0,0 +1,41 @@ +Subject: [PATCH] From c084c8349d1780980e232cb28b60a109e3d89438 Mon Sep 17 + 00:00:00 2001 From: Koen Kooi koen@dominion.thruhere.net Date: Wed, 2 Nov + 2011 16:54:57 +0100 Subject: [PATCH] Upstream-Status: Pending + +update patch to version 7.4.4 +Signed-off-by: Changqing Li changqing.li@windriver.com +--- + ext/imap/config.m4 | 10 ++-------- + 1 file changed, 2 insertions(+), 8 deletions(-) + +diff --git a/ext/imap/config.m4 b/ext/imap/config.m4 +index 5086a31..0e938bd 100644 +--- a/ext/imap/config.m4 ++++ b/ext/imap/config.m4 +@@ -110,7 +110,7 @@ if test "$PHP_IMAP" != "no"; then + PHP_NEW_EXTENSION(imap, php_imap.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) + AC_DEFINE(HAVE_IMAP,1,[ ]) + +- for i in $PHP_IMAP /usr/local /usr; do ++ for i in $PHP_IMAP $PHP_IMAP/usr /usr/local /usr; do + IMAP_INC_CHK() + el[]IMAP_INC_CHK(/include/c-client) + el[]IMAP_INC_CHK(/include/imap) +@@ -199,13 +199,7 @@ if test "$PHP_IMAP" != "no"; then + AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.) + fi + +- if test ! -r "$IMAP_DIR/c-client/libc-client.a" && test -r "$IMAP_DIR/c-client/c-client.a" ; then +- ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1 +- elif test ! -r "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" && test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then +- ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1 +- fi +- +- for lib in c-client4 c-client imap; do ++ for lib in /usr/lib c-client4 c-client imap; do + IMAP_LIB=$lib + IMAP_LIB_CHK($PHP_LIBDIR) + IMAP_LIB_CHK(c-client) +-- +2.7.4 + diff --git a/recipes-devtools/php/php/pear-makefile.patch b/recipes-devtools/php/php/pear-makefile.patch new file mode 100644 index 0000000..fcbf25b --- /dev/null +++ b/recipes-devtools/php/php/pear-makefile.patch @@ -0,0 +1,22 @@ +From edd575a546d56bb5683aff19782b16963d61fd0b Mon Sep 17 00:00:00 2001 +From: Koen Kooi koen@dominion.thruhere.net +Date: Wed, 2 Nov 2011 16:54:57 +0100 +Subject: [PATCH] Upstream-Status: Pending + +--- + pear/Makefile.frag | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pear/Makefile.frag b/pear/Makefile.frag +index bbe8ec3..16f43e2 100644 +--- a/pear/Makefile.frag ++++ b/pear/Makefile.frag +@@ -12,7 +12,7 @@ PEAR_SUFFIX = -ds a$(program_suffix) + PEAR_INSTALLER_URL = https://pear.php.net/install-pear-nozlib.phar + + install-pear-installer: $(SAPI_CLI_PATH) +- @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) pear/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)" ${PEAR_PREFIX} ${PEAR_SUFFIX} ++ @$(PHP_NATIVE_DIR)/php $(PEAR_INSTALL_FLAGS) $(builddir)/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)" ${PEAR_PREFIX} ${PEAR_SUFFIX} + + install-pear: + @echo "Installing PEAR environment: $(INSTALL_ROOT)$(peardir)/" diff --git a/recipes-devtools/php/php/phar-makefile.patch b/recipes-devtools/php/php/phar-makefile.patch new file mode 100644 index 0000000..eb73bc4 --- /dev/null +++ b/recipes-devtools/php/php/phar-makefile.patch @@ -0,0 +1,46 @@ +Subject: [PATCH] From 08962a56f69963e01892d98ca5b75de8354bd3f5 Mon Sep 17 + 00:00:00 2001 From: Koen Kooi koen@dominion.thruhere.net Date: Wed, 2 Nov + 2011 16:54:57 +0100 Subject: [PATCH] Fix phar packaging + +Inherited from OE-Classic, with some additions to fix host paths leaking +into the target package. + +Upstream-Status: Inappropriate [config] + +update patch to version 7.4.4 +Signed-off-by: Changqing Li changqing.li@windriver.com +--- + ext/phar/Makefile.frag | 17 +++-------------- + 1 file changed, 3 insertions(+), 14 deletions(-) + +diff --git a/ext/phar/Makefile.frag b/ext/phar/Makefile.frag +index 6442f33..6145412 100644 +--- a/ext/phar/Makefile.frag ++++ b/ext/phar/Makefile.frag +@@ -10,20 +10,9 @@ pharcmd: $(builddir)/phar.php $(builddir)/phar.phar + + PHP_PHARCMD_SETTINGS = -n -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0 + PHP_PHARCMD_EXECUTABLE = ` \ +- if test -x "$(top_builddir)/$(SAPI_CLI_PATH)"; then \ +- $(top_srcdir)/build/shtool echo -n -- "$(top_builddir)/$(SAPI_CLI_PATH) -n"; \ +- if test "x$(PHP_MODULES)" != "x"; then \ +- $(top_srcdir)/build/shtool echo -n -- " -d extension_dir=$(top_builddir)/modules"; \ +- for i in bz2 zlib phar; do \ +- if test -f "$(top_builddir)/modules/$$i.la"; then \ +- . $(top_builddir)/modules/$$i.la; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \ +- fi; \ +- done; \ +- fi; \ +- else \ +- $(top_srcdir)/build/shtool echo -n -- "$(PHP_EXECUTABLE)"; \ +- fi;` +-PHP_PHARCMD_BANG = `$(top_srcdir)/build/shtool echo -n -- "$(INSTALL_ROOT)$(bindir)/$(program_prefix)php$(program_suffix)$(EXEEXT)";` ++ $(top_srcdir)/build/shtool echo -n -- "$(PHP_EXECUTABLE)"; ` ++ ++PHP_PHARCMD_BANG = `$(top_srcdir)/build/shtool echo -n -- "$(bindir)/$(program_prefix)php$(program_suffix)$(EXEEXT)";` + + $(builddir)/phar/phar.inc: $(srcdir)/phar/phar.inc + -@test -d $(builddir)/phar || mkdir $(builddir)/phar +-- +2.7.4 + diff --git a/recipes-devtools/php/php/php-fpm-apache.conf b/recipes-devtools/php/php/php-fpm-apache.conf new file mode 100644 index 0000000..f7f46d2 --- /dev/null +++ b/recipes-devtools/php/php/php-fpm-apache.conf @@ -0,0 +1,6 @@ +# Taken from http://wiki.apache.org/httpd/PHP-FPM + +LoadModule proxy_module /usr/libexec/apache2/modules/mod_proxy.so +LoadModule proxy_fcgi_module /usr/libexec/apache2/modules/mod_proxy_fcgi.so + +ProxyPassMatch ^/(.*.php(/.*)?)$ fcgi://127.0.0.1:9000/usr/share/apache2/htdocs/ diff --git a/recipes-devtools/php/php/php-fpm.conf b/recipes-devtools/php/php/php-fpm.conf new file mode 100644 index 0000000..21e3dfb --- /dev/null +++ b/recipes-devtools/php/php/php-fpm.conf @@ -0,0 +1,510 @@ +;;;;;;;;;;;;;;;;;;;;; +; FPM Configuration ; +;;;;;;;;;;;;;;;;;;;;; + +; All relative paths in this configuration file are relative to PHP's install +; prefix (/usr). This prefix can be dynamicaly changed by using the +; '-p' argument from the command line. + +; Include one or more files. If glob(3) exists, it is used to include a bunch of +; files from a glob(3) pattern. This directive can be used everywhere in the +; file. +; Relative path can also be used. They will be prefixed by: +; - the global prefix if it's been set (-p arguement) +; - /usr otherwise +;include=etc/fpm.d/*.conf + +;;;;;;;;;;;;;;;;;; +; Global Options ; +;;;;;;;;;;;;;;;;;; + +[global] +; Pid file +; Note: the default prefix is /var +; Default Value: none +;pid = run/php-fpm.pid + +; Error log file +; If it's set to "syslog", log is sent to syslogd instead of being written +; in a local file. +; Note: the default prefix is /var +; Default Value: log/php-fpm.log +;error_log = log/php-fpm.log + +; syslog_facility is used to specify what type of program is logging the +; message. This lets syslogd specify that messages from different facilities +; will be handled differently. +; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) +; Default Value: daemon +;syslog.facility = daemon + +; syslog_ident is prepended to every message. If you have multiple FPM +; instances running on the same server, you can change the default value +; which must suit common needs. +; Default Value: php-fpm +;syslog.ident = php-fpm + +; Log level +; Possible Values: alert, error, warning, notice, debug +; Default Value: notice +;log_level = notice + +; If this number of child processes exit with SIGSEGV or SIGBUS within the time +; interval set by emergency_restart_interval then FPM will restart. A value +; of '0' means 'Off'. +; Default Value: 0 +;emergency_restart_threshold = 0 + +; Interval of time used by emergency_restart_interval to determine when +; a graceful restart will be initiated. This can be useful to work around +; accidental corruptions in an accelerator's shared memory. +; Available Units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;emergency_restart_interval = 0 + +; Time limit for child processes to wait for a reaction on signals from master. +; Available units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;process_control_timeout = 0 + +; The maximum number of processes FPM will fork. This has been design to control +; the global number of processes when using dynamic PM within a lot of pools. +; Use it with caution. +; Note: A value of 0 indicates no limit +; Default Value: 0 +; process.max = 128 + +; Specify the nice(2) priority to apply to the master process (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool process will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; process.priority = -19 + +; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. +; Default Value: yes +;daemonize = yes + +; Set open file descriptor rlimit for the master process. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit for the master process. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Specify the event mechanism FPM will use. The following is available: +; - select (any POSIX os) +; - poll (any POSIX os) +; - epoll (linux >= 2.5.44) +; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) +; - /dev/poll (Solaris >= 7) +; - port (Solaris >= 10) +; Default Value: not set (auto detection) +; events.mechanism = epoll + +;;;;;;;;;;;;;;;;;;;; +; Pool Definitions ; +;;;;;;;;;;;;;;;;;;;; + +; Multiple pools of child processes may be started with different listening +; ports and different management options. The name of the pool will be +; used in logs and stats. There is no limitation on the number of pools which +; FPM can handle. Your system will tell you anyway :) + +; Start a new pool named 'www'. +; the variable $pool can we used in any directive and will be replaced by the +; pool name ('www' here) +[www] + +; Per pool prefix +; It only applies on the following directives: +; - 'slowlog' +; - 'listen' (unixsocket) +; - 'chroot' +; - 'chdir' +; - 'php_values' +; - 'php_admin_values' +; When not set, the global prefix (or /usr) applies instead. +; Note: This directive can also be relative to the global prefix. +; Default Value: none +;prefix = /path/to/pools/$pool + +; Unix user/group of processes +; Note: The user is mandatory. If the group is not set, the default user's group +; will be used. +user = nobody +;group = nobody + +; The address on which to accept FastCGI requests. +; Valid syntaxes are: +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses on a +; specific port; +; '/path/to/unix/socket' - to listen on a unix socket. +; Note: This value is mandatory. +listen = 127.0.0.1:9000 + +; Set listen(2) backlog. A value of '-1' means unlimited. +; Default Value: 128 (-1 on FreeBSD and OpenBSD) +;listen.backlog = -1 + +; Set permissions for unix socket, if one is used. In Linux, read/write +; permissions must be set in order to allow connections from a web server. Many +; BSD-derived systems allow connections regardless of permissions. +; Default Values: user and group are set as the running user +; mode is set to 0666 +;listen.owner = nobody +;listen.group = nobody +;listen.mode = 0666 + +; List of ipv4 addresses of FastCGI clients which are allowed to connect. +; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original +; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address +; must be separated by a comma. If this value is left blank, connections will be +; accepted from any ip address. +; Default Value: any +;listen.allowed_clients = 127.0.0.1 + +; Specify the nice(2) priority to apply to the pool processes (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool processes will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; priority = -19 + +; Choose how the process manager will control the number of child processes. +; Possible Values: +; static - a fixed number (pm.max_children) of child processes; +; dynamic - the number of child processes are set dynamically based on the +; following directives. With this process management, there will be +; always at least 1 children. +; pm.max_children - the maximum number of children that can +; be alive at the same time. +; pm.start_servers - the number of children created on startup. +; pm.min_spare_servers - the minimum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is less than this +; number then some children will be created. +; pm.max_spare_servers - the maximum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is greater than this +; number then some children will be killed. +; ondemand - no children are created at startup. Children will be forked when +; new requests will connect. The following parameter are used: +; pm.max_children - the maximum number of children that +; can be alive at the same time. +; pm.process_idle_timeout - The number of seconds after which +; an idle process will be killed. +; Note: This value is mandatory. +pm = dynamic + +; The number of child processes to be created when pm is set to 'static' and the +; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. +; This value sets the limit on the number of simultaneous requests that will be +; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. +; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP +; CGI. The below defaults are based on a server without much resources. Don't +; forget to tweak pm.* to fit your needs. +; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' +; Note: This value is mandatory. +pm.max_children = 5 + +; The number of child processes created on startup. +; Note: Used only when pm is set to 'dynamic' +; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 +pm.start_servers = 2 + +; The desired minimum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.min_spare_servers = 1 + +; The desired maximum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.max_spare_servers = 3 + +; The number of seconds after which an idle process will be killed. +; Note: Used only when pm is set to 'ondemand' +; Default Value: 10s +;pm.process_idle_timeout = 10s; + +; The number of requests each child process should execute before respawning. +; This can be useful to work around memory leaks in 3rd party libraries. For +; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. +; Default Value: 0 +;pm.max_requests = 500 + +; The URI to view the FPM status page. If this value is not set, no URI will be +; recognized as a status page. It shows the following informations: +; pool - the name of the pool; +; process manager - static, dynamic or ondemand; +; start time - the date and time FPM has started; +; start since - number of seconds since FPM has started; +; accepted conn - the number of request accepted by the pool; +; listen queue - the number of request in the queue of pending +; connections (see backlog in listen(2)); +; max listen queue - the maximum number of requests in the queue +; of pending connections since FPM has started; +; listen queue len - the size of the socket queue of pending connections; +; idle processes - the number of idle processes; +; active processes - the number of active processes; +; total processes - the number of idle + active processes; +; max active processes - the maximum number of active processes since FPM +; has started; +; max children reached - number of times, the process limit has been reached, +; when pm tries to start more children (works only for +; pm 'dynamic' and 'ondemand'); +; Value are updated in real time. +; Example output: +; pool: www +; process manager: static +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 62636 +; accepted conn: 190460 +; listen queue: 0 +; max listen queue: 1 +; listen queue len: 42 +; idle processes: 4 +; active processes: 11 +; total processes: 15 +; max active processes: 12 +; max children reached: 0 +; +; By default the status page output is formatted as text/plain. Passing either +; 'html', 'xml' or 'json' in the query string will return the corresponding +; output syntax. Example: +; http://www.foo.bar/status +; http://www.foo.bar/status?json +; http://www.foo.bar/status?html +; http://www.foo.bar/status?xml +; +; By default the status page only outputs short status. Passing 'full' in the +; query string will also return status for each pool process. +; Example: +; http://www.foo.bar/status?full +; http://www.foo.bar/status?json&full +; http://www.foo.bar/status?html&full +; http://www.foo.bar/status?xml&full +; The Full status returns for each process: +; pid - the PID of the process; +; state - the state of the process (Idle, Running, ...); +; start time - the date and time the process has started; +; start since - the number of seconds since the process has started; +; requests - the number of requests the process has served; +; request duration - the duration in µs of the requests; +; request method - the request method (GET, POST, ...); +; request URI - the request URI with the query string; +; content length - the content length of the request (only with POST); +; user - the user (PHP_AUTH_USER) (or '-' if not set); +; script - the main script called (or '-' if not set); +; last request cpu - the %cpu the last request consumed +; it's always 0 if the process is not in Idle state +; because CPU calculation is done when the request +; processing has terminated; +; last request memory - the max amount of memory the last request consumed +; it's always 0 if the process is not in Idle state +; because memory calculation is done when the request +; processing has terminated; +; If the process is in Idle state, then informations are related to the +; last request the process has served. Otherwise informations are related to +; the current request being served. +; Example output: +; ************************ +; pid: 31330 +; state: Running +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 63087 +; requests: 12808 +; request duration: 1250261 +; request method: GET +; request URI: /test_mem.php?N=10000 +; content length: 0 +; user: - +; script: /home/fat/web/docs/php/test_mem.php +; last request cpu: 0.00 +; last request memory: 0 +; +; Note: There is a real-time FPM status monitoring sample web page available +; It's available in: /usr/share/fpm/status.html +; +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;pm.status_path = /status + +; The ping URI to call the monitoring page of FPM. If this value is not set, no +; URI will be recognized as a ping page. This could be used to test from outside +; that FPM is alive and responding, or to +; - create a graph of FPM availability (rrd or such); +; - remove a server from a group if it is not responding (load balancing); +; - trigger alerts for the operating team (24/7). +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;ping.path = /ping + +; This directive may be used to customize the response of a ping request. The +; response is formatted as text/plain with a 200 response code. +; Default Value: pong +;ping.response = pong + +; The access log file +; Default: not set +;access.log = log/$pool.access.log + +; The access log format. +; The following syntax is allowed +; %%: the '%' character +; %C: %CPU used by the request +; it can accept the following format: +; - %{user}C for user CPU only +; - %{system}C for system CPU only +; - %{total}C for user + system CPU (default) +; %d: time taken to serve the request +; it can accept the following format: +; - %{seconds}d (default) +; - %{miliseconds}d +; - %{mili}d +; - %{microseconds}d +; - %{micro}d +; %e: an environment variable (same as $_ENV or $_SERVER) +; it must be associated with embraces to specify the name of the env +; variable. Some exemples: +; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e +; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e +; %f: script filename +; %l: content-length of the request (for POST request only) +; %m: request method +; %M: peak of memory allocated by PHP +; it can accept the following format: +; - %{bytes}M (default) +; - %{kilobytes}M +; - %{kilo}M +; - %{megabytes}M +; - %{mega}M +; %n: pool name +; %o: ouput header +; it must be associated with embraces to specify the name of the header: +; - %{Content-Type}o +; - %{X-Powered-By}o +; - %{Transfert-Encoding}o +; - .... +; %p: PID of the child that serviced the request +; %P: PID of the parent of the child that serviced the request +; %q: the query string +; %Q: the '?' character if query string exists +; %r: the request URI (without the query string, see %q and %Q) +; %R: remote IP address +; %s: status (response code) +; %t: server time the request was received +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %T: time the log has been written (the request has finished) +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %u: remote user +; +; Default: "%R - %u %t "%m %r" %s" +;access.format = "%R - %u %t "%m %r%Q%q" %s %f %{mili}d %{kilo}M %C%%" + +; The log file for slow requests +; Default Value: not set +; Note: slowlog is mandatory if request_slowlog_timeout is set +;slowlog = log/$pool.log.slow + +; The timeout for serving a single request after which a PHP backtrace will be +; dumped to the 'slowlog' file. A value of '0s' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_slowlog_timeout = 0 + +; The timeout for serving a single request after which the worker process will +; be killed. This option should be used when the 'max_execution_time' ini option +; does not stop script execution for some reason. A value of '0' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_terminate_timeout = 0 + +; Set open file descriptor rlimit. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Chroot to this directory at the start. This value must be defined as an +; absolute path. When this value is not set, chroot is not used. +; Note: you can prefix with '$prefix' to chroot to the pool prefix or one +; of its subdirectories. If the pool prefix is not set, the global prefix +; will be used instead. +; Note: chrooting is a great security feature and should be used whenever +; possible. However, all PHP paths will be relative to the chroot +; (error_log, sessions.save_path, ...). +; Default Value: not set +;chroot = + +; Chdir to this directory at the start. +; Note: relative path can be used. +; Default Value: current directory or / when chroot +;chdir = /var/www + +; Redirect worker stdout and stderr into main error log. If not set, stdout and +; stderr will be redirected to /dev/null according to FastCGI specs. +; Note: on highloaded environement, this can cause some delay in the page +; process time (several ms). +; Default Value: no +;catch_workers_output = yes + +; Limits the extensions of the main script FPM will allow to parse. This can +; prevent configuration mistakes on the web server side. You should only limit +; FPM to .php extensions to prevent malicious users to use other extensions to +; exectute php code. +; Note: set an empty value to allow all extensions. +; Default Value: .php +;security.limit_extensions = .php .php3 .php4 .php5 + +; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from +; the current environment. +; Default Value: clean env +;env[HOSTNAME] = $HOSTNAME +;env[PATH] = /usr/local/bin:/usr/bin:/bin +;env[TMP] = /tmp +;env[TMPDIR] = /tmp +;env[TEMP] = /tmp + +; Additional php.ini defines, specific to this pool of workers. These settings +; overwrite the values previously defined in the php.ini. The directives are the +; same as the PHP SAPI: +; php_value/php_flag - you can set classic ini defines which can +; be overwritten from PHP call 'ini_set'. +; php_admin_value/php_admin_flag - these directives won't be overwritten by +; PHP call 'ini_set' +; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. + +; Defining 'extension' will load the corresponding shared extension from +; extension_dir. Defining 'disable_functions' or 'disable_classes' will not +; overwrite previously defined php.ini values, but will append the new value +; instead. + +; Note: path INI options can be relative and will be expanded with the prefix +; (pool, global or /usr) + +; Default Value: nothing is defined by default except the values in php.ini and +; specified at startup with the -d argument +;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com +;php_flag[display_errors] = off +;php_admin_value[error_log] = /var/log/fpm-php.www.log +;php_admin_flag[log_errors] = on +;php_admin_value[memory_limit] = 32M diff --git a/recipes-devtools/php/php/php-fpm.service b/recipes-devtools/php/php/php-fpm.service new file mode 100644 index 0000000..ac79dc9 --- /dev/null +++ b/recipes-devtools/php/php/php-fpm.service @@ -0,0 +1,10 @@ +[Unit] +Description=PHP-FPM +After=network.target +[Service] +Type=forking +PIDFile=@LOCALSTATEDIR@/run/php-fpm.pid +ExecStart=@SYSCONFDIR@/init.d/php-fpm start +ExecStop=@SYSCONFDIR@/init.d/php-fpm stop +[Install] +WantedBy=multi-user.target diff --git a/recipes-devtools/php/php/php_exec_native.patch b/recipes-devtools/php/php/php_exec_native.patch new file mode 100644 index 0000000..4aec481 --- /dev/null +++ b/recipes-devtools/php/php/php_exec_native.patch @@ -0,0 +1,26 @@ +Subject: [PATCH] rom d251b5aa3d23803d016ca16818e2e1d2f2b70a02 Mon Sep 17 + 00:00:00 2001 From: Koen Kooi koen@dominion.thruhere.net Date: Wed, 2 Nov + 2011 16:54:57 +0100 Subject: [PATCH] Upstream-Status: Inappriate + +update patch to version 7.4.4 +Signed-off-by: Changqing Li changqing.li@windriver.com +--- + sapi/cli/config.m4 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4 +index 917d45f..aaf1e27 100644 +--- a/sapi/cli/config.m4 ++++ b/sapi/cli/config.m4 +@@ -47,7 +47,7 @@ if test "$PHP_CLI" != "no"; then + esac + + dnl Set executable for tests. +- PHP_EXECUTABLE="$(top_builddir)/$(SAPI_CLI_PATH)" ++ PHP_EXECUTABLE="${PHP_NATIVE_DIR}/php" + PHP_SUBST(PHP_EXECUTABLE) + + dnl Expose to Makefile. +-- +2.7.4 + diff --git a/recipes-devtools/php/php/xfail_two_bug_tests.patch b/recipes-devtools/php/php/xfail_two_bug_tests.patch new file mode 100644 index 0000000..2105743 --- /dev/null +++ b/recipes-devtools/php/php/xfail_two_bug_tests.patch @@ -0,0 +1,34 @@ +php-ptest: xfail two tests + +If and when these tests are modified to expect the correct output, they will +succeed and generate warnings in the test summary. This patch can then be removed. + +Note that we add a closing '?>' to one test so that it can be executed directly by php. + +Upstream-Status: Pending + +Signed-off-By: Joe Slater joe.slater@windriver.com + + +--- a/tests/basic/bug71273.phpt ++++ b/tests/basic/bug71273.phpt +@@ -16,6 +16,8 @@ Bug #71273 A wrong ext directory setup i + var_dump(preg_match(",.+a[\/].+[\/]w.php_kartoffelbrei.dll.+,s", $out)); + ?> + ==DONE== ++--XFAIL-- ++Output is int(0), not int(1) + --EXPECT-- + int(1) + ==DONE== +--- a/tests/run-test/bug75042-3.phpt ++++ b/tests/run-test/bug75042-3.phpt +@@ -8,5 +8,8 @@ display_errors=1 + nonexistentsharedmodule + --FILE-- + <?php ++?> ++--XFAIL-- ++No warning message printed. + --EXPECTF-- + PHP Warning: PHP Startup: Unable to load dynamic library '%snonexistentsharedmodule.%s' %A diff --git a/recipes-devtools/php/php_%.bbappend b/recipes-devtools/php/php_%.bbappend new file mode 100644 index 0000000..645c743 --- /dev/null +++ b/recipes-devtools/php/php_%.bbappend @@ -0,0 +1,74 @@ + +FILESEXTRAPATHS:append := "${THISDIR}/files:" + +SRC_URI:append = " \ + file://php.ini \ + file://zabbix-fpm.conf \ + file://pg_config \ + " + +DEPENDS += " openldap jpeg libpng freetype libpq" + +PACKAGECONFIG = " opcache pgsql \ + ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)}\ + \ + " + +PACKAGECONFIG[pgsql] = "--with-pgsql=${WORKDIR},--without-pgsql,libpq" + +EXTRA_OECONF += " \ + --enable-bcmath \ + --enable-gd \ + --without-openssl \ + --with-ldap=${STAGING_EXECPREFIXDIR} \ + --with-config-file-path=/etc/php.ini \ + --with-freetype \ + --with-jpeg \ + " + +SYSTEMD_PACKAGES = " php-fpm " +SYSTEMD_SERVICE:php-fpm += "\ + php-fpm.service \ +" +SYSTEMD_AUTO_ENABLE:php-fpm = "enable" + +PGLIBDIR = "${STAGING_DIR_TARGET}${libdir}" +PGINCDIR = "${STAGING_DIR_TARGET}${includedir}" + +do_configure:prepend() { + + # config scripts + export LIBDIR_IN="${PGLIBDIR}" + export INCLUDEDIR_IN="${PGINCDIR}" + export VERSION_IN="14.5" +} + +do_install:append:class-target() { + + install -d ${D}/${sysconfdir}/tmpfiles.d/ + + # add tmpfile + echo 'd /run/php/ 0755 www-data www-data -' > ${D}/${sysconfdir}/tmpfiles.d/php.conf + echo >> ${D}/${sysconfdir}/tmpfiles.d/php.conf + + # add zabbix conf + install -d ${D}/${sysconfdir}/php-fpm.d/ + install -m 0644 ${WORKDIR}/zabbix-fpm.conf ${D}/${sysconfdir}/php-fpm.d/ + + sed -i -e 's#;include=.*.*$#include=/etc/php-fpm.d/*.conf#g' ${D}${sysconfdir}/php-fpm.conf + sed -i -e 's#;pm.status_path.*$#pm.status_path = /status#g' ${D}${sysconfdir}/php-fpm.conf + sed -i -e 's#;ping.path.*$#ping.path = /ping#g' ${D}${sysconfdir}/php-fpm.conf + + install -m 0644 ${WORKDIR}/php.ini ${D}/etc/php.ini + + install -d ${D}${systemd_unitdir}/system/multi-user.target.wants + ln -sf ../php-fpm.service ${D}${systemd_unitdir}/system/multi-user.target.wants/php-fpm.service +} + +FILES:${PN}-fpm += "\ + ${sysconfdir}/php.ini \ + ${sysconfdir}/php-fpm.d/ \ + ${sysconfdir}/tmpfiles.d/ \ + ${systemd_unitdir}/ \ + ${localstatedir}/lib/${BPN}/sessions \ + " \ No newline at end of file diff --git a/recipes-devtools/php/php_7.4.33.bb b/recipes-devtools/php/php_7.4.33.bb new file mode 100644 index 0000000..9ef4df3 --- /dev/null +++ b/recipes-devtools/php/php_7.4.33.bb @@ -0,0 +1,276 @@ +SUMMARY = "A server-side, HTML-embedded scripting language - sourced from Dunfell" +HOMEPAGE = "http://www.php.net" +SECTION = "console/network" + +LICENSE = "PHP-3.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=99532e0f6620bc9bca34f12fadaee33c" + +BBCLASSEXTEND = "native" +DEPENDS = "zlib bzip2 libxml2 virtual/libiconv php-native lemon-native" +DEPENDS:class-native = "zlib-native libxml2-native" + +PHP_MAJOR_VERSION = "${@d.getVar('PV').split('.')[0]}" + +SRC_URI = "http://php.net/distributions/php-%24%7BPV%7D.tar.bz2 \ + file://0001-php-don-t-use-broken-wrapper-for-mkdir.patch \ + file://debian-php-fixheader.patch \ + file://0001-configure.ac-don-t-include-build-libtool.m4.patch \ + file://0001-php.m4-don-t-unset-cache-variables.patch \ + file://CVE-2023-3824.patch \ + " + +SRC_URI:append:class-target = " \ + file://iconv.patch \ + file://imap-fix-autofoo.patch \ + file://php_exec_native.patch \ + file://php-fpm.conf \ + file://php-fpm-apache.conf \ + file://70_mod_php${PHP_MAJOR_VERSION}.conf \ + file://php-fpm.service \ + file://pear-makefile.patch \ + file://phar-makefile.patch \ + file://0001-opcache-config.m4-enable-opcache.patch \ + file://xfail_two_bug_tests.patch \ + file://CVE-2023-3247-1.patch \ + file://CVE-2023-3247-2.patch \ + " + +S = "${WORKDIR}/php-${PV}" +SRC_URI[sha256sum] = "4e8117458fe5a475bf203128726b71bcbba61c42ad463dffadee5667a198a98a" + + +inherit autotools pkgconfig python3native gettext + +# phpize is not scanned for absolute paths by default (but php-config is). +# +SSTATE_SCAN_FILES += "phpize" +SSTATE_SCAN_FILES += "build-defs.h" + +PHP_LIBDIR = "${libdir}/php${PHP_MAJOR_VERSION}" + +# Common EXTRA_OECONF +COMMON_EXTRA_OECONF = "--enable-sockets \ + --enable-pcntl \ + --enable-shared \ + --disable-rpath \ + --with-pic \ + --libdir=${PHP_LIBDIR} \ +" +EXTRA_OECONF = "--enable-mbstring \ + --enable-fpm \ + --with-libdir=${baselib} \ + --with-gettext=${STAGING_LIBDIR}/.. \ + --with-zlib=${STAGING_LIBDIR}/.. \ + --with-iconv=${STAGING_LIBDIR}/.. \ + --with-bz2=${STAGING_DIR_TARGET}${exec_prefix} \ + --with-config-file-path=${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION} \ + ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'ac_cv_c_bigendian_php=no', 'ac_cv_c_bigendian_php=yes', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'pam', '', 'ac_cv_lib_pam_pam_start=no', d)} \ + ${COMMON_EXTRA_OECONF} \ +" + +EXTRA_OECONF:append:riscv64 = " --with-pcre-jit=no" +EXTRA_OECONF:append:riscv32 = " --with-pcre-jit=no" + +CACHED_CONFIGUREVARS += "ac_cv_func_dlopen=no ac_cv_lib_dl_dlopen=yes" + +EXTRA_OECONF:class-native = " \ + --with-zlib=${STAGING_LIBDIR_NATIVE}/.. \ + --without-iconv \ + ${COMMON_EXTRA_OECONF} \ +" + +PACKAGECONFIG ??= "mysql sqlite3 imap opcache \ + ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} \ +" +PACKAGECONFIG:class-native = "" + +PACKAGECONFIG[zip] = "--with-zip --with-zlib-dir=${STAGING_EXECPREFIXDIR},,libzip" + +PACKAGECONFIG[mysql] = "--with-mysqli=mysqlnd \ + --with-pdo-mysql=mysqlnd \ + ,--without-mysqli --without-pdo-mysql \ + ,mysql5" + +PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_LIBDIR}/.. \ + --with-pdo-sqlite=${STAGING_LIBDIR}/.. \ + ,--without-sqlite3 --without-pdo-sqlite \ + ,sqlite3" +PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix},--without-pgsql,postgresql" +PACKAGECONFIG[soap] = "--enable-soap, --disable-soap, libxml2" +PACKAGECONFIG[apache2] = "--with-apxs2=${STAGING_BINDIR_CROSS}/apxs,,apache2-native apache2" +PACKAGECONFIG[pam] = ",,libpam" +PACKAGECONFIG[imap] = "--with-imap=${STAGING_DIR_HOST} \ + --with-imap-ssl=${STAGING_DIR_HOST} \ + ,--without-imap --without-imap-ssl \ + ,uw-imap" +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," +PACKAGECONFIG[opcache] = "--enable-opcache,--disable-opcache" +# PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl-dunfell" +PACKAGECONFIG[valgrind] = "--with-valgrind=${STAGING_DIR_TARGET}/usr,--with-valgrind=no,valgrind" +PACKAGECONFIG[mbregex] = "--enable-mbregex, --disable-mbregex, oniguruma" + +export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" +export PHP_PEAR_PHP_BIN = "${STAGING_BINDIR_NATIVE}/php" +CFLAGS += " -D_GNU_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -I${STAGING_INCDIR}/apache2" + +# Adding these flags enables dynamic library support, which is disabled by +# default when cross compiling +# See https://bugs.php.net/bug.php?id=60109 +CFLAGS += " -DHAVE_LIBDL " +LDFLAGS += " -ldl " + +EXTRA_OEMAKE = "INSTALL_ROOT=${D}" + +acpaths = "" + +do_configure:prepend () { + # export OPENSSL_LIBS="-L${STAGING_DIR_TARGET}${libdir} -lcrypto.1.1 -lssl.1.1" + # export OPENSSL_CFLAGS="-I${STAGING_DIR_TARGET}${includedir}/openssl.1.1" + + rm -f ${S}/build/libtool.m4 ${S}/ltmain.sh ${S}/aclocal.m4 + find ${S} -name config.m4 | xargs -n1 sed -i 's!APXS_HTTPD=.*!APXS_HTTPD=${STAGING_SBINDIR_NATIVE}/httpd!' +} + +do_configure:append() { + # No, libtool, we really don't want rpath set... + sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool + sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool +} + +do_install:append:class-native() { + rm -rf ${D}/${PHP_LIBDIR}/php/.registry + rm -rf ${D}/${PHP_LIBDIR}/php/.channels + rm -rf ${D}/${PHP_LIBDIR}/php/.[a-z]* +} + +do_install:prepend() { + cat ${ACLOCALDIR}/libtool.m4 ${ACLOCALDIR}/lt~obsolete.m4 ${ACLOCALDIR}/ltoptions.m4 \ + ${ACLOCALDIR}/ltsugar.m4 ${ACLOCALDIR}/ltversion.m4 > ${S}/build/libtool.m4 +} + +do_install:prepend:class-target() { + if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then + # Install dummy config file so apxs doesn't fail + install -d ${D}${sysconfdir}/apache2 + printf "\nLoadModule dummy_module modules/mod_dummy.so\n" > ${D}${sysconfdir}/apache2/httpd.conf + fi +} + +# fixme +do_install:append:class-target() { + install -d ${D}${sysconfdir}/ + rm -rf ${D}/.registry + rm -rf ${D}/.channels + rm -rf ${D}/.[a-z]* + rm -rf ${D}/var + rm -f ${D}/${sysconfdir}/php-fpm.conf.default + install -m 0644 ${WORKDIR}/php-fpm.conf ${D}/${sysconfdir}/php-fpm.conf + install -d ${D}/${sysconfdir}/apache2/conf.d + install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf + install -d ${D}${sysconfdir}/init.d + sed -i 's:=/usr/sbin:=${sbindir}:g' ${B}/sapi/fpm/init.d.php-fpm + sed -i 's:=/etc:=${sysconfdir}:g' ${B}/sapi/fpm/init.d.php-fpm + sed -i 's:=/var:=${localstatedir}:g' ${B}/sapi/fpm/init.d.php-fpm + install -m 0755 ${B}/sapi/fpm/init.d.php-fpm ${D}${sysconfdir}/init.d/php-fpm + install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf + + if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/php-fpm.service ${D}${systemd_unitdir}/system/ + sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \ + -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ + ${D}${systemd_unitdir}/system/php-fpm.service + fi + + if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/apache2/modules.d + install -d ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION} + install -m 644 ${WORKDIR}/70_mod_php${PHP_MAJOR_VERSION}.conf ${D}${sysconfdir}/apache2/modules.d + sed -i s,lib/,${libexecdir}/, ${D}${sysconfdir}/apache2/modules.d/70_mod_php${PHP_MAJOR_VERSION}.conf + cat ${S}/php.ini-production | \ + sed -e 's,extension_dir = "./",extension_dir = "/usr/lib/extensions",' \ + > ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}/php.ini + rm -f ${D}${sysconfdir}/apache2/httpd.conf* + fi +} + +SYSROOT_PREPROCESS_FUNCS += "php_sysroot_preprocess" + +php_sysroot_preprocess () { + install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ + install -m 755 ${D}${bindir}/phpize ${SYSROOT_DESTDIR}${bindir_crossscripts}/ + install -m 755 ${D}${bindir}/php-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ + + sed -i 's!eval echo /!eval echo ${STAGING_DIR_HOST}/!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/phpize + sed -i 's!^include_dir=.*!include_dir=${STAGING_INCDIR}/php!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/php-config +} + +MODPHP_PACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', '${PN}-modphp', '', d)}" + +PACKAGES = "${PN}-dbg ${PN}-cli ${PN}-phpdbg ${PN}-cgi ${PN}-fpm ${PN}-fpm-apache2 ${PN}-pear ${PN}-phar ${MODPHP_PACKAGE} ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}-opcache ${PN}" + +RDEPENDS:${PN} += "libgcc" +RDEPENDS:${PN}-pear = "${PN}" +RDEPENDS:${PN}-phar = "${PN}-cli" +RDEPENDS:${PN}-cli = "${PN}" +RDEPENDS:${PN}-modphp = "${PN} apache2" +RDEPENDS:${PN}-opcache = "${PN}" + +ALLOW_EMPTY:${PN} = "1" + +INITSCRIPT_PACKAGES = "${PN}-fpm" +inherit update-rc.d + +FILES:${PN}-dbg =+ "${bindir}/.debug \ + ${libexecdir}/apache2/modules/.debug" +FILES:${PN}-doc += "${PHP_LIBDIR}/php/doc" +FILES:${PN}-cli = "${bindir}/php" +FILES:${PN}-phpdbg = "${bindir}/phpdbg" +FILES:${PN}-phar = "${bindir}/phar*" +FILES:${PN}-cgi = "${bindir}/php-cgi" +FILES:${PN}-fpm = "${sbindir}/php-fpm ${sysconfdir}/php-fpm.conf ${datadir}/fpm ${sysconfdir}/init.d/php-fpm ${systemd_unitdir}/system/php-fpm.service ${sysconfdir}/php-fpm.d/www.conf.default" +FILES:${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" +CONFFILES:${PN}-fpm = "${sysconfdir}/php-fpm.conf" +CONFFILES:${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" +INITSCRIPT_NAME:${PN}-fpm = "php-fpm" +INITSCRIPT_PARAMS:${PN}-fpm = "defaults 60" +FILES:${PN}-pear = "${bindir}/pear* ${bindir}/pecl ${PHP_LIBDIR}/php/PEAR \ + ${PHP_LIBDIR}/php/PEAR*.php ${PHP_LIBDIR}/php/System.php \ + ${PHP_LIBDIR}/php/peclcmd.php ${PHP_LIBDIR}/php/pearcmd.php \ + ${PHP_LIBDIR}/php/.channels ${PHP_LIBDIR}/php/.channels/.alias \ + ${PHP_LIBDIR}/php/.registry ${PHP_LIBDIR}/php/Archive/Tar.php \ + ${PHP_LIBDIR}/php/Console/Getopt.php ${PHP_LIBDIR}/php/OS/Guess.php \ + ${PHP_LIBDIR}/php/data/PEAR \ + ${sysconfdir}/pear.conf" +FILES:${PN}-dev = "${includedir}/php ${PHP_LIBDIR}/build ${bindir}/phpize \ + ${bindir}/php-config ${PHP_LIBDIR}/php/.depdb \ + ${PHP_LIBDIR}/php/.depdblock ${PHP_LIBDIR}/php/.filemap \ + ${PHP_LIBDIR}/php/.lock ${PHP_LIBDIR}/php/test" +FILES:${PN}-staticdev += "${PHP_LIBDIR}/extensions/*/*.a" +FILES:${PN}-opcache = "${PHP_LIBDIR}/extensions/*/opcache${SOLIBSDEV}" +FILES:${PN} = "${PHP_LIBDIR}/php" +FILES:${PN} += "${bindir} ${libexecdir}/apache2" + +SUMMARYP:${PN}-modphp = "PHP module for the Apache HTTP server" +FILES:${PN}-modphp = "${libdir}/apache2 ${sysconfdir}" + +MODPHP_OLDPACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'modphp', '', d)}" +RPROVIDESP:${PN}-modphp = "${MODPHP_OLDPACKAGE}" +RREPLACES:${PN}-modphp = "${MODPHP_OLDPACKAGE}" +RCONFLICTS:${PN}-modphp = "${MODPHP_OLDPACKAGE}" + +do_install:append:class-native() { + create_wrapper ${D}${bindir}/php \ + PHP_PEAR_SYSCONF_DIR=${sysconfdir}/ +} + + +# Fails to build with thumb-1 (qemuarm) +# | {standard input}: Assembler messages: +# | {standard input}:3719: Error: selected processor does not support Thumb mode `smull r0,r2,r9,r3' +# | {standard input}:3720: Error: unshifted register required -- `sub r2,r2,r0,asr#31' +# | {standard input}:3796: Error: selected processor does not support Thumb mode `smull r0,r2,r3,r3' +# | {standard input}:3797: Error: unshifted register required -- `sub r2,r2,r0,asr#31' +# | make: *** [ext/standard/math.lo] Error 1 +ARM_INSTRUCTION_SET = "arm"
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- recipes-support/curl/curl-morello_7.82.0.bb | 116 +++++ ...0001-openssl-fix-CN-check-error-code.patch | 38 ++ .../curl/files/CVE-2022-22576.patch | 145 ++++++ .../curl/files/CVE-2022-27774-1.patch | 45 ++ .../curl/files/CVE-2022-27774-2.patch | 80 +++ .../curl/files/CVE-2022-27774-3.patch | 83 ++++ .../curl/files/CVE-2022-27774-4.patch | 35 ++ .../curl/files/CVE-2022-27775.patch | 37 ++ .../curl/files/CVE-2022-27776.patch | 115 +++++ .../curl/files/CVE-2022-27779.patch | 42 ++ .../curl/files/CVE-2022-27780.patch | 33 ++ .../curl/files/CVE-2022-27781.patch | 43 ++ .../curl/files/CVE-2022-27782-1.patch | 458 ++++++++++++++++++ .../curl/files/CVE-2022-27782-2.patch | 71 +++ .../curl/files/CVE-2022-30115.patch | 82 ++++ .../curl/files/CVE-2022-32205.patch | 174 +++++++ .../curl/files/CVE-2022-32206.patch | 51 ++ .../curl/files/CVE-2022-32207.patch | 283 +++++++++++ .../curl/files/CVE-2022-32208.patch | 67 +++ .../curl/files/CVE-2022-32221.patch | 28 ++ .../curl/files/CVE-2022-35252.patch | 72 +++ .../curl/files/CVE-2022-42915.patch | 53 ++ .../curl/files/CVE-2022-42916.patch | 136 ++++++ .../curl/files/CVE-2022-43551.patch | 35 ++ .../curl/files/CVE-2022-43552.patch | 80 +++ .../curl/files/CVE-2023-23914_5-1.patch | 280 +++++++++++ .../curl/files/CVE-2023-23914_5-2.patch | 23 + .../curl/files/CVE-2023-23914_5-3.patch | 45 ++ .../curl/files/CVE-2023-23914_5-4.patch | 48 ++ .../curl/files/CVE-2023-23914_5-5.patch | 118 +++++ 30 files changed, 2916 insertions(+) create mode 100644 recipes-support/curl/curl-morello_7.82.0.bb create mode 100644 recipes-support/curl/files/0001-openssl-fix-CN-check-error-code.patch create mode 100644 recipes-support/curl/files/CVE-2022-22576.patch create mode 100644 recipes-support/curl/files/CVE-2022-27774-1.patch create mode 100644 recipes-support/curl/files/CVE-2022-27774-2.patch create mode 100644 recipes-support/curl/files/CVE-2022-27774-3.patch create mode 100644 recipes-support/curl/files/CVE-2022-27774-4.patch create mode 100644 recipes-support/curl/files/CVE-2022-27775.patch create mode 100644 recipes-support/curl/files/CVE-2022-27776.patch create mode 100644 recipes-support/curl/files/CVE-2022-27779.patch create mode 100644 recipes-support/curl/files/CVE-2022-27780.patch create mode 100644 recipes-support/curl/files/CVE-2022-27781.patch create mode 100644 recipes-support/curl/files/CVE-2022-27782-1.patch create mode 100644 recipes-support/curl/files/CVE-2022-27782-2.patch create mode 100644 recipes-support/curl/files/CVE-2022-30115.patch create mode 100644 recipes-support/curl/files/CVE-2022-32205.patch create mode 100644 recipes-support/curl/files/CVE-2022-32206.patch create mode 100644 recipes-support/curl/files/CVE-2022-32207.patch create mode 100644 recipes-support/curl/files/CVE-2022-32208.patch create mode 100644 recipes-support/curl/files/CVE-2022-32221.patch create mode 100644 recipes-support/curl/files/CVE-2022-35252.patch create mode 100644 recipes-support/curl/files/CVE-2022-42915.patch create mode 100644 recipes-support/curl/files/CVE-2022-42916.patch create mode 100644 recipes-support/curl/files/CVE-2022-43551.patch create mode 100644 recipes-support/curl/files/CVE-2022-43552.patch create mode 100644 recipes-support/curl/files/CVE-2023-23914_5-1.patch create mode 100644 recipes-support/curl/files/CVE-2023-23914_5-2.patch create mode 100644 recipes-support/curl/files/CVE-2023-23914_5-3.patch create mode 100644 recipes-support/curl/files/CVE-2023-23914_5-4.patch create mode 100644 recipes-support/curl/files/CVE-2023-23914_5-5.patch
diff --git a/recipes-support/curl/curl-morello_7.82.0.bb b/recipes-support/curl/curl-morello_7.82.0.bb new file mode 100644 index 0000000..fd1dd59 --- /dev/null +++ b/recipes-support/curl/curl-morello_7.82.0.bb @@ -0,0 +1,116 @@ +inherit autotools pkgconfig binconfig multilib_header +inherit purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-support/curl/curl_7.82.0.bb" + +SUMMARY = "Command line tool and library for client-side URL transfers" +DESCRIPTION = "It uses URL syntax to transfer data to and from servers. \ +curl is a widely used because of its ability to be flexible and complete \ +complex tasks. For example, you can use curl for things like user authentication, \ +HTTP post, SSL connections, proxy support, FTP uploads, and more!" +HOMEPAGE = "https://curl.se/" +BUGTRACKER = "https://github.com/curl/curl/issues" +SECTION = "console/network" +LICENSE = "curl" +LIC_FILES_CHKSUM = "file://COPYING;md5=190c514872597083303371684954f238" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +SRC_URI = "https://curl.se/download/curl-%24%7BPV%7D.tar.xz \ + file://CVE-2022-22576.patch \ + file://CVE-2022-27775.patch \ + file://CVE-2022-27776.patch \ + file://CVE-2022-27774-1.patch \ + file://CVE-2022-27774-2.patch \ + file://CVE-2022-27774-3.patch \ + file://CVE-2022-27774-4.patch \ + file://CVE-2022-30115.patch \ + file://CVE-2022-27780.patch \ + file://CVE-2022-27781.patch \ + file://CVE-2022-27779.patch \ + file://CVE-2022-27782-1.patch \ + file://CVE-2022-27782-2.patch \ + file://0001-openssl-fix-CN-check-error-code.patch \ + file://CVE-2022-32205.patch \ + file://CVE-2022-32206.patch \ + file://CVE-2022-32207.patch \ + file://CVE-2022-32208.patch \ + file://CVE-2022-35252.patch \ + file://CVE-2022-32221.patch \ + file://CVE-2022-42916.patch \ + file://CVE-2022-42915.patch \ + file://CVE-2022-43551.patch \ + file://CVE-2022-43552.patch \ + file://CVE-2023-23914_5-1.patch \ + file://CVE-2023-23914_5-2.patch \ + file://CVE-2023-23914_5-3.patch \ + file://CVE-2023-23914_5-4.patch \ + file://CVE-2023-23914_5-5.patch \ + " +SRC_URI[sha256sum] = "0aaa12d7bd04b0966254f2703ce80dd5c38dbbd76af0297d3d690cdce58a583c" + +S = "${WORKDIR}/curl-${PV}" + +# Curl has used many names over the years... +CVE_PRODUCT = "haxx:curl haxx:libcurl curl:curl curl:libcurl libcurl:libcurl daniel_stenberg:curl" + +# Entropy source for random PACKAGECONFIG option +RANDOM ?= "/dev/urandom" + +PACKAGECONFIG = "openssl proxy random verbose zlib" + +DEPENDS += "openssl-morello zlib-morello openldap-morello libidn2-morello" + +# 'ares' and 'threaded-resolver' are mutually exclusive +# PACKAGECONFIG[brotli] = "--with-brotli,--without-brotli,brotli" +PACKAGECONFIG[builtinmanual] = "--enable-manual,--disable-manual" +PACKAGECONFIG[dict] = "--enable-dict,--disable-dict," +PACKAGECONFIG[imap] = "--enable-imap,--disable-imap," +PACKAGECONFIG[libidn] = "--with-libidn2,--without-libidn2,libidn2-morello" +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," +PACKAGECONFIG[ldap] = "--enable-ldap,--disable-ldap,openldap-morello" +PACKAGECONFIG[ldaps] = "--enable-ldaps,--disable-ldaps,openldap-morello" +PACKAGECONFIG[mqtt] = "--enable-mqtt,--disable-mqtt," +PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl-morello" +PACKAGECONFIG[pop3] = "--enable-pop3,--disable-pop3," +PACKAGECONFIG[proxy] = "--enable-proxy,--disable-proxy," +PACKAGECONFIG[random] = "--with-random=${RANDOM},--without-random" +PACKAGECONFIG[smtp] = "--enable-smtp,--disable-smtp," +PACKAGECONFIG[verbose] = "--enable-verbose,--disable-verbose" +PACKAGECONFIG[zlib] = "--with-zlib,--without-zlib,zlib-morello" + +EXTRA_OECONF = " \ + --disable-manual \ + --enable-threaded-resolver \ + --disable-libcurl-option \ + --disable-ntlm-wb \ + --enable-crypto-auth \ + --with-ca-bundle=${sysconfdir}/ssl/certs/ca-certificates.crt \ + --without-libpsl \ + --enable-debug \ + --enable-optimize \ + --disable-curldebug \ +" + +do_install:append:class-target() { + # cleanup buildpaths from curl-config + sed -i \ + -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ + -e 's,--with-libtool-sysroot=${STAGING_DIR_TARGET},,g' \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + -e 's|${@" ".join(d.getVar("DEBUG_PREFIX_MAP").split())}||g' \ + ${D}${bindir}/curl-config +} + +do_install:append() { + ${READELF_COMMAND} ${D}${libdir}/libcurl.so > ${D}${PURECAP_DEBUGDIR}/libcurl.so.readelf +} + +PACKAGES =+ "lib${BPN}" + +FILES:lib${BPN} = "${libdir}/lib*.so.*" +RRECOMMENDS:lib${BPN} += "ca-certificates" + +FILES:${PN} += "${datadir}/zsh" + +SYSROOT_DIRS += "${bindir}" \ No newline at end of file diff --git a/recipes-support/curl/files/0001-openssl-fix-CN-check-error-code.patch b/recipes-support/curl/files/0001-openssl-fix-CN-check-error-code.patch new file mode 100644 index 0000000..c0a2355 --- /dev/null +++ b/recipes-support/curl/files/0001-openssl-fix-CN-check-error-code.patch @@ -0,0 +1,38 @@ +From 0677924c6ec7e0d68964553fb760f6d407242c54 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Tue, 8 Mar 2022 13:38:13 +0100 +Subject: [PATCH] openssl: fix CN check error code + +Due to a missing 'else' this returns error too easily. + +Regressed in: d15692ebb + +Reported-by: Kristoffer Gleditsch +Fixes #8559 +Closes #8560 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/911714d617c106ed5d553bf003e34ec94ab6a136] + +Signed-off-by: Jose Quaresma jose.quaresma@foundries.io + +--- + lib/vtls/openssl.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c +index 616a510..1bafe96 100644 +--- a/lib/vtls/openssl.c ++++ b/lib/vtls/openssl.c +@@ -1808,7 +1808,8 @@ CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn, + memcpy(peer_CN, ASN1_STRING_get0_data(tmp), peerlen); + peer_CN[peerlen] = '\0'; + } +- result = CURLE_OUT_OF_MEMORY; ++ else ++ result = CURLE_OUT_OF_MEMORY; + } + } + else /* not a UTF8 name */ +-- +2.34.1 + diff --git a/recipes-support/curl/files/CVE-2022-22576.patch b/recipes-support/curl/files/CVE-2022-22576.patch new file mode 100644 index 0000000..469cf22 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-22576.patch @@ -0,0 +1,145 @@ +From 371264697a70e8ed3da678aefbe20940759485fa Mon Sep 17 00:00:00 2001 +From: Patrick Monnerat patrick@monnerat.net +Date: Mon, 25 Apr 2022 11:44:05 +0200 +Subject: [PATCH] url: check sasl additional parameters for connection reuse. + +Also move static function safecmp() as non-static Curl_safecmp() since +its purpose is needed at several places. + +Bug: https://curl.se/docs/CVE-2022-22576.html + +CVE-2022-22576 + +Closes #8746 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/852aa5ad351ea53e5f01d2f44b5b4370c2bf5425] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/strcase.c | 10 ++++++++++ + lib/strcase.h | 2 ++ + lib/url.c | 13 ++++++++++++- + lib/urldata.h | 1 + + lib/vtls/vtls.c | 21 ++++++--------------- + 5 files changed, 31 insertions(+), 16 deletions(-) + +diff --git a/lib/strcase.c b/lib/strcase.c +index dd46ca1..692a3f1 100644 +--- a/lib/strcase.c ++++ b/lib/strcase.c +@@ -131,6 +131,16 @@ void Curl_strntolower(char *dest, const char *src, size_t n) + } while(*src++ && --n); + } + ++/* Compare case-sensitive NUL-terminated strings, taking care of possible ++ * null pointers. Return true if arguments match. ++ */ ++bool Curl_safecmp(char *a, char *b) ++{ ++ if(a && b) ++ return !strcmp(a, b); ++ return !a && !b; ++} ++ + /* --- public functions --- */ + + int curl_strequal(const char *first, const char *second) +diff --git a/lib/strcase.h b/lib/strcase.h +index b628656..382b80a 100644 +--- a/lib/strcase.h ++++ b/lib/strcase.h +@@ -47,4 +47,6 @@ char Curl_raw_toupper(char in); + void Curl_strntoupper(char *dest, const char *src, size_t n); + void Curl_strntolower(char *dest, const char *src, size_t n); + ++bool Curl_safecmp(char *a, char *b); ++ + #endif /* HEADER_CURL_STRCASE_H */ +diff --git a/lib/url.c b/lib/url.c +index adef2cd..94e3406 100644 +--- a/lib/url.c ++++ b/lib/url.c +@@ -779,6 +779,7 @@ static void conn_free(struct connectdata *conn) + Curl_safefree(conn->passwd); + Curl_safefree(conn->sasl_authzid); + Curl_safefree(conn->options); ++ Curl_safefree(conn->oauth_bearer); + Curl_dyn_free(&conn->trailer); + Curl_safefree(conn->host.rawalloc); /* host name buffer */ + Curl_safefree(conn->conn_to_host.rawalloc); /* host name buffer */ +@@ -1340,7 +1341,9 @@ ConnectionExists(struct Curl_easy *data, + /* This protocol requires credentials per connection, + so verify that we're using the same name and password as well */ + if(strcmp(needle->user, check->user) || +- strcmp(needle->passwd, check->passwd)) { ++ strcmp(needle->passwd, check->passwd) || ++ !Curl_safecmp(needle->sasl_authzid, check->sasl_authzid) || ++ !Curl_safecmp(needle->oauth_bearer, check->oauth_bearer)) { + /* one of them was different */ + continue; + } +@@ -3635,6 +3638,14 @@ static CURLcode create_conn(struct Curl_easy *data, + } + } + ++ if(data->set.str[STRING_BEARER]) { ++ conn->oauth_bearer = strdup(data->set.str[STRING_BEARER]); ++ if(!conn->oauth_bearer) { ++ result = CURLE_OUT_OF_MEMORY; ++ goto out; ++ } ++ } ++ + #ifdef USE_UNIX_SOCKETS + if(data->set.str[STRING_UNIX_SOCKET_PATH]) { + conn->unix_domain_socket = strdup(data->set.str[STRING_UNIX_SOCKET_PATH]); +diff --git a/lib/urldata.h b/lib/urldata.h +index cc8a600..03da59a 100644 +--- a/lib/urldata.h ++++ b/lib/urldata.h +@@ -984,6 +984,7 @@ struct connectdata { + char *passwd; /* password string, allocated */ + char *options; /* options string, allocated */ + char *sasl_authzid; /* authorisation identity string, allocated */ ++ char *oauth_bearer; /* OAUTH2 bearer, allocated */ + unsigned char httpversion; /* the HTTP version*10 reported by the server */ + struct curltime now; /* "current" time */ + struct curltime created; /* creation time */ +diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c +index 03b85ba..a40ac06 100644 +--- a/lib/vtls/vtls.c ++++ b/lib/vtls/vtls.c +@@ -125,15 +125,6 @@ static bool blobcmp(struct curl_blob *first, struct curl_blob *second) + return !memcmp(first->data, second->data, first->len); /* same data */ + } + +-static bool safecmp(char *a, char *b) +-{ +- if(a && b) +- return !strcmp(a, b); +- else if(!a && !b) +- return TRUE; /* match */ +- return FALSE; /* no match */ +-} +- + + bool + Curl_ssl_config_matches(struct ssl_primary_config *data, +@@ -147,12 +138,12 @@ Curl_ssl_config_matches(struct ssl_primary_config *data, + blobcmp(data->cert_blob, needle->cert_blob) && + blobcmp(data->ca_info_blob, needle->ca_info_blob) && + blobcmp(data->issuercert_blob, needle->issuercert_blob) && +- safecmp(data->CApath, needle->CApath) && +- safecmp(data->CAfile, needle->CAfile) && +- safecmp(data->issuercert, needle->issuercert) && +- safecmp(data->clientcert, needle->clientcert) && +- safecmp(data->random_file, needle->random_file) && +- safecmp(data->egdsocket, needle->egdsocket) && ++ Curl_safecmp(data->CApath, needle->CApath) && ++ Curl_safecmp(data->CAfile, needle->CAfile) && ++ Curl_safecmp(data->issuercert, needle->issuercert) && ++ Curl_safecmp(data->clientcert, needle->clientcert) && ++ Curl_safecmp(data->random_file, needle->random_file) && ++ Curl_safecmp(data->egdsocket, needle->egdsocket) && + Curl_safe_strcasecompare(data->cipher_list, needle->cipher_list) && + Curl_safe_strcasecompare(data->cipher_list13, needle->cipher_list13) && + Curl_safe_strcasecompare(data->curves, needle->curves) && diff --git a/recipes-support/curl/files/CVE-2022-27774-1.patch b/recipes-support/curl/files/CVE-2022-27774-1.patch new file mode 100644 index 0000000..f24003f --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-27774-1.patch @@ -0,0 +1,45 @@ +From f489d50ca5fd8b6a3a622e2521e2ca52787a6608 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 25 Apr 2022 16:24:33 +0200 +Subject: [PATCH] connect: store "conn_remote_port" in the info struct + +To make it available after the connection ended. + +Prerequisite for the patches that address CVE-2022-27774. + +Upstream-Status: Backport [https://github.com/curl/curl/commit/08b8ef4e726ba10f45081ecda5b3cea788d3c839] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/connect.c | 1 + + lib/urldata.h | 6 +++++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/lib/connect.c b/lib/connect.c +index 64f9511..7518807 100644 +--- a/lib/connect.c ++++ b/lib/connect.c +@@ -623,6 +623,7 @@ void Curl_persistconninfo(struct Curl_easy *data, struct connectdata *conn, + data->info.conn_scheme = conn->handler->scheme; + data->info.conn_protocol = conn->handler->protocol; + data->info.conn_primary_port = conn->port; ++ data->info.conn_remote_port = conn->remote_port; + data->info.conn_local_port = local_port; + } + +diff --git a/lib/urldata.h b/lib/urldata.h +index f92052a..5218f76 100644 +--- a/lib/urldata.h ++++ b/lib/urldata.h +@@ -1160,7 +1160,11 @@ struct PureInfo { + reused, in the connection cache. */ + + char conn_primary_ip[MAX_IPADR_LEN]; +- int conn_primary_port; ++ int conn_primary_port; /* this is the destination port to the connection, ++ which might have been a proxy */ ++ int conn_remote_port; /* this is the "remote port", which is the port ++ number of the used URL, independent of proxy or ++ not */ + char conn_local_ip[MAX_IPADR_LEN]; + int conn_local_port; + const char *conn_scheme; diff --git a/recipes-support/curl/files/CVE-2022-27774-2.patch b/recipes-support/curl/files/CVE-2022-27774-2.patch new file mode 100644 index 0000000..9739634 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-27774-2.patch @@ -0,0 +1,80 @@ +From 50aebd6ea20956513e9b7d7c776830b54d9c8ff6 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 25 Apr 2022 16:24:33 +0200 +Subject: [PATCH] transfer: redirects to other protocols or ports clear auth + +... unless explicitly permitted. + +Bug: https://curl.se/docs/CVE-2022-27774.html +Reported-by: Harry Sintonen +Closes #8748 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/620ea21410030a9977396b4661806bc187231b79] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/transfer.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 48 insertions(+), 1 deletion(-) + +diff --git a/lib/transfer.c b/lib/transfer.c +index 1f8019b..752fe14 100644 +--- a/lib/transfer.c ++++ b/lib/transfer.c +@@ -1608,10 +1608,57 @@ CURLcode Curl_follow(struct Curl_easy *data, + return CURLE_OUT_OF_MEMORY; + } + else { +- + uc = curl_url_get(data->state.uh, CURLUPART_URL, &newurl, 0); + if(uc) + return Curl_uc_to_curlcode(uc); ++ ++ /* Clear auth if this redirects to a different port number or protocol, ++ unless permitted */ ++ if(!data->set.allow_auth_to_other_hosts && (type != FOLLOW_FAKE)) { ++ char *portnum; ++ int port; ++ bool clear = FALSE; ++ ++ if(data->set.use_port && data->state.allow_port) ++ /* a custom port is used */ ++ port = (int)data->set.use_port; ++ else { ++ uc = curl_url_get(data->state.uh, CURLUPART_PORT, &portnum, ++ CURLU_DEFAULT_PORT); ++ if(uc) { ++ free(newurl); ++ return Curl_uc_to_curlcode(uc); ++ } ++ port = atoi(portnum); ++ free(portnum); ++ } ++ if(port != data->info.conn_remote_port) { ++ infof(data, "Clear auth, redirects to port from %u to %u", ++ data->info.conn_remote_port, port); ++ clear = TRUE; ++ } ++ else { ++ char *scheme; ++ const struct Curl_handler *p; ++ uc = curl_url_get(data->state.uh, CURLUPART_SCHEME, &scheme, 0); ++ if(uc) { ++ free(newurl); ++ return Curl_uc_to_curlcode(uc); ++ } ++ ++ p = Curl_builtin_scheme(scheme); ++ if(p && (p->protocol != data->info.conn_protocol)) { ++ infof(data, "Clear auth, redirects scheme from %s to %s", ++ data->info.conn_scheme, scheme); ++ clear = TRUE; ++ } ++ free(scheme); ++ } ++ if(clear) { ++ Curl_safefree(data->state.aptr.user); ++ Curl_safefree(data->state.aptr.passwd); ++ } ++ } + } + + if(type == FOLLOW_FAKE) { diff --git a/recipes-support/curl/files/CVE-2022-27774-3.patch b/recipes-support/curl/files/CVE-2022-27774-3.patch new file mode 100644 index 0000000..e4e8c29 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-27774-3.patch @@ -0,0 +1,83 @@ +From 8af08ebf94bc6448dbc7da59845f5b78964689d9 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 25 Apr 2022 17:59:15 +0200 +Subject: [PATCH] openssl: don't leak the SRP credentials in redirects either + +Follow-up to 620ea21410030 + +Reported-by: Harry Sintonen +Closes #8751 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/139a54ed0a172adaaf1a78d6f4fff50b2c3f9e08] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/http.c | 10 +++++----- + lib/http.h | 6 ++++++ + lib/vtls/openssl.c | 3 ++- + 3 files changed, 13 insertions(+), 6 deletions(-) + +diff --git a/lib/http.c b/lib/http.c +index 0791dcf..4433824 100644 +--- a/lib/http.c ++++ b/lib/http.c +@@ -776,10 +776,10 @@ output_auth_headers(struct Curl_easy *data, + } + + /* +- * allow_auth_to_host() tells if autentication, cookies or other "sensitive +- * data" can (still) be sent to this host. ++ * Curl_allow_auth_to_host() tells if authentication, cookies or other ++ * "sensitive data" can (still) be sent to this host. + */ +-static bool allow_auth_to_host(struct Curl_easy *data) ++bool Curl_allow_auth_to_host(struct Curl_easy *data) + { + struct connectdata *conn = data->conn; + return (!data->state.this_is_a_follow || +@@ -864,7 +864,7 @@ Curl_http_output_auth(struct Curl_easy *data, + + /* To prevent the user+password to get sent to other than the original host + due to a location-follow */ +- if(allow_auth_to_host(data) ++ if(Curl_allow_auth_to_host(data) + #ifndef CURL_DISABLE_NETRC + || conn->bits.netrc + #endif +@@ -1917,7 +1917,7 @@ CURLcode Curl_add_custom_headers(struct Curl_easy *data, + checkprefix("Cookie:", compare)) && + /* be careful of sending this potentially sensitive header to + other hosts */ +- !allow_auth_to_host(data)) ++ !Curl_allow_auth_to_host(data)) + ; + else { + #ifdef USE_HYPER +diff --git a/lib/http.h b/lib/http.h +index 07e963d..9000bae 100644 +--- a/lib/http.h ++++ b/lib/http.h +@@ -320,4 +320,10 @@ Curl_http_output_auth(struct Curl_easy *data, + bool proxytunnel); /* TRUE if this is the request setting + up the proxy tunnel */ + ++/* ++ * Curl_allow_auth_to_host() tells if authentication, cookies or other ++ * "sensitive data" can (still) be sent to this host. ++ */ ++bool Curl_allow_auth_to_host(struct Curl_easy *data); ++ + #endif /* HEADER_CURL_HTTP_H */ +diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c +index 616a510..e8633f4 100644 +--- a/lib/vtls/openssl.c ++++ b/lib/vtls/openssl.c +@@ -2893,7 +2893,8 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data, + #endif + + #ifdef USE_OPENSSL_SRP +- if(ssl_authtype == CURL_TLSAUTH_SRP) { ++ if((ssl_authtype == CURL_TLSAUTH_SRP) && ++ Curl_allow_auth_to_host(data)) { + char * const ssl_username = SSL_SET_OPTION(username); + + infof(data, "Using TLS-SRP username: %s", ssl_username); diff --git a/recipes-support/curl/files/CVE-2022-27774-4.patch b/recipes-support/curl/files/CVE-2022-27774-4.patch new file mode 100644 index 0000000..a642336 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-27774-4.patch @@ -0,0 +1,35 @@ +From 56a145d6ca031841610daeebde99fbde0f8fcf21 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Tue, 26 Apr 2022 07:46:19 +0200 +Subject: [PATCH] gnutls: don't leak the SRP credentials in redirects + +Follow-up to 620ea21410030 and 139a54ed0a172a + +Reported-by: Harry Sintonen +Closes #8752 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/093531556203decd92d92bccd431edbe5561781c] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/vtls/gtls.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c +index 5749376..fe45b3a 100644 +--- a/lib/vtls/gtls.c ++++ b/lib/vtls/gtls.c +@@ -437,11 +437,11 @@ gtls_connect_step1(struct Curl_easy *data, + } + + #ifdef HAVE_GNUTLS_SRP +- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) { ++ if((SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) && ++ Curl_allow_auth_to_host(data)) { + infof(data, "Using TLS-SRP username: %s", SSL_SET_OPTION(username)); + +- rc = gnutls_srp_allocate_client_credentials( +- &backend->srp_client_cred); ++ rc = gnutls_srp_allocate_client_credentials(&backend->srp_client_cred); + if(rc != GNUTLS_E_SUCCESS) { + failf(data, "gnutls_srp_allocate_client_cred() failed: %s", + gnutls_strerror(rc)); diff --git a/recipes-support/curl/files/CVE-2022-27775.patch b/recipes-support/curl/files/CVE-2022-27775.patch new file mode 100644 index 0000000..666a906 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-27775.patch @@ -0,0 +1,37 @@ +From eef2b165c39245857b1663e9153e7c4b4b519a4c Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 25 Apr 2022 11:48:00 +0200 +Subject: [PATCH] conncache: include the zone id in the "bundle" hashkey + +Make connections to two separate IPv6 zone ids create separate +connections. + +Reported-by: Harry Sintonen +Bug: https://curl.se/docs/CVE-2022-27775.html +Closes #8747 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/058f98dc3fe595f21dc26a5b9b1699e519ba5705] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/conncache.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/lib/conncache.c b/lib/conncache.c +index cd5756a..9b9f683 100644 +--- a/lib/conncache.c ++++ b/lib/conncache.c +@@ -155,8 +155,12 @@ static void hashkey(struct connectdata *conn, char *buf, + /* report back which name we used */ + *hostp = hostname; + +- /* put the number first so that the hostname gets cut off if too long */ +- msnprintf(buf, len, "%ld%s", port, hostname); ++ /* put the numbers first so that the hostname gets cut off if too long */ ++#ifdef ENABLE_IPV6 ++ msnprintf(buf, len, "%u/%ld/%s", conn->scope_id, port, hostname); ++#else ++ msnprintf(buf, len, "%ld/%s", port, hostname); ++#endif + Curl_strntolower(buf, buf, len); + } + diff --git a/recipes-support/curl/files/CVE-2022-27776.patch b/recipes-support/curl/files/CVE-2022-27776.patch new file mode 100644 index 0000000..2feee45 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-27776.patch @@ -0,0 +1,115 @@ +From f6eba3638f9b25adfe85f3570f9a0fb2ceb09c2b Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 25 Apr 2022 13:05:40 +0200 +Subject: [PATCH] http: avoid auth/cookie on redirects same host diff port + +CVE-2022-27776 + +Reported-by: Harry Sintonen +Bug: https://curl.se/docs/CVE-2022-27776.html +Closes #8749 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/6e659993952aa5f90f48864be84a1bbb047fc258] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/http.c | 34 ++++++++++++++++++++++------------ + lib/urldata.h | 16 +++++++++------- + 2 files changed, 31 insertions(+), 19 deletions(-) + +diff --git a/lib/http.c b/lib/http.c +index 799d4fb..0791dcf 100644 +--- a/lib/http.c ++++ b/lib/http.c +@@ -775,6 +775,21 @@ output_auth_headers(struct Curl_easy *data, + return CURLE_OK; + } + ++/* ++ * allow_auth_to_host() tells if autentication, cookies or other "sensitive ++ * data" can (still) be sent to this host. ++ */ ++static bool allow_auth_to_host(struct Curl_easy *data) ++{ ++ struct connectdata *conn = data->conn; ++ return (!data->state.this_is_a_follow || ++ data->set.allow_auth_to_other_hosts || ++ (data->state.first_host && ++ strcasecompare(data->state.first_host, conn->host.name) && ++ (data->state.first_remote_port == conn->remote_port) && ++ (data->state.first_remote_protocol == conn->handler->protocol))); ++} ++ + /** + * Curl_http_output_auth() setups the authentication headers for the + * host/proxy and the correct authentication +@@ -847,17 +862,14 @@ Curl_http_output_auth(struct Curl_easy *data, + with it */ + authproxy->done = TRUE; + +- /* To prevent the user+password to get sent to other than the original +- host due to a location-follow, we do some weirdo checks here */ +- if(!data->state.this_is_a_follow || ++ /* To prevent the user+password to get sent to other than the original host ++ due to a location-follow */ ++ if(allow_auth_to_host(data) + #ifndef CURL_DISABLE_NETRC +- conn->bits.netrc || ++ || conn->bits.netrc + #endif +- !data->state.first_host || +- data->set.allow_auth_to_other_hosts || +- strcasecompare(data->state.first_host, conn->host.name)) { ++ ) + result = output_auth_headers(data, conn, authhost, request, path, FALSE); +- } + else + authhost->done = TRUE; + +@@ -1905,10 +1917,7 @@ CURLcode Curl_add_custom_headers(struct Curl_easy *data, + checkprefix("Cookie:", compare)) && + /* be careful of sending this potentially sensitive header to + other hosts */ +- (data->state.this_is_a_follow && +- data->state.first_host && +- !data->set.allow_auth_to_other_hosts && +- !strcasecompare(data->state.first_host, conn->host.name))) ++ !allow_auth_to_host(data)) + ; + else { + #ifdef USE_HYPER +@@ -2084,6 +2093,7 @@ CURLcode Curl_http_host(struct Curl_easy *data, struct connectdata *conn) + return CURLE_OUT_OF_MEMORY; + + data->state.first_remote_port = conn->remote_port; ++ data->state.first_remote_protocol = conn->handler->protocol; + } + Curl_safefree(data->state.aptr.host); + +diff --git a/lib/urldata.h b/lib/urldata.h +index 03da59a..f92052a 100644 +--- a/lib/urldata.h ++++ b/lib/urldata.h +@@ -1329,14 +1329,16 @@ struct UrlState { + char *ulbuf; /* allocated upload buffer or NULL */ + curl_off_t current_speed; /* the ProgressShow() function sets this, + bytes / second */ +- char *first_host; /* host name of the first (not followed) request. +- if set, this should be the host name that we will +- sent authorization to, no else. Used to make Location: +- following not keep sending user+password... This is +- strdup() data. +- */ ++ ++ /* host name, port number and protocol of the first (not followed) request. ++ if set, this should be the host name that we will sent authorization to, ++ no else. Used to make Location: following not keep sending user+password. ++ This is strdup()ed data. */ ++ char *first_host; ++ int first_remote_port; ++ unsigned int first_remote_protocol; ++ + int retrycount; /* number of retries on a new connection */ +- int first_remote_port; /* remote port of the first (not followed) request */ + struct Curl_ssl_session *session; /* array of 'max_ssl_sessions' size */ + long sessionage; /* number of the most recent session */ + struct tempbuf tempwrite[3]; /* BOTH, HEADER, BODY */ diff --git a/recipes-support/curl/files/CVE-2022-27779.patch b/recipes-support/curl/files/CVE-2022-27779.patch new file mode 100644 index 0000000..235be90 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-27779.patch @@ -0,0 +1,42 @@ +From 33dac5777fe5f9c8d2d7d340144b1685cd511d11 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 9 May 2022 16:47:06 +0200 +Subject: [PATCH] cookies: make bad_domain() not consider a trailing dot fine + +The check for a dot in the domain must not consider a single trailing +dot to be fine, as then TLD + trailing dot is fine and curl will accept +setting cookies for it. + +CVE-2022-27779 + +Reported-by: Axel Chong +Bug: https://curl.se/docs/CVE-2022-27779.html +Closes #8820 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/7e92d12b4e6911f424678a133b19de670e183a59] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/cookie.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/lib/cookie.c b/lib/cookie.c +index d418efa..1b8c8f9 100644 +--- a/lib/cookie.c ++++ b/lib/cookie.c +@@ -427,7 +427,15 @@ static void remove_expired(struct CookieInfo *cookies) + /* Make sure domain contains a dot or is localhost. */ + static bool bad_domain(const char *domain) + { +- return !strchr(domain, '.') && !strcasecompare(domain, "localhost"); ++ if(strcasecompare(domain, "localhost")) ++ return FALSE; ++ else { ++ /* there must be a dot present, but that dot must not be a trailing dot */ ++ char *dot = strchr(domain, '.'); ++ if(dot) ++ return dot[1] ? FALSE : TRUE; ++ } ++ return TRUE; + } + + /* diff --git a/recipes-support/curl/files/CVE-2022-27780.patch b/recipes-support/curl/files/CVE-2022-27780.patch new file mode 100644 index 0000000..8820af3 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-27780.patch @@ -0,0 +1,33 @@ +From 304b7acf73712fa501119b1ca0724f71f3074fe7 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 9 May 2022 08:19:38 +0200 +Subject: [PATCH] urlapi: reject percent-decoding host name into separator + bytes + +CVE-2022-27780 + +Reported-by: Axel Chong +Bug: https://curl.se/docs/CVE-2022-27780.html +Closes #8826 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/914aaab9153764ef8fa4178215b8ad89d3ac263a] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/urlapi.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/urlapi.c b/lib/urlapi.c +index ff00ee4..00222fc 100644 +--- a/lib/urlapi.c ++++ b/lib/urlapi.c +@@ -678,8 +678,8 @@ static CURLUcode hostname_check(struct Curl_URL *u, char *hostname) + #endif + } + else { +- /* letters from the second string is not ok */ +- len = strcspn(hostname, " \r\n"); ++ /* letters from the second string are not ok */ ++ len = strcspn(hostname, " \r\n\t/:#?!@"); + if(hlen != len) + /* hostname with bad content */ + return CURLUE_BAD_HOSTNAME; diff --git a/recipes-support/curl/files/CVE-2022-27781.patch b/recipes-support/curl/files/CVE-2022-27781.patch new file mode 100644 index 0000000..52f39a0 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-27781.patch @@ -0,0 +1,43 @@ +From 5bb5b2a901db4c6441fc451f21408be2a9463058 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 9 May 2022 10:07:15 +0200 +Subject: [PATCH] nss: return error if seemingly stuck in a cert loop + +CVE-2022-27781 + +Reported-by: Florian Kohnhäuser +Bug: https://curl.se/docs/CVE-2022-27781.html +Closes #8822 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/5c7da89d404bf59c8dd82a001119a16d18365917] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/vtls/nss.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c +index 558e3be..52f2060 100644 +--- a/lib/vtls/nss.c ++++ b/lib/vtls/nss.c +@@ -983,6 +983,9 @@ static void display_cert_info(struct Curl_easy *data, + PR_Free(common_name); + } + ++/* A number of certs that will never occur in a real server handshake */ ++#define TOO_MANY_CERTS 300 ++ + static CURLcode display_conn_info(struct Curl_easy *data, PRFileDesc *sock) + { + CURLcode result = CURLE_OK; +@@ -1018,6 +1021,11 @@ static CURLcode display_conn_info(struct Curl_easy *data, PRFileDesc *sock) + cert2 = CERT_FindCertIssuer(cert, now, certUsageSSLCA); + while(cert2) { + i++; ++ if(i >= TOO_MANY_CERTS) { ++ CERT_DestroyCertificate(cert2); ++ failf(data, "certificate loop"); ++ return CURLE_SSL_CERTPROBLEM; ++ } + if(cert2->isRoot) { + CERT_DestroyCertificate(cert2); + break; diff --git a/recipes-support/curl/files/CVE-2022-27782-1.patch b/recipes-support/curl/files/CVE-2022-27782-1.patch new file mode 100644 index 0000000..ce2599b --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-27782-1.patch @@ -0,0 +1,458 @@ +From acee9eb38639b35af9047521d71333423657de0d Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 9 May 2022 23:13:53 +0200 +Subject: [PATCH] tls: check more TLS details for connection reuse + +CVE-2022-27782 + +Reported-by: Harry Sintonen +Bug: https://curl.se/docs/CVE-2022-27782.html +Closes #8825 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/f18af4f874cecab82a9797e8c7541e0990c7a64c] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/setopt.c | 29 +++++++++++++++++------------ + lib/url.c | 23 ++++++++++++++++------- + lib/urldata.h | 13 +++++++------ + lib/vtls/gtls.c | 32 +++++++++++++++++--------------- + lib/vtls/mbedtls.c | 2 +- + lib/vtls/nss.c | 6 +++--- + lib/vtls/openssl.c | 10 +++++----- + lib/vtls/vtls.c | 21 +++++++++++++++++++++ + 8 files changed, 87 insertions(+), 49 deletions(-) + +diff --git a/lib/setopt.c b/lib/setopt.c +index 8e1bf12..7aa6fdb 100644 +--- a/lib/setopt.c ++++ b/lib/setopt.c +@@ -2294,6 +2294,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) + + case CURLOPT_SSL_OPTIONS: + arg = va_arg(param, long); ++ data->set.ssl.primary.ssl_options = (unsigned char)(arg & 0xff); + data->set.ssl.enable_beast = !!(arg & CURLSSLOPT_ALLOW_BEAST); + data->set.ssl.no_revoke = !!(arg & CURLSSLOPT_NO_REVOKE); + data->set.ssl.no_partialchain = !!(arg & CURLSSLOPT_NO_PARTIALCHAIN); +@@ -2307,6 +2308,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) + #ifndef CURL_DISABLE_PROXY + case CURLOPT_PROXY_SSL_OPTIONS: + arg = va_arg(param, long); ++ data->set.proxy_ssl.primary.ssl_options = (unsigned char)(arg & 0xff); + data->set.proxy_ssl.enable_beast = !!(arg & CURLSSLOPT_ALLOW_BEAST); + data->set.proxy_ssl.no_revoke = !!(arg & CURLSSLOPT_NO_REVOKE); + data->set.proxy_ssl.no_partialchain = !!(arg & CURLSSLOPT_NO_PARTIALCHAIN); +@@ -2745,49 +2747,52 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) + case CURLOPT_TLSAUTH_USERNAME: + result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME], + va_arg(param, char *)); +- if(data->set.str[STRING_TLSAUTH_USERNAME] && !data->set.ssl.authtype) +- data->set.ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ ++ if(data->set.str[STRING_TLSAUTH_USERNAME] && ++ !data->set.ssl.primary.authtype) ++ data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ + break; + #ifndef CURL_DISABLE_PROXY + case CURLOPT_PROXY_TLSAUTH_USERNAME: + result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME_PROXY], + va_arg(param, char *)); + if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] && +- !data->set.proxy_ssl.authtype) +- data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ ++ !data->set.proxy_ssl.primary.authtype) ++ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to ++ SRP */ + break; + #endif + case CURLOPT_TLSAUTH_PASSWORD: + result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD], + va_arg(param, char *)); +- if(data->set.str[STRING_TLSAUTH_USERNAME] && !data->set.ssl.authtype) +- data->set.ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ ++ if(data->set.str[STRING_TLSAUTH_USERNAME] && ++ !data->set.ssl.primary.authtype) ++ data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default */ + break; + #ifndef CURL_DISABLE_PROXY + case CURLOPT_PROXY_TLSAUTH_PASSWORD: + result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD_PROXY], + va_arg(param, char *)); + if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] && +- !data->set.proxy_ssl.authtype) +- data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ ++ !data->set.proxy_ssl.primary.authtype) ++ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default */ + break; + #endif + case CURLOPT_TLSAUTH_TYPE: + argptr = va_arg(param, char *); + if(!argptr || + strncasecompare(argptr, "SRP", strlen("SRP"))) +- data->set.ssl.authtype = CURL_TLSAUTH_SRP; ++ data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; + else +- data->set.ssl.authtype = CURL_TLSAUTH_NONE; ++ data->set.ssl.primary.authtype = CURL_TLSAUTH_NONE; + break; + #ifndef CURL_DISABLE_PROXY + case CURLOPT_PROXY_TLSAUTH_TYPE: + argptr = va_arg(param, char *); + if(!argptr || + strncasecompare(argptr, "SRP", strlen("SRP"))) +- data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; ++ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; + else +- data->set.proxy_ssl.authtype = CURL_TLSAUTH_NONE; ++ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_NONE; + break; + #endif + #endif +diff --git a/lib/url.c b/lib/url.c +index 94e3406..5ebf5e2 100644 +--- a/lib/url.c ++++ b/lib/url.c +@@ -540,7 +540,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data) + set->ssl.primary.verifypeer = TRUE; + set->ssl.primary.verifyhost = TRUE; + #ifdef USE_TLS_SRP +- set->ssl.authtype = CURL_TLSAUTH_NONE; ++ set->ssl.primary.authtype = CURL_TLSAUTH_NONE; + #endif + set->ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth + type */ +@@ -1758,11 +1758,17 @@ static struct connectdata *allocate_conn(struct Curl_easy *data) + conn->ssl_config.verifystatus = data->set.ssl.primary.verifystatus; + conn->ssl_config.verifypeer = data->set.ssl.primary.verifypeer; + conn->ssl_config.verifyhost = data->set.ssl.primary.verifyhost; ++ conn->ssl_config.ssl_options = data->set.ssl.primary.ssl_options; ++#ifdef USE_TLS_SRP ++#endif + #ifndef CURL_DISABLE_PROXY + conn->proxy_ssl_config.verifystatus = + data->set.proxy_ssl.primary.verifystatus; + conn->proxy_ssl_config.verifypeer = data->set.proxy_ssl.primary.verifypeer; + conn->proxy_ssl_config.verifyhost = data->set.proxy_ssl.primary.verifyhost; ++ conn->proxy_ssl_config.ssl_options = data->set.proxy_ssl.primary.ssl_options; ++#ifdef USE_TLS_SRP ++#endif + #endif + conn->ip_version = data->set.ipver; + conn->bits.connect_only = data->set.connect_only; +@@ -3848,7 +3854,8 @@ static CURLcode create_conn(struct Curl_easy *data, + data->set.str[STRING_SSL_ISSUERCERT_PROXY]; + data->set.proxy_ssl.primary.issuercert_blob = + data->set.blobs[BLOB_SSL_ISSUERCERT_PROXY]; +- data->set.proxy_ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_PROXY]; ++ data->set.proxy_ssl.primary.CRLfile = ++ data->set.str[STRING_SSL_CRLFILE_PROXY]; + data->set.proxy_ssl.cert_type = data->set.str[STRING_CERT_TYPE_PROXY]; + data->set.proxy_ssl.key = data->set.str[STRING_KEY_PROXY]; + data->set.proxy_ssl.key_type = data->set.str[STRING_KEY_TYPE_PROXY]; +@@ -3856,18 +3863,20 @@ static CURLcode create_conn(struct Curl_easy *data, + data->set.proxy_ssl.primary.clientcert = data->set.str[STRING_CERT_PROXY]; + data->set.proxy_ssl.key_blob = data->set.blobs[BLOB_KEY_PROXY]; + #endif +- data->set.ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE]; ++ data->set.ssl.primary.CRLfile = data->set.str[STRING_SSL_CRLFILE]; + data->set.ssl.cert_type = data->set.str[STRING_CERT_TYPE]; + data->set.ssl.key = data->set.str[STRING_KEY]; + data->set.ssl.key_type = data->set.str[STRING_KEY_TYPE]; + data->set.ssl.key_passwd = data->set.str[STRING_KEY_PASSWD]; + data->set.ssl.primary.clientcert = data->set.str[STRING_CERT]; + #ifdef USE_TLS_SRP +- data->set.ssl.username = data->set.str[STRING_TLSAUTH_USERNAME]; +- data->set.ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD]; ++ data->set.ssl.primary.username = data->set.str[STRING_TLSAUTH_USERNAME]; ++ data->set.ssl.primary.password = data->set.str[STRING_TLSAUTH_PASSWORD]; + #ifndef CURL_DISABLE_PROXY +- data->set.proxy_ssl.username = data->set.str[STRING_TLSAUTH_USERNAME_PROXY]; +- data->set.proxy_ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD_PROXY]; ++ data->set.proxy_ssl.primary.username = ++ data->set.str[STRING_TLSAUTH_USERNAME_PROXY]; ++ data->set.proxy_ssl.primary.password = ++ data->set.str[STRING_TLSAUTH_PASSWORD_PROXY]; + #endif + #endif + data->set.ssl.key_blob = data->set.blobs[BLOB_KEY]; +diff --git a/lib/urldata.h b/lib/urldata.h +index 5218f76..e006495 100644 +--- a/lib/urldata.h ++++ b/lib/urldata.h +@@ -253,10 +253,17 @@ struct ssl_primary_config { + char *cipher_list; /* list of ciphers to use */ + char *cipher_list13; /* list of TLS 1.3 cipher suites to use */ + char *pinned_key; ++ char *CRLfile; /* CRL to check certificate revocation */ + struct curl_blob *cert_blob; + struct curl_blob *ca_info_blob; + struct curl_blob *issuercert_blob; ++#ifdef USE_TLS_SRP ++ char *username; /* TLS username (for, e.g., SRP) */ ++ char *password; /* TLS password (for, e.g., SRP) */ ++ enum CURL_TLSAUTH authtype; /* TLS authentication type (default SRP) */ ++#endif + char *curves; /* list of curves to use */ ++ unsigned char ssl_options; /* the CURLOPT_SSL_OPTIONS bitmask */ + BIT(verifypeer); /* set TRUE if this is desired */ + BIT(verifyhost); /* set TRUE if CN/SAN must match hostname */ + BIT(verifystatus); /* set TRUE if certificate status must be checked */ +@@ -266,7 +273,6 @@ struct ssl_primary_config { + struct ssl_config_data { + struct ssl_primary_config primary; + long certverifyresult; /* result from the certificate verification */ +- char *CRLfile; /* CRL to check certificate revocation */ + curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */ + void *fsslctxp; /* parameter for call back */ + char *cert_type; /* format for certificate (default: PEM)*/ +@@ -274,11 +280,6 @@ struct ssl_config_data { + struct curl_blob *key_blob; + char *key_type; /* format for private key (default: PEM) */ + char *key_passwd; /* plain text private key password */ +-#ifdef USE_TLS_SRP +- char *username; /* TLS username (for, e.g., SRP) */ +- char *password; /* TLS password (for, e.g., SRP) */ +- enum CURL_TLSAUTH authtype; /* TLS authentication type (default SRP) */ +-#endif + BIT(certinfo); /* gather lots of certificate info */ + BIT(falsestart); + BIT(enable_beast); /* allow this flaw for interoperability's sake*/ +diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c +index fe45b3a..3c31782 100644 +--- a/lib/vtls/gtls.c ++++ b/lib/vtls/gtls.c +@@ -437,9 +437,10 @@ gtls_connect_step1(struct Curl_easy *data, + } + + #ifdef HAVE_GNUTLS_SRP +- if((SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) && ++ if((SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP) && + Curl_allow_auth_to_host(data)) { +- infof(data, "Using TLS-SRP username: %s", SSL_SET_OPTION(username)); ++ infof(data, "Using TLS-SRP username: %s", ++ SSL_SET_OPTION(primary.username)); + + rc = gnutls_srp_allocate_client_credentials(&backend->srp_client_cred); + if(rc != GNUTLS_E_SUCCESS) { +@@ -449,8 +450,8 @@ gtls_connect_step1(struct Curl_easy *data, + } + + rc = gnutls_srp_set_client_credentials(backend->srp_client_cred, +- SSL_SET_OPTION(username), +- SSL_SET_OPTION(password)); ++ SSL_SET_OPTION(primary.username), ++ SSL_SET_OPTION(primary.password)); + if(rc != GNUTLS_E_SUCCESS) { + failf(data, "gnutls_srp_set_client_cred() failed: %s", + gnutls_strerror(rc)); +@@ -507,19 +508,19 @@ gtls_connect_step1(struct Curl_easy *data, + } + #endif + +- if(SSL_SET_OPTION(CRLfile)) { ++ if(SSL_SET_OPTION(primary.CRLfile)) { + /* set the CRL list file */ + rc = gnutls_certificate_set_x509_crl_file(backend->cred, +- SSL_SET_OPTION(CRLfile), ++ SSL_SET_OPTION(primary.CRLfile), + GNUTLS_X509_FMT_PEM); + if(rc < 0) { + failf(data, "error reading crl file %s (%s)", +- SSL_SET_OPTION(CRLfile), gnutls_strerror(rc)); ++ SSL_SET_OPTION(primary.CRLfile), gnutls_strerror(rc)); + return CURLE_SSL_CRL_BADFILE; + } + else + infof(data, "found %d CRL in %s", +- rc, SSL_SET_OPTION(CRLfile)); ++ rc, SSL_SET_OPTION(primary.CRLfile)); + } + + /* Initialize TLS session as a client */ +@@ -590,7 +591,7 @@ gtls_connect_step1(struct Curl_easy *data, + #ifdef HAVE_GNUTLS_SRP + /* Only add SRP to the cipher list if SRP is requested. Otherwise + * GnuTLS will disable TLS 1.3 support. */ +- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) { ++ if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP) { + size_t len = strlen(prioritylist); + + char *prioritysrp = malloc(len + sizeof(GNUTLS_SRP) + 1); +@@ -685,7 +686,7 @@ gtls_connect_step1(struct Curl_easy *data, + + #ifdef HAVE_GNUTLS_SRP + /* put the credentials to the current session */ +- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) { ++ if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP) { + rc = gnutls_credentials_set(session, GNUTLS_CRD_SRP, + backend->srp_client_cred); + if(rc != GNUTLS_E_SUCCESS) { +@@ -867,8 +868,8 @@ Curl_gtls_verifyserver(struct Curl_easy *data, + SSL_CONN_CONFIG(verifyhost) || + SSL_CONN_CONFIG(issuercert)) { + #ifdef HAVE_GNUTLS_SRP +- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP +- && SSL_SET_OPTION(username) != NULL ++ if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP ++ && SSL_SET_OPTION(primary.username) + && !SSL_CONN_CONFIG(verifypeer) + && gnutls_cipher_get(session)) { + /* no peer cert, but auth is ok if we have SRP user and cipher and no +@@ -926,7 +927,8 @@ Curl_gtls_verifyserver(struct Curl_easy *data, + failf(data, "server certificate verification failed. CAfile: %s " + "CRLfile: %s", SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile): + "none", +- SSL_SET_OPTION(CRLfile)?SSL_SET_OPTION(CRLfile):"none"); ++ SSL_SET_OPTION(primary.CRLfile) ? ++ SSL_SET_OPTION(primary.CRLfile) : "none"); + return CURLE_PEER_FAILED_VERIFICATION; + } + else +@@ -1556,8 +1558,8 @@ static int gtls_shutdown(struct Curl_easy *data, struct connectdata *conn, + gnutls_certificate_free_credentials(backend->cred); + + #ifdef HAVE_GNUTLS_SRP +- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP +- && SSL_SET_OPTION(username) != NULL) ++ if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP ++ && SSL_SET_OPTION(primary.username) != NULL) + gnutls_srp_free_client_credentials(backend->srp_client_cred); + #endif + +diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c +index b9fd26a..bd4ad8f 100644 +--- a/lib/vtls/mbedtls.c ++++ b/lib/vtls/mbedtls.c +@@ -279,7 +279,7 @@ mbed_connect_step1(struct Curl_easy *data, struct connectdata *conn, + const char * const ssl_capath = SSL_CONN_CONFIG(CApath); + char * const ssl_cert = SSL_SET_OPTION(primary.clientcert); + const struct curl_blob *ssl_cert_blob = SSL_SET_OPTION(primary.cert_blob); +- const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile); ++ const char * const ssl_crlfile = SSL_SET_OPTION(primary.CRLfile); + const char * const hostname = SSL_HOST_NAME(); + #ifndef CURL_DISABLE_VERBOSE_STRINGS + const long int port = SSL_HOST_PORT(); +diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c +index 52f2060..959e23e 100644 +--- a/lib/vtls/nss.c ++++ b/lib/vtls/nss.c +@@ -2035,13 +2035,13 @@ static CURLcode nss_setup_connect(struct Curl_easy *data, + } + } + +- if(SSL_SET_OPTION(CRLfile)) { +- const CURLcode rv = nss_load_crl(SSL_SET_OPTION(CRLfile)); ++ if(SSL_SET_OPTION(primary.CRLfile)) { ++ const CURLcode rv = nss_load_crl(SSL_SET_OPTION(primary.CRLfile)); + if(rv) { + result = rv; + goto error; + } +- infof(data, " CRLfile: %s", SSL_SET_OPTION(CRLfile)); ++ infof(data, " CRLfile: %s", SSL_SET_OPTION(primary.CRLfile)); + } + + if(SSL_SET_OPTION(primary.clientcert)) { +diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c +index e8633f4..d98bbcb 100644 +--- a/lib/vtls/openssl.c ++++ b/lib/vtls/openssl.c +@@ -2632,7 +2632,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data, + #endif + const long int ssl_version = SSL_CONN_CONFIG(version); + #ifdef USE_OPENSSL_SRP +- const enum CURL_TLSAUTH ssl_authtype = SSL_SET_OPTION(authtype); ++ const enum CURL_TLSAUTH ssl_authtype = SSL_SET_OPTION(primary.authtype); + #endif + char * const ssl_cert = SSL_SET_OPTION(primary.clientcert); + const struct curl_blob *ssl_cert_blob = SSL_SET_OPTION(primary.cert_blob); +@@ -2643,7 +2643,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data, + (ca_info_blob ? NULL : SSL_CONN_CONFIG(CAfile)); + const char * const ssl_capath = SSL_CONN_CONFIG(CApath); + const bool verifypeer = SSL_CONN_CONFIG(verifypeer); +- const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile); ++ const char * const ssl_crlfile = SSL_SET_OPTION(primary.CRLfile); + char error_buffer[256]; + struct ssl_backend_data *backend = connssl->backend; + bool imported_native_ca = false; +@@ -2895,15 +2895,15 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data, + #ifdef USE_OPENSSL_SRP + if((ssl_authtype == CURL_TLSAUTH_SRP) && + Curl_allow_auth_to_host(data)) { +- char * const ssl_username = SSL_SET_OPTION(username); +- ++ char * const ssl_username = SSL_SET_OPTION(primary.username); ++ char * const ssl_password = SSL_SET_OPTION(primary.password); + infof(data, "Using TLS-SRP username: %s", ssl_username); + + if(!SSL_CTX_set_srp_username(backend->ctx, ssl_username)) { + failf(data, "Unable to set SRP user name"); + return CURLE_BAD_FUNCTION_ARGUMENT; + } +- if(!SSL_CTX_set_srp_password(backend->ctx, SSL_SET_OPTION(password))) { ++ if(!SSL_CTX_set_srp_password(backend->ctx, ssl_password)) { + failf(data, "failed setting SRP password"); + return CURLE_BAD_FUNCTION_ARGUMENT; + } +diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c +index a40ac06..e2d3438 100644 +--- a/lib/vtls/vtls.c ++++ b/lib/vtls/vtls.c +@@ -132,6 +132,7 @@ Curl_ssl_config_matches(struct ssl_primary_config *data, + { + if((data->version == needle->version) && + (data->version_max == needle->version_max) && ++ (data->ssl_options == needle->ssl_options) && + (data->verifypeer == needle->verifypeer) && + (data->verifyhost == needle->verifyhost) && + (data->verifystatus == needle->verifystatus) && +@@ -144,9 +145,15 @@ Curl_ssl_config_matches(struct ssl_primary_config *data, + Curl_safecmp(data->clientcert, needle->clientcert) && + Curl_safecmp(data->random_file, needle->random_file) && + Curl_safecmp(data->egdsocket, needle->egdsocket) && ++#ifdef USE_TLS_SRP ++ Curl_safecmp(data->username, needle->username) && ++ Curl_safecmp(data->password, needle->password) && ++ (data->authtype == needle->authtype) && ++#endif + Curl_safe_strcasecompare(data->cipher_list, needle->cipher_list) && + Curl_safe_strcasecompare(data->cipher_list13, needle->cipher_list13) && + Curl_safe_strcasecompare(data->curves, needle->curves) && ++ Curl_safe_strcasecompare(data->CRLfile, needle->CRLfile) && + Curl_safe_strcasecompare(data->pinned_key, needle->pinned_key)) + return TRUE; + +@@ -163,6 +170,10 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source, + dest->verifyhost = source->verifyhost; + dest->verifystatus = source->verifystatus; + dest->sessionid = source->sessionid; ++ dest->ssl_options = source->ssl_options; ++#ifdef USE_TLS_SRP ++ dest->authtype = source->authtype; ++#endif + + CLONE_BLOB(cert_blob); + CLONE_BLOB(ca_info_blob); +@@ -177,6 +188,11 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source, + CLONE_STRING(cipher_list13); + CLONE_STRING(pinned_key); + CLONE_STRING(curves); ++ CLONE_STRING(CRLfile); ++#ifdef USE_TLS_SRP ++ CLONE_STRING(username); ++ CLONE_STRING(password); ++#endif + + return TRUE; + } +@@ -196,6 +212,11 @@ void Curl_free_primary_ssl_config(struct ssl_primary_config *sslc) + Curl_safefree(sslc->ca_info_blob); + Curl_safefree(sslc->issuercert_blob); + Curl_safefree(sslc->curves); ++ Curl_safefree(sslc->CRLfile); ++#ifdef USE_TLS_SRP ++ Curl_safefree(sslc->username); ++ Curl_safefree(sslc->password); ++#endif + } + + #ifdef USE_SSL diff --git a/recipes-support/curl/files/CVE-2022-27782-2.patch b/recipes-support/curl/files/CVE-2022-27782-2.patch new file mode 100644 index 0000000..74fa7f8 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-27782-2.patch @@ -0,0 +1,71 @@ +From 782a5e8e5b0271f8cb33eeef6a3819b0149093e0 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 9 May 2022 23:13:53 +0200 +Subject: [PATCH] url: check SSH config match on connection reuse + +CVE-2022-27782 + +Reported-by: Harry Sintonen +Bug: https://curl.se/docs/CVE-2022-27782.html +Closes #8825 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/1645e9b44505abd5cbaf65da5282c3f33b5924a5] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/url.c | 11 +++++++++++ + lib/vssh/ssh.h | 6 +++--- + 2 files changed, 14 insertions(+), 3 deletions(-) + +diff --git a/lib/url.c b/lib/url.c +index 5ebf5e2..c713e54 100644 +--- a/lib/url.c ++++ b/lib/url.c +@@ -1098,6 +1098,12 @@ static void prune_dead_connections(struct Curl_easy *data) + } + } + ++static bool ssh_config_matches(struct connectdata *one, ++ struct connectdata *two) ++{ ++ return (Curl_safecmp(one->proto.sshc.rsa, two->proto.sshc.rsa) && ++ Curl_safecmp(one->proto.sshc.rsa_pub, two->proto.sshc.rsa_pub)); ++} + /* + * Given one filled in connection struct (named needle), this function should + * detect if there already is one that has all the significant details +@@ -1356,6 +1362,11 @@ ConnectionExists(struct Curl_easy *data, + (data->state.httpwant < CURL_HTTP_VERSION_2_0)) + continue; + ++ if(get_protocol_family(needle->handler) == PROTO_FAMILY_SSH) { ++ if(!ssh_config_matches(needle, check)) ++ continue; ++ } ++ + if((needle->handler->flags&PROTOPT_SSL) + #ifndef CURL_DISABLE_PROXY + || !needle->bits.httpproxy || needle->bits.tunnel_proxy +diff --git a/lib/vssh/ssh.h b/lib/vssh/ssh.h +index 7972081..30d82e5 100644 +--- a/lib/vssh/ssh.h ++++ b/lib/vssh/ssh.h +@@ -7,7 +7,7 @@ + * | (__| |_| | _ <| |___ + * ___|___/|_| ______| + * +- * Copyright (C) 1998 - 2021, Daniel Stenberg, daniel@haxx.se, et al. ++ * Copyright (C) 1998 - 2022, Daniel Stenberg, daniel@haxx.se, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms +@@ -131,8 +131,8 @@ struct ssh_conn { + + /* common */ + const char *passphrase; /* pass-phrase to use */ +- char *rsa_pub; /* path name */ +- char *rsa; /* path name */ ++ char *rsa_pub; /* strdup'ed public key file */ ++ char *rsa; /* strdup'ed private key file */ + bool authed; /* the connection has been authenticated fine */ + bool acceptfail; /* used by the SFTP_QUOTE (continue if + quote command fails) */ diff --git a/recipes-support/curl/files/CVE-2022-30115.patch b/recipes-support/curl/files/CVE-2022-30115.patch new file mode 100644 index 0000000..96839cf --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-30115.patch @@ -0,0 +1,82 @@ +From 8313ef3f507b5bdc54e985cae71aa9df00609d55 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 9 May 2022 08:13:55 +0200 +Subject: [PATCH] hsts: ignore trailing dots when comparing hosts names + +CVE-2022-30115 + +Reported-by: Axel Chong +Bug: https://curl.se/docs/CVE-2022-30115.html +Closes #8821 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/fae6fea209a2d4db1582f608bd8cc8000721733a] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/hsts.c | 30 +++++++++++++++++++++++++----- + 1 file changed, 25 insertions(+), 5 deletions(-) + +diff --git a/lib/hsts.c b/lib/hsts.c +index 03fcc9e..b9fa6f7 100644 +--- a/lib/hsts.c ++++ b/lib/hsts.c +@@ -114,16 +114,25 @@ static CURLcode hsts_create(struct hsts *h, + curl_off_t expires) + { + struct stsentry *sts = hsts_entry(); ++ char *duphost; ++ size_t hlen; + if(!sts) + return CURLE_OUT_OF_MEMORY; + +- sts->expires = expires; +- sts->includeSubDomains = subdomains; +- sts->host = strdup(hostname); +- if(!sts->host) { ++ duphost = strdup(hostname); ++ if(!duphost) { + free(sts); + return CURLE_OUT_OF_MEMORY; + } ++ ++ hlen = strlen(duphost); ++ if(duphost[hlen - 1] == '.') ++ /* strip off trailing any dot */ ++ duphost[--hlen] = 0; ++ ++ sts->host = duphost; ++ sts->expires = expires; ++ sts->includeSubDomains = subdomains; + Curl_llist_insert_next(&h->list, h->list.tail, sts, &sts->node); + return CURLE_OK; + } +@@ -238,10 +247,21 @@ struct stsentry *Curl_hsts(struct hsts *h, const char *hostname, + bool subdomain) + { + if(h) { ++ char buffer[MAX_HSTS_HOSTLEN + 1]; + time_t now = time(NULL); + size_t hlen = strlen(hostname); + struct Curl_llist_element *e; + struct Curl_llist_element *n; ++ ++ if((hlen > MAX_HSTS_HOSTLEN) || !hlen) ++ return NULL; ++ memcpy(buffer, hostname, hlen); ++ if(hostname[hlen-1] == '.') ++ /* remove the trailing dot */ ++ --hlen; ++ buffer[hlen] = 0; ++ hostname = buffer; ++ + for(e = h->list.head; e; e = n) { + struct stsentry *sts = e->ptr; + n = e->next; +@@ -440,7 +460,7 @@ static CURLcode hsts_pull(struct Curl_easy *data, struct hsts *h) + CURLSTScode sc; + DEBUGASSERT(h); + do { +- char buffer[257]; ++ char buffer[MAX_HSTS_HOSTLEN + 1]; + struct curl_hstsentry e; + e.name = buffer; + e.namelen = sizeof(buffer)-1; diff --git a/recipes-support/curl/files/CVE-2022-32205.patch b/recipes-support/curl/files/CVE-2022-32205.patch new file mode 100644 index 0000000..165fd8a --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-32205.patch @@ -0,0 +1,174 @@ +From a91c22a072cbb32e296f1efba3502f1b7775dfaf Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Sun, 26 Jun 2022 11:00:48 +0200 +Subject: [PATCH] cookie: apply limits + +- Send no more than 150 cookies per request +- Cap the max length used for a cookie: header to 8K +- Cap the max number of received Set-Cookie: headers to 50 + +Bug: https://curl.se/docs/CVE-2022-32205.html +CVE-2022-32205 +Reported-by: Harry Sintonen +Closes #9048 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/48d7064a49148f0394] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/cookie.c | 14 ++++++++++++-- + lib/cookie.h | 21 +++++++++++++++++++-- + lib/http.c | 13 +++++++++++-- + lib/urldata.h | 1 + + 4 files changed, 43 insertions(+), 6 deletions(-) + +diff --git a/lib/cookie.c b/lib/cookie.c +index 1b8c8f9..8a6aa1a 100644 +--- a/lib/cookie.c ++++ b/lib/cookie.c +@@ -477,6 +477,10 @@ Curl_cookie_add(struct Curl_easy *data, + (void)data; + #endif + ++ DEBUGASSERT(MAX_SET_COOKIE_AMOUNT <= 255); /* counter is an unsigned char */ ++ if(data->req.setcookies >= MAX_SET_COOKIE_AMOUNT) ++ return NULL; ++ + /* First, alloc and init a new struct for it */ + co = calloc(1, sizeof(struct Cookie)); + if(!co) +@@ -816,7 +820,7 @@ Curl_cookie_add(struct Curl_easy *data, + freecookie(co); + return NULL; + } +- ++ data->req.setcookies++; + } + else { + /* +@@ -1354,7 +1358,8 @@ static struct Cookie *dup_cookie(struct Cookie *src) + * + * It shall only return cookies that haven't expired. + */ +-struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, ++struct Cookie *Curl_cookie_getlist(struct Curl_easy *data, ++ struct CookieInfo *c, + const char *host, const char *path, + bool secure) + { +@@ -1409,6 +1414,11 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, + mainco = newco; + + matches++; ++ if(matches >= MAX_COOKIE_SEND_AMOUNT) { ++ infof(data, "Included max number of cookies (%u) in request!", ++ matches); ++ break; ++ } + } + else + goto fail; +diff --git a/lib/cookie.h b/lib/cookie.h +index 0ffe08e..7411980 100644 +--- a/lib/cookie.h ++++ b/lib/cookie.h +@@ -81,10 +81,26 @@ struct CookieInfo { + */ + #define MAX_COOKIE_LINE 5000 + +-/* This is the maximum length of a cookie name or content we deal with: */ ++/* Maximum length of an incoming cookie name or content we deal with. Longer ++ cookies are ignored. */ + #define MAX_NAME 4096 + #define MAX_NAME_TXT "4095" + ++/* Maximum size for an outgoing cookie line libcurl will use in an http ++ request. This is the default maximum length used in some versions of Apache ++ httpd. */ ++#define MAX_COOKIE_HEADER_LEN 8190 ++ ++/* Maximum number of cookies libcurl will send in a single request, even if ++ there might be more cookies that match. One reason to cap the number is to ++ keep the maximum HTTP request within the maximum allowed size. */ ++#define MAX_COOKIE_SEND_AMOUNT 150 ++ ++/* Maximum number of Set-Cookie: lines accepted in a single response. If more ++ such header lines are received, they are ignored. This value must be less ++ than 256 since an unsigned char is used to count. */ ++#define MAX_SET_COOKIE_AMOUNT 50 ++ + struct Curl_easy; + /* + * Add a cookie to the internal list of cookies. The domain and path arguments +@@ -97,7 +113,8 @@ struct Cookie *Curl_cookie_add(struct Curl_easy *data, + const char *domain, const char *path, + bool secure); + +-struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, const char *host, ++struct Cookie *Curl_cookie_getlist(struct Curl_easy *data, ++ struct CookieInfo *c, const char *host, + const char *path, bool secure); + void Curl_cookie_freelist(struct Cookie *cookies); + void Curl_cookie_clearall(struct CookieInfo *cookies); +diff --git a/lib/http.c b/lib/http.c +index 4433824..2c8b0c4 100644 +--- a/lib/http.c ++++ b/lib/http.c +@@ -2709,12 +2709,14 @@ CURLcode Curl_http_bodysend(struct Curl_easy *data, struct connectdata *conn, + } + + #if !defined(CURL_DISABLE_COOKIES) ++ + CURLcode Curl_http_cookies(struct Curl_easy *data, + struct connectdata *conn, + struct dynbuf *r) + { + CURLcode result = CURLE_OK; + char *addcookies = NULL; ++ bool linecap = FALSE; + if(data->set.str[STRING_COOKIE] && + !Curl_checkheaders(data, STRCONST("Cookie"))) + addcookies = data->set.str[STRING_COOKIE]; +@@ -2732,7 +2734,7 @@ CURLcode Curl_http_cookies(struct Curl_easy *data, + !strcmp(host, "127.0.0.1") || + !strcmp(host, "[::1]") ? TRUE : FALSE; + Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); +- co = Curl_cookie_getlist(data->cookies, host, data->state.up.path, ++ co = Curl_cookie_getlist(data, data->cookies, host, data->state.up.path, + secure_context); + Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); + } +@@ -2746,6 +2748,13 @@ CURLcode Curl_http_cookies(struct Curl_easy *data, + if(result) + break; + } ++ if((Curl_dyn_len(r) + strlen(co->name) + strlen(co->value) + 1) >= ++ MAX_COOKIE_HEADER_LEN) { ++ infof(data, "Restricted outgoing cookies due to header size, " ++ "'%s' not sent", co->name); ++ linecap = TRUE; ++ break; ++ } + result = Curl_dyn_addf(r, "%s%s=%s", count?"; ":"", + co->name, co->value); + if(result) +@@ -2756,7 +2765,7 @@ CURLcode Curl_http_cookies(struct Curl_easy *data, + } + Curl_cookie_freelist(store); + } +- if(addcookies && !result) { ++ if(addcookies && !result && !linecap) { + if(!count) + result = Curl_dyn_addn(r, STRCONST("Cookie: ")); + if(!result) { +diff --git a/lib/urldata.h b/lib/urldata.h +index e006495..54faf7d 100644 +--- a/lib/urldata.h ++++ b/lib/urldata.h +@@ -707,6 +707,7 @@ struct SingleRequest { + #ifndef CURL_DISABLE_DOH + struct dohdata *doh; /* DoH specific data for this request */ + #endif ++ unsigned char setcookies; + BIT(header); /* incoming data has HTTP header */ + BIT(content_range); /* set TRUE if Content-Range: was found */ + BIT(upload_done); /* set to TRUE when doing chunked transfer-encoding diff --git a/recipes-support/curl/files/CVE-2022-32206.patch b/recipes-support/curl/files/CVE-2022-32206.patch new file mode 100644 index 0000000..25f5b27 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-32206.patch @@ -0,0 +1,51 @@ +From e12531340b03d242d3f892aa8797faf12b56dddf Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 16 May 2022 16:28:13 +0200 +Subject: [PATCH] content_encoding: return error on too many compression steps + +The max allowed steps is arbitrarily set to 5. + +Bug: https://curl.se/docs/CVE-2022-32206.html +CVE-2022-32206 +Reported-by: Harry Sintonen +Closes #9049 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/3a09fbb7f264c67c43] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/content_encoding.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/lib/content_encoding.c b/lib/content_encoding.c +index c03637a..6f994b3 100644 +--- a/lib/content_encoding.c ++++ b/lib/content_encoding.c +@@ -1026,12 +1026,16 @@ static const struct content_encoding *find_encoding(const char *name, + return NULL; + } + ++/* allow no more than 5 "chained" compression steps */ ++#define MAX_ENCODE_STACK 5 ++ + /* Set-up the unencoding stack from the Content-Encoding header value. + * See RFC 7231 section 3.1.2.2. */ + CURLcode Curl_build_unencoding_stack(struct Curl_easy *data, + const char *enclist, int maybechunked) + { + struct SingleRequest *k = &data->req; ++ int counter = 0; + + do { + const char *name; +@@ -1066,6 +1070,11 @@ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data, + if(!encoding) + encoding = &error_encoding; /* Defer error at stack use. */ + ++ if(++counter >= MAX_ENCODE_STACK) { ++ failf(data, "Reject response due to %u content encodings", ++ counter); ++ return CURLE_BAD_CONTENT_ENCODING; ++ } + /* Stack the unencoding stage. */ + writer = new_unencoding_writer(data, encoding, k->writer_stack); + if(!writer) diff --git a/recipes-support/curl/files/CVE-2022-32207.patch b/recipes-support/curl/files/CVE-2022-32207.patch new file mode 100644 index 0000000..bc16b62 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-32207.patch @@ -0,0 +1,283 @@ +From 759088694e2ba68ddc5ffe042b071dadad6ff675 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Wed, 25 May 2022 10:09:53 +0200 +Subject: [PATCH] fopen: add Curl_fopen() for better overwriting of files + +Bug: https://curl.se/docs/CVE-2022-32207.html +CVE-2022-32207 +Reported-by: Harry Sintonen +Closes #9050 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/20f9dd6bae50b] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + CMakeLists.txt | 1 + + configure.ac | 1 + + lib/Makefile.inc | 2 + + lib/cookie.c | 19 ++----- + lib/curl_config.h.cmake | 3 ++ + lib/fopen.c | 113 ++++++++++++++++++++++++++++++++++++++++ + lib/fopen.h | 30 +++++++++++ + 7 files changed, 154 insertions(+), 15 deletions(-) + create mode 100644 lib/fopen.c + create mode 100644 lib/fopen.h + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b77de6d..a0bfaad 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1027,6 +1027,7 @@ elseif(HAVE_LIBSOCKET) + set(CMAKE_REQUIRED_LIBRARIES socket) + endif() + ++check_symbol_exists(fchmod "${CURL_INCLUDES}" HAVE_FCHMOD) + check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME) + check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET) + check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT) +diff --git a/configure.ac b/configure.ac +index d431870..7433bb9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3351,6 +3351,7 @@ AC_CHECK_DECLS([getpwuid_r], [], [AC_DEFINE(HAVE_DECL_GETPWUID_R_MISSING, 1, "Se + + + AC_CHECK_FUNCS([fnmatch \ ++ fchmod \ + geteuid \ + getpass_r \ + getppid \ +diff --git a/lib/Makefile.inc b/lib/Makefile.inc +index e8f110f..5139b03 100644 +--- a/lib/Makefile.inc ++++ b/lib/Makefile.inc +@@ -133,6 +133,7 @@ LIB_CFILES = \ + escape.c \ + file.c \ + fileinfo.c \ ++ fopen.c \ + formdata.c \ + ftp.c \ + ftplistparser.c \ +@@ -263,6 +264,7 @@ LIB_HFILES = \ + escape.h \ + file.h \ + fileinfo.h \ ++ fopen.h \ + formdata.h \ + ftp.h \ + ftplistparser.h \ +diff --git a/lib/cookie.c b/lib/cookie.c +index 8a6aa1a..cb0c03b 100644 +--- a/lib/cookie.c ++++ b/lib/cookie.c +@@ -96,8 +96,8 @@ Example set of cookies: + #include "curl_get_line.h" + #include "curl_memrchr.h" + #include "parsedate.h" +-#include "rand.h" + #include "rename.h" ++#include "fopen.h" + + /* The last 3 #include files should be in this order */ + #include "curl_printf.h" +@@ -1620,20 +1620,9 @@ static CURLcode cookie_output(struct Curl_easy *data, + use_stdout = TRUE; + } + else { +- unsigned char randsuffix[9]; +- +- if(Curl_rand_hex(data, randsuffix, sizeof(randsuffix))) +- return 2; +- +- tempstore = aprintf("%s.%s.tmp", filename, randsuffix); +- if(!tempstore) +- return CURLE_OUT_OF_MEMORY; +- +- out = fopen(tempstore, FOPEN_WRITETEXT); +- if(!out) { +- error = CURLE_WRITE_ERROR; ++ error = Curl_fopen(data, filename, &out, &tempstore); ++ if(error) + goto error; +- } + } + + fputs("# Netscape HTTP Cookie File\n" +@@ -1680,7 +1669,7 @@ static CURLcode cookie_output(struct Curl_easy *data, + if(!use_stdout) { + fclose(out); + out = NULL; +- if(Curl_rename(tempstore, filename)) { ++ if(tempstore && Curl_rename(tempstore, filename)) { + unlink(tempstore); + error = CURLE_WRITE_ERROR; + goto error; +diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake +index d2a0f43..c254359 100644 +--- a/lib/curl_config.h.cmake ++++ b/lib/curl_config.h.cmake +@@ -157,6 +157,9 @@ + /* Define to 1 if you have the <assert.h> header file. */ + #cmakedefine HAVE_ASSERT_H 1 + ++/* Define to 1 if you have the `fchmod' function. */ ++#cmakedefine HAVE_FCHMOD 1 ++ + /* Define to 1 if you have the `basename' function. */ + #cmakedefine HAVE_BASENAME 1 + +diff --git a/lib/fopen.c b/lib/fopen.c +new file mode 100644 +index 0000000..ad3691b +--- /dev/null ++++ b/lib/fopen.c +@@ -0,0 +1,113 @@ ++/*************************************************************************** ++ * _ _ ____ _ ++ * Project ___| | | | _ | | ++ * / __| | | | |_) | | ++ * | (__| |_| | _ <| |___ ++ * ___|___/|_| ______| ++ * ++ * Copyright (C) 1998 - 2022, Daniel Stenberg, daniel@haxx.se, et al. ++ * ++ * This software is licensed as described in the file COPYING, which ++ * you should have received as part of this distribution. The terms ++ * are also available at https://curl.se/docs/copyright.html. ++ * ++ * You may opt to use, copy, modify, merge, publish, distribute and/or sell ++ * copies of the Software, and permit persons to whom the Software is ++ * furnished to do so, under the terms of the COPYING file. ++ * ++ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY ++ * KIND, either express or implied. ++ * ++ * SPDX-License-Identifier: curl ++ * ++ ***************************************************************************/ ++ ++#include "curl_setup.h" ++ ++#if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC) || \ ++ !defined(CURL_DISABLE_HSTS) ++ ++#ifdef HAVE_FCNTL_H ++#include <fcntl.h> ++#endif ++ ++#include "urldata.h" ++#include "rand.h" ++#include "fopen.h" ++/* The last 3 #include files should be in this order */ ++#include "curl_printf.h" ++#include "curl_memory.h" ++#include "memdebug.h" ++ ++/* ++ * Curl_fopen() opens a file for writing with a temp name, to be renamed ++ * to the final name when completed. If there is an existing file using this ++ * name at the time of the open, this function will clone the mode from that ++ * file. if 'tempname' is non-NULL, it needs a rename after the file is ++ * written. ++ */ ++CURLcode Curl_fopen(struct Curl_easy *data, const char *filename, ++ FILE **fh, char **tempname) ++{ ++ CURLcode result = CURLE_WRITE_ERROR; ++ unsigned char randsuffix[9]; ++ char *tempstore = NULL; ++ struct_stat sb; ++ int fd = -1; ++ *tempname = NULL; ++ ++ if(stat(filename, &sb) == -1 || !S_ISREG(sb.st_mode)) { ++ /* a non-regular file, fallback to direct fopen() */ ++ *fh = fopen(filename, FOPEN_WRITETEXT); ++ if(*fh) ++ return CURLE_OK; ++ goto fail; ++ } ++ ++ result = Curl_rand_hex(data, randsuffix, sizeof(randsuffix)); ++ if(result) ++ goto fail; ++ ++ tempstore = aprintf("%s.%s.tmp", filename, randsuffix); ++ if(!tempstore) { ++ result = CURLE_OUT_OF_MEMORY; ++ goto fail; ++ } ++ ++ result = CURLE_WRITE_ERROR; ++ fd = open(tempstore, O_WRONLY | O_CREAT | O_EXCL, 0600); ++ if(fd == -1) ++ goto fail; ++ ++#ifdef HAVE_FCHMOD ++ { ++ struct_stat nsb; ++ if((fstat(fd, &nsb) != -1) && ++ (nsb.st_uid == sb.st_uid) && (nsb.st_gid == sb.st_gid)) { ++ /* if the user and group are the same, clone the original mode */ ++ if(fchmod(fd, sb.st_mode) == -1) ++ goto fail; ++ } ++ } ++#endif ++ ++ *fh = fdopen(fd, FOPEN_WRITETEXT); ++ if(!*fh) ++ goto fail; ++ ++ *tempname = tempstore; ++ return CURLE_OK; ++ ++fail: ++ if(fd != -1) { ++ close(fd); ++ unlink(tempstore); ++ } ++ ++ free(tempstore); ++ ++ *tempname = NULL; ++ return result; ++} ++ ++#endif /* ! disabled */ +diff --git a/lib/fopen.h b/lib/fopen.h +new file mode 100644 +index 0000000..289e55f +--- /dev/null ++++ b/lib/fopen.h +@@ -0,0 +1,30 @@ ++#ifndef HEADER_CURL_FOPEN_H ++#define HEADER_CURL_FOPEN_H ++/*************************************************************************** ++ * _ _ ____ _ ++ * Project ___| | | | _ | | ++ * / __| | | | |_) | | ++ * | (__| |_| | _ <| |___ ++ * ___|___/|_| ______| ++ * ++ * Copyright (C) 1998 - 2022, Daniel Stenberg, daniel@haxx.se, et al. ++ * ++ * This software is licensed as described in the file COPYING, which ++ * you should have received as part of this distribution. The terms ++ * are also available at https://curl.se/docs/copyright.html. ++ * ++ * You may opt to use, copy, modify, merge, publish, distribute and/or sell ++ * copies of the Software, and permit persons to whom the Software is ++ * furnished to do so, under the terms of the COPYING file. ++ * ++ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY ++ * KIND, either express or implied. ++ * ++ * SPDX-License-Identifier: curl ++ * ++ ***************************************************************************/ ++ ++CURLcode Curl_fopen(struct Curl_easy *data, const char *filename, ++ FILE **fh, char **tempname); ++ ++#endif diff --git a/recipes-support/curl/files/CVE-2022-32208.patch b/recipes-support/curl/files/CVE-2022-32208.patch new file mode 100644 index 0000000..9a4e398 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-32208.patch @@ -0,0 +1,67 @@ +From fd2ffddec315c029e923e6e6f2c049809d01a5fc Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Thu, 9 Jun 2022 09:27:24 +0200 +Subject: [PATCH] krb5: return error properly on decode errors + +Bug: https://curl.se/docs/CVE-2022-32208.html +CVE-2022-32208 +Reported-by: Harry Sintonen +Closes #9051 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/6ecdf5136b52af7] +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/krb5.c | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/lib/krb5.c b/lib/krb5.c +index 787137c..6f9e1f7 100644 +--- a/lib/krb5.c ++++ b/lib/krb5.c +@@ -140,11 +140,8 @@ krb5_decode(void *app_data, void *buf, int len, + enc.value = buf; + enc.length = len; + maj = gss_unwrap(&min, *context, &enc, &dec, NULL, NULL); +- if(maj != GSS_S_COMPLETE) { +- if(len >= 4) +- strcpy(buf, "599 "); ++ if(maj != GSS_S_COMPLETE) + return -1; +- } + + memcpy(buf, dec.value, dec.length); + len = curlx_uztosi(dec.length); +@@ -506,6 +503,7 @@ static CURLcode read_data(struct connectdata *conn, + { + int len; + CURLcode result; ++ int nread; + + result = socket_read(fd, &len, sizeof(len)); + if(result) +@@ -514,7 +512,10 @@ static CURLcode read_data(struct connectdata *conn, + if(len) { + /* only realloc if there was a length */ + len = ntohl(len); +- buf->data = Curl_saferealloc(buf->data, len); ++ if(len > CURL_MAX_INPUT_LENGTH) ++ len = 0; ++ else ++ buf->data = Curl_saferealloc(buf->data, len); + } + if(!len || !buf->data) + return CURLE_OUT_OF_MEMORY; +@@ -522,8 +523,11 @@ static CURLcode read_data(struct connectdata *conn, + result = socket_read(fd, buf->data, len); + if(result) + return result; +- buf->size = conn->mech->decode(conn->app_data, buf->data, len, +- conn->data_prot, conn); ++ nread = conn->mech->decode(conn->app_data, buf->data, len, ++ conn->data_prot, conn); ++ if(nread < 0) ++ return CURLE_RECV_ERROR; ++ buf->size = (size_t)nread; + buf->index = 0; + return CURLE_OK; + } diff --git a/recipes-support/curl/files/CVE-2022-32221.patch b/recipes-support/curl/files/CVE-2022-32221.patch new file mode 100644 index 0000000..b78b2ce --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-32221.patch @@ -0,0 +1,28 @@ +From a64e3e59938abd7d667e4470a18072a24d7e9de9 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Thu, 15 Sep 2022 09:22:45 +0200 +Subject: [PATCH] setopt: when POST is set, reset the 'upload' field + +Reported-by: RobBotic1 on github +Fixes #9507 +Closes #9511 + +CVE: CVE-2022-32221 +Upstream-Status: Backport [https://github.com/curl/curl/commit/a64e3e59938abd7d667e4470a18072a24d7e9de9] +Signed-off-by: Bhabu Bindu bhabu.bindu@kpit.com +--- + lib/setopt.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/setopt.c b/lib/setopt.c +index 03c4efdbf1e58..7289a4e78bdd0 100644 +--- a/lib/setopt.c ++++ b/lib/setopt.c +@@ -700,6 +700,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) + } + else + data->set.method = HTTPREQ_GET; ++ data->set.upload = FALSE; + break; + + case CURLOPT_HTTPPOST: diff --git a/recipes-support/curl/files/CVE-2022-35252.patch b/recipes-support/curl/files/CVE-2022-35252.patch new file mode 100644 index 0000000..7b6f81b --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-35252.patch @@ -0,0 +1,72 @@ +From 62c09239ac4e08239c8e363b06901fc80637d8c7 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 29 Aug 2022 00:09:17 +0200 +Subject: [PATCH] cookie: reject cookies with "control bytes" + +Rejects 0x01 - 0x1f (except 0x09) plus 0x7f + +Reported-by: Axel Chong + +Bug: https://curl.se/docs/CVE-2022-35252.html + +CVE-2022-35252 + +Closes #9381 + +Upstream-Status: Backport [https://github.com/curl/curl/commit/8dfc93e573ca740544a2d79ebb] + +Signed-off-by: Robert Joslyn robert.joslyn@redrectangle.org +--- + lib/cookie.c | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + +diff --git a/lib/cookie.c b/lib/cookie.c +index cb0c03b..e0470a1 100644 +--- a/lib/cookie.c ++++ b/lib/cookie.c +@@ -438,6 +438,30 @@ static bool bad_domain(const char *domain) + return TRUE; + } + ++/* ++ RFC 6265 section 4.1.1 says a server should accept this range: ++ ++ cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E ++ ++ But Firefox and Chrome as of June 2022 accept space, comma and double-quotes ++ fine. The prime reason for filtering out control bytes is that some HTTP ++ servers return 400 for requests that contain such. ++*/ ++static int invalid_octets(const char *p) ++{ ++ /* Reject all bytes \x01 - \x1f (*except* \x09, TAB) + \x7f */ ++ static const char badoctets[] = { ++ "\x01\x02\x03\x04\x05\x06\x07\x08\x0a" ++ "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" ++ "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f" ++ }; ++ size_t vlen, len; ++ /* scan for all the octets that are *not* in cookie-octet */ ++ len = strcspn(p, badoctets); ++ vlen = strlen(p); ++ return (len != vlen); ++} ++ + /* + * Curl_cookie_add + * +@@ -590,6 +614,11 @@ Curl_cookie_add(struct Curl_easy *data, + badcookie = TRUE; + break; + } ++ if(invalid_octets(whatptr) || invalid_octets(name)) { ++ infof(data, "invalid octets in name/value, cookie dropped"); ++ badcookie = TRUE; ++ break; ++ } + } + else if(!len) { + /* +-- +2.35.1 + diff --git a/recipes-support/curl/files/CVE-2022-42915.patch b/recipes-support/curl/files/CVE-2022-42915.patch new file mode 100644 index 0000000..0f37a80 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-42915.patch @@ -0,0 +1,53 @@ +From 55e1875729f9d9fc7315cec611bffbd2c817ad89 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Thu, 6 Oct 2022 14:13:36 +0200 +Subject: [PATCH] http_proxy: restore the protocol pointer on error + +Reported-by: Trail of Bits + +Closes #9790 + +CVE: CVE-2022-42915 +Upstream-Status: Backport [https://github.com/curl/curl/commit/55e1875729f9d9fc7315cec611bffbd2c817ad89] +Signed-off-by: Bhabu Bindu bhabu.bindu@kpit.com +--- + lib/http_proxy.c | 6 ++---- + lib/url.c | 9 --------- + 2 files changed, 2 insertions(+), 13 deletions(-) + +diff --git a/lib/http_proxy.c b/lib/http_proxy.c +index 1f87f6c62aa40..cc20b3a801941 100644 +--- a/lib/http_proxy.c ++++ b/lib/http_proxy.c +@@ -212,10 +212,8 @@ void Curl_connect_done(struct Curl_easy *data) + Curl_dyn_free(&s->rcvbuf); + Curl_dyn_free(&s->req); + +- /* restore the protocol pointer, if not already done */ +- if(s->prot_save) +- data->req.p.http = s->prot_save; +- s->prot_save = NULL; ++ /* restore the protocol pointer */ ++ data->req.p.http = s->prot_save; + data->info.httpcode = 0; /* clear it as it might've been used for the + proxy */ + data->req.ignorebody = FALSE; +diff --git a/lib/url.c b/lib/url.c +index 690c53c81a3c1..be5ffca2d8b20 100644 +--- a/lib/url.c ++++ b/lib/url.c +@@ -751,15 +751,6 @@ static void conn_shutdown(struct Curl_easy *data, struct connectdata *conn) + DEBUGASSERT(data); + infof(data, "Closing connection %ld", conn->connection_id); + +-#ifndef USE_HYPER +- if(conn->connect_state && conn->connect_state->prot_save) { +- /* If this was closed with a CONNECT in progress, cleanup this temporary +- struct arrangement */ +- data->req.p.http = NULL; +- Curl_safefree(conn->connect_state->prot_save); +- } +-#endif +- + /* possible left-overs from the async name resolvers */ + Curl_resolver_cancel(data); diff --git a/recipes-support/curl/files/CVE-2022-42916.patch b/recipes-support/curl/files/CVE-2022-42916.patch new file mode 100644 index 0000000..fbc5922 --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-42916.patch @@ -0,0 +1,136 @@ +From 53bcf55b4538067e6dc36242168866becb987bb7 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Wed, 12 Oct 2022 10:47:59 +0200 +Subject: [PATCH] url: use IDN decoded names for HSTS checks + +Reported-by: Hiroki Kurosawa + +Closes #9791 + +CVE: CVE-2022-42916 +Upstream-Status: Backport [https://github.com/curl/curl/commit/53bcf55b4538067e6dc36242168866becb987bb7] +Signed-off-by: Bhabu Bindu bhabu.bindu@kpit.com +Comments: Refreshed hunk +--- + lib/url.c | 91 ++++++++++++++++++++++++++++--------------------------- + 1 file changed, 47 insertions(+), 44 deletions(-) + +diff --git a/lib/url.c b/lib/url.c +index a3be56bced9de..690c53c81a3c1 100644 +--- a/lib/url.c ++++ b/lib/url.c +@@ -2012,10 +2012,56 @@ + if(!strcasecompare("file", data->state.up.scheme)) + return CURLE_OUT_OF_MEMORY; + } ++ hostname = data->state.up.hostname; ++ ++ if(hostname && hostname[0] == '[') { ++ /* This looks like an IPv6 address literal. See if there is an address ++ scope. */ ++ size_t hlen; ++ conn->bits.ipv6_ip = TRUE; ++ /* cut off the brackets! */ ++ hostname++; ++ hlen = strlen(hostname); ++ hostname[hlen - 1] = 0; ++ ++ zonefrom_url(uh, data, conn); ++ } ++ ++ /* make sure the connect struct gets its own copy of the host name */ ++ conn->host.rawalloc = strdup(hostname ? hostname : ""); ++ if(!conn->host.rawalloc) ++ return CURLE_OUT_OF_MEMORY; ++ conn->host.name = conn->host.rawalloc; ++ ++ /************************************************************* ++ * IDN-convert the hostnames ++ *************************************************************/ ++ result = Curl_idnconvert_hostname(data, &conn->host); ++ if(result) ++ return result; ++ if(conn->bits.conn_to_host) { ++ result = Curl_idnconvert_hostname(data, &conn->conn_to_host); ++ if(result) ++ return result; ++ } ++#ifndef CURL_DISABLE_PROXY ++ if(conn->bits.httpproxy) { ++ result = Curl_idnconvert_hostname(data, &conn->http_proxy.host); ++ if(result) ++ return result; ++ } ++ if(conn->bits.socksproxy) { ++ result = Curl_idnconvert_hostname(data, &conn->socks_proxy.host); ++ if(result) ++ return result; ++ } ++#endif + + #ifndef CURL_DISABLE_HSTS ++ /* HSTS upgrade */ + if(data->hsts && strcasecompare("http", data->state.up.scheme)) { +- if(Curl_hsts(data->hsts, data->state.up.hostname, TRUE)) { ++ /* This MUST use the IDN decoded name */ ++ if(Curl_hsts(data->hsts, conn->host.name, TRUE)) { + char *url; + Curl_safefree(data->state.up.scheme); + uc = curl_url_set(uh, CURLUPART_SCHEME, "https", 0); +@@ -2145,26 +2191,6 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data, + + (void)curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query, 0); + +- hostname = data->state.up.hostname; +- if(hostname && hostname[0] == '[') { +- /* This looks like an IPv6 address literal. See if there is an address +- scope. */ +- size_t hlen; +- conn->bits.ipv6_ip = TRUE; +- /* cut off the brackets! */ +- hostname++; +- hlen = strlen(hostname); +- hostname[hlen - 1] = 0; +- +- zonefrom_url(uh, data, conn); +- } +- +- /* make sure the connect struct gets its own copy of the host name */ +- conn->host.rawalloc = strdup(hostname ? hostname : ""); +- if(!conn->host.rawalloc) +- return CURLE_OUT_OF_MEMORY; +- conn->host.name = conn->host.rawalloc; +- + #ifdef ENABLE_IPV6 + if(data->set.scope_id) + /* Override any scope that was set above. */ +@@ -3713,29 +3739,6 @@ static CURLcode create_conn(struct Curl_easy *data, + if(result) + goto out; + +- /************************************************************* +- * IDN-convert the hostnames +- *************************************************************/ +- result = Curl_idnconvert_hostname(data, &conn->host); +- if(result) +- goto out; +- if(conn->bits.conn_to_host) { +- result = Curl_idnconvert_hostname(data, &conn->conn_to_host); +- if(result) +- goto out; +- } +-#ifndef CURL_DISABLE_PROXY +- if(conn->bits.httpproxy) { +- result = Curl_idnconvert_hostname(data, &conn->http_proxy.host); +- if(result) +- goto out; +- } +- if(conn->bits.socksproxy) { +- result = Curl_idnconvert_hostname(data, &conn->socks_proxy.host); +- if(result) +- goto out; +- } +-#endif + + /************************************************************* + * Check whether the host and the "connect to host" are equal. diff --git a/recipes-support/curl/files/CVE-2022-43551.patch b/recipes-support/curl/files/CVE-2022-43551.patch new file mode 100644 index 0000000..e1ec7bf --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-43551.patch @@ -0,0 +1,35 @@ +From 9e71901634e276dd050481c4320f046bebb1bc28 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 19 Dec 2022 08:36:55 +0100 +Subject: [PATCH] http: use the IDN decoded name in HSTS checks + +Otherwise it stores the info HSTS into the persistent cache for the IDN +name which will not match when the HSTS status is later checked for +using the decoded name. + +Reported-by: Hiroki Kurosawa + +Closes #10111 + +CVE: CVE-2022-43551 +Upstream-Status: Backport [https://github.com/curl/curl/commit/9e71901634e276dd050481c4320f046bebb1bc28] +Signed-off-by: Ranjitsinh Rathod ranjitsinh.rathod@kpit.com +Comments: Hunk refresh to remove patch-fuzz warning + +--- + lib/http.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/http.c b/lib/http.c +index 85528a2218eee..a784745a8d505 100644 +--- a/lib/http.c ++++ b/lib/http.c +@@ -3652,7 +3652,7 @@ CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn, + else if(data->hsts && checkprefix("Strict-Transport-Security:", headp) && + (conn->handler->flags & PROTOPT_SSL)) { + CURLcode check = +- Curl_hsts_parse(data->hsts, data->state.up.hostname, ++ Curl_hsts_parse(data->hsts, conn->host.name, + headp + strlen("Strict-Transport-Security:")); + if(check) + infof(data, "Illegal STS header skipped"); diff --git a/recipes-support/curl/files/CVE-2022-43552.patch b/recipes-support/curl/files/CVE-2022-43552.patch new file mode 100644 index 0000000..dfe6d8c --- /dev/null +++ b/recipes-support/curl/files/CVE-2022-43552.patch @@ -0,0 +1,80 @@ +From 4f20188ac644afe174be6005ef4f6ffba232b8b2 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Mon, 19 Dec 2022 08:38:37 +0100 +Subject: [PATCH] smb/telnet: do not free the protocol struct in *_done() + +It is managed by the generic layer. + +Reported-by: Trail of Bits + +Closes #10112 + +CVE: CVE-2022-43552 +Upstream-Status: Backport [https://github.com/curl/curl/commit/4f20188ac644afe174be6005ef4f6ffba232b8b2] +Signed-off-by: Ranjitsinh Rathod ranjitsinh.rathod@kpit.com + +--- + lib/smb.c | 14 ++------------ + lib/telnet.c | 3 --- + 2 files changed, 2 insertions(+), 15 deletions(-) + +diff --git a/lib/smb.c b/lib/smb.c +index 2cfe041dff072..48d5a2fe006d5 100644 +--- a/lib/smb.c ++++ b/lib/smb.c +@@ -58,8 +58,6 @@ static CURLcode smb_connect(struct Curl_easy *data, bool *done); + static CURLcode smb_connection_state(struct Curl_easy *data, bool *done); + static CURLcode smb_do(struct Curl_easy *data, bool *done); + static CURLcode smb_request_state(struct Curl_easy *data, bool *done); +-static CURLcode smb_done(struct Curl_easy *data, CURLcode status, +- bool premature); + static CURLcode smb_disconnect(struct Curl_easy *data, + struct connectdata *conn, bool dead); + static int smb_getsock(struct Curl_easy *data, struct connectdata *conn, +@@ -74,7 +72,7 @@ const struct Curl_handler Curl_handler_smb = { + "SMB", /* scheme */ + smb_setup_connection, /* setup_connection */ + smb_do, /* do_it */ +- smb_done, /* done */ ++ ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + smb_connect, /* connect_it */ + smb_connection_state, /* connecting */ +@@ -101,7 +99,7 @@ const struct Curl_handler Curl_handler_smbs = { + "SMBS", /* scheme */ + smb_setup_connection, /* setup_connection */ + smb_do, /* do_it */ +- smb_done, /* done */ ++ ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + smb_connect, /* connect_it */ + smb_connection_state, /* connecting */ +@@ -936,14 +934,6 @@ static CURLcode smb_request_state(struct Curl_easy *data, bool *done) + return CURLE_OK; + } + +-static CURLcode smb_done(struct Curl_easy *data, CURLcode status, +- bool premature) +-{ +- (void) premature; +- Curl_safefree(data->req.p.smb); +- return status; +-} +- + static CURLcode smb_disconnect(struct Curl_easy *data, + struct connectdata *conn, bool dead) + { +diff --git a/lib/telnet.c b/lib/telnet.c +index 24d3f1efb14c8..22bc81e755222 100644 +--- a/lib/telnet.c ++++ b/lib/telnet.c +@@ -1248,9 +1248,6 @@ static CURLcode telnet_done(struct Curl_easy *data, + + curl_slist_free_all(tn->telnet_vars); + tn->telnet_vars = NULL; +- +- Curl_safefree(data->req.p.telnet); +- + return CURLE_OK; + } + diff --git a/recipes-support/curl/files/CVE-2023-23914_5-1.patch b/recipes-support/curl/files/CVE-2023-23914_5-1.patch new file mode 100644 index 0000000..d357cee --- /dev/null +++ b/recipes-support/curl/files/CVE-2023-23914_5-1.patch @@ -0,0 +1,280 @@ +From 076a2f629119222aeeb50f5a03bf9f9052fabb9a Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Tue, 27 Dec 2022 11:50:20 +0100 +Subject: [PATCH] share: add sharing of HSTS cache among handles + +Closes #10138 + +CVE: CVE-2023-23914 CVE-2023-23915 +Upstream-Status: Backport [https://github.com/curl/curl/commit/076a2f629119222aeeb50f5a03bf9f9052fabb9a] +Comment: Refreshed hunk from hsts.c and urldata.h +Signed-off-by: Pawan Badganchi Pawan.Badganchi@kpit.com +Signed-off-by: Mingli Yu mingli.yu@windriver.com +--- + include/curl/curl.h | 1 + + lib/hsts.c | 15 +++++++++ + lib/hsts.h | 2 ++ + lib/setopt.c | 48 ++++++++++++++++++++++++----- + lib/share.c | 32 +++++++++++++++++-- + lib/share.h | 6 +++- + lib/transfer.c | 3 ++ + lib/url.c | 6 +++- + lib/urldata.h | 2 ++ + 9 files changed, 109 insertions(+), 11 deletions(-) + +--- a/include/curl/curl.h ++++ b/include/curl/curl.h +@@ -2953,6 +2953,7 @@ typedef enum { + CURL_LOCK_DATA_SSL_SESSION, + CURL_LOCK_DATA_CONNECT, + CURL_LOCK_DATA_PSL, ++ CURL_LOCK_DATA_HSTS, + CURL_LOCK_DATA_LAST + } curl_lock_data; + +--- a/lib/hsts.c ++++ b/lib/hsts.c +@@ -37,6 +37,7 @@ + #include "parsedate.h" + #include "rand.h" + #include "rename.h" ++#include "share.h" + #include "strtoofft.h" + + /* The last 3 #include files should be in this order */ +@@ -561,4 +562,18 @@ + return CURLE_OK; + } + ++void Curl_hsts_loadfiles(struct Curl_easy *data) ++{ ++ struct curl_slist *l = data->set.hstslist; ++ if(l) { ++ Curl_share_lock(data, CURL_LOCK_DATA_HSTS, CURL_LOCK_ACCESS_SINGLE); ++ ++ while(l) { ++ (void)Curl_hsts_loadfile(data, data->hsts, l->data); ++ l = l->next; ++ } ++ Curl_share_unlock(data, CURL_LOCK_DATA_HSTS); ++ } ++} ++ + #endif /* CURL_DISABLE_HTTP || CURL_DISABLE_HSTS */ +--- a/lib/hsts.h ++++ b/lib/hsts.h +@@ -59,9 +59,11 @@ CURLcode Curl_hsts_loadfile(struct Curl_ + struct hsts *h, const char *file); + CURLcode Curl_hsts_loadcb(struct Curl_easy *data, + struct hsts *h); ++void Curl_hsts_loadfiles(struct Curl_easy *data); + #else + #define Curl_hsts_cleanup(x) + #define Curl_hsts_loadcb(x,y) CURLE_OK + #define Curl_hsts_save(x,y,z) ++#define Curl_hsts_loadfiles(x) + #endif /* CURL_DISABLE_HTTP || CURL_DISABLE_HSTS */ + #endif /* HEADER_CURL_HSTS_H */ +--- a/lib/setopt.c ++++ b/lib/setopt.c +@@ -2260,9 +2260,14 @@ CURLcode Curl_vsetopt(struct Curl_easy * + data->cookies = NULL; + #endif + ++#ifndef CURL_DISABLE_HSTS ++ if(data->share->hsts == data->hsts) ++ data->hsts = NULL; ++#endif ++#ifdef USE_SSL + if(data->share->sslsession == data->state.session) + data->state.session = NULL; +- ++#endif + #ifdef USE_LIBPSL + if(data->psl == &data->share->psl) + data->psl = data->multi? &data->multi->psl: NULL; +@@ -2296,10 +2301,19 @@ CURLcode Curl_vsetopt(struct Curl_easy * + data->cookies = data->share->cookies; + } + #endif /* CURL_DISABLE_HTTP */ ++#ifndef CURL_DISABLE_HSTS ++ if(data->share->hsts) { ++ /* first free the private one if any */ ++ Curl_hsts_cleanup(&data->hsts); ++ data->hsts = data->share->hsts; ++ } ++#endif /* CURL_DISABLE_HTTP */ ++#ifdef USE_SSL + if(data->share->sslsession) { + data->set.general_ssl.max_ssl_sessions = data->share->max_ssl_sessions; + data->state.session = data->share->sslsession; + } ++#endif + #ifdef USE_LIBPSL + if(data->share->specifier & (1 << CURL_LOCK_DATA_PSL)) + data->psl = &data->share->psl; +@@ -3049,19 +3063,39 @@ CURLcode Curl_vsetopt(struct Curl_easy * + case CURLOPT_HSTSWRITEDATA: + data->set.hsts_write_userp = va_arg(param, void *); + break; +- case CURLOPT_HSTS: ++ case CURLOPT_HSTS: { ++ struct curl_slist *h; + if(!data->hsts) { + data->hsts = Curl_hsts_init(); + if(!data->hsts) + return CURLE_OUT_OF_MEMORY; + } + argptr = va_arg(param, char *); +- result = Curl_setstropt(&data->set.str[STRING_HSTS], argptr); +- if(result) +- return result; +- if(argptr) +- (void)Curl_hsts_loadfile(data, data->hsts, argptr); ++ if(argptr) { ++ result = Curl_setstropt(&data->set.str[STRING_HSTS], argptr); ++ if(result) ++ return result; ++ /* this needs to build a list of file names to read from, so that it can ++ read them later, as we might get a shared HSTS handle to load them ++ into */ ++ h = curl_slist_append(data->set.hstslist, argptr); ++ if(!h) { ++ curl_slist_free_all(data->set.hstslist); ++ data->set.hstslist = NULL; ++ return CURLE_OUT_OF_MEMORY; ++ } ++ data->set.hstslist = h; /* store the list for later use */ ++ } ++ else { ++ /* clear the list of HSTS files */ ++ curl_slist_free_all(data->set.hstslist); ++ data->set.hstslist = NULL; ++ if(!data->share || !data->share->hsts) ++ /* throw away the HSTS cache unless shared */ ++ Curl_hsts_cleanup(&data->hsts); ++ } + break; ++ } + case CURLOPT_HSTS_CTRL: + arg = va_arg(param, long); + if(arg & CURLHSTS_ENABLE) { +--- a/lib/share.c ++++ b/lib/share.c +@@ -29,9 +29,11 @@ + #include "share.h" + #include "psl.h" + #include "vtls/vtls.h" +-#include "curl_memory.h" ++#include "hsts.h" + +-/* The last #include file should be: */ ++/* The last 3 #include files should be in this order */ ++#include "curl_printf.h" ++#include "curl_memory.h" + #include "memdebug.h" + + struct Curl_share * +@@ -89,6 +91,18 @@ curl_share_setopt(struct Curl_share *sha + #endif + break; + ++ case CURL_LOCK_DATA_HSTS: ++#ifndef CURL_DISABLE_HSTS ++ if(!share->hsts) { ++ share->hsts = Curl_hsts_init(); ++ if(!share->hsts) ++ res = CURLSHE_NOMEM; ++ } ++#else /* CURL_DISABLE_HSTS */ ++ res = CURLSHE_NOT_BUILT_IN; ++#endif ++ break; ++ + case CURL_LOCK_DATA_SSL_SESSION: + #ifdef USE_SSL + if(!share->sslsession) { +@@ -141,6 +155,16 @@ curl_share_setopt(struct Curl_share *sha + #endif + break; + ++ case CURL_LOCK_DATA_HSTS: ++#ifndef CURL_DISABLE_HSTS ++ if(share->hsts) { ++ Curl_hsts_cleanup(&share->hsts); ++ } ++#else /* CURL_DISABLE_HSTS */ ++ res = CURLSHE_NOT_BUILT_IN; ++#endif ++ break; ++ + case CURL_LOCK_DATA_SSL_SESSION: + #ifdef USE_SSL + Curl_safefree(share->sslsession); +@@ -207,6 +231,10 @@ curl_share_cleanup(struct Curl_share *sh + Curl_cookie_cleanup(share->cookies); + #endif + ++#ifndef CURL_DISABLE_HSTS ++ Curl_hsts_cleanup(&share->hsts); ++#endif ++ + #ifdef USE_SSL + if(share->sslsession) { + size_t i; +--- a/lib/share.h ++++ b/lib/share.h +@@ -59,10 +59,14 @@ struct Curl_share { + #ifdef USE_LIBPSL + struct PslCache psl; + #endif +- ++#ifndef CURL_DISABLE_HSTS ++ struct hsts *hsts; ++#endif ++#ifdef USE_SSL + struct Curl_ssl_session *sslsession; + size_t max_ssl_sessions; + long sessionage; ++#endif + }; + + CURLSHcode Curl_share_lock(struct Curl_easy *, curl_lock_data, +--- a/lib/transfer.c ++++ b/lib/transfer.c +@@ -1398,6 +1398,9 @@ CURLcode Curl_pretransfer(struct Curl_ea + if(data->state.resolve) + result = Curl_loadhostpairs(data); + ++ /* If there is a list of hsts files to read */ ++ Curl_hsts_loadfiles(data); ++ + if(!result) { + /* Allow data->set.use_port to set which port to use. This needs to be + * disabled for example when we follow Location: headers to URLs using +--- a/lib/url.c ++++ b/lib/url.c +@@ -434,7 +434,11 @@ CURLcode Curl_close(struct Curl_easy **d + Curl_altsvc_save(data, data->asi, data->set.str[STRING_ALTSVC]); + Curl_altsvc_cleanup(&data->asi); + Curl_hsts_save(data, data->hsts, data->set.str[STRING_HSTS]); +- Curl_hsts_cleanup(&data->hsts); ++#ifndef CURL_DISABLE_HSTS ++ if(!data->share || !data->share->hsts) ++ Curl_hsts_cleanup(&data->hsts); ++ curl_slist_free_all(data->set.hstslist); /* clean up list */ ++#endif + #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) + Curl_http_auth_cleanup_digest(data); + #endif +--- a/lib/urldata.h ++++ b/lib/urldata.h +@@ -1670,6 +1670,8 @@ + + void *seek_client; /* pointer to pass to the seek callback */ + #ifndef CURL_DISABLE_HSTS ++ struct curl_slist *hstslist; /* list of HSTS files set by ++ curl_easy_setopt(HSTS) calls */ + curl_hstsread_callback hsts_read; + void *hsts_read_userp; + curl_hstswrite_callback hsts_write; diff --git a/recipes-support/curl/files/CVE-2023-23914_5-2.patch b/recipes-support/curl/files/CVE-2023-23914_5-2.patch new file mode 100644 index 0000000..668972c --- /dev/null +++ b/recipes-support/curl/files/CVE-2023-23914_5-2.patch @@ -0,0 +1,23 @@ +From 0bf8b796a0ea98395b390c7807187982215f5c11 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Tue, 27 Dec 2022 11:50:23 +0100 +Subject: [PATCH] tool_operate: share HSTS between handles + +CVE: CVE-2023-23914 CVE-2023-23915 +Upstream-Status: Backport [https://github.com/curl/curl/pull/10138/commits/ca17cfed2df001356cfe2841f166...] +Signed-off-by: Pawan Badganchi Pawan.Badganchi@kpit.com +Signed-off-by: Mingli Yu mingli.yu@windriver.com +--- + src/tool_operate.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/src/tool_operate.c ++++ b/src/tool_operate.c +@@ -2722,6 +2722,7 @@ CURLcode operate(struct GlobalConfig *gl + curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION); + curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT); + curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_PSL); ++ curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_HSTS); + + /* Get the required arguments for each operation */ + do { diff --git a/recipes-support/curl/files/CVE-2023-23914_5-3.patch b/recipes-support/curl/files/CVE-2023-23914_5-3.patch new file mode 100644 index 0000000..4422b26 --- /dev/null +++ b/recipes-support/curl/files/CVE-2023-23914_5-3.patch @@ -0,0 +1,45 @@ +From ca02a77f05bd5cef20618c8f741aa48b7be0a648 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Tue, 27 Dec 2022 11:50:23 +0100 +Subject: [PATCH] hsts: handle adding the same host name again + +It will then use the largest expire time of the two entries. + +CVE: CVE-2023-23914 CVE-2023-23915 +Upstream-Status: Backport [https://github.com/curl/curl/pull/10138/commits/e077b30a42272d964d76e5b815a0...] +Signed-off-by: Pawan Badganchi Pawan.Badganchi@kpit.com +Signed-off-by: Mingli Yu mingli.yu@windriver.com +--- + lib/hsts.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/lib/hsts.c b/lib/hsts.c +index 339237be1c621..8d6723ee587d2 100644 +--- a/lib/hsts.c ++++ b/lib/hsts.c +@@ -426,14 +426,23 @@ static CURLcode hsts_add(struct hsts *h, char *line) + if(2 == rc) { + time_t expires = strcmp(date, UNLIMITED) ? Curl_getdate_capped(date) : + TIME_T_MAX; +- CURLcode result; ++ CURLcode result = CURLE_OK; + char *p = host; + bool subdomain = FALSE; ++ struct stsentry *e; + if(p[0] == '.') { + p++; + subdomain = TRUE; + } +- result = hsts_create(h, p, subdomain, expires); ++ /* only add it if not already present */ ++ e = Curl_hsts(h, p, subdomain); ++ if(!e) ++ result = hsts_create(h, p, subdomain, expires); ++ else { ++ /* the same host name, use the largest expire time */ ++ if(expires > e->expires) ++ e->expires = expires; ++ } + if(result) + return result; + } diff --git a/recipes-support/curl/files/CVE-2023-23914_5-4.patch b/recipes-support/curl/files/CVE-2023-23914_5-4.patch new file mode 100644 index 0000000..865b3f9 --- /dev/null +++ b/recipes-support/curl/files/CVE-2023-23914_5-4.patch @@ -0,0 +1,48 @@ +From dc0725244a3163f1e2d5f51165db3a1a430f3ba0 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Tue, 27 Dec 2022 11:50:23 +0100 +Subject: [PATCH] runtests: support crlf="yes" for verify/proxy + +CVE: CVE-2023-23914 CVE-2023-23915 +Upstream-Status: Backport [https://github.com/curl/curl/pull/10138/commits/fd7e1a557e414dd803c9225e37a2...] +Comment: Refreshed hunk from FILEFORMAT.md +Signed-off-by: Pawan Badganchi Pawan.Badganchi@kpit.com +Signed-off-by: Mingli Yu mingli.yu@windriver.com +--- + tests/FILEFORMAT.md | 4 ++-- + tests/runtests.pl | 5 +++++ + 2 files changed, 7 insertions(+), 2 deletions(-) + +--- a/tests/FILEFORMAT.md ++++ b/tests/FILEFORMAT.md +@@ -540,14 +540,14 @@ + One perl op per line that operates on the protocol dump. This is pretty + advanced. Example: `s/^EPRT .*/EPRT stripped/`. + +-### `<protocol [nonewline="yes"]>` ++### `<protocol [nonewline="yes"][crlf="yes"]>` + + the protocol dump curl should transmit, if 'nonewline' is set, we will cut off + the trailing newline of this given data before comparing with the one actually + sent by the client The `<strip>` and `<strippart>` rules are applied before + comparisons are made. + +-### `<proxy [nonewline="yes"]>` ++### `<proxy [nonewline="yes"][crlf="yes"]>` + + The protocol dump curl should transmit to a HTTP proxy (when the http-proxy + server is used), if 'nonewline' is set, we will cut off the trailing newline +--- a/tests/runtests.pl ++++ b/tests/runtests.pl +@@ -4744,6 +4744,11 @@ sub singletest { + } + } + ++ if($hash{'crlf'} || ++ ($has_hyper && ($keywords{"HTTP"} || $keywords{"HTTPS"}))) { ++ map subNewlines(0, $_), @protstrip; ++ } ++ + $res = compare($testnum, $testname, "proxy", @out, @protstrip); + if($res) { + return $errorreturncode; diff --git a/recipes-support/curl/files/CVE-2023-23914_5-5.patch b/recipes-support/curl/files/CVE-2023-23914_5-5.patch new file mode 100644 index 0000000..1a363f0 --- /dev/null +++ b/recipes-support/curl/files/CVE-2023-23914_5-5.patch @@ -0,0 +1,118 @@ +From ea5aaaa5ede53819f8bc7ae767fc2d13d3704d37 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg daniel@haxx.se +Date: Tue, 27 Dec 2022 11:50:23 +0100 +Subject: [PATCH] test446: verify hsts with two URLs + +CVE: CVE-2023-23914 CVE-2023-23915 +Upstream-Status: Backport [https://github.com/curl/curl/pull/10138/commits/7e89dfd463597701dd1defcad7be...] +Comment: Refreshed hunk from Makefile.inc +Signed-off-by: Pawan Badganchi Pawan.Badganchi@kpit.com +Signed-off-by: Mingli Yu mingli.yu@windriver.com +--- + tests/data/Makefile.inc | 2 +- + tests/data/test446 | 84 +++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 85 insertions(+), 1 deletion(-) + create mode 100644 tests/data/test446 + +diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc +index 3a6356bd122bc..fe1bb1c74c2ab 100644 +--- a/tests/data/Makefile.inc ++++ b/tests/data/Makefile.inc +@@ -72,6 +72,7 @@ + \ + test430 test431 test432 test433 test434 test435 test436 \ + \ ++test446 \ + test490 test491 test492 test493 test494 \ + \ + test500 test501 test502 test503 test504 test505 test506 test507 test508 \ +diff --git a/tests/data/test446 b/tests/data/test446 +new file mode 100644 +index 0000000000000..0e2dfdcfe33b6 +--- /dev/null ++++ b/tests/data/test446 +@@ -0,0 +1,84 @@ ++<?xml version="1.0" encoding="ISO-8859-1"?> ++<testcase> ++<info> ++<keywords> ++HTTP ++HTTP proxy ++HSTS ++trailing-dot ++</keywords> ++</info> ++ ++<reply> ++ ++# we use this as response to a CONNECT ++<connect nocheck="yes"> ++HTTP/1.1 200 OK ++ ++</connect> ++<data crlf="yes"> ++HTTP/1.1 200 OK ++Content-Length: 6 ++Strict-Transport-Security: max-age=604800 ++ ++-foo- ++</data> ++<data2 crlf="yes"> ++HTTP/1.1 200 OK ++Content-Length: 6 ++Strict-Transport-Security: max-age=6048000 ++ ++-baa- ++</data2> ++</reply> ++ ++<client> ++<server> ++https ++http-proxy ++</server> ++<features> ++HSTS ++proxy ++https ++debug ++</features> ++<setenv> ++CURL_HSTS_HTTP=yes ++CURL_TIME=2000000000 ++</setenv> ++ ++<name> ++HSTS with two URLs ++</name> ++<command> ++-x http://%HOSTIP:%PROXYPORT --hsts log/hsts%TESTNUMBER http://this.hsts.example./%TESTNUMBER http://another.example.com/%TESTNUMBER0002 ++</command> ++</client> ++ ++<verify> ++# we let it CONNECT to the server to confirm HSTS but deny from there ++<proxy crlf="yes"> ++GET http://this.hsts.example./%TESTNUMBER HTTP/1.1 ++Host: this.hsts.example. ++User-Agent: curl/%VERSION ++Accept: */* ++Proxy-Connection: Keep-Alive ++ ++GET http://another.example.com/%TESTNUMBER0002 HTTP/1.1 ++Host: another.example.com ++User-Agent: curl/%VERSION ++Accept: */* ++Proxy-Connection: Keep-Alive ++ ++</proxy> ++ ++<file name="log/hsts%TESTNUMBER" mode="text"> ++# Your HSTS cache. https://curl.se/docs/hsts.html ++# This file was generated by libcurl! Edit at your own risk. ++this.hsts.example "20330525 03:33:20" ++another.example.com "20330727 03:33:20" ++</file> ++ ++</verify> ++</testcase>
linux-morello-distros@op-lists.linaro.org