summaryrefslogtreecommitdiff
path: root/sys/lib
AgeCommit message (Collapse)Author
2022-08-15Fix a doc comment to match upstreamTheo Buehler
2022-08-15Adjust whitespace (tabs vs spaces) on one line to reduce diff with upstreamTheo Buehler
2022-08-12add support for booting from RAID 1C softraid(4) volumes on amd64Stefan Sperling
Only boot-loader changes are needed. Both installboot(8) and the kernel already do what is required to make this work. ok kn@ Tested: biosboot on vmm: kn, stsp biosboot and efiboot on server hardware: stsp
2022-08-11Revert uLong -> z_off_t change in the kernelTheo Buehler
The kernel source assumes the original zlib ABI. There is no reason to stick to this local change. Pull in a fix matching ctfdump.c -r1.26. This is hopefully the last change necessary to undo a painful hack that was committed 19 years ago without ok. Someone owes me a lot of beer... ok millert
2022-08-09Sync inflateGetHeader() fix from userlandTheo Buehler
2022-05-08Backport an upstream fix for CRC calculation. This fixes Java applicationsTheo Buehler
on some older hardware, see https://github.com/madler/zlib/issues/613 Pointed out by tj and sthen commit ec3df00224d4b396e2ac6586ab5d25f673caa4c2 Author: Mark Adler <madler@alumni.caltech.edu> Date: Wed Mar 30 11:14:53 2022 -0700 Correct incorrect inputs provided to the CRC functions. The previous releases of zlib were not sensitive to incorrect CRC inputs with bits set above the low 32. This commit restores that behavior, so that applications with such bugs will continue to operate as before.
2022-05-08Update to zlib 1.2.12Theo Buehler
Build tests by myself for amd64 and arm64, sthen and inoguchi for i386 and gkoehler for macppc and powerpc64, thanks! Detailed changelog is part of the committed diff.
2022-03-25Sync with userland libz (memory-corruption + followup).Theo Buehler
ok mbuhl millert
2022-03-25Sync zlib with userlandTheo Buehler
Backport zlib fix for the multi line CLEAR_HASH macro. There is an else branch where only half of the macro is executed conditionally. Acording to upstream comment this has only little impact. https://github.com/madler/zlib/commit/38e8ce32afbaa82f67d992b9f3056f281fe69259 ok bluhm (who had the same diff)
2022-01-29Use local symbols in libkern mips64 assembly routines.Visa Hankala
OK miod@
2022-01-11spellingJonathan Gray
2022-01-11Remove dead store to f and avoid use of unvalidated fd.Visa Hankala
Found by LLVM scan-build. OK millert@ deraadt@
2021-12-01Fix booting from an IDE block device on the Sun Blade 100. ApparentlyMark Kettenis
writing to disk using the Open Firmware interfaces is buggy and causes corruption of the disk. While it isn't entirely clear what versions of Open Firmware are affected, but it seems to only affect IDE drives. So if we detect an IDE drive, disable writing to it. This results in a small lose of bootloader functionality (bsd.upgrade loop prevention and flagging /etc/random.seed re-use) but that is better than losing the ability to run OpenBSD at all. Based on a diff by Ted Bullock (who did all the hard work of debugging this and coming up with a viable fix). ok deraadt@
2021-11-29Niels agreed to remove the advertising clause; switching theseDamien Miller
to 3-term BSD license.
2021-11-01Add CRC-16 implementation. From NetBSD.Mark Kettenis
ok krw@, deraadt@
2021-10-25Remove unused variables to silence clang.Patrick Wildt
ok kettenis@
2021-10-24#define open O_* flags in libsa/stand.h, so that bootblocks can useTheo de Raadt
O_RDONLY rather using 0 ok beck
2021-07-28Fix previous: In one spot I incorrectly used Pos (unsigned short) whereTheo Buehler
I should have used Byte (unsigned char) which led to passing twice the correct size to free. Found & tested by bluhm with the sys/netinet/ipsec tests on i386.
2021-07-22Add sizes for free() in zlibTheo Buehler
Rebased version of a diff from miod who described it as follows: This tries to keep diffability against upstream, hence a questionable choice of the size type for zcfree() - but all sizes should fit in 32 bits anyway. Since all zcfree routines used in the tree cope with NULL arguments (including the various alloc.c used by the boot blocks), I have simplified TRY_FREE to compensate for the growth. Reminded by and ok mpi
2021-07-20Remove unneeded __sync_* library functions from the kernel.Visa Hankala
These library functions were added as stopgaps because GCC 4.2.1 lacks the corresponding __sync_* builtins on mips64. However, the builtins are now provided by Clang.
2021-07-08In recent libz update, tb@ overzealously attempted codesize reduction withTheo de Raadt
option BUILDFIXED -- which is incompatible with kernel hibernate unpack since it places side-effects into BSS, rather than inside z_streamp or using the private allocator. While here DYNAMIC_CRC_TABLE could cause similar problems, so disable this also. Space savings for the media is best done with bootblock-specific libz compile options, coming in the following commit. ok tb mlarkin
2021-07-04tb notices i did not add a copyright in 2011Theo de Raadt
2021-07-04Add missing RCS tagsTheo Buehler
2021-07-04Update libz to zlib 1.2.11 and reapply local patches as far as thisTheo Buehler
made sense. Tested in snaps for a few days. deraadt helped with fitting things on floppies and jmatthew found a bug I introduced. ok deraadt
2021-05-16ansiJonathan Gray
2021-05-16deregisterJonathan Gray
2021-05-16ansiJonathan Gray
2021-03-12spellingJonathan Gray
2021-03-06ansiJonathan Gray
2020-12-09Use daddr_t and not daddr32_t in boot media.Kenneth R Westerback
At a minimum, amd64/i386 should now boot from 4TB GPT formatted disks. More daddr32_t terminations with extreme prejudice to follow. Tested by various, in snaps for a few days. ok deraadt@
2020-11-28Add retguard to macppc kernel locore.S, ofwreal.S, setjmp.Sgkoehler
This changes RETGUARD_SETUP(ffs) to RETGUARD_SETUP(ffs, %r11, %r12) and RETGUARD_CHECK(ffs) to RETGUARD_CHECK(ffs, %r11, %r12) to show that r11 and r12 are in use between setup and check, and to pick registers other than r11 and r12 in some kernel functions. ok mortimer@ deraadt@
2020-10-27Retguared asm macros for powerpc libkerngkoehler
This was in the macppc snap, but I forgot to include it in my last commit "Retguard asm macros for powerpc libc, ld.so"
2020-10-26Remove an unneeded variable.Visa Hankala
OK kettenis@
2020-10-16Use the retguard macros from asm.h to protect the function.Theo de Raadt
ok mortimer kettenis
2020-08-13Add __multi3 from compiler_rt-8.xJeremie Courreges-Anglas
Needed to build a sparc64 kernel with clang 10. ok kettenis@
2020-08-13Move compiler_rt type definitions to a separate headerJeremie Courreges-Anglas
so that we can reuse them in other compiler_rt routines. ok kettenis@
2020-08-03add aliases for arm eabi long long shift functionsJonathan Gray
clang 10 on armv7 references these when building RAMDISK (-Oz) but not GENERIC (-O2). feedback and ok guenther@
2020-07-20__main() is no longer used by any of our toolchainsTheo de Raadt
this fell out of a discussion with mortimer ok kettenis
2020-07-18The kernel and bootblocks never reference this file...Theo de Raadt
2020-07-09Fix a warning false positive from clang 10.Todd C. Miller
blf_enc() takes a number of 64-bit blocks to encrypt, but using sizeof(uint64_t) in the calculation triggers a warning from clang 10 because the actual data type is uint32_t. Pass BCRYPT_WORDS / 2 for the number of blocks like libc bcrypt(3) does. OK kettenis@
2020-06-10Provide an optimized implementation of ffs(3) in the kernel onChristian Weisgerber
arm64/powerpc/powerpc64, making use of the count leading zeros instruction. powerpc testing by cwen@; ok kettenis@ deraadt@
2020-05-19If we pass a packet length larger than 2^16, we should panic() insteadPatrick Wildt
of returning -1. With a return type of u_int16_t, -1 is not different to a valid checksum. For incoming packets, the header lengths don't exceed that size anyway, but for outgoing packets it's better to see if our bootloader crafts a broken one. Discussed with gerhard@ ok deraadt@ procter@
2020-05-18Sync in_cksum.c to the same version ospfd has. This fixes problemsPatrick Wildt
with odd packet lengths, which can happen when using TFTP to load a file with an odd length. ospfd actually took dvmrpd's version in 2006 to fix the same issue, and both daemons implementations are the same. For the bootloader we keep the consts from the previous version and replace the fatal with a print and return. ok deraadt@
2020-04-02Add __lshrti3 to libkern and use it on sparc64Jeremie Courreges-Anglas
With this it's possible to build the kernel using clang. Discussed with claudio@, ok deraadt@
2020-02-29Next step in prepping for ffs2 installs: introduce a new install script varOtto Moerbeek
MDFSOPT and add a missing prototype.
2020-02-26Remove non-__STDC__ assert macros from <lib/libkern/libkern.h>.Visa Hankala
The macros are defined in a part of the header where a C compiler is required. In addition, the macros expand to C code, so it looks unnecessary to define the asserts with traditional cpp in mind. OK cheloha@, mpi@
2019-11-29Add an element to the marks array to store the virtual address of theMark Kettenis
entry point. ok mlarkin@, deraadt@
2019-11-28Implement a hexdump command in the boot loader. This helps toAlexander Bluhm
inspect the memory layout that the firmware has created. It is especially useful for UEFI debugging. OK deraadt@ kettenis@
2019-11-05Give some END()s to assembly symbols.Martin Pieuchot
ok kettenis@, jca@
2019-11-01Reduce BOOTRANDOM_MAX to 256. naddy pointed out there's no point havingTheo de Raadt
it larger than RC4STATE. A long discussion ensued. In conclusion all entropy inputs are either satisfactory enough, or just as shitty at 512.