opnsense-src/sys/kern
Mark Johnston f065d0bb29 blist: Correct the node count computed in blist_create()
Commit bb4a27f927 added the ability to allocate a span of blocks
crossing a meta node boundary.  To ensure that blst_next_leaf_alloc()
does not walk past the end of the tree, an extra all-zero meta node
needs to be present at the end of the allocation, and
blst_next_leaf_alloc() is implemented such that the presence of this
node terminates the search.

blist_create() computes the number of nodes required.  It had two
problems:
1. When the size of the blist is a power of BLIST_RADIX, we would
   unnecessarily allocate an extra level in the tree.
2. When the size of the blist is a multiple of BLIST_RADIX, we would
   fail to allocate a terminator node.  In this case,
   blst_next_leaf_alloc() could scan beyond the bounds of the
   allocation.  This was found using KASAN.

Modify blist_create() to handle these cases correctly.

Reported by:	pho
Reviewed by:	dougm

(cherry picked from commit 2783335cae)
2021-07-26 21:47:20 -04:00
..
bus_if.m
capabilities.conf Add aio_writev and aio_readv 2021-01-02 19:57:58 -07:00
clock_if.m
cpufreq_if.m
device_if.m
firmw.S Use a template assembly file for firmware object files. 2020-12-17 20:31:17 +00:00
genassym.sh
genoffset.c
genoffset.sh
imgact_aout.c Do not call FreeBSD-ABI specific code for all ABIs 2021-07-22 01:11:52 +03:00
imgact_binmisc.c imgact_binmisc: limit the extent of match on incoming entries 2020-11-08 04:24:29 +00:00
imgact_elf.c ELF coredump: define several useful flags for the coredump operations 2021-05-10 04:02:16 +03:00
imgact_elf32.c
imgact_elf64.c
imgact_shell.c
init_main.c Stop arming kqueue timers on knote owner suspend or terminate 2021-04-23 14:14:09 +03:00
init_sysent.c regen syscall files after 0bd5d81f1e 2021-05-19 20:32:47 -04:00
kern_acct.c accounting: explicitly mark the exiting thread as doing accounting 2021-06-13 04:22:33 +03:00
kern_alq.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_clock.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_clocksource.c
kern_condvar.c Use sleepq_signal(SLEEPQ_DROP) in cv_signal(). 2021-07-17 18:10:25 -04:00
kern_conf.c Fix handling of D_GIANTOK 2021-06-14 16:25:15 -04:00
kern_cons.c Remove sysctl_kern_consmute() 2020-10-05 15:54:19 +00:00
kern_context.c
kern_cpu.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_cpuset.c domainset: Define additional global policies 2021-04-28 10:00:36 -04:00
kern_ctf.c
kern_descrip.c ktrace: pack all ktrace parameters into allocated structure ktr_io_params 2021-06-13 04:22:33 +03:00
kern_dtrace.c dtrace: stop using eventhandlers for the part compiled into the kernel 2020-11-23 18:27:21 +00:00
kern_dump.c Always use 64-bit physical addresses for dump_avail[] in minidumps 2020-12-03 17:12:31 +00:00
kern_environment.c Move kernel env global variables, etc to sys/kenv.h 2020-10-07 06:16:37 +00:00
kern_et.c Remove NO_EVENTTIMERS support 2020-11-19 02:50:48 +00:00
kern_event.c kqueue: replace kq_ncallouts loop with atomic_fetchadd 2021-06-07 00:49:46 +00:00
kern_exec.c Do not call FreeBSD-ABI specific code for all ABIs 2021-07-22 01:11:52 +03:00
kern_exit.c Do not call FreeBSD-ABI specific code for all ABIs 2021-07-22 01:11:52 +03:00
kern_fail.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_ffclock.c
kern_fork.c fork: Suspend other threads if both RFPROC and RFMEM are not set 2021-05-20 09:16:47 -04:00
kern_hhook.c
kern_idle.c
kern_intr.c MFC 6eb60f5b7f: 2021-03-23 11:51:04 +01:00
kern_jail.c MFC fixes to hostuuid handling 2021-05-20 17:57:15 -07:00
kern_kcov.c
kern_khelp.c
kern_kthread.c Set TDP_KTHREAD before calling cpu_fork() and cpu_copy_thread(). 2021-03-29 11:10:54 -07:00
kern_ktr.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_ktrace.c ktrace: Remove vrele() at the end of ktr_writerequest() 2021-06-13 04:22:34 +03:00
kern_linker.c kern linker: do not allow more than one kldload and kldunload syscalls simultaneously 2021-06-07 19:32:42 +03:00
kern_lock.c lockprof: pass lock type as an argument instead of reading the spin flag 2021-06-02 15:00:23 +00:00
kern_lockf.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_lockstat.c
kern_loginclass.c Drop "All rights reserved" from all my stuff. This includes 2020-10-28 13:46:11 +00:00
kern_malloc.c MFC c743a6bd4f: 2021-03-23 11:50:29 +01:00
kern_mbuf.c mbuf: add m_free_raw to be used instead of directly calling uma_zfree 2021-07-05 12:04:59 +00:00
kern_mib.c jail: Consistently handle the pr_allow bitmask 2020-12-26 20:25:02 -08:00
kern_module.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_mtxpool.c
kern_mutex.c lockprof: pass lock type as an argument instead of reading the spin flag 2021-06-02 15:00:23 +00:00
kern_ntptime.c Add kern_ntp_adjtime(9). 2020-12-04 18:56:44 +00:00
kern_osd.c
kern_physio.c Remove alignment requirements for KVA buffer mapping. 2020-11-29 01:30:17 +00:00
kern_pmc.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_poll.c
kern_priv.c jail: Consistently handle the pr_allow bitmask 2020-12-26 20:25:02 -08:00
kern_proc.c ktrace: pack all ktrace parameters into allocated structure ktr_io_params 2021-06-13 04:22:33 +03:00
kern_procctl.c procctl(PROC_ASLR_STATUS): fix vmspace leak 2021-07-18 03:26:52 +03:00
kern_prot.c kern: fail getgroup and setgroup with negative int 2021-07-07 14:09:44 -06:00
kern_racct.c Drop "All rights reserved" from all my stuff. This includes 2020-10-28 13:46:11 +00:00
kern_rangelock.c
kern_rctl.c rctl(4): support throttling resource usage to 0 2021-01-11 15:36:57 -08:00
kern_resource.c vm_map_protect: allow to set prot and max_prot in one go. 2021-01-13 01:35:22 +02:00
kern_rmlock.c rmlock(9): add an RM_DUPOK flag 2021-04-16 10:48:02 -03:00
kern_rwlock.c lockprof: pass lock type as an argument instead of reading the spin flag 2021-06-02 15:00:23 +00:00
kern_sdt.c
kern_sema.c
kern_sendfile.c Fix handling of errors from pru_send(PRUS_NOTREADY) 2021-06-03 21:02:02 -04:00
kern_sharedpage.c random(4) FenestrasX: Push root seed version to arc4random(3) 2020-10-10 21:52:00 +00:00
kern_shutdown.c Add an option for entering KDB on recursive panics 2020-11-19 18:03:40 +00:00
kern_sig.c Add a knob to not drop signal with default ignored or ignored actions 2021-06-22 04:45:31 +03:00
kern_switch.c
kern_sx.c lockprof: pass lock type as an argument instead of reading the spin flag 2021-06-02 15:00:23 +00:00
kern_synch.c Allow sleepq_signal() to drop the lock. 2021-07-08 21:38:32 -04:00
kern_syscalls.c Move syscall_thread_{enter,exit}() into the slow path. This is only 2020-11-08 15:54:59 +00:00
kern_sysctl.c sysctl_handle_string: do not malloc when SYSCTL_IN cannot fault 2021-04-23 14:14:11 +03:00
kern_tc.c Make kern.timecounter.hardware tunable 2021-03-15 08:09:59 +02:00
kern_thr.c Provide ABI modules hooks for process exec/exit and thread exit. 2020-11-23 17:29:25 +00:00
kern_thread.c Add thread_reap_barrier() 2021-06-07 19:32:42 +03:00
kern_time.c posix timers: Check for overflow when converting to ns 2021-05-20 09:16:05 -04:00
kern_timeout.c callout: Make cc_cpu local to kern_timeout.c 2021-07-23 07:49:49 -04:00
kern_tslog.c
kern_ubsan.c
kern_umtx.c umtx: convert umtxq_lock to a macro 2021-06-07 00:34:52 +00:00
kern_uuid.c
kern_xxx.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
ksched.c
link_elf.c vm_map_protect: allow to set prot and max_prot in one go. 2021-01-13 01:35:22 +02:00
link_elf_obj.c link_elf_obj: Add a case missing from 5e6989ba4f 2021-03-17 21:24:55 -04:00
linker_if.m
Make.tags.inc
Makefile
makesyscalls.sh
md4c.c
md5c.c
msi_if.m o Add iommu de-initialization method for MSI interface. 2020-10-24 20:09:27 +00:00
p1003_1b.c
pic_if.m
posix4_mib.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
sched_4bsd.c lockprof: pass lock type as an argument instead of reading the spin flag 2021-06-02 15:00:23 +00:00
sched_ule.c sched: fix an incorrect comparison in sched_lend_user_prio_cond 2020-11-15 01:54:44 +00:00
serdev_if.m
stack_protector.c
subr_acl_nfs4.c Drop "All rights reserved" from all my stuff. This includes 2020-10-28 13:46:11 +00:00
subr_acl_posix1e.c
subr_atomic64.c
subr_autoconf.c config_intrhook: provide config_intrhook_drain 2021-07-12 13:30:55 -06:00
subr_blist.c blist: Correct the node count computed in blist_create() 2021-07-26 21:47:20 -04:00
subr_boot.c
subr_bufring.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_bus.c Create VM_MEMATTR_DEVICE on all architectures 2021-06-13 16:49:36 +01:00
subr_bus_dma.c Move the iommu stubs to a generic place, so they are available on all the 2020-10-23 21:27:48 +00:00
subr_busdma_bufalloc.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_capability.c
subr_clock.c
subr_compressor.c
subr_counter.c Rationalize per-cpu zones. 2020-11-05 15:08:56 +00:00
subr_coverage.c
subr_csan.c Rename _cscan_atomic.h and _cscan_bus.h to atomic_san.h and bus_san.h 2021-03-15 11:39:11 -04:00
subr_devmap.c ddb: fix show devmap output on 32-bit arm 2021-02-23 10:30:14 -04:00
subr_devstat.c Speed up geom_stats_resync in the presence of many devices 2021-03-21 02:23:42 +00:00
subr_disk.c Enable bioq 'car limit' added at r335066 at 128 bios. 2020-10-26 04:04:06 +00:00
subr_dummy_vdso_tc.c
subr_early.c
subr_epoch.c The old thread priority must be stored as part of the EPOCH(9) tracker. 2021-06-02 14:03:21 +02:00
subr_eventhandler.c
subr_fattime.c
subr_filter.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_firmware.c firmware(9): extend firmware_get() by a "no warn" flag. 2021-02-01 07:15:29 +00:00
subr_gtaskqueue.c Make sure all tasklets are drained before unloading the LinuxKPI. 2021-06-02 13:23:19 +02:00
subr_hash.c
subr_hints.c Move kernel env global variables, etc to sys/kenv.h 2020-10-07 06:16:37 +00:00
subr_intr.c kern/intr: declare interrupt vectors unsigned 2021-05-10 09:36:20 -04:00
subr_kdb.c sysctl: improve debug.kdb.panic_str description 2021-01-09 11:10:42 -07:00
subr_kobj.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_lock.c lockprof: move panic check after inspecting the state 2021-06-02 15:00:23 +00:00
subr_log.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_mchain.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_module.c sysctl debug.dump_modinfo should recognize font module 2021-01-08 09:24:49 +02:00
subr_msgbuf.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_param.c Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
subr_pcpu.c Add more per-cpu zones. 2020-11-09 00:34:23 +00:00
subr_pctrie.c
subr_physmem.c Add support for hw.physmem tunable for ARM/ARM64/RISC-V platforms 2020-12-03 05:39:27 +00:00
subr_pidctrl.c
subr_power.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_prf.c kvprintf(9): add missing FALLTHROUGH 2021-01-22 00:18:40 +01:00
subr_prng.c
subr_prof.c
subr_rangeset.c
subr_rman.c
subr_rtc.c Address whitespace nits in subr_rtc.c 2020-09-28 17:19:57 +00:00
subr_sbuf.c sbuf_uionew(): sbuf_new() takes int as length 2021-04-23 14:14:09 +03:00
subr_scanf.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_sfbuf.c
subr_sglist.c
subr_sleepqueue.c Allow sleepq_signal() to drop the lock. 2021-07-08 21:38:32 -04:00
subr_smp.c quisce_cpus(): add special handling for PDROP 2021-06-07 19:32:42 +03:00
subr_smr.c
subr_stack.c
subr_stats.c stats(3): Improve t-digest merging of samples which result in mu adjustment underflow. 2021-04-02 13:29:55 +11:00
subr_syscall.c Allow some VOPs to return ERELOOKUP to indicate VFS operation restart at top level. 2020-11-13 09:42:32 +00:00
subr_taskqueue.c
subr_terminal.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_trap.c tcp: HPTS performance enhancements 2021-07-13 21:58:30 +02:00
subr_turnstile.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_uio.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_unit.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_vmem.c vmem: Revert r364744 2020-12-01 16:06:31 +00:00
subr_witness.c Remove more remnants of sio(4) 2021-04-14 09:19:49 -04:00
sys_capability.c
sys_eventfd.c Expose eventfd in the native API/ABI using a new __specialfd syscall 2020-12-27 12:57:26 +02:00
sys_generic.c poll: use fget_unlocked or fget_only_user when feasible 2021-02-01 12:39:18 +00:00
sys_getrandom.c
sys_pipe.c pipe: Avoid calling selrecord() on a closing pipe 2021-05-05 11:01:43 -04:00
sys_procdesc.c procdesc: convert the zone to a malloc type 2020-11-09 00:05:21 +00:00
sys_process.c sys_process.c: extract ptrace_unsuspend() 2021-06-01 03:38:53 +03:00
sys_socket.c aio: micro-optimize the lio_opcode assignments 2021-01-20 09:02:25 -07:00
syscalls.c Regenerate syscall files after reallocation of aio_writev/aio_readv 2021-01-07 19:50:32 -07:00
syscalls.master kern: fail getgroup and setgroup with negative int 2021-07-07 14:09:44 -06:00
systrace_args.c regen syscall files after 0bd5d81f1e 2021-05-19 20:32:47 -04:00
sysv_ipc.c
sysv_msg.c MFC jail: Change the locking around pr_ref and pr_uref 2021-03-12 10:30:06 -08:00
sysv_sem.c MFC jail: Change the locking around pr_ref and pr_uref 2021-03-12 10:30:06 -08:00
sysv_shm.c MFC jail: Change the locking around pr_ref and pr_uref 2021-03-12 10:30:06 -08:00
tty.c ttydev_write: prevent stops while terminal is busied 2021-05-25 10:15:51 +03:00
tty_compat.c
tty_info.c
tty_inq.c
tty_outq.c
tty_pts.c
tty_tty.c
tty_ttydisc.c
uipc_accf.c Consistently use the SOLISTENING() macro 2021-06-21 09:14:40 -04:00
uipc_debug.c
uipc_domain.c
uipc_ktls.c ktls: switch bare zone_mbuf use to m_free_raw 2021-07-05 12:05:01 +00:00
uipc_mbuf.c mbuf: add a way to mark flowid as calculated from the internal headers 2021-04-07 06:32:39 +03:00
uipc_mbuf2.c
uipc_mbufhash.c Implement mbuf hashing routines for IP over infiniband, IPoIB. 2020-10-22 09:17:56 +00:00
uipc_mqueue.c MFC jail: Change the locking around pr_ref and pr_uref 2021-03-12 10:30:06 -08:00
uipc_sem.c Convert remaining cap_rights_init users to cap_rights_init_one 2021-01-12 13:16:10 +00:00
uipc_shm.c Constify vm_pager-related virtual tables. 2021-05-22 12:38:29 +03:00
uipc_sockbuf.c Consistently use the SOCKBUF_MTX() and SOCK_MTX() macros 2021-06-21 09:14:48 -04:00
uipc_socket.c Consistently use the SOCKBUF_MTX() and SOCK_MTX() macros 2021-06-21 09:14:48 -04:00
uipc_syscalls.c Consistently use the SOLISTENING() macro 2021-06-21 09:14:40 -04:00
uipc_usrreq.c Consistently use the SOLISTENING() macro 2021-06-21 09:14:40 -04:00
vfs_acl.c
vfs_aio.c open(2): Implement O_PATH 2021-04-23 14:14:10 +03:00
vfs_bio.c buf: Fix the dirtybufthresh check 2021-03-04 08:20:12 -05:00
vfs_cache.c cache: add cache_enter_time_flags 2021-07-25 06:59:56 +00:00
vfs_cluster.c Delete dead CLUSTERDEBUG config option. 2021-02-28 02:42:35 +02:00
vfs_default.c vfs: add missing atomic conversion to writecount adjustment 2021-05-22 18:22:16 +00:00
vfs_export.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
vfs_extattr.c
vfs_hash.c vfs: avoid exposing partially constructed vnodes 2020-09-05 00:26:03 +00:00
vfs_init.c
vfs_lookup.c vfs: use the sentinel trick in locked lookup path parsing 2021-06-07 00:34:56 +00:00
vfs_mount.c vfs: add vfs_ref_from_vp 2021-04-10 05:57:55 +00:00
vfs_mountroot.c vfs: denote vnode being a mount point with VIRF_MOUNTPOINT 2021-01-03 06:50:06 +00:00
vfs_subr.c vfs: retire unused vn_seqc_write_begin_unheld* 2021-06-07 00:34:54 +00:00
vfs_syscalls.c namei: add NDPREINIT() macro 2021-07-07 13:23:25 +03:00
vfs_vnops.c vfs: slightly rework vn_rlimit_fsize 2021-06-13 02:15:25 +00:00
vnode_if.src Add VOP_VPUT_PAIR() with trivial default implementation. 2021-02-24 09:43:03 +02:00