ID Workflow Result Correct Bug Created Started Finished Revision
e23ddb38 patching KASAN: use-after-free Read in dbJoin 2026/06/30 14:35 2026/06/30 14:35 2026/06/30 15:23 93f57954
Agent: prod-syz-agent-1
External Bug ID: ---

Inputs:
BaseBranch master
BaseCommit RC
BaseRepository git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
BugTitle KASAN: use-after-free Read in dbJoin
CrashLogID 5226126013628416
CrashReportID 5520093909352448
KernelCommit a5131c3fdf2608f1c15f3809e201cf540eb28489
KernelConfig
Show (259113 bytes)
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 6.9.0 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (Debian 12.2.0-14) 12.2.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=120200
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=24000
CONFIG_LD_IS_BFD=y
CONFIG_LD_VERSION=24000
CONFIG_LLD_VERSION=0
CONFIG_CC_CAN_LINK=y
CONFIG_CC_CAN_LINK_STATIC=y
CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y
CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y
CONFIG_TOOLS_SUPPORT_RELR=y
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y
CONFIG_PAHOLE_VERSION=124
CONFIG_CONSTRUCTORS=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_TABLE_SORT=y
CONFIG_THREAD_INFO_IN_TASK=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
# CONFIG_COMPILE_TEST is not set
# CONFIG_WERROR is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_BUILD_SALT=""
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
CONFIG_HAVE_KERNEL_ZSTD=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
# CONFIG_KERNEL_ZSTD is not set
CONFIG_DEFAULT_INIT=""
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_SYSVIPC_COMPAT=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_WATCH_QUEUE=y
CONFIG_CROSS_MEMORY_ATTACH=y
# CONFIG_USELIB is not set
CONFIG_AUDIT=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
CONFIG_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_GENERIC_IRQ_MIGRATION=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_IRQ_MSI_IOMMU=y
CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR=y
CONFIG_GENERIC_IRQ_RESERVATION_MODE=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
# CONFIG_GENERIC_IRQ_DEBUGFS is not set
# end of IRQ subsystem

CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_INIT=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST_IDLE=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK=y
CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y
CONFIG_CONTEXT_TRACKING=y
CONFIG_CONTEXT_TRACKING_IDLE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
# CONFIG_NO_HZ_FULL is not set
CONFIG_CONTEXT_TRACKING_USER=y
# CONFIG_CONTEXT_TRACKING_USER_FORCE is not set
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_CLOCKSOURCE_WATCHDOG_MAX_SKEW_US=125
# end of Timers subsystem

CONFIG_BPF=y
CONFIG_HAVE_EBPF_JIT=y
CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y

#
# BPF subsystem
#
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_BPF_JIT_DEFAULT_ON=y
# CONFIG_BPF_UNPRIV_DEFAULT_OFF is not set
CONFIG_USERMODE_DRIVER=y
CONFIG_BPF_PRELOAD=y
CONFIG_BPF_PRELOAD_UMD=y
CONFIG_BPF_LSM=y
# end of BPF subsystem

CONFIG_PREEMPT_BUILD=y
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
CONFIG_PREEMPT=y
CONFIG_PREEMPT_COUNT=y
CONFIG_PREEMPTION=y
CONFIG_PREEMPT_DYNAMIC=y
CONFIG_SCHED_CORE=y

#
# CPU/Task time and stats accounting
#
CONFIG_VIRT_CPU_ACCOUNTING=y
# CONFIG_TICK_CPU_ACCOUNTING is not set
CONFIG_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_IRQ_TIME_ACCOUNTING=y
CONFIG_HAVE_SCHED_AVG_IRQ=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_PSI=y
# CONFIG_PSI_DEFAULT_DISABLED is not set
# end of CPU/Task time and stats accounting

CONFIG_CPU_ISOLATION=y

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
CONFIG_PREEMPT_RCU=y
# CONFIG_RCU_EXPERT is not set
CONFIG_TREE_SRCU=y
CONFIG_TASKS_RCU_GENERIC=y
CONFIG_NEED_TASKS_RCU=y
CONFIG_TASKS_RCU=y
CONFIG_TASKS_TRACE_RCU=y
CONFIG_RCU_STALL_COMMON=y
CONFIG_RCU_NEED_SEGCBLIST=y
# end of RCU Subsystem

CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
# CONFIG_IKHEADERS is not set
CONFIG_LOG_BUF_SHIFT=18
CONFIG_LOG_CPU_MAX_BUF_SHIFT=12
# CONFIG_PRINTK_INDEX is not set
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y

#
# Scheduler features
#
# CONFIG_UCLAMP_TASK is not set
# end of Scheduler features

CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y
CONFIG_CC_HAS_INT128=y
CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
CONFIG_GCC10_NO_ARRAY_BOUNDS=y
CONFIG_CC_NO_ARRAY_BOUNDS=y
CONFIG_GCC_NO_STRINGOP_OVERFLOW=y
CONFIG_CC_NO_STRINGOP_OVERFLOW=y
CONFIG_ARCH_SUPPORTS_INT128=y
CONFIG_NUMA_BALANCING=y
CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y
CONFIG_CGROUPS=y
CONFIG_PAGE_COUNTER=y
# CONFIG_CGROUP_FAVOR_DYNMODS is not set
CONFIG_MEMCG=y
CONFIG_MEMCG_KMEM=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_WRITEBACK=y
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_CFS_BANDWIDTH=y
# CONFIG_RT_GROUP_SCHED is not set
CONFIG_SCHED_MM_CID=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_RDMA=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CPUSETS=y
CONFIG_PROC_PID_CPUSET=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_PERF=y
CONFIG_CGROUP_BPF=y
CONFIG_CGROUP_MISC=y
CONFIG_CGROUP_DEBUG=y
CONFIG_SOCK_CGROUP_DATA=y
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_TIME_NS=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
CONFIG_PID_NS=y
CONFIG_NET_NS=y
CONFIG_CHECKPOINT_RESTORE=y
# CONFIG_SCHED_AUTOGROUP is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
CONFIG_RD_LZO=y
CONFIG_RD_LZ4=y
CONFIG_RD_ZSTD=y
# CONFIG_BOOT_CONFIG is not set
CONFIG_INITRAMFS_PRESERVE_MTIME=y
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_LD_ORPHAN_WARN=y
CONFIG_LD_ORPHAN_WARN_LEVEL="warn"
CONFIG_SYSCTL=y
CONFIG_HAVE_UID16=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_EXPERT=y
CONFIG_UID16=y
CONFIG_MULTIUSER=y
CONFIG_SGETMASK_SYSCALL=y
CONFIG_SYSFS_SYSCALL=y
CONFIG_FHANDLE=y
CONFIG_POSIX_TIMERS=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_FUTEX_PI=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_IO_URING=y
CONFIG_ADVISE_SYSCALLS=y
CONFIG_MEMBARRIER=y
CONFIG_KCMP=y
CONFIG_RSEQ=y
# CONFIG_DEBUG_RSEQ is not set
CONFIG_CACHESTAT_SYSCALL=y
# CONFIG_PC104 is not set
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_SELFTEST is not set
CONFIG_KALLSYMS_ALL=y
CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y
CONFIG_KALLSYMS_BASE_RELATIVE=y
CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_GUEST_PERF_EVENTS=y

#
# Kernel Performance Events And Counters
#
CONFIG_PERF_EVENTS=y
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
# end of Kernel Performance Events And Counters

CONFIG_SYSTEM_DATA_VERIFICATION=y
CONFIG_PROFILING=y
CONFIG_TRACEPOINTS=y

#
# Kexec and crash features
#
CONFIG_CRASH_RESERVE=y
CONFIG_VMCORE_INFO=y
CONFIG_KEXEC_CORE=y
CONFIG_KEXEC=y
# CONFIG_KEXEC_FILE is not set
# CONFIG_KEXEC_JUMP is not set
CONFIG_CRASH_DUMP=y
CONFIG_CRASH_HOTPLUG=y
CONFIG_CRASH_MAX_MEMORY_RANGES=8192
# end of Kexec and crash features
# end of General setup

CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_MMU=y
CONFIG_ARCH_MMAP_RND_BITS_MIN=28
CONFIG_ARCH_MMAP_RND_BITS_MAX=32
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_CSUM=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_AUDIT_ARCH=y
CONFIG_KASAN_SHADOW_OFFSET=0xdffffc0000000000
CONFIG_HAVE_INTEL_TXT=y
CONFIG_X86_64_SMP=y
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_PGTABLE_LEVELS=4
CONFIG_CC_HAS_SANE_STACKPROTECTOR=y

#
# Processor type and features
#
CONFIG_SMP=y
CONFIG_X86_X2APIC=y
CONFIG_X86_MPPARSE=y
# CONFIG_X86_CPU_RESCTRL is not set
# CONFIG_X86_FRED is not set
CONFIG_X86_EXTENDED_PLATFORM=y
# CONFIG_X86_NUMACHIP is not set
# CONFIG_X86_VSMP is not set
# CONFIG_X86_GOLDFISH is not set
# CONFIG_X86_INTEL_MID is not set
# CONFIG_X86_INTEL_LPSS is not set
# CONFIG_X86_AMD_PLATFORM_DEVICE is not set
CONFIG_IOSF_MBI=y
# CONFIG_IOSF_MBI_DEBUG is not set
CONFIG_X86_SUPPORTS_MEMORY_FAILURE=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_DEBUG=y
CONFIG_PARAVIRT_SPINLOCKS=y
CONFIG_X86_HV_CALLBACK_VECTOR=y
# CONFIG_XEN is not set
CONFIG_KVM_GUEST=y
CONFIG_ARCH_CPUIDLE_HALTPOLL=y
CONFIG_PVH=y
# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set
CONFIG_PARAVIRT_CLOCK=y
# CONFIG_JAILHOUSE_GUEST is not set
# CONFIG_ACRN_GUEST is not set
# CONFIG_MK8 is not set
# CONFIG_MPSC is not set
CONFIG_MCORE2=y
# CONFIG_MATOM is not set
# CONFIG_GENERIC_CPU is not set
CONFIG_X86_INTERNODE_CACHE_SHIFT=6
CONFIG_X86_L1_CACHE_SHIFT=6
CONFIG_X86_INTEL_USERCOPY=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_X86_P6_NOP=y
CONFIG_X86_TSC=y
CONFIG_X86_HAVE_PAE=y
CONFIG_X86_CMPXCHG64=y
CONFIG_X86_CMOV=y
CONFIG_X86_MINIMUM_CPU_FAMILY=64
CONFIG_X86_DEBUGCTLMSR=y
CONFIG_IA32_FEAT_CTL=y
CONFIG_X86_VMX_FEATURE_NAMES=y
CONFIG_PROCESSOR_SELECT=y
CONFIG_CPU_SUP_INTEL=y
CONFIG_CPU_SUP_AMD=y
# CONFIG_CPU_SUP_HYGON is not set
# CONFIG_CPU_SUP_CENTAUR is not set
# CONFIG_CPU_SUP_ZHAOXIN is not set
CONFIG_HPET_TIMER=y
CONFIG_HPET_EMULATE_RTC=y
CONFIG_DMI=y
# CONFIG_GART_IOMMU is not set
CONFIG_BOOT_VESA_SUPPORT=y
# CONFIG_MAXSMP is not set
CONFIG_NR_CPUS_RANGE_BEGIN=2
CONFIG_NR_CPUS_RANGE_END=512
CONFIG_NR_CPUS_DEFAULT=64
CONFIG_NR_CPUS=8
CONFIG_SCHED_CLUSTER=y
CONFIG_SCHED_SMT=y
CONFIG_SCHED_MC=y
CONFIG_SCHED_MC_PRIO=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
CONFIG_X86_MCE=y
# CONFIG_X86_MCELOG_LEGACY is not set
CONFIG_X86_MCE_INTEL=y
CONFIG_X86_MCE_AMD=y
CONFIG_X86_MCE_THRESHOLD=y
# CONFIG_X86_MCE_INJECT is not set

#
# Performance monitoring
#
CONFIG_PERF_EVENTS_INTEL_UNCORE=y
CONFIG_PERF_EVENTS_INTEL_RAPL=y
CONFIG_PERF_EVENTS_INTEL_CSTATE=y
# CONFIG_PERF_EVENTS_AMD_POWER is not set
CONFIG_PERF_EVENTS_AMD_UNCORE=y
# CONFIG_PERF_EVENTS_AMD_BRS is not set
# end of Performance monitoring

CONFIG_X86_16BIT=y
CONFIG_X86_ESPFIX64=y
CONFIG_X86_VSYSCALL_EMULATION=y
CONFIG_X86_IOPL_IOPERM=y
CONFIG_MICROCODE=y
# CONFIG_MICROCODE_LATE_LOADING is not set
CONFIG_X86_MSR=y
CONFIG_X86_CPUID=y
# CONFIG_X86_5LEVEL is not set
CONFIG_X86_DIRECT_GBPAGES=y
# CONFIG_X86_CPA_STATISTICS is not set
CONFIG_NUMA=y
CONFIG_AMD_NUMA=y
CONFIG_X86_64_ACPI_NUMA=y
CONFIG_NUMA_EMU=y
CONFIG_NODES_SHIFT=6
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ARCH_SPARSEMEM_DEFAULT=y
# CONFIG_ARCH_MEMORY_PROBE is not set
CONFIG_ARCH_PROC_KCORE_TEXT=y
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
# CONFIG_X86_PMEM_LEGACY is not set
# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set
CONFIG_MTRR=y
# CONFIG_MTRR_SANITIZER is not set
CONFIG_X86_PAT=y
CONFIG_ARCH_USES_PG_UNCACHED=y
CONFIG_X86_UMIP=y
CONFIG_CC_HAS_IBT=y
CONFIG_X86_CET=y
CONFIG_X86_KERNEL_IBT=y
CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS=y
# CONFIG_X86_INTEL_TSX_MODE_OFF is not set
CONFIG_X86_INTEL_TSX_MODE_ON=y
# CONFIG_X86_INTEL_TSX_MODE_AUTO is not set
CONFIG_X86_SGX=y
CONFIG_X86_USER_SHADOW_STACK=y
# CONFIG_EFI is not set
CONFIG_HZ_100=y
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=100
CONFIG_SCHED_HRTICK=y
CONFIG_ARCH_SUPPORTS_KEXEC=y
CONFIG_ARCH_SUPPORTS_KEXEC_FILE=y
CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY=y
CONFIG_ARCH_SUPPORTS_KEXEC_SIG=y
CONFIG_ARCH_SUPPORTS_KEXEC_SIG_FORCE=y
CONFIG_ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG=y
CONFIG_ARCH_SUPPORTS_KEXEC_JUMP=y
CONFIG_ARCH_SUPPORTS_CRASH_DUMP=y
CONFIG_ARCH_SUPPORTS_CRASH_HOTPLUG=y
CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION=y
CONFIG_PHYSICAL_START=0x1000000
# CONFIG_RELOCATABLE is not set
CONFIG_PHYSICAL_ALIGN=0x200000
CONFIG_ADDRESS_MASKING=y
CONFIG_HOTPLUG_CPU=y
# CONFIG_COMPAT_VDSO is not set
CONFIG_LEGACY_VSYSCALL_XONLY=y
# CONFIG_LEGACY_VSYSCALL_NONE is not set
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="earlyprintk=serial net.ifnames=0 sysctl.kernel.hung_task_all_cpu_backtrace=1 ima_policy=tcb nf-conntrack-ftp.ports=20000 nf-conntrack-tftp.ports=20000 nf-conntrack-sip.ports=20000 nf-conntrack-irc.ports=20000 nf-conntrack-sane.ports=20000 binder.debug_mask=0 rcupdate.rcu_expedited=1 rcupdate.rcu_cpu_stall_cputime=1 no_hash_pointers page_owner=on sysctl.vm.nr_hugepages=4 sysctl.vm.nr_overcommit_hugepages=4 secretmem.enable=1 sysctl.max_rcu_stall_to_panic=1 msr.allow_writes=off coredump_filter=0xffff root=/dev/sda console=ttyS0 vsyscall=native numa=fake=2 kvm-intel.nested=1 spec_store_bypass_disable=prctl nopcid vivid.n_devs=16 vivid.multiplanar=1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2 netrom.nr_ndevs=16 rose.rose_ndevs=16 smp.csd_lock_timeout=100000 watchdog_thresh=55 workqueue.watchdog_thresh=140 sysctl.net.core.netdev_unregister_timeout_secs=140 dummy_hcd.num=8 panic_on_warn=1 kasan.fault=panic_on_write kasan_multi_shot"
# CONFIG_CMDLINE_OVERRIDE is not set
CONFIG_MODIFY_LDT_SYSCALL=y
# CONFIG_STRICT_SIGALTSTACK_SIZE is not set
CONFIG_HAVE_LIVEPATCH=y
# end of Processor type and features

CONFIG_CC_HAS_NAMED_AS=y
CONFIG_CC_HAS_SLS=y
CONFIG_CC_HAS_RETURN_THUNK=y
CONFIG_CC_HAS_ENTRY_PADDING=y
CONFIG_FUNCTION_PADDING_CFI=11
CONFIG_FUNCTION_PADDING_BYTES=16
CONFIG_CALL_PADDING=y
CONFIG_HAVE_CALL_THUNKS=y
CONFIG_CALL_THUNKS=y
CONFIG_PREFIX_SYMBOLS=y
CONFIG_CPU_MITIGATIONS=y
CONFIG_MITIGATION_PAGE_TABLE_ISOLATION=y
CONFIG_MITIGATION_RETPOLINE=y
CONFIG_MITIGATION_RETHUNK=y
CONFIG_MITIGATION_UNRET_ENTRY=y
CONFIG_MITIGATION_CALL_DEPTH_TRACKING=y
# CONFIG_CALL_THUNKS_DEBUG is not set
CONFIG_MITIGATION_IBPB_ENTRY=y
CONFIG_MITIGATION_IBRS_ENTRY=y
CONFIG_MITIGATION_SRSO=y
# CONFIG_MITIGATION_SLS is not set
# CONFIG_MITIGATION_GDS_FORCE is not set
CONFIG_MITIGATION_RFDS=y
CONFIG_MITIGATION_SPECTRE_BHI=y
CONFIG_ARCH_HAS_ADD_PAGES=y

#
# Power management and ACPI options
#
CONFIG_ARCH_HIBERNATION_HEADER=y
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_SUSPEND_SKIP_SYNC is not set
CONFIG_HIBERNATE_CALLBACKS=y
CONFIG_HIBERNATION=y
CONFIG_HIBERNATION_SNAPSHOT_DEV=y
CONFIG_HIBERNATION_COMP_LZO=y
# CONFIG_HIBERNATION_COMP_LZ4 is not set
CONFIG_HIBERNATION_DEF_COMP="lzo"
CONFIG_PM_STD_PARTITION=""
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
# CONFIG_PM_AUTOSLEEP is not set
# CONFIG_PM_USERSPACE_AUTOSLEEP is not set
# CONFIG_PM_WAKELOCKS is not set
CONFIG_PM=y
CONFIG_PM_DEBUG=y
# CONFIG_PM_ADVANCED_DEBUG is not set
# CONFIG_PM_TEST_SUSPEND is not set
CONFIG_PM_SLEEP_DEBUG=y
# CONFIG_DPM_WATCHDOG is not set
CONFIG_PM_TRACE=y
CONFIG_PM_TRACE_RTC=y
CONFIG_PM_CLK=y
# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set
# CONFIG_ENERGY_MODEL is not set
CONFIG_ARCH_SUPPORTS_ACPI=y
CONFIG_ACPI=y
CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y
CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC=y
CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT=y
CONFIG_ACPI_THERMAL_LIB=y
# CONFIG_ACPI_DEBUGGER is not set
CONFIG_ACPI_SPCR_TABLE=y
# CONFIG_ACPI_FPDT is not set
CONFIG_ACPI_LPIT=y
CONFIG_ACPI_SLEEP=y
CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y
# CONFIG_ACPI_EC_DEBUGFS is not set
CONFIG_ACPI_AC=y
CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_VIDEO=y
CONFIG_ACPI_FAN=y
# CONFIG_ACPI_TAD is not set
CONFIG_ACPI_DOCK=y
CONFIG_ACPI_CPU_FREQ_PSS=y
CONFIG_ACPI_PROCESSOR_CSTATE=y
CONFIG_ACPI_PROCESSOR_IDLE=y
CONFIG_ACPI_CPPC_LIB=y
CONFIG_ACPI_PROCESSOR=y
CONFIG_ACPI_HOTPLUG_CPU=y
# CONFIG_ACPI_PROCESSOR_AGGREGATOR is not set
CONFIG_ACPI_THERMAL=y
CONFIG_ACPI_PLATFORM_PROFILE=y
CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE=y
CONFIG_ACPI_TABLE_UPGRADE=y
# CONFIG_ACPI_DEBUG is not set
# CONFIG_ACPI_PCI_SLOT is not set
CONFIG_ACPI_CONTAINER=y
# CONFIG_ACPI_HOTPLUG_MEMORY is not set
CONFIG_ACPI_HOTPLUG_IOAPIC=y
# CONFIG_ACPI_SBS is not set
# CONFIG_ACPI_HED is not set
# CONFIG_ACPI_REDUCED_HARDWARE_ONLY is not set
CONFIG_ACPI_NFIT=y
# CONFIG_NFIT_SECURITY_DEBUG is not set
CONFIG_ACPI_NUMA=y
# CONFIG_ACPI_HMAT is not set
CONFIG_HAVE_ACPI_APEI=y
CONFIG_HAVE_ACPI_APEI_NMI=y
# CONFIG_ACPI_APEI is not set
# CONFIG_ACPI_DPTF is not set
# CONFIG_ACPI_EXTLOG is not set
# CONFIG_ACPI_CONFIGFS is not set
# CONFIG_ACPI_PFRUT is not set
CONFIG_ACPI_PCC=y
# CONFIG_ACPI_FFH is not set
# CONFIG_PMIC_OPREGION is not set
CONFIG_X86_PM_TIMER=y

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_GOV_ATTR_SET=y
CONFIG_CPU_FREQ_GOV_COMMON=y
# CONFIG_CPU_FREQ_STAT is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y

#
# CPU frequency scaling drivers
#
# CONFIG_CPUFREQ_DT is not set
# CONFIG_CPUFREQ_DT_PLATDEV is not set
CONFIG_X86_INTEL_PSTATE=y
# CONFIG_X86_PCC_CPUFREQ is not set
CONFIG_X86_AMD_PSTATE=y
CONFIG_X86_AMD_PSTATE_DEFAULT_MODE=3
# CONFIG_X86_AMD_PSTATE_UT is not set
CONFIG_X86_ACPI_CPUFREQ=y
CONFIG_X86_ACPI_CPUFREQ_CPB=y
# CONFIG_X86_POWERNOW_K8 is not set
# CONFIG_X86_AMD_FREQ_SENSITIVITY is not set
# CONFIG_X86_SPEEDSTEP_CENTRINO is not set
# CONFIG_X86_P4_CLOCKMOD is not set

#
# shared options
#
# end of CPU Frequency scaling

#
# CPU Idle
#
CONFIG_CPU_IDLE=y
# CONFIG_CPU_IDLE_GOV_LADDER is not set
CONFIG_CPU_IDLE_GOV_MENU=y
# CONFIG_CPU_IDLE_GOV_TEO is not set
CONFIG_CPU_IDLE_GOV_HALTPOLL=y
CONFIG_HALTPOLL_CPUIDLE=y
# end of CPU Idle

CONFIG_INTEL_IDLE=y
# end of Power management and ACPI options

#
# Bus options (PCI etc.)
#
CONFIG_PCI_DIRECT=y
CONFIG_PCI_MMCONFIG=y
CONFIG_MMCONF_FAM10H=y
# CONFIG_PCI_CNB20LE_QUIRK is not set
# CONFIG_ISA_BUS is not set
CONFIG_ISA_DMA_API=y
CONFIG_AMD_NB=y
# end of Bus options (PCI etc.)

#
# Binary Emulations
#
CONFIG_IA32_EMULATION=y
# CONFIG_IA32_EMULATION_DEFAULT_DISABLED is not set
CONFIG_X86_X32_ABI=y
CONFIG_COMPAT_32=y
CONFIG_COMPAT=y
CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
# end of Binary Emulations

CONFIG_KVM_COMMON=y
CONFIG_HAVE_KVM_PFNCACHE=y
CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_HAVE_KVM_IRQ_ROUTING=y
CONFIG_HAVE_KVM_DIRTY_RING=y
CONFIG_HAVE_KVM_DIRTY_RING_TSO=y
CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL=y
CONFIG_KVM_MMIO=y
CONFIG_KVM_ASYNC_PF=y
CONFIG_HAVE_KVM_MSI=y
CONFIG_HAVE_KVM_READONLY_MEM=y
CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y
CONFIG_KVM_VFIO=y
CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y
CONFIG_KVM_COMPAT=y
CONFIG_HAVE_KVM_IRQ_BYPASS=y
CONFIG_HAVE_KVM_NO_POLL=y
CONFIG_KVM_XFER_TO_GUEST_WORK=y
CONFIG_HAVE_KVM_PM_NOTIFIER=y
CONFIG_KVM_GENERIC_HARDWARE_ENABLING=y
CONFIG_KVM_GENERIC_MMU_NOTIFIER=y
CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES=y
CONFIG_KVM_PRIVATE_MEM=y
CONFIG_KVM_GENERIC_PRIVATE_MEM=y
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=y
CONFIG_KVM_SW_PROTECTED_VM=y
CONFIG_KVM_INTEL=y
CONFIG_X86_SGX_KVM=y
CONFIG_KVM_AMD=y
# CONFIG_KVM_SMM is not set
CONFIG_KVM_HYPERV=y
CONFIG_KVM_XEN=y
CONFIG_KVM_PROVE_MMU=y
CONFIG_KVM_MAX_NR_VCPUS=1024
CONFIG_AS_AVX512=y
CONFIG_AS_SHA1_NI=y
CONFIG_AS_SHA256_NI=y
CONFIG_AS_TPAUSE=y
CONFIG_AS_GFNI=y
CONFIG_AS_VAES=y
CONFIG_AS_VPCLMULQDQ=y
CONFIG_AS_WRUSS=y
CONFIG_ARCH_CONFIGURES_CPU_MITIGATIONS=y

#
# General architecture-dependent options
#
CONFIG_HOTPLUG_SMT=y
CONFIG_HOTPLUG_CORE_SYNC=y
CONFIG_HOTPLUG_CORE_SYNC_DEAD=y
CONFIG_HOTPLUG_CORE_SYNC_FULL=y
CONFIG_HOTPLUG_SPLIT_STARTUP=y
CONFIG_HOTPLUG_PARALLEL=y
CONFIG_GENERIC_ENTRY=y
# CONFIG_KPROBES is not set
CONFIG_JUMP_LABEL=y
# CONFIG_STATIC_KEYS_SELFTEST is not set
# CONFIG_STATIC_CALL_SELFTEST is not set
CONFIG_UPROBES=y
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
CONFIG_ARCH_USE_BUILTIN_BSWAP=y
CONFIG_USER_RETURN_NOTIFIER=y
CONFIG_HAVE_IOREMAP_PROT=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_OPTPROBES=y
CONFIG_HAVE_KPROBES_ON_FTRACE=y
CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y
CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y
CONFIG_HAVE_NMI=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y
CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_HAVE_DMA_CONTIGUOUS=y
CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_ARCH_HAS_FORTIFY_SOURCE=y
CONFIG_ARCH_HAS_SET_MEMORY=y
CONFIG_ARCH_HAS_SET_DIRECT_MAP=y
CONFIG_ARCH_HAS_CPU_FINALIZE_INIT=y
CONFIG_ARCH_HAS_CPU_PASID=y
CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y
CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y
CONFIG_ARCH_WANTS_NO_INSTR=y
CONFIG_HAVE_ASM_MODVERSIONS=y
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
CONFIG_HAVE_RSEQ=y
CONFIG_HAVE_RUST=y
CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y
CONFIG_HAVE_HW_BREAKPOINT=y
CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y
CONFIG_HAVE_USER_RETURN_NOTIFIER=y
CONFIG_HAVE_PERF_EVENTS_NMI=y
CONFIG_HAVE_HARDLOCKUP_DETECTOR_PERF=y
CONFIG_HAVE_PERF_REGS=y
CONFIG_HAVE_PERF_USER_STACK_DUMP=y
CONFIG_HAVE_ARCH_JUMP_LABEL=y
CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y
CONFIG_MMU_GATHER_TABLE_FREE=y
CONFIG_MMU_GATHER_RCU_TABLE_FREE=y
CONFIG_MMU_GATHER_MERGE_VMAS=y
CONFIG_MMU_LAZY_TLB_REFCOUNT=y
CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
CONFIG_ARCH_HAS_NMI_SAFE_THIS_CPU_OPS=y
CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y
CONFIG_HAVE_CMPXCHG_LOCAL=y
CONFIG_HAVE_CMPXCHG_DOUBLE=y
CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y
CONFIG_HAVE_ARCH_SECCOMP=y
CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
CONFIG_SECCOMP=y
CONFIG_SECCOMP_FILTER=y
# CONFIG_SECCOMP_CACHE_DEBUG is not set
CONFIG_HAVE_ARCH_STACKLEAK=y
CONFIG_HAVE_STACKPROTECTOR=y
CONFIG_STACKPROTECTOR=y
CONFIG_STACKPROTECTOR_STRONG=y
CONFIG_ARCH_SUPPORTS_LTO_CLANG=y
CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN=y
CONFIG_LTO_NONE=y
CONFIG_ARCH_SUPPORTS_CFI_CLANG=y
CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y
CONFIG_HAVE_CONTEXT_TRACKING_USER=y
CONFIG_HAVE_CONTEXT_TRACKING_USER_OFFSTACK=y
CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
CONFIG_HAVE_MOVE_PUD=y
CONFIG_HAVE_MOVE_PMD=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=y
CONFIG_HAVE_ARCH_HUGE_VMAP=y
CONFIG_HAVE_ARCH_HUGE_VMALLOC=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_PMD_MKWRITE=y
CONFIG_HAVE_ARCH_SOFT_DIRTY=y
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
CONFIG_MODULES_USE_ELF_RELA=y
CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK=y
CONFIG_SOFTIRQ_ON_OWN_STACK=y
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
CONFIG_HAVE_ARCH_MMAP_RND_BITS=y
CONFIG_HAVE_EXIT_THREAD=y
CONFIG_ARCH_MMAP_RND_BITS=28
CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y
CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8
CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES=y
CONFIG_HAVE_PAGE_SIZE_4KB=y
CONFIG_PAGE_SIZE_4KB=y
CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
CONFIG_PAGE_SHIFT=12
CONFIG_HAVE_OBJTOOL=y
CONFIG_HAVE_JUMP_LABEL_HACK=y
CONFIG_HAVE_NOINSTR_HACK=y
CONFIG_HAVE_NOINSTR_VALIDATION=y
CONFIG_HAVE_UACCESS_VALIDATION=y
CONFIG_HAVE_STACK_VALIDATION=y
CONFIG_HAVE_RELIABLE_STACKTRACE=y
CONFIG_OLD_SIGSUSPEND3=y
CONFIG_COMPAT_OLD_SIGACTION=y
CONFIG_COMPAT_32BIT_TIME=y
CONFIG_HAVE_ARCH_VMAP_STACK=y
CONFIG_VMAP_STACK=y
CONFIG_HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET=y
CONFIG_RANDOMIZE_KSTACK_OFFSET=y
# CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT is not set
CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y
CONFIG_STRICT_KERNEL_RWX=y
CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y
CONFIG_STRICT_MODULE_RWX=y
CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y
# CONFIG_LOCK_EVENT_COUNTS is not set
CONFIG_ARCH_HAS_MEM_ENCRYPT=y
CONFIG_HAVE_STATIC_CALL=y
CONFIG_HAVE_STATIC_CALL_INLINE=y
CONFIG_HAVE_PREEMPT_DYNAMIC=y
CONFIG_HAVE_PREEMPT_DYNAMIC_CALL=y
CONFIG_ARCH_WANT_LD_ORPHAN_WARN=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y
CONFIG_ARCH_HAS_ELFCORE_COMPAT=y
CONFIG_ARCH_HAS_PARANOID_L1D_FLUSH=y
CONFIG_DYNAMIC_SIGFRAME=y
CONFIG_HAVE_ARCH_NODE_DEV_GROUP=y
CONFIG_ARCH_HAS_HW_PTE_YOUNG=y
CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG=y

#
# GCOV-based kernel profiling
#
# CONFIG_GCOV_KERNEL is not set
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
# end of GCOV-based kernel profiling

CONFIG_HAVE_GCC_PLUGINS=y
CONFIG_FUNCTION_ALIGNMENT_4B=y
CONFIG_FUNCTION_ALIGNMENT_16B=y
CONFIG_FUNCTION_ALIGNMENT=16
# end of General architecture-dependent options

CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULE_SIG_FORMAT=y
CONFIG_MODULES=y
# CONFIG_MODULE_DEBUG is not set
# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
# CONFIG_MODULE_UNLOAD_TAINT_TRACKING is not set
CONFIG_MODVERSIONS=y
CONFIG_ASM_MODVERSIONS=y
CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_MODULE_SIG=y
# CONFIG_MODULE_SIG_FORCE is not set
# CONFIG_MODULE_SIG_ALL is not set
CONFIG_MODULE_SIG_SHA1=y
# CONFIG_MODULE_SIG_SHA256 is not set
# CONFIG_MODULE_SIG_SHA384 is not set
# CONFIG_MODULE_SIG_SHA512 is not set
# CONFIG_MODULE_SIG_SHA3_256 is not set
# CONFIG_MODULE_SIG_SHA3_384 is not set
# CONFIG_MODULE_SIG_SHA3_512 is not set
CONFIG_MODULE_SIG_HASH="sha1"
CONFIG_MODULE_COMPRESS_NONE=y
# CONFIG_MODULE_COMPRESS_GZIP is not set
# CONFIG_MODULE_COMPRESS_XZ is not set
# CONFIG_MODULE_COMPRESS_ZSTD is not set
# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set
CONFIG_MODPROBE_PATH="/sbin/modprobe"
# CONFIG_TRIM_UNUSED_KSYMS is not set
CONFIG_MODULES_TREE_LOOKUP=y
CONFIG_BLOCK=y
CONFIG_BLOCK_LEGACY_AUTOLOAD=y
CONFIG_BLK_RQ_ALLOC_TIME=y
CONFIG_BLK_CGROUP_RWSTAT=y
CONFIG_BLK_CGROUP_PUNT_BIO=y
CONFIG_BLK_DEV_BSG_COMMON=y
CONFIG_BLK_ICQ=y
CONFIG_BLK_DEV_BSGLIB=y
CONFIG_BLK_DEV_INTEGRITY=y
CONFIG_BLK_DEV_INTEGRITY_T10=y
# CONFIG_BLK_DEV_WRITE_MOUNTED is not set
CONFIG_BLK_DEV_ZONED=y
CONFIG_BLK_DEV_THROTTLING=y
CONFIG_BLK_WBT=y
CONFIG_BLK_WBT_MQ=y
CONFIG_BLK_CGROUP_IOLATENCY=y
# CONFIG_BLK_CGROUP_FC_APPID is not set
CONFIG_BLK_CGROUP_IOCOST=y
CONFIG_BLK_CGROUP_IOPRIO=y
CONFIG_BLK_DEBUG_FS=y
# CONFIG_BLK_SED_OPAL is not set
CONFIG_BLK_INLINE_ENCRYPTION=y
CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y

#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
CONFIG_ACORN_PARTITION=y
CONFIG_ACORN_PARTITION_CUMANA=y
CONFIG_ACORN_PARTITION_EESOX=y
CONFIG_ACORN_PARTITION_ICS=y
CONFIG_ACORN_PARTITION_ADFS=y
CONFIG_ACORN_PARTITION_POWERTEC=y
CONFIG_ACORN_PARTITION_RISCIX=y
CONFIG_AIX_PARTITION=y
CONFIG_OSF_PARTITION=y
CONFIG_AMIGA_PARTITION=y
CONFIG_ATARI_PARTITION=y
CONFIG_MAC_PARTITION=y
CONFIG_MSDOS_PARTITION=y
CONFIG_BSD_DISKLABEL=y
CONFIG_MINIX_SUBPARTITION=y
CONFIG_SOLARIS_X86_PARTITION=y
CONFIG_UNIXWARE_DISKLABEL=y
CONFIG_LDM_PARTITION=y
# CONFIG_LDM_DEBUG is not set
CONFIG_SGI_PARTITION=y
CONFIG_ULTRIX_PARTITION=y
CONFIG_SUN_PARTITION=y
CONFIG_KARMA_PARTITION=y
CONFIG_EFI_PARTITION=y
CONFIG_SYSV68_PARTITION=y
CONFIG_CMDLINE_PARTITION=y
# end of Partition Types

CONFIG_BLK_MQ_PCI=y
CONFIG_BLK_MQ_VIRTIO=y
CONFIG_BLK_PM=y
CONFIG_BLOCK_HOLDER_DEPRECATED=y
CONFIG_BLK_MQ_STACKING=y

#
# IO Schedulers
#
CONFIG_MQ_IOSCHED_DEADLINE=y
CONFIG_MQ_IOSCHED_KYBER=y
CONFIG_IOSCHED_BFQ=y
CONFIG_BFQ_GROUP_IOSCHED=y
CONFIG_BFQ_CGROUP_DEBUG=y
# end of IO Schedulers

CONFIG_PREEMPT_NOTIFIERS=y
CONFIG_PADATA=y
CONFIG_ASN1=y
CONFIG_UNINLINE_SPIN_UNLOCK=y
CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_RWSEM_SPIN_ON_OWNER=y
CONFIG_LOCK_SPIN_ON_OWNER=y
CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
CONFIG_QUEUED_SPINLOCKS=y
CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
CONFIG_QUEUED_RWLOCKS=y
CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE=y
CONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE=y
CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
CONFIG_FREEZER=y

#
# Executable file formats
#
CONFIG_BINFMT_ELF=y
CONFIG_COMPAT_BINFMT_ELF=y
CONFIG_ELFCORE=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
CONFIG_BINFMT_SCRIPT=y
CONFIG_BINFMT_MISC=y
CONFIG_COREDUMP=y
# end of Executable file formats

#
# Memory Management options
#
CONFIG_ZPOOL=y
CONFIG_SWAP=y
CONFIG_ZSWAP=y
CONFIG_ZSWAP_DEFAULT_ON=y
CONFIG_ZSWAP_SHRINKER_DEFAULT_ON=y
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_DEFLATE is not set
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZO=y
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_842 is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4 is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4HC is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD is not set
CONFIG_ZSWAP_COMPRESSOR_DEFAULT="lzo"
# CONFIG_ZSWAP_ZPOOL_DEFAULT_ZBUD is not set
# CONFIG_ZSWAP_ZPOOL_DEFAULT_Z3FOLD is not set
CONFIG_ZSWAP_ZPOOL_DEFAULT_ZSMALLOC=y
CONFIG_ZSWAP_ZPOOL_DEFAULT="zsmalloc"
# CONFIG_ZBUD is not set
# CONFIG_Z3FOLD is not set
CONFIG_ZSMALLOC=y
# CONFIG_ZSMALLOC_STAT is not set
CONFIG_ZSMALLOC_CHAIN_SIZE=8

#
# Slab allocator options
#
CONFIG_SLUB=y
# CONFIG_SLUB_TINY is not set
CONFIG_SLAB_MERGE_DEFAULT=y
# CONFIG_SLAB_FREELIST_RANDOM is not set
# CONFIG_SLAB_FREELIST_HARDENED is not set
# CONFIG_SLUB_STATS is not set
CONFIG_SLUB_CPU_PARTIAL=y
# CONFIG_RANDOM_KMALLOC_CACHES is not set
# end of Slab allocator options

# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set
# CONFIG_COMPAT_BRK is not set
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_SPARSEMEM_VMEMMAP=y
CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP=y
CONFIG_ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP=y
CONFIG_HAVE_FAST_GUP=y
CONFIG_NUMA_KEEP_MEMINFO=y
CONFIG_MEMORY_ISOLATION=y
CONFIG_EXCLUSIVE_SYSTEM_RAM=y
CONFIG_HAVE_BOOTMEM_INFO_NODE=y
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
CONFIG_MEMORY_HOTPLUG=y
CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=y
CONFIG_MEMORY_HOTREMOVE=y
CONFIG_MHP_MEMMAP_ON_MEMORY=y
CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y
CONFIG_MEMORY_BALLOON=y
# CONFIG_BALLOON_COMPACTION is not set
CONFIG_COMPACTION=y
CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1
CONFIG_PAGE_REPORTING=y
CONFIG_MIGRATION=y
CONFIG_DEVICE_MIGRATION=y
CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION=y
CONFIG_ARCH_ENABLE_THP_MIGRATION=y
CONFIG_CONTIG_ALLOC=y
CONFIG_PCP_BATCH_SCALE_MAX=5
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_MMU_NOTIFIER=y
CONFIG_KSM=y
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y
# CONFIG_MEMORY_FAILURE is not set
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ARCH_WANTS_THP_SWAP=y
CONFIG_TRANSPARENT_HUGEPAGE=y
# CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not set
CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y
# CONFIG_TRANSPARENT_HUGEPAGE_NEVER is not set
CONFIG_THP_SWAP=y
CONFIG_READ_ONLY_THP_FOR_FS=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_USE_PERCPU_NUMA_NODE_ID=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_CMA=y
# CONFIG_CMA_DEBUGFS is not set
# CONFIG_CMA_SYSFS is not set
CONFIG_CMA_AREAS=20
CONFIG_MEM_SOFT_DIRTY=y
CONFIG_GENERIC_EARLY_IOREMAP=y
# CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set
CONFIG_PAGE_IDLE_FLAG=y
# CONFIG_IDLE_PAGE_TRACKING is not set
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_ARCH_HAS_CURRENT_STACK_POINTER=y
CONFIG_ARCH_HAS_PTE_DEVMAP=y
CONFIG_ARCH_HAS_ZONE_DMA_SET=y
CONFIG_ZONE_DMA=y
CONFIG_ZONE_DMA32=y
CONFIG_ZONE_DEVICE=y
CONFIG_HMM_MIRROR=y
CONFIG_GET_FREE_REGION=y
CONFIG_DEVICE_PRIVATE=y
CONFIG_VMAP_PFN=y
CONFIG_ARCH_USES_HIGH_VMA_FLAGS=y
CONFIG_ARCH_HAS_PKEYS=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_PERCPU_STATS=y
# CONFIG_GUP_TEST is not set
# CONFIG_DMAPOOL_TEST is not set
CONFIG_ARCH_HAS_PTE_SPECIAL=y
CONFIG_MAPPING_DIRTY_HELPERS=y
CONFIG_KMAP_LOCAL=y
CONFIG_MEMFD_CREATE=y
CONFIG_SECRETMEM=y
CONFIG_ANON_VMA_NAME=y
CONFIG_HAVE_ARCH_USERFAULTFD_WP=y
CONFIG_HAVE_ARCH_USERFAULTFD_MINOR=y
CONFIG_USERFAULTFD=y
# CONFIG_PTE_MARKER_UFFD_WP is not set
CONFIG_LRU_GEN=y
CONFIG_LRU_GEN_ENABLED=y
# CONFIG_LRU_GEN_STATS is not set
CONFIG_LRU_GEN_WALKS_MMU=y
CONFIG_ARCH_SUPPORTS_PER_VMA_LOCK=y
CONFIG_PER_VMA_LOCK=y
CONFIG_LOCK_MM_AND_FIND_VMA=y
CONFIG_IOMMU_MM_DATA=y

#
# Data Access Monitoring
#
CONFIG_DAMON=y
CONFIG_DAMON_VADDR=y
CONFIG_DAMON_PADDR=y
# CONFIG_DAMON_SYSFS is not set
# CONFIG_DAMON_DBGFS_DEPRECATED is not set
CONFIG_DAMON_RECLAIM=y
# CONFIG_DAMON_LRU_SORT is not set
# end of Data Access Monitoring
# end of Memory Management options

CONFIG_NET=y
CONFIG_WANT_COMPAT_NETLINK_MESSAGES=y
CONFIG_COMPAT_NETLINK_MESSAGES=y
CONFIG_NET_INGRESS=y
CONFIG_NET_EGRESS=y
CONFIG_NET_XGRESS=y
CONFIG_NET_REDIRECT=y
CONFIG_SKB_EXTENSIONS=y

#
# Networking options
#
CONFIG_PACKET=y
CONFIG_PACKET_DIAG=y
CONFIG_UNIX=y
CONFIG_AF_UNIX_OOB=y
CONFIG_UNIX_DIAG=y
CONFIG_TLS=y
CONFIG_TLS_DEVICE=y
CONFIG_TLS_TOE=y
CONFIG_XFRM=y
CONFIG_XFRM_OFFLOAD=y
CONFIG_XFRM_ALGO=y
CONFIG_XFRM_USER=y
CONFIG_XFRM_USER_COMPAT=y
CONFIG_XFRM_INTERFACE=y
CONFIG_XFRM_SUB_POLICY=y
CONFIG_XFRM_MIGRATE=y
CONFIG_XFRM_STATISTICS=y
CONFIG_XFRM_AH=y
CONFIG_XFRM_ESP=y
CONFIG_XFRM_IPCOMP=y
CONFIG_NET_KEY=y
CONFIG_NET_KEY_MIGRATE=y
CONFIG_XFRM_ESPINTCP=y
CONFIG_SMC=y
CONFIG_SMC_DIAG=y
CONFIG_XDP_SOCKETS=y
CONFIG_XDP_SOCKETS_DIAG=y
CONFIG_NET_HANDSHAKE=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_FIB_TRIE_STATS=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_IP_ROUTE_CLASSID=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_NET_IPIP=y
CONFIG_NET_IPGRE_DEMUX=y
CONFIG_NET_IP_TUNNEL=y
CONFIG_NET_IPGRE=y
CONFIG_NET_IPGRE_BROADCAST=y
CONFIG_IP_MROUTE_COMMON=y
CONFIG_IP_MROUTE=y
CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_SYN_COOKIES=y
CONFIG_NET_IPVTI=y
CONFIG_NET_UDP_TUNNEL=y
CONFIG_NET_FOU=y
CONFIG_NET_FOU_IP_TUNNELS=y
CONFIG_INET_AH=y
CONFIG_INET_ESP=y
CONFIG_INET_ESP_OFFLOAD=y
CONFIG_INET_ESPINTCP=y
CONFIG_INET_IPCOMP=y
CONFIG_INET_TABLE_PERTURB_ORDER=16
CONFIG_INET_XFRM_TUNNEL=y
CONFIG_INET_TUNNEL=y
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
CONFIG_INET_UDP_DIAG=y
CONFIG_INET_RAW_DIAG=y
CONFIG_INET_DIAG_DESTROY=y
CONFIG_TCP_CONG_ADVANCED=y
CONFIG_TCP_CONG_BIC=y
CONFIG_TCP_CONG_CUBIC=y
CONFIG_TCP_CONG_WESTWOOD=y
CONFIG_TCP_CONG_HTCP=y
CONFIG_TCP_CONG_HSTCP=y
CONFIG_TCP_CONG_HYBLA=y
CONFIG_TCP_CONG_VEGAS=y
CONFIG_TCP_CONG_NV=y
CONFIG_TCP_CONG_SCALABLE=y
CONFIG_TCP_CONG_LP=y
CONFIG_TCP_CONG_VENO=y
CONFIG_TCP_CONG_YEAH=y
CONFIG_TCP_CONG_ILLINOIS=y
CONFIG_TCP_CONG_DCTCP=y
CONFIG_TCP_CONG_CDG=y
CONFIG_TCP_CONG_BBR=y
# CONFIG_DEFAULT_BIC is not set
CONFIG_DEFAULT_CUBIC=y
# CONFIG_DEFAULT_HTCP is not set
# CONFIG_DEFAULT_HYBLA is not set
# CONFIG_DEFAULT_VEGAS is not set
# CONFIG_DEFAULT_VENO is not set
# CONFIG_DEFAULT_WESTWOOD is not set
# CONFIG_DEFAULT_DCTCP is not set
# CONFIG_DEFAULT_CDG is not set
# CONFIG_DEFAULT_BBR is not set
# CONFIG_DEFAULT_RENO is not set
CONFIG_DEFAULT_TCP_CONG="cubic"
CONFIG_TCP_SIGPOOL=y
# CONFIG_TCP_AO is not set
CONFIG_TCP_MD5SIG=y
CONFIG_IPV6=y
CONFIG_IPV6_ROUTER_PREF=y
CONFIG_IPV6_ROUTE_INFO=y
CONFIG_IPV6_OPTIMISTIC_DAD=y
CONFIG_INET6_AH=y
CONFIG_INET6_ESP=y
CONFIG_INET6_ESP_OFFLOAD=y
CONFIG_INET6_ESPINTCP=y
CONFIG_INET6_IPCOMP=y
CONFIG_IPV6_MIP6=y
CONFIG_IPV6_ILA=y
CONFIG_INET6_XFRM_TUNNEL=y
CONFIG_INET6_TUNNEL=y
CONFIG_IPV6_VTI=y
CONFIG_IPV6_SIT=y
CONFIG_IPV6_SIT_6RD=y
CONFIG_IPV6_NDISC_NODETYPE=y
CONFIG_IPV6_TUNNEL=y
CONFIG_IPV6_GRE=y
CONFIG_IPV6_FOU=y
CONFIG_IPV6_FOU_TUNNEL=y
CONFIG_IPV6_MULTIPLE_TABLES=y
CONFIG_IPV6_SUBTREES=y
CONFIG_IPV6_MROUTE=y
CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y
CONFIG_IPV6_PIMSM_V2=y
CONFIG_IPV6_SEG6_LWTUNNEL=y
CONFIG_IPV6_SEG6_HMAC=y
CONFIG_IPV6_SEG6_BPF=y
CONFIG_IPV6_RPL_LWTUNNEL=y
# CONFIG_IPV6_IOAM6_LWTUNNEL is not set
CONFIG_NETLABEL=y
CONFIG_MPTCP=y
CONFIG_INET_MPTCP_DIAG=y
CONFIG_MPTCP_IPV6=y
CONFIG_NETWORK_SECMARK=y
CONFIG_NET_PTP_CLASSIFY=y
# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
CONFIG_NETFILTER=y
CONFIG_NETFILTER_ADVANCED=y
CONFIG_BRIDGE_NETFILTER=y

#
# Core Netfilter Configuration
#
CONFIG_NETFILTER_INGRESS=y
CONFIG_NETFILTER_EGRESS=y
CONFIG_NETFILTER_SKIP_EGRESS=y
CONFIG_NETFILTER_NETLINK=y
CONFIG_NETFILTER_FAMILY_BRIDGE=y
CONFIG_NETFILTER_FAMILY_ARP=y
CONFIG_NETFILTER_BPF_LINK=y
# CONFIG_NETFILTER_NETLINK_HOOK is not set
CONFIG_NETFILTER_NETLINK_ACCT=y
CONFIG_NETFILTER_NETLINK_QUEUE=y
CONFIG_NETFILTER_NETLINK_LOG=y
CONFIG_NETFILTER_NETLINK_OSF=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_LOG_SYSLOG=y
CONFIG_NETFILTER_CONNCOUNT=y
CONFIG_NF_CONNTRACK_MARK=y
CONFIG_NF_CONNTRACK_SECMARK=y
CONFIG_NF_CONNTRACK_ZONES=y
# CONFIG_NF_CONNTRACK_PROCFS is not set
CONFIG_NF_CONNTRACK_EVENTS=y
CONFIG_NF_CONNTRACK_TIMEOUT=y
CONFIG_NF_CONNTRACK_TIMESTAMP=y
CONFIG_NF_CONNTRACK_LABELS=y
CONFIG_NF_CONNTRACK_OVS=y
CONFIG_NF_CT_PROTO_DCCP=y
CONFIG_NF_CT_PROTO_GRE=y
CONFIG_NF_CT_PROTO_SCTP=y
CONFIG_NF_CT_PROTO_UDPLITE=y
CONFIG_NF_CONNTRACK_AMANDA=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NF_CONNTRACK_H323=y
CONFIG_NF_CONNTRACK_IRC=y
CONFIG_NF_CONNTRACK_BROADCAST=y
CONFIG_NF_CONNTRACK_NETBIOS_NS=y
CONFIG_NF_CONNTRACK_SNMP=y
CONFIG_NF_CONNTRACK_PPTP=y
CONFIG_NF_CONNTRACK_SANE=y
CONFIG_NF_CONNTRACK_SIP=y
CONFIG_NF_CONNTRACK_TFTP=y
CONFIG_NF_CT_NETLINK=y
CONFIG_NF_CT_NETLINK_TIMEOUT=y
CONFIG_NF_CT_NETLINK_HELPER=y
CONFIG_NETFILTER_NETLINK_GLUE_CT=y
CONFIG_NF_NAT=y
CONFIG_NF_NAT_AMANDA=y
CONFIG_NF_NAT_FTP=y
CONFIG_NF_NAT_IRC=y
CONFIG_NF_NAT_SIP=y
CONFIG_NF_NAT_TFTP=y
CONFIG_NF_NAT_REDIRECT=y
CONFIG_NF_NAT_MASQUERADE=y
CONFIG_NF_NAT_OVS=y
CONFIG_NETFILTER_SYNPROXY=y
CONFIG_NF_TABLES=y
CONFIG_NF_TABLES_INET=y
CONFIG_NF_TABLES_NETDEV=y
CONFIG_NFT_NUMGEN=y
CONFIG_NFT_CT=y
CONFIG_NFT_FLOW_OFFLOAD=y
CONFIG_NFT_CONNLIMIT=y
CONFIG_NFT_LOG=y
CONFIG_NFT_LIMIT=y
CONFIG_NFT_MASQ=y
CONFIG_NFT_REDIR=y
CONFIG_NFT_NAT=y
CONFIG_NFT_TUNNEL=y
CONFIG_NFT_QUEUE=y
CONFIG_NFT_QUOTA=y
CONFIG_NFT_REJECT=y
CONFIG_NFT_REJECT_INET=y
CONFIG_NFT_COMPAT=y
CONFIG_NFT_HASH=y
CONFIG_NFT_FIB=y
CONFIG_NFT_FIB_INET=y
CONFIG_NFT_XFRM=y
CONFIG_NFT_SOCKET=y
CONFIG_NFT_OSF=y
CONFIG_NFT_TPROXY=y
CONFIG_NFT_SYNPROXY=y
CONFIG_NF_DUP_NETDEV=y
CONFIG_NFT_DUP_NETDEV=y
CONFIG_NFT_FWD_NETDEV=y
CONFIG_NFT_FIB_NETDEV=y
CONFIG_NFT_REJECT_NETDEV=y
CONFIG_NF_FLOW_TABLE_INET=y
CONFIG_NF_FLOW_TABLE=y
# CONFIG_NF_FLOW_TABLE_PROCFS is not set
CONFIG_NETFILTER_XTABLES=y
CONFIG_NETFILTER_XTABLES_COMPAT=y

#
# Xtables combined modules
#
CONFIG_NETFILTER_XT_MARK=y
CONFIG_NETFILTER_XT_CONNMARK=y
CONFIG_NETFILTER_XT_SET=y

#
# Xtables targets
#
CONFIG_NETFILTER_XT_TARGET_AUDIT=y
CONFIG_NETFILTER_XT_TARGET_CHECKSUM=y
CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
CONFIG_NETFILTER_XT_TARGET_CONNMARK=y
CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
CONFIG_NETFILTER_XT_TARGET_CT=y
CONFIG_NETFILTER_XT_TARGET_DSCP=y
CONFIG_NETFILTER_XT_TARGET_HL=y
CONFIG_NETFILTER_XT_TARGET_HMARK=y
CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y
CONFIG_NETFILTER_XT_TARGET_LED=y
CONFIG_NETFILTER_XT_TARGET_LOG=y
CONFIG_NETFILTER_XT_TARGET_MARK=y
CONFIG_NETFILTER_XT_NAT=y
CONFIG_NETFILTER_XT_TARGET_NETMAP=y
CONFIG_NETFILTER_XT_TARGET_NFLOG=y
CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y
CONFIG_NETFILTER_XT_TARGET_NOTRACK=y
CONFIG_NETFILTER_XT_TARGET_RATEEST=y
CONFIG_NETFILTER_XT_TARGET_REDIRECT=y
CONFIG_NETFILTER_XT_TARGET_MASQUERADE=y
CONFIG_NETFILTER_XT_TARGET_TEE=y
CONFIG_NETFILTER_XT_TARGET_TPROXY=y
CONFIG_NETFILTER_XT_TARGET_TRACE=y
CONFIG_NETFILTER_XT_TARGET_SECMARK=y
CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=y

#
# Xtables matches
#
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
CONFIG_NETFILTER_XT_MATCH_BPF=y
CONFIG_NETFILTER_XT_MATCH_CGROUP=y
CONFIG_NETFILTER_XT_MATCH_CLUSTER=y
CONFIG_NETFILTER_XT_MATCH_COMMENT=y
CONFIG_NETFILTER_XT_MATCH_CONNBYTES=y
CONFIG_NETFILTER_XT_MATCH_CONNLABEL=y
CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y
CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
CONFIG_NETFILTER_XT_MATCH_CPU=y
CONFIG_NETFILTER_XT_MATCH_DCCP=y
CONFIG_NETFILTER_XT_MATCH_DEVGROUP=y
CONFIG_NETFILTER_XT_MATCH_DSCP=y
CONFIG_NETFILTER_XT_MATCH_ECN=y
CONFIG_NETFILTER_XT_MATCH_ESP=y
CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y
CONFIG_NETFILTER_XT_MATCH_HELPER=y
CONFIG_NETFILTER_XT_MATCH_HL=y
CONFIG_NETFILTER_XT_MATCH_IPCOMP=y
CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
CONFIG_NETFILTER_XT_MATCH_IPVS=y
CONFIG_NETFILTER_XT_MATCH_L2TP=y
CONFIG_NETFILTER_XT_MATCH_LENGTH=y
CONFIG_NETFILTER_XT_MATCH_LIMIT=y
CONFIG_NETFILTER_XT_MATCH_MAC=y
CONFIG_NETFILTER_XT_MATCH_MARK=y
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
CONFIG_NETFILTER_XT_MATCH_NFACCT=y
CONFIG_NETFILTER_XT_MATCH_OSF=y
CONFIG_NETFILTER_XT_MATCH_OWNER=y
CONFIG_NETFILTER_XT_MATCH_POLICY=y
CONFIG_NETFILTER_XT_MATCH_PHYSDEV=y
CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
CONFIG_NETFILTER_XT_MATCH_QUOTA=y
CONFIG_NETFILTER_XT_MATCH_RATEEST=y
CONFIG_NETFILTER_XT_MATCH_REALM=y
CONFIG_NETFILTER_XT_MATCH_RECENT=y
CONFIG_NETFILTER_XT_MATCH_SCTP=y
CONFIG_NETFILTER_XT_MATCH_SOCKET=y
CONFIG_NETFILTER_XT_MATCH_STATE=y
CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
CONFIG_NETFILTER_XT_MATCH_STRING=y
CONFIG_NETFILTER_XT_MATCH_TCPMSS=y
CONFIG_NETFILTER_XT_MATCH_TIME=y
CONFIG_NETFILTER_XT_MATCH_U32=y
# end of Core Netfilter Configuration

CONFIG_IP_SET=y
CONFIG_IP_SET_MAX=256
CONFIG_IP_SET_BITMAP_IP=y
CONFIG_IP_SET_BITMAP_IPMAC=y
CONFIG_IP_SET_BITMAP_PORT=y
CONFIG_IP_SET_HASH_IP=y
CONFIG_IP_SET_HASH_IPMARK=y
CONFIG_IP_SET_HASH_IPPORT=y
CONFIG_IP_SET_HASH_IPPORTIP=y
CONFIG_IP_SET_HASH_IPPORTNET=y
CONFIG_IP_SET_HASH_IPMAC=y
CONFIG_IP_SET_HASH_MAC=y
CONFIG_IP_SET_HASH_NETPORTNET=y
CONFIG_IP_SET_HASH_NET=y
CONFIG_IP_SET_HASH_NETNET=y
CONFIG_IP_SET_HASH_NETPORT=y
CONFIG_IP_SET_HASH_NETIFACE=y
CONFIG_IP_SET_LIST_SET=y
CONFIG_IP_VS=y
CONFIG_IP_VS_IPV6=y
# CONFIG_IP_VS_DEBUG is not set
CONFIG_IP_VS_TAB_BITS=12

#
# IPVS transport protocol load balancing support
#
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_PROTO_AH_ESP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y
CONFIG_IP_VS_PROTO_SCTP=y

#
# IPVS scheduler
#
CONFIG_IP_VS_RR=y
CONFIG_IP_VS_WRR=y
CONFIG_IP_VS_LC=y
CONFIG_IP_VS_WLC=y
CONFIG_IP_VS_FO=y
CONFIG_IP_VS_OVF=y
CONFIG_IP_VS_LBLC=y
CONFIG_IP_VS_LBLCR=y
CONFIG_IP_VS_DH=y
CONFIG_IP_VS_SH=y
CONFIG_IP_VS_MH=y
CONFIG_IP_VS_SED=y
CONFIG_IP_VS_NQ=y
CONFIG_IP_VS_TWOS=y

#
# IPVS SH scheduler
#
CONFIG_IP_VS_SH_TAB_BITS=8

#
# IPVS MH scheduler
#
CONFIG_IP_VS_MH_TAB_INDEX=12

#
# IPVS application helper
#
CONFIG_IP_VS_FTP=y
CONFIG_IP_VS_NFCT=y
CONFIG_IP_VS_PE_SIP=y

#
# IP: Netfilter Configuration
#
CONFIG_NF_DEFRAG_IPV4=y
CONFIG_IP_NF_IPTABLES_LEGACY=y
CONFIG_NF_SOCKET_IPV4=y
CONFIG_NF_TPROXY_IPV4=y
CONFIG_NF_TABLES_IPV4=y
CONFIG_NFT_REJECT_IPV4=y
CONFIG_NFT_DUP_IPV4=y
CONFIG_NFT_FIB_IPV4=y
CONFIG_NF_TABLES_ARP=y
CONFIG_NF_DUP_IPV4=y
CONFIG_NF_LOG_ARP=y
CONFIG_NF_LOG_IPV4=y
CONFIG_NF_REJECT_IPV4=y
CONFIG_NF_NAT_SNMP_BASIC=y
CONFIG_NF_NAT_PPTP=y
CONFIG_NF_NAT_H323=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_MATCH_AH=y
CONFIG_IP_NF_MATCH_ECN=y
CONFIG_IP_NF_MATCH_RPFILTER=y
CONFIG_IP_NF_MATCH_TTL=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_SYNPROXY=y
CONFIG_IP_NF_NAT=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IP_NF_TARGET_NETMAP=y
CONFIG_IP_NF_TARGET_REDIRECT=y
CONFIG_IP_NF_MANGLE=y
CONFIG_IP_NF_TARGET_ECN=y
CONFIG_IP_NF_TARGET_TTL=y
CONFIG_IP_NF_RAW=y
CONFIG_IP_NF_SECURITY=y
CONFIG_IP_NF_ARPTABLES=y
CONFIG_NFT_COMPAT_ARP=y
CONFIG_IP_NF_ARPFILTER=y
CONFIG_IP_NF_ARP_MANGLE=y
# end of IP: Netfilter Configuration

#
# IPv6: Netfilter Configuration
#
CONFIG_IP6_NF_IPTABLES_LEGACY=y
CONFIG_NF_SOCKET_IPV6=y
CONFIG_NF_TPROXY_IPV6=y
CONFIG_NF_TABLES_IPV6=y
CONFIG_NFT_REJECT_IPV6=y
CONFIG_NFT_DUP_IPV6=y
CONFIG_NFT_FIB_IPV6=y
CONFIG_NF_DUP_IPV6=y
CONFIG_NF_REJECT_IPV6=y
CONFIG_NF_LOG_IPV6=y
CONFIG_IP6_NF_IPTABLES=y
CONFIG_IP6_NF_MATCH_AH=y
CONFIG_IP6_NF_MATCH_EUI64=y
CONFIG_IP6_NF_MATCH_FRAG=y
CONFIG_IP6_NF_MATCH_OPTS=y
CONFIG_IP6_NF_MATCH_HL=y
CONFIG_IP6_NF_MATCH_IPV6HEADER=y
CONFIG_IP6_NF_MATCH_MH=y
CONFIG_IP6_NF_MATCH_RPFILTER=y
CONFIG_IP6_NF_MATCH_RT=y
CONFIG_IP6_NF_MATCH_SRH=y
CONFIG_IP6_NF_TARGET_HL=y
CONFIG_IP6_NF_FILTER=y
CONFIG_IP6_NF_TARGET_REJECT=y
CONFIG_IP6_NF_TARGET_SYNPROXY=y
CONFIG_IP6_NF_MANGLE=y
CONFIG_IP6_NF_RAW=y
CONFIG_IP6_NF_SECURITY=y
CONFIG_IP6_NF_NAT=y
CONFIG_IP6_NF_TARGET_MASQUERADE=y
CONFIG_IP6_NF_TARGET_NPT=y
# end of IPv6: Netfilter Configuration

CONFIG_NF_DEFRAG_IPV6=y
CONFIG_NF_TABLES_BRIDGE=y
CONFIG_NFT_BRIDGE_META=y
CONFIG_NFT_BRIDGE_REJECT=y
CONFIG_NF_CONNTRACK_BRIDGE=y
CONFIG_BRIDGE_NF_EBTABLES_LEGACY=y
CONFIG_BRIDGE_NF_EBTABLES=y
CONFIG_BRIDGE_EBT_BROUTE=y
CONFIG_BRIDGE_EBT_T_FILTER=y
CONFIG_BRIDGE_EBT_T_NAT=y
CONFIG_BRIDGE_EBT_802_3=y
CONFIG_BRIDGE_EBT_AMONG=y
CONFIG_BRIDGE_EBT_ARP=y
CONFIG_BRIDGE_EBT_IP=y
CONFIG_BRIDGE_EBT_IP6=y
CONFIG_BRIDGE_EBT_LIMIT=y
CONFIG_BRIDGE_EBT_MARK=y
CONFIG_BRIDGE_EBT_PKTTYPE=y
CONFIG_BRIDGE_EBT_STP=y
CONFIG_BRIDGE_EBT_VLAN=y
CONFIG_BRIDGE_EBT_ARPREPLY=y
CONFIG_BRIDGE_EBT_DNAT=y
CONFIG_BRIDGE_EBT_MARK_T=y
CONFIG_BRIDGE_EBT_REDIRECT=y
CONFIG_BRIDGE_EBT_SNAT=y
CONFIG_BRIDGE_EBT_LOG=y
CONFIG_BRIDGE_EBT_NFLOG=y
CONFIG_IP_DCCP=y
CONFIG_INET_DCCP_DIAG=y

#
# DCCP CCIDs Configuration
#
# CONFIG_IP_DCCP_CCID2_DEBUG is not set
CONFIG_IP_DCCP_CCID3=y
# CONFIG_IP_DCCP_CCID3_DEBUG is not set
CONFIG_IP_DCCP_TFRC_LIB=y
# end of DCCP CCIDs Configuration

#
# DCCP Kernel Hacking
#
# CONFIG_IP_DCCP_DEBUG is not set
# end of DCCP Kernel Hacking

CONFIG_IP_SCTP=y
# CONFIG_SCTP_DBG_OBJCNT is not set
CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5=y
# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1 is not set
# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_NONE is not set
CONFIG_SCTP_COOKIE_HMAC_MD5=y
CONFIG_SCTP_COOKIE_HMAC_SHA1=y
CONFIG_INET_SCTP_DIAG=y
CONFIG_RDS=y
CONFIG_RDS_RDMA=y
CONFIG_RDS_TCP=y
# CONFIG_RDS_DEBUG is not set
CONFIG_TIPC=y
CONFIG_TIPC_MEDIA_IB=y
CONFIG_TIPC_MEDIA_UDP=y
CONFIG_TIPC_CRYPTO=y
CONFIG_TIPC_DIAG=y
CONFIG_ATM=y
CONFIG_ATM_CLIP=y
# CONFIG_ATM_CLIP_NO_ICMP is not set
CONFIG_ATM_LANE=y
CONFIG_ATM_MPOA=y
CONFIG_ATM_BR2684=y
# CONFIG_ATM_BR2684_IPFILTER is not set
CONFIG_L2TP=y
# CONFIG_L2TP_DEBUGFS is not set
CONFIG_L2TP_V3=y
CONFIG_L2TP_IP=y
CONFIG_L2TP_ETH=y
CONFIG_STP=y
CONFIG_GARP=y
CONFIG_MRP=y
CONFIG_BRIDGE=y
CONFIG_BRIDGE_IGMP_SNOOPING=y
CONFIG_BRIDGE_VLAN_FILTERING=y
CONFIG_BRIDGE_MRP=y
CONFIG_BRIDGE_CFM=y
CONFIG_NET_DSA=y
# CONFIG_NET_DSA_TAG_NONE is not set
# CONFIG_NET_DSA_TAG_AR9331 is not set
CONFIG_NET_DSA_TAG_BRCM_COMMON=y
CONFIG_NET_DSA_TAG_BRCM=y
# CONFIG_NET_DSA_TAG_BRCM_LEGACY is not set
CONFIG_NET_DSA_TAG_BRCM_PREPEND=y
# CONFIG_NET_DSA_TAG_HELLCREEK is not set
# CONFIG_NET_DSA_TAG_GSWIP is not set
# CONFIG_NET_DSA_TAG_DSA is not set
# CONFIG_NET_DSA_TAG_EDSA is not set
CONFIG_NET_DSA_TAG_MTK=y
# CONFIG_NET_DSA_TAG_KSZ is not set
# CONFIG_NET_DSA_TAG_OCELOT is not set
# CONFIG_NET_DSA_TAG_OCELOT_8021Q is not set
CONFIG_NET_DSA_TAG_QCA=y
CONFIG_NET_DSA_TAG_RTL4_A=y
# CONFIG_NET_DSA_TAG_RTL8_4 is not set
# CONFIG_NET_DSA_TAG_RZN1_A5PSW is not set
# CONFIG_NET_DSA_TAG_LAN9303 is not set
# CONFIG_NET_DSA_TAG_SJA1105 is not set
# CONFIG_NET_DSA_TAG_TRAILER is not set
# CONFIG_NET_DSA_TAG_XRS700X is not set
CONFIG_VLAN_8021Q=y
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_VLAN_8021Q_MVRP=y
CONFIG_LLC=y
CONFIG_LLC2=y
# CONFIG_ATALK is not set
CONFIG_X25=y
CONFIG_LAPB=y
CONFIG_PHONET=y
CONFIG_6LOWPAN=y
# CONFIG_6LOWPAN_DEBUGFS is not set
CONFIG_6LOWPAN_NHC=y
CONFIG_6LOWPAN_NHC_DEST=y
CONFIG_6LOWPAN_NHC_FRAGMENT=y
CONFIG_6LOWPAN_NHC_HOP=y
CONFIG_6LOWPAN_NHC_IPV6=y
CONFIG_6LOWPAN_NHC_MOBILITY=y
CONFIG_6LOWPAN_NHC_ROUTING=y
CONFIG_6LOWPAN_NHC_UDP=y
CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=y
CONFIG_6LOWPAN_GHC_UDP=y
CONFIG_6LOWPAN_GHC_ICMPV6=y
CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=y
CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=y
CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=y
CONFIG_IEEE802154=y
CONFIG_IEEE802154_NL802154_EXPERIMENTAL=y
CONFIG_IEEE802154_SOCKET=y
CONFIG_IEEE802154_6LOWPAN=y
CONFIG_MAC802154=y
CONFIG_NET_SCHED=y

#
# Queueing/Scheduling
#
CONFIG_NET_SCH_HTB=y
CONFIG_NET_SCH_HFSC=y
CONFIG_NET_SCH_PRIO=y
CONFIG_NET_SCH_MULTIQ=y
CONFIG_NET_SCH_RED=y
CONFIG_NET_SCH_SFB=y
CONFIG_NET_SCH_SFQ=y
CONFIG_NET_SCH_TEQL=y
CONFIG_NET_SCH_TBF=y
CONFIG_NET_SCH_CBS=y
CONFIG_NET_SCH_ETF=y
CONFIG_NET_SCH_MQPRIO_LIB=y
CONFIG_NET_SCH_TAPRIO=y
CONFIG_NET_SCH_GRED=y
CONFIG_NET_SCH_NETEM=y
CONFIG_NET_SCH_DRR=y
CONFIG_NET_SCH_MQPRIO=y
CONFIG_NET_SCH_SKBPRIO=y
CONFIG_NET_SCH_CHOKE=y
CONFIG_NET_SCH_QFQ=y
CONFIG_NET_SCH_CODEL=y
CONFIG_NET_SCH_FQ_CODEL=y
CONFIG_NET_SCH_CAKE=y
CONFIG_NET_SCH_FQ=y
CONFIG_NET_SCH_HHF=y
CONFIG_NET_SCH_PIE=y
CONFIG_NET_SCH_FQ_PIE=y
CONFIG_NET_SCH_INGRESS=y
CONFIG_NET_SCH_PLUG=y
CONFIG_NET_SCH_ETS=y
CONFIG_NET_SCH_DEFAULT=y
# CONFIG_DEFAULT_FQ is not set
# CONFIG_DEFAULT_CODEL is not set
# CONFIG_DEFAULT_FQ_CODEL is not set
# CONFIG_DEFAULT_FQ_PIE is not set
# CONFIG_DEFAULT_SFQ is not set
CONFIG_DEFAULT_PFIFO_FAST=y
CONFIG_DEFAULT_NET_SCH="pfifo_fast"

#
# Classification
#
CONFIG_NET_CLS=y
CONFIG_NET_CLS_BASIC=y
CONFIG_NET_CLS_ROUTE4=y
CONFIG_NET_CLS_FW=y
CONFIG_NET_CLS_U32=y
CONFIG_CLS_U32_PERF=y
CONFIG_CLS_U32_MARK=y
CONFIG_NET_CLS_FLOW=y
CONFIG_NET_CLS_CGROUP=y
CONFIG_NET_CLS_BPF=y
CONFIG_NET_CLS_FLOWER=y
CONFIG_NET_CLS_MATCHALL=y
CONFIG_NET_EMATCH=y
CONFIG_NET_EMATCH_STACK=32
CONFIG_NET_EMATCH_CMP=y
CONFIG_NET_EMATCH_NBYTE=y
CONFIG_NET_EMATCH_U32=y
CONFIG_NET_EMATCH_META=y
CONFIG_NET_EMATCH_TEXT=y
CONFIG_NET_EMATCH_CANID=y
CONFIG_NET_EMATCH_IPSET=y
CONFIG_NET_EMATCH_IPT=y
CONFIG_NET_CLS_ACT=y
CONFIG_NET_ACT_POLICE=y
CONFIG_NET_ACT_GACT=y
CONFIG_GACT_PROB=y
CONFIG_NET_ACT_MIRRED=y
CONFIG_NET_ACT_SAMPLE=y
CONFIG_NET_ACT_NAT=y
CONFIG_NET_ACT_PEDIT=y
CONFIG_NET_ACT_SIMP=y
CONFIG_NET_ACT_SKBEDIT=y
CONFIG_NET_ACT_CSUM=y
CONFIG_NET_ACT_MPLS=y
CONFIG_NET_ACT_VLAN=y
CONFIG_NET_ACT_BPF=y
CONFIG_NET_ACT_CONNMARK=y
CONFIG_NET_ACT_CTINFO=y
CONFIG_NET_ACT_SKBMOD=y
CONFIG_NET_ACT_IFE=y
CONFIG_NET_ACT_TUNNEL_KEY=y
CONFIG_NET_ACT_CT=y
CONFIG_NET_ACT_GATE=y
CONFIG_NET_IFE_SKBMARK=y
CONFIG_NET_IFE_SKBPRIO=y
CONFIG_NET_IFE_SKBTCINDEX=y
CONFIG_NET_TC_SKB_EXT=y
CONFIG_NET_SCH_FIFO=y
CONFIG_DCB=y
CONFIG_DNS_RESOLVER=y
CONFIG_BATMAN_ADV=y
CONFIG_BATMAN_ADV_BATMAN_V=y
CONFIG_BATMAN_ADV_BLA=y
CONFIG_BATMAN_ADV_DAT=y
CONFIG_BATMAN_ADV_NC=y
CONFIG_BATMAN_ADV_MCAST=y
# CONFIG_BATMAN_ADV_DEBUG is not set
# CONFIG_BATMAN_ADV_TRACING is not set
CONFIG_OPENVSWITCH=y
CONFIG_OPENVSWITCH_GRE=y
CONFIG_OPENVSWITCH_VXLAN=y
CONFIG_OPENVSWITCH_GENEVE=y
CONFIG_VSOCKETS=y
CONFIG_VSOCKETS_DIAG=y
CONFIG_VSOCKETS_LOOPBACK=y
# CONFIG_VMWARE_VMCI_VSOCKETS is not set
CONFIG_VIRTIO_VSOCKETS=y
CONFIG_VIRTIO_VSOCKETS_COMMON=y
CONFIG_NETLINK_DIAG=y
CONFIG_MPLS=y
CONFIG_NET_MPLS_GSO=y
CONFIG_MPLS_ROUTING=y
CONFIG_MPLS_IPTUNNEL=y
CONFIG_NET_NSH=y
CONFIG_HSR=y
CONFIG_NET_SWITCHDEV=y
CONFIG_NET_L3_MASTER_DEV=y
CONFIG_QRTR=y
CONFIG_QRTR_TUN=y
# CONFIG_QRTR_MHI is not set
CONFIG_NET_NCSI=y
# CONFIG_NCSI_OEM_CMD_GET_MAC is not set
# CONFIG_NCSI_OEM_CMD_KEEP_PHY is not set
# CONFIG_PCPU_DEV_REFCNT is not set
CONFIG_MAX_SKB_FRAGS=17
CONFIG_RPS=y
CONFIG_RFS_ACCEL=y
CONFIG_SOCK_RX_QUEUE_MAPPING=y
CONFIG_XPS=y
CONFIG_CGROUP_NET_PRIO=y
CONFIG_CGROUP_NET_CLASSID=y
CONFIG_NET_RX_BUSY_POLL=y
CONFIG_BQL=y
CONFIG_BPF_STREAM_PARSER=y
CONFIG_NET_FLOW_LIMIT=y

#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
CONFIG_NET_DROP_MONITOR=y
# end of Network testing
# end of Networking options

CONFIG_HAMRADIO=y

#
# Packet Radio protocols
#
CONFIG_AX25=y
CONFIG_AX25_DAMA_SLAVE=y
CONFIG_NETROM=y
CONFIG_ROSE=y

#
# AX.25 network device drivers
#
CONFIG_MKISS=y
CONFIG_6PACK=y
CONFIG_BPQETHER=y
# CONFIG_BAYCOM_SER_FDX is not set
# CONFIG_BAYCOM_SER_HDX is not set
# CONFIG_BAYCOM_PAR is not set
# CONFIG_YAM is not set
# end of AX.25 network device drivers

CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y
CONFIG_CAN_GW=y
CONFIG_CAN_J1939=y
CONFIG_CAN_ISOTP=y
CONFIG_BT=y
CONFIG_BT_BREDR=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_CMTP=y
CONFIG_BT_HIDP=y
CONFIG_BT_LE=y
CONFIG_BT_LE_L2CAP_ECRED=y
CONFIG_BT_6LOWPAN=y
CONFIG_BT_LEDS=y
CONFIG_BT_MSFTEXT=y
# CONFIG_BT_AOSPEXT is not set
# CONFIG_BT_DEBUGFS is not set
# CONFIG_BT_SELFTEST is not set

#
# Bluetooth device drivers
#
CONFIG_BT_INTEL=y
CONFIG_BT_BCM=y
CONFIG_BT_RTL=y
CONFIG_BT_QCA=y
CONFIG_BT_MTK=y
CONFIG_BT_HCIBTUSB=y
# CONFIG_BT_HCIBTUSB_AUTOSUSPEND is not set
CONFIG_BT_HCIBTUSB_POLL_SYNC=y
CONFIG_BT_HCIBTUSB_BCM=y
CONFIG_BT_HCIBTUSB_MTK=y
CONFIG_BT_HCIBTUSB_RTL=y
# CONFIG_BT_HCIBTSDIO is not set
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_SERDEV=y
CONFIG_BT_HCIUART_H4=y
# CONFIG_BT_HCIUART_NOKIA is not set
CONFIG_BT_HCIUART_BCSP=y
# CONFIG_BT_HCIUART_ATH3K is not set
CONFIG_BT_HCIUART_LL=y
CONFIG_BT_HCIUART_3WIRE=y
# CONFIG_BT_HCIUART_INTEL is not set
# CONFIG_BT_HCIUART_BCM is not set
# CONFIG_BT_HCIUART_RTL is not set
CONFIG_BT_HCIUART_QCA=y
CONFIG_BT_HCIUART_AG6XX=y
CONFIG_BT_HCIUART_MRVL=y
CONFIG_BT_HCIBCM203X=y
# CONFIG_BT_HCIBCM4377 is not set
CONFIG_BT_HCIBPA10X=y
CONFIG_BT_HCIBFUSB=y
# CONFIG_BT_HCIDTL1 is not set
# CONFIG_BT_HCIBT3C is not set
# CONFIG_BT_HCIBLUECARD is not set
CONFIG_BT_HCIVHCI=y
CONFIG_BT_MRVL=y
CONFIG_BT_MRVL_SDIO=y
CONFIG_BT_ATH3K=y
# CONFIG_BT_MTKSDIO is not set
# CONFIG_BT_MTKUART is not set
# CONFIG_BT_VIRTIO is not set
# CONFIG_BT_NXPUART is not set
# end of Bluetooth device drivers

CONFIG_AF_RXRPC=y
CONFIG_AF_RXRPC_IPV6=y
# CONFIG_AF_RXRPC_INJECT_LOSS is not set
# CONFIG_AF_RXRPC_INJECT_RX_DELAY is not set
# CONFIG_AF_RXRPC_DEBUG is not set
CONFIG_RXKAD=y
# CONFIG_RXPERF is not set
CONFIG_AF_KCM=y
CONFIG_STREAM_PARSER=y
# CONFIG_MCTP is not set
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_EXT=y
CONFIG_WEXT_CORE=y
CONFIG_WEXT_PROC=y
CONFIG_WEXT_PRIV=y
CONFIG_CFG80211=y
# CONFIG_NL80211_TESTMODE is not set
# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
# CONFIG_CFG80211_CERTIFICATION_ONUS is not set
CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=y
CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS=y
CONFIG_CFG80211_DEFAULT_PS=y
CONFIG_CFG80211_DEBUGFS=y
CONFIG_CFG80211_CRDA_SUPPORT=y
CONFIG_CFG80211_WEXT=y
CONFIG_MAC80211=y
CONFIG_MAC80211_HAS_RC=y
CONFIG_MAC80211_RC_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT="minstrel_ht"
CONFIG_MAC80211_MESH=y
CONFIG_MAC80211_LEDS=y
CONFIG_MAC80211_DEBUGFS=y
# CONFIG_MAC80211_MESSAGE_TRACING is not set
# CONFIG_MAC80211_DEBUG_MENU is not set
CONFIG_MAC80211_STA_HASH_MAX_SIZE=0
CONFIG_RFKILL=y
CONFIG_RFKILL_LEDS=y
CONFIG_RFKILL_INPUT=y
# CONFIG_RFKILL_GPIO is not set
CONFIG_NET_9P=y
CONFIG_NET_9P_FD=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_NET_9P_RDMA=y
# CONFIG_NET_9P_DEBUG is not set
CONFIG_CAIF=y
CONFIG_CAIF_DEBUG=y
CONFIG_CAIF_NETDEV=y
CONFIG_CAIF_USB=y
CONFIG_CEPH_LIB=y
# CONFIG_CEPH_LIB_PRETTYDEBUG is not set
CONFIG_CEPH_LIB_USE_DNS_RESOLVER=y
CONFIG_NFC=y
CONFIG_NFC_DIGITAL=y
CONFIG_NFC_NCI=y
# CONFIG_NFC_NCI_SPI is not set
CONFIG_NFC_NCI_UART=y
CONFIG_NFC_HCI=y
CONFIG_NFC_SHDLC=y

#
# Near Field Communication (NFC) devices
#
# CONFIG_NFC_TRF7970A is not set
# CONFIG_NFC_MEI_PHY is not set
CONFIG_NFC_SIM=y
CONFIG_NFC_PORT100=y
CONFIG_NFC_VIRTUAL_NCI=y
CONFIG_NFC_FDP=y
# CONFIG_NFC_FDP_I2C is not set
# CONFIG_NFC_PN544_I2C is not set
CONFIG_NFC_PN533=y
CONFIG_NFC_PN533_USB=y
# CONFIG_NFC_PN533_I2C is not set
# CONFIG_NFC_PN532_UART is not set
# CONFIG_NFC_MICROREAD_I2C is not set
CONFIG_NFC_MRVL=y
CONFIG_NFC_MRVL_USB=y
# CONFIG_NFC_MRVL_UART is not set
# CONFIG_NFC_MRVL_I2C is not set
# CONFIG_NFC_ST21NFCA_I2C is not set
# CONFIG_NFC_ST_NCI_I2C is not set
# CONFIG_NFC_ST_NCI_SPI is not set
# CONFIG_NFC_NXP_NCI is not set
# CONFIG_NFC_S3FWRN5_I2C is not set
# CONFIG_NFC_S3FWRN82_UART is not set
# CONFIG_NFC_ST95HF is not set
# end of Near Field Communication (NFC) devices

CONFIG_PSAMPLE=y
CONFIG_NET_IFE=y
CONFIG_LWTUNNEL=y
CONFIG_LWTUNNEL_BPF=y
CONFIG_DST_CACHE=y
CONFIG_GRO_CELLS=y
CONFIG_SOCK_VALIDATE_XMIT=y
CONFIG_NET_SELFTESTS=y
CONFIG_NET_SOCK_MSG=y
CONFIG_NET_DEVLINK=y
CONFIG_PAGE_POOL=y
# CONFIG_PAGE_POOL_STATS is not set
CONFIG_FAILOVER=y
CONFIG_ETHTOOL_NETLINK=y

#
# Device Drivers
#
CONFIG_HAVE_EISA=y
# CONFIG_EISA is not set
CONFIG_HAVE_PCI=y
CONFIG_GENERIC_PCI_IOMAP=y
CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCIEPORTBUS=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_PCIEAER=y
# CONFIG_PCIEAER_INJECT is not set
# CONFIG_PCIE_ECRC is not set
CONFIG_PCIEASPM=y
CONFIG_PCIEASPM_DEFAULT=y
# CONFIG_PCIEASPM_POWERSAVE is not set
# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set
# CONFIG_PCIEASPM_PERFORMANCE is not set
CONFIG_PCIE_PME=y
# CONFIG_PCIE_DPC is not set
# CONFIG_PCIE_PTM is not set
CONFIG_PCI_MSI=y
CONFIG_PCI_QUIRKS=y
# CONFIG_PCI_DEBUG is not set
# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set
# CONFIG_PCI_STUB is not set
# CONFIG_PCI_PF_STUB is not set
CONFIG_PCI_ATS=y
CONFIG_PCI_ECAM=y
CONFIG_PCI_LOCKLESS_CONFIG=y
CONFIG_PCI_IOV=y
CONFIG_PCI_PRI=y
CONFIG_PCI_PASID=y
# CONFIG_PCI_P2PDMA is not set
CONFIG_PCI_LABEL=y
# CONFIG_PCI_DYNAMIC_OF_NODES is not set
# CONFIG_PCIE_BUS_TUNE_OFF is not set
CONFIG_PCIE_BUS_DEFAULT=y
# CONFIG_PCIE_BUS_SAFE is not set
# CONFIG_PCIE_BUS_PERFORMANCE is not set
# CONFIG_PCIE_BUS_PEER2PEER is not set
CONFIG_VGA_ARB=y
CONFIG_VGA_ARB_MAX_GPUS=16
CONFIG_HOTPLUG_PCI=y
# CONFIG_HOTPLUG_PCI_ACPI is not set
# CONFIG_HOTPLUG_PCI_CPCI is not set
# CONFIG_HOTPLUG_PCI_SHPC is not set

#
# PCI controller drivers
#
# CONFIG_PCI_FTPCI100 is not set
CONFIG_PCI_HOST_COMMON=y
CONFIG_PCI_HOST_GENERIC=y
# CONFIG_VMD is not set
# CONFIG_PCIE_MICROCHIP_HOST is not set
# CONFIG_PCIE_XILINX is not set

#
# Cadence-based PCIe controllers
#
# CONFIG_PCIE_CADENCE_PLAT_HOST is not set
# CONFIG_PCIE_CADENCE_PLAT_EP is not set
# end of Cadence-based PCIe controllers

#
# DesignWare-based PCIe controllers
#
# CONFIG_PCI_MESON is not set
# CONFIG_PCIE_INTEL_GW is not set
# CONFIG_PCIE_DW_PLAT_HOST is not set
# CONFIG_PCIE_DW_PLAT_EP is not set
# end of DesignWare-based PCIe controllers

#
# Mobiveil-based PCIe controllers
#
# end of Mobiveil-based PCIe controllers
# end of PCI controller drivers

#
# PCI Endpoint
#
CONFIG_PCI_ENDPOINT=y
# CONFIG_PCI_ENDPOINT_CONFIGFS is not set
# CONFIG_PCI_EPF_TEST is not set
# CONFIG_PCI_EPF_NTB is not set
# end of PCI Endpoint

#
# PCI switch controller drivers
#
# CONFIG_PCI_SW_SWITCHTEC is not set
# end of PCI switch controller drivers

# CONFIG_CXL_BUS is not set
CONFIG_PCCARD=y
CONFIG_PCMCIA=y
CONFIG_PCMCIA_LOAD_CIS=y
CONFIG_CARDBUS=y

#
# PC-card bridges
#
CONFIG_YENTA=y
CONFIG_YENTA_O2=y
CONFIG_YENTA_RICOH=y
CONFIG_YENTA_TI=y
CONFIG_YENTA_ENE_TUNE=y
CONFIG_YENTA_TOSHIBA=y
# CONFIG_PD6729 is not set
# CONFIG_I82092 is not set
CONFIG_PCCARD_NONSTATIC=y
# CONFIG_RAPIDIO is not set

#
# Generic Driver Options
#
CONFIG_AUXILIARY_BUS=y
CONFIG_UEVENT_HELPER=y
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_DEVTMPFS_SAFE is not set
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y

#
# Firmware loader
#
CONFIG_FW_LOADER=y
# CONFIG_FW_LOADER_DEBUG is not set
CONFIG_FW_LOADER_PAGED_BUF=y
CONFIG_FW_LOADER_SYSFS=y
CONFIG_EXTRA_FIRMWARE=""
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
CONFIG_FW_LOADER_COMPRESS=y
# CONFIG_FW_LOADER_COMPRESS_XZ is not set
# CONFIG_FW_LOADER_COMPRESS_ZSTD is not set
CONFIG_FW_CACHE=y
# CONFIG_FW_UPLOAD is not set
# end of Firmware loader

CONFIG_WANT_DEV_COREDUMP=y
CONFIG_ALLOW_DEV_COREDUMP=y
CONFIG_DEV_COREDUMP=y
# CONFIG_DEBUG_DRIVER is not set
CONFIG_DEBUG_DEVRES=y
# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set
# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set
CONFIG_GENERIC_CPU_DEVICES=y
CONFIG_GENERIC_CPU_AUTOPROBE=y
CONFIG_GENERIC_CPU_VULNERABILITIES=y
CONFIG_REGMAP=y
CONFIG_REGMAP_I2C=y
CONFIG_REGMAP_SPI=y
CONFIG_REGMAP_MMIO=y
CONFIG_REGMAP_IRQ=y
CONFIG_DMA_SHARED_BUFFER=y
# CONFIG_DMA_FENCE_TRACE is not set
# CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT is not set
# end of Generic Driver Options

#
# Bus devices
#
# CONFIG_MOXTET is not set
CONFIG_MHI_BUS=y
# CONFIG_MHI_BUS_DEBUG is not set
# CONFIG_MHI_BUS_PCI_GENERIC is not set
# CONFIG_MHI_BUS_EP is not set
# end of Bus devices

#
# Cache Drivers
#
# end of Cache Drivers

CONFIG_CONNECTOR=y
CONFIG_PROC_EVENTS=y

#
# Firmware Drivers
#

#
# ARM System Control and Management Interface Protocol
#
# end of ARM System Control and Management Interface Protocol

# CONFIG_EDD is not set
CONFIG_FIRMWARE_MEMMAP=y
CONFIG_DMIID=y
# CONFIG_DMI_SYSFS is not set
CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
# CONFIG_ISCSI_IBFT is not set
# CONFIG_FW_CFG_SYSFS is not set
CONFIG_SYSFB=y
# CONFIG_SYSFB_SIMPLEFB is not set
CONFIG_GOOGLE_FIRMWARE=y
# CONFIG_GOOGLE_SMI is not set
# CONFIG_GOOGLE_CBMEM is not set
CONFIG_GOOGLE_COREBOOT_TABLE=y
CONFIG_GOOGLE_MEMCONSOLE=y
# CONFIG_GOOGLE_MEMCONSOLE_X86_LEGACY is not set
# CONFIG_GOOGLE_FRAMEBUFFER_COREBOOT is not set
CONFIG_GOOGLE_MEMCONSOLE_COREBOOT=y
CONFIG_GOOGLE_VPD=y

#
# Qualcomm firmware drivers
#
# end of Qualcomm firmware drivers

#
# Tegra firmware driver
#
# end of Tegra firmware driver
# end of Firmware Drivers

# CONFIG_GNSS is not set
CONFIG_MTD=y
# CONFIG_MTD_TESTS is not set

#
# Partition parsers
#
# CONFIG_MTD_CMDLINE_PARTS is not set
# CONFIG_MTD_OF_PARTS is not set
# CONFIG_MTD_REDBOOT_PARTS is not set
# end of Partition parsers

#
# User Modules And Translation Layers
#
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y

#
# Note that in some cases UBI block is preferred. See MTD_UBI_BLOCK.
#
CONFIG_FTL=y
# CONFIG_NFTL is not set
# CONFIG_INFTL is not set
# CONFIG_RFD_FTL is not set
# CONFIG_SSFDC is not set
# CONFIG_SM_FTL is not set
# CONFIG_MTD_OOPS is not set
# CONFIG_MTD_SWAP is not set
# CONFIG_MTD_PARTITIONED_MASTER is not set

#
# RAM/ROM/Flash chip drivers
#
# CONFIG_MTD_CFI is not set
# CONFIG_MTD_JEDECPROBE is not set
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_ABSENT is not set
# end of RAM/ROM/Flash chip drivers

#
# Mapping drivers for chip access
#
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
# CONFIG_MTD_PLATRAM is not set
# end of Mapping drivers for chip access

#
# Self-contained MTD device drivers
#
# CONFIG_MTD_PMC551 is not set
# CONFIG_MTD_DATAFLASH is not set
# CONFIG_MTD_MCHP23K256 is not set
# CONFIG_MTD_MCHP48L640 is not set
# CONFIG_MTD_SST25L is not set
CONFIG_MTD_SLRAM=y
CONFIG_MTD_PHRAM=y
CONFIG_MTD_MTDRAM=y
CONFIG_MTDRAM_TOTAL_SIZE=128
CONFIG_MTDRAM_ERASE_SIZE=4
CONFIG_MTD_BLOCK2MTD=y

#
# Disk-On-Chip Device Drivers
#
# CONFIG_MTD_DOCG3 is not set
# end of Self-contained MTD device drivers

#
# NAND
#
# CONFIG_MTD_ONENAND is not set
# CONFIG_MTD_RAW_NAND is not set
# CONFIG_MTD_SPI_NAND is not set

#
# ECC engine support
#
# CONFIG_MTD_NAND_ECC_SW_HAMMING is not set
# CONFIG_MTD_NAND_ECC_SW_BCH is not set
# CONFIG_MTD_NAND_ECC_MXIC is not set
# end of ECC engine support
# end of NAND

#
# LPDDR & LPDDR2 PCM memory drivers
#
# CONFIG_MTD_LPDDR is not set
# end of LPDDR & LPDDR2 PCM memory drivers

# CONFIG_MTD_SPI_NOR is not set
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=20
# CONFIG_MTD_UBI_FASTMAP is not set
# CONFIG_MTD_UBI_GLUEBI is not set
# CONFIG_MTD_UBI_BLOCK is not set
# CONFIG_MTD_UBI_FAULT_INJECTION is not set
# CONFIG_MTD_UBI_NVMEM is not set
# CONFIG_MTD_HYPERBUS is not set
CONFIG_DTC=y
CONFIG_OF=y
# CONFIG_OF_UNITTEST is not set
CONFIG_OF_FLATTREE=y
CONFIG_OF_EARLY_FLATTREE=y
CONFIG_OF_KOBJ=y
CONFIG_OF_ADDRESS=y
CONFIG_OF_IRQ=y
CONFIG_OF_RESERVED_MEM=y
# CONFIG_OF_OVERLAY is not set
CONFIG_OF_NUMA=y
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
CONFIG_PARPORT=y
# CONFIG_PARPORT_PC is not set
# CONFIG_PARPORT_1284 is not set
CONFIG_PARPORT_NOT_PC=y
CONFIG_PNP=y
CONFIG_PNP_DEBUG_MESSAGES=y

#
# Protocols
#
CONFIG_PNPACPI=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_NULL_BLK=y
CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION=y
# CONFIG_BLK_DEV_FD is not set
CONFIG_CDROM=y
# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set
CONFIG_ZRAM=y
CONFIG_ZRAM_DEF_COMP_LZORLE=y
# CONFIG_ZRAM_DEF_COMP_ZSTD is not set
# CONFIG_ZRAM_DEF_COMP_LZ4 is not set
# CONFIG_ZRAM_DEF_COMP_LZO is not set
# CONFIG_ZRAM_DEF_COMP_LZ4HC is not set
# CONFIG_ZRAM_DEF_COMP_842 is not set
CONFIG_ZRAM_DEF_COMP="lzo-rle"
# CONFIG_ZRAM_WRITEBACK is not set
# CONFIG_ZRAM_TRACK_ENTRY_ACTIME is not set
# CONFIG_ZRAM_MEMORY_TRACKING is not set
# CONFIG_ZRAM_MULTI_COMP is not set
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=16
# CONFIG_BLK_DEV_DRBD is not set
CONFIG_BLK_DEV_NBD=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
# CONFIG_CDROM_PKTCDVD is not set
CONFIG_ATA_OVER_ETH=y
CONFIG_VIRTIO_BLK=y
# CONFIG_BLK_DEV_RBD is not set
# CONFIG_BLK_DEV_UBLK is not set
CONFIG_BLK_DEV_RNBD=y
CONFIG_BLK_DEV_RNBD_CLIENT=y

#
# NVME Support
#
CONFIG_NVME_CORE=y
CONFIG_BLK_DEV_NVME=y
CONFIG_NVME_MULTIPATH=y
# CONFIG_NVME_VERBOSE_ERRORS is not set
# CONFIG_NVME_HWMON is not set
CONFIG_NVME_FABRICS=y
CONFIG_NVME_RDMA=y
CONFIG_NVME_FC=y
CONFIG_NVME_TCP=y
# CONFIG_NVME_TCP_TLS is not set
# CONFIG_NVME_HOST_AUTH is not set
CONFIG_NVME_TARGET=y
# CONFIG_NVME_TARGET_PASSTHRU is not set
CONFIG_NVME_TARGET_LOOP=y
CONFIG_NVME_TARGET_RDMA=y
CONFIG_NVME_TARGET_FC=y
CONFIG_NVME_TARGET_FCLOOP=y
CONFIG_NVME_TARGET_TCP=y
# CONFIG_NVME_TARGET_TCP_TLS is not set
# CONFIG_NVME_TARGET_AUTH is not set
# end of NVME Support

#
# Misc devices
#
# CONFIG_AD525X_DPOT is not set
# CONFIG_DUMMY_IRQ is not set
# CONFIG_IBM_ASM is not set
# CONFIG_PHANTOM is not set
# CONFIG_TIFM_CORE is not set
# CONFIG_ICS932S401 is not set
# CONFIG_ENCLOSURE_SERVICES is not set
# CONFIG_HP_ILO is not set
# CONFIG_APDS9802ALS is not set
# CONFIG_ISL29003 is not set
# CONFIG_ISL29020 is not set
# CONFIG_SENSORS_TSL2550 is not set
# CONFIG_SENSORS_BH1770 is not set
# CONFIG_SENSORS_APDS990X is not set
# CONFIG_HMC6352 is not set
# CONFIG_DS1682 is not set
# CONFIG_VMWARE_BALLOON is not set
# CONFIG_LATTICE_ECP3_CONFIG is not set
# CONFIG_SRAM is not set
# CONFIG_DW_XDATA_PCIE is not set
# CONFIG_PCI_ENDPOINT_TEST is not set
# CONFIG_XILINX_SDFEC is not set
CONFIG_MISC_RTSX=y
# CONFIG_HISI_HIKEY_USB is not set
# CONFIG_OPEN_DICE is not set
# CONFIG_VCPU_STALL_DETECTOR is not set
# CONFIG_NSM is not set
# CONFIG_C2PORT is not set

#
# EEPROM support
#
# CONFIG_EEPROM_AT24 is not set
# CONFIG_EEPROM_AT25 is not set
# CONFIG_EEPROM_MAX6875 is not set
CONFIG_EEPROM_93CX6=y
# CONFIG_EEPROM_93XX46 is not set
# CONFIG_EEPROM_IDT_89HPESX is not set
# CONFIG_EEPROM_EE1004 is not set
# end of EEPROM support

# CONFIG_CB710_CORE is not set

#
# Texas Instruments shared transport line discipline
#
# CONFIG_TI_ST is not set
# end of Texas Instruments shared transport line discipline

# CONFIG_SENSORS_LIS3_I2C is not set
# CONFIG_ALTERA_STAPL is not set
CONFIG_INTEL_MEI=y
CONFIG_INTEL_MEI_ME=y
# CONFIG_INTEL_MEI_TXE is not set
# CONFIG_INTEL_MEI_GSC is not set
# CONFIG_INTEL_MEI_VSC_HW is not set
# CONFIG_INTEL_MEI_HDCP is not set
# CONFIG_INTEL_MEI_PXP is not set
# CONFIG_INTEL_MEI_GSC_PROXY is not set
CONFIG_VMWARE_VMCI=y
# CONFIG_GENWQE is not set
# CONFIG_ECHO is not set
# CONFIG_BCM_VK is not set
# CONFIG_MISC_ALCOR_PCI is not set
# CONFIG_MISC_RTSX_PCI is not set
CONFIG_MISC_RTSX_USB=y
# CONFIG_UACCE is not set
# CONFIG_PVPANIC is not set
# CONFIG_GP_PCI1XXXX is not set
# end of Misc devices

#
# SCSI device support
#
CONFIG_SCSI_MOD=y
CONFIG_RAID_ATTRS=y
CONFIG_SCSI_COMMON=y
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
CONFIG_SCSI_NETLINK=y
CONFIG_SCSI_PROC_FS=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_ST=y
CONFIG_BLK_DEV_SR=y
CONFIG_CHR_DEV_SG=y
CONFIG_BLK_DEV_BSG=y
# CONFIG_CHR_DEV_SCH is not set
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_LOGGING=y
CONFIG_SCSI_SCAN_ASYNC=y

#
# SCSI Transports
#
CONFIG_SCSI_SPI_ATTRS=y
CONFIG_SCSI_FC_ATTRS=y
CONFIG_SCSI_ISCSI_ATTRS=y
CONFIG_SCSI_SAS_ATTRS=y
CONFIG_SCSI_SAS_LIBSAS=y
CONFIG_SCSI_SAS_ATA=y
# CONFIG_SCSI_SAS_HOST_SMP is not set
CONFIG_SCSI_SRP_ATTRS=y
# end of SCSI Transports

CONFIG_SCSI_LOWLEVEL=y
# CONFIG_ISCSI_TCP is not set
# CONFIG_ISCSI_BOOT_SYSFS is not set
# CONFIG_SCSI_CXGB3_ISCSI is not set
# CONFIG_SCSI_CXGB4_ISCSI is not set
# CONFIG_SCSI_BNX2_ISCSI is not set
# CONFIG_BE2ISCSI is not set
# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
CONFIG_SCSI_HPSA=y
# CONFIG_SCSI_3W_9XXX is not set
# CONFIG_SCSI_3W_SAS is not set
# CONFIG_SCSI_ACARD is not set
# CONFIG_SCSI_AACRAID is not set
# CONFIG_SCSI_AIC7XXX is not set
# CONFIG_SCSI_AIC79XX is not set
# CONFIG_SCSI_AIC94XX is not set
# CONFIG_SCSI_MVSAS is not set
# CONFIG_SCSI_MVUMI is not set
# CONFIG_SCSI_ADVANSYS is not set
# CONFIG_SCSI_ARCMSR is not set
# CONFIG_SCSI_ESAS2R is not set
# CONFIG_MEGARAID_NEWGEN is not set
# CONFIG_MEGARAID_LEGACY is not set
# CONFIG_MEGARAID_SAS is not set
# CONFIG_SCSI_MPT3SAS is not set
# CONFIG_SCSI_MPT2SAS is not set
# CONFIG_SCSI_MPI3MR is not set
# CONFIG_SCSI_SMARTPQI is not set
# CONFIG_SCSI_HPTIOP is not set
# CONFIG_SCSI_BUSLOGIC is not set
# CONFIG_SCSI_MYRB is not set
# CONFIG_SCSI_MYRS is not set
# CONFIG_VMWARE_PVSCSI is not set
# CONFIG_LIBFC is not set
# CONFIG_SCSI_SNIC is not set
# CONFIG_SCSI_DMX3191D is not set
# CONFIG_SCSI_FDOMAIN_PCI is not set
# CONFIG_SCSI_ISCI is not set
# CONFIG_SCSI_IPS is not set
# CONFIG_SCSI_INITIO is not set
# CONFIG_SCSI_INIA100 is not set
# CONFIG_SCSI_STEX is not set
# CONFIG_SCSI_SYM53C8XX_2 is not set
# CONFIG_SCSI_IPR is not set
# CONFIG_SCSI_QLOGIC_1280 is not set
# CONFIG_SCSI_QLA_FC is not set
# CONFIG_SCSI_QLA_ISCSI is not set
# CONFIG_SCSI_LPFC is not set
# CONFIG_SCSI_EFCT is not set
# CONFIG_SCSI_DC395x is not set
# CONFIG_SCSI_AM53C974 is not set
# CONFIG_SCSI_WD719X is not set
# CONFIG_SCSI_DEBUG is not set
# CONFIG_SCSI_PMCRAID is not set
# CONFIG_SCSI_PM8001 is not set
# CONFIG_SCSI_BFA_FC is not set
CONFIG_SCSI_VIRTIO=y
# CONFIG_SCSI_CHELSIO_FCOE is not set
# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
# CONFIG_SCSI_DH is not set
# end of SCSI device support

CONFIG_ATA=y
CONFIG_SATA_HOST=y
CONFIG_PATA_TIMINGS=y
CONFIG_ATA_VERBOSE_ERROR=y
CONFIG_ATA_FORCE=y
CONFIG_ATA_ACPI=y
# CONFIG_SATA_ZPODD is not set
CONFIG_SATA_PMP=y

#
# Controllers with non-SFF native interface
#
CONFIG_SATA_AHCI=y
CONFIG_SATA_MOBILE_LPM_POLICY=0
# CONFIG_SATA_AHCI_PLATFORM is not set
# CONFIG_AHCI_DWC is not set
# CONFIG_AHCI_CEVA is not set
# CONFIG_SATA_INIC162X is not set
# CONFIG_SATA_ACARD_AHCI is not set
# CONFIG_SATA_SIL24 is not set
CONFIG_ATA_SFF=y

#
# SFF controllers with custom DMA interface
#
# CONFIG_PDC_ADMA is not set
# CONFIG_SATA_QSTOR is not set
# CONFIG_SATA_SX4 is not set
CONFIG_ATA_BMDMA=y

#
# SATA SFF controllers with BMDMA
#
CONFIG_ATA_PIIX=y
# CONFIG_SATA_DWC is not set
# CONFIG_SATA_MV is not set
# CONFIG_SATA_NV is not set
# CONFIG_SATA_PROMISE is not set
# CONFIG_SATA_SIL is not set
# CONFIG_SATA_SIS is not set
# CONFIG_SATA_SVW is not set
# CONFIG_SATA_ULI is not set
# CONFIG_SATA_VIA is not set
# CONFIG_SATA_VITESSE is not set

#
# PATA SFF controllers with BMDMA
#
# CONFIG_PATA_ALI is not set
CONFIG_PATA_AMD=y
# CONFIG_PATA_ARTOP is not set
# CONFIG_PATA_ATIIXP is not set
# CONFIG_PATA_ATP867X is not set
# CONFIG_PATA_CMD64X is not set
# CONFIG_PATA_CYPRESS is not set
# CONFIG_PATA_EFAR is not set
# CONFIG_PATA_HPT366 is not set
# CONFIG_PATA_HPT37X is not set
# CONFIG_PATA_HPT3X2N is not set
# CONFIG_PATA_HPT3X3 is not set
# CONFIG_PATA_IT8213 is not set
# CONFIG_PATA_IT821X is not set
# CONFIG_PATA_JMICRON is not set
# CONFIG_PATA_MARVELL is not set
# CONFIG_PATA_NETCELL is not set
# CONFIG_PATA_NINJA32 is not set
# CONFIG_PATA_NS87415 is not set
CONFIG_PATA_OLDPIIX=y
# CONFIG_PATA_OPTIDMA is not set
# CONFIG_PATA_PDC2027X is not set
# CONFIG_PATA_PDC_OLD is not set
# CONFIG_PATA_RADISYS is not set
# CONFIG_PATA_RDC is not set
CONFIG_PATA_SCH=y
# CONFIG_PATA_SERVERWORKS is not set
# CONFIG_PATA_SIL680 is not set
# CONFIG_PATA_SIS is not set
# CONFIG_PATA_TOSHIBA is not set
# CONFIG_PATA_TRIFLEX is not set
# CONFIG_PATA_VIA is not set
# CONFIG_PATA_WINBOND is not set

#
# PIO-only SFF controllers
#
# CONFIG_PATA_CMD640_PCI is not set
# CONFIG_PATA_MPIIX is not set
# CONFIG_PATA_NS87410 is not set
# CONFIG_PATA_OPTI is not set
# CONFIG_PATA_PCMCIA is not set
# CONFIG_PATA_OF_PLATFORM is not set
# CONFIG_PATA_RZ1000 is not set

#
# Generic fallback / legacy drivers
#
# CONFIG_PATA_ACPI is not set
CONFIG_ATA_GENERIC=y
# CONFIG_PATA_LEGACY is not set
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
CONFIG_MD_AUTODETECT=y
CONFIG_MD_BITMAP_FILE=y
CONFIG_MD_RAID0=y
CONFIG_MD_RAID1=y
CONFIG_MD_RAID10=y
CONFIG_MD_RAID456=y
# CONFIG_MD_CLUSTER is not set
CONFIG_BCACHE=y
# CONFIG_BCACHE_DEBUG is not set
# CONFIG_BCACHE_ASYNC_REGISTRATION is not set
CONFIG_BLK_DEV_DM_BUILTIN=y
CONFIG_BLK_DEV_DM=y
# CONFIG_DM_DEBUG is not set
CONFIG_DM_BUFIO=y
# CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING is not set
CONFIG_DM_BIO_PRISON=y
CONFIG_DM_PERSISTENT_DATA=y
# CONFIG_DM_UNSTRIPED is not set
CONFIG_DM_CRYPT=y
CONFIG_DM_SNAPSHOT=y
CONFIG_DM_THIN_PROVISIONING=y
CONFIG_DM_CACHE=y
CONFIG_DM_CACHE_SMQ=y
CONFIG_DM_WRITECACHE=y
# CONFIG_DM_EBS is not set
# CONFIG_DM_ERA is not set
CONFIG_DM_CLONE=y
CONFIG_DM_MIRROR=y
# CONFIG_DM_LOG_USERSPACE is not set
CONFIG_DM_RAID=y
CONFIG_DM_ZERO=y
CONFIG_DM_MULTIPATH=y
CONFIG_DM_MULTIPATH_QL=y
CONFIG_DM_MULTIPATH_ST=y
# CONFIG_DM_MULTIPATH_HST is not set
# CONFIG_DM_MULTIPATH_IOA is not set
# CONFIG_DM_DELAY is not set
# CONFIG_DM_DUST is not set
# CONFIG_DM_INIT is not set
CONFIG_DM_UEVENT=y
CONFIG_DM_FLAKEY=y
CONFIG_DM_VERITY=y
# CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG is not set
CONFIG_DM_VERITY_FEC=y
# CONFIG_DM_SWITCH is not set
# CONFIG_DM_LOG_WRITES is not set
CONFIG_DM_INTEGRITY=y
CONFIG_DM_ZONED=y
CONFIG_DM_AUDIT=y
# CONFIG_DM_VDO is not set
CONFIG_TARGET_CORE=y
# CONFIG_TCM_IBLOCK is not set
# CONFIG_TCM_FILEIO is not set
# CONFIG_TCM_PSCSI is not set
# CONFIG_LOOPBACK_TARGET is not set
# CONFIG_ISCSI_TARGET is not set
# CONFIG_SBP_TARGET is not set
# CONFIG_REMOTE_TARGET is not set
# CONFIG_FUSION is not set

#
# IEEE 1394 (FireWire) support
#
CONFIG_FIREWIRE=y
CONFIG_FIREWIRE_OHCI=y
CONFIG_FIREWIRE_SBP2=y
CONFIG_FIREWIRE_NET=y
# CONFIG_FIREWIRE_NOSY is not set
# end of IEEE 1394 (FireWire) support

# CONFIG_MACINTOSH_DRIVERS is not set
CONFIG_NETDEVICES=y
CONFIG_MII=y
CONFIG_NET_CORE=y
CONFIG_BONDING=y
CONFIG_DUMMY=y
CONFIG_WIREGUARD=y
# CONFIG_WIREGUARD_DEBUG is not set
CONFIG_EQUALIZER=y
CONFIG_NET_FC=y
CONFIG_IFB=y
CONFIG_NET_TEAM=y
CONFIG_NET_TEAM_MODE_BROADCAST=y
CONFIG_NET_TEAM_MODE_ROUNDROBIN=y
CONFIG_NET_TEAM_MODE_RANDOM=y
CONFIG_NET_TEAM_MODE_ACTIVEBACKUP=y
CONFIG_NET_TEAM_MODE_LOADBALANCE=y
CONFIG_MACVLAN=y
CONFIG_MACVTAP=y
CONFIG_IPVLAN_L3S=y
CONFIG_IPVLAN=y
CONFIG_IPVTAP=y
CONFIG_VXLAN=y
CONFIG_GENEVE=y
CONFIG_BAREUDP=y
CONFIG_GTP=y
# CONFIG_AMT is not set
CONFIG_MACSEC=y
CONFIG_NETCONSOLE=y
# CONFIG_NETCONSOLE_DYNAMIC is not set
# CONFIG_NETCONSOLE_EXTENDED_LOG is not set
CONFIG_NETPOLL=y
CONFIG_NET_POLL_CONTROLLER=y
CONFIG_TUN=y
CONFIG_TAP=y
CONFIG_TUN_VNET_CROSS_LE=y
CONFIG_VETH=y
CONFIG_VIRTIO_NET=y
CONFIG_NLMON=y
# CONFIG_NETKIT is not set
CONFIG_NET_VRF=y
CONFIG_VSOCKMON=y
# CONFIG_MHI_NET is not set
# CONFIG_ARCNET is not set
CONFIG_ATM_DRIVERS=y
# CONFIG_ATM_DUMMY is not set
CONFIG_ATM_TCP=y
# CONFIG_ATM_LANAI is not set
# CONFIG_ATM_ENI is not set
# CONFIG_ATM_NICSTAR is not set
# CONFIG_ATM_IDT77252 is not set
# CONFIG_ATM_IA is not set
# CONFIG_ATM_FORE200E is not set
# CONFIG_ATM_HE is not set
# CONFIG_ATM_SOLOS is not set
CONFIG_CAIF_DRIVERS=y
CONFIG_CAIF_TTY=y
CONFIG_CAIF_VIRTIO=y

#
# Distributed Switch Architecture drivers
#
# CONFIG_B53 is not set
# CONFIG_NET_DSA_BCM_SF2 is not set
# CONFIG_NET_DSA_LOOP is not set
# CONFIG_NET_DSA_HIRSCHMANN_HELLCREEK is not set
# CONFIG_NET_DSA_LANTIQ_GSWIP is not set
# CONFIG_NET_DSA_MT7530 is not set
# CONFIG_NET_DSA_MV88E6060 is not set
# CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON is not set
# CONFIG_NET_DSA_MV88E6XXX is not set
# CONFIG_NET_DSA_AR9331 is not set
# CONFIG_NET_DSA_QCA8K is not set
# CONFIG_NET_DSA_SJA1105 is not set
# CONFIG_NET_DSA_XRS700X_I2C is not set
# CONFIG_NET_DSA_XRS700X_MDIO is not set
# CONFIG_NET_DSA_REALTEK is not set
# CONFIG_NET_DSA_SMSC_LAN9303_I2C is not set
# CONFIG_NET_DSA_SMSC_LAN9303_MDIO is not set
# CONFIG_NET_DSA_VITESSE_VSC73XX_SPI is not set
# CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM is not set
# end of Distributed Switch Architecture drivers

CONFIG_ETHERNET=y
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_NET_VENDOR_ADAPTEC is not set
# CONFIG_NET_VENDOR_AGERE is not set
# CONFIG_NET_VENDOR_ALACRITECH is not set
CONFIG_NET_VENDOR_ALTEON=y
# CONFIG_ACENIC is not set
# CONFIG_ALTERA_TSE is not set
CONFIG_NET_VENDOR_AMAZON=y
# CONFIG_ENA_ETHERNET is not set
# CONFIG_NET_VENDOR_AMD is not set
# CONFIG_NET_VENDOR_AQUANTIA is not set
# CONFIG_NET_VENDOR_ARC is not set
CONFIG_NET_VENDOR_ASIX=y
# CONFIG_SPI_AX88796C is not set
# CONFIG_NET_VENDOR_ATHEROS is not set
# CONFIG_CX_ECAT is not set
# CONFIG_NET_VENDOR_BROADCOM is not set
# CONFIG_NET_VENDOR_CADENCE is not set
# CONFIG_NET_VENDOR_CAVIUM is not set
# CONFIG_NET_VENDOR_CHELSIO is not set
CONFIG_NET_VENDOR_CISCO=y
# CONFIG_ENIC is not set
# CONFIG_NET_VENDOR_CORTINA is not set
CONFIG_NET_VENDOR_DAVICOM=y
# CONFIG_DM9051 is not set
# CONFIG_DNET is not set
# CONFIG_NET_VENDOR_DEC is not set
# CONFIG_NET_VENDOR_DLINK is not set
# CONFIG_NET_VENDOR_EMULEX is not set
CONFIG_NET_VENDOR_ENGLEDER=y
# CONFIG_TSNEP is not set
# CONFIG_NET_VENDOR_EZCHIP is not set
# CONFIG_NET_VENDOR_FUJITSU is not set
CONFIG_NET_VENDOR_FUNGIBLE=y
# CONFIG_FUN_ETH is not set
CONFIG_NET_VENDOR_GOOGLE=y
CONFIG_GVE=y
# CONFIG_NET_VENDOR_HUAWEI is not set
CONFIG_NET_VENDOR_I825XX=y
CONFIG_NET_VENDOR_INTEL=y
CONFIG_E100=y
CONFIG_E1000=y
CONFIG_E1000E=y
CONFIG_E1000E_HWTS=y
# CONFIG_IGB is not set
# CONFIG_IGBVF is not set
# CONFIG_IXGBE is not set
# CONFIG_IXGBEVF is not set
# CONFIG_I40E is not set
# CONFIG_I40EVF is not set
# CONFIG_ICE is not set
# CONFIG_FM10K is not set
# CONFIG_IGC is not set
# CONFIG_IDPF is not set
# CONFIG_JME is not set
# CONFIG_NET_VENDOR_ADI is not set
CONFIG_NET_VENDOR_LITEX=y
# CONFIG_LITEX_LITEETH is not set
# CONFIG_NET_VENDOR_MARVELL is not set
CONFIG_NET_VENDOR_MELLANOX=y
# CONFIG_MLX4_EN is not set
CONFIG_MLX4_CORE=y
# CONFIG_MLX4_DEBUG is not set
# CONFIG_MLX4_CORE_GEN2 is not set
# CONFIG_MLX5_CORE is not set
# CONFIG_MLXSW_CORE is not set
# CONFIG_MLXFW is not set
# CONFIG_NET_VENDOR_MICREL is not set
# CONFIG_NET_VENDOR_MICROCHIP is not set
# CONFIG_NET_VENDOR_MICROSEMI is not set
CONFIG_NET_VENDOR_MICROSOFT=y
# CONFIG_NET_VENDOR_MYRI is not set
# CONFIG_FEALNX is not set
# CONFIG_NET_VENDOR_NI is not set
# CONFIG_NET_VENDOR_NATSEMI is not set
# CONFIG_NET_VENDOR_NETERION is not set
# CONFIG_NET_VENDOR_NETRONOME is not set
# CONFIG_NET_VENDOR_NVIDIA is not set
# CONFIG_NET_VENDOR_OKI is not set
# CONFIG_ETHOC is not set
# CONFIG_NET_VENDOR_PACKET_ENGINES is not set
# CONFIG_NET_VENDOR_PENSANDO is not set
# CONFIG_NET_VENDOR_QLOGIC is not set
# CONFIG_NET_VENDOR_BROCADE is not set
# CONFIG_NET_VENDOR_QUALCOMM is not set
# CONFIG_NET_VENDOR_RDC is not set
# CONFIG_NET_VENDOR_REALTEK is not set
# CONFIG_NET_VENDOR_RENESAS is not set
# CONFIG_NET_VENDOR_ROCKER is not set
# CONFIG_NET_VENDOR_SAMSUNG is not set
# CONFIG_NET_VENDOR_SEEQ is not set
# CONFIG_NET_VENDOR_SILAN is not set
# CONFIG_NET_VENDOR_SIS is not set
# CONFIG_NET_VENDOR_SOLARFLARE is not set
# CONFIG_NET_VENDOR_SMSC is not set
# CONFIG_NET_VENDOR_SOCIONEXT is not set
# CONFIG_NET_VENDOR_STMICRO is not set
# CONFIG_NET_VENDOR_SUN is not set
# CONFIG_NET_VENDOR_SYNOPSYS is not set
# CONFIG_NET_VENDOR_TEHUTI is not set
# CONFIG_NET_VENDOR_TI is not set
CONFIG_NET_VENDOR_VERTEXCOM=y
# CONFIG_MSE102X is not set
# CONFIG_NET_VENDOR_VIA is not set
CONFIG_NET_VENDOR_WANGXUN=y
# CONFIG_NGBE is not set
# CONFIG_TXGBE is not set
# CONFIG_NET_VENDOR_WIZNET is not set
# CONFIG_NET_VENDOR_XILINX is not set
# CONFIG_NET_VENDOR_XIRCOM is not set
CONFIG_FDDI=y
# CONFIG_DEFXX is not set
# CONFIG_SKFP is not set
# CONFIG_HIPPI is not set
# CONFIG_NET_SB1000 is not set
CONFIG_PHYLINK=y
CONFIG_PHYLIB=y
CONFIG_SWPHY=y
# CONFIG_LED_TRIGGER_PHY is not set
CONFIG_PHYLIB_LEDS=y
CONFIG_FIXED_PHY=y
# CONFIG_SFP is not set

#
# MII PHY device drivers
#
# CONFIG_AMD_PHY is not set
# CONFIG_ADIN_PHY is not set
# CONFIG_ADIN1100_PHY is not set
# CONFIG_AQUANTIA_PHY is not set
CONFIG_AX88796B_PHY=y
# CONFIG_BROADCOM_PHY is not set
# CONFIG_BCM54140_PHY is not set
# CONFIG_BCM7XXX_PHY is not set
# CONFIG_BCM84881_PHY is not set
# CONFIG_BCM87XX_PHY is not set
# CONFIG_CICADA_PHY is not set
# CONFIG_CORTINA_PHY is not set
# CONFIG_DAVICOM_PHY is not set
# CONFIG_ICPLUS_PHY is not set
# CONFIG_LXT_PHY is not set
# CONFIG_INTEL_XWAY_PHY is not set
# CONFIG_LSI_ET1011C_PHY is not set
# CONFIG_MARVELL_PHY is not set
# CONFIG_MARVELL_10G_PHY is not set
# CONFIG_MARVELL_88Q2XXX_PHY is not set
# CONFIG_MARVELL_88X2222_PHY is not set
# CONFIG_MAXLINEAR_GPHY is not set
# CONFIG_MEDIATEK_GE_PHY is not set
# CONFIG_MICREL_PHY is not set
# CONFIG_MICROCHIP_T1S_PHY is not set
CONFIG_MICROCHIP_PHY=y
# CONFIG_MICROCHIP_T1_PHY is not set
# CONFIG_MICROSEMI_PHY is not set
# CONFIG_MOTORCOMM_PHY is not set
# CONFIG_NATIONAL_PHY is not set
# CONFIG_NXP_CBTX_PHY is not set
# CONFIG_NXP_C45_TJA11XX_PHY is not set
# CONFIG_NXP_TJA11XX_PHY is not set
# CONFIG_NCN26000_PHY is not set
# CONFIG_AT803X_PHY is not set
# CONFIG_QCA83XX_PHY is not set
# CONFIG_QCA808X_PHY is not set
# CONFIG_QCA807X_PHY is not set
# CONFIG_QSEMI_PHY is not set
CONFIG_REALTEK_PHY=y
# CONFIG_RENESAS_PHY is not set
# CONFIG_ROCKCHIP_PHY is not set
CONFIG_SMSC_PHY=y
# CONFIG_STE10XP is not set
# CONFIG_TERANETICS_PHY is not set
# CONFIG_DP83822_PHY is not set
# CONFIG_DP83TC811_PHY is not set
# CONFIG_DP83848_PHY is not set
# CONFIG_DP83867_PHY is not set
# CONFIG_DP83869_PHY is not set
# CONFIG_DP83TD510_PHY is not set
# CONFIG_DP83TG720_PHY is not set
# CONFIG_VITESSE_PHY is not set
# CONFIG_XILINX_GMII2RGMII is not set
# CONFIG_MICREL_KS8995MA is not set
# CONFIG_PSE_CONTROLLER is not set
CONFIG_CAN_DEV=y
CONFIG_CAN_VCAN=y
CONFIG_CAN_VXCAN=y
CONFIG_CAN_NETLINK=y
CONFIG_CAN_CALC_BITTIMING=y
CONFIG_CAN_RX_OFFLOAD=y
# CONFIG_CAN_CAN327 is not set
# CONFIG_CAN_FLEXCAN is not set
# CONFIG_CAN_GRCAN is not set
# CONFIG_CAN_KVASER_PCIEFD is not set
CONFIG_CAN_SLCAN=y
# CONFIG_CAN_C_CAN is not set
# CONFIG_CAN_CC770 is not set
# CONFIG_CAN_CTUCANFD_PCI is not set
# CONFIG_CAN_CTUCANFD_PLATFORM is not set
# CONFIG_CAN_ESD_402_PCI is not set
CONFIG_CAN_IFI_CANFD=y
# CONFIG_CAN_M_CAN is not set
# CONFIG_CAN_PEAK_PCIEFD is not set
# CONFIG_CAN_SJA1000 is not set
# CONFIG_CAN_SOFTING is not set

#
# CAN SPI interfaces
#
# CONFIG_CAN_HI311X is not set
# CONFIG_CAN_MCP251X is not set
# CONFIG_CAN_MCP251XFD is not set
# end of CAN SPI interfaces

#
# CAN USB interfaces
#
CONFIG_CAN_8DEV_USB=y
CONFIG_CAN_EMS_USB=y
# CONFIG_CAN_ESD_USB is not set
# CONFIG_CAN_ETAS_ES58X is not set
# CONFIG_CAN_F81604 is not set
CONFIG_CAN_GS_USB=y
CONFIG_CAN_KVASER_USB=y
CONFIG_CAN_MCBA_USB=y
CONFIG_CAN_PEAK_USB=y
# CONFIG_CAN_UCAN is not set
# end of CAN USB interfaces

# CONFIG_CAN_DEBUG_DEVICES is not set
CONFIG_MDIO_DEVICE=y
CONFIG_MDIO_BUS=y
CONFIG_FWNODE_MDIO=y
CONFIG_OF_MDIO=y
CONFIG_ACPI_MDIO=y
CONFIG_MDIO_DEVRES=y
# CONFIG_MDIO_BITBANG is not set
# CONFIG_MDIO_BCM_UNIMAC is not set
# CONFIG_MDIO_HISI_FEMAC is not set
# CONFIG_MDIO_MVUSB is not set
# CONFIG_MDIO_MSCC_MIIM is not set
# CONFIG_MDIO_OCTEON is not set
# CONFIG_MDIO_IPQ4019 is not set
# CONFIG_MDIO_IPQ8064 is not set
# CONFIG_MDIO_THUNDER is not set

#
# MDIO Multiplexers
#
# CONFIG_MDIO_BUS_MUX_GPIO is not set
# CONFIG_MDIO_BUS_MUX_MULTIPLEXER is not set
# CONFIG_MDIO_BUS_MUX_MMIOREG is not set

#
# PCS device drivers
#
# end of PCS device drivers

# CONFIG_PLIP is not set
CONFIG_PPP=y
CONFIG_PPP_BSDCOMP=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_FILTER=y
CONFIG_PPP_MPPE=y
CONFIG_PPP_MULTILINK=y
CONFIG_PPPOATM=y
CONFIG_PPPOE=y
# CONFIG_PPPOE_HASH_BITS_1 is not set
# CONFIG_PPPOE_HASH_BITS_2 is not set
CONFIG_PPPOE_HASH_BITS_4=y
# CONFIG_PPPOE_HASH_BITS_8 is not set
CONFIG_PPPOE_HASH_BITS=4
CONFIG_PPTP=y
CONFIG_PPPOL2TP=y
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
CONFIG_SLIP=y
CONFIG_SLHC=y
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLIP_SMART=y
CONFIG_SLIP_MODE_SLIP6=y
CONFIG_USB_NET_DRIVERS=y
CONFIG_USB_CATC=y
CONFIG_USB_KAWETH=y
CONFIG_USB_PEGASUS=y
CONFIG_USB_RTL8150=y
CONFIG_USB_RTL8152=y
CONFIG_USB_LAN78XX=y
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_AX88179_178A=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_CDC_EEM=y
CONFIG_USB_NET_CDC_NCM=y
CONFIG_USB_NET_HUAWEI_CDC_NCM=y
CONFIG_USB_NET_CDC_MBIM=y
CONFIG_USB_NET_DM9601=y
CONFIG_USB_NET_SR9700=y
CONFIG_USB_NET_SR9800=y
CONFIG_USB_NET_SMSC75XX=y
CONFIG_USB_NET_SMSC95XX=y
CONFIG_USB_NET_GL620A=y
CONFIG_USB_NET_NET1080=y
CONFIG_USB_NET_PLUSB=y
CONFIG_USB_NET_MCS7830=y
CONFIG_USB_NET_RNDIS_HOST=y
CONFIG_USB_NET_CDC_SUBSET_ENABLE=y
CONFIG_USB_NET_CDC_SUBSET=y
CONFIG_USB_ALI_M5632=y
CONFIG_USB_AN2720=y
CONFIG_USB_BELKIN=y
CONFIG_USB_ARMLINUX=y
CONFIG_USB_EPSON2888=y
CONFIG_USB_KC2190=y
CONFIG_USB_NET_ZAURUS=y
CONFIG_USB_NET_CX82310_ETH=y
CONFIG_USB_NET_KALMIA=y
CONFIG_USB_NET_QMI_WWAN=y
CONFIG_USB_HSO=y
CONFIG_USB_NET_INT51X1=y
CONFIG_USB_CDC_PHONET=y
CONFIG_USB_IPHETH=y
CONFIG_USB_SIERRA_NET=y
CONFIG_USB_VL600=y
CONFIG_USB_NET_CH9200=y
# CONFIG_USB_NET_AQC111 is not set
CONFIG_USB_RTL8153_ECM=y
CONFIG_WLAN=y
CONFIG_WLAN_VENDOR_ADMTEK=y
# CONFIG_ADM8211 is not set
CONFIG_ATH_COMMON=y
CONFIG_WLAN_VENDOR_ATH=y
# CONFIG_ATH_DEBUG is not set
# CONFIG_ATH5K is not set
# CONFIG_ATH5K_PCI is not set
CONFIG_ATH9K_HW=y
CONFIG_ATH9K_COMMON=y
CONFIG_ATH9K_COMMON_DEBUG=y
CONFIG_ATH9K_BTCOEX_SUPPORT=y
CONFIG_ATH9K=y
CONFIG_ATH9K_PCI=y
CONFIG_ATH9K_AHB=y
CONFIG_ATH9K_DEBUGFS=y
# CONFIG_ATH9K_STATION_STATISTICS is not set
CONFIG_ATH9K_DYNACK=y
# CONFIG_ATH9K_WOW is not set
CONFIG_ATH9K_RFKILL=y
CONFIG_ATH9K_CHANNEL_CONTEXT=y
CONFIG_ATH9K_PCOEM=y
# CONFIG_ATH9K_PCI_NO_EEPROM is not set
CONFIG_ATH9K_HTC=y
CONFIG_ATH9K_HTC_DEBUGFS=y
# CONFIG_ATH9K_HWRNG is not set
# CONFIG_ATH9K_COMMON_SPECTRAL is not set
CONFIG_CARL9170=y
CONFIG_CARL9170_LEDS=y
# CONFIG_CARL9170_DEBUGFS is not set
CONFIG_CARL9170_WPC=y
CONFIG_CARL9170_HWRNG=y
CONFIG_ATH6KL=y
# CONFIG_ATH6KL_SDIO is not set
CONFIG_ATH6KL_USB=y
# CONFIG_ATH6KL_DEBUG is not set
# CONFIG_ATH6KL_TRACING is not set
CONFIG_AR5523=y
# CONFIG_WIL6210 is not set
CONFIG_ATH10K=y
CONFIG_ATH10K_CE=y
CONFIG_ATH10K_PCI=y
# CONFIG_ATH10K_AHB is not set
# CONFIG_ATH10K_SDIO is not set
CONFIG_ATH10K_USB=y
# CONFIG_ATH10K_DEBUG is not set
# CONFIG_ATH10K_DEBUGFS is not set
# CONFIG_ATH10K_TRACING is not set
# CONFIG_WCN36XX is not set
CONFIG_ATH11K=y
# CONFIG_ATH11K_PCI is not set
# CONFIG_ATH11K_DEBUG is not set
# CONFIG_ATH11K_DEBUGFS is not set
# CONFIG_ATH11K_TRACING is not set
# CONFIG_ATH12K is not set
# CONFIG_WLAN_VENDOR_ATMEL is not set
# CONFIG_WLAN_VENDOR_BROADCOM is not set
# CONFIG_WLAN_VENDOR_INTEL is not set
# CONFIG_WLAN_VENDOR_INTERSIL is not set
# CONFIG_WLAN_VENDOR_MARVELL is not set
# CONFIG_WLAN_VENDOR_MEDIATEK is not set
# CONFIG_WLAN_VENDOR_MICROCHIP is not set
CONFIG_WLAN_VENDOR_PURELIFI=y
# CONFIG_PLFXLC is not set
# CONFIG_WLAN_VENDOR_RALINK is not set
# CONFIG_WLAN_VENDOR_REALTEK is not set
# CONFIG_WLAN_VENDOR_RSI is not set
CONFIG_WLAN_VENDOR_SILABS=y
# CONFIG_WFX is not set
# CONFIG_WLAN_VENDOR_ST is not set
# CONFIG_WLAN_VENDOR_TI is not set
# CONFIG_WLAN_VENDOR_ZYDAS is not set
# CONFIG_WLAN_VENDOR_QUANTENNA is not set
CONFIG_MAC80211_HWSIM=y
CONFIG_VIRT_WIFI=y
CONFIG_WAN=y
CONFIG_HDLC=y
CONFIG_HDLC_RAW=y
CONFIG_HDLC_RAW_ETH=y
CONFIG_HDLC_CISCO=y
CONFIG_HDLC_FR=y
CONFIG_HDLC_PPP=y
CONFIG_HDLC_X25=y
# CONFIG_FRAMER is not set
# CONFIG_PCI200SYN is not set
# CONFIG_WANXL is not set
# CONFIG_PC300TOO is not set
# CONFIG_FARSYNC is not set
CONFIG_LAPBETHER=y
CONFIG_IEEE802154_DRIVERS=y
# CONFIG_IEEE802154_FAKELB is not set
# CONFIG_IEEE802154_AT86RF230 is not set
# CONFIG_IEEE802154_MRF24J40 is not set
# CONFIG_IEEE802154_CC2520 is not set
CONFIG_IEEE802154_ATUSB=y
# CONFIG_IEEE802154_ADF7242 is not set
# CONFIG_IEEE802154_CA8210 is not set
# CONFIG_IEEE802154_MCR20A is not set
CONFIG_IEEE802154_HWSIM=y

#
# Wireless WAN
#
CONFIG_WWAN=y
# CONFIG_WWAN_DEBUGFS is not set
# CONFIG_WWAN_HWSIM is not set
CONFIG_MHI_WWAN_CTRL=y
# CONFIG_MHI_WWAN_MBIM is not set
# CONFIG_IOSM is not set
# CONFIG_MTK_T7XX is not set
# end of Wireless WAN

CONFIG_VMXNET3=y
# CONFIG_FUJITSU_ES is not set
CONFIG_USB4_NET=y
CONFIG_NETDEVSIM=y
CONFIG_NET_FAILOVER=y
CONFIG_ISDN=y
CONFIG_ISDN_CAPI=y
CONFIG_CAPI_TRACE=y
CONFIG_ISDN_CAPI_MIDDLEWARE=y
CONFIG_MISDN=y
CONFIG_MISDN_DSP=y
CONFIG_MISDN_L1OIP=y

#
# mISDN hardware drivers
#
# CONFIG_MISDN_HFCPCI is not set
# CONFIG_MISDN_HFCMULTI is not set
CONFIG_MISDN_HFCUSB=y
# CONFIG_MISDN_AVMFRITZ is not set
# CONFIG_MISDN_SPEEDFAX is not set
# CONFIG_MISDN_INFINEON is not set
# CONFIG_MISDN_W6692 is not set
# CONFIG_MISDN_NETJET is not set

#
# Input device support
#
CONFIG_INPUT=y
CONFIG_INPUT_LEDS=y
CONFIG_INPUT_FF_MEMLESS=y
CONFIG_INPUT_SPARSEKMAP=y
# CONFIG_INPUT_MATRIXKMAP is not set
CONFIG_INPUT_VIVALDIFMAP=y

#
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
CONFIG_INPUT_MOUSEDEV_PSAUX=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
CONFIG_INPUT_JOYDEV=y
CONFIG_INPUT_EVDEV=y
# CONFIG_INPUT_EVBUG is not set

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
# CONFIG_KEYBOARD_ADC is not set
# CONFIG_KEYBOARD_ADP5588 is not set
# CONFIG_KEYBOARD_ADP5589 is not set
CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_QT1050 is not set
# CONFIG_KEYBOARD_QT1070 is not set
# CONFIG_KEYBOARD_QT2160 is not set
# CONFIG_KEYBOARD_DLINK_DIR685 is not set
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_GPIO is not set
# CONFIG_KEYBOARD_GPIO_POLLED is not set
# CONFIG_KEYBOARD_TCA6416 is not set
# CONFIG_KEYBOARD_TCA8418 is not set
# CONFIG_KEYBOARD_MATRIX is not set
# CONFIG_KEYBOARD_LM8323 is not set
# CONFIG_KEYBOARD_LM8333 is not set
# CONFIG_KEYBOARD_MAX7359 is not set
# CONFIG_KEYBOARD_MCS is not set
# CONFIG_KEYBOARD_MPR121 is not set
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_OPENCORES is not set
# CONFIG_KEYBOARD_PINEPHONE is not set
# CONFIG_KEYBOARD_SAMSUNG is not set
# CONFIG_KEYBOARD_STOWAWAY is not set
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_OMAP4 is not set
# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set
# CONFIG_KEYBOARD_TWL4030 is not set
# CONFIG_KEYBOARD_XTKBD is not set
# CONFIG_KEYBOARD_CAP11XX is not set
# CONFIG_KEYBOARD_BCM is not set
# CONFIG_KEYBOARD_CYPRESS_SF is not set
CONFIG_INPUT_MOUSE=y
CONFIG_MOUSE_PS2=y
CONFIG_MOUSE_PS2_ALPS=y
CONFIG_MOUSE_PS2_BYD=y
CONFIG_MOUSE_PS2_LOGIPS2PP=y
CONFIG_MOUSE_PS2_SYNAPTICS=y
CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y
CONFIG_MOUSE_PS2_CYPRESS=y
CONFIG_MOUSE_PS2_LIFEBOOK=y
CONFIG_MOUSE_PS2_TRACKPOINT=y
# CONFIG_MOUSE_PS2_ELANTECH is not set
# CONFIG_MOUSE_PS2_SENTELIC is not set
# CONFIG_MOUSE_PS2_TOUCHKIT is not set
CONFIG_MOUSE_PS2_FOCALTECH=y
# CONFIG_MOUSE_PS2_VMMOUSE is not set
CONFIG_MOUSE_PS2_SMBUS=y
# CONFIG_MOUSE_SERIAL is not set
CONFIG_MOUSE_APPLETOUCH=y
CONFIG_MOUSE_BCM5974=y
# CONFIG_MOUSE_CYAPA is not set
# CONFIG_MOUSE_ELAN_I2C is not set
# CONFIG_MOUSE_VSXXXAA is not set
# CONFIG_MOUSE_GPIO is not set
# CONFIG_MOUSE_SYNAPTICS_I2C is not set
CONFIG_MOUSE_SYNAPTICS_USB=y
CONFIG_INPUT_JOYSTICK=y
# CONFIG_JOYSTICK_ANALOG is not set
# CONFIG_JOYSTICK_A3D is not set
# CONFIG_JOYSTICK_ADC is not set
# CONFIG_JOYSTICK_ADI is not set
# CONFIG_JOYSTICK_COBRA is not set
# CONFIG_JOYSTICK_GF2K is not set
# CONFIG_JOYSTICK_GRIP is not set
# CONFIG_JOYSTICK_GRIP_MP is not set
# CONFIG_JOYSTICK_GUILLEMOT is not set
# CONFIG_JOYSTICK_INTERACT is not set
# CONFIG_JOYSTICK_SIDEWINDER is not set
# CONFIG_JOYSTICK_TMDC is not set
CONFIG_JOYSTICK_IFORCE=y
CONFIG_JOYSTICK_IFORCE_USB=y
# CONFIG_JOYSTICK_IFORCE_232 is not set
# CONFIG_JOYSTICK_WARRIOR is not set
# CONFIG_JOYSTICK_MAGELLAN is not set
# CONFIG_JOYSTICK_SPACEORB is not set
# CONFIG_JOYSTICK_SPACEBALL is not set
# CONFIG_JOYSTICK_STINGER is not set
# CONFIG_JOYSTICK_TWIDJOY is not set
# CONFIG_JOYSTICK_ZHENHUA is not set
# CONFIG_JOYSTICK_DB9 is not set
# CONFIG_JOYSTICK_GAMECON is not set
# CONFIG_JOYSTICK_TURBOGRAFX is not set
# CONFIG_JOYSTICK_AS5011 is not set
# CONFIG_JOYSTICK_JOYDUMP is not set
CONFIG_JOYSTICK_XPAD=y
CONFIG_JOYSTICK_XPAD_FF=y
CONFIG_JOYSTICK_XPAD_LEDS=y
# CONFIG_JOYSTICK_WALKERA0701 is not set
# CONFIG_JOYSTICK_PSXPAD_SPI is not set
# CONFIG_JOYSTICK_PXRC is not set
# CONFIG_JOYSTICK_QWIIC is not set
# CONFIG_JOYSTICK_FSIA6B is not set
# CONFIG_JOYSTICK_SENSEHAT is not set
# CONFIG_JOYSTICK_SEESAW is not set
CONFIG_INPUT_TABLET=y
CONFIG_TABLET_USB_ACECAD=y
CONFIG_TABLET_USB_AIPTEK=y
CONFIG_TABLET_USB_HANWANG=y
CONFIG_TABLET_USB_KBTAB=y
CONFIG_TABLET_USB_PEGASUS=y
# CONFIG_TABLET_SERIAL_WACOM4 is not set
CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_ADS7846 is not set
# CONFIG_TOUCHSCREEN_AD7877 is not set
# CONFIG_TOUCHSCREEN_AD7879 is not set
# CONFIG_TOUCHSCREEN_ADC is not set
# CONFIG_TOUCHSCREEN_AR1021_I2C is not set
# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set
# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set
# CONFIG_TOUCHSCREEN_BU21013 is not set
# CONFIG_TOUCHSCREEN_BU21029 is not set
# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set
# CONFIG_TOUCHSCREEN_CHIPONE_ICN8505 is not set
# CONFIG_TOUCHSCREEN_CY8CTMA140 is not set
# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set
# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set
# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set
# CONFIG_TOUCHSCREEN_CYTTSP5 is not set
# CONFIG_TOUCHSCREEN_DYNAPRO is not set
# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set
# CONFIG_TOUCHSCREEN_EETI is not set
# CONFIG_TOUCHSCREEN_EGALAX is not set
# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set
# CONFIG_TOUCHSCREEN_EXC3000 is not set
# CONFIG_TOUCHSCREEN_FUJITSU is not set
# CONFIG_TOUCHSCREEN_GOODIX is not set
# CONFIG_TOUCHSCREEN_GOODIX_BERLIN_I2C is not set
# CONFIG_TOUCHSCREEN_GOODIX_BERLIN_SPI is not set
# CONFIG_TOUCHSCREEN_HIDEEP is not set
# CONFIG_TOUCHSCREEN_HYCON_HY46XX is not set
# CONFIG_TOUCHSCREEN_HYNITRON_CSTXXX is not set
# CONFIG_TOUCHSCREEN_ILI210X is not set
# CONFIG_TOUCHSCREEN_ILITEK is not set
# CONFIG_TOUCHSCREEN_S6SY761 is not set
# CONFIG_TOUCHSCREEN_GUNZE is not set
# CONFIG_TOUCHSCREEN_EKTF2127 is not set
# CONFIG_TOUCHSCREEN_ELAN is not set
# CONFIG_TOUCHSCREEN_ELO is not set
# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
# CONFIG_TOUCHSCREEN_WACOM_I2C is not set
# CONFIG_TOUCHSCREEN_MAX11801 is not set
# CONFIG_TOUCHSCREEN_MCS5000 is not set
# CONFIG_TOUCHSCREEN_MMS114 is not set
# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set
# CONFIG_TOUCHSCREEN_MSG2638 is not set
# CONFIG_TOUCHSCREEN_MTOUCH is not set
# CONFIG_TOUCHSCREEN_NOVATEK_NVT_TS is not set
# CONFIG_TOUCHSCREEN_IMAGIS is not set
# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set
# CONFIG_TOUCHSCREEN_INEXIO is not set
# CONFIG_TOUCHSCREEN_PENMOUNT is not set
# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set
# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
# CONFIG_TOUCHSCREEN_PIXCIR is not set
# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set
CONFIG_TOUCHSCREEN_USB_COMPOSITE=y
CONFIG_TOUCHSCREEN_USB_EGALAX=y
CONFIG_TOUCHSCREEN_USB_PANJIT=y
CONFIG_TOUCHSCREEN_USB_3M=y
CONFIG_TOUCHSCREEN_USB_ITM=y
CONFIG_TOUCHSCREEN_USB_ETURBO=y
CONFIG_TOUCHSCREEN_USB_GUNZE=y
CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y
CONFIG_TOUCHSCREEN_USB_IRTOUCH=y
CONFIG_TOUCHSCREEN_USB_IDEALTEK=y
CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y
CONFIG_TOUCHSCREEN_USB_GOTOP=y
CONFIG_TOUCHSCREEN_USB_JASTEC=y
CONFIG_TOUCHSCREEN_USB_ELO=y
CONFIG_TOUCHSCREEN_USB_E2I=y
CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y
CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y
CONFIG_TOUCHSCREEN_USB_NEXIO=y
CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y
# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
# CONFIG_TOUCHSCREEN_TSC_SERIO is not set
# CONFIG_TOUCHSCREEN_TSC2004 is not set
# CONFIG_TOUCHSCREEN_TSC2005 is not set
# CONFIG_TOUCHSCREEN_TSC2007 is not set
# CONFIG_TOUCHSCREEN_RM_TS is not set
# CONFIG_TOUCHSCREEN_SILEAD is not set
# CONFIG_TOUCHSCREEN_SIS_I2C is not set
# CONFIG_TOUCHSCREEN_ST1232 is not set
# CONFIG_TOUCHSCREEN_STMFTS is not set
CONFIG_TOUCHSCREEN_SUR40=y
# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set
# CONFIG_TOUCHSCREEN_SX8654 is not set
# CONFIG_TOUCHSCREEN_TPS6507X is not set
# CONFIG_TOUCHSCREEN_ZET6223 is not set
# CONFIG_TOUCHSCREEN_ZFORCE is not set
# CONFIG_TOUCHSCREEN_COLIBRI_VF50 is not set
# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set
# CONFIG_TOUCHSCREEN_IQS5XX is not set
# CONFIG_TOUCHSCREEN_IQS7211 is not set
# CONFIG_TOUCHSCREEN_ZINITIX is not set
# CONFIG_TOUCHSCREEN_HIMAX_HX83112B is not set
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_AD714X is not set
# CONFIG_INPUT_ATMEL_CAPTOUCH is not set
# CONFIG_INPUT_BMA150 is not set
# CONFIG_INPUT_E3X0_BUTTON is not set
# CONFIG_INPUT_PCSPKR is not set
# CONFIG_INPUT_MMA8450 is not set
# CONFIG_INPUT_APANEL is not set
# CONFIG_INPUT_GPIO_BEEPER is not set
# CONFIG_INPUT_GPIO_DECODER is not set
# CONFIG_INPUT_GPIO_VIBRA is not set
# CONFIG_INPUT_ATLAS_BTNS is not set
CONFIG_INPUT_ATI_REMOTE2=y
CONFIG_INPUT_KEYSPAN_REMOTE=y
# CONFIG_INPUT_KXTJ9 is not set
CONFIG_INPUT_POWERMATE=y
CONFIG_INPUT_YEALINK=y
CONFIG_INPUT_CM109=y
# CONFIG_INPUT_REGULATOR_HAPTIC is not set
# CONFIG_INPUT_RETU_PWRBUTTON is not set
# CONFIG_INPUT_TWL4030_PWRBUTTON is not set
# CONFIG_INPUT_TWL4030_VIBRA is not set
CONFIG_INPUT_UINPUT=y
# CONFIG_INPUT_PCF8574 is not set
# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
# CONFIG_INPUT_DA7280_HAPTICS is not set
# CONFIG_INPUT_ADXL34X is not set
# CONFIG_INPUT_IBM_PANEL is not set
CONFIG_INPUT_IMS_PCU=y
# CONFIG_INPUT_IQS269A is not set
# CONFIG_INPUT_IQS626A is not set
# CONFIG_INPUT_IQS7222 is not set
# CONFIG_INPUT_CMA3000 is not set
# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set
# CONFIG_INPUT_DRV260X_HAPTICS is not set
# CONFIG_INPUT_DRV2665_HAPTICS is not set
# CONFIG_INPUT_DRV2667_HAPTICS is not set
CONFIG_RMI4_CORE=y
# CONFIG_RMI4_I2C is not set
# CONFIG_RMI4_SPI is not set
# CONFIG_RMI4_SMB is not set
CONFIG_RMI4_F03=y
CONFIG_RMI4_F03_SERIO=y
CONFIG_RMI4_2D_SENSOR=y
CONFIG_RMI4_F11=y
CONFIG_RMI4_F12=y
CONFIG_RMI4_F30=y
# CONFIG_RMI4_F34 is not set
# CONFIG_RMI4_F3A is not set
# CONFIG_RMI4_F54 is not set
# CONFIG_RMI4_F55 is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_SERIO_SERPORT=y
# CONFIG_SERIO_CT82C710 is not set
# CONFIG_SERIO_PARKBD is not set
# CONFIG_SERIO_PCIPS2 is not set
CONFIG_SERIO_LIBPS2=y
# CONFIG_SERIO_RAW is not set
# CONFIG_SERIO_ALTERA_PS2 is not set
# CONFIG_SERIO_PS2MULT is not set
# CONFIG_SERIO_ARC_PS2 is not set
# CONFIG_SERIO_APBPS2 is not set
# CONFIG_SERIO_GPIO_PS2 is not set
CONFIG_USERIO=y
# CONFIG_GAMEPORT is not set
# end of Hardware I/O ports
# end of Input device support

#
# Character devices
#
CONFIG_TTY=y
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_VT_CONSOLE_SLEEP=y
CONFIG_VT_HW_CONSOLE_BINDING=y
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
CONFIG_LEGACY_TIOCSTI=y
CONFIG_LDISC_AUTOLOAD=y

#
# Serial drivers
#
CONFIG_SERIAL_EARLYCON=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
CONFIG_SERIAL_8250_PNP=y
# CONFIG_SERIAL_8250_16550A_VARIANTS is not set
# CONFIG_SERIAL_8250_FINTEK is not set
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_DMA=y
CONFIG_SERIAL_8250_PCILIB=y
CONFIG_SERIAL_8250_PCI=y
# CONFIG_SERIAL_8250_EXAR is not set
# CONFIG_SERIAL_8250_CS is not set
CONFIG_SERIAL_8250_NR_UARTS=32
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
# CONFIG_SERIAL_8250_PCI1XXXX is not set
CONFIG_SERIAL_8250_SHARE_IRQ=y
CONFIG_SERIAL_8250_DETECT_IRQ=y
CONFIG_SERIAL_8250_RSA=y
CONFIG_SERIAL_8250_DWLIB=y
# CONFIG_SERIAL_8250_DW is not set
# CONFIG_SERIAL_8250_RT288X is not set
CONFIG_SERIAL_8250_LPSS=y
CONFIG_SERIAL_8250_MID=y
CONFIG_SERIAL_8250_PERICOM=y
# CONFIG_SERIAL_OF_PLATFORM is not set

#
# Non-8250 serial port support
#
# CONFIG_SERIAL_MAX3100 is not set
# CONFIG_SERIAL_MAX310X is not set
# CONFIG_SERIAL_UARTLITE is not set
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_JSM is not set
# CONFIG_SERIAL_SIFIVE is not set
# CONFIG_SERIAL_LANTIQ is not set
# CONFIG_SERIAL_SCCNXP is not set
# CONFIG_SERIAL_SC16IS7XX is not set
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
# CONFIG_SERIAL_ALTERA_UART is not set
# CONFIG_SERIAL_XILINX_PS_UART is not set
# CONFIG_SERIAL_ARC is not set
# CONFIG_SERIAL_RP2 is not set
# CONFIG_SERIAL_FSL_LPUART is not set
# CONFIG_SERIAL_FSL_LINFLEXUART is not set
# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set
# CONFIG_SERIAL_SPRD is not set
# end of Serial drivers

CONFIG_SERIAL_MCTRL_GPIO=y
CONFIG_SERIAL_NONSTANDARD=y
# CONFIG_MOXA_INTELLIO is not set
# CONFIG_MOXA_SMARTIO is not set
CONFIG_N_HDLC=y
# CONFIG_IPWIRELESS is not set
CONFIG_N_GSM=y
CONFIG_NOZOMI=y
CONFIG_NULL_TTY=y
CONFIG_HVC_DRIVER=y
CONFIG_SERIAL_DEV_BUS=y
CONFIG_SERIAL_DEV_CTRL_TTYPORT=y
CONFIG_TTY_PRINTK=y
CONFIG_TTY_PRINTK_LEVEL=6
# CONFIG_PRINTER is not set
# CONFIG_PPDEV is not set
CONFIG_VIRTIO_CONSOLE=y
# CONFIG_IPMI_HANDLER is not set
# CONFIG_SSIF_IPMI_BMC is not set
# CONFIG_IPMB_DEVICE_INTERFACE is not set
CONFIG_HW_RANDOM=y
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
# CONFIG_HW_RANDOM_INTEL is not set
# CONFIG_HW_RANDOM_AMD is not set
# CONFIG_HW_RANDOM_BA431 is not set
# CONFIG_HW_RANDOM_VIA is not set
CONFIG_HW_RANDOM_VIRTIO=y
# CONFIG_HW_RANDOM_CCTRNG is not set
# CONFIG_HW_RANDOM_XIPHERA is not set
# CONFIG_APPLICOM is not set
# CONFIG_MWAVE is not set
# CONFIG_DEVMEM is not set
CONFIG_NVRAM=y
# CONFIG_DEVPORT is not set
CONFIG_HPET=y
CONFIG_HPET_MMAP=y
CONFIG_HPET_MMAP_DEFAULT=y
# CONFIG_HANGCHECK_TIMER is not set
CONFIG_TCG_TPM=y
CONFIG_TCG_TPM2_HMAC=y
# CONFIG_HW_RANDOM_TPM is not set
CONFIG_TCG_TIS_CORE=y
CONFIG_TCG_TIS=y
# CONFIG_TCG_TIS_SPI is not set
# CONFIG_TCG_TIS_I2C is not set
# CONFIG_TCG_TIS_I2C_CR50 is not set
# CONFIG_TCG_TIS_I2C_ATMEL is not set
# CONFIG_TCG_TIS_I2C_INFINEON is not set
# CONFIG_TCG_TIS_I2C_NUVOTON is not set
# CONFIG_TCG_NSC is not set
# CONFIG_TCG_ATMEL is not set
# CONFIG_TCG_INFINEON is not set
CONFIG_TCG_CRB=y
# CONFIG_TCG_VTPM_PROXY is not set
# CONFIG_TCG_TIS_ST33ZP24_I2C is not set
# CONFIG_TCG_TIS_ST33ZP24_SPI is not set
# CONFIG_TELCLOCK is not set
# CONFIG_XILLYBUS is not set
# CONFIG_XILLYUSB is not set
# end of Character devices

#
# I2C support
#
CONFIG_I2C=y
CONFIG_ACPI_I2C_OPREGION=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y

#
# Multiplexer I2C Chip support
#
# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set
# CONFIG_I2C_MUX_GPIO is not set
# CONFIG_I2C_MUX_GPMUX is not set
# CONFIG_I2C_MUX_LTC4306 is not set
# CONFIG_I2C_MUX_PCA9541 is not set
# CONFIG_I2C_MUX_PCA954x is not set
CONFIG_I2C_MUX_REG=y
# CONFIG_I2C_MUX_MLXCPLD is not set
# end of Multiplexer I2C Chip support

CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_SMBUS=y
CONFIG_I2C_ALGOBIT=y

#
# I2C Hardware Bus support
#

#
# PC SMBus host controller drivers
#
# CONFIG_I2C_ALI1535 is not set
# CONFIG_I2C_ALI1563 is not set
# CONFIG_I2C_ALI15X3 is not set
# CONFIG_I2C_AMD756 is not set
# CONFIG_I2C_AMD8111 is not set
# CONFIG_I2C_AMD_MP2 is not set
CONFIG_I2C_I801=y
# CONFIG_I2C_ISCH is not set
# CONFIG_I2C_ISMT is not set
# CONFIG_I2C_PIIX4 is not set
# CONFIG_I2C_CHT_WC is not set
# CONFIG_I2C_NFORCE2 is not set
# CONFIG_I2C_NVIDIA_GPU is not set
# CONFIG_I2C_SIS5595 is not set
# CONFIG_I2C_SIS630 is not set
# CONFIG_I2C_SIS96X is not set
# CONFIG_I2C_VIA is not set
# CONFIG_I2C_VIAPRO is not set

#
# ACPI drivers
#
# CONFIG_I2C_SCMI is not set

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
# CONFIG_I2C_CBUS_GPIO is not set
CONFIG_I2C_DESIGNWARE_CORE=y
# CONFIG_I2C_DESIGNWARE_SLAVE is not set
CONFIG_I2C_DESIGNWARE_PLATFORM=y
# CONFIG_I2C_DESIGNWARE_BAYTRAIL is not set
# CONFIG_I2C_DESIGNWARE_PCI is not set
# CONFIG_I2C_EMEV2 is not set
# CONFIG_I2C_GPIO is not set
# CONFIG_I2C_OCORES is not set
# CONFIG_I2C_PCA_PLATFORM is not set
# CONFIG_I2C_RK3X is not set
# CONFIG_I2C_SIMTEC is not set
# CONFIG_I2C_XILINX is not set

#
# External I2C/SMBus adapter drivers
#
CONFIG_I2C_DIOLAN_U2C=y
CONFIG_I2C_DLN2=y
# CONFIG_I2C_CP2615 is not set
# CONFIG_I2C_PARPORT is not set
# CONFIG_I2C_PCI1XXXX is not set
CONFIG_I2C_ROBOTFUZZ_OSIF=y
# CONFIG_I2C_TAOS_EVM is not set
CONFIG_I2C_TINY_USB=y
CONFIG_I2C_VIPERBOARD=y

#
# Other I2C/SMBus bus drivers
#
# CONFIG_I2C_MLXCPLD is not set
# CONFIG_I2C_VIRTIO is not set
# end of I2C Hardware Bus support

# CONFIG_I2C_STUB is not set
CONFIG_I2C_SLAVE=y
CONFIG_I2C_SLAVE_EEPROM=y
# CONFIG_I2C_SLAVE_TESTUNIT is not set
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set
# end of I2C support

# CONFIG_I3C is not set
CONFIG_SPI=y
# CONFIG_SPI_DEBUG is not set
CONFIG_SPI_MASTER=y
# CONFIG_SPI_MEM is not set

#
# SPI Master Controller Drivers
#
# CONFIG_SPI_ALTERA is not set
# CONFIG_SPI_AXI_SPI_ENGINE is not set
# CONFIG_SPI_BITBANG is not set
# CONFIG_SPI_BUTTERFLY is not set
# CONFIG_SPI_CADENCE is not set
# CONFIG_SPI_CADENCE_QUADSPI is not set
# CONFIG_SPI_DESIGNWARE is not set
CONFIG_SPI_DLN2=y
# CONFIG_SPI_GPIO is not set
# CONFIG_SPI_LM70_LLP is not set
# CONFIG_SPI_FSL_SPI is not set
# CONFIG_SPI_MICROCHIP_CORE is not set
# CONFIG_SPI_MICROCHIP_CORE_QSPI is not set
# CONFIG_SPI_LANTIQ_SSC is not set
# CONFIG_SPI_OC_TINY is not set
# CONFIG_SPI_PCI1XXXX is not set
# CONFIG_SPI_PXA2XX is not set
# CONFIG_SPI_SC18IS602 is not set
# CONFIG_SPI_SIFIVE is not set
# CONFIG_SPI_MXIC is not set
# CONFIG_SPI_XCOMM is not set
# CONFIG_SPI_XILINX is not set
# CONFIG_SPI_AMD is not set

#
# SPI Multiplexer support
#
# CONFIG_SPI_MUX is not set

#
# SPI Protocol Masters
#
# CONFIG_SPI_SPIDEV is not set
# CONFIG_SPI_LOOPBACK_TEST is not set
# CONFIG_SPI_TLE62X0 is not set
# CONFIG_SPI_SLAVE is not set
CONFIG_SPI_DYNAMIC=y
# CONFIG_SPMI is not set
# CONFIG_HSI is not set
CONFIG_PPS=y
# CONFIG_PPS_DEBUG is not set

#
# PPS clients support
#
# CONFIG_PPS_CLIENT_KTIMER is not set
# CONFIG_PPS_CLIENT_LDISC is not set
# CONFIG_PPS_CLIENT_PARPORT is not set
# CONFIG_PPS_CLIENT_GPIO is not set

#
# PPS generators support
#

#
# PTP clock support
#
CONFIG_PTP_1588_CLOCK=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y

#
# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks.
#
CONFIG_PTP_1588_CLOCK_KVM=y
# CONFIG_PTP_1588_CLOCK_IDT82P33 is not set
# CONFIG_PTP_1588_CLOCK_IDTCM is not set
# CONFIG_PTP_1588_CLOCK_FC3W is not set
# CONFIG_PTP_1588_CLOCK_MOCK is not set
# CONFIG_PTP_1588_CLOCK_VMW is not set
# CONFIG_PTP_1588_CLOCK_OCP is not set
# end of PTP clock support

# CONFIG_PINCTRL is not set
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_FASTPATH_LIMIT=512
CONFIG_OF_GPIO=y
CONFIG_GPIO_ACPI=y
CONFIG_GPIOLIB_IRQCHIP=y
# CONFIG_DEBUG_GPIO is not set
# CONFIG_GPIO_SYSFS is not set
# CONFIG_GPIO_CDEV is not set

#
# Memory mapped GPIO drivers
#
# CONFIG_GPIO_74XX_MMIO is not set
# CONFIG_GPIO_ALTERA is not set
# CONFIG_GPIO_AMDPT is not set
# CONFIG_GPIO_CADENCE is not set
# CONFIG_GPIO_DWAPB is not set
# CONFIG_GPIO_FTGPIO010 is not set
# CONFIG_GPIO_GENERIC_PLATFORM is not set
# CONFIG_GPIO_GRGPIO is not set
# CONFIG_GPIO_HLWD is not set
# CONFIG_GPIO_ICH is not set
# CONFIG_GPIO_LOGICVC is not set
# CONFIG_GPIO_MB86S7X is not set
# CONFIG_GPIO_SIFIVE is not set
# CONFIG_GPIO_SYSCON is not set
# CONFIG_GPIO_XILINX is not set
# CONFIG_GPIO_AMD_FCH is not set
# end of Memory mapped GPIO drivers

#
# Port-mapped I/O GPIO drivers
#
# CONFIG_GPIO_VX855 is not set
# CONFIG_GPIO_F7188X is not set
# CONFIG_GPIO_IT87 is not set
# CONFIG_GPIO_SCH311X is not set
# CONFIG_GPIO_WINBOND is not set
# CONFIG_GPIO_WS16C48 is not set
# end of Port-mapped I/O GPIO drivers

#
# I2C GPIO expanders
#
# CONFIG_GPIO_ADNP is not set
# CONFIG_GPIO_FXL6408 is not set
# CONFIG_GPIO_DS4520 is not set
# CONFIG_GPIO_GW_PLD is not set
# CONFIG_GPIO_MAX7300 is not set
# CONFIG_GPIO_MAX732X is not set
# CONFIG_GPIO_PCA953X is not set
# CONFIG_GPIO_PCA9570 is not set
# CONFIG_GPIO_PCF857X is not set
# CONFIG_GPIO_TPIC2810 is not set
# end of I2C GPIO expanders

#
# MFD GPIO expanders
#
CONFIG_GPIO_DLN2=y
# CONFIG_GPIO_ELKHARTLAKE is not set
# CONFIG_GPIO_TWL4030 is not set
# end of MFD GPIO expanders

#
# PCI GPIO expanders
#
# CONFIG_GPIO_AMD8111 is not set
# CONFIG_GPIO_BT8XX is not set
# CONFIG_GPIO_ML_IOH is not set
# CONFIG_GPIO_PCI_IDIO_16 is not set
# CONFIG_GPIO_PCIE_IDIO_24 is not set
# CONFIG_GPIO_RDC321X is not set
# CONFIG_GPIO_SODAVILLE is not set
# end of PCI GPIO expanders

#
# SPI GPIO expanders
#
# CONFIG_GPIO_74X164 is not set
# CONFIG_GPIO_MAX3191X is not set
# CONFIG_GPIO_MAX7301 is not set
# CONFIG_GPIO_MC33880 is not set
# CONFIG_GPIO_PISOSR is not set
# CONFIG_GPIO_XRA1403 is not set
# end of SPI GPIO expanders

#
# USB GPIO expanders
#
CONFIG_GPIO_VIPERBOARD=y
# end of USB GPIO expanders

#
# Virtual GPIO drivers
#
# CONFIG_GPIO_AGGREGATOR is not set
# CONFIG_GPIO_LATCH is not set
# CONFIG_GPIO_MOCKUP is not set
# CONFIG_GPIO_VIRTIO is not set
# CONFIG_GPIO_SIM is not set
# end of Virtual GPIO drivers

# CONFIG_W1 is not set
# CONFIG_POWER_RESET is not set
CONFIG_POWER_SUPPLY=y
# CONFIG_POWER_SUPPLY_DEBUG is not set
CONFIG_POWER_SUPPLY_HWMON=y
# CONFIG_GENERIC_ADC_BATTERY is not set
# CONFIG_IP5XXX_POWER is not set
# CONFIG_TEST_POWER is not set
# CONFIG_CHARGER_ADP5061 is not set
# CONFIG_BATTERY_CW2015 is not set
# CONFIG_BATTERY_DS2780 is not set
# CONFIG_BATTERY_DS2781 is not set
# CONFIG_BATTERY_DS2782 is not set
# CONFIG_BATTERY_SAMSUNG_SDI is not set
# CONFIG_BATTERY_SBS is not set
# CONFIG_CHARGER_SBS is not set
# CONFIG_MANAGER_SBS is not set
# CONFIG_BATTERY_BQ27XXX is not set
# CONFIG_BATTERY_MAX17040 is not set
# CONFIG_BATTERY_MAX17042 is not set
CONFIG_CHARGER_ISP1704=y
# CONFIG_CHARGER_MAX8903 is not set
# CONFIG_CHARGER_TWL4030 is not set
# CONFIG_CHARGER_LP8727 is not set
# CONFIG_CHARGER_GPIO is not set
# CONFIG_CHARGER_MANAGER is not set
# CONFIG_CHARGER_LT3651 is not set
# CONFIG_CHARGER_LTC4162L is not set
# CONFIG_CHARGER_DETECTOR_MAX14656 is not set
# CONFIG_CHARGER_MAX77976 is not set
# CONFIG_CHARGER_BQ2415X is not set
CONFIG_CHARGER_BQ24190=y
# CONFIG_CHARGER_BQ24257 is not set
# CONFIG_CHARGER_BQ24735 is not set
# CONFIG_CHARGER_BQ2515X is not set
# CONFIG_CHARGER_BQ25890 is not set
# CONFIG_CHARGER_BQ25980 is not set
# CONFIG_CHARGER_BQ256XX is not set
# CONFIG_CHARGER_SMB347 is not set
# CONFIG_BATTERY_GAUGE_LTC2941 is not set
# CONFIG_BATTERY_GOLDFISH is not set
# CONFIG_BATTERY_RT5033 is not set
# CONFIG_CHARGER_RT9455 is not set
# CONFIG_CHARGER_RT9467 is not set
# CONFIG_CHARGER_RT9471 is not set
# CONFIG_CHARGER_UCS1002 is not set
# CONFIG_CHARGER_BD99954 is not set
# CONFIG_BATTERY_UG3105 is not set
# CONFIG_FUEL_GAUGE_MM8013 is not set
CONFIG_HWMON=y
# CONFIG_HWMON_DEBUG_CHIP is not set

#
# Native drivers
#
# CONFIG_SENSORS_ABITUGURU is not set
# CONFIG_SENSORS_ABITUGURU3 is not set
# CONFIG_SENSORS_AD7314 is not set
# CONFIG_SENSORS_AD7414 is not set
# CONFIG_SENSORS_AD7418 is not set
# CONFIG_SENSORS_ADM1021 is not set
# CONFIG_SENSORS_ADM1025 is not set
# CONFIG_SENSORS_ADM1026 is not set
# CONFIG_SENSORS_ADM1029 is not set
# CONFIG_SENSORS_ADM1031 is not set
# CONFIG_SENSORS_ADM1177 is not set
# CONFIG_SENSORS_ADM9240 is not set
# CONFIG_SENSORS_ADT7310 is not set
# CONFIG_SENSORS_ADT7410 is not set
# CONFIG_SENSORS_ADT7411 is not set
# CONFIG_SENSORS_ADT7462 is not set
# CONFIG_SENSORS_ADT7470 is not set
# CONFIG_SENSORS_ADT7475 is not set
# CONFIG_SENSORS_AHT10 is not set
# CONFIG_SENSORS_AQUACOMPUTER_D5NEXT is not set
# CONFIG_SENSORS_AS370 is not set
# CONFIG_SENSORS_ASC7621 is not set
# CONFIG_SENSORS_ASUS_ROG_RYUJIN is not set
# CONFIG_SENSORS_AXI_FAN_CONTROL is not set
# CONFIG_SENSORS_K8TEMP is not set
# CONFIG_SENSORS_K10TEMP is not set
# CONFIG_SENSORS_FAM15H_POWER is not set
# CONFIG_SENSORS_APPLESMC is not set
# CONFIG_SENSORS_ASB100 is not set
# CONFIG_SENSORS_ATXP1 is not set
# CONFIG_SENSORS_CHIPCAP2 is not set
# CONFIG_SENSORS_CORSAIR_CPRO is not set
# CONFIG_SENSORS_CORSAIR_PSU is not set
# CONFIG_SENSORS_DRIVETEMP is not set
# CONFIG_SENSORS_DS620 is not set
# CONFIG_SENSORS_DS1621 is not set
# CONFIG_SENSORS_DELL_SMM is not set
# CONFIG_SENSORS_I5K_AMB is not set
# CONFIG_SENSORS_F71805F is not set
# CONFIG_SENSORS_F71882FG is not set
# CONFIG_SENSORS_F75375S is not set
# CONFIG_SENSORS_FSCHMD is not set
# CONFIG_SENSORS_FTSTEUTATES is not set
# CONFIG_SENSORS_GIGABYTE_WATERFORCE is not set
# CONFIG_SENSORS_GL518SM is not set
# CONFIG_SENSORS_GL520SM is not set
# CONFIG_SENSORS_G760A is not set
# CONFIG_SENSORS_G762 is not set
# CONFIG_SENSORS_GPIO_FAN is not set
# CONFIG_SENSORS_HIH6130 is not set
# CONFIG_SENSORS_HS3001 is not set
# CONFIG_SENSORS_IIO_HWMON is not set
# CONFIG_SENSORS_I5500 is not set
# CONFIG_SENSORS_CORETEMP is not set
# CONFIG_SENSORS_IT87 is not set
# CONFIG_SENSORS_JC42 is not set
# CONFIG_SENSORS_POWERZ is not set
# CONFIG_SENSORS_POWR1220 is not set
# CONFIG_SENSORS_LINEAGE is not set
# CONFIG_SENSORS_LTC2945 is not set
# CONFIG_SENSORS_LTC2947_I2C is not set
# CONFIG_SENSORS_LTC2947_SPI is not set
# CONFIG_SENSORS_LTC2990 is not set
# CONFIG_SENSORS_LTC2991 is not set
# CONFIG_SENSORS_LTC2992 is not set
# CONFIG_SENSORS_LTC4151 is not set
# CONFIG_SENSORS_LTC4215 is not set
# CONFIG_SENSORS_LTC4222 is not set
# CONFIG_SENSORS_LTC4245 is not set
# CONFIG_SENSORS_LTC4260 is not set
# CONFIG_SENSORS_LTC4261 is not set
# CONFIG_SENSORS_LTC4282 is not set
# CONFIG_SENSORS_MAX1111 is not set
# CONFIG_SENSORS_MAX127 is not set
# CONFIG_SENSORS_MAX16065 is not set
# CONFIG_SENSORS_MAX1619 is not set
# CONFIG_SENSORS_MAX1668 is not set
# CONFIG_SENSORS_MAX197 is not set
# CONFIG_SENSORS_MAX31722 is not set
# CONFIG_SENSORS_MAX31730 is not set
# CONFIG_SENSORS_MAX31760 is not set
# CONFIG_MAX31827 is not set
# CONFIG_SENSORS_MAX6620 is not set
# CONFIG_SENSORS_MAX6621 is not set
# CONFIG_SENSORS_MAX6639 is not set
# CONFIG_SENSORS_MAX6642 is not set
# CONFIG_SENSORS_MAX6650 is not set
# CONFIG_SENSORS_MAX6697 is not set
# CONFIG_SENSORS_MAX31790 is not set
# CONFIG_SENSORS_MC34VR500 is not set
# CONFIG_SENSORS_MCP3021 is not set
# CONFIG_SENSORS_TC654 is not set
# CONFIG_SENSORS_TPS23861 is not set
# CONFIG_SENSORS_MR75203 is not set
# CONFIG_SENSORS_ADCXX is not set
# CONFIG_SENSORS_LM63 is not set
# CONFIG_SENSORS_LM70 is not set
# CONFIG_SENSORS_LM73 is not set
# CONFIG_SENSORS_LM75 is not set
# CONFIG_SENSORS_LM77 is not set
# CONFIG_SENSORS_LM78 is not set
# CONFIG_SENSORS_LM80 is not set
# CONFIG_SENSORS_LM83 is not set
# CONFIG_SENSORS_LM85 is not set
# CONFIG_SENSORS_LM87 is not set
# CONFIG_SENSORS_LM90 is not set
# CONFIG_SENSORS_LM92 is not set
# CONFIG_SENSORS_LM93 is not set
# CONFIG_SENSORS_LM95234 is not set
# CONFIG_SENSORS_LM95241 is not set
# CONFIG_SENSORS_LM95245 is not set
# CONFIG_SENSORS_PC87360 is not set
# CONFIG_SENSORS_PC87427 is not set
# CONFIG_SENSORS_NTC_THERMISTOR is not set
# CONFIG_SENSORS_NCT6683 is not set
# CONFIG_SENSORS_NCT6775 is not set
# CONFIG_SENSORS_NCT6775_I2C is not set
# CONFIG_SENSORS_NCT7802 is not set
# CONFIG_SENSORS_NCT7904 is not set
# CONFIG_SENSORS_NPCM7XX is not set
# CONFIG_SENSORS_NZXT_KRAKEN2 is not set
# CONFIG_SENSORS_NZXT_KRAKEN3 is not set
# CONFIG_SENSORS_NZXT_SMART2 is not set
# CONFIG_SENSORS_OCC_P8_I2C is not set
# CONFIG_SENSORS_OXP is not set
# CONFIG_SENSORS_PCF8591 is not set
# CONFIG_PMBUS is not set
# CONFIG_SENSORS_PT5161L is not set
# CONFIG_SENSORS_SBTSI is not set
# CONFIG_SENSORS_SBRMI is not set
# CONFIG_SENSORS_SHT15 is not set
# CONFIG_SENSORS_SHT21 is not set
# CONFIG_SENSORS_SHT3x is not set
# CONFIG_SENSORS_SHT4x is not set
# CONFIG_SENSORS_SHTC1 is not set
# CONFIG_SENSORS_SIS5595 is not set
# CONFIG_SENSORS_DME1737 is not set
# CONFIG_SENSORS_EMC1403 is not set
# CONFIG_SENSORS_EMC2103 is not set
# CONFIG_SENSORS_EMC2305 is not set
# CONFIG_SENSORS_EMC6W201 is not set
# CONFIG_SENSORS_SMSC47M1 is not set
# CONFIG_SENSORS_SMSC47M192 is not set
# CONFIG_SENSORS_SMSC47B397 is not set
# CONFIG_SENSORS_SCH5627 is not set
# CONFIG_SENSORS_SCH5636 is not set
# CONFIG_SENSORS_STTS751 is not set
# CONFIG_SENSORS_ADC128D818 is not set
# CONFIG_SENSORS_ADS7828 is not set
# CONFIG_SENSORS_ADS7871 is not set
# CONFIG_SENSORS_AMC6821 is not set
# CONFIG_SENSORS_INA209 is not set
# CONFIG_SENSORS_INA2XX is not set
# CONFIG_SENSORS_INA238 is not set
# CONFIG_SENSORS_INA3221 is not set
# CONFIG_SENSORS_TC74 is not set
# CONFIG_SENSORS_THMC50 is not set
# CONFIG_SENSORS_TMP102 is not set
# CONFIG_SENSORS_TMP103 is not set
# CONFIG_SENSORS_TMP108 is not set
# CONFIG_SENSORS_TMP401 is not set
# CONFIG_SENSORS_TMP421 is not set
# CONFIG_SENSORS_TMP464 is not set
# CONFIG_SENSORS_TMP513 is not set
# CONFIG_SENSORS_VIA_CPUTEMP is not set
# CONFIG_SENSORS_VIA686A is not set
# CONFIG_SENSORS_VT1211 is not set
# CONFIG_SENSORS_VT8231 is not set
# CONFIG_SENSORS_W83773G is not set
# CONFIG_SENSORS_W83781D is not set
# CONFIG_SENSORS_W83791D is not set
# CONFIG_SENSORS_W83792D is not set
# CONFIG_SENSORS_W83793 is not set
# CONFIG_SENSORS_W83795 is not set
# CONFIG_SENSORS_W83L785TS is not set
# CONFIG_SENSORS_W83L786NG is not set
# CONFIG_SENSORS_W83627HF is not set
# CONFIG_SENSORS_W83627EHF is not set
# CONFIG_SENSORS_XGENE is not set

#
# ACPI drivers
#
# CONFIG_SENSORS_ACPI_POWER is not set
# CONFIG_SENSORS_ATK0110 is not set
# CONFIG_SENSORS_ASUS_WMI is not set
# CONFIG_SENSORS_ASUS_EC is not set
# CONFIG_SENSORS_HP_WMI is not set
CONFIG_THERMAL=y
CONFIG_THERMAL_NETLINK=y
# CONFIG_THERMAL_STATISTICS is not set
# CONFIG_THERMAL_DEBUGFS is not set
CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0
CONFIG_THERMAL_HWMON=y
# CONFIG_THERMAL_OF is not set
CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set
# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set
# CONFIG_THERMAL_GOV_FAIR_SHARE is not set
CONFIG_THERMAL_GOV_STEP_WISE=y
# CONFIG_THERMAL_GOV_BANG_BANG is not set
CONFIG_THERMAL_GOV_USER_SPACE=y
# CONFIG_THERMAL_EMULATION is not set
# CONFIG_THERMAL_MMIO is not set

#
# Intel thermal drivers
#
# CONFIG_INTEL_POWERCLAMP is not set
CONFIG_X86_THERMAL_VECTOR=y
# CONFIG_X86_PKG_TEMP_THERMAL is not set
# CONFIG_INTEL_SOC_DTS_THERMAL is not set

#
# ACPI INT340X thermal drivers
#
# CONFIG_INT340X_THERMAL is not set
# end of ACPI INT340X thermal drivers

# CONFIG_INTEL_PCH_THERMAL is not set
# CONFIG_INTEL_TCC_COOLING is not set
# CONFIG_INTEL_HFI_THERMAL is not set
# end of Intel thermal drivers

# CONFIG_GENERIC_ADC_THERMAL is not set
CONFIG_WATCHDOG=y
# CONFIG_WATCHDOG_CORE is not set
# CONFIG_WATCHDOG_NOWAYOUT is not set
CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y
CONFIG_WATCHDOG_OPEN_TIMEOUT=0
# CONFIG_WATCHDOG_SYSFS is not set
# CONFIG_WATCHDOG_HRTIMER_PRETIMEOUT is not set

#
# Watchdog Pretimeout Governors
#

#
# Watchdog Device Drivers
#
# CONFIG_SOFT_WATCHDOG is not set
# CONFIG_GPIO_WATCHDOG is not set
# CONFIG_WDAT_WDT is not set
# CONFIG_XILINX_WATCHDOG is not set
# CONFIG_ZIIRAVE_WATCHDOG is not set
# CONFIG_CADENCE_WATCHDOG is not set
# CONFIG_DW_WATCHDOG is not set
# CONFIG_TWL4030_WATCHDOG is not set
# CONFIG_MAX63XX_WATCHDOG is not set
# CONFIG_RETU_WATCHDOG is not set
# CONFIG_ACQUIRE_WDT is not set
# CONFIG_ADVANTECH_WDT is not set
# CONFIG_ADVANTECH_EC_WDT is not set
# CONFIG_ALIM1535_WDT is not set
# CONFIG_ALIM7101_WDT is not set
# CONFIG_EBC_C384_WDT is not set
# CONFIG_EXAR_WDT is not set
# CONFIG_F71808E_WDT is not set
# CONFIG_SP5100_TCO is not set
# CONFIG_SBC_FITPC2_WATCHDOG is not set
# CONFIG_EUROTECH_WDT is not set
# CONFIG_IB700_WDT is not set
# CONFIG_IBMASR is not set
# CONFIG_WAFER_WDT is not set
# CONFIG_I6300ESB_WDT is not set
# CONFIG_IE6XX_WDT is not set
# CONFIG_ITCO_WDT is not set
# CONFIG_IT8712F_WDT is not set
# CONFIG_IT87_WDT is not set
# CONFIG_HP_WATCHDOG is not set
# CONFIG_SC1200_WDT is not set
# CONFIG_PC87413_WDT is not set
# CONFIG_NV_TCO is not set
# CONFIG_60XX_WDT is not set
# CONFIG_CPU5_WDT is not set
# CONFIG_SMSC_SCH311X_WDT is not set
# CONFIG_SMSC37B787_WDT is not set
# CONFIG_TQMX86_WDT is not set
# CONFIG_VIA_WDT is not set
# CONFIG_W83627HF_WDT is not set
# CONFIG_W83877F_WDT is not set
# CONFIG_W83977F_WDT is not set
# CONFIG_MACHZ_WDT is not set
# CONFIG_SBC_EPX_C3_WATCHDOG is not set
# CONFIG_INTEL_MEI_WDT is not set
# CONFIG_NI903X_WDT is not set
# CONFIG_NIC7018_WDT is not set
# CONFIG_MEN_A21_WDT is not set

#
# PCI-based Watchdog Cards
#
# CONFIG_PCIPCWATCHDOG is not set
# CONFIG_WDTPCI is not set

#
# USB-based Watchdog Cards
#
CONFIG_USBPCWATCHDOG=y
CONFIG_SSB_POSSIBLE=y
CONFIG_SSB=y
CONFIG_SSB_PCIHOST_POSSIBLE=y
# CONFIG_SSB_PCIHOST is not set
CONFIG_SSB_PCMCIAHOST_POSSIBLE=y
# CONFIG_SSB_PCMCIAHOST is not set
CONFIG_SSB_SDIOHOST_POSSIBLE=y
# CONFIG_SSB_SDIOHOST is not set
# CONFIG_SSB_DRIVER_GPIO is not set
CONFIG_BCMA_POSSIBLE=y
CONFIG_BCMA=y
CONFIG_BCMA_HOST_PCI_POSSIBLE=y
# CONFIG_BCMA_HOST_PCI is not set
# CONFIG_BCMA_HOST_SOC is not set
# CONFIG_BCMA_DRIVER_PCI is not set
# CONFIG_BCMA_DRIVER_GMAC_CMN is not set
# CONFIG_BCMA_DRIVER_GPIO is not set
# CONFIG_BCMA_DEBUG is not set

#
# Multifunction device drivers
#
CONFIG_MFD_CORE=y
# CONFIG_MFD_ACT8945A is not set
# CONFIG_MFD_AS3711 is not set
# CONFIG_MFD_SMPRO is not set
# CONFIG_MFD_AS3722 is not set
# CONFIG_PMIC_ADP5520 is not set
# CONFIG_MFD_AAT2870_CORE is not set
# CONFIG_MFD_ATMEL_FLEXCOM is not set
# CONFIG_MFD_ATMEL_HLCDC is not set
# CONFIG_MFD_BCM590XX is not set
# CONFIG_MFD_BD9571MWV is not set
# CONFIG_MFD_AXP20X_I2C is not set
# CONFIG_MFD_CS42L43_I2C is not set
# CONFIG_MFD_CS42L43_SDW is not set
# CONFIG_MFD_MADERA is not set
# CONFIG_MFD_MAX5970 is not set
# CONFIG_PMIC_DA903X is not set
# CONFIG_MFD_DA9052_SPI is not set
# CONFIG_MFD_DA9052_I2C is not set
# CONFIG_MFD_DA9055 is not set
# CONFIG_MFD_DA9062 is not set
# CONFIG_MFD_DA9063 is not set
# CONFIG_MFD_DA9150 is not set
CONFIG_MFD_DLN2=y
# CONFIG_MFD_GATEWORKS_GSC is not set
# CONFIG_MFD_MC13XXX_SPI is not set
# CONFIG_MFD_MC13XXX_I2C is not set
# CONFIG_MFD_MP2629 is not set
# CONFIG_MFD_HI6421_PMIC is not set
# CONFIG_MFD_INTEL_QUARK_I2C_GPIO is not set
CONFIG_LPC_ICH=y
# CONFIG_LPC_SCH is not set
# CONFIG_INTEL_SOC_PMIC is not set
CONFIG_INTEL_SOC_PMIC_CHTWC=y
# CONFIG_INTEL_SOC_PMIC_CHTDC_TI is not set
# CONFIG_MFD_INTEL_LPSS_ACPI is not set
# CONFIG_MFD_INTEL_LPSS_PCI is not set
# CONFIG_MFD_INTEL_PMC_BXT is not set
# CONFIG_MFD_IQS62X is not set
# CONFIG_MFD_JANZ_CMODIO is not set
# CONFIG_MFD_KEMPLD is not set
# CONFIG_MFD_88PM800 is not set
# CONFIG_MFD_88PM805 is not set
# CONFIG_MFD_88PM860X is not set
# CONFIG_MFD_MAX14577 is not set
# CONFIG_MFD_MAX77541 is not set
# CONFIG_MFD_MAX77620 is not set
# CONFIG_MFD_MAX77650 is not set
# CONFIG_MFD_MAX77686 is not set
# CONFIG_MFD_MAX77693 is not set
# CONFIG_MFD_MAX77714 is not set
# CONFIG_MFD_MAX77843 is not set
# CONFIG_MFD_MAX8907 is not set
# CONFIG_MFD_MAX8925 is not set
# CONFIG_MFD_MAX8997 is not set
# CONFIG_MFD_MAX8998 is not set
# CONFIG_MFD_MT6360 is not set
# CONFIG_MFD_MT6370 is not set
# CONFIG_MFD_MT6397 is not set
# CONFIG_MFD_MENF21BMC is not set
# CONFIG_MFD_OCELOT is not set
# CONFIG_EZX_PCAP is not set
# CONFIG_MFD_CPCAP is not set
CONFIG_MFD_VIPERBOARD=y
# CONFIG_MFD_NTXEC is not set
CONFIG_MFD_RETU=y
# CONFIG_MFD_PCF50633 is not set
# CONFIG_MFD_SY7636A is not set
# CONFIG_MFD_RDC321X is not set
# CONFIG_MFD_RT4831 is not set
# CONFIG_MFD_RT5033 is not set
# CONFIG_MFD_RT5120 is not set
# CONFIG_MFD_RC5T583 is not set
# CONFIG_MFD_RK8XX_I2C is not set
# CONFIG_MFD_RK8XX_SPI is not set
# CONFIG_MFD_RN5T618 is not set
# CONFIG_MFD_SEC_CORE is not set
# CONFIG_MFD_SI476X_CORE is not set
# CONFIG_MFD_SM501 is not set
# CONFIG_MFD_SKY81452 is not set
# CONFIG_MFD_STMPE is not set
CONFIG_MFD_SYSCON=y
# CONFIG_MFD_LP3943 is not set
# CONFIG_MFD_LP8788 is not set
# CONFIG_MFD_TI_LMU is not set
# CONFIG_MFD_PALMAS is not set
# CONFIG_TPS6105X is not set
# CONFIG_TPS65010 is not set
# CONFIG_TPS6507X is not set
# CONFIG_MFD_TPS65086 is not set
# CONFIG_MFD_TPS65090 is not set
# CONFIG_MFD_TPS65217 is not set
# CONFIG_MFD_TI_LP873X is not set
# CONFIG_MFD_TI_LP87565 is not set
# CONFIG_MFD_TPS65218 is not set
# CONFIG_MFD_TPS65219 is not set
# CONFIG_MFD_TPS6586X is not set
# CONFIG_MFD_TPS65910 is not set
# CONFIG_MFD_TPS65912_I2C is not set
# CONFIG_MFD_TPS65912_SPI is not set
# CONFIG_MFD_TPS6594_I2C is not set
# CONFIG_MFD_TPS6594_SPI is not set
CONFIG_TWL4030_CORE=y
# CONFIG_MFD_TWL4030_AUDIO is not set
# CONFIG_TWL6040_CORE is not set
# CONFIG_MFD_WL1273_CORE is not set
# CONFIG_MFD_LM3533 is not set
# CONFIG_MFD_TC3589X is not set
# CONFIG_MFD_TQMX86 is not set
# CONFIG_MFD_VX855 is not set
# CONFIG_MFD_LOCHNAGAR is not set
# CONFIG_MFD_ARIZONA_I2C is not set
# CONFIG_MFD_ARIZONA_SPI is not set
# CONFIG_MFD_WM8400 is not set
# CONFIG_MFD_WM831X_I2C is not set
# CONFIG_MFD_WM831X_SPI is not set
# CONFIG_MFD_WM8350_I2C is not set
# CONFIG_MFD_WM8994 is not set
# CONFIG_MFD_ROHM_BD718XX is not set
# CONFIG_MFD_ROHM_BD71828 is not set
# CONFIG_MFD_ROHM_BD957XMUF is not set
# CONFIG_MFD_STPMIC1 is not set
# CONFIG_MFD_STMFX is not set
# CONFIG_MFD_ATC260X_I2C is not set
# CONFIG_MFD_QCOM_PM8008 is not set
# CONFIG_RAVE_SP_CORE is not set
# CONFIG_MFD_INTEL_M10_BMC_SPI is not set
# CONFIG_MFD_RSMU_I2C is not set
# CONFIG_MFD_RSMU_SPI is not set
# end of Multifunction device drivers

CONFIG_REGULATOR=y
# CONFIG_REGULATOR_DEBUG is not set
# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
# CONFIG_REGULATOR_NETLINK_EVENTS is not set
# CONFIG_REGULATOR_88PG86X is not set
# CONFIG_REGULATOR_ACT8865 is not set
# CONFIG_REGULATOR_AD5398 is not set
# CONFIG_REGULATOR_AW37503 is not set
# CONFIG_REGULATOR_DA9121 is not set
# CONFIG_REGULATOR_DA9210 is not set
# CONFIG_REGULATOR_DA9211 is not set
# CONFIG_REGULATOR_FAN53555 is not set
# CONFIG_REGULATOR_FAN53880 is not set
# CONFIG_REGULATOR_GPIO is not set
# CONFIG_REGULATOR_ISL9305 is not set
# CONFIG_REGULATOR_ISL6271A is not set
# CONFIG_REGULATOR_LP3971 is not set
# CONFIG_REGULATOR_LP3972 is not set
# CONFIG_REGULATOR_LP872X is not set
# CONFIG_REGULATOR_LP8755 is not set
# CONFIG_REGULATOR_LTC3589 is not set
# CONFIG_REGULATOR_LTC3676 is not set
# CONFIG_REGULATOR_MAX1586 is not set
# CONFIG_REGULATOR_MAX77503 is not set
# CONFIG_REGULATOR_MAX77857 is not set
# CONFIG_REGULATOR_MAX8649 is not set
# CONFIG_REGULATOR_MAX8660 is not set
# CONFIG_REGULATOR_MAX8893 is not set
# CONFIG_REGULATOR_MAX8952 is not set
# CONFIG_REGULATOR_MAX20086 is not set
# CONFIG_REGULATOR_MAX20411 is not set
# CONFIG_REGULATOR_MAX77826 is not set
# CONFIG_REGULATOR_MCP16502 is not set
# CONFIG_REGULATOR_MP5416 is not set
# CONFIG_REGULATOR_MP8859 is not set
# CONFIG_REGULATOR_MP886X is not set
# CONFIG_REGULATOR_MPQ7920 is not set
# CONFIG_REGULATOR_MT6311 is not set
# CONFIG_REGULATOR_PCA9450 is not set
# CONFIG_REGULATOR_PF8X00 is not set
# CONFIG_REGULATOR_PFUZE100 is not set
# CONFIG_REGULATOR_PV88060 is not set
# CONFIG_REGULATOR_PV88080 is not set
# CONFIG_REGULATOR_PV88090 is not set
# CONFIG_REGULATOR_RAA215300 is not set
# CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY is not set
# CONFIG_REGULATOR_RT4801 is not set
# CONFIG_REGULATOR_RT4803 is not set
# CONFIG_REGULATOR_RT5190A is not set
# CONFIG_REGULATOR_RT5739 is not set
# CONFIG_REGULATOR_RT5759 is not set
# CONFIG_REGULATOR_RT6160 is not set
# CONFIG_REGULATOR_RT6190 is not set
# CONFIG_REGULATOR_RT6245 is not set
# CONFIG_REGULATOR_RTQ2134 is not set
# CONFIG_REGULATOR_RTMV20 is not set
# CONFIG_REGULATOR_RTQ6752 is not set
# CONFIG_REGULATOR_RTQ2208 is not set
# CONFIG_REGULATOR_SLG51000 is not set
# CONFIG_REGULATOR_SY8106A is not set
# CONFIG_REGULATOR_SY8824X is not set
# CONFIG_REGULATOR_SY8827N is not set
# CONFIG_REGULATOR_TPS51632 is not set
# CONFIG_REGULATOR_TPS62360 is not set
# CONFIG_REGULATOR_TPS6286X is not set
# CONFIG_REGULATOR_TPS6287X is not set
# CONFIG_REGULATOR_TPS65023 is not set
# CONFIG_REGULATOR_TPS6507X is not set
# CONFIG_REGULATOR_TPS65132 is not set
# CONFIG_REGULATOR_TPS6524X is not set
CONFIG_REGULATOR_TWL4030=y
# CONFIG_REGULATOR_VCTRL is not set
CONFIG_RC_CORE=y
# CONFIG_LIRC is not set
# CONFIG_RC_MAP is not set
# CONFIG_RC_DECODERS is not set
CONFIG_RC_DEVICES=y
# CONFIG_IR_ENE is not set
# CONFIG_IR_FINTEK is not set
# CONFIG_IR_GPIO_CIR is not set
# CONFIG_IR_HIX5HD2 is not set
CONFIG_IR_IGORPLUGUSB=y
CONFIG_IR_IGUANA=y
CONFIG_IR_IMON=y
# CONFIG_IR_IMON_RAW is not set
# CONFIG_IR_ITE_CIR is not set
CONFIG_IR_MCEUSB=y
# CONFIG_IR_NUVOTON is not set
CONFIG_IR_REDRAT3=y
# CONFIG_IR_SERIAL is not set
CONFIG_IR_STREAMZAP=y
# CONFIG_IR_TOY is not set
CONFIG_IR_TTUSBIR=y
# CONFIG_IR_WINBOND_CIR is not set
CONFIG_RC_ATI_REMOTE=y
# CONFIG_RC_LOOPBACK is not set
# CONFIG_RC_XBOX_DVD is not set
CONFIG_CEC_CORE=y

#
# CEC support
#
# CONFIG_MEDIA_CEC_RC is not set
CONFIG_MEDIA_CEC_SUPPORT=y
# CONFIG_CEC_CH7322 is not set
# CONFIG_CEC_GPIO is not set
# CONFIG_CEC_SECO is not set
CONFIG_USB_PULSE8_CEC=y
CONFIG_USB_RAINSHADOW_CEC=y
# end of CEC support

CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_SUPPORT_FILTER=y
# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set

#
# Media device types
#
CONFIG_MEDIA_CAMERA_SUPPORT=y
CONFIG_MEDIA_ANALOG_TV_SUPPORT=y
CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y
CONFIG_MEDIA_RADIO_SUPPORT=y
CONFIG_MEDIA_SDR_SUPPORT=y
# CONFIG_MEDIA_PLATFORM_SUPPORT is not set
CONFIG_MEDIA_TEST_SUPPORT=y
# end of Media device types

CONFIG_VIDEO_DEV=y
CONFIG_MEDIA_CONTROLLER=y
CONFIG_DVB_CORE=y

#
# Video4Linux options
#
CONFIG_VIDEO_V4L2_I2C=y
CONFIG_VIDEO_V4L2_SUBDEV_API=y
# CONFIG_VIDEO_ADV_DEBUG is not set
# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
CONFIG_VIDEO_TUNER=y
CONFIG_V4L2_MEM2MEM_DEV=y
# end of Video4Linux options

#
# Media controller options
#
CONFIG_MEDIA_CONTROLLER_DVB=y
# end of Media controller options

#
# Digital TV options
#
# CONFIG_DVB_MMAP is not set
# CONFIG_DVB_NET is not set
CONFIG_DVB_MAX_ADAPTERS=16
# CONFIG_DVB_DYNAMIC_MINORS is not set
# CONFIG_DVB_DEMUX_SECTION_LOSS_LOG is not set
# CONFIG_DVB_ULE_DEBUG is not set
# end of Digital TV options

#
# Media drivers
#

#
# Drivers filtered as selected at 'Filter media drivers'
#

#
# Media drivers
#
CONFIG_MEDIA_USB_SUPPORT=y

#
# Webcam devices
#
CONFIG_USB_GSPCA=y
CONFIG_USB_GSPCA_BENQ=y
CONFIG_USB_GSPCA_CONEX=y
CONFIG_USB_GSPCA_CPIA1=y
CONFIG_USB_GSPCA_DTCS033=y
CONFIG_USB_GSPCA_ETOMS=y
CONFIG_USB_GSPCA_FINEPIX=y
CONFIG_USB_GSPCA_JEILINJ=y
CONFIG_USB_GSPCA_JL2005BCD=y
CONFIG_USB_GSPCA_KINECT=y
CONFIG_USB_GSPCA_KONICA=y
CONFIG_USB_GSPCA_MARS=y
CONFIG_USB_GSPCA_MR97310A=y
CONFIG_USB_GSPCA_NW80X=y
CONFIG_USB_GSPCA_OV519=y
CONFIG_USB_GSPCA_OV534=y
CONFIG_USB_GSPCA_OV534_9=y
CONFIG_USB_GSPCA_PAC207=y
CONFIG_USB_GSPCA_PAC7302=y
CONFIG_USB_GSPCA_PAC7311=y
CONFIG_USB_GSPCA_SE401=y
CONFIG_USB_GSPCA_SN9C2028=y
CONFIG_USB_GSPCA_SN9C20X=y
CONFIG_USB_GSPCA_SONIXB=y
CONFIG_USB_GSPCA_SONIXJ=y
CONFIG_USB_GSPCA_SPCA1528=y
CONFIG_USB_GSPCA_SPCA500=y
CONFIG_USB_GSPCA_SPCA501=y
CONFIG_USB_GSPCA_SPCA505=y
CONFIG_USB_GSPCA_SPCA506=y
CONFIG_USB_GSPCA_SPCA508=y
CONFIG_USB_GSPCA_SPCA561=y
CONFIG_USB_GSPCA_SQ905=y
CONFIG_USB_GSPCA_SQ905C=y
CONFIG_USB_GSPCA_SQ930X=y
CONFIG_USB_GSPCA_STK014=y
CONFIG_USB_GSPCA_STK1135=y
CONFIG_USB_GSPCA_STV0680=y
CONFIG_USB_GSPCA_SUNPLUS=y
CONFIG_USB_GSPCA_T613=y
CONFIG_USB_GSPCA_TOPRO=y
CONFIG_USB_GSPCA_TOUPTEK=y
CONFIG_USB_GSPCA_TV8532=y
CONFIG_USB_GSPCA_VC032X=y
CONFIG_USB_GSPCA_VICAM=y
CONFIG_USB_GSPCA_XIRLINK_CIT=y
CONFIG_USB_GSPCA_ZC3XX=y
CONFIG_USB_GL860=y
CONFIG_USB_M5602=y
CONFIG_USB_STV06XX=y
CONFIG_USB_PWC=y
# CONFIG_USB_PWC_DEBUG is not set
CONFIG_USB_PWC_INPUT_EVDEV=y
CONFIG_USB_S2255=y
CONFIG_VIDEO_USBTV=y
CONFIG_USB_VIDEO_CLASS=y
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y

#
# Analog TV USB devices
#
CONFIG_VIDEO_GO7007=y
CONFIG_VIDEO_GO7007_USB=y
CONFIG_VIDEO_GO7007_LOADER=y
CONFIG_VIDEO_GO7007_USB_S2250_BOARD=y
CONFIG_VIDEO_HDPVR=y
CONFIG_VIDEO_PVRUSB2=y
CONFIG_VIDEO_PVRUSB2_SYSFS=y
CONFIG_VIDEO_PVRUSB2_DVB=y
# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set
CONFIG_VIDEO_STK1160=y

#
# Analog/digital TV USB devices
#
CONFIG_VIDEO_AU0828=y
CONFIG_VIDEO_AU0828_V4L2=y
CONFIG_VIDEO_AU0828_RC=y
CONFIG_VIDEO_CX231XX=y
CONFIG_VIDEO_CX231XX_RC=y
CONFIG_VIDEO_CX231XX_ALSA=y
CONFIG_VIDEO_CX231XX_DVB=y

#
# Digital TV USB devices
#
CONFIG_DVB_AS102=y
CONFIG_DVB_B2C2_FLEXCOP_USB=y
# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set
CONFIG_DVB_USB_V2=y
CONFIG_DVB_USB_AF9015=y
CONFIG_DVB_USB_AF9035=y
CONFIG_DVB_USB_ANYSEE=y
CONFIG_DVB_USB_AU6610=y
CONFIG_DVB_USB_AZ6007=y
CONFIG_DVB_USB_CE6230=y
CONFIG_DVB_USB_DVBSKY=y
CONFIG_DVB_USB_EC168=y
CONFIG_DVB_USB_GL861=y
CONFIG_DVB_USB_LME2510=y
CONFIG_DVB_USB_MXL111SF=y
CONFIG_DVB_USB_RTL28XXU=y
CONFIG_DVB_USB_ZD1301=y
CONFIG_DVB_USB=y
# CONFIG_DVB_USB_DEBUG is not set
CONFIG_DVB_USB_A800=y
CONFIG_DVB_USB_AF9005=y
CONFIG_DVB_USB_AF9005_REMOTE=y
CONFIG_DVB_USB_AZ6027=y
CONFIG_DVB_USB_CINERGY_T2=y
CONFIG_DVB_USB_CXUSB=y
# CONFIG_DVB_USB_CXUSB_ANALOG is not set
CONFIG_DVB_USB_DIB0700=y
CONFIG_DVB_USB_DIB3000MC=y
CONFIG_DVB_USB_DIBUSB_MB=y
# CONFIG_DVB_USB_DIBUSB_MB_FAULTY is not set
CONFIG_DVB_USB_DIBUSB_MC=y
CONFIG_DVB_USB_DIGITV=y
CONFIG_DVB_USB_DTT200U=y
CONFIG_DVB_USB_DTV5100=y
CONFIG_DVB_USB_DW2102=y
CONFIG_DVB_USB_GP8PSK=y
CONFIG_DVB_USB_M920X=y
CONFIG_DVB_USB_NOVA_T_USB2=y
CONFIG_DVB_USB_OPERA1=y
CONFIG_DVB_USB_PCTV452E=y
CONFIG_DVB_USB_TECHNISAT_USB2=y
CONFIG_DVB_USB_TTUSB2=y
CONFIG_DVB_USB_UMT_010=y
CONFIG_DVB_USB_VP702X=y
CONFIG_DVB_USB_VP7045=y
CONFIG_SMS_USB_DRV=y
CONFIG_DVB_TTUSB_BUDGET=y
CONFIG_DVB_TTUSB_DEC=y

#
# Webcam, TV (analog/digital) USB devices
#
CONFIG_VIDEO_EM28XX=y
CONFIG_VIDEO_EM28XX_V4L2=y
CONFIG_VIDEO_EM28XX_ALSA=y
CONFIG_VIDEO_EM28XX_DVB=y
CONFIG_VIDEO_EM28XX_RC=y

#
# Software defined radio USB devices
#
CONFIG_USB_AIRSPY=y
CONFIG_USB_HACKRF=y
CONFIG_USB_MSI2500=y
# CONFIG_MEDIA_PCI_SUPPORT is not set
CONFIG_RADIO_ADAPTERS=y
# CONFIG_RADIO_MAXIRADIO is not set
# CONFIG_RADIO_SAA7706H is not set
CONFIG_RADIO_SHARK=y
CONFIG_RADIO_SHARK2=y
CONFIG_RADIO_SI4713=y
CONFIG_RADIO_TEA575X=y
# CONFIG_RADIO_TEA5764 is not set
# CONFIG_RADIO_TEF6862 is not set
# CONFIG_RADIO_WL1273 is not set
CONFIG_USB_DSBR=y
CONFIG_USB_KEENE=y
CONFIG_USB_MA901=y
CONFIG_USB_MR800=y
CONFIG_USB_RAREMONO=y
CONFIG_RADIO_SI470X=y
CONFIG_USB_SI470X=y
# CONFIG_I2C_SI470X is not set
CONFIG_USB_SI4713=y
# CONFIG_PLATFORM_SI4713 is not set
CONFIG_I2C_SI4713=y
CONFIG_V4L_TEST_DRIVERS=y
CONFIG_VIDEO_VIM2M=y
CONFIG_VIDEO_VICODEC=y
CONFIG_VIDEO_VIMC=y
CONFIG_VIDEO_VIVID=y
CONFIG_VIDEO_VIVID_CEC=y
CONFIG_VIDEO_VIVID_MAX_DEVS=64
# CONFIG_VIDEO_VISL is not set
CONFIG_DVB_TEST_DRIVERS=y
CONFIG_DVB_VIDTV=y

#
# FireWire (IEEE 1394) Adapters
#
# CONFIG_DVB_FIREDTV is not set
CONFIG_MEDIA_COMMON_OPTIONS=y

#
# common driver options
#
CONFIG_CYPRESS_FIRMWARE=y
CONFIG_TTPCI_EEPROM=y
CONFIG_UVC_COMMON=y
CONFIG_VIDEO_CX2341X=y
CONFIG_VIDEO_TVEEPROM=y
CONFIG_DVB_B2C2_FLEXCOP=y
CONFIG_SMS_SIANO_MDTV=y
CONFIG_SMS_SIANO_RC=y
CONFIG_VIDEO_V4L2_TPG=y
CONFIG_VIDEOBUF2_CORE=y
CONFIG_VIDEOBUF2_V4L2=y
CONFIG_VIDEOBUF2_MEMOPS=y
CONFIG_VIDEOBUF2_DMA_CONTIG=y
CONFIG_VIDEOBUF2_VMALLOC=y
CONFIG_VIDEOBUF2_DMA_SG=y
# end of Media drivers

#
# Media ancillary drivers
#
CONFIG_MEDIA_ATTACH=y
# CONFIG_VIDEO_IR_I2C is not set
# CONFIG_VIDEO_CAMERA_SENSOR is not set

#
# Camera ISPs
#
# CONFIG_VIDEO_THP7312 is not set
# end of Camera ISPs

#
# Lens drivers
#
# CONFIG_VIDEO_AD5820 is not set
# CONFIG_VIDEO_AK7375 is not set
# CONFIG_VIDEO_DW9714 is not set
# CONFIG_VIDEO_DW9719 is not set
# CONFIG_VIDEO_DW9768 is not set
# CONFIG_VIDEO_DW9807_VCM is not set
# end of Lens drivers

#
# Flash devices
#
# CONFIG_VIDEO_ADP1653 is not set
# CONFIG_VIDEO_LM3560 is not set
# CONFIG_VIDEO_LM3646 is not set
# end of Flash devices

#
# Audio decoders, processors and mixers
#
# CONFIG_VIDEO_CS3308 is not set
# CONFIG_VIDEO_CS5345 is not set
CONFIG_VIDEO_CS53L32A=y
CONFIG_VIDEO_MSP3400=y
# CONFIG_VIDEO_SONY_BTF_MPX is not set
# CONFIG_VIDEO_TDA1997X is not set
# CONFIG_VIDEO_TDA7432 is not set
# CONFIG_VIDEO_TDA9840 is not set
# CONFIG_VIDEO_TEA6415C is not set
# CONFIG_VIDEO_TEA6420 is not set
# CONFIG_VIDEO_TLV320AIC23B is not set
# CONFIG_VIDEO_TVAUDIO is not set
# CONFIG_VIDEO_UDA1342 is not set
# CONFIG_VIDEO_VP27SMPX is not set
# CONFIG_VIDEO_WM8739 is not set
CONFIG_VIDEO_WM8775=y
# end of Audio decoders, processors and mixers

#
# RDS decoders
#
# CONFIG_VIDEO_SAA6588 is not set
# end of RDS decoders

#
# Video decoders
#
# CONFIG_VIDEO_ADV7180 is not set
# CONFIG_VIDEO_ADV7183 is not set
# CONFIG_VIDEO_ADV748X is not set
# CONFIG_VIDEO_ADV7604 is not set
# CONFIG_VIDEO_ADV7842 is not set
# CONFIG_VIDEO_BT819 is not set
# CONFIG_VIDEO_BT856 is not set
# CONFIG_VIDEO_BT866 is not set
# CONFIG_VIDEO_ISL7998X is not set
# CONFIG_VIDEO_KS0127 is not set
# CONFIG_VIDEO_MAX9286 is not set
# CONFIG_VIDEO_ML86V7667 is not set
# CONFIG_VIDEO_SAA7110 is not set
CONFIG_VIDEO_SAA711X=y
# CONFIG_VIDEO_TC358743 is not set
# CONFIG_VIDEO_TC358746 is not set
# CONFIG_VIDEO_TVP514X is not set
# CONFIG_VIDEO_TVP5150 is not set
# CONFIG_VIDEO_TVP7002 is not set
# CONFIG_VIDEO_TW2804 is not set
# CONFIG_VIDEO_TW9900 is not set
# CONFIG_VIDEO_TW9903 is not set
# CONFIG_VIDEO_TW9906 is not set
# CONFIG_VIDEO_TW9910 is not set
# CONFIG_VIDEO_VPX3220 is not set

#
# Video and audio decoders
#
# CONFIG_VIDEO_SAA717X is not set
CONFIG_VIDEO_CX25840=y
# end of Video decoders

#
# Video encoders
#
# CONFIG_VIDEO_ADV7170 is not set
# CONFIG_VIDEO_ADV7175 is not set
# CONFIG_VIDEO_ADV7343 is not set
# CONFIG_VIDEO_ADV7393 is not set
# CONFIG_VIDEO_ADV7511 is not set
# CONFIG_VIDEO_AK881X is not set
# CONFIG_VIDEO_SAA7127 is not set
# CONFIG_VIDEO_SAA7185 is not set
# CONFIG_VIDEO_THS8200 is not set
# end of Video encoders

#
# Video improvement chips
#
# CONFIG_VIDEO_UPD64031A is not set
# CONFIG_VIDEO_UPD64083 is not set
# end of Video improvement chips

#
# Audio/Video compression chips
#
# CONFIG_VIDEO_SAA6752HS is not set
# end of Audio/Video compression chips

#
# SDR tuner chips
#
# CONFIG_SDR_MAX2175 is not set
# end of SDR tuner chips

#
# Miscellaneous helper chips
#
# CONFIG_VIDEO_I2C is not set
# CONFIG_VIDEO_M52790 is not set
# CONFIG_VIDEO_ST_MIPID02 is not set
# CONFIG_VIDEO_THS7303 is not set
# end of Miscellaneous helper chips

#
# Video serializers and deserializers
#
# CONFIG_VIDEO_DS90UB913 is not set
# CONFIG_VIDEO_DS90UB953 is not set
# CONFIG_VIDEO_DS90UB960 is not set
# end of Video serializers and deserializers

#
# Media SPI Adapters
#
# CONFIG_CXD2880_SPI_DRV is not set
# CONFIG_VIDEO_GS1662 is not set
# end of Media SPI Adapters

CONFIG_MEDIA_TUNER=y

#
# Customize TV tuners
#
# CONFIG_MEDIA_TUNER_E4000 is not set
# CONFIG_MEDIA_TUNER_FC0011 is not set
# CONFIG_MEDIA_TUNER_FC0012 is not set
# CONFIG_MEDIA_TUNER_FC0013 is not set
# CONFIG_MEDIA_TUNER_FC2580 is not set
# CONFIG_MEDIA_TUNER_IT913X is not set
# CONFIG_MEDIA_TUNER_M88RS6000T is not set
# CONFIG_MEDIA_TUNER_MAX2165 is not set
# CONFIG_MEDIA_TUNER_MC44S803 is not set
CONFIG_MEDIA_TUNER_MSI001=y
# CONFIG_MEDIA_TUNER_MT2060 is not set
# CONFIG_MEDIA_TUNER_MT2063 is not set
# CONFIG_MEDIA_TUNER_MT20XX is not set
# CONFIG_MEDIA_TUNER_MT2131 is not set
# CONFIG_MEDIA_TUNER_MT2266 is not set
# CONFIG_MEDIA_TUNER_MXL301RF is not set
# CONFIG_MEDIA_TUNER_MXL5005S is not set
# CONFIG_MEDIA_TUNER_MXL5007T is not set
# CONFIG_MEDIA_TUNER_QM1D1B0004 is not set
# CONFIG_MEDIA_TUNER_QM1D1C0042 is not set
# CONFIG_MEDIA_TUNER_QT1010 is not set
# CONFIG_MEDIA_TUNER_R820T is not set
# CONFIG_MEDIA_TUNER_SI2157 is not set
# CONFIG_MEDIA_TUNER_SIMPLE is not set
# CONFIG_MEDIA_TUNER_TDA18212 is not set
# CONFIG_MEDIA_TUNER_TDA18218 is not set
# CONFIG_MEDIA_TUNER_TDA18250 is not set
# CONFIG_MEDIA_TUNER_TDA18271 is not set
# CONFIG_MEDIA_TUNER_TDA827X is not set
# CONFIG_MEDIA_TUNER_TDA8290 is not set
# CONFIG_MEDIA_TUNER_TDA9887 is not set
# CONFIG_MEDIA_TUNER_TEA5761 is not set
# CONFIG_MEDIA_TUNER_TEA5767 is not set
# CONFIG_MEDIA_TUNER_TUA9001 is not set
# CONFIG_MEDIA_TUNER_XC2028 is not set
# CONFIG_MEDIA_TUNER_XC4000 is not set
# CONFIG_MEDIA_TUNER_XC5000 is not set
# end of Customize TV tuners

#
# Customise DVB Frontends
#

#
# Multistandard (satellite) frontends
#
# CONFIG_DVB_M88DS3103 is not set
# CONFIG_DVB_MXL5XX is not set
# CONFIG_DVB_STB0899 is not set
# CONFIG_DVB_STB6100 is not set
# CONFIG_DVB_STV090x is not set
# CONFIG_DVB_STV0910 is not set
# CONFIG_DVB_STV6110x is not set
# CONFIG_DVB_STV6111 is not set

#
# Multistandard (cable + terrestrial) frontends
#
# CONFIG_DVB_DRXK is not set
# CONFIG_DVB_MN88472 is not set
# CONFIG_DVB_MN88473 is not set
# CONFIG_DVB_SI2165 is not set
# CONFIG_DVB_TDA18271C2DD is not set

#
# DVB-S (satellite) frontends
#
# CONFIG_DVB_CX24110 is not set
# CONFIG_DVB_CX24116 is not set
# CONFIG_DVB_CX24117 is not set
# CONFIG_DVB_CX24120 is not set
# CONFIG_DVB_CX24123 is not set
# CONFIG_DVB_DS3000 is not set
# CONFIG_DVB_MB86A16 is not set
# CONFIG_DVB_MT312 is not set
# CONFIG_DVB_S5H1420 is not set
# CONFIG_DVB_SI21XX is not set
# CONFIG_DVB_STB6000 is not set
# CONFIG_DVB_STV0288 is not set
# CONFIG_DVB_STV0299 is not set
# CONFIG_DVB_STV0900 is not set
# CONFIG_DVB_STV6110 is not set
# CONFIG_DVB_TDA10071 is not set
# CONFIG_DVB_TDA10086 is not set
# CONFIG_DVB_TDA8083 is not set
# CONFIG_DVB_TDA8261 is not set
# CONFIG_DVB_TDA826X is not set
# CONFIG_DVB_TS2020 is not set
# CONFIG_DVB_TUA6100 is not set
# CONFIG_DVB_TUNER_CX24113 is not set
# CONFIG_DVB_TUNER_ITD1000 is not set
# CONFIG_DVB_VES1X93 is not set
# CONFIG_DVB_ZL10036 is not set
# CONFIG_DVB_ZL10039 is not set

#
# DVB-T (terrestrial) frontends
#
CONFIG_DVB_AF9013=y
CONFIG_DVB_AS102_FE=y
# CONFIG_DVB_CX22700 is not set
# CONFIG_DVB_CX22702 is not set
# CONFIG_DVB_CXD2820R is not set
# CONFIG_DVB_CXD2841ER is not set
CONFIG_DVB_DIB3000MB=y
CONFIG_DVB_DIB3000MC=y
# CONFIG_DVB_DIB7000M is not set
# CONFIG_DVB_DIB7000P is not set
# CONFIG_DVB_DIB9000 is not set
# CONFIG_DVB_DRXD is not set
CONFIG_DVB_EC100=y
CONFIG_DVB_GP8PSK_FE=y
# CONFIG_DVB_L64781 is not set
# CONFIG_DVB_MT352 is not set
# CONFIG_DVB_NXT6000 is not set
CONFIG_DVB_RTL2830=y
CONFIG_DVB_RTL2832=y
CONFIG_DVB_RTL2832_SDR=y
# CONFIG_DVB_S5H1432 is not set
# CONFIG_DVB_SI2168 is not set
# CONFIG_DVB_SP887X is not set
# CONFIG_DVB_STV0367 is not set
# CONFIG_DVB_TDA10048 is not set
# CONFIG_DVB_TDA1004X is not set
# CONFIG_DVB_ZD1301_DEMOD is not set
CONFIG_DVB_ZL10353=y
# CONFIG_DVB_CXD2880 is not set

#
# DVB-C (cable) frontends
#
# CONFIG_DVB_STV0297 is not set
# CONFIG_DVB_TDA10021 is not set
# CONFIG_DVB_TDA10023 is not set
# CONFIG_DVB_VES1820 is not set

#
# ATSC (North American/Korean Terrestrial/Cable DTV) frontends
#
# CONFIG_DVB_AU8522_DTV is not set
# CONFIG_DVB_AU8522_V4L is not set
# CONFIG_DVB_BCM3510 is not set
# CONFIG_DVB_LG2160 is not set
# CONFIG_DVB_LGDT3305 is not set
# CONFIG_DVB_LGDT3306A is not set
# CONFIG_DVB_LGDT330X is not set
# CONFIG_DVB_MXL692 is not set
# CONFIG_DVB_NXT200X is not set
# CONFIG_DVB_OR51132 is not set
# CONFIG_DVB_OR51211 is not set
# CONFIG_DVB_S5H1409 is not set
# CONFIG_DVB_S5H1411 is not set

#
# ISDB-T (terrestrial) frontends
#
# CONFIG_DVB_DIB8000 is not set
# CONFIG_DVB_MB86A20S is not set
# CONFIG_DVB_S921 is not set

#
# ISDB-S (satellite) & ISDB-T (terrestrial) frontends
#
# CONFIG_DVB_MN88443X is not set
# CONFIG_DVB_TC90522 is not set

#
# Digital terrestrial only tuners/PLL
#
# CONFIG_DVB_PLL is not set
# CONFIG_DVB_TUNER_DIB0070 is not set
# CONFIG_DVB_TUNER_DIB0090 is not set

#
# SEC control devices for DVB-S
#
# CONFIG_DVB_A8293 is not set
CONFIG_DVB_AF9033=y
# CONFIG_DVB_ASCOT2E is not set
# CONFIG_DVB_ATBM8830 is not set
# CONFIG_DVB_HELENE is not set
# CONFIG_DVB_HORUS3A is not set
# CONFIG_DVB_ISL6405 is not set
# CONFIG_DVB_ISL6421 is not set
# CONFIG_DVB_ISL6423 is not set
# CONFIG_DVB_IX2505V is not set
# CONFIG_DVB_LGS8GL5 is not set
# CONFIG_DVB_LGS8GXX is not set
# CONFIG_DVB_LNBH25 is not set
# CONFIG_DVB_LNBH29 is not set
# CONFIG_DVB_LNBP21 is not set
# CONFIG_DVB_LNBP22 is not set
# CONFIG_DVB_M88RS2000 is not set
# CONFIG_DVB_TDA665x is not set
# CONFIG_DVB_DRX39XYJ is not set

#
# Common Interface (EN50221) controller drivers
#
# CONFIG_DVB_CXD2099 is not set
# CONFIG_DVB_SP2 is not set
# end of Customise DVB Frontends

#
# Tools to develop new frontends
#
# CONFIG_DVB_DUMMY_FE is not set
# end of Media ancillary drivers

#
# Graphics support
#
CONFIG_APERTURE_HELPERS=y
CONFIG_SCREEN_INFO=y
CONFIG_VIDEO=y
# CONFIG_AUXDISPLAY is not set
# CONFIG_PANEL is not set
CONFIG_AGP=y
CONFIG_AGP_AMD64=y
CONFIG_AGP_INTEL=y
# CONFIG_AGP_SIS is not set
# CONFIG_AGP_VIA is not set
CONFIG_INTEL_GTT=y
# CONFIG_VGA_SWITCHEROO is not set
CONFIG_DRM=y
CONFIG_DRM_MIPI_DSI=y
CONFIG_DRM_DEBUG_MM=y
CONFIG_DRM_KMS_HELPER=y
# CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS is not set
# CONFIG_DRM_DEBUG_MODESET_LOCK is not set
CONFIG_DRM_FBDEV_EMULATION=y
CONFIG_DRM_FBDEV_OVERALLOC=100
# CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is not set
# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
CONFIG_DRM_DP_AUX_BUS=y
CONFIG_DRM_DISPLAY_HELPER=y
CONFIG_DRM_DISPLAY_DP_HELPER=y
CONFIG_DRM_DISPLAY_HDCP_HELPER=y
CONFIG_DRM_DISPLAY_HDMI_HELPER=y
# CONFIG_DRM_DP_AUX_CHARDEV is not set
# CONFIG_DRM_DP_CEC is not set
CONFIG_DRM_TTM=y
CONFIG_DRM_BUDDY=y
CONFIG_DRM_VRAM_HELPER=y
CONFIG_DRM_TTM_HELPER=y
CONFIG_DRM_GEM_SHMEM_HELPER=y

#
# I2C encoder or helper chips
#
# CONFIG_DRM_I2C_CH7006 is not set
# CONFIG_DRM_I2C_SIL164 is not set
# CONFIG_DRM_I2C_NXP_TDA998X is not set
# CONFIG_DRM_I2C_NXP_TDA9950 is not set
# end of I2C encoder or helper chips

#
# ARM devices
#
# CONFIG_DRM_KOMEDA is not set
# end of ARM devices

# CONFIG_DRM_RADEON is not set
# CONFIG_DRM_AMDGPU is not set
# CONFIG_DRM_NOUVEAU is not set
CONFIG_DRM_I915=y
CONFIG_DRM_I915_FORCE_PROBE=""
CONFIG_DRM_I915_CAPTURE_ERROR=y
CONFIG_DRM_I915_COMPRESS_ERROR=y
CONFIG_DRM_I915_USERPTR=y
# CONFIG_DRM_I915_GVT_KVMGT is not set
# CONFIG_DRM_I915_DP_TUNNEL is not set

#
# drm/i915 Debugging
#
# CONFIG_DRM_I915_WERROR is not set
# CONFIG_DRM_I915_DEBUG is not set
# CONFIG_DRM_I915_DEBUG_MMIO is not set
# CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS is not set
# CONFIG_DRM_I915_SW_FENCE_CHECK_DAG is not set
# CONFIG_DRM_I915_DEBUG_GUC is not set
# CONFIG_DRM_I915_SELFTEST is not set
# CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS is not set
# CONFIG_DRM_I915_DEBUG_VBLANK_EVADE is not set
# CONFIG_DRM_I915_DEBUG_RUNTIME_PM is not set
# CONFIG_DRM_I915_DEBUG_WAKEREF is not set
# end of drm/i915 Debugging

#
# drm/i915 Profile Guided Optimisation
#
CONFIG_DRM_I915_REQUEST_TIMEOUT=20000
CONFIG_DRM_I915_FENCE_TIMEOUT=10000
CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250
CONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500
CONFIG_DRM_I915_PREEMPT_TIMEOUT=640
CONFIG_DRM_I915_PREEMPT_TIMEOUT_COMPUTE=7500
CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000
CONFIG_DRM_I915_STOP_TIMEOUT=100
CONFIG_DRM_I915_TIMESLICE_DURATION=1
# end of drm/i915 Profile Guided Optimisation

# CONFIG_DRM_XE is not set
CONFIG_DRM_VGEM=y
CONFIG_DRM_VKMS=y
CONFIG_DRM_VMWGFX=y
# CONFIG_DRM_VMWGFX_MKSSTATS is not set
# CONFIG_DRM_GMA500 is not set
CONFIG_DRM_UDL=y
# CONFIG_DRM_AST is not set
# CONFIG_DRM_MGAG200 is not set
# CONFIG_DRM_QXL is not set
CONFIG_DRM_VIRTIO_GPU=y
CONFIG_DRM_VIRTIO_GPU_KMS=y
CONFIG_DRM_PANEL=y

#
# Display Panels
#
# CONFIG_DRM_PANEL_ABT_Y030XX067A is not set
# CONFIG_DRM_PANEL_ARM_VERSATILE is not set
# CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596 is not set
# CONFIG_DRM_PANEL_AUO_A030JTN01 is not set
# CONFIG_DRM_PANEL_BOE_BF060Y8M_AJ0 is not set
# CONFIG_DRM_PANEL_BOE_HIMAX8279D is not set
# CONFIG_DRM_PANEL_BOE_TH101MB31UIG002_28A is not set
# CONFIG_DRM_PANEL_BOE_TV101WUM_NL6 is not set
# CONFIG_DRM_PANEL_EBBG_FT8719 is not set
# CONFIG_DRM_PANEL_ELIDA_KD35T133 is not set
# CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02 is not set
# CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D is not set
# CONFIG_DRM_PANEL_DSI_CM is not set
# CONFIG_DRM_PANEL_LVDS is not set
# CONFIG_DRM_PANEL_HIMAX_HX83112A is not set
# CONFIG_DRM_PANEL_HIMAX_HX8394 is not set
# CONFIG_DRM_PANEL_ILITEK_IL9322 is not set
# CONFIG_DRM_PANEL_ILITEK_ILI9341 is not set
# CONFIG_DRM_PANEL_ILITEK_ILI9805 is not set
# CONFIG_DRM_PANEL_ILITEK_ILI9881C is not set
# CONFIG_DRM_PANEL_ILITEK_ILI9882T is not set
# CONFIG_DRM_PANEL_INNOLUX_EJ030NA is not set
# CONFIG_DRM_PANEL_INNOLUX_P079ZCA is not set
# CONFIG_DRM_PANEL_JADARD_JD9365DA_H3 is not set
# CONFIG_DRM_PANEL_JDI_LPM102A188A is not set
# CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set
# CONFIG_DRM_PANEL_JDI_R63452 is not set
# CONFIG_DRM_PANEL_KHADAS_TS050 is not set
# CONFIG_DRM_PANEL_KINGDISPLAY_KD097D04 is not set
# CONFIG_DRM_PANEL_LEADTEK_LTK050H3146W is not set
# CONFIG_DRM_PANEL_LEADTEK_LTK500HD1829 is not set
# CONFIG_DRM_PANEL_LG_LB035Q02 is not set
# CONFIG_DRM_PANEL_LG_LG4573 is not set
# CONFIG_DRM_PANEL_MAGNACHIP_D53E6EA8966 is not set
# CONFIG_DRM_PANEL_MANTIX_MLAF057WE51 is not set
# CONFIG_DRM_PANEL_NEC_NL8048HL11 is not set
# CONFIG_DRM_PANEL_NEWVISION_NV3051D is not set
# CONFIG_DRM_PANEL_NEWVISION_NV3052C is not set
# CONFIG_DRM_PANEL_NOVATEK_NT35510 is not set
# CONFIG_DRM_PANEL_NOVATEK_NT35560 is not set
# CONFIG_DRM_PANEL_NOVATEK_NT35950 is not set
# CONFIG_DRM_PANEL_NOVATEK_NT36523 is not set
# CONFIG_DRM_PANEL_NOVATEK_NT36672A is not set
# CONFIG_DRM_PANEL_NOVATEK_NT36672E is not set
# CONFIG_DRM_PANEL_NOVATEK_NT39016 is not set
# CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO is not set
# CONFIG_DRM_PANEL_ORISETECH_OTA5601A is not set
# CONFIG_DRM_PANEL_ORISETECH_OTM8009A is not set
# CONFIG_DRM_PANEL_OSD_OSD101T2587_53TS is not set
# CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00 is not set
# CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN is not set
# CONFIG_DRM_PANEL_RAYDIUM_RM67191 is not set
# CONFIG_DRM_PANEL_RAYDIUM_RM68200 is not set
# CONFIG_DRM_PANEL_RAYDIUM_RM692E5 is not set
# CONFIG_DRM_PANEL_RONBO_RB070D30 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01 is not set
# CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20 is not set
# CONFIG_DRM_PANEL_SAMSUNG_DB7430 is not set
# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6D16D0 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6D27A1 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6E63M0 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set
# CONFIG_DRM_PANEL_SAMSUNG_SOFEF00 is not set
# CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set
# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set
# CONFIG_DRM_PANEL_SHARP_LS037V7DW01 is not set
# CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set
# CONFIG_DRM_PANEL_SHARP_LS060T1SX01 is not set
# CONFIG_DRM_PANEL_SITRONIX_ST7701 is not set
# CONFIG_DRM_PANEL_SITRONIX_ST7703 is not set
# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set
# CONFIG_DRM_PANEL_SONY_ACX565AKM is not set
# CONFIG_DRM_PANEL_SONY_TD4353_JDI is not set
# CONFIG_DRM_PANEL_SONY_TULIP_TRULY_NT35521 is not set
# CONFIG_DRM_PANEL_STARTEK_KD070FHFID015 is not set
CONFIG_DRM_PANEL_EDP=y
# CONFIG_DRM_PANEL_SIMPLE is not set
# CONFIG_DRM_PANEL_SYNAPTICS_R63353 is not set
# CONFIG_DRM_PANEL_TDO_TL070WSH30 is not set
# CONFIG_DRM_PANEL_TPO_TD028TTEC1 is not set
# CONFIG_DRM_PANEL_TPO_TD043MTEA1 is not set
# CONFIG_DRM_PANEL_TPO_TPG110 is not set
# CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA is not set
# CONFIG_DRM_PANEL_VISIONOX_R66451 is not set
# CONFIG_DRM_PANEL_VISIONOX_RM69299 is not set
# CONFIG_DRM_PANEL_VISIONOX_VTDR6130 is not set
# CONFIG_DRM_PANEL_WIDECHIPS_WS2401 is not set
# CONFIG_DRM_PANEL_XINPENG_XPP055C272 is not set
# end of Display Panels

CONFIG_DRM_BRIDGE=y
CONFIG_DRM_PANEL_BRIDGE=y

#
# Display Interface Bridges
#
# CONFIG_DRM_CHIPONE_ICN6211 is not set
# CONFIG_DRM_CHRONTEL_CH7033 is not set
# CONFIG_DRM_DISPLAY_CONNECTOR is not set
# CONFIG_DRM_ITE_IT6505 is not set
# CONFIG_DRM_LONTIUM_LT8912B is not set
# CONFIG_DRM_LONTIUM_LT9211 is not set
# CONFIG_DRM_LONTIUM_LT9611 is not set
# CONFIG_DRM_LONTIUM_LT9611UXC is not set
# CONFIG_DRM_ITE_IT66121 is not set
# CONFIG_DRM_LVDS_CODEC is not set
# CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set
# CONFIG_DRM_NWL_MIPI_DSI is not set
# CONFIG_DRM_NXP_PTN3460 is not set
# CONFIG_DRM_PARADE_PS8622 is not set
# CONFIG_DRM_PARADE_PS8640 is not set
# CONFIG_DRM_SAMSUNG_DSIM is not set
# CONFIG_DRM_SIL_SII8620 is not set
# CONFIG_DRM_SII902X is not set
# CONFIG_DRM_SII9234 is not set
# CONFIG_DRM_SIMPLE_BRIDGE is not set
# CONFIG_DRM_THINE_THC63LVD1024 is not set
# CONFIG_DRM_TOSHIBA_TC358762 is not set
# CONFIG_DRM_TOSHIBA_TC358764 is not set
# CONFIG_DRM_TOSHIBA_TC358767 is not set
# CONFIG_DRM_TOSHIBA_TC358768 is not set
# CONFIG_DRM_TOSHIBA_TC358775 is not set
# CONFIG_DRM_TI_DLPC3433 is not set
# CONFIG_DRM_TI_TFP410 is not set
# CONFIG_DRM_TI_SN65DSI83 is not set
# CONFIG_DRM_TI_SN65DSI86 is not set
# CONFIG_DRM_TI_TPD12S015 is not set
# CONFIG_DRM_ANALOGIX_ANX6345 is not set
# CONFIG_DRM_ANALOGIX_ANX78XX is not set
# CONFIG_DRM_ANALOGIX_ANX7625 is not set
# CONFIG_DRM_I2C_ADV7511 is not set
# CONFIG_DRM_CDNS_DSI is not set
# CONFIG_DRM_CDNS_MHDP8546 is not set
# end of Display Interface Bridges

# CONFIG_DRM_ETNAVIV is not set
# CONFIG_DRM_LOGICVC is not set
# CONFIG_DRM_ARCPGU is not set
CONFIG_DRM_BOCHS=y
CONFIG_DRM_CIRRUS_QEMU=y
# CONFIG_DRM_GM12U320 is not set
# CONFIG_DRM_PANEL_MIPI_DBI is not set
CONFIG_DRM_SIMPLEDRM=y
# CONFIG_TINYDRM_HX8357D is not set
# CONFIG_TINYDRM_ILI9163 is not set
# CONFIG_TINYDRM_ILI9225 is not set
# CONFIG_TINYDRM_ILI9341 is not set
# CONFIG_TINYDRM_ILI9486 is not set
# CONFIG_TINYDRM_MI0283QT is not set
# CONFIG_TINYDRM_REPAPER is not set
# CONFIG_TINYDRM_ST7586 is not set
# CONFIG_TINYDRM_ST7735R is not set
# CONFIG_DRM_VBOXVIDEO is not set
# CONFIG_DRM_GUD is not set
# CONFIG_DRM_SSD130X is not set
CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y

#
# Frame buffer Devices
#
CONFIG_FB=y
# CONFIG_FB_CIRRUS is not set
# CONFIG_FB_PM2 is not set
# CONFIG_FB_CYBER2000 is not set
# CONFIG_FB_ARC is not set
# CONFIG_FB_ASILIANT is not set
# CONFIG_FB_IMSTT is not set
CONFIG_FB_VGA16=y
# CONFIG_FB_UVESA is not set
CONFIG_FB_VESA=y
# CONFIG_FB_N411 is not set
# CONFIG_FB_HGA is not set
# CONFIG_FB_OPENCORES is not set
# CONFIG_FB_S1D13XXX is not set
# CONFIG_FB_NVIDIA is not set
# CONFIG_FB_RIVA is not set
# CONFIG_FB_I740 is not set
# CONFIG_FB_MATROX is not set
# CONFIG_FB_RADEON is not set
# CONFIG_FB_ATY128 is not set
# CONFIG_FB_ATY is not set
# CONFIG_FB_S3 is not set
# CONFIG_FB_SAVAGE is not set
# CONFIG_FB_SIS is not set
# CONFIG_FB_VIA is not set
# CONFIG_FB_NEOMAGIC is not set
# CONFIG_FB_KYRO is not set
# CONFIG_FB_3DFX is not set
# CONFIG_FB_VT8623 is not set
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_ARK is not set
# CONFIG_FB_PM3 is not set
# CONFIG_FB_CARMINE is not set
# CONFIG_FB_SMSCUFX is not set
# CONFIG_FB_IBM_GXT4500 is not set
CONFIG_FB_VIRTUAL=y
# CONFIG_FB_METRONOME is not set
# CONFIG_FB_MB862XX is not set
# CONFIG_FB_SSD1307 is not set
# CONFIG_FB_SM712 is not set
CONFIG_FB_CORE=y
CONFIG_FB_NOTIFY=y
# CONFIG_FIRMWARE_EDID is not set
# CONFIG_FB_DEVICE is not set
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_IMAGEBLIT=y
# CONFIG_FB_FOREIGN_ENDIAN is not set
CONFIG_FB_SYSMEM_FOPS=y
CONFIG_FB_DEFERRED_IO=y
CONFIG_FB_IOMEM_FOPS=y
CONFIG_FB_IOMEM_HELPERS=y
CONFIG_FB_SYSMEM_HELPERS=y
CONFIG_FB_SYSMEM_HELPERS_DEFERRED=y
# CONFIG_FB_MODE_HELPERS is not set
CONFIG_FB_TILEBLITTING=y
# end of Frame buffer Devices

#
# Backlight & LCD device support
#
CONFIG_LCD_CLASS_DEVICE=y
# CONFIG_LCD_L4F00242T03 is not set
# CONFIG_LCD_LMS283GF05 is not set
# CONFIG_LCD_LTV350QV is not set
# CONFIG_LCD_ILI922X is not set
# CONFIG_LCD_ILI9320 is not set
# CONFIG_LCD_TDO24M is not set
# CONFIG_LCD_VGG2432A4 is not set
# CONFIG_LCD_PLATFORM is not set
# CONFIG_LCD_AMS369FG06 is not set
# CONFIG_LCD_LMS501KF03 is not set
# CONFIG_LCD_HX8357 is not set
# CONFIG_LCD_OTM3225A is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
# CONFIG_BACKLIGHT_KTD253 is not set
# CONFIG_BACKLIGHT_KTD2801 is not set
# CONFIG_BACKLIGHT_KTZ8866 is not set
# CONFIG_BACKLIGHT_APPLE is not set
# CONFIG_BACKLIGHT_QCOM_WLED is not set
# CONFIG_BACKLIGHT_SAHARA is not set
# CONFIG_BACKLIGHT_ADP8860 is not set
# CONFIG_BACKLIGHT_ADP8870 is not set
# CONFIG_BACKLIGHT_LM3639 is not set
# CONFIG_BACKLIGHT_PANDORA is not set
# CONFIG_BACKLIGHT_GPIO is not set
# CONFIG_BACKLIGHT_LV5207LP is not set
# CONFIG_BACKLIGHT_BD6107 is not set
# CONFIG_BACKLIGHT_ARCXCNN is not set
# CONFIG_BACKLIGHT_LED is not set
# end of Backlight & LCD device support

CONFIG_VGASTATE=y
CONFIG_VIDEOMODE_HELPERS=y
CONFIG_HDMI=y

#
# Console display driver support
#
CONFIG_VGA_CONSOLE=y
CONFIG_DUMMY_CONSOLE=y
CONFIG_DUMMY_CONSOLE_COLUMNS=80
CONFIG_DUMMY_CONSOLE_ROWS=25
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set
# end of Console display driver support

CONFIG_LOGO=y
CONFIG_LOGO_LINUX_MONO=y
CONFIG_LOGO_LINUX_VGA16=y
# CONFIG_LOGO_LINUX_CLUT224 is not set
# end of Graphics support

# CONFIG_DRM_ACCEL is not set
CONFIG_SOUND=y
CONFIG_SOUND_OSS_CORE=y
CONFIG_SOUND_OSS_CORE_PRECLAIM=y
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
CONFIG_SND_HWDEP=y
CONFIG_SND_SEQ_DEVICE=y
CONFIG_SND_RAWMIDI=y
CONFIG_SND_JACK=y
CONFIG_SND_JACK_INPUT_DEV=y
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_PCM_TIMER=y
CONFIG_SND_HRTIMER=y
CONFIG_SND_DYNAMIC_MINORS=y
CONFIG_SND_MAX_CARDS=32
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_PROC_FS=y
CONFIG_SND_VERBOSE_PROCFS=y
# CONFIG_SND_VERBOSE_PRINTK is not set
CONFIG_SND_CTL_FAST_LOOKUP=y
CONFIG_SND_DEBUG=y
# CONFIG_SND_DEBUG_VERBOSE is not set
CONFIG_SND_PCM_XRUN_DEBUG=y
# CONFIG_SND_CTL_INPUT_VALIDATION is not set
# CONFIG_SND_CTL_DEBUG is not set
# CONFIG_SND_JACK_INJECTION_DEBUG is not set
CONFIG_SND_VMASTER=y
CONFIG_SND_DMA_SGBUF=y
CONFIG_SND_CTL_LED=y
CONFIG_SND_SEQUENCER=y
CONFIG_SND_SEQ_DUMMY=y
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
CONFIG_SND_SEQ_MIDI_EVENT=y
CONFIG_SND_SEQ_MIDI=y
CONFIG_SND_SEQ_VIRMIDI=y
# CONFIG_SND_SEQ_UMP is not set
CONFIG_SND_DRIVERS=y
# CONFIG_SND_PCSP is not set
CONFIG_SND_DUMMY=y
CONFIG_SND_ALOOP=y
# CONFIG_SND_PCMTEST is not set
CONFIG_SND_VIRMIDI=y
# CONFIG_SND_MTPAV is not set
# CONFIG_SND_MTS64 is not set
# CONFIG_SND_SERIAL_U16550 is not set
# CONFIG_SND_SERIAL_GENERIC is not set
# CONFIG_SND_MPU401 is not set
# CONFIG_SND_PORTMAN2X4 is not set
CONFIG_SND_PCI=y
# CONFIG_SND_AD1889 is not set
# CONFIG_SND_ALS300 is not set
# CONFIG_SND_ALS4000 is not set
# CONFIG_SND_ALI5451 is not set
# CONFIG_SND_ASIHPI is not set
# CONFIG_SND_ATIIXP is not set
# CONFIG_SND_ATIIXP_MODEM is not set
# CONFIG_SND_AU8810 is not set
# CONFIG_SND_AU8820 is not set
# CONFIG_SND_AU8830 is not set
# CONFIG_SND_AW2 is not set
# CONFIG_SND_AZT3328 is not set
# CONFIG_SND_BT87X is not set
# CONFIG_SND_CA0106 is not set
# CONFIG_SND_CMIPCI is not set
# CONFIG_SND_OXYGEN is not set
# CONFIG_SND_CS4281 is not set
# CONFIG_SND_CS46XX is not set
# CONFIG_SND_CTXFI is not set
# CONFIG_SND_DARLA20 is not set
# CONFIG_SND_GINA20 is not set
# CONFIG_SND_LAYLA20 is not set
# CONFIG_SND_DARLA24 is not set
# CONFIG_SND_GINA24 is not set
# CONFIG_SND_LAYLA24 is not set
# CONFIG_SND_MONA is not set
# CONFIG_SND_MIA is not set
# CONFIG_SND_ECHO3G is not set
# CONFIG_SND_INDIGO is not set
# CONFIG_SND_INDIGOIO is not set
# CONFIG_SND_INDIGODJ is not set
# CONFIG_SND_INDIGOIOX is not set
# CONFIG_SND_INDIGODJX is not set
# CONFIG_SND_EMU10K1 is not set
# CONFIG_SND_EMU10K1X is not set
# CONFIG_SND_ENS1370 is not set
# CONFIG_SND_ENS1371 is not set
# CONFIG_SND_ES1938 is not set
# CONFIG_SND_ES1968 is not set
# CONFIG_SND_FM801 is not set
# CONFIG_SND_HDSP is not set
# CONFIG_SND_HDSPM is not set
# CONFIG_SND_ICE1712 is not set
# CONFIG_SND_ICE1724 is not set
# CONFIG_SND_INTEL8X0 is not set
# CONFIG_SND_INTEL8X0M is not set
# CONFIG_SND_KORG1212 is not set
# CONFIG_SND_LOLA is not set
# CONFIG_SND_LX6464ES is not set
# CONFIG_SND_MAESTRO3 is not set
# CONFIG_SND_MIXART is not set
# CONFIG_SND_NM256 is not set
# CONFIG_SND_PCXHR is not set
# CONFIG_SND_RIPTIDE is not set
# CONFIG_SND_RME32 is not set
# CONFIG_SND_RME96 is not set
# CONFIG_SND_RME9652 is not set
# CONFIG_SND_SE6X is not set
# CONFIG_SND_SONICVIBES is not set
# CONFIG_SND_TRIDENT is not set
# CONFIG_SND_VIA82XX is not set
# CONFIG_SND_VIA82XX_MODEM is not set
# CONFIG_SND_VIRTUOSO is not set
# CONFIG_SND_VX222 is not set
# CONFIG_SND_YMFPCI is not set

#
# HD-Audio
#
CONFIG_SND_HDA=y
CONFIG_SND_HDA_GENERIC_LEDS=y
CONFIG_SND_HDA_INTEL=y
CONFIG_SND_HDA_HWDEP=y
CONFIG_SND_HDA_RECONFIG=y
CONFIG_SND_HDA_INPUT_BEEP=y
CONFIG_SND_HDA_INPUT_BEEP_MODE=1
CONFIG_SND_HDA_PATCH_LOADER=y
CONFIG_SND_HDA_SCODEC_COMPONENT=y
# CONFIG_SND_HDA_SCODEC_CS35L56_I2C is not set
# CONFIG_SND_HDA_SCODEC_CS35L56_SPI is not set
CONFIG_SND_HDA_CODEC_REALTEK=y
CONFIG_SND_HDA_CODEC_ANALOG=y
CONFIG_SND_HDA_CODEC_SIGMATEL=y
CONFIG_SND_HDA_CODEC_VIA=y
CONFIG_SND_HDA_CODEC_HDMI=y
CONFIG_SND_HDA_CODEC_CIRRUS=y
# CONFIG_SND_HDA_CODEC_CS8409 is not set
CONFIG_SND_HDA_CODEC_CONEXANT=y
CONFIG_SND_HDA_CODEC_CA0110=y
CONFIG_SND_HDA_CODEC_CA0132=y
# CONFIG_SND_HDA_CODEC_CA0132_DSP is not set
CONFIG_SND_HDA_CODEC_CMEDIA=y
CONFIG_SND_HDA_CODEC_SI3054=y
CONFIG_SND_HDA_GENERIC=y
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0
# CONFIG_SND_HDA_INTEL_HDMI_SILENT_STREAM is not set
# CONFIG_SND_HDA_CTL_DEV_ID is not set
# end of HD-Audio

CONFIG_SND_HDA_CORE=y
CONFIG_SND_HDA_COMPONENT=y
CONFIG_SND_HDA_I915=y
CONFIG_SND_HDA_PREALLOC_SIZE=0
CONFIG_SND_INTEL_NHLT=y
CONFIG_SND_INTEL_DSP_CONFIG=y
CONFIG_SND_INTEL_SOUNDWIRE_ACPI=y
# CONFIG_SND_SPI is not set
CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=y
# CONFIG_SND_USB_AUDIO_MIDI_V2 is not set
CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER=y
CONFIG_SND_USB_UA101=y
CONFIG_SND_USB_USX2Y=y
CONFIG_SND_USB_CAIAQ=y
CONFIG_SND_USB_CAIAQ_INPUT=y
CONFIG_SND_USB_US122L=y
CONFIG_SND_USB_6FIRE=y
CONFIG_SND_USB_HIFACE=y
CONFIG_SND_BCD2000=y
CONFIG_SND_USB_LINE6=y
CONFIG_SND_USB_POD=y
CONFIG_SND_USB_PODHD=y
CONFIG_SND_USB_TONEPORT=y
CONFIG_SND_USB_VARIAX=y
# CONFIG_SND_FIREWIRE is not set
CONFIG_SND_PCMCIA=y
# CONFIG_SND_VXPOCKET is not set
# CONFIG_SND_PDAUDIOCF is not set
CONFIG_SND_SOC=y
# CONFIG_SND_SOC_ADI is not set
# CONFIG_SND_SOC_AMD_ACP is not set
# CONFIG_SND_SOC_AMD_ACP3x is not set
# CONFIG_SND_SOC_AMD_RENOIR is not set
# CONFIG_SND_SOC_AMD_ACP5x is not set
# CONFIG_SND_SOC_AMD_ACP6x is not set
# CONFIG_SND_AMD_ACP_CONFIG is not set
# CONFIG_SND_SOC_AMD_ACP_COMMON is not set
# CONFIG_SND_SOC_AMD_RPL_ACP6x is not set
# CONFIG_SND_SOC_AMD_PS is not set
# CONFIG_SND_ATMEL_SOC is not set
# CONFIG_SND_BCM63XX_I2S_WHISTLER is not set
# CONFIG_SND_DESIGNWARE_I2S is not set

#
# SoC Audio for Freescale CPUs
#

#
# Common SoC Audio options for Freescale CPUs:
#
# CONFIG_SND_SOC_FSL_ASRC is not set
# CONFIG_SND_SOC_FSL_SAI is not set
# CONFIG_SND_SOC_FSL_AUDMIX is not set
# CONFIG_SND_SOC_FSL_SSI is not set
# CONFIG_SND_SOC_FSL_SPDIF is not set
# CONFIG_SND_SOC_FSL_ESAI is not set
# CONFIG_SND_SOC_FSL_MICFIL is not set
# CONFIG_SND_SOC_FSL_XCVR is not set
# CONFIG_SND_SOC_IMX_AUDMUX is not set
# end of SoC Audio for Freescale CPUs

# CONFIG_SND_SOC_CHV3_I2S is not set
# CONFIG_SND_I2S_HI6210_I2S is not set
# CONFIG_SND_SOC_IMG is not set
# CONFIG_SND_SOC_INTEL_SST_TOPLEVEL is not set
# CONFIG_SND_SOC_INTEL_AVS is not set
# CONFIG_SND_SOC_MTK_BTCVSD is not set
# CONFIG_SND_SOC_SOF_TOPLEVEL is not set

#
# STMicroelectronics STM32 SOC audio support
#
# end of STMicroelectronics STM32 SOC audio support

# CONFIG_SND_SOC_XILINX_I2S is not set
# CONFIG_SND_SOC_XILINX_AUDIO_FORMATTER is not set
# CONFIG_SND_SOC_XILINX_SPDIF is not set
# CONFIG_SND_SOC_XTFPGA_I2S is not set
CONFIG_SND_SOC_I2C_AND_SPI=y

#
# CODEC drivers
#
# CONFIG_SND_SOC_AC97_CODEC is not set
# CONFIG_SND_SOC_ADAU1372_I2C is not set
# CONFIG_SND_SOC_ADAU1372_SPI is not set
# CONFIG_SND_SOC_ADAU1701 is not set
# CONFIG_SND_SOC_ADAU1761_I2C is not set
# CONFIG_SND_SOC_ADAU1761_SPI is not set
# CONFIG_SND_SOC_ADAU7002 is not set
# CONFIG_SND_SOC_ADAU7118_HW is not set
# CONFIG_SND_SOC_ADAU7118_I2C is not set
# CONFIG_SND_SOC_AK4104 is not set
# CONFIG_SND_SOC_AK4118 is not set
# CONFIG_SND_SOC_AK4375 is not set
# CONFIG_SND_SOC_AK4458 is not set
# CONFIG_SND_SOC_AK4554 is not set
# CONFIG_SND_SOC_AK4613 is not set
# CONFIG_SND_SOC_AK4642 is not set
# CONFIG_SND_SOC_AK5386 is not set
# CONFIG_SND_SOC_AK5558 is not set
# CONFIG_SND_SOC_ALC5623 is not set
# CONFIG_SND_SOC_AUDIO_IIO_AUX is not set
# CONFIG_SND_SOC_AW8738 is not set
# CONFIG_SND_SOC_AW88395 is not set
# CONFIG_SND_SOC_AW88261 is not set
# CONFIG_SND_SOC_AW87390 is not set
# CONFIG_SND_SOC_AW88399 is not set
# CONFIG_SND_SOC_BD28623 is not set
# CONFIG_SND_SOC_BT_SCO is not set
# CONFIG_SND_SOC_CHV3_CODEC is not set
# CONFIG_SND_SOC_CS35L32 is not set
# CONFIG_SND_SOC_CS35L33 is not set
# CONFIG_SND_SOC_CS35L34 is not set
# CONFIG_SND_SOC_CS35L35 is not set
# CONFIG_SND_SOC_CS35L36 is not set
# CONFIG_SND_SOC_CS35L41_SPI is not set
# CONFIG_SND_SOC_CS35L41_I2C is not set
# CONFIG_SND_SOC_CS35L45_SPI is not set
# CONFIG_SND_SOC_CS35L45_I2C is not set
# CONFIG_SND_SOC_CS35L56_I2C is not set
# CONFIG_SND_SOC_CS35L56_SPI is not set
# CONFIG_SND_SOC_CS35L56_SDW is not set
# CONFIG_SND_SOC_CS42L42 is not set
# CONFIG_SND_SOC_CS42L42_SDW is not set
# CONFIG_SND_SOC_CS42L51_I2C is not set
# CONFIG_SND_SOC_CS42L52 is not set
# CONFIG_SND_SOC_CS42L56 is not set
# CONFIG_SND_SOC_CS42L73 is not set
# CONFIG_SND_SOC_CS42L83 is not set
# CONFIG_SND_SOC_CS4234 is not set
# CONFIG_SND_SOC_CS4265 is not set
# CONFIG_SND_SOC_CS4270 is not set
# CONFIG_SND_SOC_CS4271_I2C is not set
# CONFIG_SND_SOC_CS4271_SPI is not set
# CONFIG_SND_SOC_CS42XX8_I2C is not set
# CONFIG_SND_SOC_CS43130 is not set
# CONFIG_SND_SOC_CS4341 is not set
# CONFIG_SND_SOC_CS4349 is not set
# CONFIG_SND_SOC_CS53L30 is not set
# CONFIG_SND_SOC_CX2072X is not set
# CONFIG_SND_SOC_DA7213 is not set
# CONFIG_SND_SOC_DMIC is not set
# CONFIG_SND_SOC_ES7134 is not set
# CONFIG_SND_SOC_ES7241 is not set
# CONFIG_SND_SOC_ES8316 is not set
# CONFIG_SND_SOC_ES8326 is not set
# CONFIG_SND_SOC_ES8328_I2C is not set
# CONFIG_SND_SOC_ES8328_SPI is not set
# CONFIG_SND_SOC_GTM601 is not set
# CONFIG_SND_SOC_HDA is not set
# CONFIG_SND_SOC_ICS43432 is not set
# CONFIG_SND_SOC_IDT821034 is not set
# CONFIG_SND_SOC_INNO_RK3036 is not set
# CONFIG_SND_SOC_MAX98088 is not set
# CONFIG_SND_SOC_MAX98090 is not set
# CONFIG_SND_SOC_MAX98357A is not set
# CONFIG_SND_SOC_MAX98504 is not set
# CONFIG_SND_SOC_MAX9867 is not set
# CONFIG_SND_SOC_MAX98927 is not set
# CONFIG_SND_SOC_MAX98520 is not set
# CONFIG_SND_SOC_MAX98363 is not set
# CONFIG_SND_SOC_MAX98373_I2C is not set
# CONFIG_SND_SOC_MAX98373_SDW is not set
# CONFIG_SND_SOC_MAX98388 is not set
# CONFIG_SND_SOC_MAX98390 is not set
# CONFIG_SND_SOC_MAX98396 is not set
# CONFIG_SND_SOC_MAX9860 is not set
# CONFIG_SND_SOC_MSM8916_WCD_DIGITAL is not set
# CONFIG_SND_SOC_PCM1681 is not set
# CONFIG_SND_SOC_PCM1789_I2C is not set
# CONFIG_SND_SOC_PCM179X_I2C is not set
# CONFIG_SND_SOC_PCM179X_SPI is not set
# CONFIG_SND_SOC_PCM186X_I2C is not set
# CONFIG_SND_SOC_PCM186X_SPI is not set
# CONFIG_SND_SOC_PCM3060_I2C is not set
# CONFIG_SND_SOC_PCM3060_SPI is not set
# CONFIG_SND_SOC_PCM3168A_I2C is not set
# CONFIG_SND_SOC_PCM3168A_SPI is not set
# CONFIG_SND_SOC_PCM5102A is not set
# CONFIG_SND_SOC_PCM512x_I2C is not set
# CONFIG_SND_SOC_PCM512x_SPI is not set
# CONFIG_SND_SOC_PEB2466 is not set
# CONFIG_SND_SOC_RK3328 is not set
# CONFIG_SND_SOC_RT1017_SDCA_SDW is not set
# CONFIG_SND_SOC_RT1308_SDW is not set
# CONFIG_SND_SOC_RT1316_SDW is not set
# CONFIG_SND_SOC_RT1318_SDW is not set
# CONFIG_SND_SOC_RT5616 is not set
# CONFIG_SND_SOC_RT5631 is not set
# CONFIG_SND_SOC_RT5640 is not set
# CONFIG_SND_SOC_RT5659 is not set
# CONFIG_SND_SOC_RT5682_SDW is not set
# CONFIG_SND_SOC_RT700_SDW is not set
# CONFIG_SND_SOC_RT711_SDW is not set
# CONFIG_SND_SOC_RT711_SDCA_SDW is not set
# CONFIG_SND_SOC_RT712_SDCA_SDW is not set
# CONFIG_SND_SOC_RT712_SDCA_DMIC_SDW is not set
# CONFIG_SND_SOC_RT722_SDCA_SDW is not set
# CONFIG_SND_SOC_RT715_SDW is not set
# CONFIG_SND_SOC_RT715_SDCA_SDW is not set
# CONFIG_SND_SOC_RT9120 is not set
# CONFIG_SND_SOC_RTQ9128 is not set
# CONFIG_SND_SOC_SDW_MOCKUP is not set
# CONFIG_SND_SOC_SGTL5000 is not set
# CONFIG_SND_SOC_SIMPLE_AMPLIFIER is not set
# CONFIG_SND_SOC_SIMPLE_MUX is not set
# CONFIG_SND_SOC_SMA1303 is not set
# CONFIG_SND_SOC_SPDIF is not set
# CONFIG_SND_SOC_SRC4XXX_I2C is not set
# CONFIG_SND_SOC_SSM2305 is not set
# CONFIG_SND_SOC_SSM2518 is not set
# CONFIG_SND_SOC_SSM2602_SPI is not set
# CONFIG_SND_SOC_SSM2602_I2C is not set
# CONFIG_SND_SOC_SSM3515 is not set
# CONFIG_SND_SOC_SSM4567 is not set
# CONFIG_SND_SOC_STA32X is not set
# CONFIG_SND_SOC_STA350 is not set
# CONFIG_SND_SOC_STI_SAS is not set
# CONFIG_SND_SOC_TAS2552 is not set
# CONFIG_SND_SOC_TAS2562 is not set
# CONFIG_SND_SOC_TAS2764 is not set
# CONFIG_SND_SOC_TAS2770 is not set
# CONFIG_SND_SOC_TAS2780 is not set
# CONFIG_SND_SOC_TAS2781_I2C is not set
# CONFIG_SND_SOC_TAS5086 is not set
# CONFIG_SND_SOC_TAS571X is not set
# CONFIG_SND_SOC_TAS5720 is not set
# CONFIG_SND_SOC_TAS5805M is not set
# CONFIG_SND_SOC_TAS6424 is not set
# CONFIG_SND_SOC_TDA7419 is not set
# CONFIG_SND_SOC_TFA9879 is not set
# CONFIG_SND_SOC_TFA989X is not set
# CONFIG_SND_SOC_TLV320ADC3XXX is not set
# CONFIG_SND_SOC_TLV320AIC23_I2C is not set
# CONFIG_SND_SOC_TLV320AIC23_SPI is not set
# CONFIG_SND_SOC_TLV320AIC31XX is not set
# CONFIG_SND_SOC_TLV320AIC32X4_I2C is not set
# CONFIG_SND_SOC_TLV320AIC32X4_SPI is not set
# CONFIG_SND_SOC_TLV320AIC3X_I2C is not set
# CONFIG_SND_SOC_TLV320AIC3X_SPI is not set
# CONFIG_SND_SOC_TLV320ADCX140 is not set
# CONFIG_SND_SOC_TS3A227E is not set
# CONFIG_SND_SOC_TSCS42XX is not set
# CONFIG_SND_SOC_TSCS454 is not set
# CONFIG_SND_SOC_UDA1334 is not set
# CONFIG_SND_SOC_WCD938X_SDW is not set
# CONFIG_SND_SOC_WCD939X_SDW is not set
# CONFIG_SND_SOC_WM8510 is not set
# CONFIG_SND_SOC_WM8523 is not set
# CONFIG_SND_SOC_WM8524 is not set
# CONFIG_SND_SOC_WM8580 is not set
# CONFIG_SND_SOC_WM8711 is not set
# CONFIG_SND_SOC_WM8728 is not set
# CONFIG_SND_SOC_WM8731_I2C is not set
# CONFIG_SND_SOC_WM8731_SPI is not set
# CONFIG_SND_SOC_WM8737 is not set
# CONFIG_SND_SOC_WM8741 is not set
# CONFIG_SND_SOC_WM8750 is not set
# CONFIG_SND_SOC_WM8753 is not set
# CONFIG_SND_SOC_WM8770 is not set
# CONFIG_SND_SOC_WM8776 is not set
# CONFIG_SND_SOC_WM8782 is not set
# CONFIG_SND_SOC_WM8804_I2C is not set
# CONFIG_SND_SOC_WM8804_SPI is not set
# CONFIG_SND_SOC_WM8903 is not set
# CONFIG_SND_SOC_WM8904 is not set
# CONFIG_SND_SOC_WM8940 is not set
# CONFIG_SND_SOC_WM8960 is not set
# CONFIG_SND_SOC_WM8961 is not set
# CONFIG_SND_SOC_WM8962 is not set
# CONFIG_SND_SOC_WM8974 is not set
# CONFIG_SND_SOC_WM8978 is not set
# CONFIG_SND_SOC_WM8985 is not set
# CONFIG_SND_SOC_WSA881X is not set
# CONFIG_SND_SOC_WSA883X is not set
# CONFIG_SND_SOC_WSA884X is not set
# CONFIG_SND_SOC_ZL38060 is not set
# CONFIG_SND_SOC_MAX9759 is not set
# CONFIG_SND_SOC_MT6351 is not set
# CONFIG_SND_SOC_MT6358 is not set
# CONFIG_SND_SOC_MT6660 is not set
# CONFIG_SND_SOC_NAU8315 is not set
# CONFIG_SND_SOC_NAU8540 is not set
# CONFIG_SND_SOC_NAU8810 is not set
# CONFIG_SND_SOC_NAU8821 is not set
# CONFIG_SND_SOC_NAU8822 is not set
# CONFIG_SND_SOC_NAU8824 is not set
# CONFIG_SND_SOC_TPA6130A2 is not set
# CONFIG_SND_SOC_LPASS_WSA_MACRO is not set
# CONFIG_SND_SOC_LPASS_VA_MACRO is not set
# CONFIG_SND_SOC_LPASS_RX_MACRO is not set
# CONFIG_SND_SOC_LPASS_TX_MACRO is not set
# end of CODEC drivers

# CONFIG_SND_SIMPLE_CARD is not set
# CONFIG_SND_AUDIO_GRAPH_CARD is not set
# CONFIG_SND_AUDIO_GRAPH_CARD2 is not set
# CONFIG_SND_TEST_COMPONENT is not set
CONFIG_SND_X86=y
# CONFIG_HDMI_LPE_AUDIO is not set
CONFIG_SND_VIRTIO=y
CONFIG_HID_SUPPORT=y
CONFIG_HID=y
CONFIG_HID_BATTERY_STRENGTH=y
CONFIG_HIDRAW=y
CONFIG_UHID=y
CONFIG_HID_GENERIC=y

#
# Special HID drivers
#
CONFIG_HID_A4TECH=y
CONFIG_HID_ACCUTOUCH=y
CONFIG_HID_ACRUX=y
CONFIG_HID_ACRUX_FF=y
CONFIG_HID_APPLE=y
CONFIG_HID_APPLEIR=y
CONFIG_HID_ASUS=y
CONFIG_HID_AUREAL=y
CONFIG_HID_BELKIN=y
CONFIG_HID_BETOP_FF=y
# CONFIG_HID_BIGBEN_FF is not set
CONFIG_HID_CHERRY=y
CONFIG_HID_CHICONY=y
CONFIG_HID_CORSAIR=y
# CONFIG_HID_COUGAR is not set
# CONFIG_HID_MACALLY is not set
CONFIG_HID_PRODIKEYS=y
CONFIG_HID_CMEDIA=y
CONFIG_HID_CP2112=y
# CONFIG_HID_CREATIVE_SB0540 is not set
CONFIG_HID_CYPRESS=y
CONFIG_HID_DRAGONRISE=y
CONFIG_DRAGONRISE_FF=y
CONFIG_HID_EMS_FF=y
# CONFIG_HID_ELAN is not set
CONFIG_HID_ELECOM=y
CONFIG_HID_ELO=y
# CONFIG_HID_EVISION is not set
CONFIG_HID_EZKEY=y
# CONFIG_HID_FT260 is not set
CONFIG_HID_GEMBIRD=y
CONFIG_HID_GFRM=y
# CONFIG_HID_GLORIOUS is not set
CONFIG_HID_HOLTEK=y
CONFIG_HOLTEK_FF=y
# CONFIG_HID_GOOGLE_STADIA_FF is not set
# CONFIG_HID_VIVALDI is not set
CONFIG_HID_GT683R=y
CONFIG_HID_KEYTOUCH=y
CONFIG_HID_KYE=y
CONFIG_HID_UCLOGIC=y
CONFIG_HID_WALTOP=y
# CONFIG_HID_VIEWSONIC is not set
# CONFIG_HID_VRC2 is not set
# CONFIG_HID_XIAOMI is not set
CONFIG_HID_GYRATION=y
CONFIG_HID_ICADE=y
CONFIG_HID_ITE=y
# CONFIG_HID_JABRA is not set
CONFIG_HID_TWINHAN=y
CONFIG_HID_KENSINGTON=y
CONFIG_HID_LCPOWER=y
CONFIG_HID_LED=y
CONFIG_HID_LENOVO=y
# CONFIG_HID_LETSKETCH is not set
CONFIG_HID_LOGITECH=y
CONFIG_HID_LOGITECH_DJ=y
CONFIG_HID_LOGITECH_HIDPP=y
CONFIG_LOGITECH_FF=y
CONFIG_LOGIRUMBLEPAD2_FF=y
CONFIG_LOGIG940_FF=y
CONFIG_LOGIWHEELS_FF=y
CONFIG_HID_MAGICMOUSE=y
# CONFIG_HID_MALTRON is not set
CONFIG_HID_MAYFLASH=y
# CONFIG_HID_MEGAWORLD_FF is not set
CONFIG_HID_REDRAGON=y
CONFIG_HID_MICROSOFT=y
CONFIG_HID_MONTEREY=y
CONFIG_HID_MULTITOUCH=y
# CONFIG_HID_NINTENDO is not set
CONFIG_HID_NTI=y
CONFIG_HID_NTRIG=y
# CONFIG_HID_NVIDIA_SHIELD is not set
CONFIG_HID_ORTEK=y
CONFIG_HID_PANTHERLORD=y
CONFIG_PANTHERLORD_FF=y
CONFIG_HID_PENMOUNT=y
CONFIG_HID_PETALYNX=y
CONFIG_HID_PICOLCD=y
CONFIG_HID_PICOLCD_FB=y
CONFIG_HID_PICOLCD_BACKLIGHT=y
CONFIG_HID_PICOLCD_LCD=y
CONFIG_HID_PICOLCD_LEDS=y
CONFIG_HID_PICOLCD_CIR=y
CONFIG_HID_PLANTRONICS=y
# CONFIG_HID_PXRC is not set
# CONFIG_HID_RAZER is not set
CONFIG_HID_PRIMAX=y
CONFIG_HID_RETRODE=y
CONFIG_HID_ROCCAT=y
CONFIG_HID_SAITEK=y
CONFIG_HID_SAMSUNG=y
# CONFIG_HID_SEMITEK is not set
# CONFIG_HID_SIGMAMICRO is not set
CONFIG_HID_SONY=y
CONFIG_SONY_FF=y
CONFIG_HID_SPEEDLINK=y
# CONFIG_HID_STEAM is not set
CONFIG_HID_STEELSERIES=y
CONFIG_HID_SUNPLUS=y
CONFIG_HID_RMI=y
CONFIG_HID_GREENASIA=y
CONFIG_GREENASIA_FF=y
CONFIG_HID_SMARTJOYPLUS=y
CONFIG_SMARTJOYPLUS_FF=y
CONFIG_HID_TIVO=y
CONFIG_HID_TOPSEED=y
# CONFIG_HID_TOPRE is not set
CONFIG_HID_THINGM=y
CONFIG_HID_THRUSTMASTER=y
CONFIG_THRUSTMASTER_FF=y
CONFIG_HID_UDRAW_PS3=y
# CONFIG_HID_U2FZERO is not set
CONFIG_HID_WACOM=y
CONFIG_HID_WIIMOTE=y
CONFIG_HID_XINMO=y
CONFIG_HID_ZEROPLUS=y
CONFIG_ZEROPLUS_FF=y
CONFIG_HID_ZYDACRON=y
CONFIG_HID_SENSOR_HUB=y
CONFIG_HID_SENSOR_CUSTOM_SENSOR=y
CONFIG_HID_ALPS=y
# CONFIG_HID_MCP2200 is not set
# CONFIG_HID_MCP2221 is not set
# end of Special HID drivers

#
# HID-BPF support
#
# end of HID-BPF support

#
# USB HID support
#
CONFIG_USB_HID=y
CONFIG_HID_PID=y
CONFIG_USB_HIDDEV=y
# end of USB HID support

CONFIG_I2C_HID=y
# CONFIG_I2C_HID_ACPI is not set
# CONFIG_I2C_HID_OF is not set
# CONFIG_I2C_HID_OF_ELAN is not set
# CONFIG_I2C_HID_OF_GOODIX is not set

#
# Intel ISH HID support
#
CONFIG_INTEL_ISH_HID=y
# CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER is not set
# end of Intel ISH HID support

#
# AMD SFH HID Support
#
# CONFIG_AMD_SFH_HID is not set
# end of AMD SFH HID Support

CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_COMMON=y
CONFIG_USB_LED_TRIG=y
CONFIG_USB_ULPI_BUS=y
# CONFIG_USB_CONN_GPIO is not set
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB=y
CONFIG_USB_PCI=y
CONFIG_USB_PCI_AMD=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y

#
# Miscellaneous USB options
#
CONFIG_USB_DEFAULT_PERSIST=y
CONFIG_USB_FEW_INIT_RETRIES=y
CONFIG_USB_DYNAMIC_MINORS=y
CONFIG_USB_OTG=y
# CONFIG_USB_OTG_PRODUCTLIST is not set
# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set
CONFIG_USB_OTG_FSM=y
CONFIG_USB_LEDS_TRIGGER_USBPORT=y
CONFIG_USB_AUTOSUSPEND_DELAY=2
CONFIG_USB_DEFAULT_AUTHORIZATION_MODE=1
CONFIG_USB_MON=y

#
# USB Host Controller Drivers
#
CONFIG_USB_C67X00_HCD=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DBGCAP=y
CONFIG_USB_XHCI_PCI=y
# CONFIG_USB_XHCI_PCI_RENESAS is not set
CONFIG_USB_XHCI_PLATFORM=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TT_NEWSCHED=y
CONFIG_USB_EHCI_PCI=y
# CONFIG_USB_EHCI_FSL is not set
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OXU210HP_HCD=y
CONFIG_USB_ISP116X_HCD=y
CONFIG_USB_MAX3421_HCD=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PCI=y
# CONFIG_USB_OHCI_HCD_SSB is not set
CONFIG_USB_OHCI_HCD_PLATFORM=y
CONFIG_USB_UHCI_HCD=y
CONFIG_USB_SL811_HCD=y
CONFIG_USB_SL811_HCD_ISO=y
CONFIG_USB_SL811_CS=y
CONFIG_USB_R8A66597_HCD=y
CONFIG_USB_HCD_BCMA=y
CONFIG_USB_HCD_SSB=y
# CONFIG_USB_HCD_TEST_MODE is not set

#
# USB Device Class drivers
#
CONFIG_USB_ACM=y
CONFIG_USB_PRINTER=y
CONFIG_USB_WDM=y
CONFIG_USB_TMC=y

#
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
#

#
# also be needed; see USB_STORAGE Help for more info
#
CONFIG_USB_STORAGE=y
# CONFIG_USB_STORAGE_DEBUG is not set
CONFIG_USB_STORAGE_REALTEK=y
CONFIG_REALTEK_AUTOPM=y
CONFIG_USB_STORAGE_DATAFAB=y
CONFIG_USB_STORAGE_FREECOM=y
CONFIG_USB_STORAGE_ISD200=y
CONFIG_USB_STORAGE_USBAT=y
CONFIG_USB_STORAGE_SDDR09=y
CONFIG_USB_STORAGE_SDDR55=y
CONFIG_USB_STORAGE_JUMPSHOT=y
CONFIG_USB_STORAGE_ALAUDA=y
CONFIG_USB_STORAGE_ONETOUCH=y
CONFIG_USB_STORAGE_KARMA=y
CONFIG_USB_STORAGE_CYPRESS_ATACB=y
CONFIG_USB_STORAGE_ENE_UB6250=y
CONFIG_USB_UAS=y

#
# USB Imaging devices
#
CONFIG_USB_MDC800=y
CONFIG_USB_MICROTEK=y
CONFIG_USBIP_CORE=y
CONFIG_USBIP_VHCI_HCD=y
CONFIG_USBIP_VHCI_HC_PORTS=8
CONFIG_USBIP_VHCI_NR_HCS=16
CONFIG_USBIP_HOST=y
CONFIG_USBIP_VUDC=y
# CONFIG_USBIP_DEBUG is not set

#
# USB dual-mode controller drivers
#
# CONFIG_USB_CDNS_SUPPORT is not set
CONFIG_USB_MUSB_HDRC=y
# CONFIG_USB_MUSB_HOST is not set
# CONFIG_USB_MUSB_GADGET is not set
CONFIG_USB_MUSB_DUAL_ROLE=y

#
# Platform Glue Layer
#

#
# MUSB DMA mode
#
CONFIG_MUSB_PIO_ONLY=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_ULPI=y
# CONFIG_USB_DWC3_HOST is not set
CONFIG_USB_DWC3_GADGET=y
# CONFIG_USB_DWC3_DUAL_ROLE is not set

#
# Platform Glue Driver Support
#
CONFIG_USB_DWC3_PCI=y
# CONFIG_USB_DWC3_HAPS is not set
CONFIG_USB_DWC3_OF_SIMPLE=y
CONFIG_USB_DWC2=y
CONFIG_USB_DWC2_HOST=y

#
# Gadget/Dual-role mode requires USB Gadget support to be enabled
#
# CONFIG_USB_DWC2_PERIPHERAL is not set
# CONFIG_USB_DWC2_DUAL_ROLE is not set
CONFIG_USB_DWC2_PCI=y
# CONFIG_USB_DWC2_DEBUG is not set
# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set
CONFIG_USB_CHIPIDEA=y
CONFIG_USB_CHIPIDEA_UDC=y
CONFIG_USB_CHIPIDEA_HOST=y
CONFIG_USB_CHIPIDEA_PCI=y
# CONFIG_USB_CHIPIDEA_MSM is not set
# CONFIG_USB_CHIPIDEA_NPCM is not set
# CONFIG_USB_CHIPIDEA_IMX is not set
# CONFIG_USB_CHIPIDEA_GENERIC is not set
# CONFIG_USB_CHIPIDEA_TEGRA is not set
CONFIG_USB_ISP1760=y
CONFIG_USB_ISP1760_HCD=y
CONFIG_USB_ISP1761_UDC=y
# CONFIG_USB_ISP1760_HOST_ROLE is not set
# CONFIG_USB_ISP1760_GADGET_ROLE is not set
CONFIG_USB_ISP1760_DUAL_ROLE=y

#
# USB port drivers
#
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_CONSOLE=y
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_SIMPLE=y
CONFIG_USB_SERIAL_AIRCABLE=y
CONFIG_USB_SERIAL_ARK3116=y
CONFIG_USB_SERIAL_BELKIN=y
CONFIG_USB_SERIAL_CH341=y
CONFIG_USB_SERIAL_WHITEHEAT=y
CONFIG_USB_SERIAL_DIGI_ACCELEPORT=y
CONFIG_USB_SERIAL_CP210X=y
CONFIG_USB_SERIAL_CYPRESS_M8=y
CONFIG_USB_SERIAL_EMPEG=y
CONFIG_USB_SERIAL_FTDI_SIO=y
CONFIG_USB_SERIAL_VISOR=y
CONFIG_USB_SERIAL_IPAQ=y
CONFIG_USB_SERIAL_IR=y
CONFIG_USB_SERIAL_EDGEPORT=y
CONFIG_USB_SERIAL_EDGEPORT_TI=y
CONFIG_USB_SERIAL_F81232=y
CONFIG_USB_SERIAL_F8153X=y
CONFIG_USB_SERIAL_GARMIN=y
CONFIG_USB_SERIAL_IPW=y
CONFIG_USB_SERIAL_IUU=y
CONFIG_USB_SERIAL_KEYSPAN_PDA=y
CONFIG_USB_SERIAL_KEYSPAN=y
CONFIG_USB_SERIAL_KLSI=y
CONFIG_USB_SERIAL_KOBIL_SCT=y
CONFIG_USB_SERIAL_MCT_U232=y
CONFIG_USB_SERIAL_METRO=y
CONFIG_USB_SERIAL_MOS7720=y
CONFIG_USB_SERIAL_MOS7715_PARPORT=y
CONFIG_USB_SERIAL_MOS7840=y
CONFIG_USB_SERIAL_MXUPORT=y
CONFIG_USB_SERIAL_NAVMAN=y
CONFIG_USB_SERIAL_PL2303=y
CONFIG_USB_SERIAL_OTI6858=y
CONFIG_USB_SERIAL_QCAUX=y
CONFIG_USB_SERIAL_QUALCOMM=y
CONFIG_USB_SERIAL_SPCP8X5=y
CONFIG_USB_SERIAL_SAFE=y
# CONFIG_USB_SERIAL_SAFE_PADDED is not set
CONFIG_USB_SERIAL_SIERRAWIRELESS=y
CONFIG_USB_SERIAL_SYMBOL=y
CONFIG_USB_SERIAL_TI=y
CONFIG_USB_SERIAL_CYBERJACK=y
CONFIG_USB_SERIAL_WWAN=y
CONFIG_USB_SERIAL_OPTION=y
CONFIG_USB_SERIAL_OMNINET=y
CONFIG_USB_SERIAL_OPTICON=y
CONFIG_USB_SERIAL_XSENS_MT=y
CONFIG_USB_SERIAL_WISHBONE=y
CONFIG_USB_SERIAL_SSU100=y
CONFIG_USB_SERIAL_QT2=y
CONFIG_USB_SERIAL_UPD78F0730=y
CONFIG_USB_SERIAL_XR=y
CONFIG_USB_SERIAL_DEBUG=y

#
# USB Miscellaneous drivers
#
CONFIG_USB_USS720=y
CONFIG_USB_EMI62=y
CONFIG_USB_EMI26=y
CONFIG_USB_ADUTUX=y
CONFIG_USB_SEVSEG=y
CONFIG_USB_LEGOTOWER=y
CONFIG_USB_LCD=y
CONFIG_USB_CYPRESS_CY7C63=y
CONFIG_USB_CYTHERM=y
CONFIG_USB_IDMOUSE=y
CONFIG_USB_APPLEDISPLAY=y
# CONFIG_APPLE_MFI_FASTCHARGE is not set
# CONFIG_USB_LJCA is not set
CONFIG_USB_SISUSBVGA=y
CONFIG_USB_LD=y
CONFIG_USB_TRANCEVIBRATOR=y
CONFIG_USB_IOWARRIOR=y
CONFIG_USB_TEST=y
CONFIG_USB_EHSET_TEST_FIXTURE=y
CONFIG_USB_ISIGHTFW=y
CONFIG_USB_YUREX=y
CONFIG_USB_EZUSB_FX2=y
CONFIG_USB_HUB_USB251XB=y
CONFIG_USB_HSIC_USB3503=y
CONFIG_USB_HSIC_USB4604=y
CONFIG_USB_LINK_LAYER_TEST=y
CONFIG_USB_CHAOSKEY=y
# CONFIG_USB_ONBOARD_HUB is not set
CONFIG_USB_ATM=y
CONFIG_USB_SPEEDTOUCH=y
CONFIG_USB_CXACRU=y
CONFIG_USB_UEAGLEATM=y
CONFIG_USB_XUSBATM=y

#
# USB Physical Layer drivers
#
CONFIG_USB_PHY=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_GPIO_VBUS=y
CONFIG_TAHVO_USB=y
CONFIG_TAHVO_USB_HOST_BY_DEFAULT=y
CONFIG_USB_ISP1301=y
# end of USB Physical Layer drivers

CONFIG_USB_GADGET=y
# CONFIG_USB_GADGET_DEBUG is not set
CONFIG_USB_GADGET_DEBUG_FILES=y
CONFIG_USB_GADGET_DEBUG_FS=y
CONFIG_USB_GADGET_VBUS_DRAW=500
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
CONFIG_U_SERIAL_CONSOLE=y

#
# USB Peripheral Controller
#
CONFIG_USB_GR_UDC=y
CONFIG_USB_R8A66597=y
CONFIG_USB_PXA27X=y
CONFIG_USB_MV_UDC=y
CONFIG_USB_MV_U3D=y
CONFIG_USB_SNP_CORE=y
# CONFIG_USB_SNP_UDC_PLAT is not set
# CONFIG_USB_M66592 is not set
CONFIG_USB_BDC_UDC=y
CONFIG_USB_AMD5536UDC=y
CONFIG_USB_NET2272=y
CONFIG_USB_NET2272_DMA=y
CONFIG_USB_NET2280=y
CONFIG_USB_GOKU=y
CONFIG_USB_EG20T=y
# CONFIG_USB_GADGET_XILINX is not set
# CONFIG_USB_MAX3420_UDC is not set
# CONFIG_USB_CDNS2_UDC is not set
CONFIG_USB_DUMMY_HCD=y
# end of USB Peripheral Controller

CONFIG_USB_LIBCOMPOSITE=y
CONFIG_USB_F_ACM=y
CONFIG_USB_F_SS_LB=y
CONFIG_USB_U_SERIAL=y
CONFIG_USB_U_ETHER=y
CONFIG_USB_U_AUDIO=y
CONFIG_USB_F_SERIAL=y
CONFIG_USB_F_OBEX=y
CONFIG_USB_F_NCM=y
CONFIG_USB_F_ECM=y
CONFIG_USB_F_PHONET=y
CONFIG_USB_F_EEM=y
CONFIG_USB_F_SUBSET=y
CONFIG_USB_F_RNDIS=y
CONFIG_USB_F_MASS_STORAGE=y
CONFIG_USB_F_FS=y
CONFIG_USB_F_UAC1=y
CONFIG_USB_F_UAC1_LEGACY=y
CONFIG_USB_F_UAC2=y
CONFIG_USB_F_UVC=y
CONFIG_USB_F_MIDI=y
CONFIG_USB_F_HID=y
CONFIG_USB_F_PRINTER=y
CONFIG_USB_F_TCM=y
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=y
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=y
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_PHONET=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_LB_SS=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_UAC1=y
CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_MIDI=y
# CONFIG_USB_CONFIGFS_F_MIDI2 is not set
CONFIG_USB_CONFIGFS_F_HID=y
CONFIG_USB_CONFIGFS_F_UVC=y
CONFIG_USB_CONFIGFS_F_PRINTER=y
CONFIG_USB_CONFIGFS_F_TCM=y

#
# USB Gadget precomposed configurations
#
# CONFIG_USB_ZERO is not set
# CONFIG_USB_AUDIO is not set
# CONFIG_USB_ETH is not set
# CONFIG_USB_G_NCM is not set
CONFIG_USB_GADGETFS=y
# CONFIG_USB_FUNCTIONFS is not set
# CONFIG_USB_MASS_STORAGE is not set
# CONFIG_USB_GADGET_TARGET is not set
# CONFIG_USB_G_SERIAL is not set
# CONFIG_USB_MIDI_GADGET is not set
# CONFIG_USB_G_PRINTER is not set
# CONFIG_USB_CDC_COMPOSITE is not set
# CONFIG_USB_G_NOKIA is not set
# CONFIG_USB_G_ACM_MS is not set
# CONFIG_USB_G_MULTI is not set
# CONFIG_USB_G_HID is not set
# CONFIG_USB_G_DBGP is not set
# CONFIG_USB_G_WEBCAM is not set
CONFIG_USB_RAW_GADGET=y
# end of USB Gadget precomposed configurations

CONFIG_TYPEC=y
CONFIG_TYPEC_TCPM=y
CONFIG_TYPEC_TCPCI=y
# CONFIG_TYPEC_RT1711H is not set
# CONFIG_TYPEC_TCPCI_MAXIM is not set
CONFIG_TYPEC_FUSB302=y
CONFIG_TYPEC_UCSI=y
# CONFIG_UCSI_CCG is not set
CONFIG_UCSI_ACPI=y
# CONFIG_UCSI_STM32G0 is not set
CONFIG_TYPEC_TPS6598X=y
# CONFIG_TYPEC_ANX7411 is not set
# CONFIG_TYPEC_RT1719 is not set
# CONFIG_TYPEC_HD3SS3220 is not set
# CONFIG_TYPEC_STUSB160X is not set
# CONFIG_TYPEC_WUSB3801 is not set

#
# USB Type-C Multiplexer/DeMultiplexer Switch support
#
# CONFIG_TYPEC_MUX_FSA4480 is not set
# CONFIG_TYPEC_MUX_GPIO_SBU is not set
# CONFIG_TYPEC_MUX_PI3USB30532 is not set
# CONFIG_TYPEC_MUX_IT5205 is not set
# CONFIG_TYPEC_MUX_NB7VPQ904M is not set
# CONFIG_TYPEC_MUX_PTN36502 is not set
# CONFIG_TYPEC_MUX_WCD939X_USBSS is not set
# end of USB Type-C Multiplexer/DeMultiplexer Switch support

#
# USB Type-C Alternate Mode drivers
#
# CONFIG_TYPEC_DP_ALTMODE is not set
# end of USB Type-C Alternate Mode drivers

CONFIG_USB_ROLE_SWITCH=y
# CONFIG_USB_ROLES_INTEL_XHCI is not set
CONFIG_MMC=y
# CONFIG_PWRSEQ_EMMC is not set
# CONFIG_PWRSEQ_SD8787 is not set
# CONFIG_PWRSEQ_SIMPLE is not set
# CONFIG_MMC_BLOCK is not set
# CONFIG_SDIO_UART is not set
# CONFIG_MMC_TEST is not set
# CONFIG_MMC_CRYPTO is not set

#
# MMC/SD/SDIO Host Controller Drivers
#
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_SDHCI is not set
# CONFIG_MMC_WBSD is not set
# CONFIG_MMC_TIFM_SD is not set
# CONFIG_MMC_SPI is not set
# CONFIG_MMC_SDRICOH_CS is not set
# CONFIG_MMC_CB710 is not set
# CONFIG_MMC_VIA_SDMMC is not set
CONFIG_MMC_VUB300=y
CONFIG_MMC_USHC=y
# CONFIG_MMC_USDHI6ROL0 is not set
CONFIG_MMC_REALTEK_USB=y
# CONFIG_MMC_CQHCI is not set
# CONFIG_MMC_HSQ is not set
# CONFIG_MMC_TOSHIBA_PCI is not set
# CONFIG_MMC_MTK is not set
# CONFIG_SCSI_UFSHCD is not set
CONFIG_MEMSTICK=y
# CONFIG_MEMSTICK_DEBUG is not set

#
# MemoryStick drivers
#
# CONFIG_MEMSTICK_UNSAFE_RESUME is not set
# CONFIG_MSPRO_BLOCK is not set
# CONFIG_MS_BLOCK is not set

#
# MemoryStick Host Controller Drivers
#
# CONFIG_MEMSTICK_TIFM_MS is not set
# CONFIG_MEMSTICK_JMICRON_38X is not set
# CONFIG_MEMSTICK_R592 is not set
CONFIG_MEMSTICK_REALTEK_USB=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
# CONFIG_LEDS_CLASS_FLASH is not set
# CONFIG_LEDS_CLASS_MULTICOLOR is not set
# CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set

#
# LED drivers
#
# CONFIG_LEDS_AN30259A is not set
# CONFIG_LEDS_APU is not set
# CONFIG_LEDS_AW200XX is not set
# CONFIG_LEDS_AW2013 is not set
# CONFIG_LEDS_BCM6328 is not set
# CONFIG_LEDS_BCM6358 is not set
# CONFIG_LEDS_CHT_WCOVE is not set
# CONFIG_LEDS_CR0014114 is not set
# CONFIG_LEDS_EL15203000 is not set
# CONFIG_LEDS_LM3530 is not set
# CONFIG_LEDS_LM3532 is not set
# CONFIG_LEDS_LM3642 is not set
# CONFIG_LEDS_LM3692X is not set
# CONFIG_LEDS_PCA9532 is not set
# CONFIG_LEDS_GPIO is not set
# CONFIG_LEDS_LP3944 is not set
# CONFIG_LEDS_LP3952 is not set
# CONFIG_LEDS_LP8860 is not set
# CONFIG_LEDS_PCA955X is not set
# CONFIG_LEDS_PCA963X is not set
# CONFIG_LEDS_PCA995X is not set
# CONFIG_LEDS_DAC124S085 is not set
# CONFIG_LEDS_REGULATOR is not set
# CONFIG_LEDS_BD2606MVV is not set
# CONFIG_LEDS_BD2802 is not set
# CONFIG_LEDS_INTEL_SS4200 is not set
# CONFIG_LEDS_LT3593 is not set
# CONFIG_LEDS_TCA6507 is not set
# CONFIG_LEDS_TLC591XX is not set
# CONFIG_LEDS_LM355x is not set
# CONFIG_LEDS_IS31FL319X is not set
# CONFIG_LEDS_IS31FL32XX is not set

#
# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM)
#
# CONFIG_LEDS_BLINKM is not set
# CONFIG_LEDS_SYSCON is not set
# CONFIG_LEDS_MLXCPLD is not set
# CONFIG_LEDS_MLXREG is not set
# CONFIG_LEDS_USER is not set
# CONFIG_LEDS_NIC78BX is not set
# CONFIG_LEDS_SPI_BYTE is not set
# CONFIG_LEDS_LM3697 is not set
# CONFIG_LEDS_LGM is not set

#
# Flash and Torch LED drivers
#

#
# RGB LED drivers
#

#
# LED Triggers
#
CONFIG_LEDS_TRIGGERS=y
# CONFIG_LEDS_TRIGGER_TIMER is not set
# CONFIG_LEDS_TRIGGER_ONESHOT is not set
# CONFIG_LEDS_TRIGGER_DISK is not set
# CONFIG_LEDS_TRIGGER_MTD is not set
# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
# CONFIG_LEDS_TRIGGER_CPU is not set
# CONFIG_LEDS_TRIGGER_ACTIVITY is not set
# CONFIG_LEDS_TRIGGER_GPIO is not set
# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set

#
# iptables trigger is under Netfilter config (LED target)
#
# CONFIG_LEDS_TRIGGER_TRANSIENT is not set
# CONFIG_LEDS_TRIGGER_CAMERA is not set
# CONFIG_LEDS_TRIGGER_PANIC is not set
# CONFIG_LEDS_TRIGGER_NETDEV is not set
# CONFIG_LEDS_TRIGGER_PATTERN is not set
CONFIG_LEDS_TRIGGER_AUDIO=y
# CONFIG_LEDS_TRIGGER_TTY is not set

#
# Simple LED drivers
#
# CONFIG_ACCESSIBILITY is not set
CONFIG_INFINIBAND=y
CONFIG_INFINIBAND_USER_MAD=y
CONFIG_INFINIBAND_USER_ACCESS=y
CONFIG_INFINIBAND_USER_MEM=y
CONFIG_INFINIBAND_ON_DEMAND_PAGING=y
CONFIG_INFINIBAND_ADDR_TRANS=y
CONFIG_INFINIBAND_ADDR_TRANS_CONFIGFS=y
CONFIG_INFINIBAND_VIRT_DMA=y
# CONFIG_INFINIBAND_EFA is not set
# CONFIG_INFINIBAND_ERDMA is not set
CONFIG_MLX4_INFINIBAND=y
# CONFIG_INFINIBAND_MTHCA is not set
# CONFIG_INFINIBAND_OCRDMA is not set
# CONFIG_INFINIBAND_USNIC is not set
# CONFIG_INFINIBAND_VMWARE_PVRDMA is not set
# CONFIG_INFINIBAND_RDMAVT is not set
CONFIG_RDMA_RXE=y
CONFIG_RDMA_SIW=y
CONFIG_INFINIBAND_IPOIB=y
CONFIG_INFINIBAND_IPOIB_CM=y
CONFIG_INFINIBAND_IPOIB_DEBUG=y
# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
CONFIG_INFINIBAND_SRP=y
# CONFIG_INFINIBAND_SRPT is not set
CONFIG_INFINIBAND_ISER=y
CONFIG_INFINIBAND_RTRS=y
CONFIG_INFINIBAND_RTRS_CLIENT=y
# CONFIG_INFINIBAND_RTRS_SERVER is not set
# CONFIG_INFINIBAND_OPA_VNIC is not set
CONFIG_EDAC_ATOMIC_SCRUB=y
CONFIG_EDAC_SUPPORT=y
CONFIG_EDAC=y
# CONFIG_EDAC_LEGACY_SYSFS is not set
# CONFIG_EDAC_DEBUG is not set
# CONFIG_EDAC_DECODE_MCE is not set
# CONFIG_EDAC_E752X is not set
# CONFIG_EDAC_I82975X is not set
# CONFIG_EDAC_I3000 is not set
# CONFIG_EDAC_I3200 is not set
# CONFIG_EDAC_IE31200 is not set
# CONFIG_EDAC_X38 is not set
# CONFIG_EDAC_I5400 is not set
# CONFIG_EDAC_I7CORE is not set
# CONFIG_EDAC_I5100 is not set
# CONFIG_EDAC_I7300 is not set
# CONFIG_EDAC_SBRIDGE is not set
# CONFIG_EDAC_SKX is not set
# CONFIG_EDAC_I10NM is not set
# CONFIG_EDAC_PND2 is not set
# CONFIG_EDAC_IGEN6 is not set
CONFIG_RTC_LIB=y
CONFIG_RTC_MC146818_LIB=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_HCTOSYS is not set
CONFIG_RTC_SYSTOHC=y
CONFIG_RTC_SYSTOHC_DEVICE="rtc0"
# CONFIG_RTC_DEBUG is not set
# CONFIG_RTC_NVMEM is not set

#
# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
# CONFIG_RTC_DRV_TEST is not set

#
# I2C RTC drivers
#
# CONFIG_RTC_DRV_ABB5ZES3 is not set
# CONFIG_RTC_DRV_ABEOZ9 is not set
# CONFIG_RTC_DRV_ABX80X is not set
# CONFIG_RTC_DRV_DS1307 is not set
# CONFIG_RTC_DRV_DS1374 is not set
# CONFIG_RTC_DRV_DS1672 is not set
# CONFIG_RTC_DRV_HYM8563 is not set
# CONFIG_RTC_DRV_MAX6900 is not set
# CONFIG_RTC_DRV_MAX31335 is not set
# CONFIG_RTC_DRV_NCT3018Y is not set
# CONFIG_RTC_DRV_RS5C372 is not set
# CONFIG_RTC_DRV_ISL1208 is not set
# CONFIG_RTC_DRV_ISL12022 is not set
# CONFIG_RTC_DRV_ISL12026 is not set
# CONFIG_RTC_DRV_X1205 is not set
# CONFIG_RTC_DRV_PCF8523 is not set
# CONFIG_RTC_DRV_PCF85063 is not set
# CONFIG_RTC_DRV_PCF85363 is not set
# CONFIG_RTC_DRV_PCF8563 is not set
# CONFIG_RTC_DRV_PCF8583 is not set
# CONFIG_RTC_DRV_M41T80 is not set
# CONFIG_RTC_DRV_BQ32K is not set
# CONFIG_RTC_DRV_TWL4030 is not set
# CONFIG_RTC_DRV_S35390A is not set
# CONFIG_RTC_DRV_FM3130 is not set
# CONFIG_RTC_DRV_RX8010 is not set
# CONFIG_RTC_DRV_RX8581 is not set
# CONFIG_RTC_DRV_RX8025 is not set
# CONFIG_RTC_DRV_EM3027 is not set
# CONFIG_RTC_DRV_RV3028 is not set
# CONFIG_RTC_DRV_RV3032 is not set
# CONFIG_RTC_DRV_RV8803 is not set
# CONFIG_RTC_DRV_SD3078 is not set

#
# SPI RTC drivers
#
# CONFIG_RTC_DRV_M41T93 is not set
# CONFIG_RTC_DRV_M41T94 is not set
# CONFIG_RTC_DRV_DS1302 is not set
# CONFIG_RTC_DRV_DS1305 is not set
# CONFIG_RTC_DRV_DS1343 is not set
# CONFIG_RTC_DRV_DS1347 is not set
# CONFIG_RTC_DRV_DS1390 is not set
# CONFIG_RTC_DRV_MAX6916 is not set
# CONFIG_RTC_DRV_R9701 is not set
# CONFIG_RTC_DRV_RX4581 is not set
# CONFIG_RTC_DRV_RS5C348 is not set
# CONFIG_RTC_DRV_MAX6902 is not set
# CONFIG_RTC_DRV_PCF2123 is not set
# CONFIG_RTC_DRV_MCP795 is not set
CONFIG_RTC_I2C_AND_SPI=y

#
# SPI and I2C RTC drivers
#
# CONFIG_RTC_DRV_DS3232 is not set
# CONFIG_RTC_DRV_PCF2127 is not set
# CONFIG_RTC_DRV_RV3029C2 is not set
# CONFIG_RTC_DRV_RX6110 is not set

#
# Platform RTC drivers
#
CONFIG_RTC_DRV_CMOS=y
# CONFIG_RTC_DRV_DS1286 is not set
# CONFIG_RTC_DRV_DS1511 is not set
# CONFIG_RTC_DRV_DS1553 is not set
# CONFIG_RTC_DRV_DS1685_FAMILY is not set
# CONFIG_RTC_DRV_DS1742 is not set
# CONFIG_RTC_DRV_DS2404 is not set
# CONFIG_RTC_DRV_STK17TA8 is not set
# CONFIG_RTC_DRV_M48T86 is not set
# CONFIG_RTC_DRV_M48T35 is not set
# CONFIG_RTC_DRV_M48T59 is not set
# CONFIG_RTC_DRV_MSM6242 is not set
# CONFIG_RTC_DRV_RP5C01 is not set
# CONFIG_RTC_DRV_ZYNQMP is not set

#
# on-CPU RTC drivers
#
# CONFIG_RTC_DRV_CADENCE is not set
# CONFIG_RTC_DRV_FTRTC010 is not set
# CONFIG_RTC_DRV_R7301 is not set

#
# HID Sensor RTC drivers
#
CONFIG_RTC_DRV_HID_SENSOR_TIME=y
# CONFIG_RTC_DRV_GOLDFISH is not set
CONFIG_DMADEVICES=y
# CONFIG_DMADEVICES_DEBUG is not set

#
# DMA Devices
#
CONFIG_DMA_ENGINE=y
CONFIG_DMA_VIRTUAL_CHANNELS=y
CONFIG_DMA_ACPI=y
CONFIG_DMA_OF=y
# CONFIG_ALTERA_MSGDMA is not set
# CONFIG_DW_AXI_DMAC is not set
# CONFIG_FSL_EDMA is not set
CONFIG_INTEL_IDMA64=y
# CONFIG_INTEL_IDXD is not set
# CONFIG_INTEL_IDXD_COMPAT is not set
CONFIG_INTEL_IOATDMA=y
# CONFIG_PLX_DMA is not set
# CONFIG_XILINX_DMA is not set
# CONFIG_XILINX_XDMA is not set
# CONFIG_XILINX_ZYNQMP_DPDMA is not set
# CONFIG_AMD_PTDMA is not set
# CONFIG_QCOM_HIDMA_MGMT is not set
# CONFIG_QCOM_HIDMA is not set
CONFIG_DW_DMAC_CORE=y
# CONFIG_DW_DMAC is not set
# CONFIG_DW_DMAC_PCI is not set
# CONFIG_DW_EDMA is not set
CONFIG_HSU_DMA=y
# CONFIG_SF_PDMA is not set
# CONFIG_INTEL_LDMA is not set

#
# DMA Clients
#
CONFIG_ASYNC_TX_DMA=y
# CONFIG_DMATEST is not set
CONFIG_DMA_ENGINE_RAID=y

#
# DMABUF options
#
CONFIG_SYNC_FILE=y
CONFIG_SW_SYNC=y
CONFIG_UDMABUF=y
CONFIG_DMABUF_MOVE_NOTIFY=y
# CONFIG_DMABUF_DEBUG is not set
# CONFIG_DMABUF_SELFTESTS is not set
CONFIG_DMABUF_HEAPS=y
# CONFIG_DMABUF_SYSFS_STATS is not set
CONFIG_DMABUF_HEAPS_SYSTEM=y
CONFIG_DMABUF_HEAPS_CMA=y
# end of DMABUF options

CONFIG_DCA=y
# CONFIG_UIO is not set
CONFIG_VFIO=y
CONFIG_VFIO_DEVICE_CDEV=y
# CONFIG_VFIO_GROUP is not set
CONFIG_VFIO_VIRQFD=y
# CONFIG_VFIO_DEBUGFS is not set

#
# VFIO support for PCI devices
#
CONFIG_VFIO_PCI_CORE=y
CONFIG_VFIO_PCI_MMAP=y
CONFIG_VFIO_PCI_INTX=y
CONFIG_VFIO_PCI=y
# CONFIG_VFIO_PCI_VGA is not set
# CONFIG_VFIO_PCI_IGD is not set
# CONFIG_VIRTIO_VFIO_PCI is not set
# end of VFIO support for PCI devices

CONFIG_IRQ_BYPASS_MANAGER=y
# CONFIG_VIRT_DRIVERS is not set
CONFIG_VIRTIO_ANCHOR=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI_LIB=y
CONFIG_VIRTIO_PCI_LIB_LEGACY=y
CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_PCI_ADMIN_LEGACY=y
CONFIG_VIRTIO_PCI_LEGACY=y
CONFIG_VIRTIO_VDPA=y
CONFIG_VIRTIO_PMEM=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_MEM=y
CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
CONFIG_VIRTIO_DMA_SHARED_BUFFER=y
CONFIG_VDPA=y
CONFIG_VDPA_SIM=y
CONFIG_VDPA_SIM_NET=y
CONFIG_VDPA_SIM_BLOCK=y
CONFIG_VDPA_USER=y
# CONFIG_IFCVF is not set
# CONFIG_MLX5_VDPA_STEERING_DEBUG is not set
CONFIG_VP_VDPA=y
# CONFIG_ALIBABA_ENI_VDPA is not set
# CONFIG_SNET_VDPA is not set
CONFIG_VHOST_IOTLB=y
CONFIG_VHOST_RING=y
CONFIG_VHOST_TASK=y
CONFIG_VHOST=y
CONFIG_VHOST_MENU=y
CONFIG_VHOST_NET=y
# CONFIG_VHOST_SCSI is not set
CONFIG_VHOST_VSOCK=y
CONFIG_VHOST_VDPA=y
CONFIG_VHOST_CROSS_ENDIAN_LEGACY=y

#
# Microsoft Hyper-V guest support
#
# CONFIG_HYPERV is not set
# end of Microsoft Hyper-V guest support

CONFIG_GREYBUS=y
# CONFIG_GREYBUS_BEAGLEPLAY is not set
CONFIG_GREYBUS_ES2=y
CONFIG_COMEDI=y
# CONFIG_COMEDI_DEBUG is not set
CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB=2048
CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB=20480
# CONFIG_COMEDI_MISC_DRIVERS is not set
# CONFIG_COMEDI_PCI_DRIVERS is not set
# CONFIG_COMEDI_PCMCIA_DRIVERS is not set
CONFIG_COMEDI_USB_DRIVERS=y
CONFIG_COMEDI_DT9812=y
CONFIG_COMEDI_NI_USB6501=y
CONFIG_COMEDI_USBDUX=y
CONFIG_COMEDI_USBDUXFAST=y
CONFIG_COMEDI_USBDUXSIGMA=y
CONFIG_COMEDI_VMK80XX=y
# CONFIG_COMEDI_8255_SA is not set
# CONFIG_COMEDI_KCOMEDILIB is not set
# CONFIG_COMEDI_TESTS is not set
CONFIG_STAGING=y
# CONFIG_PRISM2_USB is not set
# CONFIG_RTLLIB is not set
# CONFIG_RTL8723BS is not set
CONFIG_R8712U=y
# CONFIG_RTS5208 is not set
# CONFIG_VT6655 is not set
# CONFIG_VT6656 is not set

#
# IIO staging drivers
#

#
# Accelerometers
#
# CONFIG_ADIS16203 is not set
# CONFIG_ADIS16240 is not set
# end of Accelerometers

#
# Analog to digital converters
#
# CONFIG_AD7816 is not set
# end of Analog to digital converters

#
# Analog digital bi-direction converters
#
# CONFIG_ADT7316 is not set
# end of Analog digital bi-direction converters

#
# Direct Digital Synthesis
#
# CONFIG_AD9832 is not set
# CONFIG_AD9834 is not set
# end of Direct Digital Synthesis

#
# Network Analyzer, Impedance Converters
#
# CONFIG_AD5933 is not set
# end of Network Analyzer, Impedance Converters
# end of IIO staging drivers

# CONFIG_FB_SM750 is not set
# CONFIG_STAGING_MEDIA is not set
# CONFIG_LTE_GDM724X is not set
# CONFIG_MOST_COMPONENTS is not set
# CONFIG_KS7010 is not set
# CONFIG_GREYBUS_AUDIO is not set
# CONFIG_GREYBUS_BOOTROM is not set
# CONFIG_GREYBUS_FIRMWARE is not set
CONFIG_GREYBUS_HID=y
# CONFIG_GREYBUS_LOG is not set
# CONFIG_GREYBUS_LOOPBACK is not set
# CONFIG_GREYBUS_POWER is not set
# CONFIG_GREYBUS_RAW is not set
# CONFIG_GREYBUS_VIBRATOR is not set
CONFIG_GREYBUS_BRIDGED_PHY=y
# CONFIG_GREYBUS_GPIO is not set
# CONFIG_GREYBUS_I2C is not set
# CONFIG_GREYBUS_SDIO is not set
# CONFIG_GREYBUS_SPI is not set
# CONFIG_GREYBUS_UART is not set
CONFIG_GREYBUS_USB=y
# CONFIG_PI433 is not set
# CONFIG_XIL_AXIS_FIFO is not set
# CONFIG_FIELDBUS_DEV is not set
# CONFIG_VME_BUS is not set
# CONFIG_GOLDFISH is not set
# CONFIG_CHROME_PLATFORMS is not set
# CONFIG_MELLANOX_PLATFORM is not set
CONFIG_SURFACE_PLATFORMS=y
# CONFIG_SURFACE3_WMI is not set
# CONFIG_SURFACE_3_POWER_OPREGION is not set
# CONFIG_SURFACE_GPE is not set
# CONFIG_SURFACE_HOTPLUG is not set
# CONFIG_SURFACE_PRO3_BUTTON is not set
# CONFIG_SURFACE_AGGREGATOR is not set
CONFIG_X86_PLATFORM_DEVICES=y
CONFIG_ACPI_WMI=y
CONFIG_WMI_BMOF=y
# CONFIG_HUAWEI_WMI is not set
# CONFIG_MXM_WMI is not set
# CONFIG_NVIDIA_WMI_EC_BACKLIGHT is not set
# CONFIG_XIAOMI_WMI is not set
# CONFIG_GIGABYTE_WMI is not set
# CONFIG_YOGABOOK is not set
# CONFIG_ACERHDF is not set
# CONFIG_ACER_WIRELESS is not set
# CONFIG_ACER_WMI is not set
# CONFIG_AMD_PMC is not set
# CONFIG_AMD_HSMP is not set
# CONFIG_AMD_WBRF is not set
# CONFIG_ADV_SWBUTTON is not set
# CONFIG_APPLE_GMUX is not set
# CONFIG_ASUS_LAPTOP is not set
# CONFIG_ASUS_WIRELESS is not set
CONFIG_ASUS_WMI=y
# CONFIG_ASUS_NB_WMI is not set
# CONFIG_ASUS_TF103C_DOCK is not set
CONFIG_EEEPC_LAPTOP=y
# CONFIG_EEEPC_WMI is not set
# CONFIG_X86_PLATFORM_DRIVERS_DELL is not set
# CONFIG_AMILO_RFKILL is not set
# CONFIG_FUJITSU_LAPTOP is not set
# CONFIG_FUJITSU_TABLET is not set
# CONFIG_GPD_POCKET_FAN is not set
# CONFIG_X86_PLATFORM_DRIVERS_HP is not set
# CONFIG_WIRELESS_HOTKEY is not set
# CONFIG_IBM_RTL is not set
# CONFIG_IDEAPAD_LAPTOP is not set
# CONFIG_LENOVO_YMC is not set
# CONFIG_SENSORS_HDAPS is not set
# CONFIG_THINKPAD_ACPI is not set
# CONFIG_THINKPAD_LMI is not set
# CONFIG_INTEL_ATOMISP2_PM is not set
# CONFIG_INTEL_IFS is not set
# CONFIG_INTEL_SAR_INT1092 is not set
# CONFIG_INTEL_SKL_INT3472 is not set

#
# Intel Speed Select Technology interface support
#
# CONFIG_INTEL_SPEED_SELECT_INTERFACE is not set
# end of Intel Speed Select Technology interface support

# CONFIG_INTEL_WMI_SBL_FW_UPDATE is not set
# CONFIG_INTEL_WMI_THUNDERBOLT is not set

#
# Intel Uncore Frequency Control
#
# CONFIG_INTEL_UNCORE_FREQ_CONTROL is not set
# end of Intel Uncore Frequency Control

# CONFIG_INTEL_HID_EVENT is not set
# CONFIG_INTEL_VBTN is not set
# CONFIG_INTEL_INT0002_VGPIO is not set
# CONFIG_INTEL_OAKTRAIL is not set
# CONFIG_INTEL_ISHTP_ECLITE is not set
# CONFIG_INTEL_PUNIT_IPC is not set
# CONFIG_INTEL_RST is not set
# CONFIG_INTEL_SMARTCONNECT is not set
# CONFIG_INTEL_TURBO_MAX_3 is not set
# CONFIG_INTEL_VSEC is not set
# CONFIG_MSI_EC is not set
# CONFIG_MSI_LAPTOP is not set
# CONFIG_MSI_WMI is not set
# CONFIG_PCENGINES_APU2 is not set
# CONFIG_BARCO_P50_GPIO is not set
# CONFIG_SAMSUNG_LAPTOP is not set
# CONFIG_SAMSUNG_Q10 is not set
# CONFIG_ACPI_TOSHIBA is not set
# CONFIG_TOSHIBA_BT_RFKILL is not set
# CONFIG_TOSHIBA_HAPS is not set
# CONFIG_TOSHIBA_WMI is not set
# CONFIG_ACPI_CMPC is not set
# CONFIG_COMPAL_LAPTOP is not set
# CONFIG_LG_LAPTOP is not set
# CONFIG_PANASONIC_LAPTOP is not set
# CONFIG_SONY_LAPTOP is not set
# CONFIG_SYSTEM76_ACPI is not set
# CONFIG_TOPSTAR_LAPTOP is not set
# CONFIG_SERIAL_MULTI_INSTANTIATE is not set
# CONFIG_MLX_PLATFORM is not set
# CONFIG_INSPUR_PLATFORM_PROFILE is not set
# CONFIG_INTEL_IPS is not set
# CONFIG_INTEL_SCU_PCI is not set
# CONFIG_INTEL_SCU_PLATFORM is not set
# CONFIG_SIEMENS_SIMATIC_IPC is not set
# CONFIG_WINMATE_FM07_KEYS is not set
CONFIG_P2SB=y
CONFIG_HAVE_CLK=y
CONFIG_HAVE_CLK_PREPARE=y
CONFIG_COMMON_CLK=y
# CONFIG_LMK04832 is not set
# CONFIG_COMMON_CLK_MAX9485 is not set
# CONFIG_COMMON_CLK_SI5341 is not set
# CONFIG_COMMON_CLK_SI5351 is not set
# CONFIG_COMMON_CLK_SI514 is not set
# CONFIG_COMMON_CLK_SI544 is not set
# CONFIG_COMMON_CLK_SI570 is not set
# CONFIG_COMMON_CLK_CDCE706 is not set
# CONFIG_COMMON_CLK_CDCE925 is not set
# CONFIG_COMMON_CLK_CS2000_CP is not set
# CONFIG_CLK_TWL is not set
# CONFIG_COMMON_CLK_AXI_CLKGEN is not set
# CONFIG_COMMON_CLK_RS9_PCIE is not set
# CONFIG_COMMON_CLK_SI521XX is not set
# CONFIG_COMMON_CLK_VC3 is not set
# CONFIG_COMMON_CLK_VC5 is not set
# CONFIG_COMMON_CLK_VC7 is not set
# CONFIG_COMMON_CLK_FIXED_MMIO is not set
# CONFIG_CLK_LGM_CGU is not set
# CONFIG_XILINX_VCU is not set
# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set
# CONFIG_HWSPINLOCK is not set

#
# Clock Source drivers
#
CONFIG_CLKEVT_I8253=y
CONFIG_I8253_LOCK=y
CONFIG_CLKBLD_I8253=y
# end of Clock Source drivers

CONFIG_MAILBOX=y
# CONFIG_PLATFORM_MHU is not set
CONFIG_PCC=y
# CONFIG_ALTERA_MBOX is not set
# CONFIG_MAILBOX_TEST is not set
CONFIG_IOMMU_IOVA=y
CONFIG_IOMMU_API=y
CONFIG_IOMMUFD_DRIVER=y
CONFIG_IOMMU_SUPPORT=y

#
# Generic IOMMU Pagetable Support
#
# end of Generic IOMMU Pagetable Support

# CONFIG_IOMMU_DEBUGFS is not set
# CONFIG_IOMMU_DEFAULT_DMA_STRICT is not set
CONFIG_IOMMU_DEFAULT_DMA_LAZY=y
# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set
CONFIG_OF_IOMMU=y
CONFIG_IOMMU_DMA=y
CONFIG_IOMMU_SVA=y
CONFIG_IOMMU_IOPF=y
# CONFIG_AMD_IOMMU is not set
CONFIG_DMAR_TABLE=y
CONFIG_INTEL_IOMMU=y
CONFIG_INTEL_IOMMU_SVM=y
CONFIG_INTEL_IOMMU_DEFAULT_ON=y
CONFIG_INTEL_IOMMU_FLOPPY_WA=y
CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON=y
CONFIG_INTEL_IOMMU_PERF_EVENTS=y
CONFIG_IOMMUFD=y
CONFIG_IOMMUFD_TEST=y
CONFIG_IRQ_REMAP=y
# CONFIG_VIRTIO_IOMMU is not set

#
# Remoteproc drivers
#
# CONFIG_REMOTEPROC is not set
# end of Remoteproc drivers

#
# Rpmsg drivers
#
# CONFIG_RPMSG_QCOM_GLINK_RPM is not set
# CONFIG_RPMSG_VIRTIO is not set
# end of Rpmsg drivers

CONFIG_SOUNDWIRE=y

#
# SoundWire Devices
#
# CONFIG_SOUNDWIRE_AMD is not set
# CONFIG_SOUNDWIRE_INTEL is not set
# CONFIG_SOUNDWIRE_QCOM is not set

#
# SOC (System On Chip) specific Drivers
#

#
# Amlogic SoC drivers
#
# end of Amlogic SoC drivers

#
# Broadcom SoC drivers
#
# end of Broadcom SoC drivers

#
# NXP/Freescale QorIQ SoC drivers
#
# end of NXP/Freescale QorIQ SoC drivers

#
# fujitsu SoC drivers
#
# end of fujitsu SoC drivers

#
# i.MX SoC drivers
#
# end of i.MX SoC drivers

#
# Enable LiteX SoC Builder specific drivers
#
# CONFIG_LITEX_SOC_CONTROLLER is not set
# end of Enable LiteX SoC Builder specific drivers

# CONFIG_WPCM450_SOC is not set

#
# Qualcomm SoC drivers
#
CONFIG_QCOM_QMI_HELPERS=y
# end of Qualcomm SoC drivers

# CONFIG_SOC_TI is not set

#
# Xilinx SoC drivers
#
# end of Xilinx SoC drivers
# end of SOC (System On Chip) specific Drivers

#
# PM Domains
#

#
# Amlogic PM Domains
#
# end of Amlogic PM Domains

#
# Broadcom PM Domains
#
# end of Broadcom PM Domains

#
# i.MX PM Domains
#
# end of i.MX PM Domains

#
# Qualcomm PM Domains
#
# end of Qualcomm PM Domains
# end of PM Domains

# CONFIG_PM_DEVFREQ is not set
CONFIG_EXTCON=y

#
# Extcon Device Drivers
#
# CONFIG_EXTCON_ADC_JACK is not set
# CONFIG_EXTCON_FSA9480 is not set
# CONFIG_EXTCON_GPIO is not set
# CONFIG_EXTCON_INTEL_INT3496 is not set
CONFIG_EXTCON_INTEL_CHT_WC=y
# CONFIG_EXTCON_MAX3355 is not set
# CONFIG_EXTCON_PTN5150 is not set
# CONFIG_EXTCON_RT8973A is not set
# CONFIG_EXTCON_SM5502 is not set
# CONFIG_EXTCON_USB_GPIO is not set
# CONFIG_EXTCON_USBC_TUSB320 is not set
# CONFIG_MEMORY is not set
CONFIG_IIO=y
CONFIG_IIO_BUFFER=y
# CONFIG_IIO_BUFFER_CB is not set
# CONFIG_IIO_BUFFER_DMA is not set
# CONFIG_IIO_BUFFER_DMAENGINE is not set
# CONFIG_IIO_BUFFER_HW_CONSUMER is not set
CONFIG_IIO_KFIFO_BUF=y
CONFIG_IIO_TRIGGERED_BUFFER=y
# CONFIG_IIO_CONFIGFS is not set
CONFIG_IIO_TRIGGER=y
CONFIG_IIO_CONSUMERS_PER_TRIGGER=2
# CONFIG_IIO_SW_DEVICE is not set
# CONFIG_IIO_SW_TRIGGER is not set
# CONFIG_IIO_TRIGGERED_EVENT is not set

#
# Accelerometers
#
# CONFIG_ADIS16201 is not set
# CONFIG_ADIS16209 is not set
# CONFIG_ADXL313_I2C is not set
# CONFIG_ADXL313_SPI is not set
# CONFIG_ADXL345_I2C is not set
# CONFIG_ADXL345_SPI is not set
# CONFIG_ADXL355_I2C is not set
# CONFIG_ADXL355_SPI is not set
# CONFIG_ADXL367_SPI is not set
# CONFIG_ADXL367_I2C is not set
# CONFIG_ADXL372_SPI is not set
# CONFIG_ADXL372_I2C is not set
# CONFIG_BMA180 is not set
# CONFIG_BMA220 is not set
# CONFIG_BMA400 is not set
# CONFIG_BMC150_ACCEL is not set
# CONFIG_BMI088_ACCEL is not set
# CONFIG_DA280 is not set
# CONFIG_DA311 is not set
# CONFIG_DMARD06 is not set
# CONFIG_DMARD09 is not set
# CONFIG_DMARD10 is not set
# CONFIG_FXLS8962AF_I2C is not set
# CONFIG_FXLS8962AF_SPI is not set
CONFIG_HID_SENSOR_ACCEL_3D=y
# CONFIG_IIO_ST_ACCEL_3AXIS is not set
# CONFIG_IIO_KX022A_SPI is not set
# CONFIG_IIO_KX022A_I2C is not set
# CONFIG_KXSD9 is not set
# CONFIG_KXCJK1013 is not set
# CONFIG_MC3230 is not set
# CONFIG_MMA7455_I2C is not set
# CONFIG_MMA7455_SPI is not set
# CONFIG_MMA7660 is not set
# CONFIG_MMA8452 is not set
# CONFIG_MMA9551 is not set
# CONFIG_MMA9553 is not set
# CONFIG_MSA311 is not set
# CONFIG_MXC4005 is not set
# CONFIG_MXC6255 is not set
# CONFIG_SCA3000 is not set
# CONFIG_SCA3300 is not set
# CONFIG_STK8312 is not set
# CONFIG_STK8BA50 is not set
# end of Accelerometers

#
# Analog to digital converters
#
# CONFIG_AD4130 is not set
# CONFIG_AD7091R5 is not set
# CONFIG_AD7091R8 is not set
# CONFIG_AD7124 is not set
# CONFIG_AD7192 is not set
# CONFIG_AD7266 is not set
# CONFIG_AD7280 is not set
# CONFIG_AD7291 is not set
# CONFIG_AD7292 is not set
# CONFIG_AD7298 is not set
# CONFIG_AD7476 is not set
# CONFIG_AD7606_IFACE_PARALLEL is not set
# CONFIG_AD7606_IFACE_SPI is not set
# CONFIG_AD7766 is not set
# CONFIG_AD7768_1 is not set
# CONFIG_AD7780 is not set
# CONFIG_AD7791 is not set
# CONFIG_AD7793 is not set
# CONFIG_AD7887 is not set
# CONFIG_AD7923 is not set
# CONFIG_AD7949 is not set
# CONFIG_AD799X is not set
# CONFIG_AD9467 is not set
# CONFIG_ADI_AXI_ADC is not set
# CONFIG_CC10001_ADC is not set
CONFIG_DLN2_ADC=y
# CONFIG_ENVELOPE_DETECTOR is not set
# CONFIG_HI8435 is not set
# CONFIG_HX711 is not set
# CONFIG_INA2XX_ADC is not set
# CONFIG_LTC2309 is not set
# CONFIG_LTC2471 is not set
# CONFIG_LTC2485 is not set
# CONFIG_LTC2496 is not set
# CONFIG_LTC2497 is not set
# CONFIG_MAX1027 is not set
# CONFIG_MAX11100 is not set
# CONFIG_MAX1118 is not set
# CONFIG_MAX11205 is not set
# CONFIG_MAX11410 is not set
# CONFIG_MAX1241 is not set
# CONFIG_MAX1363 is not set
# CONFIG_MAX34408 is not set
# CONFIG_MAX9611 is not set
# CONFIG_MCP320X is not set
# CONFIG_MCP3422 is not set
# CONFIG_MCP3564 is not set
# CONFIG_MCP3911 is not set
# CONFIG_NAU7802 is not set
# CONFIG_PAC1934 is not set
# CONFIG_RICHTEK_RTQ6056 is not set
# CONFIG_SD_ADC_MODULATOR is not set
# CONFIG_TI_ADC081C is not set
# CONFIG_TI_ADC0832 is not set
# CONFIG_TI_ADC084S021 is not set
# CONFIG_TI_ADC12138 is not set
# CONFIG_TI_ADC108S102 is not set
# CONFIG_TI_ADC128S052 is not set
# CONFIG_TI_ADC161S626 is not set
# CONFIG_TI_ADS1015 is not set
# CONFIG_TI_ADS7924 is not set
# CONFIG_TI_ADS1100 is not set
# CONFIG_TI_ADS1298 is not set
# CONFIG_TI_ADS7950 is not set
# CONFIG_TI_ADS8344 is not set
# CONFIG_TI_ADS8688 is not set
# CONFIG_TI_ADS124S08 is not set
# CONFIG_TI_ADS131E08 is not set
# CONFIG_TI_LMP92064 is not set
# CONFIG_TI_TLC4541 is not set
# CONFIG_TI_TSC2046 is not set
# CONFIG_TWL4030_MADC is not set
# CONFIG_TWL6030_GPADC is not set
# CONFIG_VF610_ADC is not set
CONFIG_VIPERBOARD_ADC=y
# CONFIG_XILINX_XADC is not set
# end of Analog to digital converters

#
# Analog to digital and digital to analog converters
#
# CONFIG_AD74115 is not set
# CONFIG_AD74413R is not set
# end of Analog to digital and digital to analog converters

#
# Analog Front Ends
#
# CONFIG_IIO_RESCALE is not set
# end of Analog Front Ends

#
# Amplifiers
#
# CONFIG_AD8366 is not set
# CONFIG_ADA4250 is not set
# CONFIG_HMC425 is not set
# end of Amplifiers

#
# Capacitance to digital converters
#
# CONFIG_AD7150 is not set
# CONFIG_AD7746 is not set
# end of Capacitance to digital converters

#
# Chemical Sensors
#
# CONFIG_AOSONG_AGS02MA is not set
# CONFIG_ATLAS_PH_SENSOR is not set
# CONFIG_ATLAS_EZO_SENSOR is not set
# CONFIG_BME680 is not set
# CONFIG_CCS811 is not set
# CONFIG_IAQCORE is not set
# CONFIG_PMS7003 is not set
# CONFIG_SCD30_CORE is not set
# CONFIG_SCD4X is not set
# CONFIG_SENSIRION_SGP30 is not set
# CONFIG_SENSIRION_SGP40 is not set
# CONFIG_SPS30_I2C is not set
# CONFIG_SPS30_SERIAL is not set
# CONFIG_SENSEAIR_SUNRISE_CO2 is not set
# CONFIG_VZ89X is not set
# end of Chemical Sensors

#
# Hid Sensor IIO Common
#
CONFIG_HID_SENSOR_IIO_COMMON=y
CONFIG_HID_SENSOR_IIO_TRIGGER=y
# end of Hid Sensor IIO Common

#
# IIO SCMI Sensors
#
# end of IIO SCMI Sensors

#
# SSP Sensor Common
#
# CONFIG_IIO_SSP_SENSORHUB is not set
# end of SSP Sensor Common

#
# Digital to analog converters
#
# CONFIG_AD3552R is not set
# CONFIG_AD5064 is not set
# CONFIG_AD5360 is not set
# CONFIG_AD5380 is not set
# CONFIG_AD5421 is not set
# CONFIG_AD5446 is not set
# CONFIG_AD5449 is not set
# CONFIG_AD5592R is not set
# CONFIG_AD5593R is not set
# CONFIG_AD5504 is not set
# CONFIG_AD5624R_SPI is not set
# CONFIG_LTC2688 is not set
# CONFIG_AD5686_SPI is not set
# CONFIG_AD5696_I2C is not set
# CONFIG_AD5755 is not set
# CONFIG_AD5758 is not set
# CONFIG_AD5761 is not set
# CONFIG_AD5764 is not set
# CONFIG_AD5766 is not set
# CONFIG_AD5770R is not set
# CONFIG_AD5791 is not set
# CONFIG_AD7293 is not set
# CONFIG_AD7303 is not set
# CONFIG_AD8801 is not set
# CONFIG_DPOT_DAC is not set
# CONFIG_DS4424 is not set
# CONFIG_LTC1660 is not set
# CONFIG_LTC2632 is not set
# CONFIG_M62332 is not set
# CONFIG_MAX517 is not set
# CONFIG_MAX5522 is not set
# CONFIG_MAX5821 is not set
# CONFIG_MCP4725 is not set
# CONFIG_MCP4728 is not set
# CONFIG_MCP4821 is not set
# CONFIG_MCP4922 is not set
# CONFIG_TI_DAC082S085 is not set
# CONFIG_TI_DAC5571 is not set
# CONFIG_TI_DAC7311 is not set
# CONFIG_TI_DAC7612 is not set
# CONFIG_VF610_DAC is not set
# end of Digital to analog converters

#
# IIO dummy driver
#
# end of IIO dummy driver

#
# Filters
#
# CONFIG_ADMV8818 is not set
# end of Filters

#
# Frequency Synthesizers DDS/PLL
#

#
# Clock Generator/Distribution
#
# CONFIG_AD9523 is not set
# end of Clock Generator/Distribution

#
# Phase-Locked Loop (PLL) frequency synthesizers
#
# CONFIG_ADF4350 is not set
# CONFIG_ADF4371 is not set
# CONFIG_ADF4377 is not set
# CONFIG_ADMFM2000 is not set
# CONFIG_ADMV1013 is not set
# CONFIG_ADMV1014 is not set
# CONFIG_ADMV4420 is not set
# CONFIG_ADRF6780 is not set
# end of Phase-Locked Loop (PLL) frequency synthesizers
# end of Frequency Synthesizers DDS/PLL

#
# Digital gyroscope sensors
#
# CONFIG_ADIS16080 is not set
# CONFIG_ADIS16130 is not set
# CONFIG_ADIS16136 is not set
# CONFIG_ADIS16260 is not set
# CONFIG_ADXRS290 is not set
# CONFIG_ADXRS450 is not set
# CONFIG_BMG160 is not set
# CONFIG_FXAS21002C is not set
CONFIG_HID_SENSOR_GYRO_3D=y
# CONFIG_MPU3050_I2C is not set
# CONFIG_IIO_ST_GYRO_3AXIS is not set
# CONFIG_ITG3200 is not set
# end of Digital gyroscope sensors

#
# Health Sensors
#

#
# Heart Rate Monitors
#
# CONFIG_AFE4403 is not set
# CONFIG_AFE4404 is not set
# CONFIG_MAX30100 is not set
# CONFIG_MAX30102 is not set
# end of Heart Rate Monitors
# end of Health Sensors

#
# Humidity sensors
#
# CONFIG_AM2315 is not set
# CONFIG_DHT11 is not set
# CONFIG_HDC100X is not set
# CONFIG_HDC2010 is not set
# CONFIG_HDC3020 is not set
CONFIG_HID_SENSOR_HUMIDITY=y
# CONFIG_HTS221 is not set
# CONFIG_HTU21 is not set
# CONFIG_SI7005 is not set
# CONFIG_SI7020 is not set
# end of Humidity sensors

#
# Inertial measurement units
#
# CONFIG_ADIS16400 is not set
# CONFIG_ADIS16460 is not set
# CONFIG_ADIS16475 is not set
# CONFIG_ADIS16480 is not set
# CONFIG_BMI160_I2C is not set
# CONFIG_BMI160_SPI is not set
# CONFIG_BMI323_I2C is not set
# CONFIG_BMI323_SPI is not set
# CONFIG_BOSCH_BNO055_SERIAL is not set
# CONFIG_BOSCH_BNO055_I2C is not set
# CONFIG_FXOS8700_I2C is not set
# CONFIG_FXOS8700_SPI is not set
# CONFIG_KMX61 is not set
# CONFIG_INV_ICM42600_I2C is not set
# CONFIG_INV_ICM42600_SPI is not set
# CONFIG_INV_MPU6050_I2C is not set
# CONFIG_INV_MPU6050_SPI is not set
# CONFIG_IIO_ST_LSM6DSX is not set
# CONFIG_IIO_ST_LSM9DS0 is not set
# end of Inertial measurement units

#
# Light sensors
#
# CONFIG_ACPI_ALS is not set
# CONFIG_ADJD_S311 is not set
# CONFIG_ADUX1020 is not set
# CONFIG_AL3010 is not set
# CONFIG_AL3320A is not set
# CONFIG_APDS9300 is not set
# CONFIG_APDS9960 is not set
# CONFIG_AS73211 is not set
# CONFIG_BH1750 is not set
# CONFIG_BH1780 is not set
# CONFIG_CM32181 is not set
# CONFIG_CM3232 is not set
# CONFIG_CM3323 is not set
# CONFIG_CM3605 is not set
# CONFIG_CM36651 is not set
# CONFIG_GP2AP002 is not set
# CONFIG_GP2AP020A00F is not set
# CONFIG_SENSORS_ISL29018 is not set
# CONFIG_SENSORS_ISL29028 is not set
# CONFIG_ISL29125 is not set
# CONFIG_ISL76682 is not set
CONFIG_HID_SENSOR_ALS=y
CONFIG_HID_SENSOR_PROX=y
# CONFIG_JSA1212 is not set
# CONFIG_ROHM_BU27008 is not set
# CONFIG_ROHM_BU27034 is not set
# CONFIG_RPR0521 is not set
# CONFIG_LTR390 is not set
# CONFIG_LTR501 is not set
# CONFIG_LTRF216A is not set
# CONFIG_LV0104CS is not set
# CONFIG_MAX44000 is not set
# CONFIG_MAX44009 is not set
# CONFIG_NOA1305 is not set
# CONFIG_OPT3001 is not set
# CONFIG_OPT4001 is not set
# CONFIG_PA12203001 is not set
# CONFIG_SI1133 is not set
# CONFIG_SI1145 is not set
# CONFIG_STK3310 is not set
# CONFIG_ST_UVIS25 is not set
# CONFIG_TCS3414 is not set
# CONFIG_TCS3472 is not set
# CONFIG_SENSORS_TSL2563 is not set
# CONFIG_TSL2583 is not set
# CONFIG_TSL2591 is not set
# CONFIG_TSL2772 is not set
# CONFIG_TSL4531 is not set
# CONFIG_US5182D is not set
# CONFIG_VCNL4000 is not set
# CONFIG_VCNL4035 is not set
# CONFIG_VEML6030 is not set
# CONFIG_VEML6070 is not set
# CONFIG_VEML6075 is not set
# CONFIG_VL6180 is not set
# CONFIG_ZOPT2201 is not set
# end of Light sensors

#
# Magnetometer sensors
#
# CONFIG_AF8133J is not set
# CONFIG_AK8974 is not set
# CONFIG_AK8975 is not set
# CONFIG_AK09911 is not set
# CONFIG_BMC150_MAGN_I2C is not set
# CONFIG_BMC150_MAGN_SPI is not set
# CONFIG_MAG3110 is not set
CONFIG_HID_SENSOR_MAGNETOMETER_3D=y
# CONFIG_MMC35240 is not set
# CONFIG_IIO_ST_MAGN_3AXIS is not set
# CONFIG_SENSORS_HMC5843_I2C is not set
# CONFIG_SENSORS_HMC5843_SPI is not set
# CONFIG_SENSORS_RM3100_I2C is not set
# CONFIG_SENSORS_RM3100_SPI is not set
# CONFIG_TI_TMAG5273 is not set
# CONFIG_YAMAHA_YAS530 is not set
# end of Magnetometer sensors

#
# Multiplexers
#
# CONFIG_IIO_MUX is not set
# end of Multiplexers

#
# Inclinometer sensors
#
CONFIG_HID_SENSOR_INCLINOMETER_3D=y
CONFIG_HID_SENSOR_DEVICE_ROTATION=y
# end of Inclinometer sensors

#
# Triggers - standalone
#
# CONFIG_IIO_INTERRUPT_TRIGGER is not set
# CONFIG_IIO_SYSFS_TRIGGER is not set
# end of Triggers - standalone

#
# Linear and angular position sensors
#
# CONFIG_HID_SENSOR_CUSTOM_INTEL_HINGE is not set
# end of Linear and angular position sensors

#
# Digital potentiometers
#
# CONFIG_AD5110 is not set
# CONFIG_AD5272 is not set
# CONFIG_DS1803 is not set
# CONFIG_MAX5432 is not set
# CONFIG_MAX5481 is not set
# CONFIG_MAX5487 is not set
# CONFIG_MCP4018 is not set
# CONFIG_MCP4131 is not set
# CONFIG_MCP4531 is not set
# CONFIG_MCP41010 is not set
# CONFIG_TPL0102 is not set
# CONFIG_X9250 is not set
# end of Digital potentiometers

#
# Digital potentiostats
#
# CONFIG_LMP91000 is not set
# end of Digital potentiostats

#
# Pressure sensors
#
# CONFIG_ABP060MG is not set
# CONFIG_ROHM_BM1390 is not set
# CONFIG_BMP280 is not set
# CONFIG_DLHL60D is not set
# CONFIG_DPS310 is not set
CONFIG_HID_SENSOR_PRESS=y
# CONFIG_HP03 is not set
# CONFIG_HSC030PA is not set
# CONFIG_ICP10100 is not set
# CONFIG_MPL115_I2C is not set
# CONFIG_MPL115_SPI is not set
# CONFIG_MPL3115 is not set
# CONFIG_MPRLS0025PA is not set
# CONFIG_MS5611 is not set
# CONFIG_MS5637 is not set
# CONFIG_IIO_ST_PRESS is not set
# CONFIG_T5403 is not set
# CONFIG_HP206C is not set
# CONFIG_ZPA2326 is not set
# end of Pressure sensors

#
# Lightning sensors
#
# CONFIG_AS3935 is not set
# end of Lightning sensors

#
# Proximity and distance sensors
#
# CONFIG_IRSD200 is not set
# CONFIG_ISL29501 is not set
# CONFIG_LIDAR_LITE_V2 is not set
# CONFIG_MB1232 is not set
# CONFIG_PING is not set
# CONFIG_RFD77402 is not set
# CONFIG_SRF04 is not set
# CONFIG_SX9310 is not set
# CONFIG_SX9324 is not set
# CONFIG_SX9360 is not set
# CONFIG_SX9500 is not set
# CONFIG_SRF08 is not set
# CONFIG_VCNL3020 is not set
# CONFIG_VL53L0X_I2C is not set
# end of Proximity and distance sensors

#
# Resolver to digital converters
#
# CONFIG_AD2S90 is not set
# CONFIG_AD2S1200 is not set
# CONFIG_AD2S1210 is not set
# end of Resolver to digital converters

#
# Temperature sensors
#
# CONFIG_LTC2983 is not set
# CONFIG_MAXIM_THERMOCOUPLE is not set
CONFIG_HID_SENSOR_TEMP=y
# CONFIG_MLX90614 is not set
# CONFIG_MLX90632 is not set
# CONFIG_MLX90635 is not set
# CONFIG_TMP006 is not set
# CONFIG_TMP007 is not set
# CONFIG_TMP117 is not set
# CONFIG_TSYS01 is not set
# CONFIG_TSYS02D is not set
# CONFIG_MAX30208 is not set
# CONFIG_MAX31856 is not set
# CONFIG_MAX31865 is not set
# CONFIG_MCP9600 is not set
# end of Temperature sensors

# CONFIG_NTB is not set
# CONFIG_PWM is not set

#
# IRQ chip support
#
CONFIG_IRQCHIP=y
# CONFIG_AL_FIC is not set
# CONFIG_XILINX_INTC is not set
# end of IRQ chip support

# CONFIG_IPACK_BUS is not set
CONFIG_RESET_CONTROLLER=y
# CONFIG_RESET_GPIO is not set
# CONFIG_RESET_INTEL_GW is not set
# CONFIG_RESET_SIMPLE is not set
# CONFIG_RESET_TI_SYSCON is not set
# CONFIG_RESET_TI_TPS380X is not set

#
# PHY Subsystem
#
CONFIG_GENERIC_PHY=y
# CONFIG_USB_LGM_PHY is not set
# CONFIG_PHY_CAN_TRANSCEIVER is not set

#
# PHY drivers for Broadcom platforms
#
# CONFIG_BCM_KONA_USB2_PHY is not set
# end of PHY drivers for Broadcom platforms

# CONFIG_PHY_CADENCE_TORRENT is not set
# CONFIG_PHY_CADENCE_DPHY is not set
# CONFIG_PHY_CADENCE_DPHY_RX is not set
# CONFIG_PHY_CADENCE_SIERRA is not set
# CONFIG_PHY_CADENCE_SALVO is not set
# CONFIG_PHY_PXA_28NM_HSIC is not set
# CONFIG_PHY_PXA_28NM_USB2 is not set
# CONFIG_PHY_LAN966X_SERDES is not set
CONFIG_PHY_CPCAP_USB=y
# CONFIG_PHY_MAPPHONE_MDM6600 is not set
# CONFIG_PHY_OCELOT_SERDES is not set
CONFIG_PHY_QCOM_USB_HS=y
CONFIG_PHY_QCOM_USB_HSIC=y
CONFIG_PHY_SAMSUNG_USB2=y
CONFIG_PHY_TUSB1210=y
# CONFIG_PHY_INTEL_LGM_COMBO is not set
# CONFIG_PHY_INTEL_LGM_EMMC is not set
# end of PHY Subsystem

# CONFIG_POWERCAP is not set
# CONFIG_MCB is not set

#
# Performance monitor support
#
# CONFIG_DWC_PCIE_PMU is not set
# end of Performance monitor support

CONFIG_RAS=y
CONFIG_USB4=y
# CONFIG_USB4_DEBUGFS_WRITE is not set
# CONFIG_USB4_DMA_TEST is not set

#
# Android
#
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES="binder0,binder1"
# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set
# end of Android

CONFIG_LIBNVDIMM=y
CONFIG_BLK_DEV_PMEM=y
CONFIG_ND_CLAIM=y
CONFIG_ND_BTT=y
CONFIG_BTT=y
CONFIG_ND_PFN=y
CONFIG_NVDIMM_PFN=y
CONFIG_NVDIMM_DAX=y
CONFIG_OF_PMEM=y
CONFIG_NVDIMM_KEYS=y
# CONFIG_NVDIMM_SECURITY_TEST is not set
CONFIG_DAX=y
CONFIG_DEV_DAX=y
# CONFIG_DEV_DAX_PMEM is not set
# CONFIG_DEV_DAX_KMEM is not set
CONFIG_NVMEM=y
CONFIG_NVMEM_SYSFS=y
CONFIG_NVMEM_LAYOUTS=y

#
# Layout Types
#
# CONFIG_NVMEM_LAYOUT_SL28_VPD is not set
# CONFIG_NVMEM_LAYOUT_ONIE_TLV is not set
# end of Layout Types

# CONFIG_NVMEM_RMEM is not set
# CONFIG_NVMEM_U_BOOT_ENV is not set

#
# HW tracing support
#
# CONFIG_STM is not set
# CONFIG_INTEL_TH is not set
# end of HW tracing support

# CONFIG_FPGA is not set
# CONFIG_FSI is not set
# CONFIG_TEE is not set
# CONFIG_SIOX is not set
# CONFIG_SLIMBUS is not set
# CONFIG_INTERCONNECT is not set
CONFIG_COUNTER=y
# CONFIG_INTEL_QEP is not set
# CONFIG_INTERRUPT_CNT is not set
CONFIG_MOST=y
# CONFIG_MOST_USB_HDM is not set
# CONFIG_MOST_CDEV is not set
# CONFIG_MOST_SND is not set
# CONFIG_PECI is not set
# CONFIG_HTE is not set
# end of Device Drivers

#
# File systems
#
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_VALIDATE_FS_PARSER=y
CONFIG_FS_IOMAP=y
CONFIG_FS_STACK=y
CONFIG_BUFFER_HEAD=y
CONFIG_LEGACY_DIRECT_IO=y
# CONFIG_EXT2_FS is not set
CONFIG_EXT3_FS=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT2=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
# CONFIG_EXT4_DEBUG is not set
CONFIG_JBD2=y
# CONFIG_JBD2_DEBUG is not set
CONFIG_FS_MBCACHE=y
CONFIG_REISERFS_FS=y
# CONFIG_REISERFS_CHECK is not set
CONFIG_REISERFS_PROC_INFO=y
CONFIG_REISERFS_FS_XATTR=y
CONFIG_REISERFS_FS_POSIX_ACL=y
CONFIG_REISERFS_FS_SECURITY=y
CONFIG_JFS_FS=y
CONFIG_JFS_POSIX_ACL=y
CONFIG_JFS_SECURITY=y
CONFIG_JFS_DEBUG=y
# CONFIG_JFS_STATISTICS is not set
CONFIG_XFS_FS=y
# CONFIG_XFS_SUPPORT_V4 is not set
# CONFIG_XFS_SUPPORT_ASCII_CI is not set
CONFIG_XFS_QUOTA=y
CONFIG_XFS_POSIX_ACL=y
CONFIG_XFS_RT=y
# CONFIG_XFS_ONLINE_SCRUB is not set
# CONFIG_XFS_WARN is not set
# CONFIG_XFS_DEBUG is not set
CONFIG_GFS2_FS=y
CONFIG_GFS2_FS_LOCKING_DLM=y
CONFIG_OCFS2_FS=y
CONFIG_OCFS2_FS_O2CB=y
CONFIG_OCFS2_FS_USERSPACE_CLUSTER=y
CONFIG_OCFS2_FS_STATS=y
# CONFIG_OCFS2_DEBUG_MASKLOG is not set
CONFIG_OCFS2_DEBUG_FS=y
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
# CONFIG_BTRFS_DEBUG is not set
CONFIG_BTRFS_ASSERT=y
CONFIG_BTRFS_FS_REF_VERIFY=y
CONFIG_NILFS2_FS=y
CONFIG_F2FS_FS=y
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
CONFIG_F2FS_FS_SECURITY=y
CONFIG_F2FS_CHECK_FS=y
CONFIG_F2FS_FAULT_INJECTION=y
CONFIG_F2FS_FS_COMPRESSION=y
CONFIG_F2FS_FS_LZO=y
CONFIG_F2FS_FS_LZORLE=y
CONFIG_F2FS_FS_LZ4=y
CONFIG_F2FS_FS_LZ4HC=y
CONFIG_F2FS_FS_ZSTD=y
# CONFIG_F2FS_IOSTAT is not set
# CONFIG_F2FS_UNFAIR_RWSEM is not set
CONFIG_BCACHEFS_FS=y
CONFIG_BCACHEFS_QUOTA=y
CONFIG_BCACHEFS_ERASURE_CODING=y
CONFIG_BCACHEFS_POSIX_ACL=y
CONFIG_BCACHEFS_DEBUG=y
# CONFIG_BCACHEFS_TESTS is not set
# CONFIG_BCACHEFS_LOCK_TIME_STATS is not set
# CONFIG_BCACHEFS_NO_LATENCY_ACCT is not set
CONFIG_BCACHEFS_SIX_OPTIMISTIC_SPIN=y
CONFIG_ZONEFS_FS=y
CONFIG_FS_DAX=y
CONFIG_FS_DAX_PMD=y
CONFIG_FS_POSIX_ACL=y
CONFIG_EXPORTFS=y
CONFIG_EXPORTFS_BLOCK_OPS=y
CONFIG_FILE_LOCKING=y
CONFIG_FS_ENCRYPTION=y
CONFIG_FS_ENCRYPTION_ALGS=y
# CONFIG_FS_ENCRYPTION_INLINE_CRYPT is not set
CONFIG_FS_VERITY=y
CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
CONFIG_INOTIFY_USER=y
CONFIG_FANOTIFY=y
CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_QUOTA_DEBUG is not set
CONFIG_QUOTA_TREE=y
# CONFIG_QFMT_V1 is not set
CONFIG_QFMT_V2=y
CONFIG_QUOTACTL=y
CONFIG_AUTOFS_FS=y
CONFIG_FUSE_FS=y
CONFIG_CUSE=y
CONFIG_VIRTIO_FS=y
CONFIG_FUSE_DAX=y
# CONFIG_FUSE_PASSTHROUGH is not set
CONFIG_OVERLAY_FS=y
CONFIG_OVERLAY_FS_REDIRECT_DIR=y
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
CONFIG_OVERLAY_FS_INDEX=y
# CONFIG_OVERLAY_FS_NFS_EXPORT is not set
# CONFIG_OVERLAY_FS_XINO_AUTO is not set
# CONFIG_OVERLAY_FS_METACOPY is not set
CONFIG_OVERLAY_FS_DEBUG=y

#
# Caches
#
CONFIG_NETFS_SUPPORT=y
# CONFIG_NETFS_STATS is not set
CONFIG_FSCACHE=y
# CONFIG_FSCACHE_STATS is not set
# CONFIG_FSCACHE_DEBUG is not set
CONFIG_CACHEFILES=y
# CONFIG_CACHEFILES_DEBUG is not set
# CONFIG_CACHEFILES_ERROR_INJECTION is not set
# CONFIG_CACHEFILES_ONDEMAND is not set
# end of Caches

#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=y
CONFIG_JOLIET=y
CONFIG_ZISOFS=y
CONFIG_UDF_FS=y
# end of CD-ROM/DVD Filesystems

#
# DOS/FAT/EXFAT/NT Filesystems
#
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
# CONFIG_FAT_DEFAULT_UTF8 is not set
CONFIG_EXFAT_FS=y
CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8"
CONFIG_NTFS3_FS=y
# CONFIG_NTFS3_64BIT_CLUSTER is not set
CONFIG_NTFS3_LZX_XPRESS=y
CONFIG_NTFS3_FS_POSIX_ACL=y
# CONFIG_NTFS_FS is not set
# end of DOS/FAT/EXFAT/NT Filesystems

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_PROC_VMCORE=y
# CONFIG_PROC_VMCORE_DEVICE_DUMP is not set
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_PROC_CHILDREN=y
CONFIG_PROC_PID_ARCH_STATUS=y
CONFIG_KERNFS=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_TMPFS_XATTR=y
# CONFIG_TMPFS_INODE64 is not set
CONFIG_TMPFS_QUOTA=y
CONFIG_HUGETLBFS=y
# CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON is not set
CONFIG_HUGETLB_PAGE=y
CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP=y
CONFIG_ARCH_HAS_GIGANTIC_PAGE=y
CONFIG_CONFIGFS_FS=y
# end of Pseudo filesystems

CONFIG_MISC_FILESYSTEMS=y
CONFIG_ORANGEFS_FS=y
CONFIG_ADFS_FS=y
# CONFIG_ADFS_FS_RW is not set
CONFIG_AFFS_FS=y
CONFIG_ECRYPT_FS=y
CONFIG_ECRYPT_FS_MESSAGING=y
CONFIG_HFS_FS=y
CONFIG_HFSPLUS_FS=y
CONFIG_BEFS_FS=y
# CONFIG_BEFS_DEBUG is not set
CONFIG_BFS_FS=y
CONFIG_EFS_FS=y
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_FS_DEBUG=0
CONFIG_JFFS2_FS_WRITEBUFFER=y
# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
CONFIG_JFFS2_SUMMARY=y
CONFIG_JFFS2_FS_XATTR=y
CONFIG_JFFS2_FS_POSIX_ACL=y
CONFIG_JFFS2_FS_SECURITY=y
CONFIG_JFFS2_COMPRESSION_OPTIONS=y
CONFIG_JFFS2_ZLIB=y
CONFIG_JFFS2_LZO=y
CONFIG_JFFS2_RTIME=y
CONFIG_JFFS2_RUBIN=y
# CONFIG_JFFS2_CMODE_NONE is not set
CONFIG_JFFS2_CMODE_PRIORITY=y
# CONFIG_JFFS2_CMODE_SIZE is not set
# CONFIG_JFFS2_CMODE_FAVOURLZO is not set
CONFIG_UBIFS_FS=y
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
CONFIG_UBIFS_FS_LZO=y
CONFIG_UBIFS_FS_ZLIB=y
CONFIG_UBIFS_FS_ZSTD=y
CONFIG_UBIFS_ATIME_SUPPORT=y
CONFIG_UBIFS_FS_XATTR=y
CONFIG_UBIFS_FS_SECURITY=y
# CONFIG_UBIFS_FS_AUTHENTICATION is not set
CONFIG_CRAMFS=y
CONFIG_CRAMFS_BLOCKDEV=y
CONFIG_CRAMFS_MTD=y
CONFIG_SQUASHFS=y
# CONFIG_SQUASHFS_FILE_CACHE is not set
CONFIG_SQUASHFS_FILE_DIRECT=y
CONFIG_SQUASHFS_DECOMP_SINGLE=y
# CONFIG_SQUASHFS_CHOICE_DECOMP_BY_MOUNT is not set
CONFIG_SQUASHFS_COMPILE_DECOMP_SINGLE=y
# CONFIG_SQUASHFS_COMPILE_DECOMP_MULTI is not set
# CONFIG_SQUASHFS_COMPILE_DECOMP_MULTI_PERCPU is not set
CONFIG_SQUASHFS_XATTR=y
CONFIG_SQUASHFS_ZLIB=y
CONFIG_SQUASHFS_LZ4=y
CONFIG_SQUASHFS_LZO=y
CONFIG_SQUASHFS_XZ=y
CONFIG_SQUASHFS_ZSTD=y
CONFIG_SQUASHFS_4K_DEVBLK_SIZE=y
# CONFIG_SQUASHFS_EMBEDDED is not set
CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
CONFIG_VXFS_FS=y
CONFIG_MINIX_FS=y
CONFIG_OMFS_FS=y
CONFIG_HPFS_FS=y
CONFIG_QNX4FS_FS=y
CONFIG_QNX6FS_FS=y
# CONFIG_QNX6FS_DEBUG is not set
CONFIG_ROMFS_FS=y
# CONFIG_ROMFS_BACKED_BY_BLOCK is not set
# CONFIG_ROMFS_BACKED_BY_MTD is not set
CONFIG_ROMFS_BACKED_BY_BOTH=y
CONFIG_ROMFS_ON_BLOCK=y
CONFIG_ROMFS_ON_MTD=y
CONFIG_PSTORE=y
CONFIG_PSTORE_DEFAULT_KMSG_BYTES=10240
CONFIG_PSTORE_COMPRESS=y
# CONFIG_PSTORE_CONSOLE is not set
# CONFIG_PSTORE_PMSG is not set
# CONFIG_PSTORE_RAM is not set
# CONFIG_PSTORE_BLK is not set
CONFIG_SYSV_FS=y
CONFIG_UFS_FS=y
CONFIG_UFS_FS_WRITE=y
# CONFIG_UFS_DEBUG is not set
CONFIG_EROFS_FS=y
# CONFIG_EROFS_FS_DEBUG is not set
CONFIG_EROFS_FS_XATTR=y
CONFIG_EROFS_FS_POSIX_ACL=y
CONFIG_EROFS_FS_SECURITY=y
CONFIG_EROFS_FS_ZIP=y
# CONFIG_EROFS_FS_ZIP_LZMA is not set
# CONFIG_EROFS_FS_ZIP_DEFLATE is not set
# CONFIG_EROFS_FS_ONDEMAND is not set
# CONFIG_EROFS_FS_PCPU_KTHREAD is not set
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V2=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
# CONFIG_NFS_SWAP is not set
CONFIG_NFS_V4_1=y
CONFIG_NFS_V4_2=y
CONFIG_PNFS_FILE_LAYOUT=y
CONFIG_PNFS_BLOCK=y
CONFIG_PNFS_FLEXFILE_LAYOUT=y
CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org"
# CONFIG_NFS_V4_1_MIGRATION is not set
CONFIG_NFS_V4_SECURITY_LABEL=y
CONFIG_ROOT_NFS=y
CONFIG_NFS_FSCACHE=y
# CONFIG_NFS_USE_LEGACY_DNS is not set
CONFIG_NFS_USE_KERNEL_DNS=y
# CONFIG_NFS_DISABLE_UDP_SUPPORT is not set
CONFIG_NFS_V4_2_READ_PLUS=y
CONFIG_NFSD=y
# CONFIG_NFSD_V2 is not set
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_V4=y
CONFIG_NFSD_PNFS=y
CONFIG_NFSD_BLOCKLAYOUT=y
CONFIG_NFSD_SCSILAYOUT=y
CONFIG_NFSD_FLEXFILELAYOUT=y
CONFIG_NFSD_V4_2_INTER_SSC=y
CONFIG_NFSD_V4_SECURITY_LABEL=y
# CONFIG_NFSD_LEGACY_CLIENT_TRACKING is not set
CONFIG_GRACE_PERIOD=y
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_NFS_ACL_SUPPORT=y
CONFIG_NFS_COMMON=y
CONFIG_NFS_V4_2_SSC_HELPER=y
CONFIG_SUNRPC=y
CONFIG_SUNRPC_GSS=y
CONFIG_SUNRPC_BACKCHANNEL=y
CONFIG_RPCSEC_GSS_KRB5=y
# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA1 is not set
# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_CAMELLIA is not set
# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA2 is not set
# CONFIG_SUNRPC_DEBUG is not set
# CONFIG_SUNRPC_XPRT_RDMA is not set
CONFIG_CEPH_FS=y
CONFIG_CEPH_FSCACHE=y
CONFIG_CEPH_FS_POSIX_ACL=y
# CONFIG_CEPH_FS_SECURITY_LABEL is not set
CONFIG_CIFS=y
# CONFIG_CIFS_STATS2 is not set
CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y
CONFIG_CIFS_UPCALL=y
CONFIG_CIFS_XATTR=y
CONFIG_CIFS_POSIX=y
CONFIG_CIFS_DEBUG=y
# CONFIG_CIFS_DEBUG2 is not set
# CONFIG_CIFS_DEBUG_DUMP_KEYS is not set
CONFIG_CIFS_DFS_UPCALL=y
CONFIG_CIFS_SWN_UPCALL=y
CONFIG_CIFS_SMB_DIRECT=y
CONFIG_CIFS_FSCACHE=y
# CONFIG_CIFS_ROOT is not set
# CONFIG_SMB_SERVER is not set
CONFIG_SMBFS=y
# CONFIG_CODA_FS is not set
CONFIG_AFS_FS=y
# CONFIG_AFS_DEBUG is not set
CONFIG_AFS_FSCACHE=y
# CONFIG_AFS_DEBUG_CURSOR is not set
CONFIG_9P_FS=y
CONFIG_9P_FSCACHE=y
CONFIG_9P_FS_POSIX_ACL=y
CONFIG_9P_FS_SECURITY=y
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="utf8"
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_CODEPAGE_737=y
CONFIG_NLS_CODEPAGE_775=y
CONFIG_NLS_CODEPAGE_850=y
CONFIG_NLS_CODEPAGE_852=y
CONFIG_NLS_CODEPAGE_855=y
CONFIG_NLS_CODEPAGE_857=y
CONFIG_NLS_CODEPAGE_860=y
CONFIG_NLS_CODEPAGE_861=y
CONFIG_NLS_CODEPAGE_862=y
CONFIG_NLS_CODEPAGE_863=y
CONFIG_NLS_CODEPAGE_864=y
CONFIG_NLS_CODEPAGE_865=y
CONFIG_NLS_CODEPAGE_866=y
CONFIG_NLS_CODEPAGE_869=y
CONFIG_NLS_CODEPAGE_936=y
CONFIG_NLS_CODEPAGE_950=y
CONFIG_NLS_CODEPAGE_932=y
CONFIG_NLS_CODEPAGE_949=y
CONFIG_NLS_CODEPAGE_874=y
CONFIG_NLS_ISO8859_8=y
CONFIG_NLS_CODEPAGE_1250=y
CONFIG_NLS_CODEPAGE_1251=y
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_ISO8859_2=y
CONFIG_NLS_ISO8859_3=y
CONFIG_NLS_ISO8859_4=y
CONFIG_NLS_ISO8859_5=y
CONFIG_NLS_ISO8859_6=y
CONFIG_NLS_ISO8859_7=y
CONFIG_NLS_ISO8859_9=y
CONFIG_NLS_ISO8859_13=y
CONFIG_NLS_ISO8859_14=y
CONFIG_NLS_ISO8859_15=y
CONFIG_NLS_KOI8_R=y
CONFIG_NLS_KOI8_U=y
CONFIG_NLS_MAC_ROMAN=y
CONFIG_NLS_MAC_CELTIC=y
CONFIG_NLS_MAC_CENTEURO=y
CONFIG_NLS_MAC_CROATIAN=y
CONFIG_NLS_MAC_CYRILLIC=y
CONFIG_NLS_MAC_GAELIC=y
CONFIG_NLS_MAC_GREEK=y
CONFIG_NLS_MAC_ICELAND=y
CONFIG_NLS_MAC_INUIT=y
CONFIG_NLS_MAC_ROMANIAN=y
CONFIG_NLS_MAC_TURKISH=y
CONFIG_NLS_UTF8=y
CONFIG_NLS_UCS2_UTILS=y
CONFIG_DLM=y
# CONFIG_DLM_DEBUG is not set
CONFIG_UNICODE=y
# CONFIG_UNICODE_NORMALIZATION_SELFTEST is not set
CONFIG_IO_WQ=y
# end of File systems

#
# Security options
#
CONFIG_KEYS=y
CONFIG_KEYS_REQUEST_CACHE=y
CONFIG_PERSISTENT_KEYRINGS=y
CONFIG_BIG_KEYS=y
CONFIG_TRUSTED_KEYS=y
# CONFIG_TRUSTED_KEYS_TPM is not set

#
# No trust source selected!
#
CONFIG_ENCRYPTED_KEYS=y
# CONFIG_USER_DECRYPTED_DATA is not set
CONFIG_KEY_DH_OPERATIONS=y
CONFIG_KEY_NOTIFICATIONS=y
# CONFIG_SECURITY_DMESG_RESTRICT is not set
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
CONFIG_SECURITY_NETWORK=y
CONFIG_SECURITY_INFINIBAND=y
CONFIG_SECURITY_NETWORK_XFRM=y
CONFIG_SECURITY_PATH=y
# CONFIG_INTEL_TXT is not set
CONFIG_HARDENED_USERCOPY=y
CONFIG_FORTIFY_SOURCE=y
# CONFIG_STATIC_USERMODEHELPER is not set
# CONFIG_SECURITY_SELINUX is not set
# CONFIG_SECURITY_SMACK is not set
CONFIG_SECURITY_TOMOYO=y
CONFIG_SECURITY_TOMOYO_MAX_ACCEPT_ENTRY=64
CONFIG_SECURITY_TOMOYO_MAX_AUDIT_LOG=32
CONFIG_SECURITY_TOMOYO_OMIT_USERSPACE_LOADER=y
CONFIG_SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING=y
CONFIG_SECURITY_APPARMOR=y
CONFIG_SECURITY_APPARMOR_DEBUG=y
CONFIG_SECURITY_APPARMOR_DEBUG_ASSERTS=y
# CONFIG_SECURITY_APPARMOR_DEBUG_MESSAGES is not set
CONFIG_SECURITY_APPARMOR_INTROSPECT_POLICY=y
CONFIG_SECURITY_APPARMOR_HASH=y
CONFIG_SECURITY_APPARMOR_HASH_DEFAULT=y
# CONFIG_SECURITY_APPARMOR_EXPORT_BINARY is not set
# CONFIG_SECURITY_APPARMOR_PARANOID_LOAD is not set
# CONFIG_SECURITY_LOADPIN is not set
CONFIG_SECURITY_YAMA=y
CONFIG_SECURITY_SAFESETID=y
CONFIG_SECURITY_LOCKDOWN_LSM=y
CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y
CONFIG_LOCK_DOWN_KERNEL_FORCE_NONE=y
# CONFIG_LOCK_DOWN_KERNEL_FORCE_INTEGRITY is not set
# CONFIG_LOCK_DOWN_KERNEL_FORCE_CONFIDENTIALITY is not set
CONFIG_SECURITY_LANDLOCK=y
CONFIG_INTEGRITY=y
CONFIG_INTEGRITY_SIGNATURE=y
CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y
CONFIG_INTEGRITY_TRUSTED_KEYRING=y
CONFIG_INTEGRITY_AUDIT=y
CONFIG_IMA=y
CONFIG_IMA_MEASURE_PCR_IDX=10
CONFIG_IMA_LSM_RULES=y
CONFIG_IMA_NG_TEMPLATE=y
# CONFIG_IMA_SIG_TEMPLATE is not set
CONFIG_IMA_DEFAULT_TEMPLATE="ima-ng"
# CONFIG_IMA_DEFAULT_HASH_SHA1 is not set
CONFIG_IMA_DEFAULT_HASH_SHA256=y
# CONFIG_IMA_DEFAULT_HASH_SHA512 is not set
# CONFIG_IMA_DEFAULT_HASH_WP512 is not set
CONFIG_IMA_DEFAULT_HASH="sha256"
CONFIG_IMA_WRITE_POLICY=y
CONFIG_IMA_READ_POLICY=y
CONFIG_IMA_APPRAISE=y
# CONFIG_IMA_ARCH_POLICY is not set
# CONFIG_IMA_APPRAISE_BUILD_POLICY is not set
# CONFIG_IMA_APPRAISE_BOOTPARAM is not set
CONFIG_IMA_APPRAISE_MODSIG=y
# CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY is not set
# CONFIG_IMA_BLACKLIST_KEYRING is not set
# CONFIG_IMA_LOAD_X509 is not set
CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS=y
CONFIG_IMA_QUEUE_EARLY_BOOT_KEYS=y
# CONFIG_IMA_DISABLE_HTABLE is not set
CONFIG_EVM=y
CONFIG_EVM_ATTR_FSUUID=y
CONFIG_EVM_ADD_XATTRS=y
# CONFIG_EVM_LOAD_X509 is not set
# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
CONFIG_DEFAULT_SECURITY_APPARMOR=y
# CONFIG_DEFAULT_SECURITY_DAC is not set
CONFIG_LSM="landlock,lockdown,yama,safesetid,integrity,tomoyo,apparmor,bpf"

#
# Kernel hardening options
#

#
# Memory initialization
#
CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y
# CONFIG_INIT_STACK_NONE is not set
# CONFIG_INIT_STACK_ALL_PATTERN is not set
CONFIG_INIT_STACK_ALL_ZERO=y
CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set
CONFIG_CC_HAS_ZERO_CALL_USED_REGS=y
# CONFIG_ZERO_CALL_USED_REGS is not set
# end of Memory initialization

#
# Hardening of kernel data structures
#
CONFIG_LIST_HARDENED=y
CONFIG_BUG_ON_DATA_CORRUPTION=y
# end of Hardening of kernel data structures

CONFIG_RANDSTRUCT_NONE=y
# end of Kernel hardening options
# end of Security options

CONFIG_XOR_BLOCKS=y
CONFIG_ASYNC_CORE=y
CONFIG_ASYNC_MEMCPY=y
CONFIG_ASYNC_XOR=y
CONFIG_ASYNC_PQ=y
CONFIG_ASYNC_RAID6_RECOV=y
CONFIG_CRYPTO=y

#
# Crypto core or helper
#
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_SIG2=y
CONFIG_CRYPTO_SKCIPHER=y
CONFIG_CRYPTO_SKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
CONFIG_CRYPTO_RNG=y
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_RNG_DEFAULT=y
CONFIG_CRYPTO_AKCIPHER2=y
CONFIG_CRYPTO_AKCIPHER=y
CONFIG_CRYPTO_KPP2=y
CONFIG_CRYPTO_KPP=y
CONFIG_CRYPTO_ACOMP2=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
CONFIG_CRYPTO_USER=y
CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
CONFIG_CRYPTO_NULL=y
CONFIG_CRYPTO_NULL2=y
CONFIG_CRYPTO_PCRYPT=y
CONFIG_CRYPTO_CRYPTD=y
CONFIG_CRYPTO_AUTHENC=y
# CONFIG_CRYPTO_TEST is not set
CONFIG_CRYPTO_SIMD=y
CONFIG_CRYPTO_ENGINE=y
# end of Crypto core or helper

#
# Public-key cryptography
#
CONFIG_CRYPTO_RSA=y
CONFIG_CRYPTO_DH=y
# CONFIG_CRYPTO_DH_RFC7919_GROUPS is not set
CONFIG_CRYPTO_ECC=y
CONFIG_CRYPTO_ECDH=y
# CONFIG_CRYPTO_ECDSA is not set
CONFIG_CRYPTO_ECRDSA=y
CONFIG_CRYPTO_SM2=y
CONFIG_CRYPTO_CURVE25519=y
# end of Public-key cryptography

#
# Block ciphers
#
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_AES_TI=y
CONFIG_CRYPTO_ANUBIS=y
CONFIG_CRYPTO_ARIA=y
CONFIG_CRYPTO_BLOWFISH=y
CONFIG_CRYPTO_BLOWFISH_COMMON=y
CONFIG_CRYPTO_CAMELLIA=y
CONFIG_CRYPTO_CAST_COMMON=y
CONFIG_CRYPTO_CAST5=y
CONFIG_CRYPTO_CAST6=y
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_FCRYPT=y
CONFIG_CRYPTO_KHAZAD=y
CONFIG_CRYPTO_SEED=y
CONFIG_CRYPTO_SERPENT=y
CONFIG_CRYPTO_SM4=y
CONFIG_CRYPTO_SM4_GENERIC=y
CONFIG_CRYPTO_TEA=y
CONFIG_CRYPTO_TWOFISH=y
CONFIG_CRYPTO_TWOFISH_COMMON=y
# end of Block ciphers

#
# Length-preserving ciphers and modes
#
CONFIG_CRYPTO_ADIANTUM=y
CONFIG_CRYPTO_ARC4=y
CONFIG_CRYPTO_CHACHA20=y
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_CTR=y
CONFIG_CRYPTO_CTS=y
CONFIG_CRYPTO_ECB=y
CONFIG_CRYPTO_HCTR2=y
CONFIG_CRYPTO_KEYWRAP=y
CONFIG_CRYPTO_LRW=y
CONFIG_CRYPTO_PCBC=y
CONFIG_CRYPTO_XCTR=y
CONFIG_CRYPTO_XTS=y
CONFIG_CRYPTO_NHPOLY1305=y
# end of Length-preserving ciphers and modes

#
# AEAD (authenticated encryption with associated data) ciphers
#
CONFIG_CRYPTO_AEGIS128=y
CONFIG_CRYPTO_CHACHA20POLY1305=y
CONFIG_CRYPTO_CCM=y
CONFIG_CRYPTO_GCM=y
CONFIG_CRYPTO_GENIV=y
CONFIG_CRYPTO_SEQIV=y
CONFIG_CRYPTO_ECHAINIV=y
CONFIG_CRYPTO_ESSIV=y
# end of AEAD (authenticated encryption with associated data) ciphers

#
# Hashes, digests, and MACs
#
CONFIG_CRYPTO_BLAKE2B=y
CONFIG_CRYPTO_CMAC=y
CONFIG_CRYPTO_GHASH=y
CONFIG_CRYPTO_HMAC=y
# CONFIG_CRYPTO_MD4 is not set
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_MICHAEL_MIC=y
CONFIG_CRYPTO_POLYVAL=y
CONFIG_CRYPTO_POLY1305=y
CONFIG_CRYPTO_RMD160=y
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA256=y
CONFIG_CRYPTO_SHA512=y
CONFIG_CRYPTO_SHA3=y
CONFIG_CRYPTO_SM3=y
# CONFIG_CRYPTO_SM3_GENERIC is not set
CONFIG_CRYPTO_STREEBOG=y
CONFIG_CRYPTO_VMAC=y
CONFIG_CRYPTO_WP512=y
CONFIG_CRYPTO_XCBC=y
CONFIG_CRYPTO_XXHASH=y
# end of Hashes, digests, and MACs

#
# CRCs (cyclic redundancy checks)
#
CONFIG_CRYPTO_CRC32C=y
CONFIG_CRYPTO_CRC32=y
CONFIG_CRYPTO_CRCT10DIF=y
CONFIG_CRYPTO_CRC64_ROCKSOFT=y
# end of CRCs (cyclic redundancy checks)

#
# Compression
#
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_LZO=y
CONFIG_CRYPTO_842=y
CONFIG_CRYPTO_LZ4=y
CONFIG_CRYPTO_LZ4HC=y
CONFIG_CRYPTO_ZSTD=y
# end of Compression

#
# Random number generation
#
CONFIG_CRYPTO_ANSI_CPRNG=y
CONFIG_CRYPTO_DRBG_MENU=y
CONFIG_CRYPTO_DRBG_HMAC=y
CONFIG_CRYPTO_DRBG_HASH=y
CONFIG_CRYPTO_DRBG_CTR=y
CONFIG_CRYPTO_DRBG=y
CONFIG_CRYPTO_JITTERENTROPY=y
CONFIG_CRYPTO_JITTERENTROPY_MEMORY_BLOCKS=64
CONFIG_CRYPTO_JITTERENTROPY_MEMORY_BLOCKSIZE=32
CONFIG_CRYPTO_JITTERENTROPY_OSR=1
CONFIG_CRYPTO_KDF800108_CTR=y
# end of Random number generation

#
# Userspace interface
#
CONFIG_CRYPTO_USER_API=y
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_USER_API_SKCIPHER=y
CONFIG_CRYPTO_USER_API_RNG=y
# CONFIG_CRYPTO_USER_API_RNG_CAVP is not set
CONFIG_CRYPTO_USER_API_AEAD=y
CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE=y
# end of Userspace interface

CONFIG_CRYPTO_HASH_INFO=y

#
# Accelerated Cryptographic Algorithms for CPU (x86)
#
CONFIG_CRYPTO_CURVE25519_X86=y
CONFIG_CRYPTO_AES_NI_INTEL=y
CONFIG_CRYPTO_BLOWFISH_X86_64=y
CONFIG_CRYPTO_CAMELLIA_X86_64=y
CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64=y
CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64=y
CONFIG_CRYPTO_CAST5_AVX_X86_64=y
CONFIG_CRYPTO_CAST6_AVX_X86_64=y
CONFIG_CRYPTO_DES3_EDE_X86_64=y
CONFIG_CRYPTO_SERPENT_SSE2_X86_64=y
CONFIG_CRYPTO_SERPENT_AVX_X86_64=y
CONFIG_CRYPTO_SERPENT_AVX2_X86_64=y
CONFIG_CRYPTO_SM4_AESNI_AVX_X86_64=y
CONFIG_CRYPTO_SM4_AESNI_AVX2_X86_64=y
CONFIG_CRYPTO_TWOFISH_X86_64=y
CONFIG_CRYPTO_TWOFISH_X86_64_3WAY=y
CONFIG_CRYPTO_TWOFISH_AVX_X86_64=y
CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64=y
# CONFIG_CRYPTO_ARIA_AESNI_AVX2_X86_64 is not set
# CONFIG_CRYPTO_ARIA_GFNI_AVX512_X86_64 is not set
CONFIG_CRYPTO_CHACHA20_X86_64=y
CONFIG_CRYPTO_AEGIS128_AESNI_SSE2=y
CONFIG_CRYPTO_NHPOLY1305_SSE2=y
CONFIG_CRYPTO_NHPOLY1305_AVX2=y
CONFIG_CRYPTO_BLAKE2S_X86=y
CONFIG_CRYPTO_POLYVAL_CLMUL_NI=y
CONFIG_CRYPTO_POLY1305_X86_64=y
CONFIG_CRYPTO_SHA1_SSSE3=y
CONFIG_CRYPTO_SHA256_SSSE3=y
CONFIG_CRYPTO_SHA512_SSSE3=y
CONFIG_CRYPTO_SM3_AVX_X86_64=y
CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL=y
CONFIG_CRYPTO_CRC32C_INTEL=y
CONFIG_CRYPTO_CRC32_PCLMUL=y
CONFIG_CRYPTO_CRCT10DIF_PCLMUL=y
# end of Accelerated Cryptographic Algorithms for CPU (x86)

CONFIG_CRYPTO_HW=y
CONFIG_CRYPTO_DEV_PADLOCK=y
CONFIG_CRYPTO_DEV_PADLOCK_AES=y
CONFIG_CRYPTO_DEV_PADLOCK_SHA=y
# CONFIG_CRYPTO_DEV_ATMEL_ECC is not set
# CONFIG_CRYPTO_DEV_ATMEL_SHA204A is not set
CONFIG_CRYPTO_DEV_CCP=y
CONFIG_CRYPTO_DEV_CCP_DD=y
# CONFIG_CRYPTO_DEV_SP_CCP is not set
# CONFIG_CRYPTO_DEV_NITROX_CNN55XX is not set
CONFIG_CRYPTO_DEV_QAT=y
CONFIG_CRYPTO_DEV_QAT_DH895xCC=y
CONFIG_CRYPTO_DEV_QAT_C3XXX=y
CONFIG_CRYPTO_DEV_QAT_C62X=y
# CONFIG_CRYPTO_DEV_QAT_4XXX is not set
# CONFIG_CRYPTO_DEV_QAT_420XX is not set
CONFIG_CRYPTO_DEV_QAT_DH895xCCVF=y
CONFIG_CRYPTO_DEV_QAT_C3XXXVF=y
CONFIG_CRYPTO_DEV_QAT_C62XVF=y
# CONFIG_CRYPTO_DEV_QAT_ERROR_INJECTION is not set
CONFIG_CRYPTO_DEV_VIRTIO=y
# CONFIG_CRYPTO_DEV_SAFEXCEL is not set
# CONFIG_CRYPTO_DEV_CCREE is not set
# CONFIG_CRYPTO_DEV_AMLOGIC_GXL is not set
CONFIG_ASYMMETRIC_KEY_TYPE=y
CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
CONFIG_X509_CERTIFICATE_PARSER=y
CONFIG_PKCS8_PRIVATE_KEY_PARSER=y
CONFIG_PKCS7_MESSAGE_PARSER=y
CONFIG_PKCS7_TEST_KEY=y
CONFIG_SIGNED_PE_FILE_VERIFICATION=y
# CONFIG_FIPS_SIGNATURE_SELFTEST is not set

#
# Certificates for signature checking
#
CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
CONFIG_MODULE_SIG_KEY_TYPE_RSA=y
# CONFIG_MODULE_SIG_KEY_TYPE_ECDSA is not set
CONFIG_SYSTEM_TRUSTED_KEYRING=y
CONFIG_SYSTEM_TRUSTED_KEYS=""
# CONFIG_SYSTEM_EXTRA_CERTIFICATE is not set
CONFIG_SECONDARY_TRUSTED_KEYRING=y
# CONFIG_SECONDARY_TRUSTED_KEYRING_SIGNED_BY_BUILTIN is not set
# CONFIG_SYSTEM_BLACKLIST_KEYRING is not set
# end of Certificates for signature checking

CONFIG_BINARY_PRINTF=y

#
# Library routines
#
CONFIG_RAID6_PQ=y
# CONFIG_RAID6_PQ_BENCHMARK is not set
CONFIG_LINEAR_RANGES=y
# CONFIG_PACKING is not set
CONFIG_BITREVERSE=y
CONFIG_GENERIC_STRNCPY_FROM_USER=y
CONFIG_GENERIC_STRNLEN_USER=y
CONFIG_GENERIC_NET_UTILS=y
# CONFIG_CORDIC is not set
# CONFIG_PRIME_NUMBERS is not set
CONFIG_RATIONAL=y
CONFIG_GENERIC_IOMAP=y
CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
CONFIG_ARCH_HAS_FAST_MULTIPLIER=y
CONFIG_ARCH_USE_SYM_ANNOTATIONS=y

#
# Crypto library routines
#
CONFIG_CRYPTO_LIB_UTILS=y
CONFIG_CRYPTO_LIB_AES=y
CONFIG_CRYPTO_LIB_AESCFB=y
CONFIG_CRYPTO_LIB_ARC4=y
CONFIG_CRYPTO_LIB_GF128MUL=y
CONFIG_CRYPTO_ARCH_HAVE_LIB_BLAKE2S=y
CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=y
CONFIG_CRYPTO_LIB_CHACHA_GENERIC=y
CONFIG_CRYPTO_LIB_CHACHA=y
CONFIG_CRYPTO_ARCH_HAVE_LIB_CURVE25519=y
CONFIG_CRYPTO_LIB_CURVE25519_GENERIC=y
CONFIG_CRYPTO_LIB_CURVE25519=y
CONFIG_CRYPTO_LIB_DES=y
CONFIG_CRYPTO_LIB_POLY1305_RSIZE=11
CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305=y
CONFIG_CRYPTO_LIB_POLY1305_GENERIC=y
CONFIG_CRYPTO_LIB_POLY1305=y
CONFIG_CRYPTO_LIB_CHACHA20POLY1305=y
CONFIG_CRYPTO_LIB_SHA1=y
CONFIG_CRYPTO_LIB_SHA256=y
# end of Crypto library routines

CONFIG_CRC_CCITT=y
CONFIG_CRC16=y
CONFIG_CRC_T10DIF=y
CONFIG_CRC64_ROCKSOFT=y
CONFIG_CRC_ITU_T=y
CONFIG_CRC32=y
# CONFIG_CRC32_SELFTEST is not set
CONFIG_CRC32_SLICEBY8=y
# CONFIG_CRC32_SLICEBY4 is not set
# CONFIG_CRC32_SARWATE is not set
# CONFIG_CRC32_BIT is not set
CONFIG_CRC64=y
CONFIG_CRC4=y
CONFIG_CRC7=y
CONFIG_LIBCRC32C=y
CONFIG_CRC8=y
CONFIG_XXHASH=y
# CONFIG_RANDOM32_SELFTEST is not set
CONFIG_842_COMPRESS=y
CONFIG_842_DECOMPRESS=y
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_LZ4_COMPRESS=y
CONFIG_LZ4HC_COMPRESS=y
CONFIG_LZ4_DECOMPRESS=y
CONFIG_ZSTD_COMMON=y
CONFIG_ZSTD_COMPRESS=y
CONFIG_ZSTD_DECOMPRESS=y
CONFIG_XZ_DEC=y
CONFIG_XZ_DEC_X86=y
CONFIG_XZ_DEC_POWERPC=y
CONFIG_XZ_DEC_ARM=y
CONFIG_XZ_DEC_ARMTHUMB=y
CONFIG_XZ_DEC_SPARC=y
# CONFIG_XZ_DEC_MICROLZMA is not set
CONFIG_XZ_DEC_BCJ=y
# CONFIG_XZ_DEC_TEST is not set
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DECOMPRESS_XZ=y
CONFIG_DECOMPRESS_LZO=y
CONFIG_DECOMPRESS_LZ4=y
CONFIG_DECOMPRESS_ZSTD=y
CONFIG_GENERIC_ALLOCATOR=y
CONFIG_REED_SOLOMON=y
CONFIG_REED_SOLOMON_DEC8=y
CONFIG_TEXTSEARCH=y
CONFIG_TEXTSEARCH_KMP=y
CONFIG_TEXTSEARCH_BM=y
CONFIG_TEXTSEARCH_FSM=y
CONFIG_INTERVAL_TREE=y
CONFIG_INTERVAL_TREE_SPAN_ITER=y
CONFIG_XARRAY_MULTI=y
CONFIG_ASSOCIATIVE_ARRAY=y
CONFIG_CLOSURES=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_IOPORT_MAP=y
CONFIG_HAS_DMA=y
CONFIG_DMA_OPS=y
CONFIG_NEED_SG_DMA_FLAGS=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_DMA_DECLARE_COHERENT=y
CONFIG_SWIOTLB=y
# CONFIG_SWIOTLB_DYNAMIC is not set
# CONFIG_DMA_RESTRICTED_POOL is not set
CONFIG_DMA_CMA=y
# CONFIG_DMA_NUMA_CMA is not set

#
# Default contiguous memory area size:
#
CONFIG_CMA_SIZE_MBYTES=0
CONFIG_CMA_SIZE_SEL_MBYTES=y
# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
# CONFIG_CMA_SIZE_SEL_MIN is not set
# CONFIG_CMA_SIZE_SEL_MAX is not set
CONFIG_CMA_ALIGNMENT=8
# CONFIG_DMA_API_DEBUG is not set
# CONFIG_DMA_MAP_BENCHMARK is not set
CONFIG_SGL_ALLOC=y
CONFIG_CHECK_SIGNATURE=y
# CONFIG_CPUMASK_OFFSTACK is not set
# CONFIG_FORCE_NR_CPUS is not set
CONFIG_CPU_RMAP=y
CONFIG_DQL=y
CONFIG_GLOB=y
# CONFIG_GLOB_SELFTEST is not set
CONFIG_NLATTR=y
CONFIG_CLZ_TAB=y
CONFIG_IRQ_POLL=y
CONFIG_MPILIB=y
CONFIG_SIGNATURE=y
CONFIG_DIMLIB=y
CONFIG_LIBFDT=y
CONFIG_OID_REGISTRY=y
CONFIG_HAVE_GENERIC_VDSO=y
CONFIG_GENERIC_GETTIMEOFDAY=y
CONFIG_GENERIC_VDSO_TIME_NS=y
CONFIG_FONT_SUPPORT=y
# CONFIG_FONTS is not set
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
CONFIG_SG_POOL=y
CONFIG_ARCH_HAS_PMEM_API=y
CONFIG_MEMREGION=y
CONFIG_ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION=y
CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE=y
CONFIG_ARCH_HAS_COPY_MC=y
CONFIG_ARCH_STACKWALK=y
CONFIG_STACKDEPOT=y
CONFIG_STACKDEPOT_ALWAYS_INIT=y
CONFIG_STACKDEPOT_MAX_FRAMES=64
CONFIG_REF_TRACKER=y
CONFIG_SBITMAP=y
# CONFIG_LWQ_TEST is not set
# end of Library routines

CONFIG_FIRMWARE_TABLE=y

#
# Kernel hacking
#

#
# printk and dmesg options
#
CONFIG_PRINTK_TIME=y
CONFIG_PRINTK_CALLER=y
# CONFIG_STACKTRACE_BUILD_ID is not set
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7
CONFIG_CONSOLE_LOGLEVEL_QUIET=4
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
# CONFIG_BOOT_PRINTK_DELAY is not set
CONFIG_DYNAMIC_DEBUG=y
CONFIG_DYNAMIC_DEBUG_CORE=y
CONFIG_SYMBOLIC_ERRNAME=y
CONFIG_DEBUG_BUGVERBOSE=y
# end of printk and dmesg options

CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_MISC=y

#
# Compile-time checks and compiler options
#
CONFIG_DEBUG_INFO=y
CONFIG_AS_HAS_NON_CONST_ULEB128=y
# CONFIG_DEBUG_INFO_NONE is not set
# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set
CONFIG_DEBUG_INFO_DWARF4=y
# CONFIG_DEBUG_INFO_DWARF5 is not set
# CONFIG_DEBUG_INFO_REDUCED is not set
CONFIG_DEBUG_INFO_COMPRESSED_NONE=y
# CONFIG_DEBUG_INFO_COMPRESSED_ZLIB is not set
# CONFIG_DEBUG_INFO_SPLIT is not set
# CONFIG_DEBUG_INFO_BTF is not set
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y
# CONFIG_GDB_SCRIPTS is not set
CONFIG_FRAME_WARN=2048
# CONFIG_STRIP_ASM_SYMS is not set
# CONFIG_READABLE_ASM is not set
# CONFIG_HEADERS_INSTALL is not set
# CONFIG_DEBUG_SECTION_MISMATCH is not set
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
# CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B is not set
CONFIG_OBJTOOL=y
CONFIG_NOINSTR_VALIDATION=y
# CONFIG_VMLINUX_MAP is not set
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
# end of Compile-time checks and compiler options

#
# Generic Kernel Debugging Instruments
#
# CONFIG_MAGIC_SYSRQ is not set
CONFIG_DEBUG_FS=y
CONFIG_DEBUG_FS_ALLOW_ALL=y
# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set
# CONFIG_DEBUG_FS_ALLOW_NONE is not set
CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_KGDB is not set
CONFIG_ARCH_HAS_UBSAN=y
CONFIG_UBSAN=y
# CONFIG_UBSAN_TRAP is not set
CONFIG_CC_HAS_UBSAN_BOUNDS_STRICT=y
CONFIG_UBSAN_BOUNDS=y
CONFIG_UBSAN_BOUNDS_STRICT=y
CONFIG_UBSAN_SHIFT=y
# CONFIG_UBSAN_DIV_ZERO is not set
# CONFIG_UBSAN_SIGNED_WRAP is not set
# CONFIG_UBSAN_BOOL is not set
# CONFIG_UBSAN_ENUM is not set
# CONFIG_UBSAN_ALIGNMENT is not set
# CONFIG_TEST_UBSAN is not set
CONFIG_HAVE_ARCH_KCSAN=y
CONFIG_HAVE_KCSAN_COMPILER=y
# end of Generic Kernel Debugging Instruments

#
# Networking Debugging
#
CONFIG_NET_DEV_REFCNT_TRACKER=y
CONFIG_NET_NS_REFCNT_TRACKER=y
CONFIG_DEBUG_NET=y
# end of Networking Debugging

#
# Memory Debugging
#
CONFIG_PAGE_EXTENSION=y
# CONFIG_DEBUG_PAGEALLOC is not set
CONFIG_SLUB_DEBUG=y
# CONFIG_SLUB_DEBUG_ON is not set
CONFIG_PAGE_OWNER=y
CONFIG_PAGE_TABLE_CHECK=y
CONFIG_PAGE_TABLE_CHECK_ENFORCED=y
CONFIG_PAGE_POISONING=y
# CONFIG_DEBUG_PAGE_REF is not set
# CONFIG_DEBUG_RODATA_TEST is not set
CONFIG_ARCH_HAS_DEBUG_WX=y
CONFIG_DEBUG_WX=y
CONFIG_GENERIC_PTDUMP=y
CONFIG_PTDUMP_CORE=y
CONFIG_PTDUMP_DEBUGFS=y
CONFIG_HAVE_DEBUG_KMEMLEAK=y
# CONFIG_DEBUG_KMEMLEAK is not set
# CONFIG_PER_VMA_LOCK_STATS is not set
CONFIG_DEBUG_OBJECTS=y
# CONFIG_DEBUG_OBJECTS_SELFTEST is not set
CONFIG_DEBUG_OBJECTS_FREE=y
CONFIG_DEBUG_OBJECTS_TIMERS=y
CONFIG_DEBUG_OBJECTS_WORK=y
CONFIG_DEBUG_OBJECTS_RCU_HEAD=y
CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y
CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1
# CONFIG_SHRINKER_DEBUG is not set
CONFIG_DEBUG_STACK_USAGE=y
CONFIG_SCHED_STACK_END_CHECK=y
CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y
CONFIG_DEBUG_VM_IRQSOFF=y
CONFIG_DEBUG_VM=y
CONFIG_DEBUG_VM_MAPLE_TREE=y
CONFIG_DEBUG_VM_RB=y
CONFIG_DEBUG_VM_PGFLAGS=y
CONFIG_DEBUG_VM_PGTABLE=y
CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y
CONFIG_DEBUG_VIRTUAL=y
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DEBUG_PER_CPU_MAPS=y
CONFIG_DEBUG_KMAP_LOCAL=y
CONFIG_ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP=y
CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP=y
CONFIG_HAVE_ARCH_KASAN=y
CONFIG_HAVE_ARCH_KASAN_VMALLOC=y
CONFIG_CC_HAS_KASAN_GENERIC=y
CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y
CONFIG_KASAN=y
CONFIG_KASAN_GENERIC=y
# CONFIG_KASAN_OUTLINE is not set
CONFIG_KASAN_INLINE=y
CONFIG_KASAN_STACK=y
CONFIG_KASAN_VMALLOC=y
# CONFIG_KASAN_MODULE_TEST is not set
# CONFIG_KASAN_EXTRA_INFO is not set
CONFIG_HAVE_ARCH_KFENCE=y
CONFIG_KFENCE=y
CONFIG_KFENCE_SAMPLE_INTERVAL=100
CONFIG_KFENCE_NUM_OBJECTS=255
# CONFIG_KFENCE_DEFERRABLE is not set
CONFIG_KFENCE_STATIC_KEYS=y
CONFIG_KFENCE_STRESS_TEST_FAULTS=0
CONFIG_HAVE_ARCH_KMSAN=y
# end of Memory Debugging

# CONFIG_DEBUG_SHIRQ is not set

#
# Debug Oops, Lockups and Hangs
#
CONFIG_PANIC_ON_OOPS=y
CONFIG_PANIC_ON_OOPS_VALUE=1
CONFIG_PANIC_TIMEOUT=86400
CONFIG_LOCKUP_DETECTOR=y
CONFIG_SOFTLOCKUP_DETECTOR=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
CONFIG_HAVE_HARDLOCKUP_DETECTOR_BUDDY=y
CONFIG_HARDLOCKUP_DETECTOR=y
# CONFIG_HARDLOCKUP_DETECTOR_PREFER_BUDDY is not set
CONFIG_HARDLOCKUP_DETECTOR_PERF=y
# CONFIG_HARDLOCKUP_DETECTOR_BUDDY is not set
# CONFIG_HARDLOCKUP_DETECTOR_ARCH is not set
CONFIG_HARDLOCKUP_DETECTOR_COUNTS_HRTIMER=y
CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y
CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=140
CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
CONFIG_WQ_WATCHDOG=y
# CONFIG_WQ_CPU_INTENSIVE_REPORT is not set
# CONFIG_TEST_LOCKUP is not set
# end of Debug Oops, Lockups and Hangs

#
# Scheduler Debugging
#
# CONFIG_SCHED_DEBUG is not set
CONFIG_SCHED_INFO=y
CONFIG_SCHEDSTATS=y
# end of Scheduler Debugging

CONFIG_DEBUG_TIMEKEEPING=y
CONFIG_DEBUG_PREEMPT=y

#
# Lock Debugging (spinlocks, mutexes, etc...)
#
CONFIG_LOCK_DEBUGGING_SUPPORT=y
CONFIG_PROVE_LOCKING=y
# CONFIG_PROVE_RAW_LOCK_NESTING is not set
# CONFIG_LOCK_STAT is not set
CONFIG_DEBUG_RT_MUTEXES=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y
CONFIG_DEBUG_RWSEMS=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_LOCKDEP=y
CONFIG_LOCKDEP_BITS=17
CONFIG_LOCKDEP_CHAINS_BITS=18
CONFIG_LOCKDEP_STACK_TRACE_BITS=20
CONFIG_LOCKDEP_STACK_TRACE_HASH_BITS=14
CONFIG_LOCKDEP_CIRCULAR_QUEUE_BITS=12
# CONFIG_DEBUG_LOCKDEP is not set
CONFIG_DEBUG_ATOMIC_SLEEP=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
# CONFIG_LOCK_TORTURE_TEST is not set
# CONFIG_WW_MUTEX_SELFTEST is not set
# CONFIG_SCF_TORTURE_TEST is not set
CONFIG_CSD_LOCK_WAIT_DEBUG=y
# CONFIG_CSD_LOCK_WAIT_DEBUG_DEFAULT is not set
# end of Lock Debugging (spinlocks, mutexes, etc...)

CONFIG_TRACE_IRQFLAGS=y
CONFIG_TRACE_IRQFLAGS_NMI=y
CONFIG_NMI_CHECK_CPU=y
CONFIG_DEBUG_IRQFLAGS=y
CONFIG_STACKTRACE=y
# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set
# CONFIG_DEBUG_KOBJECT is not set
# CONFIG_DEBUG_KOBJECT_RELEASE is not set

#
# Debug kernel data structures
#
CONFIG_DEBUG_LIST=y
CONFIG_DEBUG_PLIST=y
CONFIG_DEBUG_SG=y
CONFIG_DEBUG_NOTIFIERS=y
# CONFIG_DEBUG_CLOSURES is not set
CONFIG_DEBUG_MAPLE_TREE=y
# end of Debug kernel data structures

#
# RCU Debugging
#
CONFIG_PROVE_RCU=y
# CONFIG_RCU_SCALE_TEST is not set
# CONFIG_RCU_TORTURE_TEST is not set
# CONFIG_RCU_REF_SCALE_TEST is not set
CONFIG_RCU_CPU_STALL_TIMEOUT=100
CONFIG_RCU_EXP_CPU_STALL_TIMEOUT=21000
# CONFIG_RCU_CPU_STALL_CPUTIME is not set
# CONFIG_RCU_TRACE is not set
CONFIG_RCU_EQS_DEBUG=y
# end of RCU Debugging

# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set
# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set
# CONFIG_LATENCYTOP is not set
CONFIG_USER_STACKTRACE_SUPPORT=y
CONFIG_NOP_TRACER=y
CONFIG_HAVE_RETHOOK=y
CONFIG_HAVE_FUNCTION_TRACER=y
CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS=y
CONFIG_HAVE_DYNAMIC_FTRACE_NO_PATCHABLE=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_FENTRY=y
CONFIG_HAVE_OBJTOOL_MCOUNT=y
CONFIG_HAVE_OBJTOOL_NOP_MCOUNT=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_HAVE_BUILDTIME_MCOUNT_SORT=y
CONFIG_TRACE_CLOCK=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_PREEMPTIRQ_TRACEPOINTS=y
CONFIG_TRACING=y
CONFIG_GENERIC_TRACER=y
CONFIG_TRACING_SUPPORT=y
CONFIG_FTRACE=y
# CONFIG_BOOTTIME_TRACING is not set
# CONFIG_FUNCTION_TRACER is not set
# CONFIG_STACK_TRACER is not set
# CONFIG_IRQSOFF_TRACER is not set
# CONFIG_PREEMPT_TRACER is not set
# CONFIG_SCHED_TRACER is not set
# CONFIG_HWLAT_TRACER is not set
# CONFIG_OSNOISE_TRACER is not set
# CONFIG_TIMERLAT_TRACER is not set
# CONFIG_MMIOTRACE is not set
# CONFIG_FTRACE_SYSCALLS is not set
# CONFIG_TRACER_SNAPSHOT is not set
CONFIG_BRANCH_PROFILE_NONE=y
# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
CONFIG_BLK_DEV_IO_TRACE=y
CONFIG_UPROBE_EVENTS=y
CONFIG_BPF_EVENTS=y
CONFIG_DYNAMIC_EVENTS=y
CONFIG_PROBE_EVENTS=y
# CONFIG_SYNTH_EVENTS is not set
# CONFIG_USER_EVENTS is not set
# CONFIG_HIST_TRIGGERS is not set
CONFIG_TRACE_EVENT_INJECT=y
# CONFIG_TRACEPOINT_BENCHMARK is not set
# CONFIG_RING_BUFFER_BENCHMARK is not set
# CONFIG_TRACE_EVAL_MAP_FILE is not set
# CONFIG_FTRACE_STARTUP_TEST is not set
# CONFIG_RING_BUFFER_STARTUP_TEST is not set
CONFIG_RING_BUFFER_VALIDATE_TIME_DELTAS=y
# CONFIG_PREEMPTIRQ_DELAY_TEST is not set
# CONFIG_RV is not set
CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
# CONFIG_SAMPLES is not set
CONFIG_HAVE_SAMPLE_FTRACE_DIRECT=y
CONFIG_HAVE_SAMPLE_FTRACE_DIRECT_MULTI=y
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
# CONFIG_STRICT_DEVMEM is not set

#
# x86 Debugging
#
CONFIG_EARLY_PRINTK_USB=y
CONFIG_X86_VERBOSE_BOOTUP=y
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_PRINTK_DBGP=y
# CONFIG_EARLY_PRINTK_USB_XDBC is not set
# CONFIG_DEBUG_TLBFLUSH is not set
CONFIG_HAVE_MMIOTRACE_SUPPORT=y
# CONFIG_X86_DECODER_SELFTEST is not set
CONFIG_IO_DELAY_0X80=y
# CONFIG_IO_DELAY_0XED is not set
# CONFIG_IO_DELAY_UDELAY is not set
# CONFIG_IO_DELAY_NONE is not set
CONFIG_DEBUG_BOOT_PARAMS=y
# CONFIG_CPA_DEBUG is not set
CONFIG_DEBUG_ENTRY=y
# CONFIG_DEBUG_NMI_SELFTEST is not set
CONFIG_X86_DEBUG_FPU=y
# CONFIG_PUNIT_ATOM_DEBUG is not set
CONFIG_UNWINDER_ORC=y
# CONFIG_UNWINDER_FRAME_POINTER is not set
# end of x86 Debugging

#
# Kernel Testing and Coverage
#
# CONFIG_KUNIT is not set
# CONFIG_NOTIFIER_ERROR_INJECTION is not set
CONFIG_FAULT_INJECTION=y
CONFIG_FAILSLAB=y
CONFIG_FAIL_PAGE_ALLOC=y
CONFIG_FAULT_INJECTION_USERCOPY=y
CONFIG_FAIL_MAKE_REQUEST=y
CONFIG_FAIL_IO_TIMEOUT=y
CONFIG_FAIL_FUTEX=y
CONFIG_FAULT_INJECTION_DEBUG_FS=y
# CONFIG_FAIL_MMC_REQUEST is not set
CONFIG_FAULT_INJECTION_CONFIGFS=y
# CONFIG_FAULT_INJECTION_STACKTRACE_FILTER is not set
CONFIG_ARCH_HAS_KCOV=y
CONFIG_CC_HAS_SANCOV_TRACE_PC=y
CONFIG_KCOV=y
CONFIG_KCOV_ENABLE_COMPARISONS=y
CONFIG_KCOV_INSTRUMENT_ALL=y
CONFIG_KCOV_IRQ_AREA_SIZE=0x40000
CONFIG_RUNTIME_TESTING_MENU=y
# CONFIG_TEST_DHRY is not set
# CONFIG_LKDTM is not set
# CONFIG_TEST_MIN_HEAP is not set
# CONFIG_TEST_DIV64 is not set
# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_TEST_REF_TRACKER is not set
# CONFIG_RBTREE_TEST is not set
# CONFIG_REED_SOLOMON_TEST is not set
# CONFIG_INTERVAL_TREE_TEST is not set
# CONFIG_PERCPU_TEST is not set
# CONFIG_ATOMIC64_SELFTEST is not set
# CONFIG_ASYNC_RAID6_TEST is not set
# CONFIG_TEST_HEXDUMP is not set
# CONFIG_TEST_KSTRTOX is not set
# CONFIG_TEST_PRINTF is not set
# CONFIG_TEST_SCANF is not set
# CONFIG_TEST_BITMAP is not set
# CONFIG_TEST_UUID is not set
# CONFIG_TEST_XARRAY is not set
# CONFIG_TEST_MAPLE_TREE is not set
# CONFIG_TEST_RHASHTABLE is not set
# CONFIG_TEST_IDA is not set
# CONFIG_TEST_LKM is not set
# CONFIG_TEST_BITOPS is not set
# CONFIG_TEST_VMALLOC is not set
# CONFIG_TEST_USER_COPY is not set
# CONFIG_TEST_BPF is not set
# CONFIG_TEST_BLACKHOLE_DEV is not set
# CONFIG_FIND_BIT_BENCHMARK is not set
# CONFIG_TEST_FIRMWARE is not set
# CONFIG_TEST_SYSCTL is not set
# CONFIG_TEST_UDELAY is not set
# CONFIG_TEST_STATIC_KEYS is not set
# CONFIG_TEST_DYNAMIC_DEBUG is not set
# CONFIG_TEST_KMOD is not set
# CONFIG_TEST_DEBUG_VIRTUAL is not set
# CONFIG_TEST_MEMCAT_P is not set
# CONFIG_TEST_MEMINIT is not set
# CONFIG_TEST_HMM is not set
# CONFIG_TEST_FREE_PAGES is not set
# CONFIG_TEST_CLOCKSOURCE_WATCHDOG is not set
# CONFIG_TEST_OBJPOOL is not set
CONFIG_ARCH_USE_MEMTEST=y
# CONFIG_MEMTEST is not set
# end of Kernel Testing and Coverage

#
# Rust hacking
#
# end of Rust hacking
# end of Kernel hacking
KernelRepo git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
ReproCID 4868127940149248
ReproOpts
Show (102 bytes)
{"repeat":true,"procs":1,"slowdown":1,"sandbox":"none","sandbox_arg":0,"close_fds":true,"tmpdir":true}
ReproSyzID 5342204618342400
SyzkallerCommit fdb4c10ce6d49163d1f57463d7ca0ae22b71e765
TargetArch amd64
TargetOS linux

Current Stage: moderation
Next Stage: upstream

Reporting Stages and Comments:
Stage Source Reported At Ext ID Comments
moderation lore 2026/06/30 15:23 <2cfad14e-3856-4dd8-b464-6b0c1e15b9fb@mail.kernel.org>
2 Comments
  • syzbot@kernel.org (2026/06/30 15:25):
    An array-index-out-of-bounds issue occurs in dbJoin() when the JFS
    filesystem attempts to free blocks using a corrupted dmap structure read
    from disk.
    
    The JFS filesystem uses a binary buddy system to manage free space. The
    state of the buddy system is stored in dmap (for leaf levels) and dmapctl
    (for upper levels) structures on disk. When a dmap is read from disk, its
    dmaptree structure is not fully validated. Specifically, the leafidx field
    (which indicates the index of the first leaf in the stree array) is read
    directly from disk and used to compute pointers to the leaf nodes.
    
    If leafidx is corrupted (e.g., set to 0xffffffff), the computed pointer
    will point out of bounds of the stree array. When dbFreeDmap() is called to
    free blocks, it calls dbFreeBits(), which in turn calls dbJoin() to update
    the buddy system. dbJoin() uses the corrupted leafidx to access the leaf
    nodes, resulting in an out-of-bounds memory access.
    
    While a similar integrity check (check_dmapctl()) was recently added for
    dmapctl structures, the dmap structures (dmaptree) were left unchecked.
    
    Introduce a check_dmaptree() function, similar to the existing
    check_dmapctl() function, to validate the integrity of the dmaptree
    structure when it is used. The function verifies that fields like nleafs,
    l2nleafs, leafidx, height, and budmin are within their expected bounds and
    internally consistent. It also ensures that the leaf nodes fit within the
    stree array and have valid values.
    
    Call check_dmaptree() at the entry points of functions that operate on the
    dmap structure (dbFreeDmap(), dbAllocNext(), dbAllocNear(),
    dbAllocDmapLev(), dbAllocDmapBU(), and dbAllocDmap()). If the validation
    fails, log an error and return -EIO to prevent further processing of the
    corrupted dmap. This also replaces the existing partial checks for leafidx
    in dbAllocNext() and dbAllocNear().
    
    UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2867:24
    index 4294967295 is out of range for type 's8[1365]' (aka 'signed
    char[1365]')
    CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
    1.16.3-debian-1.16.3-2 04/01/2014
    Call Trace:
     <TASK>
     dump_stack_lvl+0xe8/0x150
     ubsan_epilogue+0xa/0x30
     __ubsan_handle_out_of_bounds+0xe8/0xf0
     dbJoin+0xcc4/0xd60
     dbFreeBits+0x4a2/0xd70
     dbFreeDmap
     dbFree+0x324/0x650
     txFreeMap+0x9e6/0xde0
     xtTruncate+0xd16/0x2eb0
     jfs_free_zero_link+0x35b/0x4c0
     jfs_evict_inode+0x356/0x430
     evict+0x624/0xb50
     txLazyCommit
     jfs_lazycommit+0x44c/0xac0
     kthread+0x388/0x470
     ret_from_fork+0x514/0xb70
     ret_from_fork_asm+0x1a/0x30
     </TASK>
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Assisted-by: Gemini:gemini-3.1-pro-preview best-expensive syzbot
    Reported-by: syzbot+667a6d667592227b1452@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=667a6d667592227b1452
    Link: https://syzkaller.appspot.com/ai_job?id=e23ddb38-d666-490d-86a7-4d67edb1eac1
    To: <jfs-discussion@lists.sourceforge.net>
    To: "Dave Kleikamp" <shaggy@kernel.org>
    Cc: "Arnaud Lecomte" <contact@arnaud-lcm.com>
    Cc: "Kees Cook" <kees@kernel.org>
    Cc: <linux-kernel@vger.kernel.org>
    Cc: "Yun Zhou" <yun.zhou@windriver.com>
    Cc: "Zheng Yu" <zheng.yu@northwestern.edu>
    
    ---
    diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
    index a841cf21d..4f2e0b78d 100644
    --- a/fs/jfs/jfs_dmap.c
    +++ b/fs/jfs/jfs_dmap.c
    @@ -220,6 +220,85 @@ static bool check_dmapctl(struct dmapctl *dcp)
     	return true;
     }
     
    +/*
    + * check_dmaptree - Validate integrity of a dmaptree structure
    + * @dtp: Pointer to the dmaptree structure to check
    + *
    + * Return: true if valid, false if corrupted
    + */
    +static bool check_dmaptree(struct dmaptree *dtp)
    +{
    +	u32 nleafs, l2nleafs, leafidx, height;
    +	int i;
    +
    +	nleafs = le32_to_cpu(dtp->nleafs);
    +	/* Check basic field ranges */
    +	if (unlikely(nleafs > LPERDMAP)) {
    +		jfs_err("dmaptree: invalid nleafs %u (max %u)", nleafs,
    +			LPERDMAP);
    +		return false;
    +	}
    +
    +	l2nleafs = le32_to_cpu(dtp->l2nleafs);
    +	if (unlikely(l2nleafs > L2LPERDMAP)) {
    +		jfs_err("dmaptree: invalid l2nleafs %u (max %u)", l2nleafs,
    +			L2LPERDMAP);
    +		return false;
    +	}
    +
    +	/* Verify nleafs matches l2nleafs (must be power of two) */
    +	if (unlikely((1U << l2nleafs) != nleafs)) {
    +		jfs_err("dmaptree: nleafs %u != 2^%u", nleafs, l2nleafs);
    +		return false;
    +	}
    +
    +	leafidx = le32_to_cpu(dtp->leafidx);
    +	/* Check leaf index matches expected position */
    +	if (unlikely(leafidx != LEAFIND)) {
    +		jfs_err("dmaptree: invalid leafidx %u (expected %u)", leafidx,
    +			LEAFIND);
    +		return false;
    +	}
    +
    +	height = le32_to_cpu(dtp->height);
    +	/* Check tree height is within valid range */
    +	if (unlikely(height > 4)) {
    +		jfs_err("dmaptree: invalid height %u (max 4)", height);
    +		return false;
    +	}
    +
    +	/* Check budmin is valid */
    +	if (unlikely(dtp->budmin < BUDMIN)) {
    +		jfs_err("dmaptree: invalid budmin %d (min %d)", dtp->budmin,
    +			BUDMIN);
    +		return false;
    +	}
    +
    +	/* Check leaf nodes fit within stree array */
    +	if (unlikely(leafidx + nleafs > TREESIZE)) {
    +		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
    +			leafidx + nleafs, TREESIZE);
    +		return false;
    +	}
    +
    +	/* Check leaf nodes have valid values */
    +	for (i = leafidx; i < leafidx + nleafs; i++) {
    +		s8 val = dtp->stree[i];
    +
    +		if (unlikely(val < NOFREE)) {
    +			jfs_err("dmaptree: invalid leaf value %d at index %d",
    +				val, i);
    +			return false;
    +		} else if (unlikely(val > 31)) {
    +			jfs_err("dmaptree: leaf value %d too large at index %d",
    +				val, i);
    +			return false;
    +		}
    +	}
    +
    +	return true;
    +}
    +
     /*
      * NAME:	dbMount()
      *
    @@ -1163,7 +1242,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
     	s8 *leaf;
     	u32 mask;
     
    -	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
    +	if (unlikely(!check_dmaptree(&dp->tree))) {
     		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
     		return -EIO;
     	}
    @@ -1293,7 +1372,7 @@ dbAllocNear(struct bmap * bmp,
     	int word, lword, rc;
     	s8 *leaf;
     
    -	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
    +	if (unlikely(!check_dmaptree(&dp->tree))) {
     		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
     		return -EIO;
     	}
    @@ -2046,6 +2125,11 @@ dbAllocDmapLev(struct bmap * bmp,
     	s64 blkno;
     	int leafidx, rc;
     
    +	if (unlikely(!check_dmaptree(&dp->tree))) {
    +		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
    +		return -EIO;
    +	}
    +
     	/* can't be more than a dmaps worth of blocks */
     	assert(l2nb <= L2BPERDMAP);
     
    @@ -2112,6 +2196,11 @@ static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
     	s8 oldroot;
     	int rc;
     
    +	if (unlikely(!check_dmaptree(&dp->tree))) {
    +		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
    +		return -EIO;
    +	}
    +
     	/* save the current value of the root (i.e. maximum free string)
     	 * of the dmap tree.
     	 */
    @@ -2167,6 +2256,11 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
     	s8 oldroot;
     	int rc = 0, word;
     
    +	if (unlikely(!check_dmaptree(&dp->tree))) {
    +		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
    +		return -EIO;
    +	}
    +
     	/* save the current value of the root (i.e. maximum free string)
     	 * of the dmap tree.
     	 */
    @@ -3338,6 +3432,11 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
     	s8 oldroot;
     	struct dmaptree *tp = (struct dmaptree *) & dp->tree;
     
    +	if (unlikely(!check_dmaptree(&dp->tree))) {
    +		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
    +		return -EIO;
    +	}
    +
     	/* save the current value of the root (i.e. maximum free string)
     	 * of the dmap tree.
     	 */
    
    
    base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
    -- 
    This is an AI-generated patch subject to moderation.
    Reply with '#syz upstream' to Sign-off the patch as a human author
    and send it to the upstream kernel mailing lists.
    Reply with '#syz reject' to reject it ('#syz unreject' to undo).
    
    See https://goo.gle/syzbot-ai-patches for information about AI-generated patches.
    You can comment on the patch as usual, syzbot will try to address
    the comments and send a new version of the patch if necessary.
    syzbot engineers can be reached at syzkaller@googlegroups.com.
    
  • sst@poczta.fm (2026/07/06 08:20):
    On cze 30, 2026 15:23, syzbot wrote:
    > An array-index-out-of-bounds issue occurs in dbJoin() when the JFS
    > filesystem attempts to free blocks using a corrupted dmap structure read
    > from disk.
    > 
    > The JFS filesystem uses a binary buddy system to manage free space. The
    > state of the buddy system is stored in dmap (for leaf levels) and dmapctl
    > (for upper levels) structures on disk. When a dmap is read from disk, its
    > dmaptree structure is not fully validated. Specifically, the leafidx field
    > (which indicates the index of the first leaf in the stree array) is read
    > directly from disk and used to compute pointers to the leaf nodes.
    > 
    > If leafidx is corrupted (e.g., set to 0xffffffff), the computed pointer
    > will point out of bounds of the stree array. When dbFreeDmap() is called to
    > free blocks, it calls dbFreeBits(), which in turn calls dbJoin() to update
    > the buddy system. dbJoin() uses the corrupted leafidx to access the leaf
    > nodes, resulting in an out-of-bounds memory access.
    > 
    > While a similar integrity check (check_dmapctl()) was recently added for
    > dmapctl structures, the dmap structures (dmaptree) were left unchecked.
    > 
    > Introduce a check_dmaptree() function, similar to the existing
    > check_dmapctl() function, to validate the integrity of the dmaptree
    > structure when it is used. The function verifies that fields like nleafs,
    > l2nleafs, leafidx, height, and budmin are within their expected bounds and
    > internally consistent. It also ensures that the leaf nodes fit within the
    > stree array and have valid values.
    > 
    > Call check_dmaptree() at the entry points of functions that operate on the
    > dmap structure (dbFreeDmap(), dbAllocNext(), dbAllocNear(),
    > dbAllocDmapLev(), dbAllocDmapBU(), and dbAllocDmap()). If the validation
    > fails, log an error and return -EIO to prevent further processing of the
    > corrupted dmap. This also replaces the existing partial checks for leafidx
    > in dbAllocNext() and dbAllocNear().
    > 
    > UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2867:24
    > index 4294967295 is out of range for type 's8[1365]' (aka 'signed
    > char[1365]')
    > CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted
    > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
    > 1.16.3-debian-1.16.3-2 04/01/2014
    > Call Trace:
    >  <TASK>
    >  dump_stack_lvl+0xe8/0x150
    >  ubsan_epilogue+0xa/0x30
    >  __ubsan_handle_out_of_bounds+0xe8/0xf0
    >  dbJoin+0xcc4/0xd60
    >  dbFreeBits+0x4a2/0xd70
    >  dbFreeDmap
    >  dbFree+0x324/0x650
    >  txFreeMap+0x9e6/0xde0
    >  xtTruncate+0xd16/0x2eb0
    >  jfs_free_zero_link+0x35b/0x4c0
    >  jfs_evict_inode+0x356/0x430
    >  evict+0x624/0xb50
    >  txLazyCommit
    >  jfs_lazycommit+0x44c/0xac0
    >  kthread+0x388/0x470
    >  ret_from_fork+0x514/0xb70
    >  ret_from_fork_asm+0x1a/0x30
    >  </TASK>
    > 
    > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    > Assisted-by: Gemini:gemini-3.1-pro-preview best-expensive syzbot
    > Reported-by: syzbot+667a6d667592227b1452@syzkaller.appspotmail.com
    > Closes: https://syzkaller.appspot.com/bug?extid=667a6d667592227b1452
    > Link: https://syzkaller.appspot.com/ai_job?id=e23ddb38-d666-490d-86a7-4d67edb1eac1
    > To: <jfs-discussion@lists.sourceforge.net>
    > To: "Dave Kleikamp" <shaggy@kernel.org>
    > Cc: "Arnaud Lecomte" <contact@arnaud-lcm.com>
    > Cc: "Kees Cook" <kees@kernel.org>
    > Cc: <linux-kernel@vger.kernel.org>
    > Cc: "Yun Zhou" <yun.zhou@windriver.com>
    > Cc: "Zheng Yu" <zheng.yu@northwestern.edu>
    > 
    > ---
    > diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
    > index a841cf21d..4f2e0b78d 100644
    > --- a/fs/jfs/jfs_dmap.c
    > +++ b/fs/jfs/jfs_dmap.c
    > @@ -220,6 +220,85 @@ static bool check_dmapctl(struct dmapctl *dcp)
    >  	return true;
    >  }
    >  
    > +/*
    > + * check_dmaptree - Validate integrity of a dmaptree structure
    > + * @dtp: Pointer to the dmaptree structure to check
    > + *
    > + * Return: true if valid, false if corrupted
    > + */
    > +static bool check_dmaptree(struct dmaptree *dtp)
    > +{
    > +	u32 nleafs, l2nleafs, leafidx, height;
    > +	int i;
    > +
    > +	nleafs = le32_to_cpu(dtp->nleafs);
    > +	/* Check basic field ranges */
    > +	if (unlikely(nleafs > LPERDMAP)) {
    > +		jfs_err("dmaptree: invalid nleafs %u (max %u)", nleafs,
    > +			LPERDMAP);
    > +		return false;
    > +	}
    > +
    > +	l2nleafs = le32_to_cpu(dtp->l2nleafs);
    > +	if (unlikely(l2nleafs > L2LPERDMAP)) {
    > +		jfs_err("dmaptree: invalid l2nleafs %u (max %u)", l2nleafs,
    > +			L2LPERDMAP);
    > +		return false;
    > +	}
    > +
    > +	/* Verify nleafs matches l2nleafs (must be power of two) */
    > +	if (unlikely((1U << l2nleafs) != nleafs)) {
    > +		jfs_err("dmaptree: nleafs %u != 2^%u", nleafs, l2nleafs);
    > +		return false;
    > +	}
    > +
    > +	leafidx = le32_to_cpu(dtp->leafidx);
    > +	/* Check leaf index matches expected position */
    > +	if (unlikely(leafidx != LEAFIND)) {
    > +		jfs_err("dmaptree: invalid leafidx %u (expected %u)", leafidx,
    > +			LEAFIND);
    > +		return false;
    > +	}
    > +
    > +	height = le32_to_cpu(dtp->height);
    > +	/* Check tree height is within valid range */
    > +	if (unlikely(height > 4)) {
    > +		jfs_err("dmaptree: invalid height %u (max 4)", height);
    > +		return false;
    > +	}
    > +
    > +	/* Check budmin is valid */
    > +	if (unlikely(dtp->budmin < BUDMIN)) {
    > +		jfs_err("dmaptree: invalid budmin %d (min %d)", dtp->budmin,
    > +			BUDMIN);
    > +		return false;
    > +	}
    > +
    > +	/* Check leaf nodes fit within stree array */
    > +	if (unlikely(leafidx + nleafs > TREESIZE)) {
    > +		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
    > +			leafidx + nleafs, TREESIZE);
    > +		return false;
    > +	}
    > +
    > +	/* Check leaf nodes have valid values */
    > +	for (i = leafidx; i < leafidx + nleafs; i++) {
    > +		s8 val = dtp->stree[i];
    > +
    > +		if (unlikely(val < NOFREE)) {
    > +			jfs_err("dmaptree: invalid leaf value %d at index %d",
    > +				val, i);
    > +			return false;
    > +		} else if (unlikely(val > 31)) {
    > +			jfs_err("dmaptree: leaf value %d too large at index %d",
    > +				val, i);
    > +			return false;
    > +		}
    > +	}
    > +
    > +	return true;
    > +}
    > +
    >  /*
    >   * NAME:	dbMount()
    >   *
    > @@ -1163,7 +1242,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
    >  	s8 *leaf;
    >  	u32 mask;
    >  
    > -	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
    > +	if (unlikely(!check_dmaptree(&dp->tree))) {
    >  		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
    >  		return -EIO;
    >  	}
    > @@ -1293,7 +1372,7 @@ dbAllocNear(struct bmap * bmp,
    >  	int word, lword, rc;
    >  	s8 *leaf;
    >  
    > -	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
    > +	if (unlikely(!check_dmaptree(&dp->tree))) {
    >  		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
    >  		return -EIO;
    >  	}
    > @@ -2046,6 +2125,11 @@ dbAllocDmapLev(struct bmap * bmp,
    >  	s64 blkno;
    >  	int leafidx, rc;
    >  
    > +	if (unlikely(!check_dmaptree(&dp->tree))) {
    > +		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
    > +		return -EIO;
    > +	}
    > +
    >  	/* can't be more than a dmaps worth of blocks */
    >  	assert(l2nb <= L2BPERDMAP);
    >  
    > @@ -2112,6 +2196,11 @@ static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
    >  	s8 oldroot;
    >  	int rc;
    >  
    > +	if (unlikely(!check_dmaptree(&dp->tree))) {
    > +		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
    > +		return -EIO;
    > +	}
    > +
    >  	/* save the current value of the root (i.e. maximum free string)
    >  	 * of the dmap tree.
    >  	 */
    > @@ -2167,6 +2256,11 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
    >  	s8 oldroot;
    >  	int rc = 0, word;
    >  
    > +	if (unlikely(!check_dmaptree(&dp->tree))) {
    > +		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
    > +		return -EIO;
    > +	}
    > +
    >  	/* save the current value of the root (i.e. maximum free string)
    >  	 * of the dmap tree.
    >  	 */
    > @@ -3338,6 +3432,11 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
    >  	s8 oldroot;
    >  	struct dmaptree *tp = (struct dmaptree *) & dp->tree;
    >  
    > +	if (unlikely(!check_dmaptree(&dp->tree))) {
    
    Pointer to dp->tree is saved to tp on line above. We should use it here.
    
    > +		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
    > +		return -EIO;
    > +	}
    > +
    >  	/* save the current value of the root (i.e. maximum free string)
    >  	 * of the dmap tree.
    >  	 */
    > 
    > 
    > base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
    
    -- 
    Slawomir Stepien
    

Outputs:
AckedBy
[]
Fixes
map[Hash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Title:Linux-2.6.12-rc2]
KernelBranch
master
KernelCommit
dc59e4fea9d83f03bad6bddf3fa2e52491777482
KernelRepo
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
PatchDescription
jfs: add dmaptree integrity check to prevent array-index-out-of-bounds

An array-index-out-of-bounds issue occurs in dbJoin() when the JFS
filesystem attempts to free blocks using a corrupted dmap structure read
from disk.

The JFS filesystem uses a binary buddy system to manage free space. The
state of the buddy system is stored in dmap (for leaf levels) and dmapctl
(for upper levels) structures on disk. When a dmap is read from disk, its
dmaptree structure is not fully validated. Specifically, the leafidx field
(which indicates the index of the first leaf in the stree array) is read
directly from disk and used to compute pointers to the leaf nodes.

If leafidx is corrupted (e.g., set to 0xffffffff), the computed pointer
will point out of bounds of the stree array. When dbFreeDmap() is called to
free blocks, it calls dbFreeBits(), which in turn calls dbJoin() to update
the buddy system. dbJoin() uses the corrupted leafidx to access the leaf
nodes, resulting in an out-of-bounds memory access.

While a similar integrity check (check_dmapctl()) was recently added for
dmapctl structures, the dmap structures (dmaptree) were left unchecked.

Introduce a check_dmaptree() function, similar to the existing
check_dmapctl() function, to validate the integrity of the dmaptree
structure when it is used. The function verifies that fields like nleafs,
l2nleafs, leafidx, height, and budmin are within their expected bounds and
internally consistent. It also ensures that the leaf nodes fit within the
stree array and have valid values.

Call check_dmaptree() at the entry points of functions that operate on the
dmap structure (dbFreeDmap(), dbAllocNext(), dbAllocNear(),
dbAllocDmapLev(), dbAllocDmapBU(), and dbAllocDmap()). If the validation
fails, log an error and return -EIO to prevent further processing of the
corrupted dmap. This also replaces the existing partial checks for leafidx
in dbAllocNext() and dbAllocNear().

UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2867:24
index 4294967295 is out of range for type 's8[1365]' (aka 'signed
char[1365]')
CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150
 ubsan_epilogue+0xa/0x30
 __ubsan_handle_out_of_bounds+0xe8/0xf0
 dbJoin+0xcc4/0xd60
 dbFreeBits+0x4a2/0xd70
 dbFreeDmap
 dbFree+0x324/0x650
 txFreeMap+0x9e6/0xde0
 xtTruncate+0xd16/0x2eb0
 jfs_free_zero_link+0x35b/0x4c0
 jfs_evict_inode+0x356/0x430
 evict+0x624/0xb50
 txLazyCommit
 jfs_lazycommit+0x44c/0xac0
 kthread+0x388/0x470
 ret_from_fork+0x514/0xb70
 ret_from_fork_asm+0x1a/0x30
 </TASK>
PatchDiff
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index a841cf21d..4f2e0b78d 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -220,6 +220,85 @@ static bool check_dmapctl(struct dmapctl *dcp)
 	return true;
 }
 
+/*
+ * check_dmaptree - Validate integrity of a dmaptree structure
+ * @dtp: Pointer to the dmaptree structure to check
+ *
+ * Return: true if valid, false if corrupted
+ */
+static bool check_dmaptree(struct dmaptree *dtp)
+{
+	u32 nleafs, l2nleafs, leafidx, height;
+	int i;
+
+	nleafs = le32_to_cpu(dtp->nleafs);
+	/* Check basic field ranges */
+	if (unlikely(nleafs > LPERDMAP)) {
+		jfs_err("dmaptree: invalid nleafs %u (max %u)", nleafs,
+			LPERDMAP);
+		return false;
+	}
+
+	l2nleafs = le32_to_cpu(dtp->l2nleafs);
+	if (unlikely(l2nleafs > L2LPERDMAP)) {
+		jfs_err("dmaptree: invalid l2nleafs %u (max %u)", l2nleafs,
+			L2LPERDMAP);
+		return false;
+	}
+
+	/* Verify nleafs matches l2nleafs (must be power of two) */
+	if (unlikely((1U << l2nleafs) != nleafs)) {
+		jfs_err("dmaptree: nleafs %u != 2^%u", nleafs, l2nleafs);
+		return false;
+	}
+
+	leafidx = le32_to_cpu(dtp->leafidx);
+	/* Check leaf index matches expected position */
+	if (unlikely(leafidx != LEAFIND)) {
+		jfs_err("dmaptree: invalid leafidx %u (expected %u)", leafidx,
+			LEAFIND);
+		return false;
+	}
+
+	height = le32_to_cpu(dtp->height);
+	/* Check tree height is within valid range */
+	if (unlikely(height > 4)) {
+		jfs_err("dmaptree: invalid height %u (max 4)", height);
+		return false;
+	}
+
+	/* Check budmin is valid */
+	if (unlikely(dtp->budmin < BUDMIN)) {
+		jfs_err("dmaptree: invalid budmin %d (min %d)", dtp->budmin,
+			BUDMIN);
+		return false;
+	}
+
+	/* Check leaf nodes fit within stree array */
+	if (unlikely(leafidx + nleafs > TREESIZE)) {
+		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
+			leafidx + nleafs, TREESIZE);
+		return false;
+	}
+
+	/* Check leaf nodes have valid values */
+	for (i = leafidx; i < leafidx + nleafs; i++) {
+		s8 val = dtp->stree[i];
+
+		if (unlikely(val < NOFREE)) {
+			jfs_err("dmaptree: invalid leaf value %d at index %d",
+				val, i);
+			return false;
+		} else if (unlikely(val > 31)) {
+			jfs_err("dmaptree: leaf value %d too large at index %d",
+				val, i);
+			return false;
+		}
+	}
+
+	return true;
+}
+
 /*
  * NAME:	dbMount()
  *
@@ -1163,7 +1242,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 *leaf;
 	u32 mask;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
@@ -1293,7 +1372,7 @@ dbAllocNear(struct bmap * bmp,
 	int word, lword, rc;
 	s8 *leaf;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
@@ -2046,6 +2125,11 @@ dbAllocDmapLev(struct bmap * bmp,
 	s64 blkno;
 	int leafidx, rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* can't be more than a dmaps worth of blocks */
 	assert(l2nb <= L2BPERDMAP);
 
@@ -2112,6 +2196,11 @@ static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	int rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
@@ -2167,6 +2256,11 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	int rc = 0, word;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
@@ -3338,6 +3432,11 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	struct dmaptree *tp = (struct dmaptree *) & dp->tree;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
Recipients
[map[Email:contact@arnaud-lcm.com Name:Arnaud Lecomte To:false] map[Email:jfs-discussion@lists.sourceforge.net Name: To:true] map[Email:kees@kernel.org Name:Kees Cook To:false] map[Email:linux-kernel@vger.kernel.org Name: To:false] map[Email:shaggy@kernel.org Name:Dave Kleikamp To:true] map[Email:yun.zhou@windriver.com Name:Yun Zhou To:false] map[Email:zheng.yu@northwestern.edu Name:Zheng Yu To:false]]
ReportedBy
[]
ReviewedBy
[]
TestedBy
[]

Crash report:
==================================================================
BUG: KASAN: use-after-free in dbJoin+0x295/0x2b0 fs/jfs/jfs_dmap.c:2805
Read of size 1 at addr ffff8881788e1061 by task jfsCommit/112

CPU: 1 PID: 112 Comm: jfsCommit Not tainted 6.9.0-syzkaller-01768-ga5131c3fdf26 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0xc3/0x620 mm/kasan/report.c:488
 kasan_report+0xd9/0x110 mm/kasan/report.c:601
 dbJoin+0x295/0x2b0 fs/jfs/jfs_dmap.c:2805
 dbFreeBits+0x15c/0x8f0 fs/jfs/jfs_dmap.c:2338
 dbFreeDmap+0x62/0x1b0 fs/jfs/jfs_dmap.c:2087
 dbFree+0x266/0x550 fs/jfs/jfs_dmap.c:409
 txFreeMap+0x788/0xe60 fs/jfs/jfs_txnmgr.c:2515
 xtTruncate+0x1e57/0x2c80 fs/jfs/jfs_xtree.c:2467
 jfs_free_zero_link+0x372/0x4f0 fs/jfs/namei.c:759
 jfs_evict_inode+0x423/0x4b0 fs/jfs/inode.c:153
 evict+0x2f0/0x6c0 fs/inode.c:667
 iput_final fs/inode.c:1741 [inline]
 iput.part.0+0x5a8/0x7f0 fs/inode.c:1767
 iput+0x5c/0x80 fs/inode.c:1757
 txUpdateMap+0xaf3/0xd20 fs/jfs/jfs_txnmgr.c:2367
 txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline]
 jfs_lazycommit+0x5e6/0xb20 fs/jfs/jfs_txnmgr.c:2733
 kthread+0x2c4/0x3a0 kernel/kthread.c:388
 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1788e1
flags: 0x57ff00000000000(node=1|zone=2|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 057ff00000000000 ffffea0005e23848 ffffea0005e23848 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner info is not present (never set?)

Memory state around the buggy address:
 ffff8881788e0f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881788e0f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8881788e1000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                                       ^
 ffff8881788e1080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881788e1100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2900:31
index -3 is out of range for type 's8 [1365]'
CPU: 1 PID: 112 Comm: jfsCommit Tainted: G    B              6.9.0-syzkaller-01768-ga5131c3fdf26 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x16c/0x1f0 lib/dump_stack.c:114
 ubsan_epilogue lib/ubsan.c:231 [inline]
 __ubsan_handle_out_of_bounds+0x110/0x150 lib/ubsan.c:429
 dbAdjTree+0x383/0x3d0 fs/jfs/jfs_dmap.c:2900
 dbJoin+0x24b/0x2b0 fs/jfs/jfs_dmap.c:2841
 dbFreeBits+0x15c/0x8f0 fs/jfs/jfs_dmap.c:2338
 dbFreeDmap+0x62/0x1b0 fs/jfs/jfs_dmap.c:2087
 dbFree+0x266/0x550 fs/jfs/jfs_dmap.c:409
 txFreeMap+0x788/0xe60 fs/jfs/jfs_txnmgr.c:2515
 xtTruncate+0x1e57/0x2c80 fs/jfs/jfs_xtree.c:2467
 jfs_free_zero_link+0x372/0x4f0 fs/jfs/namei.c:759
 jfs_evict_inode+0x423/0x4b0 fs/jfs/inode.c:153
 evict+0x2f0/0x6c0 fs/inode.c:667
 iput_final fs/inode.c:1741 [inline]
 iput.part.0+0x5a8/0x7f0 fs/inode.c:1767
 iput+0x5c/0x80 fs/inode.c:1757
 txUpdateMap+0xaf3/0xd20 fs/jfs/jfs_txnmgr.c:2367
 txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline]
 jfs_lazycommit+0x5e6/0xb20 fs/jfs/jfs_txnmgr.c:2733
 kthread+0x2c4/0x3a0 kernel/kthread.c:388
 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>
---[ end trace ]---

Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/06/30 14:35 flow patching
47m Results:
map[AckedBy:[] Fixes:map[Hash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Title:Linux-2.6.12-rc2] KernelBranch:master KernelCommit:dc59e4fea9d83f03bad6bddf3fa2e52491777482 KernelRepo:git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git PatchDescription:jfs: add dmaptree integrity check to prevent array-index-out-of-bounds

An array-index-out-of-bounds issue occurs in dbJoin() when the JFS
filesystem attempts to free blocks using a corrupted dmap structure read
from disk.

The JFS filesystem uses a binary buddy system to manage free space. The
state of the buddy system is stored in dmap (for leaf levels) and dmapctl
(for upper levels) structures on disk. When a dmap is read from disk, its
dmaptree structure is not fully validated. Specifically, the leafidx field
(which indicates the index of the first leaf in the stree array) is read
directly from disk and used to compute pointers to the leaf nodes.

If leafidx is corrupted (e.g., set to 0xffffffff), the computed pointer
will point out of bounds of the stree array. When dbFreeDmap() is called to
free blocks, it calls dbFreeBits(), which in turn calls dbJoin() to update
the buddy system. dbJoin() uses the corrupted leafidx to access the leaf
nodes, resulting in an out-of-bounds memory access.

While a similar integrity check (check_dmapctl()) was recently added for
dmapctl structures, the dmap structures (dmaptree) were left unchecked.

Introduce a check_dmaptree() function, similar to the existing
check_dmapctl() function, to validate the integrity of the dmaptree
structure when it is used. The function verifies that fields like nleafs,
l2nleafs, leafidx, height, and budmin are within their expected bounds and
internally consistent. It also ensures that the leaf nodes fit within the
stree array and have valid values.

Call check_dmaptree() at the entry points of functions that operate on the
dmap structure (dbFreeDmap(), dbAllocNext(), dbAllocNear(),
dbAllocDmapLev(), dbAllocDmapBU(), and dbAllocDmap()). If the validation
fails, log an error and return -EIO to prevent further processing of the
corrupted dmap. This also replaces the existing partial checks for leafidx
in dbAllocNext() and dbAllocNear().

UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2867:24
index 4294967295 is out of range for type 's8[1365]' (aka 'signed
char[1365]')
CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150
 ubsan_epilogue+0xa/0x30
 __ubsan_handle_out_of_bounds+0xe8/0xf0
 dbJoin+0xcc4/0xd60
 dbFreeBits+0x4a2/0xd70
 dbFreeDmap
 dbFree+0x324/0x650
 txFreeMap+0x9e6/0xde0
 xtTruncate+0xd16/0x2eb0
 jfs_free_zero_link+0x35b/0x4c0
 jfs_evict_inode+0x356/0x430
 evict+0x624/0xb50
 txLazyCommit
 jfs_lazycommit+0x44c/0xac0
 kthread+0x388/0x470
 ret_from_fork+0x514/0xb70
 ret_from_fork_asm+0x1a/0x30
 </TASK> PatchDiff:diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index a841cf21d..4f2e0b78d 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -220,6 +220,85 @@ static bool check_dmapctl(struct dmapctl *dcp)
 	return true;
 }
 
+/*
+ * check_dmaptree - Validate integrity of a dmaptree structure
+ * @dtp: Pointer to the dmaptree structure to check
+ *
+ * Return: true if valid, false if corrupted
+ */
+static bool check_dmaptree(struct dmaptree *dtp)
+{
+	u32 nleafs, l2nleafs, leafidx, height;
+	int i;
+
+	nleafs = le32_to_cpu(dtp->nleafs);
+	/* Check basic field ranges */
+	if (unlikely(nleafs > LPERDMAP)) {
+		jfs_err("dmaptree: invalid nleafs %u (max %u)", nleafs,
+			LPERDMAP);
+		return false;
+	}
+
+	l2nleafs = le32_to_cpu(dtp->l2nleafs);
+	if (unlikely(l2nleafs > L2LPERDMAP)) {
+		jfs_err("dmaptree: invalid l2nleafs %u (max %u)", l2nleafs,
+			L2LPERDMAP);
+		return false;
+	}
+
+	/* Verify nleafs matches l2nleafs (must be power of two) */
+	if (unlikely((1U << l2nleafs) != nleafs)) {
+		jfs_err("dmaptree: nleafs %u != 2^%u", nleafs, l2nleafs);
+		return false;
+	}
+
+	leafidx = le32_to_cpu(dtp->leafidx);
+	/* Check leaf index matches expected position */
+	if (unlikely(leafidx != LEAFIND)) {
+		jfs_err("dmaptree: invalid leafidx %u (expected %u)", leafidx,
+			LEAFIND);
+		return false;
+	}
+
+	height = le32_to_cpu(dtp->height);
+	/* Check tree height is within valid range */
+	if (unlikely(height > 4)) {
+		jfs_err("dmaptree: invalid height %u (max 4)", height);
+		return false;
+	}
+
+	/* Check budmin is valid */
+	if (unlikely(dtp->budmin < BUDMIN)) {
+		jfs_err("dmaptree: invalid budmin %d (min %d)", dtp->budmin,
+			BUDMIN);
+		return false;
+	}
+
+	/* Check leaf nodes fit within stree array */
+	if (unlikely(leafidx + nleafs > TREESIZE)) {
+		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
+			leafidx + nleafs, TREESIZE);
+		return false;
+	}
+
+	/* Check leaf nodes have valid values */
+	for (i = leafidx; i < leafidx + nleafs; i++) {
+		s8 val = dtp->stree[i];
+
+		if (unlikely(val < NOFREE)) {
+			jfs_err("dmaptree: invalid leaf value %d at index %d",
+				val, i);
+			return false;
+		} else if (unlikely(val > 31)) {
+			jfs_err("dmaptree: leaf value %d too large at index %d",
+				val, i);
+			return false;
+		}
+	}
+
+	return true;
+}
+
 /*
  * NAME:	dbMount()
  *
@@ -1163,7 +1242,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 *leaf;
 	u32 mask;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
@@ -1293,7 +1372,7 @@ dbAllocNear(struct bmap * bmp,
 	int word, lword, rc;
 	s8 *leaf;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
@@ -2046,6 +2125,11 @@ dbAllocDmapLev(struct bmap * bmp,
 	s64 blkno;
 	int leafidx, rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* can't be more than a dmaps worth of blocks */
 	assert(l2nb <= L2BPERDMAP);
 
@@ -2112,6 +2196,11 @@ static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	int rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
@@ -2167,6 +2256,11 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	int rc = 0, word;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
@@ -3338,6 +3432,11 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	struct dmaptree *tp = (struct dmaptree *) & dp->tree;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
 Recipients:[map[Email:contact@arnaud-lcm.com Name:Arnaud Lecomte To:false] map[Email:jfs-discussion@lists.sourceforge.net Name: To:true] map[Email:kees@kernel.org Name:Kees Cook To:false] map[Email:linux-kernel@vger.kernel.org Name: To:false] map[Email:shaggy@kernel.org Name:Dave Kleikamp To:true] map[Email:yun.zhou@windriver.com Name:Yun Zhou To:false] map[Email:zheng.yu@northwestern.edu Name:Zheng Yu To:false]] ReportedBy:[] ReviewedBy:[] TestedBy:[]]

1/1 2026/06/30 14:35 action base-commit-picker
0m Results:
map[KernelBranch:master KernelCommit:dc59e4fea9d83f03bad6bddf3fa2e52491777482 KernelRepo:git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git]

2/1 2026/06/30 14:35 action syz-repro-to-c-repro
0m Results:
map[SimplifiedCRepro:// autogenerated by syzkaller (https://github.com/google/syzkaller)

#define _GNU_SOURCE 

#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>

#include <linux/loop.h>

#ifndef __NR_memfd_create
#define __NR_memfd_create 319
#endif

static unsigned long long procid;

//% This code is derived from puff.{c,h}, found in the zlib development. The
//% original files come with the following copyright notice:

//% Copyright (C) 2002-2013 Mark Adler, all rights reserved
//% version 2.3, 21 Jan 2013
//% This software is provided 'as-is', without any express or implied
//% warranty.  In no event will the author be held liable for any damages
//% arising from the use of this software.
//% Permission is granted to anyone to use this software for any purpose,
//% including commercial applications, and to alter it and redistribute it
//% freely, subject to the following restrictions:
//% 1. The origin of this software must not be misrepresented; you must not
//%    claim that you wrote the original software. If you use this software
//%    in a product, an acknowledgment in the product documentation would be
//%    appreciated but is not required.
//% 2. Altered source versions must be plainly marked as such, and must not be
//%    misrepresented as being the original software.
//% 3. This notice may not be removed or altered from any source distribution.
//% Mark Adler    madler@alumni.caltech.edu

//% BEGIN CODE DERIVED FROM puff.{c,h}

#define MAXBITS 15
#define MAXLCODES 286
#define MAXDCODES 30
#define MAXCODES (MAXLCODES + MAXDCODES)
#define FIXLCODES 288

struct puff_state {
	unsigned char* out;
	unsigned long outlen;
	unsigned long outcnt;
	const unsigned char* in;
	unsigned long inlen;
	unsigned long incnt;
	int bitbuf;
	int bitcnt;
	jmp_buf env;
};
static int puff_bits(struct puff_state* s, int need)
{
	long val = s->bitbuf;
	while (s->bitcnt < need) {
		if (s->incnt == s->inlen)
			longjmp(s->env, 1);
		val |= (long)(s->in[s->incnt++]) << s->bitcnt;
		s->bitcnt += 8;
	}
	s->bitbuf = (int)(val >> need);
	s->bitcnt -= need;
	return (int)(val & ((1L << need) - 1));
}
static int puff_stored(struct puff_state* s)
{
	s->bitbuf = 0;
	s->bitcnt = 0;
	if (s->incnt + 4 > s->inlen)
		return 2;
	unsigned len = s->in[s->incnt++];
	len |= s->in[s->incnt++] << 8;
	if (s->in[s->incnt++] != (~len & 0xff) ||
	    s->in[s->incnt++] != ((~len >> 8) & 0xff))
		return -2;
	if (s->incnt + len > s->inlen)
		return 2;
	if (s->outcnt + len > s->outlen)
		return 1;
	for (; len--; s->outcnt++, s->incnt++) {
		if (s->in[s->incnt])
			s->out[s->outcnt] = s->in[s->incnt];
	}
	return 0;
}
struct puff_huffman {
	short* count;
	short* symbol;
};
static int puff_decode(struct puff_state* s, const struct puff_huffman* h)
{
	int first = 0;
	int index = 0;
	int bitbuf = s->bitbuf;
	int left = s->bitcnt;
	int code = first = index = 0;
	int len = 1;
	short* next = h->count + 1;
	while (1) {
		while (left--) {
			code |= bitbuf & 1;
			bitbuf >>= 1;
			int count = *next++;
			if (code - count < first) {
				s->bitbuf = bitbuf;
				s->bitcnt = (s->bitcnt - len) & 7;
				return h->symbol[index + (code - first)];
			}
			index += count;
			first += count;
			first <<= 1;
			code <<= 1;
			len++;
		}
		left = (MAXBITS + 1) - len;
		if (left == 0)
			break;
		if (s->incnt == s->inlen)
			longjmp(s->env, 1);
		bitbuf = s->in[s->incnt++];
		if (left > 8)
			left = 8;
	}
	return -10;
}
static int puff_construct(struct puff_huffman* h, const short* length, int n)
{
	int len;
	for (len = 0; len <= MAXBITS; len++)
		h->count[len] = 0;
	int symbol;
	for (symbol = 0; symbol < n; symbol++)
		(h->count[length[symbol]])++;
	if (h->count[0] == n)
		return 0;
	int left = 1;
	for (len = 1; len <= MAXBITS; len++) {
		left <<= 1;
		left -= h->count[len];
		if (left < 0)
			return left;
	}
	short offs[MAXBITS + 1];
	offs[1] = 0;
	for (len = 1; len < MAXBITS; len++)
		offs[len + 1] = offs[len] + h->count[len];
	for (symbol = 0; symbol < n; symbol++)
		if (length[symbol] != 0)
			h->symbol[offs[length[symbol]]++] = symbol;
	return left;
}
static int puff_codes(struct puff_state* s,
		      const struct puff_huffman* lencode,
		      const struct puff_huffman* distcode)
{
	static const short lens[29] = {
				       3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
				       35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258};
	static const short lext[29] = {
				       0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
				       3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0};
	static const short dists[30] = {
					1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
					257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
					8193, 12289, 16385, 24577};
	static const short dext[30] = {
				       0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
				       7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
				       12, 12, 13, 13};
	int symbol;
	do {
		symbol = puff_decode(s, lencode);
		if (symbol < 0)
			return symbol;
		if (symbol < 256) {
			if (s->outcnt == s->outlen)
				return 1;
			if (symbol)
				s->out[s->outcnt] = symbol;
			s->outcnt++;
		} else if (symbol > 256) {
			symbol -= 257;
			if (symbol >= 29)
				return -10;
			int len = lens[symbol] + puff_bits(s, lext[symbol]);
			symbol = puff_decode(s, distcode);
			if (symbol < 0)
				return symbol;
			unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]);
			if (dist > s->outcnt)
				return -11;
			if (s->outcnt + len > s->outlen)
				return 1;
			while (len--) {
				if (dist <= s->outcnt && s->out[s->outcnt - dist])
					s->out[s->outcnt] = s->out[s->outcnt - dist];
				s->outcnt++;
			}
		}
	} while (symbol != 256);
	return 0;
}
static int puff_fixed(struct puff_state* s)
{
	static int virgin = 1;
	static short lencnt[MAXBITS + 1], lensym[FIXLCODES];
	static short distcnt[MAXBITS + 1], distsym[MAXDCODES];
	static struct puff_huffman lencode, distcode;
	if (virgin) {
		lencode.count = lencnt;
		lencode.symbol = lensym;
		distcode.count = distcnt;
		distcode.symbol = distsym;
		short lengths[FIXLCODES];
		int symbol;
		for (symbol = 0; symbol < 144; symbol++)
			lengths[symbol] = 8;
		for (; symbol < 256; symbol++)
			lengths[symbol] = 9;
		for (; symbol < 280; symbol++)
			lengths[symbol] = 7;
		for (; symbol < FIXLCODES; symbol++)
			lengths[symbol] = 8;
		puff_construct(&lencode, lengths, FIXLCODES);
		for (symbol = 0; symbol < MAXDCODES; symbol++)
			lengths[symbol] = 5;
		puff_construct(&distcode, lengths, MAXDCODES);
		virgin = 0;
	}
	return puff_codes(s, &lencode, &distcode);
}
static int puff_dynamic(struct puff_state* s)
{
	static const short order[19] =
	    {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
	int nlen = puff_bits(s, 5) + 257;
	int ndist = puff_bits(s, 5) + 1;
	int ncode = puff_bits(s, 4) + 4;
	if (nlen > MAXLCODES || ndist > MAXDCODES)
		return -3;
	short lengths[MAXCODES];
	int index;
	for (index = 0; index < ncode; index++)
		lengths[order[index]] = puff_bits(s, 3);
	for (; index < 19; index++)
		lengths[order[index]] = 0;
	short lencnt[MAXBITS + 1], lensym[MAXLCODES];
	struct puff_huffman lencode = {lencnt, lensym};
	int err = puff_construct(&lencode, lengths, 19);
	if (err != 0)
		return -4;
	index = 0;
	while (index < nlen + ndist) {
		int symbol;
		int len;
		symbol = puff_decode(s, &lencode);
		if (symbol < 0)
			return symbol;
		if (symbol < 16)
			lengths[index++] = symbol;
		else {
			len = 0;
			if (symbol == 16) {
				if (index == 0)
					return -5;
				len = lengths[index - 1];
				symbol = 3 + puff_bits(s, 2);
			} else if (symbol == 17)
				symbol = 3 + puff_bits(s, 3);
			else
				symbol = 11 + puff_bits(s, 7);
			if (index + symbol > nlen + ndist)
				return -6;
			while (symbol--)
				lengths[index++] = len;
		}
	}
	if (lengths[256] == 0)
		return -9;
	err = puff_construct(&lencode, lengths, nlen);
	if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1]))
		return -7;
	short distcnt[MAXBITS + 1], distsym[MAXDCODES];
	struct puff_huffman distcode = {distcnt, distsym};
	err = puff_construct(&distcode, lengths + nlen, ndist);
	if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1]))
		return -8;
	return puff_codes(s, &lencode, &distcode);
}
static int puff(
    unsigned char* dest,
    unsigned long* destlen,
    const unsigned char* source,
    unsigned long sourcelen)
{
	struct puff_state s = {
	    .out = dest,
	    .outlen = *destlen,
	    .outcnt = 0,
	    .in = source,
	    .inlen = sourcelen,
	    .incnt = 0,
	    .bitbuf = 0,
	    .bitcnt = 0,
	};
	int err;
	if (setjmp(s.env) != 0)
		err = 2;
	else {
		int last;
		do {
			last = puff_bits(&s, 1);
			int type = puff_bits(&s, 2);
			err = type == 0 ? puff_stored(&s) : (type == 1 ? puff_fixed(&s) : (type == 2 ? puff_dynamic(&s) : -1));
			if (err != 0)
				break;
		} while (!last);
	}
	*destlen = s.outcnt;
	return err;
}

//% END CODE DERIVED FROM puff.{c,h}

#define ZLIB_HEADER_WIDTH 2

static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd)
{
	if (sourcelen < ZLIB_HEADER_WIDTH)
		return 0;
	source += ZLIB_HEADER_WIDTH;
	sourcelen -= ZLIB_HEADER_WIDTH;
	const unsigned long max_destlen = 132 << 20;
	void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0);
	if (ret == MAP_FAILED)
		return -1;
	unsigned char* dest = (unsigned char*)ret;
	unsigned long destlen = max_destlen;
	int err = puff(dest, &destlen, source, sourcelen);
	if (err) {
		munmap(dest, max_destlen);
		errno = -err;
		return -1;
	}
	if (write(dest_fd, dest, destlen) != (ssize_t)destlen) {
		munmap(dest, max_destlen);
		return -1;
	}
	return munmap(dest, max_destlen);
}

static int setup_loop_device(unsigned char* data, unsigned long size, const char* loopname, int* loopfd_p)
{
	int err = 0, loopfd = -1;
	int memfd = syscall(__NR_memfd_create, "syzkaller", 0);
	if (memfd == -1) {
		err = errno;
		goto error;
	}
	if (puff_zlib_to_file(data, size, memfd)) {
		err = errno;
		goto error_close_memfd;
	}
	loopfd = open(loopname, O_RDWR);
	if (loopfd == -1) {
		err = errno;
		goto error_close_memfd;
	}
	if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
		if (errno != EBUSY) {
			err = errno;
			goto error_close_loop;
		}
		ioctl(loopfd, LOOP_CLR_FD, 0);
		usleep(1000);
		if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
			err = errno;
			goto error_close_loop;
		}
	}
	close(memfd);
	*loopfd_p = loopfd;
	return 0;

error_close_loop:
	close(loopfd);
error_close_memfd:
	close(memfd);
error:
	errno = err;
	return -1;
}

static void reset_loop_device(const char* loopname)
{
	int loopfd = open(loopname, O_RDWR);
	if (loopfd == -1) {
		return;
	}
	if (ioctl(loopfd, LOOP_CLR_FD, 0)) {
	}
	close(loopfd);
}

static long syz_mount_image(
    volatile long fsarg,
    volatile long dir,
    volatile long flags,
    volatile long optsarg,
    volatile long change_dir,
    volatile unsigned long size,
    volatile long image)
{
	unsigned char* data = (unsigned char*)image;
	int res = -1, err = 0, need_loop_device = !!size;
	char* mount_opts = (char*)optsarg;
	char* target = (char*)dir;
	char* fs = (char*)fsarg;
	char* source = NULL;
	char loopname[64];
	if (need_loop_device) {
		int loopfd;
		memset(loopname, 0, sizeof(loopname));
		snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid);
		if (setup_loop_device(data, size, loopname, &loopfd) == -1)
			return -1;
		close(loopfd);
		source = loopname;
	}
	mkdir(target, 0777);
	char opts[256];
	memset(opts, 0, sizeof(opts));
	if (strlen(mount_opts) > (sizeof(opts) - 32)) {
	}
	strncpy(opts, mount_opts, sizeof(opts) - 32);
	if (strcmp(fs, "iso9660") == 0) {
		flags |= MS_RDONLY;
	} else if (strncmp(fs, "ext", 3) == 0) {
		bool has_remount_ro = false;
		char* remount_ro_start = strstr(opts, "errors=remount-ro");
		if (remount_ro_start != NULL) {
			char after = *(remount_ro_start + strlen("errors=remount-ro"));
			char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1);
			has_remount_ro = ((before == '\0' || before == ',') && (after == '\0' || after == ','));
		}
		if (strstr(opts, "errors=panic") || !has_remount_ro)
			strcat(opts, ",errors=continue");
	} else if (strcmp(fs, "xfs") == 0) {
		strcat(opts, ",nouuid");
	} else if (strncmp(fs, "gfs2", 4) == 0 && (strstr(opts, "errors=panic") || strstr(opts, "debug"))) {
		strcat(opts, ",errors=withdraw");
	}
	res = mount(source, target, fs, flags, opts);
	if (res == -1) {
		err = errno;
		goto error_clear_loop;
	}
	res = open(target, O_RDONLY | O_DIRECTORY);
	if (res == -1) {
		err = errno;
		goto error_clear_loop;
	}
	if (change_dir) {
		res = chdir(target);
		if (res == -1) {
			err = errno;
		}
	}

error_clear_loop:
	if (need_loop_device)
		reset_loop_device(loopname);
	errno = err;
	return res;
}

uint64_t r[1] = {0xffffffffffffffff};

int main(void)
{
		syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
	syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
	syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
	const char* reason;
	(void)reason;
				intptr_t res = 0;
	if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
//  syz_mount_image$jfs arguments: [
//    fs: ptr[in, buffer] {
//      buffer: {6a 66 73 00} (length 0x4)
//    }
//    dir: ptr[in, buffer] {
//      buffer: {2e 2f 62 75 73 00} (length 0x6)
//    }
//    flags: mount_flags = 0x402 (8 bytes)
//    opts: ptr[inout, array[ANYUNION]] {
//      array[ANYUNION] {
//      }
//    }
//    chdir: int8 = 0xfe (1 bytes)
//    size: len = 0x61a8 (8 bytes)
//    img: ptr[in, buffer] {
//      buffer: (compressed buffer with length 0x61a8)
//    }
//  ]
//  returns fd_dir
memcpy((void*)0x200000000000, "jfs\000", 4);
memcpy((void*)0x200000000040, "./bus\000", 6);
memcpy((void*)0x200000009940, "... [truncated large byte array] ...", 25000);
syz_mount_image(/*fs=*/0x200000000000, /*dir=*/0x200000000040, /*flags=MS_NOSUID|MS_NOATIME*/0x402, /*opts=*/0x200000000580, /*chdir=*/0xfe, /*size=*/0x61a8, /*img=*/0x200000009940);
//  rename arguments: [
//    old: ptr[in, buffer] {
//      buffer: {2e 2f 66 69 6c 65 32 00} (length 0x8)
//    }
//    new: ptr[in, buffer] {
//      buffer: {2e 2f 62 75 73 00} (length 0x6)
//    }
//  ]
memcpy((void*)0x2000000002c0, "./file2\000", 8);
memcpy((void*)0x200000000340, "./bus\000", 6);
	syscall(__NR_rename, /*old=*/0x2000000002c0ul, /*new=*/0x200000000340ul);
//  mount arguments: [
//    src: ptr[in, blockdev_filename] {
//      union blockdev_filename {
//        loop: loop_filename {
//          prefix: buffer: {2f 64 65 76 2f 6c 6f 6f 70} (length 0x9)
//          id: proc = 0x0 (1 bytes)
//          z: const = 0x0 (1 bytes)
//        }
//      }
//    }
//    dst: ptr[in, buffer] {
//      buffer: {2e 2f 62 75 73 00} (length 0x6)
//    }
//    type: nil
//    flags: mount_flags = 0x1000 (8 bytes)
//    data: nil
//  ]
memcpy((void*)0x200000000380, "/dev/loop", 9);
*(uint8_t*)0x200000000389 = 0x30;
*(uint8_t*)0x20000000038a = 0;
memcpy((void*)0x200000000080, "./bus\000", 6);
	syscall(__NR_mount, /*src=*/0x200000000380ul, /*dst=*/0x200000000080ul, /*type=*/0ul, /*flags=MS_BIND*/0x1000ul, /*data=*/0ul);
//  open arguments: [
//    file: ptr[in, buffer] {
//      buffer: {2e 2f 62 75 73 00} (length 0x6)
//    }
//    flags: open_flags = 0x0 (8 bytes)
//    mode: open_mode = 0x0 (8 bytes)
//  ]
//  returns fd
memcpy((void*)0x200000000000, "./bus\000", 6);
	res = syscall(__NR_open, /*file=*/0x200000000000ul, /*flags=*/0ul, /*mode=*/0ul);
	if (res != -1)
		r[0] = res;
//  ioctl$LOOP_SET_STATUS64 arguments: [
//    fd: fd_loop (resource)
//    cmd: const = 0x4c04 (4 bytes)
//    arg: ptr[in, loop_info64] {
//      loop_info64 {
//        lo_device: const = 0x0 (8 bytes)
//        lo_inode: const = 0x0 (8 bytes)
//        lo_rdevice: const = 0x0 (8 bytes)
//        lo_offset: int64 = 0x7f (8 bytes)
//        lo_sizelimit: int64 = 0x0 (8 bytes)
//        lo_number: const = 0x0 (4 bytes)
//        lo_enc_type: lo_encrypt_type = 0x0 (4 bytes)
//        lo_enc_key_size: int32 = 0x0 (4 bytes)
//        lo_flags: lo_flags = 0x0 (4 bytes)
//        lo_file_name: buffer: {ef 35 9f 41 3b b9 01 52 f7 d6 d1 ce 5d 29 c3 ee 5e 5c a9 00 0f 7c 41 49 9d c2 aa c6 3a 01 00 00 00 00 00 00 00 4f aa 2a d9 c0 84 a0 03 ea 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x40)
//        lo_crypt_name: buffer: {03 6c 47 c6 78 08 20 04 00 00 00 00 00 00 00 33 52 63 bd bc ef 54 9b a1 97 fc e4 7d df dd 75 3a bd 95 01 00 00 2a 00 ff ff ff ff ff ff ff ff 00 00 00 00 e8 f2 00 00 00 02 00 00 00 00 00 00 00} (length 0x40)
//        lo_enc_key: buffer: {b7 32 67 36 18 1c 20 82 20 00 00 00 b9 00 00 00 00 00 00 00 00 00 f0 ff ff ff ff f2 ff 00 00 00} (length 0x20)
//        lo_init: array[int64] {
//          int64 = 0x0 (8 bytes)
//          int64 = 0x0 (8 bytes)
//        }
//      }
//    }
//  ]
*(uint64_t*)0x200000000240 = 0;
*(uint64_t*)0x200000000248 = 0;
*(uint64_t*)0x200000000250 = 0;
*(uint64_t*)0x200000000258 = 0x7f;
*(uint64_t*)0x200000000260 = 0;
*(uint32_t*)0x200000000268 = 0;
*(uint32_t*)0x20000000026c = 0;
*(uint32_t*)0x200000000270 = 0;
*(uint32_t*)0x200000000274 = 0;
memcpy((void*)0x200000000278, "... [truncated large byte array] ...", 64);
memcpy((void*)0x2000000002b8, "... [truncated large byte array] ...", 64);
memcpy((void*)0x2000000002f8, "... [truncated large byte array] ...", 32);
*(uint64_t*)0x200000000318 = 0;
*(uint64_t*)0x200000000320 = 0;
	syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x4c04, /*arg=*/0x200000000240ul);
	return 0;
}
]

3/1 2026/06/30 14:35 action kernel-checkouter
0m Results:
map[KernelSrc:/app/workdir/cache/src/7be5f73ee7b4d1978813accf8bb54cd892ccd800]

4/1 2026/06/30 14:35 action kernel-builder
0m Results:
map[KernelObj:/app/workdir/cache/build/5bc2ba8f92aa5e21412e076f42b19309bd220aa4]

5/1 2026/06/30 14:35 action crash-reproducer
0m Results:
map[OtherCrashReports:<nil> ReproducedBugTitle:UBSAN: array-index-out-of-bounds in dbJoin ReproducedCrashReport:------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in /app/workdir/cache/src/7be5f73ee7b4d1978813accf8bb54cd892ccd800/fs/jfs/jfs_dmap.c:2867:24
index 4294967295 is out of range for type 's8[1365]' (aka 'signed char[1365]')
CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted syzkaller #1 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 ubsan_epilogue+0xa/0x30 lib/ubsan.c:233
 __ubsan_handle_out_of_bounds+0xe8/0xf0 lib/ubsan.c:455
 dbJoin+0xcc4/0xd60 fs/jfs/jfs_dmap.c:2867
 dbFreeBits+0x4a2/0xd70 fs/jfs/jfs_dmap.c:2427
 dbFreeDmap fs/jfs/jfs_dmap.c:2176 [inline]
 dbFree+0x324/0x650 fs/jfs/jfs_dmap.c:485
 txFreeMap+0x9e6/0xde0 fs/jfs/jfs_txnmgr.c:2517
 xtTruncate+0xd16/0x2eb0 fs/jfs/jfs_xtree.c:2481
 jfs_free_zero_link+0x35b/0x4c0 fs/jfs/namei.c:760
 jfs_evict_inode+0x356/0x430 fs/jfs/inode.c:159
 evict+0x624/0xb50 fs/inode.c:825
 txLazyCommit fs/jfs/jfs_txnmgr.c:2666 [inline]
 jfs_lazycommit+0x44c/0xac0 fs/jfs/jfs_txnmgr.c:2735
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
---[ end trace ]---
 ReproducedFaultInjection:]

6/1 2026/06/30 14:35 action codesearch-prepare
0m Results:
map[Index:codesearch-index]

7/1 2026/06/30 14:36 agent debugger
10m Model:
best-expensive

Instruction:
You are an experienced Linux kernel developer tasked with debugging a kernel crash root cause.
You need to provide a detailed explanation of the root cause for another developer to be
able to write a fix for the bug based on your explanation. Include all relevant details
into the response: function/struct/field/etc names, code snippets, line numbers,
macro/enum values, etc.



Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.

Prefer calling several tools at the same time to save round-trips.

Prompt:
The crash is:

------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in /app/workdir/cache/src/7be5f73ee7b4d1978813accf8bb54cd892ccd800/fs/jfs/jfs_dmap.c:2867:24
index 4294967295 is out of range for type 's8[1365]' (aka 'signed char[1365]')
CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted syzkaller #1 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 ubsan_epilogue+0xa/0x30 lib/ubsan.c:233
 __ubsan_handle_out_of_bounds+0xe8/0xf0 lib/ubsan.c:455
 dbJoin+0xcc4/0xd60 fs/jfs/jfs_dmap.c:2867
 dbFreeBits+0x4a2/0xd70 fs/jfs/jfs_dmap.c:2427
 dbFreeDmap fs/jfs/jfs_dmap.c:2176 [inline]
 dbFree+0x324/0x650 fs/jfs/jfs_dmap.c:485
 txFreeMap+0x9e6/0xde0 fs/jfs/jfs_txnmgr.c:2517
 xtTruncate+0xd16/0x2eb0 fs/jfs/jfs_xtree.c:2481
 jfs_free_zero_link+0x35b/0x4c0 fs/jfs/namei.c:760
 jfs_evict_inode+0x356/0x430 fs/jfs/inode.c:159
 evict+0x624/0xb50 fs/inode.c:825
 txLazyCommit fs/jfs/jfs_txnmgr.c:2666 [inline]
 jfs_lazycommit+0x44c/0xac0 fs/jfs/jfs_txnmgr.c:2735
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
---[ end trace ]---


The following C code is a draft of the vulnerable syscall sequence. Keep in mind that
it may lack the precise threading, sandboxing, and some arguments of a working reproducer:

// autogenerated by syzkaller (https://github.com/google/syzkaller)

#define _GNU_SOURCE 

#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>

#include <linux/loop.h>

#ifndef __NR_memfd_create
#define __NR_memfd_create 319
#endif

static unsigned long long procid;

//% This code is derived from puff.{c,h}, found in the zlib development. The
//% original files come with the following copyright notice:

//% Copyright (C) 2002-2013 Mark Adler, all rights reserved
//% version 2.3, 21 Jan 2013
//% This software is provided 'as-is', without any express or implied
//% warranty.  In no event will the author be held liable for any damages
//% arising from the use of this software.
//% Permission is granted to anyone to use this software for any purpose,
//% including commercial applications, and to alter it and redistribute it
//% freely, subject to the following restrictions:
//% 1. The origin of this software must not be misrepresented; you must not
//%    claim that you wrote the original software. If you use this software
//%    in a product, an acknowledgment in the product documentation would be
//%    appreciated but is not required.
//% 2. Altered source versions must be plainly marked as such, and must not be
//%    misrepresented as being the original software.
//% 3. This notice may not be removed or altered from any source distribution.
//% Mark Adler    madler@alumni.caltech.edu

//% BEGIN CODE DERIVED FROM puff.{c,h}

#define MAXBITS 15
#define MAXLCODES 286
#define MAXDCODES 30
#define MAXCODES (MAXLCODES + MAXDCODES)
#define FIXLCODES 288

struct puff_state {
	unsigned char* out;
	unsigned long outlen;
	unsigned long outcnt;
	const unsigned char* in;
	unsigned long inlen;
	unsigned long incnt;
	int bitbuf;
	int bitcnt;
	jmp_buf env;
};
static int puff_bits(struct puff_state* s, int need)
{
	long val = s->bitbuf;
	while (s->bitcnt < need) {
		if (s->incnt == s->inlen)
			longjmp(s->env, 1);
		val |= (long)(s->in[s->incnt++]) << s->bitcnt;
		s->bitcnt += 8;
	}
	s->bitbuf = (int)(val >> need);
	s->bitcnt -= need;
	return (int)(val & ((1L << need) - 1));
}
static int puff_stored(struct puff_state* s)
{
	s->bitbuf = 0;
	s->bitcnt = 0;
	if (s->incnt + 4 > s->inlen)
		return 2;
	unsigned len = s->in[s->incnt++];
	len |= s->in[s->incnt++] << 8;
	if (s->in[s->incnt++] != (~len & 0xff) ||
	    s->in[s->incnt++] != ((~len >> 8) & 0xff))
		return -2;
	if (s->incnt + len > s->inlen)
		return 2;
	if (s->outcnt + len > s->outlen)
		return 1;
	for (; len--; s->outcnt++, s->incnt++) {
		if (s->in[s->incnt])
			s->out[s->outcnt] = s->in[s->incnt];
	}
	return 0;
}
struct puff_huffman {
	short* count;
	short* symbol;
};
static int puff_decode(struct puff_state* s, const struct puff_huffman* h)
{
	int first = 0;
	int index = 0;
	int bitbuf = s->bitbuf;
	int left = s->bitcnt;
	int code = first = index = 0;
	int len = 1;
	short* next = h->count + 1;
	while (1) {
		while (left--) {
			code |= bitbuf & 1;
			bitbuf >>= 1;
			int count = *next++;
			if (code - count < first) {
				s->bitbuf = bitbuf;
				s->bitcnt = (s->bitcnt - len) & 7;
				return h->symbol[index + (code - first)];
			}
			index += count;
			first += count;
			first <<= 1;
			code <<= 1;
			len++;
		}
		left = (MAXBITS + 1) - len;
		if (left == 0)
			break;
		if (s->incnt == s->inlen)
			longjmp(s->env, 1);
		bitbuf = s->in[s->incnt++];
		if (left > 8)
			left = 8;
	}
	return -10;
}
static int puff_construct(struct puff_huffman* h, const short* length, int n)
{
	int len;
	for (len = 0; len <= MAXBITS; len++)
		h->count[len] = 0;
	int symbol;
	for (symbol = 0; symbol < n; symbol++)
		(h->count[length[symbol]])++;
	if (h->count[0] == n)
		return 0;
	int left = 1;
	for (len = 1; len <= MAXBITS; len++) {
		left <<= 1;
		left -= h->count[len];
		if (left < 0)
			return left;
	}
	short offs[MAXBITS + 1];
	offs[1] = 0;
	for (len = 1; len < MAXBITS; len++)
		offs[len + 1] = offs[len] + h->count[len];
	for (symbol = 0; symbol < n; symbol++)
		if (length[symbol] != 0)
			h->symbol[offs[length[symbol]]++] = symbol;
	return left;
}
static int puff_codes(struct puff_state* s,
		      const struct puff_huffman* lencode,
		      const struct puff_huffman* distcode)
{
	static const short lens[29] = {
				       3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
				       35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258};
	static const short lext[29] = {
				       0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
				       3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0};
	static const short dists[30] = {
					1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
					257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
					8193, 12289, 16385, 24577};
	static const short dext[30] = {
				       0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
				       7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
				       12, 12, 13, 13};
	int symbol;
	do {
		symbol = puff_decode(s, lencode);
		if (symbol < 0)
			return symbol;
		if (symbol < 256) {
			if (s->outcnt == s->outlen)
				return 1;
			if (symbol)
				s->out[s->outcnt] = symbol;
			s->outcnt++;
		} else if (symbol > 256) {
			symbol -= 257;
			if (symbol >= 29)
				return -10;
			int len = lens[symbol] + puff_bits(s, lext[symbol]);
			symbol = puff_decode(s, distcode);
			if (symbol < 0)
				return symbol;
			unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]);
			if (dist > s->outcnt)
				return -11;
			if (s->outcnt + len > s->outlen)
				return 1;
			while (len--) {
				if (dist <= s->outcnt && s->out[s->outcnt - dist])
					s->out[s->outcnt] = s->out[s->outcnt - dist];
				s->outcnt++;
			}
		}
	} while (symbol != 256);
	return 0;
}
static int puff_fixed(struct puff_state* s)
{
	static int virgin = 1;
	static short lencnt[MAXBITS + 1], lensym[FIXLCODES];
	static short distcnt[MAXBITS + 1], distsym[MAXDCODES];
	static struct puff_huffman lencode, distcode;
	if (virgin) {
		lencode.count = lencnt;
		lencode.symbol = lensym;
		distcode.count = distcnt;
		distcode.symbol = distsym;
		short lengths[FIXLCODES];
		int symbol;
		for (symbol = 0; symbol < 144; symbol++)
			lengths[symbol] = 8;
		for (; symbol < 256; symbol++)
			lengths[symbol] = 9;
		for (; symbol < 280; symbol++)
			lengths[symbol] = 7;
		for (; symbol < FIXLCODES; symbol++)
			lengths[symbol] = 8;
		puff_construct(&lencode, lengths, FIXLCODES);
		for (symbol = 0; symbol < MAXDCODES; symbol++)
			lengths[symbol] = 5;
		puff_construct(&distcode, lengths, MAXDCODES);
		virgin = 0;
	}
	return puff_codes(s, &lencode, &distcode);
}
static int puff_dynamic(struct puff_state* s)
{
	static const short order[19] =
	    {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
	int nlen = puff_bits(s, 5) + 257;
	int ndist = puff_bits(s, 5) + 1;
	int ncode = puff_bits(s, 4) + 4;
	if (nlen > MAXLCODES || ndist > MAXDCODES)
		return -3;
	short lengths[MAXCODES];
	int index;
	for (index = 0; index < ncode; index++)
		lengths[order[index]] = puff_bits(s, 3);
	for (; index < 19; index++)
		lengths[order[index]] = 0;
	short lencnt[MAXBITS + 1], lensym[MAXLCODES];
	struct puff_huffman lencode = {lencnt, lensym};
	int err = puff_construct(&lencode, lengths, 19);
	if (err != 0)
		return -4;
	index = 0;
	while (index < nlen + ndist) {
		int symbol;
		int len;
		symbol = puff_decode(s, &lencode);
		if (symbol < 0)
			return symbol;
		if (symbol < 16)
			lengths[index++] = symbol;
		else {
			len = 0;
			if (symbol == 16) {
				if (index == 0)
					return -5;
				len = lengths[index - 1];
				symbol = 3 + puff_bits(s, 2);
			} else if (symbol == 17)
				symbol = 3 + puff_bits(s, 3);
			else
				symbol = 11 + puff_bits(s, 7);
			if (index + symbol > nlen + ndist)
				return -6;
			while (symbol--)
				lengths[index++] = len;
		}
	}
	if (lengths[256] == 0)
		return -9;
	err = puff_construct(&lencode, lengths, nlen);
	if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1]))
		return -7;
	short distcnt[MAXBITS + 1], distsym[MAXDCODES];
	struct puff_huffman distcode = {distcnt, distsym};
	err = puff_construct(&distcode, lengths + nlen, ndist);
	if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1]))
		return -8;
	return puff_codes(s, &lencode, &distcode);
}
static int puff(
    unsigned char* dest,
    unsigned long* destlen,
    const unsigned char* source,
    unsigned long sourcelen)
{
	struct puff_state s = {
	    .out = dest,
	    .outlen = *destlen,
	    .outcnt = 0,
	    .in = source,
	    .inlen = sourcelen,
	    .incnt = 0,
	    .bitbuf = 0,
	    .bitcnt = 0,
	};
	int err;
	if (setjmp(s.env) != 0)
		err = 2;
	else {
		int last;
		do {
			last = puff_bits(&s, 1);
			int type = puff_bits(&s, 2);
			err = type == 0 ? puff_stored(&s) : (type == 1 ? puff_fixed(&s) : (type == 2 ? puff_dynamic(&s) : -1));
			if (err != 0)
				break;
		} while (!last);
	}
	*destlen = s.outcnt;
	return err;
}

//% END CODE DERIVED FROM puff.{c,h}

#define ZLIB_HEADER_WIDTH 2

static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd)
{
	if (sourcelen < ZLIB_HEADER_WIDTH)
		return 0;
	source += ZLIB_HEADER_WIDTH;
	sourcelen -= ZLIB_HEADER_WIDTH;
	const unsigned long max_destlen = 132 << 20;
	void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0);
	if (ret == MAP_FAILED)
		return -1;
	unsigned char* dest = (unsigned char*)ret;
	unsigned long destlen = max_destlen;
	int err = puff(dest, &destlen, source, sourcelen);
	if (err) {
		munmap(dest, max_destlen);
		errno = -err;
		return -1;
	}
	if (write(dest_fd, dest, destlen) != (ssize_t)destlen) {
		munmap(dest, max_destlen);
		return -1;
	}
	return munmap(dest, max_destlen);
}

static int setup_loop_device(unsigned char* data, unsigned long size, const char* loopname, int* loopfd_p)
{
	int err = 0, loopfd = -1;
	int memfd = syscall(__NR_memfd_create, "syzkaller", 0);
	if (memfd == -1) {
		err = errno;
		goto error;
	}
	if (puff_zlib_to_file(data, size, memfd)) {
		err = errno;
		goto error_close_memfd;
	}
	loopfd = open(loopname, O_RDWR);
	if (loopfd == -1) {
		err = errno;
		goto error_close_memfd;
	}
	if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
		if (errno != EBUSY) {
			err = errno;
			goto error_close_loop;
		}
		ioctl(loopfd, LOOP_CLR_FD, 0);
		usleep(1000);
		if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
			err = errno;
			goto error_close_loop;
		}
	}
	close(memfd);
	*loopfd_p = loopfd;
	return 0;

error_close_loop:
	close(loopfd);
error_close_memfd:
	close(memfd);
error:
	errno = err;
	return -1;
}

static void reset_loop_device(const char* loopname)
{
	int loopfd = open(loopname, O_RDWR);
	if (loopfd == -1) {
		return;
	}
	if (ioctl(loopfd, LOOP_CLR_FD, 0)) {
	}
	close(loopfd);
}

static long syz_mount_image(
    volatile long fsarg,
    volatile long dir,
    volatile long flags,
    volatile long optsarg,
    volatile long change_dir,
    volatile unsigned long size,
    volatile long image)
{
	unsigned char* data = (unsigned char*)image;
	int res = -1, err = 0, need_loop_device = !!size;
	char* mount_opts = (char*)optsarg;
	char* target = (char*)dir;
	char* fs = (char*)fsarg;
	char* source = NULL;
	char loopname[64];
	if (need_loop_device) {
		int loopfd;
		memset(loopname, 0, sizeof(loopname));
		snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid);
		if (setup_loop_device(data, size, loopname, &loopfd) == -1)
			return -1;
		close(loopfd);
		source = loopname;
	}
	mkdir(target, 0777);
	char opts[256];
	memset(opts, 0, sizeof(opts));
	if (strlen(mount_opts) > (sizeof(opts) - 32)) {
	}
	strncpy(opts, mount_opts, sizeof(opts) - 32);
	if (strcmp(fs, "iso9660") == 0) {
		flags |= MS_RDONLY;
	} else if (strncmp(fs, "ext", 3) == 0) {
		bool has_remount_ro = false;
		char* remount_ro_start = strstr(opts, "errors=remount-ro");
		if (remount_ro_start != NULL) {
			char after = *(remount_ro_start + strlen("errors=remount-ro"));
			char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1);
			has_remount_ro = ((before == '\0' || before == ',') && (after == '\0' || after == ','));
		}
		if (strstr(opts, "errors=panic") || !has_remount_ro)
			strcat(opts, ",errors=continue");
	} else if (strcmp(fs, "xfs") == 0) {
		strcat(opts, ",nouuid");
	} else if (strncmp(fs, "gfs2", 4) == 0 && (strstr(opts, "errors=panic") || strstr(opts, "debug"))) {
		strcat(opts, ",errors=withdraw");
	}
	res = mount(source, target, fs, flags, opts);
	if (res == -1) {
		err = errno;
		goto error_clear_loop;
	}
	res = open(target, O_RDONLY | O_DIRECTORY);
	if (res == -1) {
		err = errno;
		goto error_clear_loop;
	}
	if (change_dir) {
		res = chdir(target);
		if (res == -1) {
			err = errno;
		}
	}

error_clear_loop:
	if (need_loop_device)
		reset_loop_device(loopname);
	errno = err;
	return res;
}

uint64_t r[1] = {0xffffffffffffffff};

int main(void)
{
		syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
	syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
	syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
	const char* reason;
	(void)reason;
				intptr_t res = 0;
	if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
//  syz_mount_image$jfs arguments: [
//    fs: ptr[in, buffer] {
//      buffer: {6a 66 73 00} (length 0x4)
//    }
//    dir: ptr[in, buffer] {
//      buffer: {2e 2f 62 75 73 00} (length 0x6)
//    }
//    flags: mount_flags = 0x402 (8 bytes)
//    opts: ptr[inout, array[ANYUNION]] {
//      array[ANYUNION] {
//      }
//    }
//    chdir: int8 = 0xfe (1 bytes)
//    size: len = 0x61a8 (8 bytes)
//    img: ptr[in, buffer] {
//      buffer: (compressed buffer with length 0x61a8)
//    }
//  ]
//  returns fd_dir
memcpy((void*)0x200000000000, "jfs\000", 4);
memcpy((void*)0x200000000040, "./bus\000", 6);
memcpy((void*)0x200000009940, "... [truncated large byte array] ...", 25000);
syz_mount_image(/*fs=*/0x200000000000, /*dir=*/0x200000000040, /*flags=MS_NOSUID|MS_NOATIME*/0x402, /*opts=*/0x200000000580, /*chdir=*/0xfe, /*size=*/0x61a8, /*img=*/0x200000009940);
//  rename arguments: [
//    old: ptr[in, buffer] {
//      buffer: {2e 2f 66 69 6c 65 32 00} (length 0x8)
//    }
//    new: ptr[in, buffer] {
//      buffer: {2e 2f 62 75 73 00} (length 0x6)
//    }
//  ]
memcpy((void*)0x2000000002c0, "./file2\000", 8);
memcpy((void*)0x200000000340, "./bus\000", 6);
	syscall(__NR_rename, /*old=*/0x2000000002c0ul, /*new=*/0x200000000340ul);
//  mount arguments: [
//    src: ptr[in, blockdev_filename] {
//      union blockdev_filename {
//        loop: loop_filename {
//          prefix: buffer: {2f 64 65 76 2f 6c 6f 6f 70} (length 0x9)
//          id: proc = 0x0 (1 bytes)
//          z: const = 0x0 (1 bytes)
//        }
//      }
//    }
//    dst: ptr[in, buffer] {
//      buffer: {2e 2f 62 75 73 00} (length 0x6)
//    }
//    type: nil
//    flags: mount_flags = 0x1000 (8 bytes)
//    data: nil
//  ]
memcpy((void*)0x200000000380, "/dev/loop", 9);
*(uint8_t*)0x200000000389 = 0x30;
*(uint8_t*)0x20000000038a = 0;
memcpy((void*)0x200000000080, "./bus\000", 6);
	syscall(__NR_mount, /*src=*/0x200000000380ul, /*dst=*/0x200000000080ul, /*type=*/0ul, /*flags=MS_BIND*/0x1000ul, /*data=*/0ul);
//  open arguments: [
//    file: ptr[in, buffer] {
//      buffer: {2e 2f 62 75 73 00} (length 0x6)
//    }
//    flags: open_flags = 0x0 (8 bytes)
//    mode: open_mode = 0x0 (8 bytes)
//  ]
//  returns fd
memcpy((void*)0x200000000000, "./bus\000", 6);
	res = syscall(__NR_open, /*file=*/0x200000000000ul, /*flags=*/0ul, /*mode=*/0ul);
	if (res != -1)
		r[0] = res;
//  ioctl$LOOP_SET_STATUS64 arguments: [
//    fd: fd_loop (resource)
//    cmd: const = 0x4c04 (4 bytes)
//    arg: ptr[in, loop_info64] {
//      loop_info64 {
//        lo_device: const = 0x0 (8 bytes)
//        lo_inode: const = 0x0 (8 bytes)
//        lo_rdevice: const = 0x0 (8 bytes)
//        lo_offset: int64 = 0x7f (8 bytes)
//        lo_sizelimit: int64 = 0x0 (8 bytes)
//        lo_number: const = 0x0 (4 bytes)
//        lo_enc_type: lo_encrypt_type = 0x0 (4 bytes)
//        lo_enc_key_size: int32 = 0x0 (4 bytes)
//        lo_flags: lo_flags = 0x0 (4 bytes)
//        lo_file_name: buffer: {ef 35 9f 41 3b b9 01 52 f7 d6 d1 ce 5d 29 c3 ee 5e 5c a9 00 0f 7c 41 49 9d c2 aa c6 3a 01 00 00 00 00 00 00 00 4f aa 2a d9 c0 84 a0 03 ea 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x40)
//        lo_crypt_name: buffer: {03 6c 47 c6 78 08 20 04 00 00 00 00 00 00 00 33 52 63 bd bc ef 54 9b a1 97 fc e4 7d df dd 75 3a bd 95 01 00 00 2a 00 ff ff ff ff ff ff ff ff 00 00 00 00 e8 f2 00 00 00 02 00 00 00 00 00 00 00} (length 0x40)
//        lo_enc_key: buffer: {b7 32 67 36 18 1c 20 82 20 00 00 00 b9 00 00 00 00 00 00 00 00 00 f0 ff ff ff ff f2 ff 00 00 00} (length 0x20)
//        lo_init: array[int64] {
//          int64 = 0x0 (8 bytes)
//          int64 = 0x0 (8 bytes)
//        }
//      }
//    }
//  ]
*(uint64_t*)0x200000000240 = 0;
*(uint64_t*)0x200000000248 = 0;
*(uint64_t*)0x200000000250 = 0;
*(uint64_t*)0x200000000258 = 0x7f;
*(uint64_t*)0x200000000260 = 0;
*(uint32_t*)0x200000000268 = 0;
*(uint32_t*)0x20000000026c = 0;
*(uint32_t*)0x200000000270 = 0;
*(uint32_t*)0x200000000274 = 0;
memcpy((void*)0x200000000278, "... [truncated large byte array] ...", 64);
memcpy((void*)0x2000000002b8, "... [truncated large byte array] ...", 64);
memcpy((void*)0x2000000002f8, "... [truncated large byte array] ...", 32);
*(uint64_t*)0x200000000318 = 0;
*(uint64_t*)0x200000000320 = 0;
	syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x4c04, /*arg=*/0x200000000240ul);
	return 0;
}





Reply:
An array-index-out-of-bounds crash occurs in `dbJoin` when the JFS filesystem attempts to free blocks using a corrupted `dmap` structure read from disk.

### Root Cause

The JFS filesystem uses a binary buddy system to manage free space. The state of the buddy system is stored in `dmap` (for leaf levels) and `dmapctl` (for upper levels) structures on disk. 

When a `dmap` is read from disk, its `dmaptree` structure is not fully validated. Specifically, the `leafidx` field (which indicates the index of the first leaf in the `stree` array) is read directly from disk and used to compute pointers to the leaf nodes. 

If `leafidx` is corrupted (e.g., set to `0xffffffff` / `-1`), the computed pointer will point out of bounds of the `stree` array. When `dbFreeDmap` is called to free blocks, it calls `dbFreeBits`, which in turn calls `dbJoin` to update the buddy system. `dbJoin` uses the corrupted `leafidx` to access the leaf nodes:

```c
// fs/jfs/jfs_dmap.c:2867
leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
```

This results in an out-of-bounds memory access when `leaf[buddy]` is subsequently accessed.

While a similar integrity check (`check_dmapctl`) was recently added for `dmapctl` structures in commit `cce219b203c4` ("jfs: add dmapctl integrity check to prevent invalid operations"), the `dmap` structures (`dmaptree`) were left unchecked.

### Fix

Introduce a `check_dmaptree` function, similar to the existing `check_dmapctl` function, to validate the integrity of the `dmaptree` structure when it is used. 

The `check_dmaptree` function should verify that:
- `nleafs` is within bounds (`<= LPERDMAP`).
- `l2nleafs` is within bounds (`<= L2LPERDMAP`).
- `nleafs` matches `2^l2nleafs`.
- `leafidx` is exactly `LEAFIND`.
- `height` is within bounds (`<= 4`).
- `budmin` is valid (`>= BUDMIN`).
- The leaf nodes fit within the `stree` array (`leafidx + nleafs <= TREESIZE`).
- The values of the leaf nodes are valid (`>= NOFREE` and `<= 31`).

Call `check_dmaptree` in the functions that operate on the `dmap` structure, such as `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. If `check_dmaptree` fails, return `-EIO` to prevent further processing of the corrupted `dmap`. This will also replace the existing partial checks for `leafidx` in `dbAllocNext` and `dbAllocNear`.

```c
/*
 * check_dmaptree - Validate integrity of a dmaptree structure
 * @dtp: Pointer to the dmaptree structure to check
 *
 * Return: true if valid, false if corrupted
 */
static bool check_dmaptree(struct dmaptree *dtp)
{
	u32 nleafs, l2nleafs, leafidx, height;
	int i;

	nleafs = le32_to_cpu(dtp->nleafs);
	/* Check basic field ranges */
	if (unlikely(nleafs > LPERDMAP)) {
		jfs_err("dmaptree: invalid nleafs %u (max %u)",
			nleafs, LPERDMAP);
		return false;
	}

	l2nleafs = le32_to_cpu(dtp->l2nleafs);
	if (unlikely(l2nleafs > L2LPERDMAP)) {
		jfs_err("dmaptree: invalid l2nleafs %u (max %u)",
			l2nleafs, L2LPERDMAP);
		return false;
	}

	/* Verify nleafs matches l2nleafs (must be power of two) */
	if (unlikely((1U << l2nleafs) != nleafs)) {
		jfs_err("dmaptree: nleafs %u != 2^%u",
			nleafs, l2nleafs);
		return false;
	}

	leafidx = le32_to_cpu(dtp->leafidx);
	/* Check leaf index matches expected position */
	if (unlikely(leafidx != LEAFIND)) {
		jfs_err("dmaptree: invalid leafidx %u (expected %u)",
			leafidx, LEAFIND);
		return false;
	}

	height = le32_to_cpu(dtp->height);
	/* Check tree height is within valid range */
	if (unlikely(height > 4)) {
		jfs_err("dmaptree: invalid height %u (max 4)",
			height);
		return false;
	}

	/* Check budmin is valid */
	if (unlikely(dtp->budmin < BUDMIN)) {
		jfs_err("dmaptree: invalid budmin %d (min %d)",
			dtp->budmin, BUDMIN);
		return false;
	}

	/* Check leaf nodes fit within stree array */
	if (unlikely(leafidx + nleafs > TREESIZE)) {
		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
			leafidx + nleafs, TREESIZE);
		return false;
	}

	/* Check leaf nodes have valid values */
	for (i = leafidx; i < leafidx + nleafs; i++) {
		s8 val = dtp->stree[i];

		if (unlikely(val < NOFREE)) {
			jfs_err("dmaptree: invalid leaf value %d at index %d",
					val, i);
			return false;
		} else if (unlikely(val > 31)) {
			jfs_err("dmaptree: leaf value %d too large at index %d", val, i);
			return false;
		}
	}

	return true;
}
```

Then, in functions like `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`, add the check at the beginning:

```c
	if (unlikely(!check_dmaptree(&dp->tree))) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}
```

8/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 12766
							output: 41
							thoughts: 125
						

Thoughts:
**Analyzing a UBSAN Crash in the JFS Filesystem**

Okay, so I've got a UBSAN array-index-out-of-bounds crash on my hands, specifically in the JFS filesystem code. The culprit is `fs/jfs/jfs_dmap.c`, line 2867, position 24.  The reported index is 4294967295.  Now, that's interesting because, in the world of 32-bit unsigned integers, that's equivalent to -1. Effectively, we're trying to access an array using a negative index, although it is encoded as a maximum unsigned integer. The array type in question is an `s8[1365]`, so a signed 8-bit character array with 1365 elements. The failing function is `dbJoin`. I need to dive into that section of the code and see what's going on. Line 2867 and surrounding lines will be my starting point. I need to understand how the index is being calculated, what data is flowing into that `dbJoin` function, and why it is generating such an unexpected index. Let's see if we can find some clues.



9/2 2026/06/30 14:36 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2850 LineCount:50]

Results:
map[Contents:2850:	 * PARAMETERS:
2851:	 *	tp	- pointer to the tree containing the leaf.
2852:	 *	leafno	- the number of the leaf to be updated.
2853:	 *	newval	- the new value for the leaf.
2854:	 *
2855:	 * RETURN VALUES: none
2856:	 */
2857:	static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl)
2858:	{
2859:		int budsz, buddy;
2860:		s8 *leaf;
2861:	
2862:		/* can the new leaf value require a join with other leaves ?
2863:		 */
2864:		if (newval >= tp->dmt_budmin) {
2865:			/* pickup a pointer to the leaves of the tree.
2866:			 */
2867:			leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
2868:	
2869:			/* try to join the specified leaf into a large binary
2870:			 * buddy system.  the join proceeds by attempting to join
2871:			 * the specified leafno with its buddy (leaf) at new value.
2872:			 * if the join occurs, we attempt to join the left leaf
2873:			 * of the joined buddies with its buddy at new value + 1.
2874:			 * we continue to join until we find a buddy that cannot be
2875:			 * joined (does not have a value equal to the size of the
2876:			 * last join) or until all leaves have been joined into a
2877:			 * single system.
2878:			 *
2879:			 * get the buddy size (number of words covered) of
2880:			 * the new value.
2881:			 */
2882:			budsz = BUDSIZE(newval, tp->dmt_budmin);
2883:	
2884:			/* try to join.
2885:			 */
2886:			while (budsz < le32_to_cpu(tp->dmt_nleafs)) {
2887:				/* get the buddy leaf.
2888:				 */
2889:				buddy = leafno ^ budsz;
2890:	
2891:				/* if the leaf's new value is greater than its
2892:				 * buddy's value, we join no more.
2893:				 */
2894:				if (newval > leaf[buddy])
2895:					break;
2896:	
2897:				/* It shouldn't be less */
2898:				if (newval < leaf[buddy])
2899:					return -EIO;
]

10/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 13964
							output: 29
							thoughts: 261
						

Thoughts:
**Debugging a JFS Crash**

Okay, so I've got a crash at line 2867 in `jfs_dmap.c`. The trace is pretty clear: it's a `UBSAN` array-index-out-of-bounds error. The specific index is 4294967295, which is -1 when interpreted as a signed integer, and it's out of range for the array `s8[1365]` named `tp->dmt_stree`. Right, let's look at that line, specifically.

Line 2867 is: `leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);`. Alright, so `tp->dmt_leafidx` is the culprit. `le32_to_cpu()` is returning 4294967295, which becomes -1 when we use it as an index, which is definitely out of bounds. The code is interpreting that as a negative index. I need to understand where `tp->dmt_leafidx` is being set and what its valid range is. Let's see how `dmtree_t` is defined; I need to know how these fields are being populated.



11/2 2026/06/30 14:36 tool codesearch-find-references
0m Args:
map[IncludeSnippetLines:0 Name:dmtree_t]

Results:
map[References:[map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2613] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2620] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2622] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2652] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2662] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2664] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjTree SourceFile:fs/jfs/jfs_dmap.c SourceLine:2951] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAllocBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2230] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAllocBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2230] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAllocDmapLev SourceFile:fs/jfs/jfs_dmap.c SourceLine:2056] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbBackSplit SourceFile:fs/jfs/jfs_dmap.c SourceLine:2778] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbFindCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:1804] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbFindLeaf SourceFile:fs/jfs/jfs_dmap.c SourceLine:3034] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbFreeBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2377] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbFreeBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2377] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbFreeDmap SourceFile:fs/jfs/jfs_dmap.c SourceLine:2195] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbJoin SourceFile:fs/jfs/jfs_dmap.c SourceLine:2857] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbSplit SourceFile:fs/jfs/jfs_dmap.c SourceLine:2713]] TruncatedOutput:false]

12/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 15519
							output: 41
							thoughts: 14
						

Thoughts:
Here's my thought process, summarized as you requested:

**Delving into `dmtree_t`**

Alright, let's get down to brass tacks. I need to understand what this `dmtree_t` thing is all about. Time to consult the documentation, the source code, maybe even some example usage if it's available. My gut tells me this is probably a type definition, perhaps a struct or typedef, or class. Likely dealing with a data structure. Given the "dm" prefix, I'm already anticipating that this might be related to device management or data management in some capacity. My experience tells me these types are often related to a binary tree implementation, but let's not jump to any conclusions. We need a solid definition. From there I can determine its role within the system. Let's start with a focused search and go from there. This is a critical first step.



13/2 2026/06/30 14:36 tool codesearch-find-references
0m Args:
map[IncludeSnippetLines:0 Name:dmtree_t SourceTreePrefix:fs/jfs/]

Results:
map[References:[map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2613] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2620] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2622] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2652] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2662] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2664] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAdjTree SourceFile:fs/jfs/jfs_dmap.c SourceLine:2951] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAllocBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2230] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAllocBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2230] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbAllocDmapLev SourceFile:fs/jfs/jfs_dmap.c SourceLine:2056] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbBackSplit SourceFile:fs/jfs/jfs_dmap.c SourceLine:2778] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbFindCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:1804] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbFindLeaf SourceFile:fs/jfs/jfs_dmap.c SourceLine:3034] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbFreeBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2377] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbFreeBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2377] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbFreeDmap SourceFile:fs/jfs/jfs_dmap.c SourceLine:2195] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbJoin SourceFile:fs/jfs/jfs_dmap.c SourceLine:2857] map[ReferenceKind:uses ReferencingEntityKind:function ReferencingEntityName:dbSplit SourceFile:fs/jfs/jfs_dmap.c SourceLine:2713]] TruncatedOutput:false]

14/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 16750
							output: 21
							thoughts: 20
						

Thoughts:
Here's my thought process, as if I were thinking it:

**Digging into `dmtree_t`**

Okay, so `dmtree_t`... I see it's a `typedef`. Right, that means it's an alias for some underlying type. I need to understand what this thing actually *is*. The declaration alone won't tell me everything. Let's see if I can find where it's defined and used. Time to fire up a `grep` and see where this `dmtree_t` is hiding in the codebase. That's the best way to get a quick overview of its structure and purpose. I'm assuming that it is used throughout the code so this will be a good first step.



15/2 2026/06/30 14:36 tool grepper
0m Error:
log-in to see details

Args:
map[Expression:typedef.*dmtree_t]

Results:
map[Output:]

16/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 16967
							output: 21
							thoughts: 14
						

Thoughts:
Okay, here's my summarized thought process, assuming I'm an expert and this is just the beginning of a larger investigation:

**Initiating Code Exploration: Targeting `dmtree_t`**

Alright, time to dive in. My first instinct is to get a handle on what `dmtree_t` actually *is*. This strongly suggests some sort of data structure, potentially tree-like given the naming convention. So, I'm going to start with the most basic approach: a good old `grep`. I'll run a grep search for the definition of `dmtree_t` in the codebase. That should give me the type definition and allow me to determine how it's structured, what fields are available, and the overall purpose of this data structure. Knowing the definition is paramount before I can understand its use and how it relates to the larger system. Let's see what we can find.



17/2 2026/06/30 14:36 tool grepper
0m Error:
log-in to see details

Args:
map[Expression:struct.*dmtree_t]

Results:
map[Output:]

18/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 17210
							output: 30
							thoughts: 20
						

Thoughts:
Okay, here's my interpretation of that thought process, assuming I'm an expert in file systems and kernel internals:

**Diving into JFS with `dmtree_t`**

Alright, time to get my hands dirty. I'm thinking I need to find the definition or usage of `dmtree_t`. Given that the context seems to be about file systems, specifically JFS, the natural starting point is to dive into the JFS source code. I'm going to use `grep` – a classic, reliable tool – to pinpoint the location of `dmtree_t`. This should be quick, and hopefully, I'll be able to trace its purpose and relationship to other JFS data structures without having to do a full code dive.  `fs/jfs/` is the directory I'll target first. Let's see what we can dig up!



19/2 2026/06/30 14:36 tool grepper
0m Args:
map[Expression:dmtree_t PathPrefix:fs/jfs/]

Results:
map[Output:fs/jfs/jfs_dmap.c=64=static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
fs/jfs/jfs_dmap.c-65-			int nblocks);
fs/jfs/jfs_dmap.c:66:static void dbSplit(dmtree_t *tp, int leafno, int splitsz, int newval, bool is_ctl);
fs/jfs/jfs_dmap.c:67:static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl);
fs/jfs/jfs_dmap.c:68:static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl);
fs/jfs/jfs_dmap.c:69:static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl);
fs/jfs/jfs_dmap.c-70-static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc,
--
fs/jfs/jfs_dmap.c=89=static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno);
fs/jfs/jfs_dmap.c:90:static int dbFindLeaf(dmtree_t *tp, int l2nb, int *leafidx, bool is_ctl);
fs/jfs/jfs_dmap.c-91-static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
--
fs/jfs/jfs_dmap.c=1768=static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
--
fs/jfs/jfs_dmap.c-1803-		 */
fs/jfs/jfs_dmap.c:1804:		rc = dbFindLeaf((dmtree_t *) dcp, l2nb, &leafidx, true);
fs/jfs/jfs_dmap.c-1805-
--
fs/jfs/jfs_dmap.c=2043=dbAllocDmapLev(struct bmap * bmp,
--
fs/jfs/jfs_dmap.c-2055-	 */
fs/jfs/jfs_dmap.c:2056:	if (dbFindLeaf((dmtree_t *) &dp->tree, l2nb, &leafidx, false))
fs/jfs/jfs_dmap.c-2057-		return -ENOSPC;
--
fs/jfs/jfs_dmap.c=2164=static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
--
fs/jfs/jfs_dmap.c-2194-		if (dp->tree.stree[word] == NOFREE)
fs/jfs/jfs_dmap.c:2195:			dbBackSplit((dmtree_t *)&dp->tree, word, false);
fs/jfs/jfs_dmap.c-2196-
--
fs/jfs/jfs_dmap.c=2226=static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
--
fs/jfs/jfs_dmap.c-2229-	int dbitno, word, rembits, nb, nwords, wbitno, nw, agno;
fs/jfs/jfs_dmap.c:2230:	dmtree_t *tp = (dmtree_t *) & dp->tree;
fs/jfs/jfs_dmap.c-2231-	int size;
--
fs/jfs/jfs_dmap.c=2373=static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
--
fs/jfs/jfs_dmap.c-2376-	int dbitno, word, rembits, nb, nwords, wbitno, nw, agno;
fs/jfs/jfs_dmap.c:2377:	dmtree_t *tp = (dmtree_t *) & dp->tree;
fs/jfs/jfs_dmap.c-2378-	int rc = 0;
--
fs/jfs/jfs_dmap.c=2557=dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
--
fs/jfs/jfs_dmap.c-2612-		if (oldval == NOFREE) {
fs/jfs/jfs_dmap.c:2613:			rc = dbBackSplit((dmtree_t *)dcp, leafno, true);
fs/jfs/jfs_dmap.c-2614-			if (rc) {
--
fs/jfs/jfs_dmap.c-2619-		}
fs/jfs/jfs_dmap.c:2620:		dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval, true);
fs/jfs/jfs_dmap.c-2621-	} else {
fs/jfs/jfs_dmap.c:2622:		rc = dbJoin((dmtree_t *) dcp, leafno, newval, true);
fs/jfs/jfs_dmap.c-2623-		if (rc) {
--
fs/jfs/jfs_dmap.c-2651-				if (alloc) {
fs/jfs/jfs_dmap.c:2652:					dbJoin((dmtree_t *) dcp, leafno,
fs/jfs/jfs_dmap.c-2653-					       oldval, true);
--
fs/jfs/jfs_dmap.c-2661-					if (dcp->stree[ti] == NOFREE)
fs/jfs/jfs_dmap.c:2662:						dbBackSplit((dmtree_t *)
fs/jfs/jfs_dmap.c-2663-							    dcp, leafno, true);
fs/jfs/jfs_dmap.c:2664:					dbSplit((dmtree_t *) dcp, leafno,
fs/jfs/jfs_dmap.c-2665-						dcp->budmin, oldval, true);
--
fs/jfs/jfs_dmap.c-2712- */
fs/jfs/jfs_dmap.c:2713:static void dbSplit(dmtree_t *tp, int leafno, int splitsz, int newval, bool is_ctl)
fs/jfs/jfs_dmap.c-2714-{
--
fs/jfs/jfs_dmap.c-2777- */
fs/jfs/jfs_dmap.c:2778:static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl)
fs/jfs/jfs_dmap.c-2779-{
--
fs/jfs/jfs_dmap.c-2856- */
fs/jfs/jfs_dmap.c:2857:static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl)
fs/jfs/jfs_dmap.c-2858-{
--
fs/jfs/jfs_dmap.c-2950- */
fs/jfs/jfs_dmap.c:2951:static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl)
fs/jfs/jfs_dmap.c-2952-{
--
fs/jfs/jfs_dmap.c-3013- *
fs/jfs/jfs_dmap.c:3014: * FUNCTION:	search a dmtree_t for sufficient free blocks, returning
fs/jfs/jfs_dmap.c-3015- *		the index of a leaf describing the free blocks if
--
fs/jfs/jfs_dmap.c-3017- *
fs/jfs/jfs_dmap.c:3018: *		the search starts at the top of the dmtree_t tree and
fs/jfs/jfs_dmap.c-3019- *		proceeds down the tree to the leftmost leaf with sufficient
--
fs/jfs/jfs_dmap.c-3033- */
fs/jfs/jfs_dmap.c:3034:static int dbFindLeaf(dmtree_t *tp, int l2nb, int *leafidx, bool is_ctl)
fs/jfs/jfs_dmap.c-3035-{
--
fs/jfs/jfs_dmap.h=175=typedef union dmtree {
--
fs/jfs/jfs_dmap.h-177-	struct dmapctl t2;
fs/jfs/jfs_dmap.h:178:} dmtree_t;
fs/jfs/jfs_dmap.h-179-
]

20/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 19863
							output: 40
							thoughts: 32
						

Thoughts:
Okay, here's my attempt at summarizing that thought process, tailored for an expert audience:

**Diving into the JFS Data Map Definition**

Alright, so I need to understand how the JFS filesystem handles its data maps, specifically the `dmtree_t` structure. My instinct is always to go straight to the source. The header file I need, according to my mental map of the Linux kernel, is in `fs/jfs/jfs_dmap.h`. Time to pull that up and see what we're dealing with. Let's get a look at the actual definition.



21/2 2026/06/30 14:36 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.h FirstLine:150 LineCount:50]

Results:
map[Contents: 150:		__le64 start;		/* 8: starting blkno for this dmap	*/
 151:		struct dmaptree tree;	/* 360: dmap tree			*/
 152:		u8 pad[1672];		/* 1672: pad to 2048 bytes		*/
 153:		__le32 wmap[LPERDMAP];	/* 1024: bits of the working map	*/
 154:		__le32 pmap[LPERDMAP];	/* 1024: bits of the persistent map	*/
 155:	};				/* - 4096 -				*/
 156:	
 157:	/*
 158:	 *	disk map control page per level.
 159:	 *
 160:	 * dmapctl must be consistent with dmaptree.
 161:	 */
 162:	struct dmapctl {
 163:		__le32 nleafs;		/* 4: number of tree leafs	*/
 164:		__le32 l2nleafs;	/* 4: l2 number of tree leafs	*/
 165:		__le32 leafidx;		/* 4: index of the first tree leaf	*/
 166:		__le32 height;		/* 4: height of tree		*/
 167:		s8 budmin;		/* 1: minimum l2 tree leaf value	*/
 168:		s8 stree[CTLTREESIZE];	/* CTLTREESIZE: dmapctl tree	*/
 169:		u8 pad[2714];		/* 2714: pad to 4096		*/
 170:	};				/* - 4096 -			*/
 171:	
 172:	/*
 173:	 *	common definition for dmaptree within dmap and dmapctl
 174:	 */
 175:	typedef union dmtree {
 176:		struct dmaptree t1;
 177:		struct dmapctl t2;
 178:	} dmtree_t;
 179:	
 180:	/* macros for accessing fields within dmtree */
 181:	#define	dmt_nleafs	t1.nleafs
 182:	#define	dmt_l2nleafs	t1.l2nleafs
 183:	#define	dmt_leafidx	t1.leafidx
 184:	#define	dmt_height	t1.height
 185:	#define	dmt_budmin	t1.budmin
 186:	#define	dmt_stree	t2.stree
 187:	
 188:	/*
 189:	 *	on-disk aggregate disk allocation map descriptor.
 190:	 */
 191:	struct dbmap_disk {
 192:		__le64 dn_mapsize;	/* 8: number of blocks in aggregate	*/
 193:		__le64 dn_nfree;	/* 8: num free blks in aggregate map	*/
 194:		__le32 dn_l2nbperpage;	/* 4: number of blks per page		*/
 195:		__le32 dn_numag;	/* 4: total number of ags		*/
 196:		__le32 dn_maxlevel;	/* 4: number of active ags		*/
 197:		__le32 dn_maxag;	/* 4: max active alloc group number	*/
 198:		__le32 dn_agpref;	/* 4: preferred alloc group (hint)	*/
 199:		__le32 dn_aglevel;	/* 4: dmapctl level holding the AG	*/
]

22/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 21086
							output: 40
							thoughts: 54
						

Thoughts:
Here's my thought process, as if I were analyzing this code:

**Deconstructing Data Structures: A Deep Dive**

Okay, so I'm looking at this code and immediately see a variable, `dmt_leafidx`, and it's being assigned the value of `t1.leafidx`. Right away, I'm thinking, "Okay, we're talking about a leaf index, but where is this coming from?" Then, I remember I need to clarify what these variables represent within the bigger picture, so I remind myself that `t1` is a `struct dmaptree` and `t2` is a `struct dmapctl`. This makes my job easier because I have my bearings now. To fully understand what's happening, I need to look up the definition of `struct dmaptree`. I need to fully understand what each variable actually *is*. Let's get that definition and move forward.



23/2 2026/06/30 14:36 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.h FirstLine:120 LineCount:30]

Results:
map[Contents: 120:	 */
 121:	#define BLKTOAG(b,sbi)	((b) >> ((sbi)->bmap->db_agl2size))
 122:	
 123:	/* convert allocation group number to starting disk block
 124:	 * number.
 125:	 */
 126:	#define AGTOBLK(a,ip)	\
 127:		((s64)(a) << (JFS_SBI((ip)->i_sb)->bmap->db_agl2size))
 128:	
 129:	/*
 130:	 *	dmap summary tree
 131:	 *
 132:	 * dmaptree must be consistent with dmapctl.
 133:	 */
 134:	struct dmaptree {
 135:		__le32 nleafs;		/* 4: number of tree leafs	*/
 136:		__le32 l2nleafs;	/* 4: l2 number of tree leafs	*/
 137:		__le32 leafidx;		/* 4: index of first tree leaf	*/
 138:		__le32 height;		/* 4: height of the tree	*/
 139:		s8 budmin;		/* 1: min l2 tree leaf value to combine */
 140:		s8 stree[TREESIZE];	/* TREESIZE: tree		*/
 141:		u8 pad[2];		/* 2: pad to word boundary	*/
 142:	};				/* - 360 -			*/
 143:	
 144:	/*
 145:	 *	dmap page per 8K blocks bitmap
 146:	 */
 147:	struct dmap {
 148:		__le32 nblocks;		/* 4: num blks covered by this dmap	*/
 149:		__le32 nfree;		/* 4: num of free blks in this dmap	*/
]

24/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 21916
							output: 31
							thoughts: 14
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Investigating TREESIZE**

Okay, so `TREESIZE`... what exactly are we talking about here? It's not immediately obvious from the term itself. I need to unpack this. Is it referring to the *physical* size of a tree data structure in memory? Or is it a measure of the number of nodes, height, or perhaps the overall data volume contained within the tree? The specific context is missing, and that will dramatically shape how to interpret and act on it. My initial reflex is to quickly consider the different ways this could be defined. Depending on the type of tree (binary, n-ary, balanced, etc.) and what data it's holding, the precise meaning of `TREESIZE` will need to be pinned down before any meaningful analysis can be done. I'll need to dig deeper for that clarity.



25/2 2026/06/30 14:36 tool grepper
0m Args:
map[Expression:#define.*TREESIZE PathPrefix:fs/jfs/]

Results:
map[Output:fs/jfs/jfs_dmap.h-10-#define BMAPVERSION	1	/* version number */
fs/jfs/jfs_dmap.h:11:#define	TREESIZE	(256+64+16+4+1)	/* size of a dmap tree */
fs/jfs/jfs_dmap.h-12-#define	LEAFIND		(64+16+4+1)	/* index of 1st leaf of a dmap tree */
--
fs/jfs/jfs_dmap.h-19-#define L2BPERDMAP	13	/* l2 num of blks per dmap */
fs/jfs/jfs_dmap.h:20:#define CTLTREESIZE	(1024+256+64+16+4+1)	/* size of a dmapctl tree */
fs/jfs/jfs_dmap.h-21-#define CTLLEAFIND	(256+64+16+4+1)	/* idx of 1st leaf of a dmapctl tree */
]

26/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 22438
							output: 41
							thoughts: 217
						

Thoughts:
**Analyzing a JFS Crash**

Okay, so I'm looking at this crash report, and the core of it seems to be an out-of-bounds access. The error message is screaming: "index 4294967295 is out of range for type 's8[1365]'".  Right away, I recognize that `4294967295` is the same as `-1` when interpreted as a signed 32-bit integer, which is what `le32_to_cpu()` is likely doing.  That’s my first red flag: a negative index accessing an array!

The code context gives me some critical information. `TREESIZE` is `341`, and `CTLTREESIZE` is `1365`.  `dmt_stree` is my array `s8[CTLTREESIZE]`, named `s8 stree[1365]`, and it's being used by `t2.stree`. Then `dmt_leafidx`, which holds the problematic index, is effectively `t1.leafidx`, which is offset in memory in a similar way to `t2.leafidx`.  I need to figure out how this `dmt_leafidx` is getting set to -1.

Aha, the syzkaller reproducer... it mounts a corrupted JFS image.  That's my critical clue. This value is read from disk. The corruption must be the root cause. This confirms my hypothesis. I need to trace this variable's initialization and any validation that might happen. Where exactly is `dmt_leafidx` being validated?  That's where I need to focus my attention to determine if this can be a more widespread issue.



27/2 2026/06/30 14:36 tool codesearch-find-references
0m Error:
log-in to see details

Args:
map[IncludeSnippetLines:0 Name:dmt_leafidx SourceTreePrefix:fs/jfs/]

Results:
map[References:<nil> TruncatedOutput:false]

28/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 23104
							output: 30
							thoughts: 20
						

Thoughts:
Here's my take on those thoughts, assuming I'm an expert:

**Investigating a Macro: `dmt_leafidx`**

Okay, so `dmt_leafidx`... looks like it's a macro. Right away, my brain jumps to "grep." I need to see where this is defined and, more importantly, *used* within the codebase. I need context. Grepping will give me a quick and dirty way to trace its definition and all the calls to it. From there, I can get a much better feel for what it's doing. Probably some index calculation, but let's see where it fits into the broader picture. Let's get to work!



29/2 2026/06/30 14:36 tool grepper
0m Args:
map[Expression:dmt_leafidx PathPrefix:fs/jfs/]

Results:
map[Output:fs/jfs/jfs_dmap.c=2713=static void dbSplit(dmtree_t *tp, int leafno, int splitsz, int newval, bool is_ctl)
--
fs/jfs/jfs_dmap.c-2716-	int cursz;
fs/jfs/jfs_dmap.c:2717:	s8 *leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
fs/jfs/jfs_dmap.c-2718-
--
fs/jfs/jfs_dmap.c=2778=static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl)
--
fs/jfs/jfs_dmap.c-2781-	int cursz;
fs/jfs/jfs_dmap.c:2782:	s8 *leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
fs/jfs/jfs_dmap.c-2783-
--
fs/jfs/jfs_dmap.c=2857=static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl)
--
fs/jfs/jfs_dmap.c-2866-		 */
fs/jfs/jfs_dmap.c:2867:		leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
fs/jfs/jfs_dmap.c-2868-
--
fs/jfs/jfs_dmap.c=2951=static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl)
--
fs/jfs/jfs_dmap.c-2959-	 */
fs/jfs/jfs_dmap.c:2960:	lp = leafno + le32_to_cpu(tp->dmt_leafidx);
fs/jfs/jfs_dmap.c-2961-
--
fs/jfs/jfs_dmap.c=3034=static int dbFindLeaf(dmtree_t *tp, int l2nb, int *leafidx, bool is_ctl)
--
fs/jfs/jfs_dmap.c-3071-	}
fs/jfs/jfs_dmap.c:3072:	if (le32_to_cpu(tp->dmt_leafidx) >= max_idx)
fs/jfs/jfs_dmap.c-3073-		return -ENOSPC;
--
fs/jfs/jfs_dmap.c-3077-	 */
fs/jfs/jfs_dmap.c:3078:	*leafidx = x + n - le32_to_cpu(tp->dmt_leafidx);
fs/jfs/jfs_dmap.c-3079-
--
fs/jfs/jfs_dmap.h=175=typedef union dmtree {
--
fs/jfs/jfs_dmap.h-182-#define	dmt_l2nleafs	t1.l2nleafs
fs/jfs/jfs_dmap.h:183:#define	dmt_leafidx	t1.leafidx
fs/jfs/jfs_dmap.h-184-#define	dmt_height	t1.height
]

30/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 24215
							output: 30
							thoughts: 68
						

Thoughts:
**Analyzing `dbFindLeaf` and Leaf Index Validation**

Okay, let's dive into this. My initial focus is on `dbFindLeaf` and, specifically, how the `dmt_leafidx` is validated within its execution. A crucial point is that this `dmt_leafidx` value is, as I recall, read directly from the disk. This raises an immediate red flag: Is there any validation happening *at the point* the `dmap` or `dmapctl` structures are read from the disk? This is a critical security consideration, as unvalidated data from disk could easily lead to exploits. Therefore, my immediate next step is to trace the read operation for `dmap` itself. Understanding the point of read is crucial. The goal is to pinpoint the exact moment any potential validation might or might not be happening.



31/2 2026/06/30 14:36 tool grepper
0m Args:
map[Expression:read_metapage PathPrefix:fs/jfs/]

Results:
map[Output:fs/jfs/jfs_btree.h=17=struct btpage {
--
fs/jfs/jfs_btree.h-63-	{\
fs/jfs/jfs_btree.h:64:		MP = read_metapage((IP), BN, SIZE, 1);\
fs/jfs/jfs_btree.h-65-		if (MP) {\
--
fs/jfs/jfs_dmap.c=240=int dbMount(struct inode *ipbmap)
--
fs/jfs/jfs_dmap.c-255-	/* read the on-disk bmap descriptor. */
fs/jfs/jfs_dmap.c:256:	mp = read_metapage(ipbmap,
fs/jfs/jfs_dmap.c-257-			   BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
--
fs/jfs/jfs_dmap.c=363=int dbSync(struct inode *ipbmap)
--
fs/jfs/jfs_dmap.c-373-	/* get the buffer for the on-disk bmap descriptor. */
fs/jfs/jfs_dmap.c:374:	mp = read_metapage(ipbmap,
fs/jfs/jfs_dmap.c-375-			   BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
--
fs/jfs/jfs_dmap.c-377-	if (mp == NULL) {
fs/jfs/jfs_dmap.c:378:		jfs_err("dbSync: read_metapage failed!");
fs/jfs/jfs_dmap.c-379-		return -EIO;
--
fs/jfs/jfs_dmap.c=431=int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
--
fs/jfs/jfs_dmap.c-471-		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
fs/jfs/jfs_dmap.c:472:		mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
fs/jfs/jfs_dmap.c-473-		if (mp == NULL) {
--
fs/jfs/jfs_dmap.c=525=dbUpdatePMap(struct inode *ipbmap,
--
fs/jfs/jfs_dmap.c-565-
fs/jfs/jfs_dmap.c:566:			mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE,
fs/jfs/jfs_dmap.c-567-					   0);
--
fs/jfs/jfs_dmap.c=801=int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
--
fs/jfs/jfs_dmap.c-882-		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
fs/jfs/jfs_dmap.c:883:		mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
fs/jfs/jfs_dmap.c-884-		if (mp == NULL)
--
fs/jfs/jfs_dmap.c=1059=static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
--
fs/jfs/jfs_dmap.c-1112-	lblkno = BLKTODMAP(extblkno, bmp->db_l2nbperpage);
fs/jfs/jfs_dmap.c:1113:	mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
fs/jfs/jfs_dmap.c-1114-	if (mp == NULL) {
--
fs/jfs/jfs_dmap.c=1399=dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
--
fs/jfs/jfs_dmap.c-1455-	lblkno = BLKTOCTL(blkno, bmp->db_l2nbperpage, bmp->db_aglevel);
fs/jfs/jfs_dmap.c:1456:	mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
fs/jfs/jfs_dmap.c-1457-	if (mp == NULL)
--
fs/jfs/jfs_dmap.c=1768=static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
--
fs/jfs/jfs_dmap.c-1785-		lblkno = BLKTOCTL(b, bmp->db_l2nbperpage, lev);
fs/jfs/jfs_dmap.c:1786:		mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
fs/jfs/jfs_dmap.c-1787-		if (mp == NULL)
--
fs/jfs/jfs_dmap.c=1887=dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
--
fs/jfs/jfs_dmap.c-1899-		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
fs/jfs/jfs_dmap.c:1900:		mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
fs/jfs/jfs_dmap.c-1901-		if (mp == NULL)
--
fs/jfs/jfs_dmap.c-1931-		lblkno = BLKTODMAP(b, bmp->db_l2nbperpage);
fs/jfs/jfs_dmap.c:1932:		mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
fs/jfs/jfs_dmap.c-1933-		if (mp == NULL) {
--
fs/jfs/jfs_dmap.c-1984-		lblkno = BLKTODMAP(b, bmp->db_l2nbperpage);
fs/jfs/jfs_dmap.c:1985:		mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
fs/jfs/jfs_dmap.c-1986-		if (mp == NULL) {
--
fs/jfs/jfs_dmap.c=2557=dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
--
fs/jfs/jfs_dmap.c-2569-	lblkno = BLKTOCTL(blkno, bmp->db_l2nbperpage, level);
fs/jfs/jfs_dmap.c:2570:	mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
fs/jfs/jfs_dmap.c-2571-	if (mp == NULL)
--
fs/jfs/jfs_dmap.c=3278=int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks)
--
fs/jfs/jfs_dmap.c-3303-		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
fs/jfs/jfs_dmap.c:3304:		mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
fs/jfs/jfs_dmap.c-3305-		if (mp == NULL) {
--
fs/jfs/jfs_dmap.c=3454=int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
--
fs/jfs/jfs_dmap.c-3537-	p = BMAPBLKNO + nbperpage;	/* L2 page */
fs/jfs/jfs_dmap.c:3538:	l2mp = read_metapage(ipbmap, p, PSIZE, 0);
fs/jfs/jfs_dmap.c-3539-	if (!l2mp) {
--
fs/jfs/jfs_dmap.c-3561-			/* read in L1 page: (blkno & (MAXL1SIZE - 1)) */
fs/jfs/jfs_dmap.c:3562:			l1mp = read_metapage(ipbmap, p, PSIZE, 0);
fs/jfs/jfs_dmap.c-3563-			if (l1mp == NULL)
--
fs/jfs/jfs_dmap.c-3601-
fs/jfs/jfs_dmap.c:3602:				l0mp = read_metapage(ipbmap, p, PSIZE, 0);
fs/jfs/jfs_dmap.c-3603-				if (l0mp == NULL)
--
fs/jfs/jfs_dmap.c-3645-					/* read in dmap page: */
fs/jfs/jfs_dmap.c:3646:					mp = read_metapage(ipbmap, p,
fs/jfs/jfs_dmap.c-3647-							   PSIZE, 0);
--
fs/jfs/jfs_dmap.c-3652-					/* assign/init dmap page */
fs/jfs/jfs_dmap.c:3653:					mp = read_metapage(ipbmap, p,
fs/jfs/jfs_dmap.c-3654-							   PSIZE, 0);
--
fs/jfs/jfs_dtree.c=193=static struct metapage *read_index_page(struct inode *inode, s64 blkno)
--
fs/jfs/jfs_dtree.c-203-
fs/jfs/jfs_dtree.c:204:	return read_metapage(inode, xaddr, PSIZE, 1);
fs/jfs/jfs_dtree.c-205-}
--
fs/jfs/jfs_dtree.c=319=static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
--
fs/jfs/jfs_dtree.c-451-	if (!mp) {
fs/jfs/jfs_dtree.c:452:		jfs_err("add_index: get/read_metapage failed!");
fs/jfs/jfs_dtree.c-453-		goto clean_up;
--
fs/jfs/jfs_imap.c=94=int diMount(struct inode *ipimap)
--
fs/jfs/jfs_imap.c-110-
fs/jfs/jfs_imap.c:111:	mp = read_metapage(ipimap,
fs/jfs/jfs_imap.c-112-			   IMAPBLKNO << JFS_SBI(ipimap->i_sb)->l2nbperpage,
--
fs/jfs/jfs_imap.c=290=int diRead(struct inode *ip)
--
fs/jfs/jfs_imap.c-366-	/* read the page of disk inode */
fs/jfs/jfs_imap.c:367:	mp = read_metapage(ipimap, pageno << sbi->l2nbperpage, PSIZE, 1);
fs/jfs/jfs_imap.c-368-	if (!mp) {
fs/jfs/jfs_imap.c:369:		jfs_err("diRead: read_metapage failed");
fs/jfs/jfs_imap.c-370-		return -EIO;
--
fs/jfs/jfs_imap.c=418=struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary)
--
fs/jfs/jfs_imap.c-446-	/* read the page of fixed disk inode (AIT) in raw mode */
fs/jfs/jfs_imap.c:447:	mp = read_metapage(ip, address << sbi->l2nbperpage, PSIZE, 1);
fs/jfs/jfs_imap.c-448-	if (mp == NULL) {
--
fs/jfs/jfs_imap.c=500=void diWriteSpecial(struct inode *ip, int secondary)
--
fs/jfs/jfs_imap.c-517-	/* read the page of fixed disk inode (AIT) in raw mode */
fs/jfs/jfs_imap.c:518:	mp = read_metapage(ip, address << sbi->l2nbperpage, PSIZE, 1);
fs/jfs/jfs_imap.c-519-	if (mp == NULL) {
--
fs/jfs/jfs_imap.c=581=int diWrite(tid_t tid, struct inode *ip)
--
fs/jfs/jfs_imap.c-638-      retry:
fs/jfs/jfs_imap.c:639:	mp = read_metapage(ipimap, pageno << sbi->l2nbperpage, PSIZE, 1);
fs/jfs/jfs_imap.c-640-	if (!mp)
--
fs/jfs/jfs_imap.c=2663=static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp)
--
fs/jfs/jfs_imap.c-2671-	/* read the iag. */
fs/jfs/jfs_imap.c:2672:	*mpp = read_metapage(ipimap, blkno, PSIZE, 0);
fs/jfs/jfs_imap.c-2673-	if (*mpp == NULL) {
--
fs/jfs/jfs_metapage.h=50=extern struct metapage *__get_metapage(struct inode *inode,
--
fs/jfs/jfs_metapage.h-53-
fs/jfs/jfs_metapage.h:54:#define read_metapage(inode, lblock, size, absolute)\
fs/jfs/jfs_metapage.h-55-	 __get_metapage(inode, lblock, size, absolute, false)
--
fs/jfs/xattr.c=351=static int ea_read(struct inode *ip, struct jfs_ea_list *ealist)
--
fs/jfs/xattr.c-395-
fs/jfs/xattr.c:396:		if (!(mp = read_metapage(ip, blkno + i, bytes_to_read, 1)))
fs/jfs/xattr.c-397-			return -EIO;
--
fs/jfs/xattr.c=426=static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
--
fs/jfs/xattr.c-548-	ea_buf->flag = EA_EXTENT;
fs/jfs/xattr.c:549:	ea_buf->mp = read_metapage(inode, addressDXD(&ji->ea),
fs/jfs/xattr.c-550-				   lengthDXD(&ji->ea) << sb->s_blocksize_bits,
]

32/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 28660
							output: 40
							thoughts: 20
						

Thoughts:
Here's my thought process, summarized as if I were considering this issue:

**Checking `dbMount`'s Validation of `dmt_leafidx`**

Okay, so I'm looking at this code and I need to make sure that the `dbMount` function is properly validating the `dmt_leafidx` value. This is critical. A flaw here could lead to some pretty nasty data corruption or, worse, security vulnerabilities. I need to understand if `dbMount` is doing the right checks to ensure that `dmt_leafidx` is within acceptable bounds, and that it's handling potential edge cases or malformed inputs correctly. I need to consider exactly what types of validation are *necessary* in this specific context. Is a simple range check enough? Or does it need something more sophisticated like a check against a lookup table or some other form of authorization? I need to think about potential attack vectors and if this validation step is robust enough to prevent them. Let's dig into the code and see exactly what's happening.



33/2 2026/06/30 14:36 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:240 LineCount:50]

Results:
map[Contents: 240:	int dbMount(struct inode *ipbmap)
 241:	{
 242:		struct bmap *bmp;
 243:		struct dbmap_disk *dbmp_le;
 244:		struct metapage *mp;
 245:		int i, err;
 246:	
 247:		/*
 248:		 * allocate/initialize the in-memory bmap descriptor
 249:		 */
 250:		/* allocate memory for the in-memory bmap descriptor */
 251:		bmp = kmalloc_obj(struct bmap);
 252:		if (bmp == NULL)
 253:			return -ENOMEM;
 254:	
 255:		/* read the on-disk bmap descriptor. */
 256:		mp = read_metapage(ipbmap,
 257:				   BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
 258:				   PSIZE, 0);
 259:		if (mp == NULL) {
 260:			err = -EIO;
 261:			goto err_kfree_bmp;
 262:		}
 263:	
 264:		/* copy the on-disk bmap descriptor to its in-memory version. */
 265:		dbmp_le = (struct dbmap_disk *) mp->data;
 266:		bmp->db_mapsize = le64_to_cpu(dbmp_le->dn_mapsize);
 267:		bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree);
 268:		bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage);
 269:		bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag);
 270:		bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel);
 271:		bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag);
 272:		bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref);
 273:		bmp->db_aglevel = le32_to_cpu(dbmp_le->dn_aglevel);
 274:		bmp->db_agheight = le32_to_cpu(dbmp_le->dn_agheight);
 275:		bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth);
 276:		bmp->db_agstart = le32_to_cpu(dbmp_le->dn_agstart);
 277:		bmp->db_agl2size = le32_to_cpu(dbmp_le->dn_agl2size);
 278:	
 279:		if ((bmp->db_l2nbperpage > L2PSIZE - L2MINBLOCKSIZE) ||
 280:		    (bmp->db_l2nbperpage < 0) ||
 281:		    !bmp->db_numag || (bmp->db_numag > MAXAG) ||
 282:		    (bmp->db_maxag >= MAXAG) || (bmp->db_maxag < 0) ||
 283:		    (bmp->db_agpref >= MAXAG) || (bmp->db_agpref < 0) ||
 284:		    (bmp->db_agheight < 0) || (bmp->db_agheight > (L2LPERCTL >> 1)) ||
 285:		    (bmp->db_agwidth < 1) || (bmp->db_agwidth > (LPERCTL / MAXAG)) ||
 286:		    (bmp->db_agwidth > (1 << (L2LPERCTL - (bmp->db_agheight << 1)))) ||
 287:		    (bmp->db_agstart < 0) ||
 288:		    (bmp->db_agstart > (CTLTREESIZE - 1 - bmp->db_agwidth * (MAXAG - 1))) ||
 289:		    (bmp->db_agl2size > L2MAXL2SIZE - L2MAXAG) ||
]

34/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 30083
							output: 41
							thoughts: 73
						

Thoughts:
**Analyzing Database Memory Allocation**

Okay, so `dbMount` is only concerned with reading `dbmap_disk`. That's important to keep in mind. It's skipping over `dmap` and `dmapctl` – a detail that definitely merits further investigation. My question now is, where *does* `dmap` get read? I know it's crucial for the allocation process, so it has to be somewhere within the relevant code.

A quick mental scan suggests I'll find it in routines such as `dbFreeBits`, `dbFreeDmap`, or `dbAllocBits`. Let's target `dbFreeDmap` for a closer look since it's showing up in the current stack trace. That seems like the most logical first step to understanding the read operations performed on `dmap`.



35/2 2026/06/30 14:36 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2164 LineCount:50]

Results:
map[Contents:2164:	static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2165:			      int nblocks)
2166:	{
2167:		s8 oldroot;
2168:		int rc = 0, word;
2169:	
2170:		/* save the current value of the root (i.e. maximum free string)
2171:		 * of the dmap tree.
2172:		 */
2173:		oldroot = dp->tree.stree[ROOT];
2174:	
2175:		/* free the specified (blocks) bits */
2176:		rc = dbFreeBits(bmp, dp, blkno, nblocks);
2177:	
2178:		/* if error or the root has not changed, done. */
2179:		if (rc || (dp->tree.stree[ROOT] == oldroot))
2180:			return (rc);
2181:	
2182:		/* root changed. bubble the change up to the dmap control pages.
2183:		 * if the adjustment of the upper level control pages fails,
2184:		 * backout the deallocation.
2185:		 */
2186:		if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 0, 0))) {
2187:			word = (blkno & (BPERDMAP - 1)) >> L2DBWORD;
2188:	
2189:			/* as part of backing out the deallocation, we will have
2190:			 * to back split the dmap tree if the deallocation caused
2191:			 * the freed blocks to become part of a larger binary buddy
2192:			 * system.
2193:			 */
2194:			if (dp->tree.stree[word] == NOFREE)
2195:				dbBackSplit((dmtree_t *)&dp->tree, word, false);
2196:	
2197:			dbAllocBits(bmp, dp, blkno, nblocks);
2198:		}
2199:	
2200:		return (rc);
2201:	}
2202:	
2203:	
2204:	/*
2205:	 * NAME:	dbAllocBits()
2206:	 *
2207:	 * FUNCTION:	allocate a specified block range from a dmap.
2208:	 *
2209:	 *		this routine updates the dmap to reflect the working
2210:	 *		state allocation of the specified block range. it directly
2211:	 *		updates the bits of the working map and causes the adjustment
2212:	 *		of the binary buddy system described by the dmap's dmtree
2213:	 *		leaves to reflect the bits allocated.  it also causes the
]

36/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 31153
							output: 41
							thoughts: 21
						

Thoughts:
Here's my take on those thoughts, tailored for an expert audience:

**Investigating the Memory Deallocation Pathway**

Okay, so `dbFreeDmap` is directly invoked by `dbFree`. That's a good starting point. My immediate thought is, let's take a closer look at `dbFree` itself. We need to understand the control flow, the data structures it's manipulating, and how it interacts with the underlying memory management system, and of course, where it is called from. Understanding `dbFree` is key to understanding what `dbFreeDmap` does. I need to be sure that `dbFree` behaves as expected, before I consider that `dbFreeDmap` is doing something unexpectedly.



37/2 2026/06/30 14:36 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:431 LineCount:100]

Results:
map[Contents: 431:	int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
 432:	{
 433:		struct metapage *mp;
 434:		struct dmap *dp;
 435:		int nb, rc;
 436:		s64 lblkno, rem;
 437:		struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
 438:		struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
 439:		struct super_block *sb = ipbmap->i_sb;
 440:	
 441:		IREAD_LOCK(ipbmap, RDWRLOCK_DMAP);
 442:	
 443:		/* block to be freed better be within the mapsize. */
 444:		if (unlikely((blkno == 0) || (blkno + nblocks > bmp->db_mapsize))) {
 445:			IREAD_UNLOCK(ipbmap);
 446:			printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
 447:			       (unsigned long long) blkno,
 448:			       (unsigned long long) nblocks);
 449:			jfs_error(ip->i_sb, "block to be freed is outside the map\n");
 450:			return -EIO;
 451:		}
 452:	
 453:		/**
 454:		 * TRIM the blocks, when mounted with discard option
 455:		 */
 456:		if (JFS_SBI(sb)->flag & JFS_DISCARD)
 457:			if (JFS_SBI(sb)->minblks_trim <= nblocks)
 458:				jfs_issue_discard(ipbmap, blkno, nblocks);
 459:	
 460:		/*
 461:		 * free the blocks a dmap at a time.
 462:		 */
 463:		mp = NULL;
 464:		for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) {
 465:			/* release previous dmap if any */
 466:			if (mp) {
 467:				write_metapage(mp);
 468:			}
 469:	
 470:			/* get the buffer for the current dmap. */
 471:			lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 472:			mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
 473:			if (mp == NULL) {
 474:				IREAD_UNLOCK(ipbmap);
 475:				return -EIO;
 476:			}
 477:			dp = (struct dmap *) mp->data;
 478:	
 479:			/* determine the number of blocks to be freed from
 480:			 * this dmap.
 481:			 */
 482:			nb = min(rem, BPERDMAP - (blkno & (BPERDMAP - 1)));
 483:	
 484:			/* free the blocks. */
 485:			if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) {
 486:				jfs_error(ip->i_sb, "error in block map\n");
 487:				release_metapage(mp);
 488:				IREAD_UNLOCK(ipbmap);
 489:				return (rc);
 490:			}
 491:		}
 492:	
 493:		/* write the last buffer. */
 494:		if (mp)
 495:			write_metapage(mp);
 496:	
 497:		IREAD_UNLOCK(ipbmap);
 498:	
 499:		return (0);
 500:	}
 501:	
 502:	
 503:	/*
 504:	 * NAME:	dbUpdatePMap()
 505:	 *
 506:	 * FUNCTION:	update the allocation state (free or allocate) of the
 507:	 *		specified block range in the persistent block allocation map.
 508:	 *
 509:	 *		the blocks will be updated in the persistent map one
 510:	 *		dmap at a time.
 511:	 *
 512:	 * PARAMETERS:
 513:	 *	ipbmap	- pointer to in-core inode for the block map.
 514:	 *	free	- 'true' if block range is to be freed from the persistent
 515:	 *		  map; 'false' if it is to be allocated.
 516:	 *	blkno	- starting block number of the range.
 517:	 *	nblocks	- number of contiguous blocks in the range.
 518:	 *	tblk	- transaction block;
 519:	 *
 520:	 * RETURN VALUES:
 521:	 *	0	- success
 522:	 *	-EIO	- i/o error
 523:	 */
 524:	int
 525:	dbUpdatePMap(struct inode *ipbmap,
 526:		     int free, s64 blkno, s64 nblocks, struct tblock * tblk)
 527:	{
 528:		int nblks, dbitno, wbitno, rbits;
 529:		int word, nbits, nwords;
 530:		struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
]

38/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 32938
							output: 42
							thoughts: 111
						

Thoughts:
**Analyzing the dbFree Function and Potential Vulnerabilities**

Okay, so I'm looking at this `dbFree` function, and it seems like the first thing it does is read a metapage. That metapage contains a `struct dmap`, and then it calls `dbFreeDmap` on that structure. Inside the `dmap` is a `struct dmaptree tree` which is essentially the `t1` member of a `dmtree_t`. The code then pulls out `t1.leafidx`, which, from what I can see, is assigned the value of `dp->tree.leafidx`.

My immediate concern is: is `dp->tree.leafidx` being validated *anywhere* after it's read from the metapage? This is a critical point. If it's not, we could potentially have a vulnerability. A malicious actor could potentially manipulate the contents of the metapage, and thus, `dp->tree.leafidx`, leading to unintended consequences down the line.

Therefore, my next step is to carefully examine the `read_metapage` and `__get_metapage` functions. I need to understand exactly how the metapage is read, what checks are performed, and, most importantly, if any checks are done to validate this `leafidx` value before it gets used elsewhere. This is where I'll likely find the crux of the matter.



39/2 2026/06/30 14:36 tool read-file
0m Args:
map[File:fs/jfs/jfs_metapage.c FirstLine:640 LineCount:100]

Results:
map[Contents: 640:	}
 641:	
 642:	#ifdef CONFIG_MIGRATION
 643:	/*
 644:	 * metapage_migrate_folio - Migration function for JFS metapages
 645:	 */
 646:	static int metapage_migrate_folio(struct address_space *mapping,
 647:					  struct folio *dst, struct folio *src,
 648:					  enum migrate_mode mode)
 649:	{
 650:		int expected_count;
 651:	
 652:		if (!src->private)
 653:			return filemap_migrate_folio(mapping, dst, src, mode);
 654:	
 655:		/* Check whether page does not have extra refs before we do more work */
 656:		expected_count = folio_expected_ref_count(src) + 1;
 657:		if (folio_ref_count(src) != expected_count)
 658:			return -EAGAIN;
 659:		return __metapage_migrate_folio(mapping, dst, src, mode);
 660:	}
 661:	#else
 662:	#define metapage_migrate_folio NULL
 663:	#endif	/* CONFIG_MIGRATION */
 664:	
 665:	static void metapage_invalidate_folio(struct folio *folio, size_t offset,
 666:					    size_t length)
 667:	{
 668:		BUG_ON(offset || length < folio_size(folio));
 669:	
 670:		BUG_ON(folio_test_writeback(folio));
 671:	
 672:		metapage_release_folio(folio, 0);
 673:	}
 674:	
 675:	const struct address_space_operations jfs_metapage_aops = {
 676:		.read_folio	= metapage_read_folio,
 677:		.writepages	= metapage_writepages,
 678:		.release_folio	= metapage_release_folio,
 679:		.invalidate_folio = metapage_invalidate_folio,
 680:		.dirty_folio	= filemap_dirty_folio,
 681:		.migrate_folio	= metapage_migrate_folio,
 682:	};
 683:	
 684:	struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
 685:					unsigned int size, int absolute,
 686:					unsigned long new)
 687:	{
 688:		int l2BlocksPerPage;
 689:		int l2bsize;
 690:		struct address_space *mapping;
 691:		struct metapage *mp = NULL;
 692:		struct folio *folio;
 693:		unsigned long page_index;
 694:		unsigned long page_offset;
 695:	
 696:		jfs_info("__get_metapage: ino = %llu, lblock = 0x%lx, abs=%d",
 697:			 inode->i_ino, lblock, absolute);
 698:	
 699:		l2bsize = inode->i_blkbits;
 700:		l2BlocksPerPage = PAGE_SHIFT - l2bsize;
 701:		page_index = lblock >> l2BlocksPerPage;
 702:		page_offset = (lblock - (page_index << l2BlocksPerPage)) << l2bsize;
 703:		if ((page_offset + size) > PAGE_SIZE) {
 704:			jfs_err("MetaData crosses page boundary!!");
 705:			jfs_err("lblock = %lx, size  = %d", lblock, size);
 706:			dump_stack();
 707:			return NULL;
 708:		}
 709:		if (absolute)
 710:			mapping = JFS_SBI(inode->i_sb)->direct_inode->i_mapping;
 711:		else {
 712:			/*
 713:			 * If an nfs client tries to read an inode that is larger
 714:			 * than any existing inodes, we may try to read past the
 715:			 * end of the inode map
 716:			 */
 717:			if ((lblock << inode->i_blkbits) >= inode->i_size)
 718:				return NULL;
 719:			mapping = inode->i_mapping;
 720:		}
 721:	
 722:		if (new && (PSIZE == PAGE_SIZE)) {
 723:			folio = filemap_grab_folio(mapping, page_index);
 724:			if (IS_ERR(folio)) {
 725:				jfs_err("filemap_grab_folio failed!");
 726:				return NULL;
 727:			}
 728:			folio_mark_uptodate(folio);
 729:		} else {
 730:			folio = read_mapping_folio(mapping, page_index, NULL);
 731:			if (IS_ERR(folio)) {
 732:				jfs_err("read_mapping_page failed!");
 733:				return NULL;
 734:			}
 735:			folio_lock(folio);
 736:		}
 737:	
 738:		mp = folio_to_mp(folio, page_offset);
 739:		if (mp) {
]

40/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 34906
							output: 31
							thoughts: 318
						

Thoughts:
**Vulnerability Deep Dive: Unvalidated Disk Reads**

Okay, so `__get_metapage` is clearly the culprit here. It's just blindly slurping the raw page content off disk, no checks whatsoever on `dmap` or `dmapctl` data. That's a huge red flag. Specifically, I'm zeroing in on `dp->tree.leafidx` – it's being read directly from disk and then *immediately* used without a sanity check. That's asking for trouble.

Looking at `dbJoin`, this is where things get interesting and where the rubber hits the road:

```c
		/* can the new leaf value require a join with other leaves ?
		 */
		if (newval >= tp->dmt_budmin) {
			/* pickup a pointer to the leaves of the tree.
			 */
			leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
```

`tp->dmt_leafidx` is the problem child, because it's sourced directly from `dp->tree.leafidx`. And if *that* is corrupted on disk, then `leaf` is going to point into la-la land, out of bounds of `tp->dmt_stree`. This is a classic buffer overflow scenario.

I need to nail down the expected boundaries, here. `dmt_leafidx` is, as I recall, the index of the *first* leaf within `stree`. For `dmap`, `stree` has a size of `TREESIZE` (341), and the first leaf starts at `LEAFIND` (85). For `dmapctl`, `stree` is `CTLTREESIZE` (1365), with the first leaf at `CTLLEAFIND` (341). Alright, let's just make sure I have those values of `LEAFIND` and `CTLLEAFIND` correct. Then, let's see how we can exploit this to write some nasty values, and cause crashes, or even worse...



41/2 2026/06/30 14:36 tool grepper
0m Args:
map[Expression:#define.*LEAFIND PathPrefix:fs/jfs/]

Results:
map[Output:fs/jfs/jfs_dmap.h-11-#define	TREESIZE	(256+64+16+4+1)	/* size of a dmap tree */
fs/jfs/jfs_dmap.h:12:#define	LEAFIND		(64+16+4+1)	/* index of 1st leaf of a dmap tree */
fs/jfs/jfs_dmap.h-13-#define LPERDMAP	256	/* num leaves per dmap tree */
--
fs/jfs/jfs_dmap.h-20-#define CTLTREESIZE	(1024+256+64+16+4+1)	/* size of a dmapctl tree */
fs/jfs/jfs_dmap.h:21:#define CTLLEAFIND	(256+64+16+4+1)	/* idx of 1st leaf of a dmapctl tree */
fs/jfs/jfs_dmap.h-22-#define LPERCTL		1024	/* num of leaves per dmapctl tree */
]

42/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 36001
							output: 42
							thoughts: 576
						

Thoughts:
**Analyzing the dmtree Indexing Logic**

Okay, so I'm looking at how the `dmtree` structure works, specifically how it manages free space. I see that `LEAFIND` is defined as 85 and `CTLLEAFIND` as 341. The critical part is the value of `dmt_leafidx`, which can be anything, as it's read from disk. The crucial question is, how robust is the system in validating this value when it's read and used?

I'm digging into `dbAllocBottomUp` which seems to load the `dmap` and `dmapctl` structures. I'm focusing on the call to `read_metapage` in this function. And I can't find any validation code here: it just reads the data into the `dp` pointer, assuming the data on the disk is valid. That's a potential vulnerability.

Now, I remember `dmt_leafidx` gets used in `dbFindLeaf`. Let's see: I found the function, and it uses `dmt_leafidx` in a loop condition and a check. Specifically, there's a conditional `if (le32_to_cpu(tp->dmt_leafidx) >= max_idx) return -ENOSPC;`. The use of `max_idx` is tied to `is_ctl`, setting `max_idx` equal to either `CTLLEAFIND` or `LEAFIND`. However, I can see that the check is present, so there is *some* validation, even if it's potentially limited.

But, hang on... `dbFindLeaf` is only called during allocation. What about during *freeing* space? The `dbFreeDmap` function calls `dbFreeBits`, which in turn calls `dbJoin` and `dbAdjTree`. So it's looking like `dmt_leafidx` is not used in the freeing of space, so there's less validation than I initially suspected. I'm moving on to `dbFreeBits` to see what is going on there.



43/2 2026/06/30 14:36 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2373 LineCount:100]

Results:
map[Contents:2373:	static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2374:			       int nblocks)
2375:	{
2376:		int dbitno, word, rembits, nb, nwords, wbitno, nw, agno;
2377:		dmtree_t *tp = (dmtree_t *) & dp->tree;
2378:		int rc = 0;
2379:		int size;
2380:	
2381:		/* determine the bit number and word within the dmap of the
2382:		 * starting block.
2383:		 */
2384:		dbitno = blkno & (BPERDMAP - 1);
2385:		word = dbitno >> L2DBWORD;
2386:	
2387:		/* block range better be within the dmap.
2388:		 */
2389:		assert(dbitno + nblocks <= BPERDMAP);
2390:	
2391:		/* free the bits of the dmaps words corresponding to the block range.
2392:		 * not all bits of the first and last words may be contained within
2393:		 * the block range.  if this is the case, we'll work against those
2394:		 * words (i.e. partial first and/or last) on an individual basis
2395:		 * (a single pass), freeing the bits of interest by hand and updating
2396:		 * the leaf corresponding to the dmap word. a single pass will be used
2397:		 * for all dmap words fully contained within the specified range.
2398:		 * within this pass, the bits of all fully contained dmap words will
2399:		 * be marked as free in a single shot and the leaves will be updated. a
2400:		 * single leaf may describe the free space of multiple dmap words,
2401:		 * so we may update only a subset of the actual leaves corresponding
2402:		 * to the dmap words of the block range.
2403:		 *
2404:		 * dbJoin() is used to update leaf values and will join the binary
2405:		 * buddy system of the leaves if the new leaf values indicate this
2406:		 * should be done.
2407:		 */
2408:		for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
2409:			/* determine the bit number within the word and
2410:			 * the number of bits within the word.
2411:			 */
2412:			wbitno = dbitno & (DBWORD - 1);
2413:			nb = min(rembits, DBWORD - wbitno);
2414:	
2415:			/* check if only part of a word is to be freed.
2416:			 */
2417:			if (nb < DBWORD) {
2418:				/* free (zero) the appropriate bits within this
2419:				 * dmap word.
2420:				 */
2421:				dp->wmap[word] &=
2422:				    cpu_to_le32(~(ONES << (DBWORD - nb)
2423:						  >> wbitno));
2424:	
2425:				/* update the leaf for this dmap word.
2426:				 */
2427:				rc = dbJoin(tp, word,
2428:					    dbMaxBud((u8 *)&dp->wmap[word]), false);
2429:				if (rc)
2430:					return rc;
2431:	
2432:				word += 1;
2433:			} else {
2434:				/* one or more dmap words are fully contained
2435:				 * within the block range.  determine how many
2436:				 * words and free (zero) the bits of these words.
2437:				 */
2438:				nwords = rembits >> L2DBWORD;
2439:				memset(&dp->wmap[word], 0, nwords * 4);
2440:	
2441:				/* determine how many bits.
2442:				 */
2443:				nb = nwords << L2DBWORD;
2444:	
2445:				/* now update the appropriate leaves to reflect
2446:				 * the freed words.
2447:				 */
2448:				for (; nwords > 0; nwords -= nw) {
2449:					/* determine what the leaf value should be
2450:					 * updated to as the minimum of the l2 number
2451:					 * of bits being freed and the l2 (max) number
2452:					 * of bits that can be described by this leaf.
2453:					 */
2454:					size =
2455:					    min(LITOL2BSZ
2456:						(word, L2LPERDMAP, BUDMIN),
2457:						NLSTOL2BSZ(nwords));
2458:	
2459:					/* update the leaf.
2460:					 */
2461:					rc = dbJoin(tp, word, size, false);
2462:					if (rc)
2463:						return rc;
2464:	
2465:					/* get the number of dmap words handled.
2466:					 */
2467:					nw = BUDSIZE(size, BUDMIN);
2468:					word += nw;
2469:				}
2470:			}
2471:		}
2472:	
]

44/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 38593
							output: 29
							thoughts: 430
						

Thoughts:
**Vulnerability Discovery: Out-of-Bounds Access in `dbJoin`**

Okay, so I've been digging into this `dbFreeBits` function, and it's calling `dbJoin` with `tp`, which is essentially a pointer to `dp->tree`. `dp` is this `struct dmap` that's loaded from disk. The problem is, and this is a glaring omission, there's no check on `dp->tree.leafidx` *before* the `dbJoin` call. This is a potential disaster waiting to happen.

Looking at the `dbJoin` code itself, it seems like the vulnerable spot is this:

```c
	/* pickup a pointer to the leaves of the tree.
	 */
	leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
```

If `tp->dmt_leafidx` is corrupted – say, because the data on disk is bad – then `leaf` is going to point way out of bounds. Further down, `leaf[buddy]` gets accessed, and that's the trigger for the out-of-bounds read. This happens when the new leaf value is less than the existing leaf value. It seems a simple comparison is enough to trigger the issue.

My first thought is, the fix is straightforward: validate `dmt_leafidx` whenever a `dmap` or `dmapctl` struct is read from disk. Or we could put the validation right inside `dbJoin`, `dbSplit`, `dbBackSplit`, `dbAdjTree`, and any other place where the value is used.

But wait a minute... Let me rethink this... `dmt_leafidx` is actually a *constant* for both `dmap` and `dmapctl`. For `dmap`, it's always `LEAFIND` (85), and for `dmapctl`, it's `CTLLEAFIND` (341). Now, this is interesting. I'll need to check how `dmap` and `dmapctl` are initialized to confirm my suspicions and to figure out if it is possible for the value to be corrupted or tampered with. It seems the vulnerability lies in either corruption of the `leafidx` constant, or in another, related structure or variable in the vicinity. I'll need to look at the initialization code.



45/2 2026/06/30 14:36 tool grepper
0m Args:
map[Expression:leafidx.*= PathPrefix:fs/jfs/]

Results:
map[Output:fs/jfs/jfs_dmap.c=142=static bool check_dmapctl(struct dmapctl *dcp)
--
fs/jfs/jfs_dmap.c-169-
fs/jfs/jfs_dmap.c:170:	leafidx = le32_to_cpu(dcp->leafidx);
fs/jfs/jfs_dmap.c-171-	/* Check leaf index matches expected position */
fs/jfs/jfs_dmap.c:172:	if (unlikely(leafidx != CTLLEAFIND)) {
fs/jfs/jfs_dmap.c-173-		jfs_err("dmapctl: invalid leafidx %u (expected %u)",
--
fs/jfs/jfs_dmap.c=1158=static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
--
fs/jfs/jfs_dmap.c-1165-
fs/jfs/jfs_dmap.c:1166:	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
fs/jfs/jfs_dmap.c-1167-		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
--
fs/jfs/jfs_dmap.c=1290=dbAllocNear(struct bmap * bmp,
--
fs/jfs/jfs_dmap.c-1295-
fs/jfs/jfs_dmap.c:1296:	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
fs/jfs/jfs_dmap.c-1297-		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
--
fs/jfs/jfs_dmap.c=3034=static int dbFindLeaf(dmtree_t *tp, int l2nb, int *leafidx, bool is_ctl)
--
fs/jfs/jfs_dmap.c-3071-	}
fs/jfs/jfs_dmap.c:3072:	if (le32_to_cpu(tp->dmt_leafidx) >= max_idx)
fs/jfs/jfs_dmap.c-3073-		return -ENOSPC;
--
fs/jfs/jfs_dmap.c-3077-	 */
fs/jfs/jfs_dmap.c:3078:	*leafidx = x + n - le32_to_cpu(tp->dmt_leafidx);
fs/jfs/jfs_dmap.c-3079-
--
fs/jfs/jfs_dmap.c=3940=static int dbInitDmapTree(struct dmap * dp)
--
fs/jfs/jfs_dmap.c-3949-	tp->l2nleafs = cpu_to_le32(L2LPERDMAP);
fs/jfs/jfs_dmap.c:3950:	tp->leafidx = cpu_to_le32(LEAFIND);
fs/jfs/jfs_dmap.c-3951-	tp->height = cpu_to_le32(4);
--
fs/jfs/jfs_dmap.c=4061=static int dbInitDmapCtl(struct dmapctl * dcp, int level, int i)
--
fs/jfs/jfs_dmap.c-4066-	dcp->l2nleafs = cpu_to_le32(L2LPERCTL);
fs/jfs/jfs_dmap.c:4067:	dcp->leafidx = cpu_to_le32(CTLLEAFIND);
fs/jfs/jfs_dmap.c-4068-	dcp->height = cpu_to_le32(5);
]

46/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 40604
							output: 30
							thoughts: 27
						

Thoughts:
Here's my thought process, summarized as you requested:

**A Moment of Realization and Investigation**

Wait a minute, I seem to recall a utility called `check_dmapctl` existing! That's a potentially important piece of the puzzle. Now I need to see where this is being called. My immediate next step is to trace its usage within the system. Understanding the context in which `check_dmapctl` is used will give me the information to understand its importance in the wider system.



47/2 2026/06/30 14:36 tool grepper
0m Args:
map[Expression:check_dmapctl PathPrefix:fs/jfs/]

Results:
map[Output:fs/jfs/jfs_dmap.c=117=static const s8 budtab[256] = {
--
fs/jfs/jfs_dmap.c-136-/*
fs/jfs/jfs_dmap.c:137: * check_dmapctl - Validate integrity of a dmapctl structure
fs/jfs/jfs_dmap.c-138- * @dcp: Pointer to the dmapctl structure to check
--
fs/jfs/jfs_dmap.c-141- */
fs/jfs/jfs_dmap.c:142:static bool check_dmapctl(struct dmapctl *dcp)
fs/jfs/jfs_dmap.c-143-{
--
fs/jfs/jfs_dmap.c=1399=dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
--
fs/jfs/jfs_dmap.c-1461-
fs/jfs/jfs_dmap.c:1462:	if (unlikely(!check_dmapctl(dcp))) {
fs/jfs/jfs_dmap.c-1463-		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
--
fs/jfs/jfs_dmap.c=1768=static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
--
fs/jfs/jfs_dmap.c-1791-
fs/jfs/jfs_dmap.c:1792:		if (unlikely(!check_dmapctl(dcp))) {
fs/jfs/jfs_dmap.c-1793-			jfs_error(bmp->db_ipbmap->i_sb,
--
fs/jfs/jfs_dmap.c=2557=dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
--
fs/jfs/jfs_dmap.c-2574-
fs/jfs/jfs_dmap.c:2575:	if (unlikely(!check_dmapctl(dcp))) {
fs/jfs/jfs_dmap.c-2576-		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
--
fs/jfs/jfs_dmap.c=3454=int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
--
fs/jfs/jfs_dmap.c-3543-	l2dcp = (struct dmapctl *) l2mp->data;
fs/jfs/jfs_dmap.c:3544:	if (unlikely(!check_dmapctl(l2dcp))) {
fs/jfs/jfs_dmap.c-3545-		jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
--
fs/jfs/jfs_dmap.c-3565-			l1dcp = (struct dmapctl *) l1mp->data;
fs/jfs/jfs_dmap.c:3566:			if (unlikely(!check_dmapctl(l1dcp))) {
fs/jfs/jfs_dmap.c-3567-				jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
--
fs/jfs/jfs_dmap.c-3582-			l1dcp = (struct dmapctl *) l1mp->data;
fs/jfs/jfs_dmap.c:3583:			if (unlikely(!check_dmapctl(l1dcp))) {
fs/jfs/jfs_dmap.c-3584-				jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
--
fs/jfs/jfs_dmap.c-3605-				l0dcp = (struct dmapctl *) l0mp->data;
fs/jfs/jfs_dmap.c:3606:				if (unlikely(!check_dmapctl(l0dcp))) {
fs/jfs/jfs_dmap.c-3607-					jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
--
fs/jfs/jfs_dmap.c-3624-				l0dcp = (struct dmapctl *) l0mp->data;
fs/jfs/jfs_dmap.c:3625:				if (unlikely(!check_dmapctl(l0dcp))) {
fs/jfs/jfs_dmap.c-3626-					jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
]

48/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 42062
							output: 41
							thoughts: 91
						

Thoughts:
Okay, here's my take on those thoughts, framed as an expert's internal monologue:

**Investigating a Discrepancy in the Data Mapper Code**

Hmm, so `check_dmapctl` is implemented, but I'm not seeing a corresponding `check_dmap` function. That's a little odd. Let's dig in. I see that `dbAllocNext` and `dbAllocNear` both perform a check for `dp->tree.leafidx != cpu_to_le32(LEAFIND)`. Okay, that makes sense – they're validating something about the leaf index. However, `dbFree` and `dbFreeBits` don't seem to have that same check. That's a potential point of divergence I need to understand. I should take a closer look at what those allocation routines are actually doing. Let's focus on `dbAllocNext` and `dbAllocNear` and see what's going on. I need to understand why the deallocation path might not require the same validation or if this oversight is a bug.



49/2 2026/06/30 14:36 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:1158 LineCount:20]

Results:
map[Contents:1158:	static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
1159:			       int nblocks)
1160:	{
1161:		int dbitno, word, rembits, nb, nwords, wbitno, nw;
1162:		int l2size;
1163:		s8 *leaf;
1164:		u32 mask;
1165:	
1166:		if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
1167:			jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
1168:			return -EIO;
1169:		}
1170:	
1171:		/* pick up a pointer to the leaves of the dmap tree.
1172:		 */
1173:		leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx);
1174:	
1175:		/* determine the bit number and word within the dmap of the
1176:		 * starting block.
1177:		 */
]

50/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 42757
							output: 40
							thoughts: 96
						

Thoughts:
Okay, let me think this through.

**Analyzing Data Structure Consistency**

Alright, I'm tracing some operations related to database allocation and deallocation. I see that `dbAllocNext` and `dbAllocNear` are properly checking `dp->tree.leafidx`. That's good, ensuring they're operating within the expected boundaries of the leaf index. However, `dbFree` is where things are a little hazy. I see `dbFree` reads `dp` and then calls `dbFreeDmap`. `dbFreeDmap` then cascades further by calling `dbFreeBits`, which eventually calls `dbJoin`. The issue I see is that **none** of these called functions – `dbFreeDmap`, `dbFreeBits`, or `dbJoin` – are explicitly checking `dp->tree.leafidx` again. That seems like a potential inconsistency or vulnerability. Now that I think about it again, `dbFree` reads `dp` and calls `dbFreeDmap` - which is a critical point. I really need to revisit `dbFree` itself to make sure I am fully understanding its role in all of this.



51/2 2026/06/30 14:36 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:464 LineCount:30]

Results:
map[Contents: 464:		for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) {
 465:			/* release previous dmap if any */
 466:			if (mp) {
 467:				write_metapage(mp);
 468:			}
 469:	
 470:			/* get the buffer for the current dmap. */
 471:			lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 472:			mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
 473:			if (mp == NULL) {
 474:				IREAD_UNLOCK(ipbmap);
 475:				return -EIO;
 476:			}
 477:			dp = (struct dmap *) mp->data;
 478:	
 479:			/* determine the number of blocks to be freed from
 480:			 * this dmap.
 481:			 */
 482:			nb = min(rem, BPERDMAP - (blkno & (BPERDMAP - 1)));
 483:	
 484:			/* free the blocks. */
 485:			if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) {
 486:				jfs_error(ip->i_sb, "error in block map\n");
 487:				release_metapage(mp);
 488:				IREAD_UNLOCK(ipbmap);
 489:				return (rc);
 490:			}
 491:		}
 492:	
 493:		/* write the last buffer. */
]

52/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 43605
							output: 41
							thoughts: 180
						

Thoughts:
**Analyzing Potential Error Points in the Database Operations**

Okay, so I'm thinking about where we could insert a check to catch potential issues, specifically related to the `dmt_leafidx` value. My initial instinct was to look at places where we're freeing resources – `dbFreeDmap`, `dbFreeBits`, `dbFree`, or `dbJoin`. But then I realized that several functions manipulate this `tp->dmt_leafidx` value: `dbJoin`, `dbSplit`, `dbBackSplit`, `dbAdjTree`, and `dbFindLeaf`. That's a lot of places to keep track of.

Hang on...`dbJoin` takes a `dmtree_t *tp` and a `bool is_ctl` as parameters. Right, that's the key. If `is_ctl` is true, then this is operating on a `dmapctl`, and the `tp->dmt_leafidx` should, by design, be `CTLLEAFIND`, which is 341. Conversely, if `is_ctl` is false, it's a regular `dmap`, and we'd expect `tp->dmt_leafidx` to be `LEAFIND`, which is 85.

I need to dive into the implementation of `dbJoin` and see how this value is being used and modified, to pinpoint the best place to add a sanity check. Let me examine `dbJoin` more closely.



53/2 2026/06/30 14:36 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2857 LineCount:20]

Results:
map[Contents:2857:	static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl)
2858:	{
2859:		int budsz, buddy;
2860:		s8 *leaf;
2861:	
2862:		/* can the new leaf value require a join with other leaves ?
2863:		 */
2864:		if (newval >= tp->dmt_budmin) {
2865:			/* pickup a pointer to the leaves of the tree.
2866:			 */
2867:			leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
2868:	
2869:			/* try to join the specified leaf into a large binary
2870:			 * buddy system.  the join proceeds by attempting to join
2871:			 * the specified leafno with its buddy (leaf) at new value.
2872:			 * if the join occurs, we attempt to join the left leaf
2873:			 * of the joined buddies with its buddy at new value + 1.
2874:			 * we continue to join until we find a buddy that cannot be
2875:			 * joined (does not have a value equal to the size of the
2876:			 * last join) or until all leaves have been joined into a
]

54/2 2026/06/30 14:36 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 44504
							output: 36
							thoughts: 1182
						

Thoughts:
**Analyzing `dmap` Validation and Location**

Okay, so I'm looking at where we can best validate the `dmap` structure. My initial thought was to add a check in `dbJoin`, right before it accesses `tp->dmt_leafidx`. But, the more I look, the more I realize that `tp->dmt_leafidx` is used in multiple functions: `dbSplit`, `dbBackSplit`, and `dbAdjTree` as well. That means validating there might not be sufficient.

The best place to validate `dmap` is when it is read from disk, or when freeing/allocating bits.

I recall that `check_dmapctl` is called when `dmapctl` is read. Why don't we do something similar, and create a `check_dmap` function and call it when `dmap` is read? Let's check where `dmap` is actually read from disk. Seems like it's read by `read_metapage` in many functions: `dbFree`, `dbUpdatePMap`, `dbAllocBottomUp`, `dbExtendFS`, `dbAlloc`, `dbExtend`, and `dbAllocCtl`.

It seems we can add `check_dmap` and call it in these functions.

Wait a second. I just remembered that `check_dmapctl` is also called from `dbAllocAG`, `dbFindCtl`, `dbAdjCtl`, and `dbExtendFS`. So it's not actually called from within `read_metapage`.

An alternative might be to just check `dp->tree.leafidx == cpu_to_le32(LEAFIND)` in functions like `dbFreeDmap`, `dbAllocBits`, and `dbFreeBits`. Actually, `dbAllocNext` and `dbAllocNear` *already* check `dp->tree.leafidx != cpu_to_le32(LEAFIND)`.



55/2 2026/06/30 14:36 tool git-log
10m Error:
log-in to see details

Args:
map[CodeRegexp:dp->tree.leafidx != cpu_to_le32\(LEAFIND\)]

Results:
map[Output:]

56/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 46180
							output: 47
							thoughts: 12
						

Thoughts:
Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person:

**Focusing on Filesystem Implementations**

Alright, I need to narrow my scope. Instead of a general discussion, I should restrict my focus. The current task requires a deep dive into filesystem implementation. I should concentrate on the specific aspects of `fs/jfs/`, which represents a specific filesystem implementation. This immediately hones my thinking, allowing me to draw on my existing knowledge base and avoid getting bogged down in extraneous details. Focusing on `fs/jfs/` allows for a more concise and direct analysis.



57/2 2026/06/30 14:46 tool git-log
0m Args:
map[CodeRegexp:dp->tree.leafidx != cpu_to_le32\(LEAFIND\) PathPrefix:fs/jfs/]

Results:
map[Output:1da177e4c3f4 Linux-2.6.12-rc2
]

58/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 46410
							output: 33
							thoughts: 21
						

Thoughts:
Okay, here's my interpretation of those thoughts, tailored for an expert audience, and delivered as a first-person summary:

**The Persistent Challenge**

It's always been lurking in the background, hasn't it? This particular issue – this core problem, it's been a thorn in my side from the start. I need to get back to basics. Let's see if `check_dmapctl` can shed some light on the current state and give me a clue as to the next step. I'll need to run this and parse the output, probably look for inconsistencies.



59/2 2026/06/30 14:46 tool git-log
0m Args:
map[CodeRegexp:check_dmapctl PathPrefix:fs/jfs/]

Results:
map[Output:cce219b203c4 jfs: add dmapctl integrity check to prevent invalid operations
]

60/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 46628
							output: 26
							thoughts: 32
						

Thoughts:
Okay, here's my interpretation of those thoughts, crafted with the understanding that the user is an expert.

**Initial Investigation into a Recent Addition**

Right, `check_dmapctl`... that's a new one. I seem to recall that popping up in the recent commits. Let's dig into that `cce219b203c4` commit, that should tell the whole story. What specifically did they change or add regarding the dmap control? What problems was the author trying to solve? Or was this just a refactor or addition of functionality? Understanding the context will be important, because while I understand what the function does generally, it's the *why* that's important here. I want to see how this integrates with the existing system. The commit message better be clear and concise!



61/2 2026/06/30 14:46 tool git-show
0m Args:
map[Commit:cce219b203c4]

Results:
map[Output:commit cce219b203c4b9cb445e910c7090d1f58af847c5
Author: Yun Zhou <yun.zhou@windriver.com>
Date:   Fri Nov 28 23:51:50 2025 +0800

    jfs: add dmapctl integrity check to prevent invalid operations
    
    Add check_dmapctl() to validate dmapctl structure integrity, focusing on
    preventing invalid operations caused by on-disk corruption.
    
    Key checks:
     - nleafs bounded by [0, LPERCTL] (maximum leaf nodes per dmapctl).
     - l2nleafs bounded by [0, L2LPERCTL] and consistent with nleafs
       (nleafs must be 2^l2nleafs).
     - leafidx must be exactly CTLLEAFIND (expected leaf index position).
     - height bounded by [0, L2LPERCTL >> 1] (valid tree height range).
     - budmin validity: NOFREE only if nleafs=0; otherwise >= BUDMIN.
     - Leaf nodes fit within stree array (leafidx + nleafs <= CTLTREESIZE).
     - Leaf node values are either non-negative or NOFREE.
    
    Invoked in dbAllocAG(), dbFindCtl(), dbAdjCtl() and dbExtendFS() when
    accessing dmapctl pages, catching corruption early before dmap operations
    trigger invalid memory access or logic errors.
    
    This fixes the following UBSAN warning.
    
    [58245.668090][T14017] ------------[ cut here ]------------
    [58245.668103][T14017] UBSAN: shift-out-of-bounds in fs/jfs/jfs_dmap.c:2641:11
    [58245.668119][T14017] shift exponent 110 is too large for 32-bit type 'int'
    [58245.668137][T14017] CPU: 0 UID: 0 PID: 14017 Comm: 4c1966e88c28fa9 Tainted: G            E       6.18.0-rc4-00253-g21ce5d4ba045-dirty #124 PREEMPT_{RT,(full)}
    [58245.668174][T14017] Tainted: [E]=UNSIGNED_MODULE
    [58245.668176][T14017] Hardware name: QEMU Ubuntu 25.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
    [58245.668184][T14017] Call Trace:
    [58245.668200][T14017]  <TASK>
    [58245.668208][T14017]  dump_stack_lvl+0x189/0x250
    [58245.668288][T14017]  ? __pfx_dump_stack_lvl+0x10/0x10
    [58245.668301][T14017]  ? __pfx__printk+0x10/0x10
    [58245.668315][T14017]  ? lock_metapage+0x303/0x400 [jfs]
    [58245.668406][T14017]  ubsan_epilogue+0xa/0x40
    [58245.668422][T14017]  __ubsan_handle_shift_out_of_bounds+0x386/0x410
    [58245.668462][T14017]  dbSplit+0x1f8/0x200 [jfs]
    [58245.668543][T14017]  dbAdjCtl+0x34c/0xa20 [jfs]
    [58245.668628][T14017]  dbAllocNear+0x2ee/0x3d0 [jfs]
    [58245.668710][T14017]  dbAlloc+0x933/0xba0 [jfs]
    [58245.668797][T14017]  ea_write+0x374/0xdd0 [jfs]
    [58245.668888][T14017]  ? __pfx_ea_write+0x10/0x10 [jfs]
    [58245.668966][T14017]  ? __jfs_setxattr+0x76e/0x1120 [jfs]
    [58245.669046][T14017]  __jfs_setxattr+0xa01/0x1120 [jfs]
    [58245.669135][T14017]  ? __pfx___jfs_setxattr+0x10/0x10 [jfs]
    [58245.669216][T14017]  ? mutex_lock_nested+0x154/0x1d0
    [58245.669252][T14017]  ? __jfs_xattr_set+0xb9/0x170 [jfs]
    [58245.669333][T14017]  __jfs_xattr_set+0xda/0x170 [jfs]
    [58245.669430][T14017]  ? __pfx___jfs_xattr_set+0x10/0x10 [jfs]
    [58245.669509][T14017]  ? xattr_full_name+0x6f/0x90
    [58245.669546][T14017]  ? jfs_xattr_set+0x33/0x60 [jfs]
    [58245.669636][T14017]  ? __pfx_jfs_xattr_set+0x10/0x10 [jfs]
    [58245.669726][T14017]  __vfs_setxattr+0x43c/0x480
    [58245.669743][T14017]  __vfs_setxattr_noperm+0x12d/0x660
    [58245.669756][T14017]  vfs_setxattr+0x16b/0x2f0
    [58245.669768][T14017]  ? __pfx_vfs_setxattr+0x10/0x10
    [58245.669782][T14017]  filename_setxattr+0x274/0x600
    [58245.669795][T14017]  ? __pfx_filename_setxattr+0x10/0x10
    [58245.669806][T14017]  ? getname_flags+0x1e5/0x540
    [58245.669829][T14017]  path_setxattrat+0x364/0x3a0
    [58245.669840][T14017]  ? __pfx_path_setxattrat+0x10/0x10
    [58245.669859][T14017]  ? __se_sys_chdir+0x1b9/0x280
    [58245.669876][T14017]  __x64_sys_lsetxattr+0xbf/0xe0
    [58245.669888][T14017]  do_syscall_64+0xfa/0xfa0
    [58245.669901][T14017]  ? lockdep_hardirqs_on+0x9c/0x150
    [58245.669913][T14017]  ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
    [58245.669927][T14017]  ? exc_page_fault+0xab/0x100
    [58245.669937][T14017]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Reported-by: syzbot+4c1966e88c28fa96e053@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=4c1966e88c28fa96e053
    Signed-off-by: Yun Zhou <yun.zhou@windriver.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 2abe8cc02ee6..a841cf21da7d 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -133,6 +133,93 @@ static const s8 budtab[256] = {
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1
 };
 
+/*
+ * check_dmapctl - Validate integrity of a dmapctl structure
+ * @dcp: Pointer to the dmapctl structure to check
+ *
+ * Return: true if valid, false if corrupted
+ */
+static bool check_dmapctl(struct dmapctl *dcp)
+{
+	s8 budmin = dcp->budmin;
+	u32 nleafs, l2nleafs, leafidx, height;
+	int i;
+
+	nleafs = le32_to_cpu(dcp->nleafs);
+	/* Check basic field ranges */
+	if (unlikely(nleafs > LPERCTL)) {
+		jfs_err("dmapctl: invalid nleafs %u (max %u)",
+			nleafs, LPERCTL);
+		return false;
+	}
+
+	l2nleafs = le32_to_cpu(dcp->l2nleafs);
+	if (unlikely(l2nleafs > L2LPERCTL)) {
+		jfs_err("dmapctl: invalid l2nleafs %u (max %u)",
+			l2nleafs, L2LPERCTL);
+		return false;
+	}
+
+	/* Verify nleafs matches l2nleafs (must be power of two) */
+	if (unlikely((1U << l2nleafs) != nleafs)) {
+		jfs_err("dmapctl: nleafs %u != 2^%u",
+			nleafs, l2nleafs);
+		return false;
+	}
+
+	leafidx = le32_to_cpu(dcp->leafidx);
+	/* Check leaf index matches expected position */
+	if (unlikely(leafidx != CTLLEAFIND)) {
+		jfs_err("dmapctl: invalid leafidx %u (expected %u)",
+			leafidx, CTLLEAFIND);
+		return false;
+	}
+
+	height = le32_to_cpu(dcp->height);
+	/* Check tree height is within valid range */
+	if (unlikely(height > (L2LPERCTL >> 1))) {
+		jfs_err("dmapctl: invalid height %u (max %u)",
+			height, L2LPERCTL >> 1);
+		return false;
+	}
+
+	/* Check budmin is valid (cannot be NOFREE for non-empty tree) */
+	if (budmin == NOFREE) {
+		if (unlikely(nleafs > 0)) {
+			jfs_err("dmapctl: budmin is NOFREE but nleafs %u",
+				nleafs);
+			return false;
+		}
+	} else if (unlikely(budmin < BUDMIN)) {
+		jfs_err("dmapctl: invalid budmin %d (min %d)",
+			budmin, BUDMIN);
+		return false;
+	}
+
+	/* Check leaf nodes fit within stree array */
+	if (unlikely(leafidx + nleafs > CTLTREESIZE)) {
+		jfs_err("dmapctl: leaf range exceeds stree size (end %u > %u)",
+			leafidx + nleafs, CTLTREESIZE);
+		return false;
+	}
+
+	/* Check leaf nodes have valid values */
+	for (i = leafidx; i < leafidx + nleafs; i++) {
+		s8 val = dcp->stree[i];
+
+		if (unlikely(val < NOFREE)) {
+			jfs_err("dmapctl: invalid leaf value %d at index %d",
+					val, i);
+			return false;
+		} else if (unlikely(val > 31)) {
+			jfs_err("dmapctl: leaf value %d too large at index %d", val, i);
+			return false;
+		}
+	}
+
+	return true;
+}
+
 /*
  * NAME:	dbMount()
  *
@@ -1372,7 +1459,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
 	dcp = (struct dmapctl *) mp->data;
 	budmin = dcp->budmin;
 
-	if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
+	if (unlikely(!check_dmapctl(dcp))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
 		release_metapage(mp);
 		return -EIO;
@@ -1702,7 +1789,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
 		dcp = (struct dmapctl *) mp->data;
 		budmin = dcp->budmin;
 
-		if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
+		if (unlikely(!check_dmapctl(dcp))) {
 			jfs_error(bmp->db_ipbmap->i_sb,
 				  "Corrupt dmapctl page\n");
 			release_metapage(mp);
@@ -2485,7 +2572,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
 		return -EIO;
 	dcp = (struct dmapctl *) mp->data;
 
-	if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
+	if (unlikely(!check_dmapctl(dcp))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
 		release_metapage(mp);
 		return -EIO;
@@ -3454,6 +3541,11 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 		return -EIO;
 	}
 	l2dcp = (struct dmapctl *) l2mp->data;
+	if (unlikely(!check_dmapctl(l2dcp))) {
+		jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
+		release_metapage(l2mp);
+		return -EIO;
+	}
 
 	/* compute start L1 */
 	k = blkno >> L2MAXL1SIZE;
@@ -3471,6 +3563,10 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 			if (l1mp == NULL)
 				goto errout;
 			l1dcp = (struct dmapctl *) l1mp->data;
+			if (unlikely(!check_dmapctl(l1dcp))) {
+				jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
+				goto errout;
+			}
 
 			/* compute start L0 */
 			j = (blkno & (MAXL1SIZE - 1)) >> L2MAXL0SIZE;
@@ -3484,6 +3580,10 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 				goto errout;
 
 			l1dcp = (struct dmapctl *) l1mp->data;
+			if (unlikely(!check_dmapctl(l1dcp))) {
+				jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
+				goto errout;
+			}
 
 			/* compute start L0 */
 			j = 0;
@@ -3503,6 +3603,10 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 				if (l0mp == NULL)
 					goto errout;
 				l0dcp = (struct dmapctl *) l0mp->data;
+				if (unlikely(!check_dmapctl(l0dcp))) {
+					jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
+					goto errout;
+				}
 
 				/* compute start dmap */
 				i = (blkno & (MAXL0SIZE - 1)) >>
@@ -3518,6 +3622,10 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 					goto errout;
 
 				l0dcp = (struct dmapctl *) l0mp->data;
+				if (unlikely(!check_dmapctl(l0dcp))) {
+					jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
+					goto errout;
+				}
 
 				/* compute start dmap */
 				i = 0;
]

62/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 51947
							output: 40
							thoughts: 118
						

Thoughts:
**Analyzing the DMAP/DMAPCTL Implementation**

Okay, so we added `check_dmapctl`, which makes sense for, you know, checking `dmapctl`. But then it struck me – we're not actually checking `dmap` itself. That seemed like a gap. Hmm, let me think. Right! `dmap` has that internal `struct dmaptree tree`, so it’s all connected.

Now, if I recall correctly, `struct dmaptree` holds all that vital metadata: `nleafs`, `l2nleafs`, `leafidx`, `height`, `budmin`, `stree`. The structure is actually quite similar in purpose to what we find in `dmapctl`. It's really the same underlying data!

Therefore, we need to think about adding a `check_dmap` or maybe, even better, `check_dmaptree` function. It would make more sense to check the underlying datastructure, and if that is valid, then `dmap` is valid by extension. Now I'm going to have to dive into that `struct dmaptree` definition again. Let's see...



63/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.h FirstLine:134 LineCount:10]

Results:
map[Contents: 134:	struct dmaptree {
 135:		__le32 nleafs;		/* 4: number of tree leafs	*/
 136:		__le32 l2nleafs;	/* 4: l2 number of tree leafs	*/
 137:		__le32 leafidx;		/* 4: index of first tree leaf	*/
 138:		__le32 height;		/* 4: height of the tree	*/
 139:		s8 budmin;		/* 1: min l2 tree leaf value to combine */
 140:		s8 stree[TREESIZE];	/* TREESIZE: tree		*/
 141:		u8 pad[2];		/* 2: pad to word boundary	*/
 142:	};				/* - 360 -			*/
 143:	
]

64/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 52587
							output: 41
							thoughts: 498
						

Thoughts:
**Validating the `dmap` Structure for Robustness**

Okay, so I'm thinking about the `struct dmaptree` and specifically that `leafidx` member. If it's corrupted, we're in trouble, right? The potential problem lies with `dbFree`, because it reads the `dmap` and then calls `dbFreeDmap`. If `dp->tree.leafidx` is bad, `dbFreeBits` will call `dbJoin` which could lead to an out-of-bounds access.

So, the key here is to validate `dp->tree.leafidx` whenever the `dmap` is read from disk. The obvious place to start is within `dbFree` itself. Let's see... looking at the code:

```c
		mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
		if (mp == NULL) {
			IREAD_UNLOCK(ipbmap);
			return -EIO;
		}
		dp = (struct dmap *) mp->data;
```

Right, we can add `check_dmap(dp)` right there after the read.

Now, let's make sure we haven't missed any other reads. Okay, I'm going through the other functions... `dbUpdatePMap`, `dbAllocBottomUp`, `dbExtendFS`, `dbAlloc`, `dbExtend`, `dbAllocCtl`. Wait a minute, `dbAllocNext` and `dbAllocNear` are *already* checking `dp->tree.leafidx != cpu_to_le32(LEAFIND)`. Interesting!

If we create `check_dmap` and make it robust, we could potentially replace those checks. I think that's the right direction. Let's start thinking about what this `check_dmap` or maybe `check_dmaptree` function needs to do.

Ah, of course. `check_dmapctl` checks a lot of stuff: `nleafs`, `l2nleafs`, `leafidx`, `height`, `budmin`, and `stree`. For the basic `dmap`, `nleafs` should be `LPERDMAP` (256), `l2nleafs` should be `L2LPERDMAP` (8), `leafidx` is expected to be `LEAFIND` (85), `height` is 4, `budmin` should be `BUDMIN` (0). Also, the `stree` size is `TREESIZE` (341). Got it. That sounds like a good check to implement. Let me just take a quick look at `dbInitDmapTree` to ensure that it has the correct values.



65/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:3940 LineCount:20]

Results:
map[Contents:3940:	static int dbInitDmapTree(struct dmap * dp)
3941:	{
3942:		struct dmaptree *tp;
3943:		s8 *cp;
3944:		int i;
3945:	
3946:		/* init fixed info of tree */
3947:		tp = &dp->tree;
3948:		tp->nleafs = cpu_to_le32(LPERDMAP);
3949:		tp->l2nleafs = cpu_to_le32(L2LPERDMAP);
3950:		tp->leafidx = cpu_to_le32(LEAFIND);
3951:		tp->height = cpu_to_le32(4);
3952:		tp->budmin = BUDMIN;
3953:	
3954:		/* init each leaf from corresponding wmap word:
3955:		 * note: leaf is set to NOFREE(-1) if all blocks of corresponding
3956:		 * bitmap word are allocated.
3957:		 */
3958:		cp = tp->stree + le32_to_cpu(tp->leafidx);
3959:		for (i = 0; i < LPERDMAP; i++)
]

66/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 54077
							output: 41
							thoughts: 2349
						

Thoughts:
**Analyzing and Securing the JFS dmap Implementation**

Okay, so I'm looking at this `check_dmaptree` function, and it seems like a solid approach to validating the structure of our `dmaptree` data. I've confirmed that the critical fields like `nleafs`, `l2nleafs`, `leafidx`, and `height` are defined correctly with their corresponding constants (`LPERDMAP`, `L2LPERDMAP`, `LEAFIND`, and 4 respectively) and can follow a similar pattern to `check_dmapctl`.

I'm considering incorporating this `check_dmaptree` function into the various read paths. The current code checks for invalid values during initialization, but it doesn't appear to perform this comprehensive validation upon reading from disk. I've noted that `check_dmapctl` was added later, but `check_dmaptree` wasn't, potentially because early fuzzing efforts didn't uncover dmap corruption as readily.

The crash is happening in `dbJoin`, which is used for both `dmap` and `dmapctl`. Although validating `tp->dmt_leafidx` inside `dbJoin`, `dbSplit`, `dbBackSplit`, `dbAdjTree`, and `dbFindLeaf` would provide robustness, it may introduce an unnecessary performance overhead with the addition of more `if` statements.

Therefore, the most critical locations to introduce the `check_dmaptree` call would be where `dmap` is read from disk, like in `dbFree`, `dbUpdatePMap`, `dbAllocBottomUp`, `dbExtendFS`, `dbAlloc`, `dbExtend`, and `dbAllocCtl`. I also noted `dbAllocNext` and `dbAllocNear` check `dp->tree.leafidx` already. But they don't check for all the other conditions, like the number of leaves or height.

Since `dbFreeDmap` isn't calling `dbAllocNext`, it's potentially vulnerable. Therefore, this is the most critical area to add either `check_dmaptree`, or, at a minimum, a `dp->tree.leafidx != cpu_to_le32(LEAFIND)` check. I need to closely examine `dbFreeDmap` to see where the checks should be placed. Adding these validations should help prevent corruption from leading to more serious issues.



67/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2164 LineCount:20]

Results:
map[Contents:2164:	static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2165:			      int nblocks)
2166:	{
2167:		s8 oldroot;
2168:		int rc = 0, word;
2169:	
2170:		/* save the current value of the root (i.e. maximum free string)
2171:		 * of the dmap tree.
2172:		 */
2173:		oldroot = dp->tree.stree[ROOT];
2174:	
2175:		/* free the specified (blocks) bits */
2176:		rc = dbFreeBits(bmp, dp, blkno, nblocks);
2177:	
2178:		/* if error or the root has not changed, done. */
2179:		if (rc || (dp->tree.stree[ROOT] == oldroot))
2180:			return (rc);
2181:	
2182:		/* root changed. bubble the change up to the dmap control pages.
2183:		 * if the adjustment of the upper level control pages fails,
]

68/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 57306
							output: 41
							thoughts: 149
						

Thoughts:
**Analyzing a Potential Bug Fix**

Okay, so I'm looking at this potential crash in `dbFreeDmap`. The immediate thought is that adding an `if (dp->tree.leafidx != cpu_to_le32(LEAFIND))` check in `dbFreeDmap` *should* prevent the issue. Seems straightforward enough. But, I need to take a step back and consider the broader implications.

The red flag is that `dbFreeBits` is also called from `dbUpdatePMap`, and I need to check how it will be affected by this fix. A quick scan reveals that neither `dbFreeBits` nor `dbAllocBits` actually validate `dp->tree.leafidx`, and that’s a problem. A change in the logic of one of these functions may cause an issue further up the call stack.

Right now, I'm leaning toward the `dbAllocBits` function as the place to start digging deeper. It seems like the common function which causes the problem.



69/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2226 LineCount:20]

Results:
map[Contents:2226:	static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2227:				int nblocks)
2228:	{
2229:		int dbitno, word, rembits, nb, nwords, wbitno, nw, agno;
2230:		dmtree_t *tp = (dmtree_t *) & dp->tree;
2231:		int size;
2232:		s8 *leaf;
2233:	
2234:		/* pick up a pointer to the leaves of the dmap tree */
2235:		leaf = dp->tree.stree + LEAFIND;
2236:	
2237:		/* determine the bit number and word within the dmap of the
2238:		 * starting block.
2239:		 */
2240:		dbitno = blkno & (BPERDMAP - 1);
2241:		word = dbitno >> L2DBWORD;
2242:	
2243:		/* block range better be within the dmap */
2244:		assert(dbitno + nblocks <= BPERDMAP);
2245:	
]

70/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 58042
							output: 40
							thoughts: 225
						

Thoughts:
**Vulnerability Assessment: `dbAllocBits`**

Okay, hold on a second! I've been focusing on `LEAFIND` and the potential for direct manipulation there, but something just clicked. I see that `dbAllocBits` *directly* accesses the dmap tree leaves using `LEAFIND`:

```c
/* pick up a pointer to the leaves of the dmap tree */
leaf = dp->tree.stree + LEAFIND;
```

But, further down in the code, `dbAllocBits` also calls `dbJoin`, and that function is using `tp->dmt_leafidx`!

```c
/* update the leaf for this dmap word.
 */
dbJoin(tp, word,
       dbMaxBud((u8 *) & dp->wmap[word]), false);
```

```c
leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
```

Meaning, we've got *two* points of potential vulnerability within `dbAllocBits`. If `tp->dmt_leafidx` gets corrupted, even if `LEAFIND` is intact, we're still going to be reading from the wrong leaf! This doubles the attack surface, potentially.

The solution seems straightforward. We've got `check_dmaptree` in place for dmap trees. It's a matter of adding a check *everywhere* the dmap is read to make it significantly safer. Let's see what `check_dmapctl` is doing and what we can learn from it for this scenario.



71/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:133 LineCount:50]

Results:
map[Contents: 133:		2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1
 134:	};
 135:	
 136:	/*
 137:	 * check_dmapctl - Validate integrity of a dmapctl structure
 138:	 * @dcp: Pointer to the dmapctl structure to check
 139:	 *
 140:	 * Return: true if valid, false if corrupted
 141:	 */
 142:	static bool check_dmapctl(struct dmapctl *dcp)
 143:	{
 144:		s8 budmin = dcp->budmin;
 145:		u32 nleafs, l2nleafs, leafidx, height;
 146:		int i;
 147:	
 148:		nleafs = le32_to_cpu(dcp->nleafs);
 149:		/* Check basic field ranges */
 150:		if (unlikely(nleafs > LPERCTL)) {
 151:			jfs_err("dmapctl: invalid nleafs %u (max %u)",
 152:				nleafs, LPERCTL);
 153:			return false;
 154:		}
 155:	
 156:		l2nleafs = le32_to_cpu(dcp->l2nleafs);
 157:		if (unlikely(l2nleafs > L2LPERCTL)) {
 158:			jfs_err("dmapctl: invalid l2nleafs %u (max %u)",
 159:				l2nleafs, L2LPERCTL);
 160:			return false;
 161:		}
 162:	
 163:		/* Verify nleafs matches l2nleafs (must be power of two) */
 164:		if (unlikely((1U << l2nleafs) != nleafs)) {
 165:			jfs_err("dmapctl: nleafs %u != 2^%u",
 166:				nleafs, l2nleafs);
 167:			return false;
 168:		}
 169:	
 170:		leafidx = le32_to_cpu(dcp->leafidx);
 171:		/* Check leaf index matches expected position */
 172:		if (unlikely(leafidx != CTLLEAFIND)) {
 173:			jfs_err("dmapctl: invalid leafidx %u (expected %u)",
 174:				leafidx, CTLLEAFIND);
 175:			return false;
 176:		}
 177:	
 178:		height = le32_to_cpu(dcp->height);
 179:		/* Check tree height is within valid range */
 180:		if (unlikely(height > (L2LPERCTL >> 1))) {
 181:			jfs_err("dmapctl: invalid height %u (max %u)",
 182:				height, L2LPERCTL >> 1);
]

72/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 59523
							output: 39
							thoughts: 2146
						

Thoughts:
**Analyzing `dmaptree` Validation in JFS**

Okay, so I'm looking at this `check_dmaptree` function, and it seems pretty straightforward. It's a sanity check for the `dmaptree` structure within the `dmap`. My initial thought is that if this validation is in place, it should prevent the out-of-bounds access I was worried about in those `dbJoin` and `dbSplit` calls. 

I'm making a mental note that the `dmap` structure also contains `nblocks` and `nfree`. I'm going to keep an eye on these additional checks within the `dmap` structure. It looks like just checking the `dmaptree` might be enough to prevent the specific out-of-bounds problems in those functions, but I'll make sure to verify that.

Where should I be placing the `check_dmaptree` calls? It looks like it's already implemented in `dbFree`, `dbUpdatePMap`, `dbAllocBottomUp`, `dbExtendFS`, `dbAlloc`, `dbExtend`, and `dbAllocCtl`. Okay, good. That's a good set of checks.

I'm seeing that functions like `dbAllocNext` and `dbAllocNear` also have a similar check for `leafidx`. But I can optimize this a bit. If I call the `check_dmaptree` function after I read the metapage, I could remove this redundant check. Since `dbAllocNext` and `dbAllocNear` are called from `dbAlloc` and `dbAllocCtl`, I can just check the `dmaptree` there. But, I should double-check that `dbAllocNext` is only called from `dbAlloc` and `dbAllocCtl`, and not from something like `dbAllocAG`.

Alright, I will verify the call graph for `dbAllocNext` and `dbAllocNear`, and make sure my assumption is correct before I go ahead and remove the redundant `leafidx` checks. That's a good optimization.



73/2 2026/06/30 14:46 tool codesearch-find-references
0m Args:
map[IncludeSnippetLines:0 Name:dbAllocNext SourceTreePrefix:fs/jfs/]

Results:
map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbAlloc SourceFile:fs/jfs/jfs_dmap.c SourceLine:892] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbExtend SourceFile:fs/jfs/jfs_dmap.c SourceLine:1124]] TruncatedOutput:false]

74/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 62275
							output: 39
							thoughts: 6
						

Thoughts:
Okay, here's my attempt at summarizing the thought process, speaking from the first person, and assuming I'm an expert in the field:

**Internal Monologue on Memory Allocation**

Right, so I'm thinking about memory allocation, specifically `dbAllocNear`. What's the best way to approach this? We're dealing with a system, likely embedded, where memory is a precious resource. The "Near" part of the name tells me we're probably aiming for something performance-oriented, low latency access, maybe in a specific memory region like a scratchpad or tightly coupled memory.

My initial thoughts revolve around the trade-offs. Speed versus fragmentation is always the dance we do. Am I going for a really fast, pre-allocated pool with predictable performance but potentially wasted space? Or are we considering a more dynamic, general-purpose allocator that can handle fragmentation but introduces latency? The context of where this `dbAllocNear` is used is key. Is it in a critical real-time loop, or something more background? This will heavily influence the design.

I'm starting to consider various allocation strategies. Maybe a simple bump allocator would be good if the memory regions are contiguous and the allocations are primarily for short-lived, ordered objects. I'd then have to consider, what is the size of the objects to be allocated? The efficiency of the `dbAllocNear` is paramount. I'd need to consider alignment constraints – can we work with a simpler system using word-aligned blocks, or do we need bit-precise addressing for a particular data layout? I am also considering error handling - what happens when this allocation fails, and what can I do to recover from the failure?

Furthermore, I have to think about concurrency. If there are multiple threads accessing this allocation mechanism, I'll need some form of synchronization, likely a mutex or lock-free structure, to ensure data consistency and prevent memory corruption. I need to be careful with the chosen approach. A mutex can introduce significant overhead, but a poorly implemented lock-free approach can be even worse. We need the right balance.

Then, there's the question of deallocation. Is this a system where objects are explicitly freed, or do we have some kind of garbage collection (unlikely for a "near" allocator in a performance-critical area)? The deallocation strategy will directly impact the complexity of the allocator and the potential for fragmentation. If deallocation happens, is it likely to free smaller areas, or large areas - if the smaller areas, I would think about managing free lists, which will increase the complexity.

Finally, I'm thinking about testing and debugging. How can I verify that `dbAllocNear` is working correctly? I'd need to design test cases that cover various allocation patterns, including boundary conditions, concurrent access, and error scenarios. We need to be able to detect memory leaks and corruption as quickly as possible. This requires carefully-crafted unit tests and possibly memory profiling tools. The documentation is critical - I'll need to clearly document any assumptions, limitations, and usage guidelines for this function to prevent unexpected problems down the line. It's time to dig into the existing codebase and see if there are any hints!



75/2 2026/06/30 14:46 tool codesearch-find-references
0m Args:
map[IncludeSnippetLines:0 Name:dbAllocNear SourceTreePrefix:fs/jfs/]

Results:
map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbAlloc SourceFile:fs/jfs/jfs_dmap.c SourceLine:919]] TruncatedOutput:false]

76/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 63058
							output: 41
							thoughts: 149
						

Thoughts:
**Refactoring Allocation Checks**

Okay, here's the plan. If I introduce `check_dmaptree` immediately after `read_metapage` within both `dbAlloc` and `dbExtend`, I can safely eliminate the redundant checks currently present in `dbAllocNext` and `dbAllocNear`. That's a decent simplification.

Hold on a second... what about `dbAllocCtl`? It has a direct call to `dbAllocBits`. Let me think... right, `dbAllocCtl` reads from the `dmap` and then uses the result with `dbAllocBits`. 

```c
			/* allocate the blocks. */
			dbAllocBits(bmp, dp, blkno, nb);
```

So, yes, it seems adding `check_dmaptree` within `dbAllocCtl` is absolutely crucial to maintaining data integrity. It's a key piece.

Just to be absolutely sure, I should probably double-check the implementation of `dbAllocCtl` to make sure I haven't missed anything. Gotta be meticulous about this kind of change.



77/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:1887 LineCount:50]

Results:
map[Contents:1887:	dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
1888:	{
1889:		int rc, nb;
1890:		s64 b, lblkno, n;
1891:		struct metapage *mp;
1892:		struct dmap *dp;
1893:	
1894:		/* check if the allocation request is confined to a single dmap.
1895:		 */
1896:		if (l2nb <= L2BPERDMAP) {
1897:			/* get the buffer for the dmap.
1898:			 */
1899:			lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
1900:			mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
1901:			if (mp == NULL)
1902:				return -EIO;
1903:			dp = (struct dmap *) mp->data;
1904:	
1905:			if (dp->tree.budmin < 0) {
1906:				release_metapage(mp);
1907:				return -EIO;
1908:			}
1909:	
1910:			/* try to allocate the blocks.
1911:			 */
1912:			rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results);
1913:			if (rc == 0)
1914:				mark_metapage_dirty(mp);
1915:	
1916:			release_metapage(mp);
1917:	
1918:			return (rc);
1919:		}
1920:	
1921:		/* allocation request involving multiple dmaps. it must start on
1922:		 * a dmap boundary.
1923:		 */
1924:		assert((blkno & (BPERDMAP - 1)) == 0);
1925:	
1926:		/* allocate the blocks dmap by dmap.
1927:		 */
1928:		for (n = nblocks, b = blkno; n > 0; n -= nb, b += nb) {
1929:			/* get the buffer for the dmap.
1930:			 */
1931:			lblkno = BLKTODMAP(b, bmp->db_l2nbperpage);
1932:			mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
1933:			if (mp == NULL) {
1934:				rc = -EIO;
1935:				goto backout;
1936:			}
]

78/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 64261
							output: 41
							thoughts: 595
						

Thoughts:
**Refining the dmap Tree Consistency Check**

Okay, so I see that `dbAllocCtl` reads the `dmap` structure in a couple of places. The initial instinct was to add a `check_dmaptree` call *everywhere* that `dmap` is accessed in that function, which quickly ballooned into a lot of additions. That's not the most elegant solution.

Then I considered adding `check_dmaptree` to all of the *major* allocation/deallocation functions: `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocBits`, `dbFreeBits`, and `dbFreeDmap`. That seems more targeted.

Hold on a second... `dbFreeDmap` calls `dbFreeBits`. So, checking inside `dbFreeBits` would effectively cover the `dbFreeDmap` case.

Thinking more broadly, let me list all the functions that directly *operate* on the `dmap`:

*   `dbFreeDmap`
*   `dbFreeBits`
*   `dbAllocBits`
*   `dbAllocNext`
*   `dbAllocNear`
*   `dbAllocDmapLev`

If I place the `check_dmaptree` at the *beginning* of *each* of these functions, I should have comprehensive coverage, validating the `dmap` tree before any changes are made. The `dbFreeDmap` will be indirectly taken care of by the `dbFreeBits` check. Now to just double check `dbAllocDmapLev`.



79/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2043 LineCount:20]

Results:
map[Contents:2043:	dbAllocDmapLev(struct bmap * bmp,
2044:		       struct dmap * dp, int nblocks, int l2nb, s64 * results)
2045:	{
2046:		s64 blkno;
2047:		int leafidx, rc;
2048:	
2049:		/* can't be more than a dmaps worth of blocks */
2050:		assert(l2nb <= L2BPERDMAP);
2051:	
2052:		/* search the tree within the dmap page for sufficient
2053:		 * free space.  if sufficient free space is found, dbFindLeaf()
2054:		 * returns the index of the leaf at which free space was found.
2055:		 */
2056:		if (dbFindLeaf((dmtree_t *) &dp->tree, l2nb, &leafidx, false))
2057:			return -ENOSPC;
2058:	
2059:		if (leafidx < 0)
2060:			return -EIO;
2061:	
2062:		/* determine the block number within the file system corresponding
]

80/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 65563
							output: 39
							thoughts: 233
						

Thoughts:
**Refining the DMAP Tree Integrity Checks**

Okay, so I'm looking at enhancing the error handling within the DMAP tree code. The core idea is to introduce `check_dmaptree` in several key allocation and deallocation functions to improve robustness. My initial plan is to insert this check into `dbFreeBits`, `dbAllocBits`, `dbAllocNext`, `dbAllocNear`, and `dbAllocDmapLev`.

Hold on... I just realized that `dbAllocNext` and `dbAllocNear` are *already* performing a check on the `dp->tree.leafidx`. Currently, it tests for `cpu_to_le32(LEAFIND)`. My thought is to replace this conditional with a call to `check_dmaptree`, and I can apply the same logic to `dbFreeBits`, and `dbAllocDmapLev`.

A potential wrinkle has appeared, though. I'm focusing on `dbAllocBits` now and remember that its return types are important. Specifically, `dbFreeBits` returns an `int` and `dbAllocBits` is `void`. This means `dbAllocBits` cannot directly signal an error using its return value. So, if `check_dmaptree` fails inside `dbAllocBits`, I can't simply return an error code like `-EIO`. This changes things. I need to investigate how `dbAllocBits` is used. I'll have to trace its callers to understand the broader context and see how to propagate a failure condition, or if there's an alternative. This might change my approach.



81/2 2026/06/30 14:46 tool codesearch-find-references
0m Args:
map[IncludeSnippetLines:0 Name:dbAllocBits SourceTreePrefix:fs/jfs/]

Results:
map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbAllocDmap SourceFile:fs/jfs/jfs_dmap.c SourceLine:2121] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbFreeDmap SourceFile:fs/jfs/jfs_dmap.c SourceLine:2197]] TruncatedOutput:false]

82/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 66302
							output: 28
							thoughts: 56
						

Thoughts:
Here's my take on the situation:

**Investigating the Scope of `dbAllocBits` Usage**

Okay, so I see `dbAllocBits` popping up in a bunch of crucial places: `dbAllocDmap`, `dbFreeDmap`, `dbUpdatePMap`, `dbAllocBottomUp`, `dbExtendFS`, and `dbAllocCtl`. That's a pretty diverse set of functions, all of which seem fundamental to the storage layer, and potentially the filesystems themselves. Since the function in question is so broadly used across core features, I need to get a better handle on the implications. Time to fire up the grepper and see exactly how `dbAllocBits` is utilized in each of those contexts. It's time to follow the trail.



83/2 2026/06/30 14:46 tool grepper
0m Args:
map[Expression:dbAllocBits PathPrefix:fs/jfs/]

Results:
map[Output:fs/jfs/jfs_dmap.c-63- */
fs/jfs/jfs_dmap.c:64:static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
fs/jfs/jfs_dmap.c-65-			int nblocks);
--
fs/jfs/jfs_dmap.c=2043=dbAllocDmapLev(struct bmap * bmp,
--
fs/jfs/jfs_dmap.c-2088- *		this routine allocates the specified blocks from the dmap
fs/jfs/jfs_dmap.c:2089: *		through a call to dbAllocBits(). if the allocation of the
fs/jfs/jfs_dmap.c-2090- *		block range causes the maximum string of free blocks within
--
fs/jfs/jfs_dmap.c=2109=static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
--
fs/jfs/jfs_dmap.c-2120-	/* allocate the specified (blocks) bits */
fs/jfs/jfs_dmap.c:2121:	dbAllocBits(bmp, dp, blkno, nblocks);
fs/jfs/jfs_dmap.c-2122-
--
fs/jfs/jfs_dmap.c=2164=static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
--
fs/jfs/jfs_dmap.c-2196-
fs/jfs/jfs_dmap.c:2197:		dbAllocBits(bmp, dp, blkno, nblocks);
fs/jfs/jfs_dmap.c-2198-	}
--
fs/jfs/jfs_dmap.c-2204-/*
fs/jfs/jfs_dmap.c:2205: * NAME:	dbAllocBits()
fs/jfs/jfs_dmap.c-2206- *
--
fs/jfs/jfs_dmap.c-2225- */
fs/jfs/jfs_dmap.c:2226:static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
fs/jfs/jfs_dmap.c-2227-			int nblocks)
]

84/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 67190
							output: 40
							thoughts: 36
						

Thoughts:
Okay, let's see...

**Analyzing Data Block Allocation in the System**

Hmm, it seems like `dbAllocBits` is exclusively called within `dbAllocDmap` and `dbFreeDmap`. That's interesting, and potentially a very narrow scope to consider. I need to understand if this has implications for how allocation and deallocation function together. Let's see if there's any important overlap or interaction with something like `dbUpdatePMap`. I need to ensure that the allocated bits are properly reflected across the whole system.



85/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:525 LineCount:50]

Results:
map[Contents: 525:	dbUpdatePMap(struct inode *ipbmap,
 526:		     int free, s64 blkno, s64 nblocks, struct tblock * tblk)
 527:	{
 528:		int nblks, dbitno, wbitno, rbits;
 529:		int word, nbits, nwords;
 530:		struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 531:		s64 lblkno, rem, lastlblkno;
 532:		u32 mask;
 533:		struct dmap *dp;
 534:		struct metapage *mp;
 535:		struct jfs_log *log;
 536:		int lsn, difft, diffp;
 537:		unsigned long flags;
 538:	
 539:		/* the blocks better be within the mapsize. */
 540:		if (blkno + nblocks > bmp->db_mapsize) {
 541:			printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
 542:			       (unsigned long long) blkno,
 543:			       (unsigned long long) nblocks);
 544:			jfs_error(ipbmap->i_sb, "blocks are outside the map\n");
 545:			return -EIO;
 546:		}
 547:	
 548:		/* compute delta of transaction lsn from log syncpt */
 549:		lsn = tblk->lsn;
 550:		log = (struct jfs_log *) JFS_SBI(tblk->sb)->log;
 551:		logdiff(difft, lsn, log);
 552:	
 553:		/*
 554:		 * update the block state a dmap at a time.
 555:		 */
 556:		mp = NULL;
 557:		lastlblkno = 0;
 558:		for (rem = nblocks; rem > 0; rem -= nblks, blkno += nblks) {
 559:			/* get the buffer for the current dmap. */
 560:			lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 561:			if (lblkno != lastlblkno) {
 562:				if (mp) {
 563:					write_metapage(mp);
 564:				}
 565:	
 566:				mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE,
 567:						   0);
 568:				if (mp == NULL)
 569:					return -EIO;
 570:				metapage_wait_for_io(mp);
 571:			}
 572:			dp = (struct dmap *) mp->data;
 573:	
 574:			/* determine the bit number and word within the dmap of
]

86/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 68213
							output: 40
							thoughts: 3
						

Thoughts:
Okay, I'm ready. Here's how I'll approach summarizing the "thoughts," assuming I'm an expert in the relevant field:

**Assessing the Landscape: Initial Impressions & Analysis**

Okay, here's what I'm thinking. The initial presentation is crucial – it's the foundation upon which everything else will be built. I need to quickly identify the core problem or concept being addressed. What are the key elements? What's the potential significance? Is it something novel, or a rehash of existing ideas with a new spin? I'll be looking for nuances, those little details that separate solid work from truly insightful contributions. The quality of the first impression matters enormously. I need to determine if this is a concept that warrants further investment.



87/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:575 LineCount:50]

Results:
map[Contents: 575:			 * the starting block.  also determine how many blocks
 576:			 * are to be updated within this dmap.
 577:			 */
 578:			dbitno = blkno & (BPERDMAP - 1);
 579:			word = dbitno >> L2DBWORD;
 580:			nblks = min(rem, (s64)BPERDMAP - dbitno);
 581:	
 582:			/* update the bits of the dmap words. the first and last
 583:			 * words may only have a subset of their bits updated. if
 584:			 * this is the case, we'll work against that word (i.e.
 585:			 * partial first and/or last) only in a single pass.  a
 586:			 * single pass will also be used to update all words that
 587:			 * are to have all their bits updated.
 588:			 */
 589:			for (rbits = nblks; rbits > 0;
 590:			     rbits -= nbits, dbitno += nbits) {
 591:				/* determine the bit number within the word and
 592:				 * the number of bits within the word.
 593:				 */
 594:				wbitno = dbitno & (DBWORD - 1);
 595:				nbits = min(rbits, DBWORD - wbitno);
 596:	
 597:				/* check if only part of the word is to be updated. */
 598:				if (nbits < DBWORD) {
 599:					/* update (free or allocate) the bits
 600:					 * in this word.
 601:					 */
 602:					mask =
 603:					    (ONES << (DBWORD - nbits) >> wbitno);
 604:					if (free)
 605:						dp->pmap[word] &=
 606:						    cpu_to_le32(~mask);
 607:					else
 608:						dp->pmap[word] |=
 609:						    cpu_to_le32(mask);
 610:	
 611:					word += 1;
 612:				} else {
 613:					/* one or more words are to have all
 614:					 * their bits updated.  determine how
 615:					 * many words and how many bits.
 616:					 */
 617:					nwords = rbits >> L2DBWORD;
 618:					nbits = nwords << L2DBWORD;
 619:	
 620:					/* update (free or allocate) the bits
 621:					 * in these words.
 622:					 */
 623:					if (free)
 624:						memset(&dp->pmap[word], 0,
]

88/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 69197
							output: 41
							thoughts: 311
						

Thoughts:
**Analyzing dmap Allocation and Freeing Logic**

Okay, so I'm looking at this `dbUpdatePMap` function, and it seems like it's updating `dp->pmap`, not `dp->wmap`. That's important to note. Also, it doesn't call `dbFreeBits` or `dbAllocBits` directly, which means those functions are handled elsewhere. Now, where do *those* get called? Hmm, `dbAllocBits` is called in `dbAllocDmap` and `dbFreeDmap`. Right, so `dbAllocDmap` is called by `dbAllocDmapLev`. And `dbAllocDmapLev` is ultimately called by `dbAllocCtl`. Got it. So, `dbAllocBits` is exclusively called by `dbAllocDmap` and `dbFreeDmap`, which is what I thought. Similarly, `dbFreeBits` is only called by `dbFreeDmap`. And finally, `dbFreeDmap` is called by `dbFree`.

Alright, I think I've got it. I think adding `check_dmaptree` in `dbFreeDmap`, `dbAllocDmap`, `dbAllocNext`, `dbAllocNear`, and `dbAllocDmapLev` should cover all locations where the dmap is used for allocation and freeing. But wait, `dbAllocNext` and `dbAllocNear` check `dp->tree.leafidx != cpu_to_le32(LEAFIND)`. Ah, I see - they have that check already. If I replace those with `check_dmaptree`, in addition to the other places, and then add `check_dmaptree` to `dbFreeDmap` and `dbAllocDmapLev`.... Well, I *think* that's it. Let me just confirm. Ah, `dbAllocDmap` is called by `dbAllocDmapLev`. Let me double-check that part again. Time to look at `dbAllocDmapLev` in detail.



89/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2043 LineCount:30]

Results:
map[Contents:2043:	dbAllocDmapLev(struct bmap * bmp,
2044:		       struct dmap * dp, int nblocks, int l2nb, s64 * results)
2045:	{
2046:		s64 blkno;
2047:		int leafidx, rc;
2048:	
2049:		/* can't be more than a dmaps worth of blocks */
2050:		assert(l2nb <= L2BPERDMAP);
2051:	
2052:		/* search the tree within the dmap page for sufficient
2053:		 * free space.  if sufficient free space is found, dbFindLeaf()
2054:		 * returns the index of the leaf at which free space was found.
2055:		 */
2056:		if (dbFindLeaf((dmtree_t *) &dp->tree, l2nb, &leafidx, false))
2057:			return -ENOSPC;
2058:	
2059:		if (leafidx < 0)
2060:			return -EIO;
2061:	
2062:		/* determine the block number within the file system corresponding
2063:		 * to the leaf at which free space was found.
2064:		 */
2065:		blkno = le64_to_cpu(dp->start) + (leafidx << L2DBWORD);
2066:	
2067:		/* if not all bits of the dmap word are free, get the starting
2068:		 * bit number within the dmap word of the required string of free
2069:		 * bits and adjust the block number with this value.
2070:		 */
2071:		if (dp->tree.stree[leafidx + LEAFIND] < BUDMIN)
2072:			blkno += dbFindBits(le32_to_cpu(dp->wmap[leafidx]), l2nb);
]

90/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 70507
							output: 41
							thoughts: 112
						

Thoughts:
**Checking the DMAP Tree**

Okay, so I'm thinking through the `dbAllocDmapLev` function and confirming that it, indeed, utilizes `dp->tree`. Therefore, if I want to ensure the integrity of the DMAP tree, I need to add that `check_dmaptree` function to the following locations in the code: `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, and, of course, `dbAllocDmapLev` itself. I need to make sure this is done thoroughly.

Hmm, wait a second... looking closer, `dbAllocBottomUp` calls `dbAllocBits` directly, and `dbExtendFS` also calls `dbAllocBits` directly. That's something I need to keep in mind, and so those need to be updated. Got to be thorough here.



91/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:3278 LineCount:40]

Results:
map[Contents:3278:	int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks)
3279:	{
3280:		struct metapage *mp;
3281:		struct dmap *dp;
3282:		int nb, rc;
3283:		s64 lblkno, rem;
3284:		struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
3285:		struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
3286:	
3287:		IREAD_LOCK(ipbmap, RDWRLOCK_DMAP);
3288:	
3289:		/* block to be allocated better be within the mapsize. */
3290:		ASSERT(nblocks <= bmp->db_mapsize - blkno);
3291:	
3292:		/*
3293:		 * allocate the blocks a dmap at a time.
3294:		 */
3295:		mp = NULL;
3296:		for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) {
3297:			/* release previous dmap if any */
3298:			if (mp) {
3299:				write_metapage(mp);
3300:			}
3301:	
3302:			/* get the buffer for the current dmap. */
3303:			lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
3304:			mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
3305:			if (mp == NULL) {
3306:				IREAD_UNLOCK(ipbmap);
3307:				return -EIO;
3308:			}
3309:			dp = (struct dmap *) mp->data;
3310:	
3311:			/* determine the number of blocks to be allocated from
3312:			 * this dmap.
3313:			 */
3314:			nb = min(rem, BPERDMAP - (blkno & (BPERDMAP - 1)));
3315:	
3316:			/* allocate the blocks. */
3317:			if ((rc = dbAllocDmapBU(bmp, dp, blkno, nb))) {
]

92/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 71488
							output: 41
							thoughts: 28
						

Thoughts:
Okay, here's my take on those thoughts, tailored for an expert audience:

**Tracing Down Allocation Strategies**

Right, so `dbAllocBottomUp` is the starting point here. Seems like it's delegating to `dbAllocDmapBU` – that's the key function to dissect. I need to understand the specifics of how `dbAllocDmapBU` is handling its allocation strategy. Is it using a dynamic memory allocation scheme, or something more specialized? Is it a bottom-up approach? What data structures are involved in its Dmap process? It's time to dig into the internals of `dbAllocDmapBU`. I need to assess its performance characteristics.



93/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:3335 LineCount:20]

Results:
map[Contents:3335:	{
3336:		int rc;
3337:		int dbitno, word, rembits, nb, nwords, wbitno, agno;
3338:		s8 oldroot;
3339:		struct dmaptree *tp = (struct dmaptree *) & dp->tree;
3340:	
3341:		/* save the current value of the root (i.e. maximum free string)
3342:		 * of the dmap tree.
3343:		 */
3344:		oldroot = tp->stree[ROOT];
3345:	
3346:		/* determine the bit number and word within the dmap of the
3347:		 * starting block.
3348:		 */
3349:		dbitno = blkno & (BPERDMAP - 1);
3350:		word = dbitno >> L2DBWORD;
3351:	
3352:		/* block range better be within the dmap */
3353:		assert(dbitno + nblocks <= BPERDMAP);
3354:	
]

94/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 72009
							output: 41
							thoughts: 180
						

Thoughts:
**My Analysis of Dmap Tree Consistency**

Okay, let's break this down. It looks like `dbAllocDmapBU` utilizes `tp->stree[ROOT]` and then calls `dbJoin`. Since `dbJoin` is involved, and we want to ensure the integrity of the dmap tree, it makes sense that `dbAllocDmapBU` should also incorporate the `check_dmaptree` function.

Actually, it makes more sense to consolidate the `check_dmaptree` call across all the functions that interact with the dmap, to reduce code duplication and centralize the check. So, that means adding the `check_dmaptree` call to `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbExtendFS`, since they all use `dmap`.

Hold on... what about `dbUpdatePMap`? It reads from `dmap` and updates `dp->pmap`. But the critical point is that it *doesn't* rely on `dp->tree`. Therefore, it should be safe from potential corruption related to the `dp->tree` structure, since it's not actually using the tree. That's a good relief.

Wait a second, there's `dbExtendFS`. I recall that one reads from `dmap` and then calls `dbAllocBits` directly. That's a direct interaction with the dmap. Okay, better double-check `dbExtendFS` carefully to be sure.



95/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:3645 LineCount:20]

Results:
map[Contents:3645:						/* read in dmap page: */
3646:						mp = read_metapage(ipbmap, p,
3647:								   PSIZE, 0);
3648:						if (mp == NULL)
3649:							goto errout;
3650:						n = min(nblocks, (s64)BPERDMAP - n);
3651:					} else {
3652:						/* assign/init dmap page */
3653:						mp = read_metapage(ipbmap, p,
3654:								   PSIZE, 0);
3655:						if (mp == NULL)
3656:							goto errout;
3657:	
3658:						n = min_t(s64, nblocks, BPERDMAP);
3659:					}
3660:	
3661:					dp = (struct dmap *) mp->data;
3662:					*l0leaf = dbInitDmap(dp, blkno, n);
3663:	
3664:					bmp->db_nfree += n;
]

96/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 72871
							output: 41
							thoughts: 59
						

Thoughts:
Here's my summary, as though I'm thinking through this process:

**Diving into `dbExtendFS` and `dbInitDmap`**

Okay, so `dbExtendFS` is calling `dbInitDmap`. That's the key starting point. I need to understand what `dbInitDmap` is actually *doing* to get the full picture. My immediate thought is, "What specifically does `dbInitDmap` initialize?". Ah, right, it initializes the `dmap` itself, which is a critical piece, and it *overwrites* `dp->tree`. So, any previous state, even if corrupted on disk, gets wiped out. That's good, that means we have a clean slate from which to work with! I don't need to be concerned about the integrity of the existing tree before the call to `dbInitDmap`. Now I should take a look at the code for `dbInitDmap` to understand *how* it's doing this to confirm that my mental model is correct.



97/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:3887 LineCount:20]

Results:
map[Contents:3887:				memset(&dp->pmap[w], 0, nw * 4);
3888:	
3889:				/* skip the words freed */
3890:				nb = nw << L2DBWORD;
3891:				w += nw;
3892:			}
3893:		}
3894:	
3895:		/*
3896:		 * mark bits following the range to be freed (non-existing
3897:		 * blocks) as allocated (ONES)
3898:		 */
3899:	
3900:		if (blkno == BPERDMAP)
3901:			goto initTree;
3902:	
3903:		/* the first word beyond the end of existing blocks */
3904:		w = blkno >> L2DBWORD;
3905:	
3906:		/* does nblocks fall on a 32-bit boundary ? */
]

98/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 73458
							output: 41
							thoughts: 454
						

Thoughts:
**Ensuring the Safety of the Dmap Tree**

Okay, so `dbInitDmap` is calling `dbInitDmapTree`, which means `dp->tree` is properly initialized. That’s good, so `dbExtendFS` should be safe in this context. Now, I need to pinpoint everywhere the `dmap` structure and its `tree` component are actually being *used*. Let's see:

*   `dbFreeDmap` (called by `dbFree`)
*   `dbAllocNext` (called by `dbAlloc`, `dbExtend`)
*   `dbAllocNear` (called by `dbAlloc`)
*   `dbAllocDmapLev` (called by `dbAllocCtl`)
*   `dbAllocDmapBU` (called by `dbAllocBottomUp`)

Hmm, wait a minute, what about `dbAllocBits`? It's called by both `dbAllocDmap` *and* `dbFreeDmap`. And `dbAllocDmap` itself is called by `dbAllocDmapLev`. So, if I ensure I'm using `check_dmaptree` in `dbAllocDmapLev`, then `dbAllocDmap` and, by extension, `dbAllocBits` are all protected. The same logic applies if I check the tree in `dbFreeDmap` - that would protect `dbFreeBits` and `dbAllocBits`. So, it looks like I need to integrate `check_dmaptree` in the following functions:

*   `dbFreeDmap`
*   `dbAllocNext`
*   `dbAllocNear`
*   `dbAllocDmapLev`
*   `dbAllocDmapBU`

But hold on, `dbAllocNext` and `dbAllocNear` already contain this:

```c
	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}
```

That can be replaced with the `check_dmaptree` call: `if (unlikely(!check_dmaptree(&dp->tree))) return -EIO;`. And I'll need to add that same check to `dbFreeDmap`, `dbAllocDmapLev`, and `dbAllocDmapBU`.

Alright, let's start with `dbFreeDmap` and begin the implementation.



99/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2164 LineCount:20]

Results:
map[Contents:2164:	static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2165:			      int nblocks)
2166:	{
2167:		s8 oldroot;
2168:		int rc = 0, word;
2169:	
2170:		/* save the current value of the root (i.e. maximum free string)
2171:		 * of the dmap tree.
2172:		 */
2173:		oldroot = dp->tree.stree[ROOT];
2174:	
2175:		/* free the specified (blocks) bits */
2176:		rc = dbFreeBits(bmp, dp, blkno, nblocks);
2177:	
2178:		/* if error or the root has not changed, done. */
2179:		if (rc || (dp->tree.stree[ROOT] == oldroot))
2180:			return (rc);
2181:	
2182:		/* root changed. bubble the change up to the dmap control pages.
2183:		 * if the adjustment of the upper level control pages fails,
]

100/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 74826
							output: 41
							thoughts: 69
						

Thoughts:
Here's my thought process, as requested:

**Assessing a Potential Optimization in `dbFreeDmap`**

Okay, so I'm looking at `dbFreeDmap`, and I'm thinking, "Could we short-circuit an error earlier?" The core idea is to add that check at the beginning: `if (unlikely(!check_dmaptree(&dp->tree))) return -EIO;`. That `unlikely` macro is good because this condition shouldn't happen often, so we don't want to slow down the common path.

And yeah, since `dbFreeDmap`'s return type is `int`, returning `-EIO` is perfectly valid to indicate an I/O error – that's clean and consistent. No problems there from a type-safety perspective. That's good.

Alright, let's just make sure this doesn't break anything. Before I commit to this change, I should probably check how `dbAllocDmapLev` is working and how it interacts with the rest of this code. So my next thought is, let's go see what's happening with that function.



101/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2043 LineCount:20]

Results:
map[Contents:2043:	dbAllocDmapLev(struct bmap * bmp,
2044:		       struct dmap * dp, int nblocks, int l2nb, s64 * results)
2045:	{
2046:		s64 blkno;
2047:		int leafidx, rc;
2048:	
2049:		/* can't be more than a dmaps worth of blocks */
2050:		assert(l2nb <= L2BPERDMAP);
2051:	
2052:		/* search the tree within the dmap page for sufficient
2053:		 * free space.  if sufficient free space is found, dbFindLeaf()
2054:		 * returns the index of the leaf at which free space was found.
2055:		 */
2056:		if (dbFindLeaf((dmtree_t *) &dp->tree, l2nb, &leafidx, false))
2057:			return -ENOSPC;
2058:	
2059:		if (leafidx < 0)
2060:			return -EIO;
2061:	
2062:		/* determine the block number within the file system corresponding
]

102/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 75507
							output: 41
							thoughts: 48
						

Thoughts:
Okay, here's my take on those thoughts, framed as my own:

**Analyzing `dbAllocDmapLev` and `dbAllocDmapBU` for Robustness**

Alright, I'm looking at `dbAllocDmapLev` and thinking about a potential safeguard. It occurs to me that adding `if (unlikely(!check_dmaptree(&dp->tree))) return -EIO;` right at the start of that function might be a good idea. This check would, ideally, quickly bail out with an I/O error if the dmap tree is somehow corrupt or inconsistent before any real allocation attempts are made. It's a sort of preemptive sanity check, right? Better to fail fast if something's fundamentally wrong.

Now, let's not just stop there. I need to see how that change impacts the system overall. Let's shift our focus to `dbAllocDmapBU`. I'll need to assess if this same check, or a similar one, should also be placed at the entry point of *that* function, too. My gut says it probably should, but I need to examine the specific logic of `dbAllocDmapBU` to be certain. Perhaps it calls the same underlying tree checking routine, in which case we may need to make sure the same checks can be run from each function's beginning. It's all about making sure we have consistency in our dmap integrity checks, and we should consider if `check_dmaptree` needs further scrutiny.



103/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:3334 LineCount:20]

Results:
map[Contents:3334:				 int nblocks)
3335:	{
3336:		int rc;
3337:		int dbitno, word, rembits, nb, nwords, wbitno, agno;
3338:		s8 oldroot;
3339:		struct dmaptree *tp = (struct dmaptree *) & dp->tree;
3340:	
3341:		/* save the current value of the root (i.e. maximum free string)
3342:		 * of the dmap tree.
3343:		 */
3344:		oldroot = tp->stree[ROOT];
3345:	
3346:		/* determine the bit number and word within the dmap of the
3347:		 * starting block.
3348:		 */
3349:		dbitno = blkno & (BPERDMAP - 1);
3350:		word = dbitno >> L2DBWORD;
3351:	
3352:		/* block range better be within the dmap */
3353:		assert(dbitno + nblocks <= BPERDMAP);
]

104/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 76227
							output: 41
							thoughts: 2178
						

Thoughts:
**Refining the dmap Tree Corruption Check**

Okay, so I've been mulling over the best place to add `check_dmaptree` for dmap integrity. Initially, I thought about adding it at the start of `dbAllocDmapBU`. But then, I had a thought: why not integrate it with the metapage reads? That way, we'd catch corruption right after reading from disk, which is a very clean approach.

I then did a quick scan and saw that `read_metapage` is used in a few key places: `dbFree`, `dbUpdatePMap`, `dbAllocBottomUp`, `dbExtendFS`, `dbAlloc`, `dbExtend`, and `dbAllocCtl`. I quickly checked `dbExtendFS` and found it's safe because `dbInitDmap` overwrites the tree. The initial thought was to add the check to these six spots, making it explicit and catching issues immediately after disk reads. However, `dbAllocCtl` reads `dmap` in two locations.

Then I realized that I needed to revisit `dbUpdatePMap`. I noticed that `mp` is reused in the loop if `lblkno == lastlblkno`, and if it's reused, it doesn't need to be checked in the loop. The `mp` only needs to be checked after a new read. This would clean up the loop considerably.

However, after stepping back, I remembered that `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbFreeDmap` are actually the ones that work with `dp->tree`. So, instead of adding checks everywhere `read_metapage` is called, I could just add `check_dmaptree` to *those* functions directly. This seemed cleaner and less error-prone.

So, I looked through the list and found the following:
*   `dbFreeDmap`
*   `dbAllocNext`
*   `dbAllocNear`
*   `dbAllocDmapLev`
*   `dbAllocDmapBU`

These five functions are where it really matters. It's much more localized and concise. However, `dbUpdatePMap` is fine; it's using the pmap. I also checked that `dbFreeBits` and `dbAllocBits` are called by `dbFreeDmap` and `dbAllocDmapLev`.

Wait... I just recalled that `dbAllocCtl` calls `dbAllocBits` directly. I need to re-examine that. After revisiting `dbAllocCtl` I'm good to go. I think this approach is the most efficient and robust way to ensure dmap integrity.



105/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:1926 LineCount:30]

Results:
map[Contents:1926:		/* allocate the blocks dmap by dmap.
1927:		 */
1928:		for (n = nblocks, b = blkno; n > 0; n -= nb, b += nb) {
1929:			/* get the buffer for the dmap.
1930:			 */
1931:			lblkno = BLKTODMAP(b, bmp->db_l2nbperpage);
1932:			mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
1933:			if (mp == NULL) {
1934:				rc = -EIO;
1935:				goto backout;
1936:			}
1937:			dp = (struct dmap *) mp->data;
1938:	
1939:			/* the dmap better be all free.
1940:			 */
1941:			if (dp->tree.stree[ROOT] != L2BPERDMAP) {
1942:				release_metapage(mp);
1943:				jfs_error(bmp->db_ipbmap->i_sb,
1944:					  "the dmap is not all free\n");
1945:				rc = -EIO;
1946:				goto backout;
1947:			}
1948:	
1949:			/* determine how many blocks to allocate from this dmap.
1950:			 */
1951:			nb = min_t(s64, n, BPERDMAP);
1952:	
1953:			/* allocate the blocks from the dmap.
1954:			 */
1955:			if ((rc = dbAllocDmap(bmp, dp, b, nb))) {
]

106/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 79517
							output: 41
							thoughts: 27
						

Thoughts:
Okay, here's my take on those thoughts, framed for an expert audience, and written as if they were my own:

**Investigating the Allocation Chain**

Right, so `dbAllocCtl` is clearly the entry point for allocation control, and it's calling `dbAllocDmap`. That's a good place to start digging. My initial thought process is to trace the allocation strategy, and the fact that `dbAllocCtl` is interacting with `dbAllocDmap` tells me that the primary method of allocating resources is a direct memory allocation via a Direct Memory Access Plan. I need to understand this part. I need to immediately understand the implications. Let's see what `dbAllocDmap` is all about. This is where the core allocation logic probably resides, and understanding this function is key to how the allocation strategies are implemented, and the interactions between the control and direct mapping plans. The allocation system is critical, so let's get a handle on `dbAllocDmap`.



107/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2109 LineCount:20]

Results:
map[Contents:2109:	static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2110:			       int nblocks)
2111:	{
2112:		s8 oldroot;
2113:		int rc;
2114:	
2115:		/* save the current value of the root (i.e. maximum free string)
2116:		 * of the dmap tree.
2117:		 */
2118:		oldroot = dp->tree.stree[ROOT];
2119:	
2120:		/* allocate the specified (blocks) bits */
2121:		dbAllocBits(bmp, dp, blkno, nblocks);
2122:	
2123:		/* if the root has not changed, done. */
2124:		if (dp->tree.stree[ROOT] == oldroot)
2125:			return (0);
2126:	
2127:		/* root changed. bubble the change up to the dmap control pages.
2128:		 * if the adjustment of the upper level control pages fails,
]

108/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 80107
							output: 41
							thoughts: 81
						

Thoughts:
Okay, let's see, I'm tracking down this memory allocation path. Right, so `**dbAllocCtl and Dmap Allocation Review**`, I see that `dbAllocCtl` calls `dbAllocDmap`. That's good, so any checks I put in `dbAllocDmap` will automatically cover `dbAllocCtl`, excellent. Hold on a second, though... I need to be completely thorough here. I'm pretty sure I remember `dbAllocDmapLev` also utilizing `dbAllocDmap`. Let me just quickly confirm that... I should probably investigate `dbAllocDmapLev` directly to make absolutely certain. It would be a nightmare to miss a call path in a memory management routine.



109/2 2026/06/30 14:46 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:2080 LineCount:20]

Results:
map[Contents:2080:	
2081:	
2082:	/*
2083:	 * NAME:	dbAllocDmap()
2084:	 *
2085:	 * FUNCTION:	adjust the disk allocation map to reflect the allocation
2086:	 *		of a specified block range within a dmap.
2087:	 *
2088:	 *		this routine allocates the specified blocks from the dmap
2089:	 *		through a call to dbAllocBits(). if the allocation of the
2090:	 *		block range causes the maximum string of free blocks within
2091:	 *		the dmap to change (i.e. the value of the root of the dmap's
2092:	 *		dmtree), this routine will cause this change to be reflected
2093:	 *		up through the appropriate levels of the dmap control pages
2094:	 *		by a call to dbAdjCtl() for the L0 dmap control page that
2095:	 *		covers this dmap.
2096:	 *
2097:	 * PARAMETERS:
2098:	 *	bmp	-  pointer to bmap descriptor
2099:	 *	dp	-  pointer to dmap to allocate the block range from.
]

110/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 80724
							output: 31
							thoughts: 3588
						

Thoughts:
**Dmap Tree Integrity Check Implementation**

Okay, so I've been tracing the allocation paths in the Dmap code, and I need to solidify how we're going to ensure the integrity of the Dmap tree. The initial thought was that `dbAllocDmapLev` calls `dbAllocDmap`, so if we check the tree in `dbAllocDmap` that should cover the bases. But then I saw that `dbAllocDmapLev` uses `dp->tree` *before* it calls `dbAllocDmap`. That's important. It means `dbAllocDmapLev` needs to perform this integrity check itself.

So, the key functions that interact with `dp->tree` before calling the Dmap functions are: `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU` and `dbAllocDmap`. I also need to verify that these functions are the entry points.

I then saw that `dbFreeBits` and `dbAllocBits` also use the `dp->tree`. `dbFreeBits` is called from `dbFreeDmap` and `dbAllocBits` is called by `dbAllocDmap` and `dbFreeDmap`. That reinforces the list. The `dbExtendFS` overwrites `dp->tree` and is not an entry point. `dbUpdatePMap` doesn't use `dp->tree`.

I've also looked at `dbAllocCtl` and `dbAllocDmap` interaction. We should add a check to `dbAllocDmap` because `dbAllocCtl` calls it.

I need to create a `check_dmaptree` function. Based on the existing `check_dmapctl` function, I can infer that the basic field checks, range checks on `nleafs`, `l2nleafs`, `height`, `budmin`, and the `stree` array, are going to be key. I need to make sure `nleafs` matches `l2nleafs`, that the `leafidx` is correct, that the `height` is within valid range (max 4). Also to check `budmin`, `leafidx + nleafs` within `TREESIZE`, and the values of the leaf nodes within a valid range.

Now, after carefully inspecting the existing code, I'm confident about the approach. We just replace the existing `leafidx != LEAFIND` check in `dbAllocNext` and `dbAllocNear` with the `check_dmaptree` function. I also need to make sure that the functions return `-EIO` if the tree is corrupt.

I'm ready to write the patch now.



111/2 2026/06/30 14:46 tool grepper
0m Args:
map[Expression:#define.*BUDMIN PathPrefix:fs/jfs/]

Results:
map[Output:fs/jfs/jfs_dmap.h-16-#define	L2DBWORD	5	/* l2 # of blks covered by a mword */
fs/jfs/jfs_dmap.h:17:#define BUDMIN		L2DBWORD	/* max free string in a map word */
fs/jfs/jfs_dmap.h-18-#define BPERDMAP	(LPERDMAP * DBWORD)	/* num of blks per dmap */
--
fs/jfs/jfs_dmap.h=230=struct bmap {
--
fs/jfs/jfs_dmap.h-264-/* convert number of leafs to log2 leaf value */
fs/jfs/jfs_dmap.h:265:#define	NLSTOL2BSZ(n)		(31 - cntlz((n)) + BUDMIN)
fs/jfs/jfs_dmap.h-266-
]

112/2 2026/06/30 14:46 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 85172
							output: 1622
							thoughts: 2184
						

Thoughts:
**Diving into JFS Dmap Integrity**

Okay, so I've been dissecting this JFS file system code, specifically the dmap and buddy system implementation. My initial concern was about how the `dmaptree` structure is handled, and I'm seeing a potential vulnerability. Specifically, `BUDMIN` is equal to `L2DBWORD`, which is 5, but there's a check `dtp->budmin < BUDMIN` that needs to be valid. And the `dbInitDmapTree` sets `tp->budmin = BUDMIN;`, so this makes sense.

Essentially, the issue boils down to the fact that when a `dmap` is read from disk, the `leafidx` field is directly consumed without validation, and used to compute pointers within the `stree` array which can lead to an out of bounds memory access. We are dealing with signed values for `val`, with `val < -1` being a valid range. This means that we're dealing with values from -1, 0, 1, ... up to 31 as the maximum, which makes sense because it's a log2 value.

So, here's my understanding of the problem and the proposed solution:

**Root Cause:** The JFS uses a binary buddy system for free space management. The `dmap` and `dmapctl` structures on disk store the state of this buddy system. The issue arises because when the `dmap` is read from disk, the `leafidx` field (which indicates the starting index of leaves in the `stree` array) is directly trusted. If this `leafidx` is corrupted, the resulting pointer will point outside the `stree` array's boundaries. This corruption can be triggered in the function `dbFreeDmap`, because `dbJoin` is called to update the buddy system, where it relies on this corrupted `leafidx` to access the leaf nodes, resulting in an out-of-bounds access.

**Fix:** The fix is to introduce a function, which I'm calling `check_dmaptree`, to thoroughly validate the `dmaptree` structure when it's loaded from disk. This validation will be very similar to `check_dmapctl`, but specifically tailored to the `dmaptree` structure. It's essentially a sanity check to make sure that the data read from disk is internally consistent.

Here's the validation logic I'm planning:

*   **Bounds Checks:** Make sure `nleafs` is within `LPERDMAP`, and `l2nleafs` is within `L2LPERDMAP`.
*   **Power of Two Check:** `nleafs` must match `2` raised to the power of `l2nleafs`.
*   **`leafidx` Validation:** `leafidx` should exactly be `LEAFIND`.
*   **Height Check:** The `height` must be within a valid range (<= 4).
*   **`budmin` Validation:** The `budmin` should be valid (>= `BUDMIN`).
*   **`stree` Array Bounds:** Make sure the leaf nodes (indexed by `leafidx` and `nleafs`) fit within the `stree` array.
*   **Leaf Node Value Range:** The values of the leaf nodes within the `stree` array must be within the valid range, meaning they're `>= NOFREE` and `<= 31`.

I'll be calling `check_dmaptree` in several crucial functions: `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. If `check_dmaptree` fails, I'll return `-EIO` to signal an I/O error and prevent further operations on the corrupted `dmap`, which will prevent the out of bounds memory access. This will replace existing partial checks for `leafidx` in `dbAllocNext` and `dbAllocNear` with a much more comprehensive validation routine.

I will be adding:

```c
static bool check_dmaptree(struct dmaptree *dtp)
{
	u32 nleafs, l2nleafs, leafidx, height;
	int i;

	nleafs = le32_to_cpu(dtp->nleafs);
	/* Check basic field ranges */
	if (unlikely(nleafs > LPERDMAP)) {
		jfs_err("dmaptree: invalid nleafs %u (max %u)",
			nleafs, LPERDMAP);
		return false;
	}

	l2nleafs


113/1 2026/06/30 14:46 agent history-explorer
0m Model:
best-expensive

Instruction:
You are an experienced Linux kernel developer researching prior art for fixing a kernel bug.
You are given a bug explanation. This explanation details the root cause of the bug resulting
from debugging, but does not provide the final fix strategy. Your goal is to explore how
similar bugs were fixed in the past in the same subsystem or files.

CRITICAL: Do NOT attempt to debug the issue further or write a patch for it yourself.
Your ONLY objective is to research and provide the necessary historical context.

Use the git-log tool with the Since parameter set to "3 years" to focus on recent history.
Search for commits that address issues with similar root causes (e.g. similar missing locks,
incorrect refcounting, or similar error path bugs) in the affected files.

Your final reply must summarize your findings: what idioms, locking rules, or common patterns
should be followed when writing a fix for this bug based on how previous similar bugs were addressed.
If you find no relevant past fixes, clearly state that.

Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.

Prefer calling several tools at the same time to save round-trips.

Prompt:
The crash is:

------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in /app/workdir/cache/src/7be5f73ee7b4d1978813accf8bb54cd892ccd800/fs/jfs/jfs_dmap.c:2867:24
index 4294967295 is out of range for type 's8[1365]' (aka 'signed char[1365]')
CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted syzkaller #1 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 ubsan_epilogue+0xa/0x30 lib/ubsan.c:233
 __ubsan_handle_out_of_bounds+0xe8/0xf0 lib/ubsan.c:455
 dbJoin+0xcc4/0xd60 fs/jfs/jfs_dmap.c:2867
 dbFreeBits+0x4a2/0xd70 fs/jfs/jfs_dmap.c:2427
 dbFreeDmap fs/jfs/jfs_dmap.c:2176 [inline]
 dbFree+0x324/0x650 fs/jfs/jfs_dmap.c:485
 txFreeMap+0x9e6/0xde0 fs/jfs/jfs_txnmgr.c:2517
 xtTruncate+0xd16/0x2eb0 fs/jfs/jfs_xtree.c:2481
 jfs_free_zero_link+0x35b/0x4c0 fs/jfs/namei.c:760
 jfs_evict_inode+0x356/0x430 fs/jfs/inode.c:159
 evict+0x624/0xb50 fs/inode.c:825
 txLazyCommit fs/jfs/jfs_txnmgr.c:2666 [inline]
 jfs_lazycommit+0x44c/0xac0 fs/jfs/jfs_txnmgr.c:2735
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
---[ end trace ]---


The explanation of the root cause of the bug is:

An array-index-out-of-bounds crash occurs in `dbJoin` when the JFS filesystem attempts to free blocks using a corrupted `dmap` structure read from disk.

### Root Cause

The JFS filesystem uses a binary buddy system to manage free space. The state of the buddy system is stored in `dmap` (for leaf levels) and `dmapctl` (for upper levels) structures on disk. 

When a `dmap` is read from disk, its `dmaptree` structure is not fully validated. Specifically, the `leafidx` field (which indicates the index of the first leaf in the `stree` array) is read directly from disk and used to compute pointers to the leaf nodes. 

If `leafidx` is corrupted (e.g., set to `0xffffffff` / `-1`), the computed pointer will point out of bounds of the `stree` array. When `dbFreeDmap` is called to free blocks, it calls `dbFreeBits`, which in turn calls `dbJoin` to update the buddy system. `dbJoin` uses the corrupted `leafidx` to access the leaf nodes:

```c
// fs/jfs/jfs_dmap.c:2867
leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
```

This results in an out-of-bounds memory access when `leaf[buddy]` is subsequently accessed.

While a similar integrity check (`check_dmapctl`) was recently added for `dmapctl` structures in commit `cce219b203c4` ("jfs: add dmapctl integrity check to prevent invalid operations"), the `dmap` structures (`dmaptree`) were left unchecked.

### Fix

Introduce a `check_dmaptree` function, similar to the existing `check_dmapctl` function, to validate the integrity of the `dmaptree` structure when it is used. 

The `check_dmaptree` function should verify that:
- `nleafs` is within bounds (`<= LPERDMAP`).
- `l2nleafs` is within bounds (`<= L2LPERDMAP`).
- `nleafs` matches `2^l2nleafs`.
- `leafidx` is exactly `LEAFIND`.
- `height` is within bounds (`<= 4`).
- `budmin` is valid (`>= BUDMIN`).
- The leaf nodes fit within the `stree` array (`leafidx + nleafs <= TREESIZE`).
- The values of the leaf nodes are valid (`>= NOFREE` and `<= 31`).

Call `check_dmaptree` in the functions that operate on the `dmap` structure, such as `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. If `check_dmaptree` fails, return `-EIO` to prevent further processing of the corrupted `dmap`. This will also replace the existing partial checks for `leafidx` in `dbAllocNext` and `dbAllocNear`.

```c
/*
 * check_dmaptree - Validate integrity of a dmaptree structure
 * @dtp: Pointer to the dmaptree structure to check
 *
 * Return: true if valid, false if corrupted
 */
static bool check_dmaptree(struct dmaptree *dtp)
{
	u32 nleafs, l2nleafs, leafidx, height;
	int i;

	nleafs = le32_to_cpu(dtp->nleafs);
	/* Check basic field ranges */
	if (unlikely(nleafs > LPERDMAP)) {
		jfs_err("dmaptree: invalid nleafs %u (max %u)",
			nleafs, LPERDMAP);
		return false;
	}

	l2nleafs = le32_to_cpu(dtp->l2nleafs);
	if (unlikely(l2nleafs > L2LPERDMAP)) {
		jfs_err("dmaptree: invalid l2nleafs %u (max %u)",
			l2nleafs, L2LPERDMAP);
		return false;
	}

	/* Verify nleafs matches l2nleafs (must be power of two) */
	if (unlikely((1U << l2nleafs) != nleafs)) {
		jfs_err("dmaptree: nleafs %u != 2^%u",
			nleafs, l2nleafs);
		return false;
	}

	leafidx = le32_to_cpu(dtp->leafidx);
	/* Check leaf index matches expected position */
	if (unlikely(leafidx != LEAFIND)) {
		jfs_err("dmaptree: invalid leafidx %u (expected %u)",
			leafidx, LEAFIND);
		return false;
	}

	height = le32_to_cpu(dtp->height);
	/* Check tree height is within valid range */
	if (unlikely(height > 4)) {
		jfs_err("dmaptree: invalid height %u (max 4)",
			height);
		return false;
	}

	/* Check budmin is valid */
	if (unlikely(dtp->budmin < BUDMIN)) {
		jfs_err("dmaptree: invalid budmin %d (min %d)",
			dtp->budmin, BUDMIN);
		return false;
	}

	/* Check leaf nodes fit within stree array */
	if (unlikely(leafidx + nleafs > TREESIZE)) {
		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
			leafidx + nleafs, TREESIZE);
		return false;
	}

	/* Check leaf nodes have valid values */
	for (i = leafidx; i < leafidx + nleafs; i++) {
		s8 val = dtp->stree[i];

		if (unlikely(val < NOFREE)) {
			jfs_err("dmaptree: invalid leaf value %d at index %d",
					val, i);
			return false;
		} else if (unlikely(val > 31)) {
			jfs_err("dmaptree: leaf value %d too large at index %d", val, i);
			return false;
		}
	}

	return true;
}
```

Then, in functions like `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`, add the check at the beginning:

```c
	if (unlikely(!check_dmaptree(&dp->tree))) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}
```

Reply:
Based on the research into how similar bugs were addressed in the JFS subsystem (specifically in `fs/jfs/jfs_dmap.c`), here is a summary of the idioms, locking rules, and common patterns that should be followed when writing a fix for this bug:

### 1. Dedicated Validation Function
The standard idiom for preventing out-of-bounds accesses and invalid operations due to corrupted on-disk metadata is to introduce a dedicated, standalone validation function. 
- For example, commit `cce219b203c4` ("jfs: add dmapctl integrity check to prevent invalid operations") introduced `check_dmapctl()`. 
- Following this pattern, introducing `check_dmaptree(struct dmaptree *dtp)` is the correct approach. The function should return a boolean (`true` if valid, `false` if corrupted).

### 2. Comprehensive Field Checks and Detailed Logging
The validation function must thoroughly verify the bounds and internal consistency of the structure's fields before they are used in any calculations or array indexing.
- **Consistency:** Ensure fields like `nleafs` match `2^l2nleafs`.
- **Bounds:** Check that `leafidx`, `height`, and `budmin` are within their defined macros/limits (e.g., `LEAFIND`, `BUDMIN`, `TREESIZE`).
- **Detailed Logging:** Inside the validation function, use `jfs_err()` to log the specific field that failed validation, including the corrupted value and the expected limit. This aids in debugging disk corruption issues.

### 3. Caller-Side Handling and Error Propagation
Functions that operate on the `dmap` structure (such as `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`) should invoke the validation function as early as possible.
- **Branch Prediction:** Wrap the check in the `unlikely()` macro, as corruption is the exceptional case: 
  ```c
  if (unlikely(!check_dmaptree(&dp->tree))) { ... }
  ```
- **Generic Error Logging:** If the check fails, the caller should log a generic filesystem error using `jfs_error()`. The superblock pointer can typically be accessed via the bmap descriptor: `jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");`.
- **Abort Operation:** Return `-EIO` immediately to halt further processing and prevent the out-of-bounds memory access.
- **Resource Cleanup:** While the specific functions mentioned (`dbFreeDmap`, `dbAllocNext`, etc.) do not directly hold a metapage reference that needs releasing at their entry points, the general pattern (seen in `dbAllocAG` and `dbFindCtl`) dictates that any held resources (like `release_metapage(mp)`) must be freed before returning `-EIO`.

### 4. Locking Rules
The integrity checks do not require any new locks. They should be performed synchronously within the existing locking context of the callers. 
- Functions like `dbFreeDmap` and `dbAllocNext` are already serialized via `IREAD_LOCK(ipbmap)` or `IWRITE_LOCK(ipbmap)` upon entry. 
- The validation simply acts as a safe, read-only guard rail before the code proceeds to modify the buddy system state or traverse the tree.

114/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 6191
							output: 40
							thoughts: 217
						

Thoughts:
**Investigating the JFS Kernel Bug**

Okay, so we've got an array-index-out-of-bounds bug in `dbJoin` within the JFS filesystem, and it looks like it's being triggered by a corrupted `dmap` structure retrieved from disk. My first instinct is to dig into the prior art here, to see how similar problems have been tackled.

The description mentions that they added an integrity check (`check_dmapctl`) for `dmapctl` structures fairly recently in commit `cce219b203c4`. That's a great lead. I need to pull up the code for that commit – I'll use `git log` to find it quickly and examine the implementation of `check_dmapctl`. My immediate goal is to understand the methodology behind that check. What kind of corruption was it designed to catch? What was the general approach?

Then I'll shift my search slightly. I'll need a new function called `check_dmaptree` and it looks like it needs to be used in `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. I will look for other similar fixes in `fs/jfs/jfs_dmap.c`, to see if there are any other integrity checks in this file. That will hopefully help me determine the appropriate implementation strategy for `check_dmaptree`. From there, I can analyze the code, understand the root cause of the `dbJoin` issue, and determine the optimal strategy for mitigation.



115/2 2026/06/30 14:46 tool git-log
0m Args:
map[Count:10 PathPrefix:fs/jfs/jfs_dmap.c Since:3 years]

Results:
map[Output:cce219b203c4 jfs: add dmapctl integrity check to prevent invalid operations
bf4afc53b77a Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
69050f8d6d07 treewide: Replace kmalloc with kmalloc_obj for non-scalar types
856db3759202 jfs: fix metapage reference count leak in dbAllocCtl
c214006856ff jfs: upper bound check of tree index in dbAllocAG
37bfb464ddca jfs: validate AG parameters in dbMount() to prevent crashes
0d250b1c5248 fs/jfs: consolidate sanity checking in dbMount
ddf2846f22e8 jfs: add sanity check for agwidth in dbMount
7fcbf789629c fs/jfs: Prevent integer overflow in AG size calculation
70ca3246ad20 fs/jfs: cast inactags to s64 to prevent potential overflow
]

116/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 7063
							output: 52
							thoughts: 44
						

Thoughts:
Okay, here's my interpretation of those code snippets as if they were my own mental processes, keeping in mind my expertise:

**Diving into the Code: Initial Assessment**

Alright, let's get down to brass tacks. I need to take a look at these three specific code snippets: `cce219b203c4`, `c214006856ff`, and `37bfb464ddca`. Just seeing the identifiers, I'm already forming some initial hypotheses. Are these commit hashes? Function names? Specific data points? Context is key here. Given the format, my instincts lean towards thinking these are probably version control identifiers, perhaps Git commit SHAs, or unique identifiers within a larger system. However, until I have more context, I'm hesitant to make definitive judgements. My priority is to analyze the relationship, if any, between these three IDs. Are they related in sequence or purpose? Are there any obvious patterns or dependencies that jump out? The goal is to determine the scope of these particular areas of code and see if there are commonalities or relationships between them. Let's see what these snippets tell me.



117/2 2026/06/30 14:46 tool git-show
0m Args:
map[Commit:cce219b203c4]

Results:
map[Output:commit cce219b203c4b9cb445e910c7090d1f58af847c5
Author: Yun Zhou <yun.zhou@windriver.com>
Date:   Fri Nov 28 23:51:50 2025 +0800

    jfs: add dmapctl integrity check to prevent invalid operations
    
    Add check_dmapctl() to validate dmapctl structure integrity, focusing on
    preventing invalid operations caused by on-disk corruption.
    
    Key checks:
     - nleafs bounded by [0, LPERCTL] (maximum leaf nodes per dmapctl).
     - l2nleafs bounded by [0, L2LPERCTL] and consistent with nleafs
       (nleafs must be 2^l2nleafs).
     - leafidx must be exactly CTLLEAFIND (expected leaf index position).
     - height bounded by [0, L2LPERCTL >> 1] (valid tree height range).
     - budmin validity: NOFREE only if nleafs=0; otherwise >= BUDMIN.
     - Leaf nodes fit within stree array (leafidx + nleafs <= CTLTREESIZE).
     - Leaf node values are either non-negative or NOFREE.
    
    Invoked in dbAllocAG(), dbFindCtl(), dbAdjCtl() and dbExtendFS() when
    accessing dmapctl pages, catching corruption early before dmap operations
    trigger invalid memory access or logic errors.
    
    This fixes the following UBSAN warning.
    
    [58245.668090][T14017] ------------[ cut here ]------------
    [58245.668103][T14017] UBSAN: shift-out-of-bounds in fs/jfs/jfs_dmap.c:2641:11
    [58245.668119][T14017] shift exponent 110 is too large for 32-bit type 'int'
    [58245.668137][T14017] CPU: 0 UID: 0 PID: 14017 Comm: 4c1966e88c28fa9 Tainted: G            E       6.18.0-rc4-00253-g21ce5d4ba045-dirty #124 PREEMPT_{RT,(full)}
    [58245.668174][T14017] Tainted: [E]=UNSIGNED_MODULE
    [58245.668176][T14017] Hardware name: QEMU Ubuntu 25.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
    [58245.668184][T14017] Call Trace:
    [58245.668200][T14017]  <TASK>
    [58245.668208][T14017]  dump_stack_lvl+0x189/0x250
    [58245.668288][T14017]  ? __pfx_dump_stack_lvl+0x10/0x10
    [58245.668301][T14017]  ? __pfx__printk+0x10/0x10
    [58245.668315][T14017]  ? lock_metapage+0x303/0x400 [jfs]
    [58245.668406][T14017]  ubsan_epilogue+0xa/0x40
    [58245.668422][T14017]  __ubsan_handle_shift_out_of_bounds+0x386/0x410
    [58245.668462][T14017]  dbSplit+0x1f8/0x200 [jfs]
    [58245.668543][T14017]  dbAdjCtl+0x34c/0xa20 [jfs]
    [58245.668628][T14017]  dbAllocNear+0x2ee/0x3d0 [jfs]
    [58245.668710][T14017]  dbAlloc+0x933/0xba0 [jfs]
    [58245.668797][T14017]  ea_write+0x374/0xdd0 [jfs]
    [58245.668888][T14017]  ? __pfx_ea_write+0x10/0x10 [jfs]
    [58245.668966][T14017]  ? __jfs_setxattr+0x76e/0x1120 [jfs]
    [58245.669046][T14017]  __jfs_setxattr+0xa01/0x1120 [jfs]
    [58245.669135][T14017]  ? __pfx___jfs_setxattr+0x10/0x10 [jfs]
    [58245.669216][T14017]  ? mutex_lock_nested+0x154/0x1d0
    [58245.669252][T14017]  ? __jfs_xattr_set+0xb9/0x170 [jfs]
    [58245.669333][T14017]  __jfs_xattr_set+0xda/0x170 [jfs]
    [58245.669430][T14017]  ? __pfx___jfs_xattr_set+0x10/0x10 [jfs]
    [58245.669509][T14017]  ? xattr_full_name+0x6f/0x90
    [58245.669546][T14017]  ? jfs_xattr_set+0x33/0x60 [jfs]
    [58245.669636][T14017]  ? __pfx_jfs_xattr_set+0x10/0x10 [jfs]
    [58245.669726][T14017]  __vfs_setxattr+0x43c/0x480
    [58245.669743][T14017]  __vfs_setxattr_noperm+0x12d/0x660
    [58245.669756][T14017]  vfs_setxattr+0x16b/0x2f0
    [58245.669768][T14017]  ? __pfx_vfs_setxattr+0x10/0x10
    [58245.669782][T14017]  filename_setxattr+0x274/0x600
    [58245.669795][T14017]  ? __pfx_filename_setxattr+0x10/0x10
    [58245.669806][T14017]  ? getname_flags+0x1e5/0x540
    [58245.669829][T14017]  path_setxattrat+0x364/0x3a0
    [58245.669840][T14017]  ? __pfx_path_setxattrat+0x10/0x10
    [58245.669859][T14017]  ? __se_sys_chdir+0x1b9/0x280
    [58245.669876][T14017]  __x64_sys_lsetxattr+0xbf/0xe0
    [58245.669888][T14017]  do_syscall_64+0xfa/0xfa0
    [58245.669901][T14017]  ? lockdep_hardirqs_on+0x9c/0x150
    [58245.669913][T14017]  ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
    [58245.669927][T14017]  ? exc_page_fault+0xab/0x100
    [58245.669937][T14017]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Reported-by: syzbot+4c1966e88c28fa96e053@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=4c1966e88c28fa96e053
    Signed-off-by: Yun Zhou <yun.zhou@windriver.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 2abe8cc02ee6..a841cf21da7d 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -133,6 +133,93 @@ static const s8 budtab[256] = {
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1
 };
 
+/*
+ * check_dmapctl - Validate integrity of a dmapctl structure
+ * @dcp: Pointer to the dmapctl structure to check
+ *
+ * Return: true if valid, false if corrupted
+ */
+static bool check_dmapctl(struct dmapctl *dcp)
+{
+	s8 budmin = dcp->budmin;
+	u32 nleafs, l2nleafs, leafidx, height;
+	int i;
+
+	nleafs = le32_to_cpu(dcp->nleafs);
+	/* Check basic field ranges */
+	if (unlikely(nleafs > LPERCTL)) {
+		jfs_err("dmapctl: invalid nleafs %u (max %u)",
+			nleafs, LPERCTL);
+		return false;
+	}
+
+	l2nleafs = le32_to_cpu(dcp->l2nleafs);
+	if (unlikely(l2nleafs > L2LPERCTL)) {
+		jfs_err("dmapctl: invalid l2nleafs %u (max %u)",
+			l2nleafs, L2LPERCTL);
+		return false;
+	}
+
+	/* Verify nleafs matches l2nleafs (must be power of two) */
+	if (unlikely((1U << l2nleafs) != nleafs)) {
+		jfs_err("dmapctl: nleafs %u != 2^%u",
+			nleafs, l2nleafs);
+		return false;
+	}
+
+	leafidx = le32_to_cpu(dcp->leafidx);
+	/* Check leaf index matches expected position */
+	if (unlikely(leafidx != CTLLEAFIND)) {
+		jfs_err("dmapctl: invalid leafidx %u (expected %u)",
+			leafidx, CTLLEAFIND);
+		return false;
+	}
+
+	height = le32_to_cpu(dcp->height);
+	/* Check tree height is within valid range */
+	if (unlikely(height > (L2LPERCTL >> 1))) {
+		jfs_err("dmapctl: invalid height %u (max %u)",
+			height, L2LPERCTL >> 1);
+		return false;
+	}
+
+	/* Check budmin is valid (cannot be NOFREE for non-empty tree) */
+	if (budmin == NOFREE) {
+		if (unlikely(nleafs > 0)) {
+			jfs_err("dmapctl: budmin is NOFREE but nleafs %u",
+				nleafs);
+			return false;
+		}
+	} else if (unlikely(budmin < BUDMIN)) {
+		jfs_err("dmapctl: invalid budmin %d (min %d)",
+			budmin, BUDMIN);
+		return false;
+	}
+
+	/* Check leaf nodes fit within stree array */
+	if (unlikely(leafidx + nleafs > CTLTREESIZE)) {
+		jfs_err("dmapctl: leaf range exceeds stree size (end %u > %u)",
+			leafidx + nleafs, CTLTREESIZE);
+		return false;
+	}
+
+	/* Check leaf nodes have valid values */
+	for (i = leafidx; i < leafidx + nleafs; i++) {
+		s8 val = dcp->stree[i];
+
+		if (unlikely(val < NOFREE)) {
+			jfs_err("dmapctl: invalid leaf value %d at index %d",
+					val, i);
+			return false;
+		} else if (unlikely(val > 31)) {
+			jfs_err("dmapctl: leaf value %d too large at index %d", val, i);
+			return false;
+		}
+	}
+
+	return true;
+}
+
 /*
  * NAME:	dbMount()
  *
@@ -1372,7 +1459,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
 	dcp = (struct dmapctl *) mp->data;
 	budmin = dcp->budmin;
 
-	if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
+	if (unlikely(!check_dmapctl(dcp))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
 		release_metapage(mp);
 		return -EIO;
@@ -1702,7 +1789,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
 		dcp = (struct dmapctl *) mp->data;
 		budmin = dcp->budmin;
 
-		if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
+		if (unlikely(!check_dmapctl(dcp))) {
 			jfs_error(bmp->db_ipbmap->i_sb,
 				  "Corrupt dmapctl page\n");
 			release_metapage(mp);
@@ -2485,7 +2572,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
 		return -EIO;
 	dcp = (struct dmapctl *) mp->data;
 
-	if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
+	if (unlikely(!check_dmapctl(dcp))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
 		release_metapage(mp);
 		return -EIO;
@@ -3454,6 +3541,11 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 		return -EIO;
 	}
 	l2dcp = (struct dmapctl *) l2mp->data;
+	if (unlikely(!check_dmapctl(l2dcp))) {
+		jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
+		release_metapage(l2mp);
+		return -EIO;
+	}
 
 	/* compute start L1 */
 	k = blkno >> L2MAXL1SIZE;
@@ -3471,6 +3563,10 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 			if (l1mp == NULL)
 				goto errout;
 			l1dcp = (struct dmapctl *) l1mp->data;
+			if (unlikely(!check_dmapctl(l1dcp))) {
+				jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
+				goto errout;
+			}
 
 			/* compute start L0 */
 			j = (blkno & (MAXL1SIZE - 1)) >> L2MAXL0SIZE;
@@ -3484,6 +3580,10 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 				goto errout;
 
 			l1dcp = (struct dmapctl *) l1mp->data;
+			if (unlikely(!check_dmapctl(l1dcp))) {
+				jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
+				goto errout;
+			}
 
 			/* compute start L0 */
 			j = 0;
@@ -3503,6 +3603,10 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 				if (l0mp == NULL)
 					goto errout;
 				l0dcp = (struct dmapctl *) l0mp->data;
+				if (unlikely(!check_dmapctl(l0dcp))) {
+					jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
+					goto errout;
+				}
 
 				/* compute start dmap */
 				i = (blkno & (MAXL0SIZE - 1)) >>
@@ -3518,6 +3622,10 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno,	s64 nblocks)
 					goto errout;
 
 				l0dcp = (struct dmapctl *) l0mp->data;
+				if (unlikely(!check_dmapctl(l0dcp))) {
+					jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
+					goto errout;
+				}
 
 				/* compute start dmap */
 				i = 0;
]

118/2 2026/06/30 14:46 tool git-show
0m Args:
map[Commit:c214006856ff]

Results:
map[Output:commit c214006856ff52a8ff17ed8da52d50601d54f9ce
Author: Arnaud Lecomte <contact@arnaud-lcm.com>
Date:   Thu Apr 24 00:13:51 2025 +0200

    jfs: upper bound check of tree index in dbAllocAG
    
    When computing the tree index in dbAllocAG, we never check if we are
    out of bounds realative to the size of the stree.
    This could happen in a scenario where the filesystem metadata are
    corrupted.
    
    Reported-by: syzbot+cffd18309153948f3c3e@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=cffd18309153948f3c3e
    Tested-by: syzbot+cffd18309153948f3c3e@syzkaller.appspotmail.com
    Signed-off-by: Arnaud Lecomte <contact@arnaud-lcm.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 35e063c9f3a4..5080d59089bd 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -1389,6 +1389,12 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
 	    (1 << (L2LPERCTL - (bmp->db_agheight << 1))) / bmp->db_agwidth;
 	ti = bmp->db_agstart + bmp->db_agwidth * (agno & (agperlev - 1));
 
+	if (ti < 0 || ti >= le32_to_cpu(dcp->nleafs)) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
+		release_metapage(mp);
+		return -EIO;
+	}
+
 	/* dmap control page trees fan-out by 4 and a single allocation
 	 * group may be described by 1 or 2 subtrees within the ag level
 	 * dmap control page, depending upon the ag size. examine the ag's
]

119/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 13176
							output: 31
							thoughts: 116
						

Thoughts:
Okay, let's break this down.

**Analyzing the JFS Integrity Fixes**

Alright, so commit `cce219b203c4` caught my attention. It introduced `check_dmapctl` to validate `dmapctl` structures, which is a good step towards improving JFS's robustness. Now, the note mentions that the `dmaptree` fix mirrors this approach. My gut tells me this is likely referring to ensuring the integrity of the `dmaptree` structures associated with the dmap, which is critical for preventing corruption and invalid operations, especially during crucial file system operations. The introduction of a `check_dmaptree` function and its invocation within dmap-manipulating functions makes perfect sense. To get a better understanding of its application, I think checking `fs/jfs/jfs_dmap.c` will provide the most information on how and where this new integrity check is being implemented and to what degree. Knowing the functions that are modified will give some idea of where there might have been the chance for invalid structures in the past.



120/2 2026/06/30 14:46 tool codesearch-file-index
0m Args:
map[SourceFile:fs/jfs/jfs_dmap.c]

Results:
map[Entities:[map[Kind:function Name:blkstol2] map[Kind:function Name:check_dmapctl] map[Kind:function Name:cntlz] map[Kind:function Name:cnttz] map[Kind:function Name:dbAdjCtl] map[Kind:function Name:dbAdjTree] map[Kind:function Name:dbAlloc] map[Kind:function Name:dbAllocAG] map[Kind:function Name:dbAllocAny] map[Kind:function Name:dbAllocBits] map[Kind:function Name:dbAllocBottomUp] map[Kind:function Name:dbAllocCtl] map[Kind:function Name:dbAllocDmap] map[Kind:function Name:dbAllocDmapBU] map[Kind:function Name:dbAllocDmapLev] map[Kind:function Name:dbAllocNear] map[Kind:function Name:dbAllocNext] map[Kind:function Name:dbBackSplit] map[Kind:function Name:dbDiscardAG] map[Kind:function Name:dbExtend] map[Kind:function Name:dbExtendFS] map[Kind:function Name:dbFinalizeBmap] map[Kind:function Name:dbFindBits] map[Kind:function Name:dbFindCtl] map[Kind:function Name:dbFindLeaf] map[Kind:function Name:dbFree] map[Kind:function Name:dbFreeBits] map[Kind:function Name:dbFreeDmap] map[Kind:function Name:dbGetL2AGSize] map[Kind:function Name:dbInitDmap] map[Kind:function Name:dbInitDmapCtl] map[Kind:function Name:dbInitDmapTree] map[Kind:function Name:dbInitTree] map[Kind:function Name:dbJoin] map[Kind:function Name:dbMapFileSizeToMapSize] map[Kind:function Name:dbMaxBud] map[Kind:function Name:dbMount] map[Kind:function Name:dbNextAG] map[Kind:function Name:dbReAlloc] map[Kind:function Name:dbSplit] map[Kind:function Name:dbSync] map[Kind:function Name:dbUnmount] map[Kind:function Name:dbUpdatePMap] map[Kind:struct Name:range2trim] map[Kind:global_variable Name:budtab]]]

121/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 14218
							output: 54
							thoughts: 149
						

Thoughts:
**Analyzing Past Fixes to Guide the Current Bug Resolution**

Okay, so the user wants me to dive into the history books, so to speak, and see how similar problems in this `fs/jfs` subsystem, specifically those related to dmap allocation, were handled before. My job is to distill these past experiences into actionable insights: which idioms were favored? Were there specific locking protocols that consistently proved effective? Are there recognizable patterns in how these issues were tackled? This should give us a good set of best practices to guide writing a reliable fix.

The current proposed solution, adding and calling `check_dmaptree` in several `dbAlloc` and `dbFree` functions (`dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`), sounds like a good starting point. I need to understand the rationale and context behind it. Let's start by scrutinizing the existing `check_dmapctl` function in `fs/jfs/jfs_dmap.c`. How is it used? What is its scope? This will give me a point of reference to build on as I look at these prior fixes.



122/2 2026/06/30 14:46 tool codesearch-find-references
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c IncludeSnippetLines:2 Name:check_dmapctl SourceTreePrefix:]

Results:
map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2575 SourceSnippet:2573:		dcp = (struct dmapctl *) mp->data;
2574:	
2575:		if (unlikely(!check_dmapctl(dcp))) {
2576:			jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
2577:			release_metapage(mp);
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbAllocAG SourceFile:fs/jfs/jfs_dmap.c SourceLine:1462 SourceSnippet:1460:		budmin = dcp->budmin;
1461:	
1462:		if (unlikely(!check_dmapctl(dcp))) {
1463:			jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
1464:			release_metapage(mp);
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbExtendFS SourceFile:fs/jfs/jfs_dmap.c SourceLine:3544 SourceSnippet:3542:		}
3543:		l2dcp = (struct dmapctl *) l2mp->data;
3544:		if (unlikely(!check_dmapctl(l2dcp))) {
3545:			jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
3546:			release_metapage(l2mp);
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbExtendFS SourceFile:fs/jfs/jfs_dmap.c SourceLine:3566 SourceSnippet:3564:					goto errout;
3565:				l1dcp = (struct dmapctl *) l1mp->data;
3566:				if (unlikely(!check_dmapctl(l1dcp))) {
3567:					jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
3568:					goto errout;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbExtendFS SourceFile:fs/jfs/jfs_dmap.c SourceLine:3583 SourceSnippet:3581:	
3582:				l1dcp = (struct dmapctl *) l1mp->data;
3583:				if (unlikely(!check_dmapctl(l1dcp))) {
3584:					jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
3585:					goto errout;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbExtendFS SourceFile:fs/jfs/jfs_dmap.c SourceLine:3606 SourceSnippet:3604:						goto errout;
3605:					l0dcp = (struct dmapctl *) l0mp->data;
3606:					if (unlikely(!check_dmapctl(l0dcp))) {
3607:						jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
3608:						goto errout;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbExtendFS SourceFile:fs/jfs/jfs_dmap.c SourceLine:3625 SourceSnippet:3623:	
3624:					l0dcp = (struct dmapctl *) l0mp->data;
3625:					if (unlikely(!check_dmapctl(l0dcp))) {
3626:						jfs_error(ipbmap->i_sb, "Corrupt dmapctl page\n");
3627:						goto errout;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbFindCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:1792 SourceSnippet:1790:			budmin = dcp->budmin;
1791:	
1792:			if (unlikely(!check_dmapctl(dcp))) {
1793:				jfs_error(bmp->db_ipbmap->i_sb,
1794:					  "Corrupt dmapctl page\n");
]] TruncatedOutput:false]

123/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 15947
							output: 79
							thoughts: 162
						

Thoughts:
**Analyzing the dmapctl Corruption Check**

Okay, so I'm looking at this error handling pattern, and it's pretty straightforward. It boils down to this: `if (unlikely(!check_dmapctl(dcp))) { /* Error handling */ }`. I've seen this a million times – the code checks `check_dmapctl`, and if that's *unlikely* to be successful, it means there's a problem, likely corruption, with the `dmapctl` page. The error handling then involves logging the error, releasing the metapage, and returning `-EIO`. Standard stuff for signaling a critical I/O error.

The interesting bit is where this check *should* be added. The comment suggests we integrate the `check_dmaptree` function. Right, so I need to go through the code, looking at those functions mentioned: `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. I need to ensure the check is included in any of those functions that interact with the DMAP control structure, and I'll need to figure out where they are returning a value - `goto errout` or another similar method to propagate the error. My job now is to determine if this pattern is correctly implemented or if any functions are missing this critical check, and how they propagate the error.



124/2 2026/06/30 14:46 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbFreeDmap]

Results:
map[SourceCode:2138:	/*
2139:	 * NAME:	dbFreeDmap()
2140:	 *
2141:	 * FUNCTION:	adjust the disk allocation map to reflect the allocation
2142:	 *		of a specified block range within a dmap.
2143:	 *
2144:	 *		this routine frees the specified blocks from the dmap through
2145:	 *		a call to dbFreeBits(). if the deallocation of the block range
2146:	 *		causes the maximum string of free blocks within the dmap to
2147:	 *		change (i.e. the value of the root of the dmap's dmtree), this
2148:	 *		routine will cause this change to be reflected up through the
2149:	 *		appropriate levels of the dmap control pages by a call to
2150:	 *		dbAdjCtl() for the L0 dmap control page that covers this dmap.
2151:	 *
2152:	 * PARAMETERS:
2153:	 *	bmp	-  pointer to bmap descriptor
2154:	 *	dp	-  pointer to dmap to free the block range from.
2155:	 *	blkno	-  starting block number of the block to be freed.
2156:	 *	nblocks	-  number of blocks to be freed.
2157:	 *
2158:	 * RETURN VALUES:
2159:	 *	0	- success
2160:	 *	-EIO	- i/o error
2161:	 *
2162:	 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
2163:	 */
2164:	static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2165:			      int nblocks)
2166:	{
2167:		s8 oldroot;
2168:		int rc = 0, word;
2169:	
2170:		/* save the current value of the root (i.e. maximum free string)
2171:		 * of the dmap tree.
2172:		 */
2173:		oldroot = dp->tree.stree[ROOT];
2174:	
2175:		/* free the specified (blocks) bits */
2176:		rc = dbFreeBits(bmp, dp, blkno, nblocks);
2177:	
2178:		/* if error or the root has not changed, done. */
2179:		if (rc || (dp->tree.stree[ROOT] == oldroot))
2180:			return (rc);
2181:	
2182:		/* root changed. bubble the change up to the dmap control pages.
2183:		 * if the adjustment of the upper level control pages fails,
2184:		 * backout the deallocation.
2185:		 */
2186:		if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 0, 0))) {
2187:			word = (blkno & (BPERDMAP - 1)) >> L2DBWORD;
2188:	
2189:			/* as part of backing out the deallocation, we will have
2190:			 * to back split the dmap tree if the deallocation caused
2191:			 * the freed blocks to become part of a larger binary buddy
2192:			 * system.
2193:			 */
2194:			if (dp->tree.stree[word] == NOFREE)
2195:				dbBackSplit((dmtree_t *)&dp->tree, word, false);
2196:	
2197:			dbAllocBits(bmp, dp, blkno, nblocks);
2198:		}
2199:	
2200:		return (rc);
2201:	}
 SourceFile:fs/jfs/jfs_dmap.c]

125/2 2026/06/30 14:46 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocNext]

Results:
map[SourceCode:1139:	/*
1140:	 * NAME:	dbAllocNext()
1141:	 *
1142:	 * FUNCTION:	attempt to allocate the blocks of the specified block
1143:	 *		range within a dmap.
1144:	 *
1145:	 * PARAMETERS:
1146:	 *	bmp	-  pointer to bmap descriptor
1147:	 *	dp	-  pointer to dmap.
1148:	 *	blkno	-  starting block number of the range.
1149:	 *	nblocks	-  number of contiguous free blocks of the range.
1150:	 *
1151:	 * RETURN VALUES:
1152:	 *	0	- success
1153:	 *	-ENOSPC	- insufficient disk resources
1154:	 *	-EIO	- i/o error
1155:	 *
1156:	 * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
1157:	 */
1158:	static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
1159:			       int nblocks)
1160:	{
1161:		int dbitno, word, rembits, nb, nwords, wbitno, nw;
1162:		int l2size;
1163:		s8 *leaf;
1164:		u32 mask;
1165:	
1166:		if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
1167:			jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
1168:			return -EIO;
1169:		}
1170:	
1171:		/* pick up a pointer to the leaves of the dmap tree.
1172:		 */
1173:		leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx);
1174:	
1175:		/* determine the bit number and word within the dmap of the
1176:		 * starting block.
1177:		 */
1178:		dbitno = blkno & (BPERDMAP - 1);
1179:		word = dbitno >> L2DBWORD;
1180:	
1181:		/* check if the specified block range is contained within
1182:		 * this dmap.
1183:		 */
1184:		if (dbitno + nblocks > BPERDMAP)
1185:			return -ENOSPC;
1186:	
1187:		/* check if the starting leaf indicates that anything
1188:		 * is free.
1189:		 */
1190:		if (leaf[word] == NOFREE)
1191:			return -ENOSPC;
1192:	
1193:		/* check the dmaps words corresponding to block range to see
1194:		 * if the block range is free.  not all bits of the first and
1195:		 * last words may be contained within the block range.  if this
1196:		 * is the case, we'll work against those words (i.e. partial first
1197:		 * and/or last) on an individual basis (a single pass) and examine
1198:		 * the actual bits to determine if they are free.  a single pass
1199:		 * will be used for all dmap words fully contained within the
1200:		 * specified range.  within this pass, the leaves of the dmap
1201:		 * tree will be examined to determine if the blocks are free. a
1202:		 * single leaf may describe the free space of multiple dmap
1203:		 * words, so we may visit only a subset of the actual leaves
1204:		 * corresponding to the dmap words of the block range.
1205:		 */
1206:		for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
1207:			/* determine the bit number within the word and
1208:			 * the number of bits within the word.
1209:			 */
1210:			wbitno = dbitno & (DBWORD - 1);
1211:			nb = min(rembits, DBWORD - wbitno);
1212:	
1213:			/* check if only part of the word is to be examined.
1214:			 */
1215:			if (nb < DBWORD) {
1216:				/* check if the bits are free.
1217:				 */
1218:				mask = (ONES << (DBWORD - nb) >> wbitno);
1219:				if ((mask & ~le32_to_cpu(dp->wmap[word])) != mask)
1220:					return -ENOSPC;
1221:	
1222:				word += 1;
1223:			} else {
1224:				/* one or more dmap words are fully contained
1225:				 * within the block range.  determine how many
1226:				 * words and how many bits.
1227:				 */
1228:				nwords = rembits >> L2DBWORD;
1229:				nb = nwords << L2DBWORD;
1230:	
1231:				/* now examine the appropriate leaves to determine
1232:				 * if the blocks are free.
1233:				 */
1234:				while (nwords > 0) {
1235:					/* does the leaf describe any free space ?
1236:					 */
1237:					if (leaf[word] < BUDMIN)
1238:						return -ENOSPC;
1239:	
1240:					/* determine the l2 number of bits provided
1241:					 * by this leaf.
1242:					 */
1243:					l2size =
1244:					    min_t(int, leaf[word], NLSTOL2BSZ(nwords));
1245:	
1246:					/* determine how many words were handled.
1247:					 */
1248:					nw = BUDSIZE(l2size, BUDMIN);
1249:	
1250:					nwords -= nw;
1251:					word += nw;
1252:				}
1253:			}
1254:		}
1255:	
1256:		/* allocate the blocks.
1257:		 */
1258:		return (dbAllocDmap(bmp, dp, blkno, nblocks));
1259:	}
 SourceFile:fs/jfs/jfs_dmap.c]

126/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 19394
							output: 39
							thoughts: 123
						

Thoughts:
**Analyzing the `dbAllocNext` Bug Fix**

Okay, so looking at this code snippet from `dbAllocNext`, it's clear we're dealing with a check for `leafidx`. Specifically, it appears to be ensuring that the `leafidx` field within the data structure (`dp->tree.leafidx`) matches a predefined expected value, `LEAFIND`. The check itself is straightforward: if it *doesn't* match, we log an error ("Corrupt dmap page") and return an I/O error (`-EIO`).

This is pretty much verbatim what the bug description mentioned, that this check is going to replace the partial checks. So, the bugfix explanation is on point. Now, to make sure this is comprehensive, I should also check `dbAllocNear` to confirm the code's consistency. Let's dig into that next.



127/2 2026/06/30 14:46 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocNear]

Results:
map[SourceCode:1262:	/*
1263:	 * NAME:	dbAllocNear()
1264:	 *
1265:	 * FUNCTION:	attempt to allocate a number of contiguous free blocks near
1266:	 *		a specified block (hint) within a dmap.
1267:	 *
1268:	 *		starting with the dmap leaf that covers the hint, we'll
1269:	 *		check the next four contiguous leaves for sufficient free
1270:	 *		space.  if sufficient free space is found, we'll allocate
1271:	 *		the desired free space.
1272:	 *
1273:	 * PARAMETERS:
1274:	 *	bmp	-  pointer to bmap descriptor
1275:	 *	dp	-  pointer to dmap.
1276:	 *	blkno	-  block number to allocate near.
1277:	 *	nblocks	-  actual number of contiguous free blocks desired.
1278:	 *	l2nb	-  log2 number of contiguous free blocks desired.
1279:	 *	results	-  on successful return, set to the starting block number
1280:	 *		   of the newly allocated range.
1281:	 *
1282:	 * RETURN VALUES:
1283:	 *	0	- success
1284:	 *	-ENOSPC	- insufficient disk resources
1285:	 *	-EIO	- i/o error
1286:	 *
1287:	 * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
1288:	 */
1289:	static int
1290:	dbAllocNear(struct bmap * bmp,
1291:		    struct dmap * dp, s64 blkno, int nblocks, int l2nb, s64 * results)
1292:	{
1293:		int word, lword, rc;
1294:		s8 *leaf;
1295:	
1296:		if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
1297:			jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
1298:			return -EIO;
1299:		}
1300:	
1301:		leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx);
1302:	
1303:		/* determine the word within the dmap that holds the hint
1304:		 * (i.e. blkno).  also, determine the last word in the dmap
1305:		 * that we'll include in our examination.
1306:		 */
1307:		word = (blkno & (BPERDMAP - 1)) >> L2DBWORD;
1308:		lword = min(word + 4, LPERDMAP);
1309:	
1310:		/* examine the leaves for sufficient free space.
1311:		 */
1312:		for (; word < lword; word++) {
1313:			/* does the leaf describe sufficient free space ?
1314:			 */
1315:			if (leaf[word] < l2nb)
1316:				continue;
1317:	
1318:			/* determine the block number within the file system
1319:			 * of the first block described by this dmap word.
1320:			 */
1321:			blkno = le64_to_cpu(dp->start) + (word << L2DBWORD);
1322:	
1323:			/* if not all bits of the dmap word are free, get the
1324:			 * starting bit number within the dmap word of the required
1325:			 * string of free bits and adjust the block number with the
1326:			 * value.
1327:			 */
1328:			if (leaf[word] < BUDMIN)
1329:				blkno +=
1330:				    dbFindBits(le32_to_cpu(dp->wmap[word]), l2nb);
1331:	
1332:			/* allocate the blocks.
1333:			 */
1334:			if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
1335:				*results = blkno;
1336:	
1337:			return (rc);
1338:		}
1339:	
1340:		return -ENOSPC;
1341:	}
 SourceFile:fs/jfs/jfs_dmap.c]

128/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 21005
							output: 82
							thoughts: 103
						

Thoughts:
**Analyzing Potential Corruption in JFS Disk Allocation**

Okay, so I'm looking at `dbAllocNear` and I see that crucial `if` statement right away. It's checking if the `leafidx` within the `dp->tree` structure matches `LEAFIND`. A mismatch here, and we're immediately throwing a `-EIO` error with a "Corrupt dmap page" message. That's a clear red flag. This points directly to potential corruption in the dmap. I need to keep this in mind as I work to debug this.

Now, let's step back and consider how this `leafidx` could be getting messed up. To get a better grasp of the situation, I need to dig deeper into the allocation functions themselves: `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. Understanding their individual roles will help me pinpoint where a discrepancy could originate and determine the root cause of this corruption. I'll focus on how they interact with `dp->tree` and specifically manipulate `leafidx`.



129/2 2026/06/30 14:46 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocDmapLev]

Results:
map[SourceCode:2016:	/*
2017:	 * NAME:	dbAllocDmapLev()
2018:	 *
2019:	 * FUNCTION:	attempt to allocate a specified number of contiguous blocks
2020:	 *		from a specified dmap.
2021:	 *
2022:	 *		this routine checks if the contiguous blocks are available.
2023:	 *		if so, nblocks of blocks are allocated; otherwise, ENOSPC is
2024:	 *		returned.
2025:	 *
2026:	 * PARAMETERS:
2027:	 *	mp	-  pointer to bmap descriptor
2028:	 *	dp	-  pointer to dmap to attempt to allocate blocks from.
2029:	 *	l2nb	-  log2 number of contiguous block desired.
2030:	 *	nblocks	-  actual number of contiguous block desired.
2031:	 *	results	-  on successful return, set to the starting block number
2032:	 *		   of the newly allocated range.
2033:	 *
2034:	 * RETURN VALUES:
2035:	 *	0	- success
2036:	 *	-ENOSPC	- insufficient disk resources
2037:	 *	-EIO	- i/o error
2038:	 *
2039:	 * serialization: IREAD_LOCK(ipbmap), e.g., from dbAlloc(), or
2040:	 *	IWRITE_LOCK(ipbmap), e.g., dbAllocCtl(), held on entry/exit;
2041:	 */
2042:	static int
2043:	dbAllocDmapLev(struct bmap * bmp,
2044:		       struct dmap * dp, int nblocks, int l2nb, s64 * results)
2045:	{
2046:		s64 blkno;
2047:		int leafidx, rc;
2048:	
2049:		/* can't be more than a dmaps worth of blocks */
2050:		assert(l2nb <= L2BPERDMAP);
2051:	
2052:		/* search the tree within the dmap page for sufficient
2053:		 * free space.  if sufficient free space is found, dbFindLeaf()
2054:		 * returns the index of the leaf at which free space was found.
2055:		 */
2056:		if (dbFindLeaf((dmtree_t *) &dp->tree, l2nb, &leafidx, false))
2057:			return -ENOSPC;
2058:	
2059:		if (leafidx < 0)
2060:			return -EIO;
2061:	
2062:		/* determine the block number within the file system corresponding
2063:		 * to the leaf at which free space was found.
2064:		 */
2065:		blkno = le64_to_cpu(dp->start) + (leafidx << L2DBWORD);
2066:	
2067:		/* if not all bits of the dmap word are free, get the starting
2068:		 * bit number within the dmap word of the required string of free
2069:		 * bits and adjust the block number with this value.
2070:		 */
2071:		if (dp->tree.stree[leafidx + LEAFIND] < BUDMIN)
2072:			blkno += dbFindBits(le32_to_cpu(dp->wmap[leafidx]), l2nb);
2073:	
2074:		/* allocate the blocks */
2075:		if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
2076:			*results = blkno;
2077:	
2078:		return (rc);
2079:	}
 SourceFile:fs/jfs/jfs_dmap.c]

130/2 2026/06/30 14:46 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocDmapBU]

Results:
map[SourceCode:3333:	static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
3334:				 int nblocks)
3335:	{
3336:		int rc;
3337:		int dbitno, word, rembits, nb, nwords, wbitno, agno;
3338:		s8 oldroot;
3339:		struct dmaptree *tp = (struct dmaptree *) & dp->tree;
3340:	
3341:		/* save the current value of the root (i.e. maximum free string)
3342:		 * of the dmap tree.
3343:		 */
3344:		oldroot = tp->stree[ROOT];
3345:	
3346:		/* determine the bit number and word within the dmap of the
3347:		 * starting block.
3348:		 */
3349:		dbitno = blkno & (BPERDMAP - 1);
3350:		word = dbitno >> L2DBWORD;
3351:	
3352:		/* block range better be within the dmap */
3353:		assert(dbitno + nblocks <= BPERDMAP);
3354:	
3355:		/* allocate the bits of the dmap's words corresponding to the block
3356:		 * range. not all bits of the first and last words may be contained
3357:		 * within the block range.  if this is the case, we'll work against
3358:		 * those words (i.e. partial first and/or last) on an individual basis
3359:		 * (a single pass), allocating the bits of interest by hand and
3360:		 * updating the leaf corresponding to the dmap word. a single pass
3361:		 * will be used for all dmap words fully contained within the
3362:		 * specified range.  within this pass, the bits of all fully contained
3363:		 * dmap words will be marked as free in a single shot and the leaves
3364:		 * will be updated. a single leaf may describe the free space of
3365:		 * multiple dmap words, so we may update only a subset of the actual
3366:		 * leaves corresponding to the dmap words of the block range.
3367:		 */
3368:		for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
3369:			/* determine the bit number within the word and
3370:			 * the number of bits within the word.
3371:			 */
3372:			wbitno = dbitno & (DBWORD - 1);
3373:			nb = min(rembits, DBWORD - wbitno);
3374:	
3375:			/* check if only part of a word is to be allocated.
3376:			 */
3377:			if (nb < DBWORD) {
3378:				/* allocate (set to 1) the appropriate bits within
3379:				 * this dmap word.
3380:				 */
3381:				dp->wmap[word] |= cpu_to_le32(ONES << (DBWORD - nb)
3382:							      >> wbitno);
3383:	
3384:				word++;
3385:			} else {
3386:				/* one or more dmap words are fully contained
3387:				 * within the block range.  determine how many
3388:				 * words and allocate (set to 1) the bits of these
3389:				 * words.
3390:				 */
3391:				nwords = rembits >> L2DBWORD;
3392:				memset(&dp->wmap[word], (int) ONES, nwords * 4);
3393:	
3394:				/* determine how many bits */
3395:				nb = nwords << L2DBWORD;
3396:				word += nwords;
3397:			}
3398:		}
3399:	
3400:		/* update the free count for this dmap */
3401:		le32_add_cpu(&dp->nfree, -nblocks);
3402:	
3403:		/* reconstruct summary tree */
3404:		dbInitDmapTree(dp);
3405:	
3406:		BMAP_LOCK(bmp);
3407:	
3408:		/* if this allocation group is completely free,
3409:		 * update the highest active allocation group number
3410:		 * if this allocation group is the new max.
3411:		 */
3412:		agno = blkno >> bmp->db_agl2size;
3413:		if (agno > bmp->db_maxag)
3414:			bmp->db_maxag = agno;
3415:	
3416:		/* update the free count for the allocation group and map */
3417:		bmp->db_agfree[agno] -= nblocks;
3418:		bmp->db_nfree -= nblocks;
3419:	
3420:		BMAP_UNLOCK(bmp);
3421:	
3422:		/* if the root has not changed, done. */
3423:		if (tp->stree[ROOT] == oldroot)
3424:			return (0);
3425:	
3426:		/* root changed. bubble the change up to the dmap control pages.
3427:		 * if the adjustment of the upper level control pages fails,
3428:		 * backout the bit allocation (thus making everything consistent).
3429:		 */
3430:		if ((rc = dbAdjCtl(bmp, blkno, tp->stree[ROOT], 1, 0)))
3431:			dbFreeBits(bmp, dp, blkno, nblocks);
3432:	
3433:		return (rc);
3434:	}
 SourceFile:fs/jfs/jfs_dmap.c]

131/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 24106
							output: 40
							thoughts: 60
						

Thoughts:
Here's my summary, as the expert:

**Investigating Potential Data Structure Access Issues in DMAP Allocation**

Okay, so I'm looking into these DMAP allocation functions and it looks like `dbAllocDmapLev` is potentially problematic. I see it skips the `leafidx` check directly, but that could be offset if it's hitting `stree` through `dbFindLeaf`. I need to confirm that. And, I also noticed `dbAllocDmapBU` isn't doing the check either.

To get a clearer picture of how this is all working, I'm going to dig into `dbAllocDmap` itself. That seems like the logical next step to understand the flow and see what's really going on with `stree` access in these allocation routines. I need to know how these things are interacting, if at all, and whether there's a vulnerability or just an oversight. Let's see what `dbAllocDmap` reveals.



132/2 2026/06/30 14:46 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocDmap]

Results:
map[SourceCode:2082:	/*
2083:	 * NAME:	dbAllocDmap()
2084:	 *
2085:	 * FUNCTION:	adjust the disk allocation map to reflect the allocation
2086:	 *		of a specified block range within a dmap.
2087:	 *
2088:	 *		this routine allocates the specified blocks from the dmap
2089:	 *		through a call to dbAllocBits(). if the allocation of the
2090:	 *		block range causes the maximum string of free blocks within
2091:	 *		the dmap to change (i.e. the value of the root of the dmap's
2092:	 *		dmtree), this routine will cause this change to be reflected
2093:	 *		up through the appropriate levels of the dmap control pages
2094:	 *		by a call to dbAdjCtl() for the L0 dmap control page that
2095:	 *		covers this dmap.
2096:	 *
2097:	 * PARAMETERS:
2098:	 *	bmp	-  pointer to bmap descriptor
2099:	 *	dp	-  pointer to dmap to allocate the block range from.
2100:	 *	blkno	-  starting block number of the block to be allocated.
2101:	 *	nblocks	-  number of blocks to be allocated.
2102:	 *
2103:	 * RETURN VALUES:
2104:	 *	0	- success
2105:	 *	-EIO	- i/o error
2106:	 *
2107:	 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
2108:	 */
2109:	static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2110:			       int nblocks)
2111:	{
2112:		s8 oldroot;
2113:		int rc;
2114:	
2115:		/* save the current value of the root (i.e. maximum free string)
2116:		 * of the dmap tree.
2117:		 */
2118:		oldroot = dp->tree.stree[ROOT];
2119:	
2120:		/* allocate the specified (blocks) bits */
2121:		dbAllocBits(bmp, dp, blkno, nblocks);
2122:	
2123:		/* if the root has not changed, done. */
2124:		if (dp->tree.stree[ROOT] == oldroot)
2125:			return (0);
2126:	
2127:		/* root changed. bubble the change up to the dmap control pages.
2128:		 * if the adjustment of the upper level control pages fails,
2129:		 * backout the bit allocation (thus making everything consistent).
2130:		 */
2131:		if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 1, 0)))
2132:			dbFreeBits(bmp, dp, blkno, nblocks);
2133:	
2134:		return (rc);
2135:	}
 SourceFile:fs/jfs/jfs_dmap.c]

133/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 25319
							output: 79
							thoughts: 719
						

Thoughts:
**Analyzing and Replicating a Proven Bug-Fix Pattern for dmap Corruption**

Okay, so the proposed solution is to add a `check_dmaptree` function and call it in several key dmap allocation and deallocation functions. Before diving into the implementation details of `check_dmaptree`, I need to ground this in past solutions for related issues within the JFS filesystem. The goal here is to leverage established patterns and idioms to ensure that the fix is robust and aligns with existing coding standards. This avoids introducing new, potentially unforeseen, problems.

I've reviewed `cce219b203c4` ("jfs: add dmapctl integrity check to prevent invalid operations") and `c214006856ff` ("jfs: upper bound check of tree index in dbAllocAG") as they seem most relevant. The `cce219b203c4` commit, in particular, offers a good template. It introduced a `check_dmapctl` function to validate a structure read from disk. The crucial aspect is the return value - a boolean indicating validity – and the handling of failures.

The `check_dmapctl` function performs a series of checks:

*   Bounds checks on fields like `nleafs`, `l2nleafs`, `leafidx`, and `height`.
*   Validity of `budmin`.
*   Ensuring leaf nodes fit within the allocated `stree` array.
*   Validation of leaf node values.

Importantly, the failure handling is consistent. When `check_dmapctl` returns `false`, indicating corruption, the code does the following:

1.  Logs an error using `jfs_error`, providing context with the superblock (`sb`).
2.  Releases the metapage if applicable.
3.  Returns `-EIO` (or jumps to an error handling label) to signal a fatal I/O error.

The use of the `unlikely()` macro for the failure path (`if (unlikely(!check_dmapctl(dcp)))`) is also noteworthy, as this helps the compiler optimize code by considering the common case (valid dmap) to be the "likely" one.

Therefore, to address the `dmaptree` corruption, I propose the following plan, based on the `cce219b203c4` pattern:

1.  Create `check_dmaptree` function returning a `bool` value.
2.  Within `check_dmaptree`, perform similar integrity checks as in `check_dmapctl`: boundary validation of fields like `nleafs`, `l2nleafs`, `leafidx`, `height`, `budmin`, and validate the leaf node values.
3.  Use `jfs_err` *inside* `check_dmaptree` to log specific validation failures; this adds granularity to the error reporting.
4.  In the calling functions (`dbFreeDmap`, etc.), call `check_dmaptree` and check the return value using `unlikely(!check_dmaptree(&dp->tree))`.
5.  If `check_dmaptree` returns `false`, log a general corruption error using `jfs_error`, using the superblock accessible through `bmp->db_ipbmap->i_sb` (or a similar construct) to provide context. It's important to verify that `bmp->db_ipbmap->i_sb` is accessible in all the affected functions.
6.  Return `-EIO` to indicate a fatal I/O error and propagate it upwards.

So, this approach replicates the structure of the existing integrity checks, which will ensure that it is safe to use within the codebase.



134/2 2026/06/30 14:46 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbFreeDmap]

Results:
map[SourceCode:2138:	/*
2139:	 * NAME:	dbFreeDmap()
2140:	 *
2141:	 * FUNCTION:	adjust the disk allocation map to reflect the allocation
2142:	 *		of a specified block range within a dmap.
2143:	 *
2144:	 *		this routine frees the specified blocks from the dmap through
2145:	 *		a call to dbFreeBits(). if the deallocation of the block range
2146:	 *		causes the maximum string of free blocks within the dmap to
2147:	 *		change (i.e. the value of the root of the dmap's dmtree), this
2148:	 *		routine will cause this change to be reflected up through the
2149:	 *		appropriate levels of the dmap control pages by a call to
2150:	 *		dbAdjCtl() for the L0 dmap control page that covers this dmap.
2151:	 *
2152:	 * PARAMETERS:
2153:	 *	bmp	-  pointer to bmap descriptor
2154:	 *	dp	-  pointer to dmap to free the block range from.
2155:	 *	blkno	-  starting block number of the block to be freed.
2156:	 *	nblocks	-  number of blocks to be freed.
2157:	 *
2158:	 * RETURN VALUES:
2159:	 *	0	- success
2160:	 *	-EIO	- i/o error
2161:	 *
2162:	 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
2163:	 */
2164:	static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2165:			      int nblocks)
2166:	{
2167:		s8 oldroot;
2168:		int rc = 0, word;
2169:	
2170:		/* save the current value of the root (i.e. maximum free string)
2171:		 * of the dmap tree.
2172:		 */
2173:		oldroot = dp->tree.stree[ROOT];
2174:	
2175:		/* free the specified (blocks) bits */
2176:		rc = dbFreeBits(bmp, dp, blkno, nblocks);
2177:	
2178:		/* if error or the root has not changed, done. */
2179:		if (rc || (dp->tree.stree[ROOT] == oldroot))
2180:			return (rc);
2181:	
2182:		/* root changed. bubble the change up to the dmap control pages.
2183:		 * if the adjustment of the upper level control pages fails,
2184:		 * backout the deallocation.
2185:		 */
2186:		if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 0, 0))) {
2187:			word = (blkno & (BPERDMAP - 1)) >> L2DBWORD;
2188:	
2189:			/* as part of backing out the deallocation, we will have
2190:			 * to back split the dmap tree if the deallocation caused
2191:			 * the freed blocks to become part of a larger binary buddy
2192:			 * system.
2193:			 */
2194:			if (dp->tree.stree[word] == NOFREE)
2195:				dbBackSplit((dmtree_t *)&dp->tree, word, false);
2196:	
2197:			dbAllocBits(bmp, dp, blkno, nblocks);
2198:		}
2199:	
2200:		return (rc);
2201:	}
 SourceFile:fs/jfs/jfs_dmap.c]

135/2 2026/06/30 14:46 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocNext]

Results:
map[SourceCode:1139:	/*
1140:	 * NAME:	dbAllocNext()
1141:	 *
1142:	 * FUNCTION:	attempt to allocate the blocks of the specified block
1143:	 *		range within a dmap.
1144:	 *
1145:	 * PARAMETERS:
1146:	 *	bmp	-  pointer to bmap descriptor
1147:	 *	dp	-  pointer to dmap.
1148:	 *	blkno	-  starting block number of the range.
1149:	 *	nblocks	-  number of contiguous free blocks of the range.
1150:	 *
1151:	 * RETURN VALUES:
1152:	 *	0	- success
1153:	 *	-ENOSPC	- insufficient disk resources
1154:	 *	-EIO	- i/o error
1155:	 *
1156:	 * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
1157:	 */
1158:	static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
1159:			       int nblocks)
1160:	{
1161:		int dbitno, word, rembits, nb, nwords, wbitno, nw;
1162:		int l2size;
1163:		s8 *leaf;
1164:		u32 mask;
1165:	
1166:		if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
1167:			jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
1168:			return -EIO;
1169:		}
1170:	
1171:		/* pick up a pointer to the leaves of the dmap tree.
1172:		 */
1173:		leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx);
1174:	
1175:		/* determine the bit number and word within the dmap of the
1176:		 * starting block.
1177:		 */
1178:		dbitno = blkno & (BPERDMAP - 1);
1179:		word = dbitno >> L2DBWORD;
1180:	
1181:		/* check if the specified block range is contained within
1182:		 * this dmap.
1183:		 */
1184:		if (dbitno + nblocks > BPERDMAP)
1185:			return -ENOSPC;
1186:	
1187:		/* check if the starting leaf indicates that anything
1188:		 * is free.
1189:		 */
1190:		if (leaf[word] == NOFREE)
1191:			return -ENOSPC;
1192:	
1193:		/* check the dmaps words corresponding to block range to see
1194:		 * if the block range is free.  not all bits of the first and
1195:		 * last words may be contained within the block range.  if this
1196:		 * is the case, we'll work against those words (i.e. partial first
1197:		 * and/or last) on an individual basis (a single pass) and examine
1198:		 * the actual bits to determine if they are free.  a single pass
1199:		 * will be used for all dmap words fully contained within the
1200:		 * specified range.  within this pass, the leaves of the dmap
1201:		 * tree will be examined to determine if the blocks are free. a
1202:		 * single leaf may describe the free space of multiple dmap
1203:		 * words, so we may visit only a subset of the actual leaves
1204:		 * corresponding to the dmap words of the block range.
1205:		 */
1206:		for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
1207:			/* determine the bit number within the word and
1208:			 * the number of bits within the word.
1209:			 */
1210:			wbitno = dbitno & (DBWORD - 1);
1211:			nb = min(rembits, DBWORD - wbitno);
1212:	
1213:			/* check if only part of the word is to be examined.
1214:			 */
1215:			if (nb < DBWORD) {
1216:				/* check if the bits are free.
1217:				 */
1218:				mask = (ONES << (DBWORD - nb) >> wbitno);
1219:				if ((mask & ~le32_to_cpu(dp->wmap[word])) != mask)
1220:					return -ENOSPC;
1221:	
1222:				word += 1;
1223:			} else {
1224:				/* one or more dmap words are fully contained
1225:				 * within the block range.  determine how many
1226:				 * words and how many bits.
1227:				 */
1228:				nwords = rembits >> L2DBWORD;
1229:				nb = nwords << L2DBWORD;
1230:	
1231:				/* now examine the appropriate leaves to determine
1232:				 * if the blocks are free.
1233:				 */
1234:				while (nwords > 0) {
1235:					/* does the leaf describe any free space ?
1236:					 */
1237:					if (leaf[word] < BUDMIN)
1238:						return -ENOSPC;
1239:	
1240:					/* determine the l2 number of bits provided
1241:					 * by this leaf.
1242:					 */
1243:					l2size =
1244:					    min_t(int, leaf[word], NLSTOL2BSZ(nwords));
1245:	
1246:					/* determine how many words were handled.
1247:					 */
1248:					nw = BUDSIZE(l2size, BUDMIN);
1249:	
1250:					nwords -= nw;
1251:					word += nw;
1252:				}
1253:			}
1254:		}
1255:	
1256:		/* allocate the blocks.
1257:		 */
1258:		return (dbAllocDmap(bmp, dp, blkno, nblocks));
1259:	}
 SourceFile:fs/jfs/jfs_dmap.c]

136/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 29824
							output: 24
							thoughts: 207
						

Thoughts:
**Analyzing Potential Integrity Checks and Error Handling in JFS**

Okay, so I'm observing that `bmp->db_ipbmap->i_sb` is accessible within all the functions we're looking at, which is a key piece of information. This is good; it's a common element, so it makes comparison easier. Now, I need to see if there are any other similar instances of this type of fix within JFS.

I recall seeing commit `c214006856ff`, specifically "jfs: upper bound check of tree index in dbAllocAG." Let's pull that up and see. Ah, yes, it added a critical integrity check:

```c
	if (ti < 0 || ti >= le32_to_cpu(dcp->nleafs)) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
		release_metapage(mp);
		return -EIO;
	}
```

Perfect. This mirrors what we're aiming for. It's an integrity check, specifically targeting the upper bound of a tree index. If the index is out of bounds, it logs an error, uses the `bmp->db_ipbmap->i_sb` superblock pointer to help with logging, releases a metapage, and returns `-EIO`, which is the standard I/O error code. This is exactly the kind of approach that we need to investigate.

Then I also remember `37bfb464ddca` ("jfs: validate AG parameters in dbMount() to prevent crashes"). Now I'm interested to see how that was addressed. I need to understand that commit as well to see if there's any related methodology or reasoning that can inform my current analysis.



137/2 2026/06/30 14:46 tool git-show
0m Args:
map[Commit:37bfb464ddca]

Results:
map[Output:commit 37bfb464ddca87f203071b5bd562cd91ddc0b40a
Author: Vasiliy Kovalev <kovalev@altlinux.org>
Date:   Mon Mar 10 11:56:02 2025 +0300

    jfs: validate AG parameters in dbMount() to prevent crashes
    
    Validate db_agheight, db_agwidth, and db_agstart in dbMount to catch
    corrupted metadata early and avoid undefined behavior in dbAllocAG.
    Limits are derived from L2LPERCTL, LPERCTL/MAXAG, and CTLTREESIZE:
    
    - agheight: 0 to L2LPERCTL/2 (0 to 5) ensures shift
      (L2LPERCTL - 2*agheight) >= 0.
    - agwidth: 1 to min(LPERCTL/MAXAG, 2^(L2LPERCTL - 2*agheight))
      ensures agperlev >= 1.
      - Ranges: 1-8 (agheight 0-3), 1-4 (agheight 4), 1 (agheight 5).
      - LPERCTL/MAXAG = 1024/128 = 8 limits leaves per AG;
        2^(10 - 2*agheight) prevents division to 0.
    - agstart: 0 to CTLTREESIZE-1 - agwidth*(MAXAG-1) keeps ti within
      stree (size 1365).
      - Ranges: 0-1237 (agwidth 1), 0-348 (agwidth 8).
    
    UBSAN: shift-out-of-bounds in fs/jfs/jfs_dmap.c:1400:9
    shift exponent -335544310 is negative
    CPU: 0 UID: 0 PID: 5822 Comm: syz-executor130 Not tainted 6.14.0-rc5-syzkaller #0
    Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
     ubsan_epilogue lib/ubsan.c:231 [inline]
     __ubsan_handle_shift_out_of_bounds+0x3c8/0x420 lib/ubsan.c:468
     dbAllocAG+0x1087/0x10b0 fs/jfs/jfs_dmap.c:1400
     dbDiscardAG+0x352/0xa20 fs/jfs/jfs_dmap.c:1613
     jfs_ioc_trim+0x45a/0x6b0 fs/jfs/jfs_discard.c:105
     jfs_ioctl+0x2cd/0x3e0 fs/jfs/ioctl.c:131
     vfs_ioctl fs/ioctl.c:51 [inline]
     __do_sys_ioctl fs/ioctl.c:906 [inline]
     __se_sys_ioctl+0xf5/0x170 fs/ioctl.c:892
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
    
    Cc: stable@vger.kernel.org
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot+fe8264911355151c487f@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=fe8264911355151c487f
    Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 26e89d0c69b6..35e063c9f3a4 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -194,7 +194,11 @@ int dbMount(struct inode *ipbmap)
 	    !bmp->db_numag || (bmp->db_numag > MAXAG) ||
 	    (bmp->db_maxag >= MAXAG) || (bmp->db_maxag < 0) ||
 	    (bmp->db_agpref >= MAXAG) || (bmp->db_agpref < 0) ||
-	    !bmp->db_agwidth ||
+	    (bmp->db_agheight < 0) || (bmp->db_agheight > (L2LPERCTL >> 1)) ||
+	    (bmp->db_agwidth < 1) || (bmp->db_agwidth > (LPERCTL / MAXAG)) ||
+	    (bmp->db_agwidth > (1 << (L2LPERCTL - (bmp->db_agheight << 1)))) ||
+	    (bmp->db_agstart < 0) ||
+	    (bmp->db_agstart > (CTLTREESIZE - 1 - bmp->db_agwidth * (MAXAG - 1))) ||
 	    (bmp->db_agl2size > L2MAXL2SIZE - L2MAXAG) ||
 	    (bmp->db_agl2size < 0) ||
 	    ((bmp->db_mapsize - 1) >> bmp->db_agl2size) > MAXAG) {
]

138/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 32016
							output: 79
							thoughts: 427
						

Thoughts:
**My Approach to Validating On-Disk Metadata**

Okay, so I'm looking at this pattern in `fs/jfs/jfs_dmap.c`, and it's quite clear how they're handling potential corruption in the on-disk metadata. It's a solid, pragmatic approach, and one I've used myself in similar situations. Essentially, the strategy is this:

First, introduce a dedicated validation function like `check_dmapctl` or `check_dmaptree`, and now likely `check_dmaptree`, to check the consistency of the structure's fields. This dedicated function is key. It's where the specific validation logic resides.

Second, the validation function needs to give me a clear "yes" or "no" answer, so a `bool` return (`true` for valid, `false` for corrupted) is perfect.

Third, and this is crucial for debugging and future analysis, inside this validation function, I need to log *specific* details about any field that fails validation. `jfs_err()` is a good choice for this. It's essential to pinpoint *why* the data is considered corrupted, not just that it *is* corrupted.

Fourth, call this validation function at critical points - when the structure is read from disk, or immediately before it's used. This keeps the integrity check as close to the source of the data as possible. Functions like `dbFreeDmap`, `dbAllocNext`, etc. are prime candidates.

Fifth, to keep the code clean and perform the check, use `unlikely(!check_dmaptree(...))` for the check.

Sixth, if the validation fails, log a generic error using `jfs_error(sb, "Corrupt dmap page\n");`. This is a fallback and provides context for the broader system. I'd typically also include the specific details from `jfs_err()` in the more verbose logging.

Seventh, and this is important, return `-EIO` to abort the operation and prevent further processing of the bad data. Better to fail early and safely than to potentially cause more damage by continuing with corrupted information.

Finally, if the function has allocated resources, make sure they are released before returning. Memory leaks are the enemy! It looks like there may not be much direct metapage management within the specific functions (`dbAllocNext` and `dbFreeDmap`) but I should double-check and make sure to release any resources. For example `release_metapage(mp);`. However, as I'm looking now, it appears that `dbAllocNext` and `dbFreeDmap` simply return `-EIO`. So the responsibility may fall on the caller, but I'll still keep cleanup in mind.

So, let me check the specific cleanup requirements for `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. It's always worth verifying this. This also needs to be added as a part of the integrity check in `dbMount`.



139/2 2026/06/30 14:46 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbFreeDmap]

Results:
map[SourceCode:2138:	/*
2139:	 * NAME:	dbFreeDmap()
2140:	 *
2141:	 * FUNCTION:	adjust the disk allocation map to reflect the allocation
2142:	 *		of a specified block range within a dmap.
2143:	 *
2144:	 *		this routine frees the specified blocks from the dmap through
2145:	 *		a call to dbFreeBits(). if the deallocation of the block range
2146:	 *		causes the maximum string of free blocks within the dmap to
2147:	 *		change (i.e. the value of the root of the dmap's dmtree), this
2148:	 *		routine will cause this change to be reflected up through the
2149:	 *		appropriate levels of the dmap control pages by a call to
2150:	 *		dbAdjCtl() for the L0 dmap control page that covers this dmap.
2151:	 *
2152:	 * PARAMETERS:
2153:	 *	bmp	-  pointer to bmap descriptor
2154:	 *	dp	-  pointer to dmap to free the block range from.
2155:	 *	blkno	-  starting block number of the block to be freed.
2156:	 *	nblocks	-  number of blocks to be freed.
2157:	 *
2158:	 * RETURN VALUES:
2159:	 *	0	- success
2160:	 *	-EIO	- i/o error
2161:	 *
2162:	 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
2163:	 */
2164:	static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2165:			      int nblocks)
2166:	{
2167:		s8 oldroot;
2168:		int rc = 0, word;
2169:	
2170:		/* save the current value of the root (i.e. maximum free string)
2171:		 * of the dmap tree.
2172:		 */
2173:		oldroot = dp->tree.stree[ROOT];
2174:	
2175:		/* free the specified (blocks) bits */
2176:		rc = dbFreeBits(bmp, dp, blkno, nblocks);
2177:	
2178:		/* if error or the root has not changed, done. */
2179:		if (rc || (dp->tree.stree[ROOT] == oldroot))
2180:			return (rc);
2181:	
2182:		/* root changed. bubble the change up to the dmap control pages.
2183:		 * if the adjustment of the upper level control pages fails,
2184:		 * backout the deallocation.
2185:		 */
2186:		if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 0, 0))) {
2187:			word = (blkno & (BPERDMAP - 1)) >> L2DBWORD;
2188:	
2189:			/* as part of backing out the deallocation, we will have
2190:			 * to back split the dmap tree if the deallocation caused
2191:			 * the freed blocks to become part of a larger binary buddy
2192:			 * system.
2193:			 */
2194:			if (dp->tree.stree[word] == NOFREE)
2195:				dbBackSplit((dmtree_t *)&dp->tree, word, false);
2196:	
2197:			dbAllocBits(bmp, dp, blkno, nblocks);
2198:		}
2199:	
2200:		return (rc);
2201:	}
 SourceFile:fs/jfs/jfs_dmap.c]

140/2 2026/06/30 14:46 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocNext]

Results:
map[SourceCode:1139:	/*
1140:	 * NAME:	dbAllocNext()
1141:	 *
1142:	 * FUNCTION:	attempt to allocate the blocks of the specified block
1143:	 *		range within a dmap.
1144:	 *
1145:	 * PARAMETERS:
1146:	 *	bmp	-  pointer to bmap descriptor
1147:	 *	dp	-  pointer to dmap.
1148:	 *	blkno	-  starting block number of the range.
1149:	 *	nblocks	-  number of contiguous free blocks of the range.
1150:	 *
1151:	 * RETURN VALUES:
1152:	 *	0	- success
1153:	 *	-ENOSPC	- insufficient disk resources
1154:	 *	-EIO	- i/o error
1155:	 *
1156:	 * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
1157:	 */
1158:	static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
1159:			       int nblocks)
1160:	{
1161:		int dbitno, word, rembits, nb, nwords, wbitno, nw;
1162:		int l2size;
1163:		s8 *leaf;
1164:		u32 mask;
1165:	
1166:		if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
1167:			jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
1168:			return -EIO;
1169:		}
1170:	
1171:		/* pick up a pointer to the leaves of the dmap tree.
1172:		 */
1173:		leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx);
1174:	
1175:		/* determine the bit number and word within the dmap of the
1176:		 * starting block.
1177:		 */
1178:		dbitno = blkno & (BPERDMAP - 1);
1179:		word = dbitno >> L2DBWORD;
1180:	
1181:		/* check if the specified block range is contained within
1182:		 * this dmap.
1183:		 */
1184:		if (dbitno + nblocks > BPERDMAP)
1185:			return -ENOSPC;
1186:	
1187:		/* check if the starting leaf indicates that anything
1188:		 * is free.
1189:		 */
1190:		if (leaf[word] == NOFREE)
1191:			return -ENOSPC;
1192:	
1193:		/* check the dmaps words corresponding to block range to see
1194:		 * if the block range is free.  not all bits of the first and
1195:		 * last words may be contained within the block range.  if this
1196:		 * is the case, we'll work against those words (i.e. partial first
1197:		 * and/or last) on an individual basis (a single pass) and examine
1198:		 * the actual bits to determine if they are free.  a single pass
1199:		 * will be used for all dmap words fully contained within the
1200:		 * specified range.  within this pass, the leaves of the dmap
1201:		 * tree will be examined to determine if the blocks are free. a
1202:		 * single leaf may describe the free space of multiple dmap
1203:		 * words, so we may visit only a subset of the actual leaves
1204:		 * corresponding to the dmap words of the block range.
1205:		 */
1206:		for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
1207:			/* determine the bit number within the word and
1208:			 * the number of bits within the word.
1209:			 */
1210:			wbitno = dbitno & (DBWORD - 1);
1211:			nb = min(rembits, DBWORD - wbitno);
1212:	
1213:			/* check if only part of the word is to be examined.
1214:			 */
1215:			if (nb < DBWORD) {
1216:				/* check if the bits are free.
1217:				 */
1218:				mask = (ONES << (DBWORD - nb) >> wbitno);
1219:				if ((mask & ~le32_to_cpu(dp->wmap[word])) != mask)
1220:					return -ENOSPC;
1221:	
1222:				word += 1;
1223:			} else {
1224:				/* one or more dmap words are fully contained
1225:				 * within the block range.  determine how many
1226:				 * words and how many bits.
1227:				 */
1228:				nwords = rembits >> L2DBWORD;
1229:				nb = nwords << L2DBWORD;
1230:	
1231:				/* now examine the appropriate leaves to determine
1232:				 * if the blocks are free.
1233:				 */
1234:				while (nwords > 0) {
1235:					/* does the leaf describe any free space ?
1236:					 */
1237:					if (leaf[word] < BUDMIN)
1238:						return -ENOSPC;
1239:	
1240:					/* determine the l2 number of bits provided
1241:					 * by this leaf.
1242:					 */
1243:					l2size =
1244:					    min_t(int, leaf[word], NLSTOL2BSZ(nwords));
1245:	
1246:					/* determine how many words were handled.
1247:					 */
1248:					nw = BUDSIZE(l2size, BUDMIN);
1249:	
1250:					nwords -= nw;
1251:					word += nw;
1252:				}
1253:			}
1254:		}
1255:	
1256:		/* allocate the blocks.
1257:		 */
1258:		return (dbAllocDmap(bmp, dp, blkno, nblocks));
1259:	}
 SourceFile:fs/jfs/jfs_dmap.c]

141/2 2026/06/30 14:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 36082
							output: 754
							thoughts: 693
						

Thoughts:
**My Analysis of Idioms and Best Practices for Handling Potential Data Corruption**

Okay, so the prompt wants me to distill the common patterns and idioms we use when addressing bugs stemming from corrupted on-disk structures, specifically within `fs/jfs/jfs_dmap.c`. Let me break down what I've learned from similar past fixes.

Firstly, the core approach revolves around a **dedicated validation function**. We need to introduce a dedicated function, like `check_dmapctl()` or `check_dmaptree()`, tailored to thoroughly scrutinize structures like `dmapctl` or `dmap`. This isn't just a cursory glance; we're talking **comprehensive field checks**. The validation function needs to meticulously verify the bounds and consistency of *every* relevant field, checking things like `nleafs`, `l2nleafs`, `leafidx`, `height`, `budmin`, and critically, array bounds for fields like `stree`.

Crucially, this validation function is the place to provide **detailed error logging**. We need to use `jfs_err()` within the validation function itself to pinpoint *exactly* what failed.  We need to log specific details, such as which field failed validation and what the expected/maximum values should be. This is critical for diagnosis down the line.

The validation function should return a simple boolean.  `true` means the structure passes muster; `false` indicates corruption.  The calling code then handles the failure.  Speaking of which, all the callers of functions that work with those structures -- the `dbFreeDmap` and the `dbAlloc...` functions, for example -- should invoke the validation function *early*.  Ideally, they call it immediately after they obtain a pointer to the structure they are operating on.

To optimize, it's essential to use `unlikely()` because we are assuming corruption is the exception. So wrap the check in an `unlikely()` clause: `if (unlikely(!check_dmaptree(&dp->tree)))`.

When corruption *is* detected by the caller, the strategy is consistent.  **Generic error logging** is done by the caller using `jfs_error(sb, "Corrupt dmap page\n");` (where `sb` can be grabbed via `bmp->db_ipbmap->i_sb`). The error needs to propagate: We need to return `-EIO` to signal that we must abort the operation, so that we don't try to further process bad data.

A very important best practice is **resource cleanup**. If, for instance, we’ve obtained a metapage lock, we *must* release it before returning the `-EIO` error. Note that this isn't necessarily a requirement for the specific functions mentioned (like `dbFreeDmap`, `dbAllocNext`), but it's a general principle we need to keep in mind, as seen in other functions, such as `dbAllocAG` or `dbFindCtl`.

Regarding **locking rules**, the validation process doesn't introduce any *new* locking requirements. It's meant to work within the *existing* locking context. For instance, if `dbFreeDmap` or `dbAllocNext` is called with either `IREAD_LOCK(ipbmap)` or `IWRITE_LOCK(ipbmap)` held, the validation must happen *within* that lock. That ensures that the structure is protected during the check and prevents any race conditions before we can detect and report the error. It's important to remember that the locking protects the structure during the check, and must be held *before* calling the validation function. This ensures that the structure remains consistent and protected from concurrent modification.



142/1 2026/06/30 14:46 action kernel-scratch-checkouter
0m Results:
map[KernelScratchSrc:/app/workdir/cache/tmp/tmp486162105]

143/1 2026/06/30 14:47 loop
21m
144/2 2026/06/30 14:47 iteration 0
21m
145/3 2026/06/30 14:47 agent patch-generator
0m Model:
best-expensive

Instruction:
You are an experienced Linux kernel developer tasked with creating a fix for a kernel bug.
You will be given a crash report, an initial explanation of the root cause done by another
kernel expert, and a summary of how similar bugs were fixed in the past.

Use the codeeditor tool to do code edits.
Note: you will not see your changes when looking at the code using codesearch tools.
Use the patch-diff tool to review the modifications you applied.

Your final reply should contain explanation of what you did in the patch and why
(details not present in the initial explanation of the bug).

Your fix must not just prevent the given crash, but also be the best fix for the underlying
root cause from the software engineering point of view. There can be several ways to fix the
same bug. Consider alternatives, and pick the best one. For example, additional checks may be
added at different locations/functions, it's usually better to place them earlier in the
execution to avoid multiple checks at various locations later.

Frequently the same coding mistake is done in several locations in the source code.
Check if your fix should be extended/applied to similar cases around to fix other similar bugs.
But don't go too wide, don't try to fix problems kernel-wide, fix similar issues
in the same file only.


If you are changing post-conditions of a function, consider all callers of the functions,
and if they need to be updated to handle new post-conditions. For example, if you make
a function that previously never returned a NULL, return NULL, consider if callers
need to be updated to handle NULL return value.



Prefer calling several tools at the same time to save round-trips.

Prompt:
The crash that corresponds to the bug is:

------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in /app/workdir/cache/src/7be5f73ee7b4d1978813accf8bb54cd892ccd800/fs/jfs/jfs_dmap.c:2867:24
index 4294967295 is out of range for type 's8[1365]' (aka 'signed char[1365]')
CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted syzkaller #1 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 ubsan_epilogue+0xa/0x30 lib/ubsan.c:233
 __ubsan_handle_out_of_bounds+0xe8/0xf0 lib/ubsan.c:455
 dbJoin+0xcc4/0xd60 fs/jfs/jfs_dmap.c:2867
 dbFreeBits+0x4a2/0xd70 fs/jfs/jfs_dmap.c:2427
 dbFreeDmap fs/jfs/jfs_dmap.c:2176 [inline]
 dbFree+0x324/0x650 fs/jfs/jfs_dmap.c:485
 txFreeMap+0x9e6/0xde0 fs/jfs/jfs_txnmgr.c:2517
 xtTruncate+0xd16/0x2eb0 fs/jfs/jfs_xtree.c:2481
 jfs_free_zero_link+0x35b/0x4c0 fs/jfs/namei.c:760
 jfs_evict_inode+0x356/0x430 fs/jfs/inode.c:159
 evict+0x624/0xb50 fs/inode.c:825
 txLazyCommit fs/jfs/jfs_txnmgr.c:2666 [inline]
 jfs_lazycommit+0x44c/0xac0 fs/jfs/jfs_txnmgr.c:2735
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
---[ end trace ]---


The explanation of the root cause of the bug is:

An array-index-out-of-bounds crash occurs in `dbJoin` when the JFS filesystem attempts to free blocks using a corrupted `dmap` structure read from disk.

### Root Cause

The JFS filesystem uses a binary buddy system to manage free space. The state of the buddy system is stored in `dmap` (for leaf levels) and `dmapctl` (for upper levels) structures on disk. 

When a `dmap` is read from disk, its `dmaptree` structure is not fully validated. Specifically, the `leafidx` field (which indicates the index of the first leaf in the `stree` array) is read directly from disk and used to compute pointers to the leaf nodes. 

If `leafidx` is corrupted (e.g., set to `0xffffffff` / `-1`), the computed pointer will point out of bounds of the `stree` array. When `dbFreeDmap` is called to free blocks, it calls `dbFreeBits`, which in turn calls `dbJoin` to update the buddy system. `dbJoin` uses the corrupted `leafidx` to access the leaf nodes:

```c
// fs/jfs/jfs_dmap.c:2867
leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
```

This results in an out-of-bounds memory access when `leaf[buddy]` is subsequently accessed.

While a similar integrity check (`check_dmapctl`) was recently added for `dmapctl` structures in commit `cce219b203c4` ("jfs: add dmapctl integrity check to prevent invalid operations"), the `dmap` structures (`dmaptree`) were left unchecked.

### Fix

Introduce a `check_dmaptree` function, similar to the existing `check_dmapctl` function, to validate the integrity of the `dmaptree` structure when it is used. 

The `check_dmaptree` function should verify that:
- `nleafs` is within bounds (`<= LPERDMAP`).
- `l2nleafs` is within bounds (`<= L2LPERDMAP`).
- `nleafs` matches `2^l2nleafs`.
- `leafidx` is exactly `LEAFIND`.
- `height` is within bounds (`<= 4`).
- `budmin` is valid (`>= BUDMIN`).
- The leaf nodes fit within the `stree` array (`leafidx + nleafs <= TREESIZE`).
- The values of the leaf nodes are valid (`>= NOFREE` and `<= 31`).

Call `check_dmaptree` in the functions that operate on the `dmap` structure, such as `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. If `check_dmaptree` fails, return `-EIO` to prevent further processing of the corrupted `dmap`. This will also replace the existing partial checks for `leafidx` in `dbAllocNext` and `dbAllocNear`.

```c
/*
 * check_dmaptree - Validate integrity of a dmaptree structure
 * @dtp: Pointer to the dmaptree structure to check
 *
 * Return: true if valid, false if corrupted
 */
static bool check_dmaptree(struct dmaptree *dtp)
{
	u32 nleafs, l2nleafs, leafidx, height;
	int i;

	nleafs = le32_to_cpu(dtp->nleafs);
	/* Check basic field ranges */
	if (unlikely(nleafs > LPERDMAP)) {
		jfs_err("dmaptree: invalid nleafs %u (max %u)",
			nleafs, LPERDMAP);
		return false;
	}

	l2nleafs = le32_to_cpu(dtp->l2nleafs);
	if (unlikely(l2nleafs > L2LPERDMAP)) {
		jfs_err("dmaptree: invalid l2nleafs %u (max %u)",
			l2nleafs, L2LPERDMAP);
		return false;
	}

	/* Verify nleafs matches l2nleafs (must be power of two) */
	if (unlikely((1U << l2nleafs) != nleafs)) {
		jfs_err("dmaptree: nleafs %u != 2^%u",
			nleafs, l2nleafs);
		return false;
	}

	leafidx = le32_to_cpu(dtp->leafidx);
	/* Check leaf index matches expected position */
	if (unlikely(leafidx != LEAFIND)) {
		jfs_err("dmaptree: invalid leafidx %u (expected %u)",
			leafidx, LEAFIND);
		return false;
	}

	height = le32_to_cpu(dtp->height);
	/* Check tree height is within valid range */
	if (unlikely(height > 4)) {
		jfs_err("dmaptree: invalid height %u (max 4)",
			height);
		return false;
	}

	/* Check budmin is valid */
	if (unlikely(dtp->budmin < BUDMIN)) {
		jfs_err("dmaptree: invalid budmin %d (min %d)",
			dtp->budmin, BUDMIN);
		return false;
	}

	/* Check leaf nodes fit within stree array */
	if (unlikely(leafidx + nleafs > TREESIZE)) {
		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
			leafidx + nleafs, TREESIZE);
		return false;
	}

	/* Check leaf nodes have valid values */
	for (i = leafidx; i < leafidx + nleafs; i++) {
		s8 val = dtp->stree[i];

		if (unlikely(val < NOFREE)) {
			jfs_err("dmaptree: invalid leaf value %d at index %d",
					val, i);
			return false;
		} else if (unlikely(val > 31)) {
			jfs_err("dmaptree: leaf value %d too large at index %d", val, i);
			return false;
		}
	}

	return true;
}
```

Then, in functions like `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`, add the check at the beginning:

```c
	if (unlikely(!check_dmaptree(&dp->tree))) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}
```


Historical context on how similar bugs were fixed in the past:

Based on the research into how similar bugs were addressed in the JFS subsystem (specifically in `fs/jfs/jfs_dmap.c`), here is a summary of the idioms, locking rules, and common patterns that should be followed when writing a fix for this bug:

### 1. Dedicated Validation Function
The standard idiom for preventing out-of-bounds accesses and invalid operations due to corrupted on-disk metadata is to introduce a dedicated, standalone validation function. 
- For example, commit `cce219b203c4` ("jfs: add dmapctl integrity check to prevent invalid operations") introduced `check_dmapctl()`. 
- Following this pattern, introducing `check_dmaptree(struct dmaptree *dtp)` is the correct approach. The function should return a boolean (`true` if valid, `false` if corrupted).

### 2. Comprehensive Field Checks and Detailed Logging
The validation function must thoroughly verify the bounds and internal consistency of the structure's fields before they are used in any calculations or array indexing.
- **Consistency:** Ensure fields like `nleafs` match `2^l2nleafs`.
- **Bounds:** Check that `leafidx`, `height`, and `budmin` are within their defined macros/limits (e.g., `LEAFIND`, `BUDMIN`, `TREESIZE`).
- **Detailed Logging:** Inside the validation function, use `jfs_err()` to log the specific field that failed validation, including the corrupted value and the expected limit. This aids in debugging disk corruption issues.

### 3. Caller-Side Handling and Error Propagation
Functions that operate on the `dmap` structure (such as `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`) should invoke the validation function as early as possible.
- **Branch Prediction:** Wrap the check in the `unlikely()` macro, as corruption is the exceptional case: 
  ```c
  if (unlikely(!check_dmaptree(&dp->tree))) { ... }
  ```
- **Generic Error Logging:** If the check fails, the caller should log a generic filesystem error using `jfs_error()`. The superblock pointer can typically be accessed via the bmap descriptor: `jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");`.
- **Abort Operation:** Return `-EIO` immediately to halt further processing and prevent the out-of-bounds memory access.
- **Resource Cleanup:** While the specific functions mentioned (`dbFreeDmap`, `dbAllocNext`, etc.) do not directly hold a metapage reference that needs releasing at their entry points, the general pattern (seen in `dbAllocAG` and `dbFindCtl`) dictates that any held resources (like `release_metapage(mp)`) must be freed before returning `-EIO`.

### 4. Locking Rules
The integrity checks do not require any new locks. They should be performed synchronously within the existing locking context of the callers. 
- Functions like `dbFreeDmap` and `dbAllocNext` are already serialized via `IREAD_LOCK(ipbmap)` or `IWRITE_LOCK(ipbmap)` upon entry. 
- The validation simply acts as a safe, read-only guard rail before the code proceeds to modify the buddy system state or traverse the tree.




Reply:
I have implemented the fix by introducing a dedicated validation function `check_dmaptree()` and calling it at the entry points of all functions that operate on the `dmap` structure.

### What I did in the patch:
1. **Introduced `check_dmaptree()`**: I added a new function in `fs/jfs/jfs_dmap.c` right after `check_dmapctl()`. This function thoroughly validates the integrity of a `dmaptree` structure by checking its fields (`nleafs`, `l2nleafs`, `leafidx`, `height`, `budmin`) against their expected bounds and ensuring internal consistency (e.g., `nleafs == 2^l2nleafs`). It also iterates over the leaf nodes to ensure their values are within the valid range (`NOFREE` to 31) and that the leaf range does not exceed the `stree` array size.
2. **Added Validation Checks**: I added `if (unlikely(!check_dmaptree(&dp->tree)))` checks at the beginning of the following functions:
   - `dbFreeDmap()`
   - `dbAllocNext()`
   - `dbAllocNear()`
   - `dbAllocDmapLev()`
   - `dbAllocDmapBU()`
   - `dbAllocDmap()`
3. **Replaced Partial Checks**: In `dbAllocNext()` and `dbAllocNear()`, I replaced the existing partial checks (`if (dp->tree.leafidx != cpu_to_le32(LEAFIND))`) with the comprehensive `check_dmaptree()` call.
4. **Error Handling**: If the validation fails, the functions log a generic filesystem error using `jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");` and immediately return `-EIO`.

### Why this is the best approach:
- **Fail-Fast Mechanism**: By placing the validation checks at the very beginning of the entry-point functions, we ensure that corrupted metadata is caught before any calculations or array indexing occur. This prevents out-of-bounds memory accesses (like the one in `dbJoin()`) and avoids propagating corrupted state into the buddy system.
- **Comprehensive Validation**: The previous partial checks only verified `leafidx`, leaving other fields like `nleafs` and the actual leaf values unchecked. `check_dmaptree()` provides a robust defense against various forms of disk corruption.
- **Consistency**: This approach mirrors the existing pattern established by `check_dmapctl()` for `dmapctl` structures, maintaining consistency in how JFS handles on-disk metadata validation.
- **Locking Safety**: The checks are performed synchronously within the existing locking context (e.g., `IREAD_LOCK` or `IWRITE_LOCK` on `ipbmap`), requiring no new locks and ensuring thread-safe validation.

146/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 7405
							output: 31
							thoughts: 331
						

Thoughts:
**Analyzing a JFS Crash Report**

Alright, let's break this down. We've got a crash report, and the UBSAN output clearly points to an array-index-out-of-bounds error deep within the JFS file system, specifically in `jfs_dmap.c`. Line 2867 is the culprit, trying to access an invalid index within the `s8[1365]` array. It's a classic case of bad indexing. The call stack gives us the sequence leading up to the error: `dbJoin`, `dbFreeBits`, `dbFreeDmap` are all implicated.

Looking at the code and the context, I'm pretty sure the root cause is a lack of robust validation of the `dmaptree` structure. It seems we're not properly checking the integrity of this critical data structure before using it, allowing an out-of-bounds access to sneak through. This is concerning, we need to take action.

My immediate thought is to introduce a validation function, perhaps named `check_dmaptree`, in `fs/jfs/jfs_dmap.c`. This function would thoroughly inspect the `dmaptree` structure, making sure indices are within bounds, pointers are valid, and the overall structure is internally consistent.

The real challenge is to pinpoint *where* this validation needs to be injected. Based on the call stack, I should insert calls to `check_dmaptree` within `dbFreeDmap` – the function that's being called, which then in turns calls those other functions we saw in the stack trace. The places where the allocations are made are also suspects. Therefore, I also need to call `check_dmaptree` in `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap` . It seems like these are the key points in the code where the `dmaptree` structure is modified or utilized, making them prime candidates for checking.

Time to dive into `fs/jfs/jfs_dmap.c` and start coding that validation function. Let's get this fixed.



147/4 2026/06/30 14:47 tool codesearch-file-index
0m Args:
map[SourceFile:fs/jfs/jfs_dmap.c]

Results:
map[Entities:[map[Kind:function Name:blkstol2] map[Kind:function Name:check_dmapctl] map[Kind:function Name:cntlz] map[Kind:function Name:cnttz] map[Kind:function Name:dbAdjCtl] map[Kind:function Name:dbAdjTree] map[Kind:function Name:dbAlloc] map[Kind:function Name:dbAllocAG] map[Kind:function Name:dbAllocAny] map[Kind:function Name:dbAllocBits] map[Kind:function Name:dbAllocBottomUp] map[Kind:function Name:dbAllocCtl] map[Kind:function Name:dbAllocDmap] map[Kind:function Name:dbAllocDmapBU] map[Kind:function Name:dbAllocDmapLev] map[Kind:function Name:dbAllocNear] map[Kind:function Name:dbAllocNext] map[Kind:function Name:dbBackSplit] map[Kind:function Name:dbDiscardAG] map[Kind:function Name:dbExtend] map[Kind:function Name:dbExtendFS] map[Kind:function Name:dbFinalizeBmap] map[Kind:function Name:dbFindBits] map[Kind:function Name:dbFindCtl] map[Kind:function Name:dbFindLeaf] map[Kind:function Name:dbFree] map[Kind:function Name:dbFreeBits] map[Kind:function Name:dbFreeDmap] map[Kind:function Name:dbGetL2AGSize] map[Kind:function Name:dbInitDmap] map[Kind:function Name:dbInitDmapCtl] map[Kind:function Name:dbInitDmapTree] map[Kind:function Name:dbInitTree] map[Kind:function Name:dbJoin] map[Kind:function Name:dbMapFileSizeToMapSize] map[Kind:function Name:dbMaxBud] map[Kind:function Name:dbMount] map[Kind:function Name:dbNextAG] map[Kind:function Name:dbReAlloc] map[Kind:function Name:dbSplit] map[Kind:function Name:dbSync] map[Kind:function Name:dbUnmount] map[Kind:function Name:dbUpdatePMap] map[Kind:struct Name:range2trim] map[Kind:global_variable Name:budtab]]]

148/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 8895
							output: 41
							thoughts: 44
						

Thoughts:
Okay, let's dive into this. Here's how I'm thinking about it:

**Locating and Contextualizing `check_dmaptree` in JFS**

Alright, I need to figure out where `check_dmapctl` lives within the JFS codebase, specifically the `fs/jfs` directory. My aim is to get a sense of its immediate surrounding code, so I can then decide the best place to insert `check_dmaptree`. The rationale here is to keep related functionalities close together for maintainability and comprehension, which is standard practice when dealing with filesystem internals. Going to examine `fs/jfs/jfs_dmap.c` feels like the most logical first step. Hopefully `check_dmapctl` is defined there and I can establish some context!



149/4 2026/06/30 14:47 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:check_dmapctl]

Results:
map[SourceCode: 136:	/*
 137:	 * check_dmapctl - Validate integrity of a dmapctl structure
 138:	 * @dcp: Pointer to the dmapctl structure to check
 139:	 *
 140:	 * Return: true if valid, false if corrupted
 141:	 */
 142:	static bool check_dmapctl(struct dmapctl *dcp)
 143:	{
 144:		s8 budmin = dcp->budmin;
 145:		u32 nleafs, l2nleafs, leafidx, height;
 146:		int i;
 147:	
 148:		nleafs = le32_to_cpu(dcp->nleafs);
 149:		/* Check basic field ranges */
 150:		if (unlikely(nleafs > LPERCTL)) {
 151:			jfs_err("dmapctl: invalid nleafs %u (max %u)",
 152:				nleafs, LPERCTL);
 153:			return false;
 154:		}
 155:	
 156:		l2nleafs = le32_to_cpu(dcp->l2nleafs);
 157:		if (unlikely(l2nleafs > L2LPERCTL)) {
 158:			jfs_err("dmapctl: invalid l2nleafs %u (max %u)",
 159:				l2nleafs, L2LPERCTL);
 160:			return false;
 161:		}
 162:	
 163:		/* Verify nleafs matches l2nleafs (must be power of two) */
 164:		if (unlikely((1U << l2nleafs) != nleafs)) {
 165:			jfs_err("dmapctl: nleafs %u != 2^%u",
 166:				nleafs, l2nleafs);
 167:			return false;
 168:		}
 169:	
 170:		leafidx = le32_to_cpu(dcp->leafidx);
 171:		/* Check leaf index matches expected position */
 172:		if (unlikely(leafidx != CTLLEAFIND)) {
 173:			jfs_err("dmapctl: invalid leafidx %u (expected %u)",
 174:				leafidx, CTLLEAFIND);
 175:			return false;
 176:		}
 177:	
 178:		height = le32_to_cpu(dcp->height);
 179:		/* Check tree height is within valid range */
 180:		if (unlikely(height > (L2LPERCTL >> 1))) {
 181:			jfs_err("dmapctl: invalid height %u (max %u)",
 182:				height, L2LPERCTL >> 1);
 183:			return false;
 184:		}
 185:	
 186:		/* Check budmin is valid (cannot be NOFREE for non-empty tree) */
 187:		if (budmin == NOFREE) {
 188:			if (unlikely(nleafs > 0)) {
 189:				jfs_err("dmapctl: budmin is NOFREE but nleafs %u",
 190:					nleafs);
 191:				return false;
 192:			}
 193:		} else if (unlikely(budmin < BUDMIN)) {
 194:			jfs_err("dmapctl: invalid budmin %d (min %d)",
 195:				budmin, BUDMIN);
 196:			return false;
 197:		}
 198:	
 199:		/* Check leaf nodes fit within stree array */
 200:		if (unlikely(leafidx + nleafs > CTLTREESIZE)) {
 201:			jfs_err("dmapctl: leaf range exceeds stree size (end %u > %u)",
 202:				leafidx + nleafs, CTLTREESIZE);
 203:			return false;
 204:		}
 205:	
 206:		/* Check leaf nodes have valid values */
 207:		for (i = leafidx; i < leafidx + nleafs; i++) {
 208:			s8 val = dcp->stree[i];
 209:	
 210:			if (unlikely(val < NOFREE)) {
 211:				jfs_err("dmapctl: invalid leaf value %d at index %d",
 212:						val, i);
 213:				return false;
 214:			} else if (unlikely(val > 31)) {
 215:				jfs_err("dmapctl: leaf value %d too large at index %d", val, i);
 216:				return false;
 217:			}
 218:		}
 219:	
 220:		return true;
 221:	}
 SourceFile:fs/jfs/jfs_dmap.c]

150/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 10551
							output: 875
							thoughts: 19
						

Thoughts:
Here's my thought process, summarized as you requested:

**Planning the Integration: `check_dmaptree` After `check_dmapctl`**

Okay, so I'm thinking about the order of operations here. We've got `check_dmapctl` already in place, and the next logical step is integrating `check_dmaptree`. From an architectural standpoint, the flow seems cleanest if `check_dmaptree` follows immediately after `check_dmapctl`. This sequencing likely minimizes dependencies and maximizes clarity in the overall system operation. I'm choosing this order because it allows for a clear progression in the checks, and likely mirrors the inherent logic of how the dmap system is expected to function. No need to overcomplicate the implementation – this keeps it simple and efficient.



151/4 2026/06/30 14:47 tool codeeditor
0m Error:
log-in to see details

Args:
map[CurrentCode:	return true;
}

/*
 *	dbMount()
 NewCode:	return true;
}

/*
 * check_dmaptree - Validate integrity of a dmaptree structure
 * @dtp: Pointer to the dmaptree structure to check
 *
 * Return: true if valid, false if corrupted
 */
static bool check_dmaptree(struct dmaptree *dtp)
{
	u32 nleafs, l2nleafs, leafidx, height;
	int i;

	nleafs = le32_to_cpu(dtp->nleafs);
	/* Check basic field ranges */
	if (unlikely(nleafs > LPERDMAP)) {
		jfs_err("dmaptree: invalid nleafs %u (max %u)",
			nleafs, LPERDMAP);
		return false;
	}

	l2nleafs = le32_to_cpu(dtp->l2nleafs);
	if (unlikely(l2nleafs > L2LPERDMAP)) {
		jfs_err("dmaptree: invalid l2nleafs %u (max %u)",
			l2nleafs, L2LPERDMAP);
		return false;
	}

	/* Verify nleafs matches l2nleafs (must be power of two) */
	if (unlikely((1U << l2nleafs) != nleafs)) {
		jfs_err("dmaptree: nleafs %u != 2^%u",
			nleafs, l2nleafs);
		return false;
	}

	leafidx = le32_to_cpu(dtp->leafidx);
	/* Check leaf index matches expected position */
	if (unlikely(leafidx != LEAFIND)) {
		jfs_err("dmaptree: invalid leafidx %u (expected %u)",
			leafidx, LEAFIND);
		return false;
	}

	height = le32_to_cpu(dtp->height);
	/* Check tree height is within valid range */
	if (unlikely(height > 4)) {
		jfs_err("dmaptree: invalid height %u (max 4)",
			height);
		return false;
	}

	/* Check budmin is valid */
	if (unlikely(dtp->budmin < BUDMIN)) {
		jfs_err("dmaptree: invalid budmin %d (min %d)",
			dtp->budmin, BUDMIN);
		return false;
	}

	/* Check leaf nodes fit within stree array */
	if (unlikely(leafidx + nleafs > TREESIZE)) {
		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
			leafidx + nleafs, TREESIZE);
		return false;
	}

	/* Check leaf nodes have valid values */
	for (i = leafidx; i < leafidx + nleafs; i++) {
		s8 val = dtp->stree[i];

		if (unlikely(val < NOFREE)) {
			jfs_err("dmaptree: invalid leaf value %d at index %d",
					val, i);
			return false;
		} else if (unlikely(val > 31)) {
			jfs_err("dmaptree: leaf value %d too large at index %d", val, i);
			return false;
		}
	}

	return true;
}

/*
 *	dbMount()
 SourceFile:fs/jfs/jfs_dmap.c]

Results:
map[]

152/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 11645
							output: 44
							thoughts: 13
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and presented as if it's my own thought process:

**Focusing In: Targeted File Analysis**

Right, let's zero in on a specific area within this file. Line 220, give or take a few around it, is where I need to start. I'm not going to approach this with a broad sweep; I'm going in with a targeted analysis. I've likely got a specific hypothesis or question I'm trying to answer, and that line, or the surrounding code, seems the most likely point of interest. I'm probably anticipating a certain structure or logic around that line and know the file's general architecture. The context around this area is crucial for understanding what's happening.



153/4 2026/06/30 14:47 tool read-file
0m Error:
log-in to see details

Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:215 LineCount:15]

154/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 11900
							output: 40
							thoughts: 8
						

Thoughts:
Okay, here's the summary, assuming I'm the one having these thoughts and that I'm an expert in the field:

**Initial Data Type Assessment**

Alright, looking at this code or data structure... my first thought is, "FirstLine needs to be an integer." There's just no way it's going to work reliably as anything else. Everything is pointing to a numerical representation, probably a row or line number, and a string or other non-integer type would introduce so many problems further down the line. It would cause conversion errors and unexpected behavior in any logic that depends on it. This is a basic, fundamental assessment I have to make before doing anything else.



155/4 2026/06/30 14:47 tool read-file
0m Args:
map[File:fs/jfs/jfs_dmap.c FirstLine:215 LineCount:15]

Results:
map[Contents: 215:				jfs_err("dmapctl: leaf value %d too large at index %d", val, i);
 216:				return false;
 217:			}
 218:		}
 219:	
 220:		return true;
 221:	}
 222:	
 223:	/*
 224:	 * NAME:	dbMount()
 225:	 *
 226:	 * FUNCTION:	initializate the block allocation map.
 227:	 *
 228:	 *		memory is allocated for the in-core bmap descriptor and
 229:	 *		the in-core descriptor is initialized from disk.
]

156/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 12290
							output: 877
							thoughts: 8
						

Thoughts:
Okay, I'm ready. Here's a summary, in the first person, assuming I'm an expert in the field and the text is the only available context:

**Analyzing the Snippet**

Alright, I'm looking at this snippet. The core of my analysis is to pinpoint the most effective application of its components within a given system. My expertise allows me to quickly identify potential areas of optimization or conflict. I need to understand its role in a broader context – how it integrates with existing infrastructure, what its dependencies are, and what performance characteristics I should anticipate. I immediately start assessing potential edge cases and error scenarios – my experience tells me where the subtle bugs often reside. Ultimately, I'm evaluating its contribution to the overall goal and determining if it efficiently fulfills its intended purpose.



157/4 2026/06/30 14:47 tool codeeditor
0m Args:
map[CurrentCode:	return true;
}

/*
 * NAME:	dbMount() NewCode:	return true;
}

/*
 * check_dmaptree - Validate integrity of a dmaptree structure
 * @dtp: Pointer to the dmaptree structure to check
 *
 * Return: true if valid, false if corrupted
 */
static bool check_dmaptree(struct dmaptree *dtp)
{
	u32 nleafs, l2nleafs, leafidx, height;
	int i;

	nleafs = le32_to_cpu(dtp->nleafs);
	/* Check basic field ranges */
	if (unlikely(nleafs > LPERDMAP)) {
		jfs_err("dmaptree: invalid nleafs %u (max %u)",
			nleafs, LPERDMAP);
		return false;
	}

	l2nleafs = le32_to_cpu(dtp->l2nleafs);
	if (unlikely(l2nleafs > L2LPERDMAP)) {
		jfs_err("dmaptree: invalid l2nleafs %u (max %u)",
			l2nleafs, L2LPERDMAP);
		return false;
	}

	/* Verify nleafs matches l2nleafs (must be power of two) */
	if (unlikely((1U << l2nleafs) != nleafs)) {
		jfs_err("dmaptree: nleafs %u != 2^%u",
			nleafs, l2nleafs);
		return false;
	}

	leafidx = le32_to_cpu(dtp->leafidx);
	/* Check leaf index matches expected position */
	if (unlikely(leafidx != LEAFIND)) {
		jfs_err("dmaptree: invalid leafidx %u (expected %u)",
			leafidx, LEAFIND);
		return false;
	}

	height = le32_to_cpu(dtp->height);
	/* Check tree height is within valid range */
	if (unlikely(height > 4)) {
		jfs_err("dmaptree: invalid height %u (max 4)",
			height);
		return false;
	}

	/* Check budmin is valid */
	if (unlikely(dtp->budmin < BUDMIN)) {
		jfs_err("dmaptree: invalid budmin %d (min %d)",
			dtp->budmin, BUDMIN);
		return false;
	}

	/* Check leaf nodes fit within stree array */
	if (unlikely(leafidx + nleafs > TREESIZE)) {
		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
			leafidx + nleafs, TREESIZE);
		return false;
	}

	/* Check leaf nodes have valid values */
	for (i = leafidx; i < leafidx + nleafs; i++) {
		s8 val = dtp->stree[i];

		if (unlikely(val < NOFREE)) {
			jfs_err("dmaptree: invalid leaf value %d at index %d",
					val, i);
			return false;
		} else if (unlikely(val > 31)) {
			jfs_err("dmaptree: leaf value %d too large at index %d", val, i);
			return false;
		}
	}

	return true;
}

/*
 * NAME:	dbMount() SourceFile:fs/jfs/jfs_dmap.c]

Results:
map[]

158/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 13346
							output: 40
							thoughts: 62
						

Thoughts:
**Integrating `check_dmaptree` into Key Allocation and Deallocation Routines**

Okay, time to get this done. I need to make sure `check_dmaptree` is integrated into a few critical functions within the database management system. I'll need to add it to `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. These are the core routines where we're allocating and freeing space within the data map structure, so verifying the tree's integrity at these points is crucial. Let's start by digging into `dbFreeDmap` and see where this function is.



159/4 2026/06/30 14:47 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbFreeDmap]

Results:
map[SourceCode:2138:	/*
2139:	 * NAME:	dbFreeDmap()
2140:	 *
2141:	 * FUNCTION:	adjust the disk allocation map to reflect the allocation
2142:	 *		of a specified block range within a dmap.
2143:	 *
2144:	 *		this routine frees the specified blocks from the dmap through
2145:	 *		a call to dbFreeBits(). if the deallocation of the block range
2146:	 *		causes the maximum string of free blocks within the dmap to
2147:	 *		change (i.e. the value of the root of the dmap's dmtree), this
2148:	 *		routine will cause this change to be reflected up through the
2149:	 *		appropriate levels of the dmap control pages by a call to
2150:	 *		dbAdjCtl() for the L0 dmap control page that covers this dmap.
2151:	 *
2152:	 * PARAMETERS:
2153:	 *	bmp	-  pointer to bmap descriptor
2154:	 *	dp	-  pointer to dmap to free the block range from.
2155:	 *	blkno	-  starting block number of the block to be freed.
2156:	 *	nblocks	-  number of blocks to be freed.
2157:	 *
2158:	 * RETURN VALUES:
2159:	 *	0	- success
2160:	 *	-EIO	- i/o error
2161:	 *
2162:	 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
2163:	 */
2164:	static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2165:			      int nblocks)
2166:	{
2167:		s8 oldroot;
2168:		int rc = 0, word;
2169:	
2170:		/* save the current value of the root (i.e. maximum free string)
2171:		 * of the dmap tree.
2172:		 */
2173:		oldroot = dp->tree.stree[ROOT];
2174:	
2175:		/* free the specified (blocks) bits */
2176:		rc = dbFreeBits(bmp, dp, blkno, nblocks);
2177:	
2178:		/* if error or the root has not changed, done. */
2179:		if (rc || (dp->tree.stree[ROOT] == oldroot))
2180:			return (rc);
2181:	
2182:		/* root changed. bubble the change up to the dmap control pages.
2183:		 * if the adjustment of the upper level control pages fails,
2184:		 * backout the deallocation.
2185:		 */
2186:		if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 0, 0))) {
2187:			word = (blkno & (BPERDMAP - 1)) >> L2DBWORD;
2188:	
2189:			/* as part of backing out the deallocation, we will have
2190:			 * to back split the dmap tree if the deallocation caused
2191:			 * the freed blocks to become part of a larger binary buddy
2192:			 * system.
2193:			 */
2194:			if (dp->tree.stree[word] == NOFREE)
2195:				dbBackSplit((dmtree_t *)&dp->tree, word, false);
2196:	
2197:			dbAllocBits(bmp, dp, blkno, nblocks);
2198:		}
2199:	
2200:		return (rc);
2201:	}
 SourceFile:fs/jfs/jfs_dmap.c]

160/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 14676
							output: 289
							thoughts: 15
						

Thoughts:
Okay, here's my summary, in the first person, as if reflecting on this thought:

**Prioritizing Resource Management: The Placement of a Critical Check**

Alright, so the core of this seems straightforward enough. I'm thinking about the function `dbFreeDmap`, and specifically, where to place a check within its logic. The crucial point is that this check isn't just *any* check; it's significant enough to warrant positioning at the very beginning of the function's execution. My expertise tells me that this early placement likely serves a critical purpose related to resource management and preventing potential errors or inconsistencies down the line. It signals that this test is a pre-condition, a gatekeeper, and the function is best not continuing without it. The specific reason for this I'd likely understand from context, either from the code itself or the wider problem that the code is solving, but it is clear that this check is vital to the function.



161/4 2026/06/30 14:47 tool codeeditor
0m Args:
map[CurrentCode:static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
		      int nblocks)
{
	s8 oldroot;
	int rc = 0, word;

	/* save the current value of the root (i.e. maximum free string)
	 * of the dmap tree.
	 */
	oldroot = dp->tree.stree[ROOT]; NewCode:static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
		      int nblocks)
{
	s8 oldroot;
	int rc = 0, word;

	if (unlikely(!check_dmaptree(&dp->tree))) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}

	/* save the current value of the root (i.e. maximum free string)
	 * of the dmap tree.
	 */
	oldroot = dp->tree.stree[ROOT]; SourceFile:fs/jfs/jfs_dmap.c]

Results:
map[]

162/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 15188
							output: 39
							thoughts: 6
						

Thoughts:
Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person:

**Allocating the Next Database Resource**

Alright, let's get down to brass tacks: `dbAllocNext`. This is where the rubber meets the road, isn't it? The core of resource management, specifically, how we allocate the *next* piece of the database. I'm thinking about the implications instantly. Is this a new object? A segment of existing space? What's the allocation strategy? Is it contiguous, extent-based, or something more sophisticated like a B-tree based scheme? The choice has cascading effects, especially in a concurrent environment.

Right now, my mind's running through the key considerations. First, the metadata lookup. Where do we even start looking? This function needs to know the storage pool, the allocation bitmap (if it’s that type of scheme), or the free list. Am I dealing with a simple list, or something more complex like a segmented free list to avoid fragmentation? Then comes the critical check. Do we have enough *contiguous* space, if contiguity is a constraint, or are we allowed to use fragmentation? What's the cost of defragmentation if we don’t?

I need to make sure this allocation is atomic, even if we are using an optimistic locking approach. We can't have two threads grabbing the same resource simultaneously. That means careful attention to locking primitives, whether they are mutexes, semaphores, or something more specialized to the underlying storage system. What's the granularity of the lock? This has implications for throughput and contention.

I'm considering error handling now. What if `dbAllocNext` fails to find available space? Do we return an error code, throw an exception, or attempt to grow the storage pool? What are the implications of each approach? We need a clear, consistent response. Should the caller be able to specify a timeout, or a maximum retry count? I'm debating the level of abstraction, too. Do we handle the low-level allocation details here, or delegate that to a lower-level storage manager, offering the database layer with a simpler interface? This is where the design's coupling becomes apparent.

Finally, I'm thinking about logging. If something goes wrong, or even if it goes right, we need to log this. Error logs need enough context to debug a problem. The same is true for successful allocation, but the level of detail can be lower. Is this going to require an update to the database's transaction log?

It needs to be efficient, thread safe, and robust. Now to get into the code...



163/4 2026/06/30 14:47 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocNext]

Results:
map[SourceCode:1139:	/*
1140:	 * NAME:	dbAllocNext()
1141:	 *
1142:	 * FUNCTION:	attempt to allocate the blocks of the specified block
1143:	 *		range within a dmap.
1144:	 *
1145:	 * PARAMETERS:
1146:	 *	bmp	-  pointer to bmap descriptor
1147:	 *	dp	-  pointer to dmap.
1148:	 *	blkno	-  starting block number of the range.
1149:	 *	nblocks	-  number of contiguous free blocks of the range.
1150:	 *
1151:	 * RETURN VALUES:
1152:	 *	0	- success
1153:	 *	-ENOSPC	- insufficient disk resources
1154:	 *	-EIO	- i/o error
1155:	 *
1156:	 * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
1157:	 */
1158:	static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
1159:			       int nblocks)
1160:	{
1161:		int dbitno, word, rembits, nb, nwords, wbitno, nw;
1162:		int l2size;
1163:		s8 *leaf;
1164:		u32 mask;
1165:	
1166:		if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
1167:			jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
1168:			return -EIO;
1169:		}
1170:	
1171:		/* pick up a pointer to the leaves of the dmap tree.
1172:		 */
1173:		leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx);
1174:	
1175:		/* determine the bit number and word within the dmap of the
1176:		 * starting block.
1177:		 */
1178:		dbitno = blkno & (BPERDMAP - 1);
1179:		word = dbitno >> L2DBWORD;
1180:	
1181:		/* check if the specified block range is contained within
1182:		 * this dmap.
1183:		 */
1184:		if (dbitno + nblocks > BPERDMAP)
1185:			return -ENOSPC;
1186:	
1187:		/* check if the starting leaf indicates that anything
1188:		 * is free.
1189:		 */
1190:		if (leaf[word] == NOFREE)
1191:			return -ENOSPC;
1192:	
1193:		/* check the dmaps words corresponding to block range to see
1194:		 * if the block range is free.  not all bits of the first and
1195:		 * last words may be contained within the block range.  if this
1196:		 * is the case, we'll work against those words (i.e. partial first
1197:		 * and/or last) on an individual basis (a single pass) and examine
1198:		 * the actual bits to determine if they are free.  a single pass
1199:		 * will be used for all dmap words fully contained within the
1200:		 * specified range.  within this pass, the leaves of the dmap
1201:		 * tree will be examined to determine if the blocks are free. a
1202:		 * single leaf may describe the free space of multiple dmap
1203:		 * words, so we may visit only a subset of the actual leaves
1204:		 * corresponding to the dmap words of the block range.
1205:		 */
1206:		for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
1207:			/* determine the bit number within the word and
1208:			 * the number of bits within the word.
1209:			 */
1210:			wbitno = dbitno & (DBWORD - 1);
1211:			nb = min(rembits, DBWORD - wbitno);
1212:	
1213:			/* check if only part of the word is to be examined.
1214:			 */
1215:			if (nb < DBWORD) {
1216:				/* check if the bits are free.
1217:				 */
1218:				mask = (ONES << (DBWORD - nb) >> wbitno);
1219:				if ((mask & ~le32_to_cpu(dp->wmap[word])) != mask)
1220:					return -ENOSPC;
1221:	
1222:				word += 1;
1223:			} else {
1224:				/* one or more dmap words are fully contained
1225:				 * within the block range.  determine how many
1226:				 * words and how many bits.
1227:				 */
1228:				nwords = rembits >> L2DBWORD;
1229:				nb = nwords << L2DBWORD;
1230:	
1231:				/* now examine the appropriate leaves to determine
1232:				 * if the blocks are free.
1233:				 */
1234:				while (nwords > 0) {
1235:					/* does the leaf describe any free space ?
1236:					 */
1237:					if (leaf[word] < BUDMIN)
1238:						return -ENOSPC;
1239:	
1240:					/* determine the l2 number of bits provided
1241:					 * by this leaf.
1242:					 */
1243:					l2size =
1244:					    min_t(int, leaf[word], NLSTOL2BSZ(nwords));
1245:	
1246:					/* determine how many words were handled.
1247:					 */
1248:					nw = BUDSIZE(l2size, BUDMIN);
1249:	
1250:					nwords -= nw;
1251:					word += nw;
1252:				}
1253:			}
1254:		}
1255:	
1256:		/* allocate the blocks.
1257:		 */
1258:		return (dbAllocDmap(bmp, dp, blkno, nblocks));
1259:	}
 SourceFile:fs/jfs/jfs_dmap.c]

164/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 17622
							output: 235
							thoughts: 12
						

Thoughts:
Okay, here's my summary, in the first person, as if these are my thoughts, keeping in mind I'm dealing with database allocation and am assumed to be an expert:

**Refactoring the Allocation Logic: `dbAllocNext`**

Right, looking at this `dbAllocNext` function... I'm noticing a potential issue. That "partial check" we have in there? It's bugging me. It feels like a potential source of subtle errors, maybe even resource leaks or allocation fragmentation down the line if we're not careful. It's a bit of a code smell, honestly. I've seen similar patterns lead to trouble in the past, especially when dealing with concurrency or complex allocation schemes.

I'm thinking we need to rethink that piece. The partial check, as it stands, might be masking a deeper issue, or at least making the logic harder to follow and maintain. We're probably better off with a more robust and complete check, or even better, refactoring the surrounding code to avoid the need for such a granular, potentially incomplete, validation. I need to dig deeper to see exactly *why* that partial check is there. What's it trying to protect against? And is there a cleaner, more efficient way to achieve the same result? A more elegant solution would involve consolidating the validation, or eliminating the partial validation entirely, ideally simplifying the overall function's responsibility. It's time to replace that partial check with something more definitive. Let's see what we can do to make this more reliable.



165/4 2026/06/30 14:47 tool codeeditor
0m Args:
map[CurrentCode:	int l2size;
	s8 *leaf;
	u32 mask;

	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}

	/* pick up a pointer to the leaves of the dmap tree.
	 */ NewCode:	int l2size;
	s8 *leaf;
	u32 mask;

	if (unlikely(!check_dmaptree(&dp->tree))) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}

	/* pick up a pointer to the leaves of the dmap tree.
	 */ SourceFile:fs/jfs/jfs_dmap.c]

Results:
map[]

166/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 18200
							output: 39
							thoughts: 6
						

Thoughts:
Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person:

**Allocating Memory Efficiently: Focusing on `dbAllocNear`**

Alright, let's zero in on `dbAllocNear`. We're dealing with memory allocation here, and given the name, I'm immediately thinking "near" implies something specific about the architecture or memory model in play. This isn't just a generic `malloc` replacement. It's likely optimized for allocating blocks that are... well, *near* something else, likely within a specific segment, page, or addressing range.

My mind immediately starts running through the implications. Why `near`? Is it about avoiding expensive page table lookups? Minimizing cache misses by keeping related data clustered? Or perhaps it's for performance gains related to accessing memory within a specific segment or region, something that leverages a particular CPU instruction set or memory addressing mode. The constraints are crucial here. What are the size limitations? What's the context? Is this for a critical section, a kernel module, or some high-frequency data buffer?

I'm also considering the potential downsides. "Near" allocation, by definition, implies a limited scope. This could lead to fragmentation issues if not managed very carefully. There's a tradeoff here between speed and flexibility, and the right choice will depend on the application's specific needs and its memory profile. I need to understand the details to evaluate whether `dbAllocNear` is the right allocation mechanism for this task or not.



167/4 2026/06/30 14:47 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocNear]

Results:
map[SourceCode:1262:	/*
1263:	 * NAME:	dbAllocNear()
1264:	 *
1265:	 * FUNCTION:	attempt to allocate a number of contiguous free blocks near
1266:	 *		a specified block (hint) within a dmap.
1267:	 *
1268:	 *		starting with the dmap leaf that covers the hint, we'll
1269:	 *		check the next four contiguous leaves for sufficient free
1270:	 *		space.  if sufficient free space is found, we'll allocate
1271:	 *		the desired free space.
1272:	 *
1273:	 * PARAMETERS:
1274:	 *	bmp	-  pointer to bmap descriptor
1275:	 *	dp	-  pointer to dmap.
1276:	 *	blkno	-  block number to allocate near.
1277:	 *	nblocks	-  actual number of contiguous free blocks desired.
1278:	 *	l2nb	-  log2 number of contiguous free blocks desired.
1279:	 *	results	-  on successful return, set to the starting block number
1280:	 *		   of the newly allocated range.
1281:	 *
1282:	 * RETURN VALUES:
1283:	 *	0	- success
1284:	 *	-ENOSPC	- insufficient disk resources
1285:	 *	-EIO	- i/o error
1286:	 *
1287:	 * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
1288:	 */
1289:	static int
1290:	dbAllocNear(struct bmap * bmp,
1291:		    struct dmap * dp, s64 blkno, int nblocks, int l2nb, s64 * results)
1292:	{
1293:		int word, lword, rc;
1294:		s8 *leaf;
1295:	
1296:		if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
1297:			jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
1298:			return -EIO;
1299:		}
1300:	
1301:		leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx);
1302:	
1303:		/* determine the word within the dmap that holds the hint
1304:		 * (i.e. blkno).  also, determine the last word in the dmap
1305:		 * that we'll include in our examination.
1306:		 */
1307:		word = (blkno & (BPERDMAP - 1)) >> L2DBWORD;
1308:		lword = min(word + 4, LPERDMAP);
1309:	
1310:		/* examine the leaves for sufficient free space.
1311:		 */
1312:		for (; word < lword; word++) {
1313:			/* does the leaf describe sufficient free space ?
1314:			 */
1315:			if (leaf[word] < l2nb)
1316:				continue;
1317:	
1318:			/* determine the block number within the file system
1319:			 * of the first block described by this dmap word.
1320:			 */
1321:			blkno = le64_to_cpu(dp->start) + (word << L2DBWORD);
1322:	
1323:			/* if not all bits of the dmap word are free, get the
1324:			 * starting bit number within the dmap word of the required
1325:			 * string of free bits and adjust the block number with the
1326:			 * value.
1327:			 */
1328:			if (leaf[word] < BUDMIN)
1329:				blkno +=
1330:				    dbFindBits(le32_to_cpu(dp->wmap[word]), l2nb);
1331:	
1332:			/* allocate the blocks.
1333:			 */
1334:			if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
1335:				*results = blkno;
1336:	
1337:			return (rc);
1338:		}
1339:	
1340:		return -ENOSPC;
1341:	}
 SourceFile:fs/jfs/jfs_dmap.c]

168/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 19836
							output: 241
							thoughts: 12
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Refactoring `dbAllocNear` for Enhanced Precision**

Okay, so I'm looking at the `dbAllocNear` function again. Something's been nagging at me, and I've just realized what it is: that partial check. It's a bit of a kludge, isn't it? A half-measure, potentially leading to inaccuracies and edge-case behaviors I'd rather avoid. We're aiming for optimal allocation strategy here, and this 'partial' approach feels like it might be introducing some undesirable imprecision or subtle bugs down the line. Perhaps it's preventing the algorithm from making the best allocation decisions in certain scenarios. Time to dig in and devise a more robust replacement strategy. Let's see if we can find a cleaner, more definitive solution for that specific condition. Maybe a more precise metric, or a different logical structure, would be an improvement. This is about ensuring optimal resource utilization, and I'm confident we can tighten things up.



169/4 2026/06/30 14:47 tool codeeditor
0m Args:
map[CurrentCode:	int word, lword, rc;
	s8 *leaf;

	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}

	leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx); NewCode:	int word, lword, rc;
	s8 *leaf;

	if (unlikely(!check_dmaptree(&dp->tree))) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}

	leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx); SourceFile:fs/jfs/jfs_dmap.c]

Results:
map[]

170/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 20319
							output: 41
							thoughts: 8
						

Thoughts:
Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person:

**Diving into `dbAllocDmapLev`**

Alright, let's break this down. My mind immediately goes to the potential complexity here. The function's name, `dbAllocDmapLev`, suggests we're dealing with *database* allocation, specifically a *dmap* (data map) structure, and likely at a *level* – so probably hierarchical allocation. The "db" prefix implies this is core database-related and likely storage-centric.

I'm starting to think about the underlying data structures. Am I dealing with a block-based storage system? Is this a tiered storage setup? Is this allocation strategy for metadata, data blocks, or both? The "level" aspect makes me immediately consider concepts like B-trees, or perhaps a more specialized, custom indexing scheme optimized for this particular database engine. Are we talking about a multi-level index to efficiently manage space within a data volume?

The core question now is *how* the allocation happens. Is this a simple bitfield allocation, a more sophisticated buddy system, or something entirely different? What are the implications for fragmentation, performance, and recovery? Are there safeguards against race conditions, particularly in a multi-threaded environment? Does it involve journaling or atomic operations to ensure data consistency? My head is already spinning with the details of memory management strategies. I want to look for potential bottlenecks as well.

I need to quickly assess the context. What's the target system? What's the scope of this allocation? What's the underlying hardware? What are the performance and availability requirements? If this is for high-throughput, mission-critical data, the allocation strategy will be far more critical than if it's for something less performance-sensitive.

Next, I'll need to dig into the function's parameters and return values. What inputs are provided to control the allocation size, the level of the dmap, and any other relevant configurations? What kind of error codes are returned, and what do they signify? Are there opportunities for optimization or potential pitfalls that I can anticipate?

I also need to see if this is tied to any other allocation mechanisms. Is this a bottom-up or top-down allocation? Does it work with specific block sizes or larger logical units of storage? This could reveal a lot about the design philosophy.

Finally, I need to look for any documentation, comments, or related code that provides insight into its overall purpose, constraints, and dependencies.



171/4 2026/06/30 14:47 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocDmapLev]

Results:
map[SourceCode:2016:	/*
2017:	 * NAME:	dbAllocDmapLev()
2018:	 *
2019:	 * FUNCTION:	attempt to allocate a specified number of contiguous blocks
2020:	 *		from a specified dmap.
2021:	 *
2022:	 *		this routine checks if the contiguous blocks are available.
2023:	 *		if so, nblocks of blocks are allocated; otherwise, ENOSPC is
2024:	 *		returned.
2025:	 *
2026:	 * PARAMETERS:
2027:	 *	mp	-  pointer to bmap descriptor
2028:	 *	dp	-  pointer to dmap to attempt to allocate blocks from.
2029:	 *	l2nb	-  log2 number of contiguous block desired.
2030:	 *	nblocks	-  actual number of contiguous block desired.
2031:	 *	results	-  on successful return, set to the starting block number
2032:	 *		   of the newly allocated range.
2033:	 *
2034:	 * RETURN VALUES:
2035:	 *	0	- success
2036:	 *	-ENOSPC	- insufficient disk resources
2037:	 *	-EIO	- i/o error
2038:	 *
2039:	 * serialization: IREAD_LOCK(ipbmap), e.g., from dbAlloc(), or
2040:	 *	IWRITE_LOCK(ipbmap), e.g., dbAllocCtl(), held on entry/exit;
2041:	 */
2042:	static int
2043:	dbAllocDmapLev(struct bmap * bmp,
2044:		       struct dmap * dp, int nblocks, int l2nb, s64 * results)
2045:	{
2046:		s64 blkno;
2047:		int leafidx, rc;
2048:	
2049:		/* can't be more than a dmaps worth of blocks */
2050:		assert(l2nb <= L2BPERDMAP);
2051:	
2052:		/* search the tree within the dmap page for sufficient
2053:		 * free space.  if sufficient free space is found, dbFindLeaf()
2054:		 * returns the index of the leaf at which free space was found.
2055:		 */
2056:		if (dbFindLeaf((dmtree_t *) &dp->tree, l2nb, &leafidx, false))
2057:			return -ENOSPC;
2058:	
2059:		if (leafidx < 0)
2060:			return -EIO;
2061:	
2062:		/* determine the block number within the file system corresponding
2063:		 * to the leaf at which free space was found.
2064:		 */
2065:		blkno = le64_to_cpu(dp->start) + (leafidx << L2DBWORD);
2066:	
2067:		/* if not all bits of the dmap word are free, get the starting
2068:		 * bit number within the dmap word of the required string of free
2069:		 * bits and adjust the block number with this value.
2070:		 */
2071:		if (dp->tree.stree[leafidx + LEAFIND] < BUDMIN)
2072:			blkno += dbFindBits(le32_to_cpu(dp->wmap[leafidx]), l2nb);
2073:	
2074:		/* allocate the blocks */
2075:		if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
2076:			*results = blkno;
2077:	
2078:		return (rc);
2079:	}
 SourceFile:fs/jfs/jfs_dmap.c]

172/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 21968
							output: 273
							thoughts: 16
						

Thoughts:
Here's my thought process, summarized as you requested:

**Optimizing `dbAllocDmapLev` for Efficiency**

Okay, I'm looking at `dbAllocDmapLev` again, and I realize there's a potential optimization here. I really should add that initial check right at the *very* beginning of the function. It'll prevent unnecessary execution of subsequent code if the criteria for allocation is immediately determined to be unmet. This small change could save compute cycles and improve overall performance, especially in scenarios where allocation failures are common. Gotta stay sharp and make these kinds of micro-optimizations where possible. It's the little things, you know?



173/4 2026/06/30 14:47 tool codeeditor
0m Args:
map[CurrentCode:static int
dbAllocDmapLev(struct bmap * bmp,
	       struct dmap * dp, int nblocks, int l2nb, s64 * results)
{
	s64 blkno;
	int leafidx, rc;

	/* can't be more than a dmaps worth of blocks */
	assert(l2nb <= L2BPERDMAP); NewCode:static int
dbAllocDmapLev(struct bmap * bmp,
	       struct dmap * dp, int nblocks, int l2nb, s64 * results)
{
	s64 blkno;
	int leafidx, rc;

	if (unlikely(!check_dmaptree(&dp->tree))) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}

	/* can't be more than a dmaps worth of blocks */
	assert(l2nb <= L2BPERDMAP); SourceFile:fs/jfs/jfs_dmap.c]

Results:
map[]

174/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 22404
							output: 41
							thoughts: 8
						

Thoughts:
Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written as if it's my own internal monologue:

**Focusing on `dbAllocDmapBU`**

Alright, let's zero in on `dbAllocDmapBU`. We're talking about dynamic block allocation, specifically within the context of a Distributed Map (DMap) backing store, and the 'BU' likely hints at a Bottom-Up allocation strategy. So, immediately, I'm thinking about the implications for fragmentation. Is it using a bitmap-based approach to track free blocks? Or perhaps a more sophisticated structure like a free list, potentially organized by size class? I need to understand the underlying data structures involved – what is the granularity of these blocks? What's the size of the DMap and its capacity?

The "Bottom-Up" suggests we're allocating from the end of the DMap storage space or starting at the beginning depending on how this design is setup. That's interesting, and it can have its advantages. Bottom-up can sometimes allow for a more efficient allocation strategy when paired with certain algorithms, potentially reducing initial overhead in some situations. However, it's also worth considering the cost of traversal to find available blocks. Is the implementation optimized for cache locality?

Given the dynamic nature, I need to know how the system deals with allocation failure. What's the error handling? Does it have a retry mechanism? Does it fall back to another allocation strategy if bottom-up fails at the moment? Is it configured to trigger a defragmentation or compaction of the DMap to resolve space limitation?

My next consideration is concurrency. Is this allocation routine thread-safe? Are there locking mechanisms in place? And if so, how granular are they? High concurrency is critical, and poorly designed locks could be a major performance bottleneck. Understanding this lock hierarchy is paramount. The system’s performance will depend significantly on this.

Finally, I'm wondering about the broader implications on the entire DMap's performance characteristics. This allocation function has huge impact on how fast writes happen, how efficiently space is utilized, and how fast reads can happen (if data placement is influenced). Is this function optimized for performance metrics important for the target application? It's essential to understand the typical workload patterns. Overall, I need a deep dive into the implementation details to fully grasp the trade-offs and potential performance characteristics, especially within this particular DMap.



175/4 2026/06/30 14:47 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocDmapBU]

Results:
map[SourceCode:3333:	static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
3334:				 int nblocks)
3335:	{
3336:		int rc;
3337:		int dbitno, word, rembits, nb, nwords, wbitno, agno;
3338:		s8 oldroot;
3339:		struct dmaptree *tp = (struct dmaptree *) & dp->tree;
3340:	
3341:		/* save the current value of the root (i.e. maximum free string)
3342:		 * of the dmap tree.
3343:		 */
3344:		oldroot = tp->stree[ROOT];
3345:	
3346:		/* determine the bit number and word within the dmap of the
3347:		 * starting block.
3348:		 */
3349:		dbitno = blkno & (BPERDMAP - 1);
3350:		word = dbitno >> L2DBWORD;
3351:	
3352:		/* block range better be within the dmap */
3353:		assert(dbitno + nblocks <= BPERDMAP);
3354:	
3355:		/* allocate the bits of the dmap's words corresponding to the block
3356:		 * range. not all bits of the first and last words may be contained
3357:		 * within the block range.  if this is the case, we'll work against
3358:		 * those words (i.e. partial first and/or last) on an individual basis
3359:		 * (a single pass), allocating the bits of interest by hand and
3360:		 * updating the leaf corresponding to the dmap word. a single pass
3361:		 * will be used for all dmap words fully contained within the
3362:		 * specified range.  within this pass, the bits of all fully contained
3363:		 * dmap words will be marked as free in a single shot and the leaves
3364:		 * will be updated. a single leaf may describe the free space of
3365:		 * multiple dmap words, so we may update only a subset of the actual
3366:		 * leaves corresponding to the dmap words of the block range.
3367:		 */
3368:		for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
3369:			/* determine the bit number within the word and
3370:			 * the number of bits within the word.
3371:			 */
3372:			wbitno = dbitno & (DBWORD - 1);
3373:			nb = min(rembits, DBWORD - wbitno);
3374:	
3375:			/* check if only part of a word is to be allocated.
3376:			 */
3377:			if (nb < DBWORD) {
3378:				/* allocate (set to 1) the appropriate bits within
3379:				 * this dmap word.
3380:				 */
3381:				dp->wmap[word] |= cpu_to_le32(ONES << (DBWORD - nb)
3382:							      >> wbitno);
3383:	
3384:				word++;
3385:			} else {
3386:				/* one or more dmap words are fully contained
3387:				 * within the block range.  determine how many
3388:				 * words and allocate (set to 1) the bits of these
3389:				 * words.
3390:				 */
3391:				nwords = rembits >> L2DBWORD;
3392:				memset(&dp->wmap[word], (int) ONES, nwords * 4);
3393:	
3394:				/* determine how many bits */
3395:				nb = nwords << L2DBWORD;
3396:				word += nwords;
3397:			}
3398:		}
3399:	
3400:		/* update the free count for this dmap */
3401:		le32_add_cpu(&dp->nfree, -nblocks);
3402:	
3403:		/* reconstruct summary tree */
3404:		dbInitDmapTree(dp);
3405:	
3406:		BMAP_LOCK(bmp);
3407:	
3408:		/* if this allocation group is completely free,
3409:		 * update the highest active allocation group number
3410:		 * if this allocation group is the new max.
3411:		 */
3412:		agno = blkno >> bmp->db_agl2size;
3413:		if (agno > bmp->db_maxag)
3414:			bmp->db_maxag = agno;
3415:	
3416:		/* update the free count for the allocation group and map */
3417:		bmp->db_agfree[agno] -= nblocks;
3418:		bmp->db_nfree -= nblocks;
3419:	
3420:		BMAP_UNLOCK(bmp);
3421:	
3422:		/* if the root has not changed, done. */
3423:		if (tp->stree[ROOT] == oldroot)
3424:			return (0);
3425:	
3426:		/* root changed. bubble the change up to the dmap control pages.
3427:		 * if the adjustment of the upper level control pages fails,
3428:		 * backout the bit allocation (thus making everything consistent).
3429:		 */
3430:		if ((rc = dbAdjCtl(bmp, blkno, tp->stree[ROOT], 1, 0)))
3431:			dbFreeBits(bmp, dp, blkno, nblocks);
3432:	
3433:		return (rc);
3434:	}
 SourceFile:fs/jfs/jfs_dmap.c]

176/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 24594
							output: 339
							thoughts: 16
						

Thoughts:
Okay, here's my summarized thought process, presented as if I were considering this myself:

**Addressing the `dbAllocDmapBU` Routine**

Right, so I'm thinking about the `dbAllocDmapBU` function. I need to make a change, and the most logical place to start is right at the beginning. It's crucial to implement that check upfront. This will help avoid more complications down the line. It's a fundamental step to ensure the rest of the routine functions correctly. It really feels like an essential preventative measure, making the code more robust from the get-go.



177/4 2026/06/30 14:47 tool codeeditor
0m Args:
map[CurrentCode:static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
			 int nblocks)
{
	int rc;
	int dbitno, word, rembits, nb, nwords, wbitno, agno;
	s8 oldroot;
	struct dmaptree *tp = (struct dmaptree *) & dp->tree;

	/* save the current value of the root (i.e. maximum free string)
	 * of the dmap tree.
	 */ NewCode:static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
			 int nblocks)
{
	int rc;
	int dbitno, word, rembits, nb, nwords, wbitno, agno;
	s8 oldroot;
	struct dmaptree *tp = (struct dmaptree *) & dp->tree;

	if (unlikely(!check_dmaptree(&dp->tree))) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}

	/* save the current value of the root (i.e. maximum free string)
	 * of the dmap tree.
	 */ SourceFile:fs/jfs/jfs_dmap.c]

Results:
map[]

178/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 25084
							output: 40
							thoughts: 7
						

Thoughts:
Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person:

**Allocating a DMA Buffer: Let's Dive into `dbAllocDmap`**

Alright, so we're talking about DMA (Direct Memory Access) and the allocation process. Specifically, I'm thinking about `dbAllocDmap`. The core concept here is that we're carving out a contiguous physical memory region that our DMA engine can directly access. No virtual address translation overhead, pure physical access for high-throughput I/O. We need this buffer and the kernel data structure which tracks it, known as the dmap, for a device to have direct access to system memory.

The allocation strategy, that's where things get interesting. Is this a system where we have large contiguous physical memory regions readily available, or are we dealing with a fragmented physical address space? That influences whether we can just grab a large chunk or if we need to implement something more clever, maybe using a buddy allocator or a zone allocator. We are likely to need to consider page sizes – are we aligning to a specific page boundary for optimal DMA performance? 

What about error handling? `dbAllocDmap` will need to gracefully handle memory exhaustion scenarios. What error codes are returned? Should we retry with a smaller size request? Are we handling NUMA (Non-Uniform Memory Access) considerations? Ideally, we'd want to allocate the DMA buffer as close to the initiating device as possible to minimize latency.

And then, the bookkeeping. The dmap structure itself – what information does it need to store? Physical address, size, mapping information (if applicable), and any associated metadata for the device driver. This includes the logic to track which DMA buffers are currently in use, and which are available to be allocated. How are we ensuring thread safety when accessing this structure? Mutexes, spinlocks, read-write locks - the right choice depends on the specific concurrency profile.

Finally, consider the deallocation. What happens when the DMA buffer is no longer needed? We have to ensure it's properly freed back into the system, and that all associated mappings are cleaned up to avoid memory leaks. The potential for resource exhaustion is a concern, so this needs to be bulletproof.



179/4 2026/06/30 14:47 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocDmap]

Results:
map[SourceCode:2082:	/*
2083:	 * NAME:	dbAllocDmap()
2084:	 *
2085:	 * FUNCTION:	adjust the disk allocation map to reflect the allocation
2086:	 *		of a specified block range within a dmap.
2087:	 *
2088:	 *		this routine allocates the specified blocks from the dmap
2089:	 *		through a call to dbAllocBits(). if the allocation of the
2090:	 *		block range causes the maximum string of free blocks within
2091:	 *		the dmap to change (i.e. the value of the root of the dmap's
2092:	 *		dmtree), this routine will cause this change to be reflected
2093:	 *		up through the appropriate levels of the dmap control pages
2094:	 *		by a call to dbAdjCtl() for the L0 dmap control page that
2095:	 *		covers this dmap.
2096:	 *
2097:	 * PARAMETERS:
2098:	 *	bmp	-  pointer to bmap descriptor
2099:	 *	dp	-  pointer to dmap to allocate the block range from.
2100:	 *	blkno	-  starting block number of the block to be allocated.
2101:	 *	nblocks	-  number of blocks to be allocated.
2102:	 *
2103:	 * RETURN VALUES:
2104:	 *	0	- success
2105:	 *	-EIO	- i/o error
2106:	 *
2107:	 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
2108:	 */
2109:	static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2110:			       int nblocks)
2111:	{
2112:		s8 oldroot;
2113:		int rc;
2114:	
2115:		/* save the current value of the root (i.e. maximum free string)
2116:		 * of the dmap tree.
2117:		 */
2118:		oldroot = dp->tree.stree[ROOT];
2119:	
2120:		/* allocate the specified (blocks) bits */
2121:		dbAllocBits(bmp, dp, blkno, nblocks);
2122:	
2123:		/* if the root has not changed, done. */
2124:		if (dp->tree.stree[ROOT] == oldroot)
2125:			return (0);
2126:	
2127:		/* root changed. bubble the change up to the dmap control pages.
2128:		 * if the adjustment of the upper level control pages fails,
2129:		 * backout the bit allocation (thus making everything consistent).
2130:		 */
2131:		if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 1, 0)))
2132:			dbFreeBits(bmp, dp, blkno, nblocks);
2133:	
2134:		return (rc);
2135:	}
 SourceFile:fs/jfs/jfs_dmap.c]

180/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 26511
							output: 251
							thoughts: 15
						

Thoughts:
Okay, here's my summarized thought process, presented as if I were considering this myself:

**Addressing the `dbAllocDmap` Function**

Right, so I'm looking at the `dbAllocDmap` function, and a crucial optimization jumps out at me. We need to improve its robustness and potentially its efficiency. My immediate thought is, "We need to put that error check *right at the beginning*." I'm talking about a prominent early check. This will prevent a lot of downstream issues, catch invalid states sooner, and generally make the function more resilient. Doing this upfront protects against bad data right away, which is paramount. It's a foundational change that will pay dividends.



181/4 2026/06/30 14:47 tool codeeditor
0m Args:
map[CurrentCode:static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
		       int nblocks)
{
	s8 oldroot;
	int rc;

	/* save the current value of the root (i.e. maximum free string)
	 * of the dmap tree.
	 */ NewCode:static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
		       int nblocks)
{
	s8 oldroot;
	int rc;

	if (unlikely(!check_dmaptree(&dp->tree))) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}

	/* save the current value of the root (i.e. maximum free string)
	 * of the dmap tree.
	 */ SourceFile:fs/jfs/jfs_dmap.c]

Results:
map[]

182/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 26931
							output: 39
							thoughts: 109
						

Thoughts:
**Checking for Unvalidated `dmaptree` Usage**

Okay, let's take a methodical approach to this. My primary concern is ensuring that the `dmaptree` structure isn't being used directly in any place that could introduce vulnerabilities, without proper validation in the calls. So, I need to methodically review the code. I started by looking at calls to `dbAllocBits` and `dbFreeBits`. I'm relieved to see that they are called from `dbAllocDmap` and `dbFreeDmap`, and those functions now *do* have the necessary checks in place. That's a good start. I also just validated that `dbAllocDmapBU`, `dbAllocDmapLev` and `dbAllocNear` all appear to have the expected validation checks as well. Now, the natural next step is to examine `dbFindLeaf`. I need to confirm that this critical function also validates inputs before interacting with the `dmaptree`. This feels like it's going well, but I need to be thorough.



183/4 2026/06/30 14:47 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbFindLeaf]

Results:
map[SourceCode:3011:	/*
3012:	 * NAME:	dbFindLeaf()
3013:	 *
3014:	 * FUNCTION:	search a dmtree_t for sufficient free blocks, returning
3015:	 *		the index of a leaf describing the free blocks if
3016:	 *		sufficient free blocks are found.
3017:	 *
3018:	 *		the search starts at the top of the dmtree_t tree and
3019:	 *		proceeds down the tree to the leftmost leaf with sufficient
3020:	 *		free space.
3021:	 *
3022:	 * PARAMETERS:
3023:	 *	tp	- pointer to the tree to be searched.
3024:	 *	l2nb	- log2 number of free blocks to search for.
3025:	 *	leafidx	- return pointer to be set to the index of the leaf
3026:	 *		  describing at least l2nb free blocks if sufficient
3027:	 *		  free blocks are found.
3028:	 *	is_ctl	- determines if the tree is of type ctl
3029:	 *
3030:	 * RETURN VALUES:
3031:	 *	0	- success
3032:	 *	-ENOSPC	- insufficient free blocks.
3033:	 */
3034:	static int dbFindLeaf(dmtree_t *tp, int l2nb, int *leafidx, bool is_ctl)
3035:	{
3036:		int ti, n = 0, k, x = 0;
3037:		int max_size, max_idx;
3038:	
3039:		max_size = is_ctl ? CTLTREESIZE : TREESIZE;
3040:		max_idx = is_ctl ? LPERCTL : LPERDMAP;
3041:	
3042:		/* first check the root of the tree to see if there is
3043:		 * sufficient free space.
3044:		 */
3045:		if (l2nb > tp->dmt_stree[ROOT])
3046:			return -ENOSPC;
3047:	
3048:		/* sufficient free space available. now search down the tree
3049:		 * starting at the next level for the leftmost leaf that
3050:		 * describes sufficient free space.
3051:		 */
3052:		for (k = le32_to_cpu(tp->dmt_height), ti = 1;
3053:		     k > 0; k--, ti = ((ti + n) << 2) + 1) {
3054:			/* search the four nodes at this level, starting from
3055:			 * the left.
3056:			 */
3057:			for (x = ti, n = 0; n < 4; n++) {
3058:				/* sufficient free space found.  move to the next
3059:				 * level (or quit if this is the last level).
3060:				 */
3061:				if (x + n > max_size)
3062:					return -ENOSPC;
3063:				if (l2nb <= tp->dmt_stree[x + n])
3064:					break;
3065:			}
3066:	
3067:			/* better have found something since the higher
3068:			 * levels of the tree said it was here.
3069:			 */
3070:			assert(n < 4);
3071:		}
3072:		if (le32_to_cpu(tp->dmt_leafidx) >= max_idx)
3073:			return -ENOSPC;
3074:	
3075:		/* set the return to the leftmost leaf describing sufficient
3076:		 * free space.
3077:		 */
3078:		*leafidx = x + n - le32_to_cpu(tp->dmt_leafidx);
3079:	
3080:		return (0);
3081:	}
 SourceFile:fs/jfs/jfs_dmap.c]

184/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 28430
							output: 20
							thoughts: 69
						

Thoughts:
Here's a breakdown of my thought process:

**Internal Code Analysis and Dependency Mapping**

Okay, so I'm tracing the calls to `dbFindLeaf` within this storage subsystem code. I see it's being invoked from `dbAllocDmapLev`, specifically within a context that now includes `check_dmaptree`. That's interesting; it suggests this particular instance of `dbFindLeaf` might be subject to additional data consistency checks related to the dmap tree structure. I'll need to keep that in mind when examining the code flow there.

Next, I observe that `dbFindLeaf` is also called from `dbAllocCtl`. Aha, that's for handling `dmapctl`, and it has its own associated check, `check_dmapctl`. This tells me that `dbFindLeaf` is likely a core routine for finding a leaf node within a b-tree-like structure (or similar) used for managing both the dmap itself and potentially its control information. The checks suggest integrity is paramount.

Now, given the significance of this function and its presence in both the allocation and control paths, I want to round out my understanding of how it's used. I should dig deeper and examine the calls to `dbSplit` and `dbBackSplit` to see if there's any context I'm missing. They seem like critical operations in the tree management. They likely split the tree and/or balance the tree as needed. I'll check to see if `dbFindLeaf` is related to splitting or balancing in any way.



185/4 2026/06/30 14:47 tool codesearch-find-references
0m Args:
map[Name:dbSplit]

Results:
map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2620] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2664] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbAllocBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2280] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbAllocBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2321] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbBackSplit SourceFile:fs/jfs/jfs_dmap.c SourceLine:2829]] TruncatedOutput:false]

186/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 29137
							output: 20
							thoughts: 43
						

Thoughts:
Here's my analysis of the situation:

**Investigating Memory Allocation Dependencies**

Okay, so `dbAllocBits` is a key function, and I see it's called within `dbAllocDmap` for allocation and, importantly, during error handling in `dbFreeDmap`. This immediately flags potential issues with memory management and error propagation. Both of those functions include a call to `check_dmaptree`, which likely points to a data structure consistency verification step.  Now, I need to understand the relationship, so I'm going to shift focus and look at `dbJoin`. I need to figure out how `dbJoin` interacts, if at all, with these allocation and deallocation routines. This will allow me to build a fuller picture of the memory lifecycle and pinpoint potential areas of concern for race conditions, leaks or inconsistencies.



187/4 2026/06/30 14:47 tool codesearch-find-references
0m Args:
map[Name:dbJoin]

Results:
map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2622] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbAdjCtl SourceFile:fs/jfs/jfs_dmap.c SourceLine:2652] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbFreeBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2427] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbFreeBits SourceFile:fs/jfs/jfs_dmap.c SourceLine:2461]] TruncatedOutput:false]

188/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 29610
							output: 21
							thoughts: 56
						

Thoughts:
Here's my summary, as the expert:

**Investigating `dbFreeBits` Usage**

Okay, so I'm looking at `dbFreeBits` and tracing its calls. It's called from a few key places: `dbFreeDmap`, and then on error paths from `dbAllocDmapBU` and `dbAllocDmap`. Importantly, all of these call sites also include a call to `check_dmaptree`. That's the crucial context. Now, what's interesting here isn't *that* it's called, but *where* and *why*. I need to understand the implications of releasing these bits under these circumstances, especially with that tree check. My next step is to drill into `dbAdjTree` and see how it fits into this picture. Knowing how this tree is being adjusted after releasing memory will be key to understanding the overall integrity of the system and whether there are any potential race conditions, memory leaks or other bugs lurking. Let's see how that function works.



189/4 2026/06/30 14:47 tool codesearch-find-references
0m Args:
map[Name:dbAdjTree]

Results:
map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbJoin SourceFile:fs/jfs/jfs_dmap.c SourceLine:2912] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbJoin SourceFile:fs/jfs/jfs_dmap.c SourceLine:2917] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbJoin SourceFile:fs/jfs/jfs_dmap.c SourceLine:2930] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbSplit SourceFile:fs/jfs/jfs_dmap.c SourceLine:2735] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dbSplit SourceFile:fs/jfs/jfs_dmap.c SourceLine:2747]] TruncatedOutput:false]

190/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 30183
							output: 39
							thoughts: 27
						

Thoughts:
Okay, here's my take on those thoughts, framed as my own:

**Reviewing `dmaptree` Operation Entry Points**

Alright, after this review, I'm pretty confident we've got all the bases covered regarding the potential entry points for operations within the `dmaptree` module. We've traced through the major functions and identified where the relevant calls are made. It feels pretty thorough, but given the critical nature of this, let's just do a quick double-check on `dbAllocAG`. That specific function seems like a likely candidate for potential issues, so it's worth a second look just to be absolutely certain we haven't overlooked anything, especially considering its role in allocation, which always has interesting implications for memory management and potential race conditions. Just a quick sanity check to ensure our comprehensive approach is truly complete.



191/4 2026/06/30 14:47 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocAG]

Results:
map[SourceCode:1344:	/*
1345:	 * NAME:	dbAllocAG()
1346:	 *
1347:	 * FUNCTION:	attempt to allocate the specified number of contiguous
1348:	 *		free blocks within the specified allocation group.
1349:	 *
1350:	 *		unless the allocation group size is equal to the number
1351:	 *		of blocks per dmap, the dmap control pages will be used to
1352:	 *		find the required free space, if available.  we start the
1353:	 *		search at the highest dmap control page level which
1354:	 *		distinctly describes the allocation group's free space
1355:	 *		(i.e. the highest level at which the allocation group's
1356:	 *		free space is not mixed in with that of any other group).
1357:	 *		in addition, we start the search within this level at a
1358:	 *		height of the dmapctl dmtree at which the nodes distinctly
1359:	 *		describe the allocation group's free space.  at this height,
1360:	 *		the allocation group's free space may be represented by 1
1361:	 *		or two sub-trees, depending on the allocation group size.
1362:	 *		we search the top nodes of these subtrees left to right for
1363:	 *		sufficient free space.  if sufficient free space is found,
1364:	 *		the subtree is searched to find the leftmost leaf that
1365:	 *		has free space.  once we have made it to the leaf, we
1366:	 *		move the search to the next lower level dmap control page
1367:	 *		corresponding to this leaf.  we continue down the dmap control
1368:	 *		pages until we find the dmap that contains or starts the
1369:	 *		sufficient free space and we allocate at this dmap.
1370:	 *
1371:	 *		if the allocation group size is equal to the dmap size,
1372:	 *		we'll start at the dmap corresponding to the allocation
1373:	 *		group and attempt the allocation at this level.
1374:	 *
1375:	 *		the dmap control page search is also not performed if the
1376:	 *		allocation group is completely free and we go to the first
1377:	 *		dmap of the allocation group to do the allocation.  this is
1378:	 *		done because the allocation group may be part (not the first
1379:	 *		part) of a larger binary buddy system, causing the dmap
1380:	 *		control pages to indicate no free space (NOFREE) within
1381:	 *		the allocation group.
1382:	 *
1383:	 * PARAMETERS:
1384:	 *	bmp	-  pointer to bmap descriptor
1385:	 *	agno	- allocation group number.
1386:	 *	nblocks	-  actual number of contiguous free blocks desired.
1387:	 *	l2nb	-  log2 number of contiguous free blocks desired.
1388:	 *	results	-  on successful return, set to the starting block number
1389:	 *		   of the newly allocated range.
1390:	 *
1391:	 * RETURN VALUES:
1392:	 *	0	- success
1393:	 *	-ENOSPC	- insufficient disk resources
1394:	 *	-EIO	- i/o error
1395:	 *
1396:	 * note: IWRITE_LOCK(ipmap) held on entry/exit;
1397:	 */
1398:	static int
1399:	dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
1400:	{
1401:		struct metapage *mp;
1402:		struct dmapctl *dcp;
1403:		int rc, ti, i, k, m, n, agperlev;
1404:		s64 blkno, lblkno;
1405:		int budmin;
1406:	
1407:		/* allocation request should not be for more than the
1408:		 * allocation group size.
1409:		 */
1410:		if (l2nb > bmp->db_agl2size) {
1411:			jfs_error(bmp->db_ipbmap->i_sb,
1412:				  "allocation request is larger than the allocation group size\n");
1413:			return -EIO;
1414:		}
1415:	
1416:		/* determine the starting block number of the allocation
1417:		 * group.
1418:		 */
1419:		blkno = (s64) agno << bmp->db_agl2size;
1420:	
1421:		/* check if the allocation group size is the minimum allocation
1422:		 * group size or if the allocation group is completely free. if
1423:		 * the allocation group size is the minimum size of BPERDMAP (i.e.
1424:		 * 1 dmap), there is no need to search the dmap control page (below)
1425:		 * that fully describes the allocation group since the allocation
1426:		 * group is already fully described by a dmap.  in this case, we
1427:		 * just call dbAllocCtl() to search the dmap tree and allocate the
1428:		 * required space if available.
1429:		 *
1430:		 * if the allocation group is completely free, dbAllocCtl() is
1431:		 * also called to allocate the required space.  this is done for
1432:		 * two reasons.  first, it makes no sense searching the dmap control
1433:		 * pages for free space when we know that free space exists.  second,
1434:		 * the dmap control pages may indicate that the allocation group
1435:		 * has no free space if the allocation group is part (not the first
1436:		 * part) of a larger binary buddy system.
1437:		 */
1438:		if (bmp->db_agsize == BPERDMAP
1439:		    || bmp->db_agfree[agno] == bmp->db_agsize) {
1440:			rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1441:			if ((rc == -ENOSPC) &&
1442:			    (bmp->db_agfree[agno] == bmp->db_agsize)) {
1443:				printk(KERN_ERR "blkno = %Lx, blocks = %Lx\n",
1444:				       (unsigned long long) blkno,
1445:				       (unsigned long long) nblocks);
1446:				jfs_error(bmp->db_ipbmap->i_sb,
1447:					  "dbAllocCtl failed in free AG\n");
1448:			}
1449:			return (rc);
1450:		}
1451:	
1452:		/* the buffer for the dmap control page that fully describes the
1453:		 * allocation group.
1454:		 */
1455:		lblkno = BLKTOCTL(blkno, bmp->db_l2nbperpage, bmp->db_aglevel);
1456:		mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
1457:		if (mp == NULL)
1458:			return -EIO;
1459:		dcp = (struct dmapctl *) mp->data;
1460:		budmin = dcp->budmin;
1461:	
1462:		if (unlikely(!check_dmapctl(dcp))) {
1463:			jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
1464:			release_metapage(mp);
1465:			return -EIO;
1466:		}
1467:	
1468:		/* search the subtree(s) of the dmap control page that describes
1469:		 * the allocation group, looking for sufficient free space.  to begin,
1470:		 * determine how many allocation groups are represented in a dmap
1471:		 * control page at the control page level (i.e. L0, L1, L2) that
1472:		 * fully describes an allocation group. next, determine the starting
1473:		 * tree index of this allocation group within the control page.
1474:		 */
1475:		agperlev =
1476:		    (1 << (L2LPERCTL - (bmp->db_agheight << 1))) / bmp->db_agwidth;
1477:		ti = bmp->db_agstart + bmp->db_agwidth * (agno & (agperlev - 1));
1478:	
1479:		if (ti < 0 || ti >= le32_to_cpu(dcp->nleafs)) {
1480:			jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
1481:			release_metapage(mp);
1482:			return -EIO;
1483:		}
1484:	
1485:		/* dmap control page trees fan-out by 4 and a single allocation
1486:		 * group may be described by 1 or 2 subtrees within the ag level
1487:		 * dmap control page, depending upon the ag size. examine the ag's
1488:		 * subtrees for sufficient free space, starting with the leftmost
1489:		 * subtree.
1490:		 */
1491:		for (i = 0; i < bmp->db_agwidth; i++, ti++) {
1492:			/* is there sufficient free space ?
1493:			 */
1494:			if (l2nb > dcp->stree[ti])
1495:				continue;
1496:	
1497:			/* sufficient free space found in a subtree. now search down
1498:			 * the subtree to find the leftmost leaf that describes this
1499:			 * free space.
1500:			 */
1501:			for (k = bmp->db_agheight; k > 0; k--) {
1502:				for (n = 0, m = (ti << 2) + 1; n < 4; n++) {
1503:					if (l2nb <= dcp->stree[m + n]) {
1504:						ti = m + n;
1505:						break;
1506:					}
1507:				}
1508:				if (n == 4) {
1509:					jfs_error(bmp->db_ipbmap->i_sb,
1510:						  "failed descending stree\n");
1511:					release_metapage(mp);
1512:					return -EIO;
1513:				}
1514:			}
1515:	
1516:			/* determine the block number within the file system
1517:			 * that corresponds to this leaf.
1518:			 */
1519:			if (bmp->db_aglevel == 2)
1520:				blkno = 0;
1521:			else if (bmp->db_aglevel == 1)
1522:				blkno &= ~(MAXL1SIZE - 1);
1523:			else		/* bmp->db_aglevel == 0 */
1524:				blkno &= ~(MAXL0SIZE - 1);
1525:	
1526:			blkno +=
1527:			    ((s64) (ti - le32_to_cpu(dcp->leafidx))) << budmin;
1528:	
1529:			/* release the buffer in preparation for going down
1530:			 * the next level of dmap control pages.
1531:			 */
1532:			release_metapage(mp);
1533:	
1534:			/* check if we need to continue to search down the lower
1535:			 * level dmap control pages.  we need to if the number of
1536:			 * blocks required is less than maximum number of blocks
1537:			 * described at the next lower level.
1538:			 */
1539:			if (l2nb < budmin) {
1540:	
1541:				/* search the lower level dmap control pages to get
1542:				 * the starting block number of the dmap that
1543:				 * contains or starts off the free space.
1544:				 */
1545:				if ((rc =
1546:				     dbFindCtl(bmp, l2nb, bmp->db_aglevel - 1,
1547:					       &blkno))) {
1548:					if (rc == -ENOSPC) {
1549:						jfs_error(bmp->db_ipbmap->i_sb,
1550:							  "control page inconsistent\n");
1551:						return -EIO;
1552:					}
1553:					return (rc);
1554:				}
1555:			}
1556:	
1557:			/* allocate the blocks.
1558:			 */
1559:			rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1560:			if (rc == -ENOSPC) {
1561:				jfs_error(bmp->db_ipbmap->i_sb,
1562:					  "unable to allocate blocks\n");
1563:				rc = -EIO;
1564:			}
1565:			return (rc);
1566:		}
1567:	
1568:		/* no space in the allocation group.  release the buffer and
1569:		 * return -ENOSPC.
1570:		 */
1571:		release_metapage(mp);
1572:	
1573:		return -ENOSPC;
1574:	}
 SourceFile:fs/jfs/jfs_dmap.c]

192/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 34283
							output: 40
							thoughts: 173
						

Thoughts:
**Reviewing the DMAP Allocation Changes**

Okay, so `dbAllocAG` is working with `dmapctl`, and we already have `check_dmapctl` in place. Good. Now, let's step through the recent modifications I've made, specifically focusing on the DMAP tree integrity.

I introduced this `check_dmaptree` function, which is critical. I've now integrated it into a few core allocation/deallocation routines. Specifically, I've added a call to `check_dmaptree` wrapped in an `unlikely` conditional, checking for a potential issue, to the following:

*   `dbFreeDmap`: Ensures the deallocation process doesn't corrupt the tree.
*   `dbAllocNext`: I've replaced the old `leafidx` check (`if (dp->tree.leafidx != cpu_to_le32(LEAFIND))`) with this `check_dmaptree` call to provide more robust verification of the tree's health.
*   `dbAllocNear`: Same rationale as `dbAllocNext` – replacing the `leafidx` check with the `check_dmaptree` call for improved stability.
*   `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`: I've included the `check_dmaptree` within these functions as well, which are involved with level, bottom-up, and general DMAP allocation, respectively. This should improve their reliability.

Before I go further, I should verify the `dbAllocCtl` function, just to ensure that those changes were correctly integrated.



193/4 2026/06/30 14:47 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/jfs/jfs_dmap.c Name:dbAllocCtl]

Results:
map[SourceCode:1841:	/*
1842:	 * NAME:	dbAllocCtl()
1843:	 *
1844:	 * FUNCTION:	attempt to allocate a specified number of contiguous
1845:	 *		blocks starting within a specific dmap.
1846:	 *
1847:	 *		this routine is called by higher level routines that search
1848:	 *		the dmap control pages above the actual dmaps for contiguous
1849:	 *		free space.  the result of successful searches by these
1850:	 *		routines are the starting block numbers within dmaps, with
1851:	 *		the dmaps themselves containing the desired contiguous free
1852:	 *		space or starting a contiguous free space of desired size
1853:	 *		that is made up of the blocks of one or more dmaps. these
1854:	 *		calls should not fail due to insufficent resources.
1855:	 *
1856:	 *		this routine is called in some cases where it is not known
1857:	 *		whether it will fail due to insufficient resources.  more
1858:	 *		specifically, this occurs when allocating from an allocation
1859:	 *		group whose size is equal to the number of blocks per dmap.
1860:	 *		in this case, the dmap control pages are not examined prior
1861:	 *		to calling this routine (to save pathlength) and the call
1862:	 *		might fail.
1863:	 *
1864:	 *		for a request size that fits within a dmap, this routine relies
1865:	 *		upon the dmap's dmtree to find the requested contiguous free
1866:	 *		space.  for request sizes that are larger than a dmap, the
1867:	 *		requested free space will start at the first block of the
1868:	 *		first dmap (i.e. blkno).
1869:	 *
1870:	 * PARAMETERS:
1871:	 *	bmp	-  pointer to bmap descriptor
1872:	 *	nblocks	 -  actual number of contiguous free blocks to allocate.
1873:	 *	l2nb	 -  log2 number of contiguous free blocks to allocate.
1874:	 *	blkno	 -  starting block number of the dmap to start the allocation
1875:	 *		    from.
1876:	 *	results	-  on successful return, set to the starting block number
1877:	 *		   of the newly allocated range.
1878:	 *
1879:	 * RETURN VALUES:
1880:	 *	0	- success
1881:	 *	-ENOSPC	- insufficient disk resources
1882:	 *	-EIO	- i/o error
1883:	 *
1884:	 * serialization: IWRITE_LOCK(ipbmap) held on entry/exit;
1885:	 */
1886:	static int
1887:	dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
1888:	{
1889:		int rc, nb;
1890:		s64 b, lblkno, n;
1891:		struct metapage *mp;
1892:		struct dmap *dp;
1893:	
1894:		/* check if the allocation request is confined to a single dmap.
1895:		 */
1896:		if (l2nb <= L2BPERDMAP) {
1897:			/* get the buffer for the dmap.
1898:			 */
1899:			lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
1900:			mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
1901:			if (mp == NULL)
1902:				return -EIO;
1903:			dp = (struct dmap *) mp->data;
1904:	
1905:			if (dp->tree.budmin < 0) {
1906:				release_metapage(mp);
1907:				return -EIO;
1908:			}
1909:	
1910:			/* try to allocate the blocks.
1911:			 */
1912:			rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results);
1913:			if (rc == 0)
1914:				mark_metapage_dirty(mp);
1915:	
1916:			release_metapage(mp);
1917:	
1918:			return (rc);
1919:		}
1920:	
1921:		/* allocation request involving multiple dmaps. it must start on
1922:		 * a dmap boundary.
1923:		 */
1924:		assert((blkno & (BPERDMAP - 1)) == 0);
1925:	
1926:		/* allocate the blocks dmap by dmap.
1927:		 */
1928:		for (n = nblocks, b = blkno; n > 0; n -= nb, b += nb) {
1929:			/* get the buffer for the dmap.
1930:			 */
1931:			lblkno = BLKTODMAP(b, bmp->db_l2nbperpage);
1932:			mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
1933:			if (mp == NULL) {
1934:				rc = -EIO;
1935:				goto backout;
1936:			}
1937:			dp = (struct dmap *) mp->data;
1938:	
1939:			/* the dmap better be all free.
1940:			 */
1941:			if (dp->tree.stree[ROOT] != L2BPERDMAP) {
1942:				release_metapage(mp);
1943:				jfs_error(bmp->db_ipbmap->i_sb,
1944:					  "the dmap is not all free\n");
1945:				rc = -EIO;
1946:				goto backout;
1947:			}
1948:	
1949:			/* determine how many blocks to allocate from this dmap.
1950:			 */
1951:			nb = min_t(s64, n, BPERDMAP);
1952:	
1953:			/* allocate the blocks from the dmap.
1954:			 */
1955:			if ((rc = dbAllocDmap(bmp, dp, b, nb))) {
1956:				release_metapage(mp);
1957:				goto backout;
1958:			}
1959:	
1960:			/* write the buffer.
1961:			 */
1962:			write_metapage(mp);
1963:		}
1964:	
1965:		/* set the results (starting block number) and return.
1966:		 */
1967:		*results = blkno;
1968:		return (0);
1969:	
1970:		/* something failed in handling an allocation request involving
1971:		 * multiple dmaps.  we'll try to clean up by backing out any
1972:		 * allocation that has already happened for this request.  if
1973:		 * we fail in backing out the allocation, we'll mark the file
1974:		 * system to indicate that blocks have been leaked.
1975:		 */
1976:	      backout:
1977:	
1978:		/* try to backout the allocations dmap by dmap.
1979:		 */
1980:		for (n = nblocks - n, b = blkno; n > 0;
1981:		     n -= BPERDMAP, b += BPERDMAP) {
1982:			/* get the buffer for this dmap.
1983:			 */
1984:			lblkno = BLKTODMAP(b, bmp->db_l2nbperpage);
1985:			mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
1986:			if (mp == NULL) {
1987:				/* could not back out.  mark the file system
1988:				 * to indicate that we have leaked blocks.
1989:				 */
1990:				jfs_error(bmp->db_ipbmap->i_sb,
1991:					  "I/O Error: Block Leakage\n");
1992:				continue;
1993:			}
1994:			dp = (struct dmap *) mp->data;
1995:	
1996:			/* free the blocks is this dmap.
1997:			 */
1998:			if (dbFreeDmap(bmp, dp, b, BPERDMAP)) {
1999:				/* could not back out.  mark the file system
2000:				 * to indicate that we have leaked blocks.
2001:				 */
2002:				release_metapage(mp);
2003:				jfs_error(bmp->db_ipbmap->i_sb, "Block Leakage\n");
2004:				continue;
2005:			}
2006:	
2007:			/* write the buffer.
2008:			 */
2009:			write_metapage(mp);
2010:		}
2011:	
2012:		return (rc);
2013:	}
 SourceFile:fs/jfs/jfs_dmap.c]

194/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 37517
							output: 15
							thoughts: 374
						

Thoughts:
**Reviewing the DMAP Allocation/Freeing Code**

Okay, so I'm looking at this `dbAllocCtl` function, and it's calling a few other functions, specifically `dbAllocDmapLev`, `dbAllocDmap`, and `dbFreeDmap`. All of those guys have `check_dmaptree` calls in them, which is good. But `dbAllocCtl` itself is also doing some checks on the `dp->tree` structure *before* it calls those other functions. Specifically, I see it's checking `dp->tree.budmin < 0` and also if `dp->tree.stree[ROOT]` is not equal to `L2BPERDMAP`.

I was initially thinking that since `dbAllocDmapLev` and `dbAllocDmap` also check `dp->tree`, maybe it was redundant. But then I realized that `dbAllocCtl` accesses `dp->tree.stree[ROOT]` *before* it calls any of those other functions. Hmm, so that's a point of potential concern. Let's look at that access:

```c
		if (dp->tree.stree[ROOT] != L2BPERDMAP) {
```

Right, okay, so it's checking `dp->tree.stree[ROOT]`. Now, `ROOT` is just a constant of 1, so it's always accessing the second element (`stree[1]`) of the array. The `stree` array itself has a size of `TREESIZE`, which is defined as 341. So, access to `stree[1]` is always in bounds. So, the potential out-of-bounds issue I was initially worried about is not an issue.

However, it's still checking `dp->tree.budmin < 0`.

The question then becomes: Is it worth adding a `check_dmaptree` call *inside* `dbAllocCtl` itself? The documentation I have says to put `check_dmaptree` in functions that operate on the `dmap` structure. So, I added it to all the functions specified. I think I will leave it out for now.

Let's do a quick run over using `patch-diff` and then I'll sign off.



195/4 2026/06/30 14:47 tool patch-diff
0m Args:
map[File:]

Results:
map[Output:diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index a841cf21d..d2cd7d2e8 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -136,104 +136,184 @@ static const s8 budtab[256] = {
 /*
  * check_dmapctl - Validate integrity of a dmapctl structure
  * @dcp: Pointer to the dmapctl structure to check
  *
  * Return: true if valid, false if corrupted
  */
 static bool check_dmapctl(struct dmapctl *dcp)
 {
 	s8 budmin = dcp->budmin;
 	u32 nleafs, l2nleafs, leafidx, height;
 	int i;
 
 	nleafs = le32_to_cpu(dcp->nleafs);
 	/* Check basic field ranges */
 	if (unlikely(nleafs > LPERCTL)) {
 		jfs_err("dmapctl: invalid nleafs %u (max %u)",
 			nleafs, LPERCTL);
 		return false;
 	}
 
 	l2nleafs = le32_to_cpu(dcp->l2nleafs);
 	if (unlikely(l2nleafs > L2LPERCTL)) {
 		jfs_err("dmapctl: invalid l2nleafs %u (max %u)",
 			l2nleafs, L2LPERCTL);
 		return false;
 	}
 
 	/* Verify nleafs matches l2nleafs (must be power of two) */
 	if (unlikely((1U << l2nleafs) != nleafs)) {
 		jfs_err("dmapctl: nleafs %u != 2^%u",
 			nleafs, l2nleafs);
 		return false;
 	}
 
 	leafidx = le32_to_cpu(dcp->leafidx);
 	/* Check leaf index matches expected position */
 	if (unlikely(leafidx != CTLLEAFIND)) {
 		jfs_err("dmapctl: invalid leafidx %u (expected %u)",
 			leafidx, CTLLEAFIND);
 		return false;
 	}
 
 	height = le32_to_cpu(dcp->height);
 	/* Check tree height is within valid range */
 	if (unlikely(height > (L2LPERCTL >> 1))) {
 		jfs_err("dmapctl: invalid height %u (max %u)",
 			height, L2LPERCTL >> 1);
 		return false;
 	}
 
 	/* Check budmin is valid (cannot be NOFREE for non-empty tree) */
 	if (budmin == NOFREE) {
 		if (unlikely(nleafs > 0)) {
 			jfs_err("dmapctl: budmin is NOFREE but nleafs %u",
 				nleafs);
 			return false;
 		}
 	} else if (unlikely(budmin < BUDMIN)) {
 		jfs_err("dmapctl: invalid budmin %d (min %d)",
 			budmin, BUDMIN);
 		return false;
 	}
 
 	/* Check leaf nodes fit within stree array */
 	if (unlikely(leafidx + nleafs > CTLTREESIZE)) {
 		jfs_err("dmapctl: leaf range exceeds stree size (end %u > %u)",
 			leafidx + nleafs, CTLTREESIZE);
 		return false;
 	}
 
 	/* Check leaf nodes have valid values */
 	for (i = leafidx; i < leafidx + nleafs; i++) {
 		s8 val = dcp->stree[i];
 
 		if (unlikely(val < NOFREE)) {
 			jfs_err("dmapctl: invalid leaf value %d at index %d",
 					val, i);
 			return false;
 		} else if (unlikely(val > 31)) {
 			jfs_err("dmapctl: leaf value %d too large at index %d", val, i);
 			return false;
 		}
 	}
 
 	return true;
 }
 
+/*
+ * check_dmaptree - Validate integrity of a dmaptree structure
+ * @dtp: Pointer to the dmaptree structure to check
+ *
+ * Return: true if valid, false if corrupted
+ */
+static bool check_dmaptree(struct dmaptree *dtp)
+{
+	u32 nleafs, l2nleafs, leafidx, height;
+	int i;
+
+	nleafs = le32_to_cpu(dtp->nleafs);
+	/* Check basic field ranges */
+	if (unlikely(nleafs > LPERDMAP)) {
+		jfs_err("dmaptree: invalid nleafs %u (max %u)",
+			nleafs, LPERDMAP);
+		return false;
+	}
+
+	l2nleafs = le32_to_cpu(dtp->l2nleafs);
+	if (unlikely(l2nleafs > L2LPERDMAP)) {
+		jfs_err("dmaptree: invalid l2nleafs %u (max %u)",
+			l2nleafs, L2LPERDMAP);
+		return false;
+	}
+
+	/* Verify nleafs matches l2nleafs (must be power of two) */
+	if (unlikely((1U << l2nleafs) != nleafs)) {
+		jfs_err("dmaptree: nleafs %u != 2^%u",
+			nleafs, l2nleafs);
+		return false;
+	}
+
+	leafidx = le32_to_cpu(dtp->leafidx);
+	/* Check leaf index matches expected position */
+	if (unlikely(leafidx != LEAFIND)) {
+		jfs_err("dmaptree: invalid leafidx %u (expected %u)",
+			leafidx, LEAFIND);
+		return false;
+	}
+
+	height = le32_to_cpu(dtp->height);
+	/* Check tree height is within valid range */
+	if (unlikely(height > 4)) {
+		jfs_err("dmaptree: invalid height %u (max 4)",
+			height);
+		return false;
+	}
+
+	/* Check budmin is valid */
+	if (unlikely(dtp->budmin < BUDMIN)) {
+		jfs_err("dmaptree: invalid budmin %d (min %d)",
+			dtp->budmin, BUDMIN);
+		return false;
+	}
+
+	/* Check leaf nodes fit within stree array */
+	if (unlikely(leafidx + nleafs > TREESIZE)) {
+		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
+			leafidx + nleafs, TREESIZE);
+		return false;
+	}
+
+	/* Check leaf nodes have valid values */
+	for (i = leafidx; i < leafidx + nleafs; i++) {
+		s8 val = dtp->stree[i];
+
+		if (unlikely(val < NOFREE)) {
+			jfs_err("dmaptree: invalid leaf value %d at index %d",
+					val, i);
+			return false;
+		} else if (unlikely(val > 31)) {
+			jfs_err("dmaptree: leaf value %d too large at index %d", val, i);
+			return false;
+		}
+	}
+
+	return true;
+}
+
 /*
  * NAME:	dbMount()
  *
  * FUNCTION:	initializate the block allocation map.
  *
  *		memory is allocated for the in-core bmap descriptor and
  *		the in-core descriptor is initialized from disk.
  *
  * PARAMETERS:
  *	ipbmap	- pointer to in-core inode for the block map.
  *
  * RETURN VALUES:
  *	0	- success
  *	-ENOMEM	- insufficient memory
  *	-EIO	- i/o error
  *	-EINVAL - wrong bmap data
  */
@@ -1139,259 +1219,259 @@ static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
 /*
  * NAME:	dbAllocNext()
  *
  * FUNCTION:	attempt to allocate the blocks of the specified block
  *		range within a dmap.
  *
  * PARAMETERS:
  *	bmp	-  pointer to bmap descriptor
  *	dp	-  pointer to dmap.
  *	blkno	-  starting block number of the range.
  *	nblocks	-  number of contiguous free blocks of the range.
  *
  * RETURN VALUES:
  *	0	- success
  *	-ENOSPC	- insufficient disk resources
  *	-EIO	- i/o error
  *
  * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
  */
 static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks)
 {
 	int dbitno, word, rembits, nb, nwords, wbitno, nw;
 	int l2size;
 	s8 *leaf;
 	u32 mask;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
 
 	/* pick up a pointer to the leaves of the dmap tree.
 	 */
 	leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx);
 
 	/* determine the bit number and word within the dmap of the
 	 * starting block.
 	 */
 	dbitno = blkno & (BPERDMAP - 1);
 	word = dbitno >> L2DBWORD;
 
 	/* check if the specified block range is contained within
 	 * this dmap.
 	 */
 	if (dbitno + nblocks > BPERDMAP)
 		return -ENOSPC;
 
 	/* check if the starting leaf indicates that anything
 	 * is free.
 	 */
 	if (leaf[word] == NOFREE)
 		return -ENOSPC;
 
 	/* check the dmaps words corresponding to block range to see
 	 * if the block range is free.  not all bits of the first and
 	 * last words may be contained within the block range.  if this
 	 * is the case, we'll work against those words (i.e. partial first
 	 * and/or last) on an individual basis (a single pass) and examine
 	 * the actual bits to determine if they are free.  a single pass
 	 * will be used for all dmap words fully contained within the
 	 * specified range.  within this pass, the leaves of the dmap
 	 * tree will be examined to determine if the blocks are free. a
 	 * single leaf may describe the free space of multiple dmap
 	 * words, so we may visit only a subset of the actual leaves
 	 * corresponding to the dmap words of the block range.
 	 */
 	for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
 		/* determine the bit number within the word and
 		 * the number of bits within the word.
 		 */
 		wbitno = dbitno & (DBWORD - 1);
 		nb = min(rembits, DBWORD - wbitno);
 
 		/* check if only part of the word is to be examined.
 		 */
 		if (nb < DBWORD) {
 			/* check if the bits are free.
 			 */
 			mask = (ONES << (DBWORD - nb) >> wbitno);
 			if ((mask & ~le32_to_cpu(dp->wmap[word])) != mask)
 				return -ENOSPC;
 
 			word += 1;
 		} else {
 			/* one or more dmap words are fully contained
 			 * within the block range.  determine how many
 			 * words and how many bits.
 			 */
 			nwords = rembits >> L2DBWORD;
 			nb = nwords << L2DBWORD;
 
 			/* now examine the appropriate leaves to determine
 			 * if the blocks are free.
 			 */
 			while (nwords > 0) {
 				/* does the leaf describe any free space ?
 				 */
 				if (leaf[word] < BUDMIN)
 					return -ENOSPC;
 
 				/* determine the l2 number of bits provided
 				 * by this leaf.
 				 */
 				l2size =
 				    min_t(int, leaf[word], NLSTOL2BSZ(nwords));
 
 				/* determine how many words were handled.
 				 */
 				nw = BUDSIZE(l2size, BUDMIN);
 
 				nwords -= nw;
 				word += nw;
 			}
 		}
 	}
 
 	/* allocate the blocks.
 	 */
 	return (dbAllocDmap(bmp, dp, blkno, nblocks));
 }
 
 
 /*
  * NAME:	dbAllocNear()
  *
  * FUNCTION:	attempt to allocate a number of contiguous free blocks near
  *		a specified block (hint) within a dmap.
  *
  *		starting with the dmap leaf that covers the hint, we'll
  *		check the next four contiguous leaves for sufficient free
  *		space.  if sufficient free space is found, we'll allocate
  *		the desired free space.
  *
  * PARAMETERS:
  *	bmp	-  pointer to bmap descriptor
  *	dp	-  pointer to dmap.
  *	blkno	-  block number to allocate near.
  *	nblocks	-  actual number of contiguous free blocks desired.
  *	l2nb	-  log2 number of contiguous free blocks desired.
  *	results	-  on successful return, set to the starting block number
  *		   of the newly allocated range.
  *
  * RETURN VALUES:
  *	0	- success
  *	-ENOSPC	- insufficient disk resources
  *	-EIO	- i/o error
  *
  * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
  */
 static int
 dbAllocNear(struct bmap * bmp,
 	    struct dmap * dp, s64 blkno, int nblocks, int l2nb, s64 * results)
 {
 	int word, lword, rc;
 	s8 *leaf;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
 
 	leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx);
 
 	/* determine the word within the dmap that holds the hint
 	 * (i.e. blkno).  also, determine the last word in the dmap
 	 * that we'll include in our examination.
 	 */
 	word = (blkno & (BPERDMAP - 1)) >> L2DBWORD;
 	lword = min(word + 4, LPERDMAP);
 
 	/* examine the leaves for sufficient free space.
 	 */
 	for (; word < lword; word++) {
 		/* does the leaf describe sufficient free space ?
 		 */
 		if (leaf[word] < l2nb)
 			continue;
 
 		/* determine the block number within the file system
 		 * of the first block described by this dmap word.
 		 */
 		blkno = le64_to_cpu(dp->start) + (word << L2DBWORD);
 
 		/* if not all bits of the dmap word are free, get the
 		 * starting bit number within the dmap word of the required
 		 * string of free bits and adjust the block number with the
 		 * value.
 		 */
 		if (leaf[word] < BUDMIN)
 			blkno +=
 			    dbFindBits(le32_to_cpu(dp->wmap[word]), l2nb);
 
 		/* allocate the blocks.
 		 */
 		if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
 			*results = blkno;
 
 		return (rc);
 	}
 
 	return -ENOSPC;
 }
 
 
 /*
  * NAME:	dbAllocAG()
  *
  * FUNCTION:	attempt to allocate the specified number of contiguous
  *		free blocks within the specified allocation group.
  *
  *		unless the allocation group size is equal to the number
  *		of blocks per dmap, the dmap control pages will be used to
  *		find the required free space, if available.  we start the
  *		search at the highest dmap control page level which
  *		distinctly describes the allocation group's free space
  *		(i.e. the highest level at which the allocation group's
  *		free space is not mixed in with that of any other group).
  *		in addition, we start the search within this level at a
  *		height of the dmapctl dmtree at which the nodes distinctly
  *		describe the allocation group's free space.  at this height,
  *		the allocation group's free space may be represented by 1
  *		or two sub-trees, depending on the allocation group size.
  *		we search the top nodes of these subtrees left to right for
  *		sufficient free space.  if sufficient free space is found,
  *		the subtree is searched to find the leftmost leaf that
  *		has free space.  once we have made it to the leaf, we
  *		move the search to the next lower level dmap control page
  *		corresponding to this leaf.  we continue down the dmap control
  *		pages until we find the dmap that contains or starts the
  *		sufficient free space and we allocate at this dmap.
  *
  *		if the allocation group size is equal to the dmap size,
  *		we'll start at the dmap corresponding to the allocation
  *		group and attempt the allocation at this level.
  *
  *		the dmap control page search is also not performed if the
  *		allocation group is completely free and we go to the first
  *		dmap of the allocation group to do the allocation.  this is
  *		done because the allocation group may be part (not the first
  *		part) of a larger binary buddy system, causing the dmap
  *		control pages to indicate no free space (NOFREE) within
  *		the allocation group.
  *
  * PARAMETERS:
  *	bmp	-  pointer to bmap descriptor
  *	agno	- allocation group number.
  *	nblocks	-  actual number of contiguous free blocks desired.
  *	l2nb	-  log2 number of contiguous free blocks desired.
  *	results	-  on successful return, set to the starting block number
  *		   of the newly allocated range.
  *
  * RETURN VALUES:
  *	0	- success
  *	-ENOSPC	- insufficient disk resources
  *	-EIO	- i/o error
  *
  * note: IWRITE_LOCK(ipmap) held on entry/exit;
  */
@@ -2039,187 +2119,202 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
  * serialization: IREAD_LOCK(ipbmap), e.g., from dbAlloc(), or
  *	IWRITE_LOCK(ipbmap), e.g., dbAllocCtl(), held on entry/exit;
  */
 static int
 dbAllocDmapLev(struct bmap * bmp,
 	       struct dmap * dp, int nblocks, int l2nb, s64 * results)
 {
 	s64 blkno;
 	int leafidx, rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* can't be more than a dmaps worth of blocks */
 	assert(l2nb <= L2BPERDMAP);
 
 	/* search the tree within the dmap page for sufficient
 	 * free space.  if sufficient free space is found, dbFindLeaf()
 	 * returns the index of the leaf at which free space was found.
 	 */
 	if (dbFindLeaf((dmtree_t *) &dp->tree, l2nb, &leafidx, false))
 		return -ENOSPC;
 
 	if (leafidx < 0)
 		return -EIO;
 
 	/* determine the block number within the file system corresponding
 	 * to the leaf at which free space was found.
 	 */
 	blkno = le64_to_cpu(dp->start) + (leafidx << L2DBWORD);
 
 	/* if not all bits of the dmap word are free, get the starting
 	 * bit number within the dmap word of the required string of free
 	 * bits and adjust the block number with this value.
 	 */
 	if (dp->tree.stree[leafidx + LEAFIND] < BUDMIN)
 		blkno += dbFindBits(le32_to_cpu(dp->wmap[leafidx]), l2nb);
 
 	/* allocate the blocks */
 	if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
 		*results = blkno;
 
 	return (rc);
 }
 
 
 /*
  * NAME:	dbAllocDmap()
  *
  * FUNCTION:	adjust the disk allocation map to reflect the allocation
  *		of a specified block range within a dmap.
  *
  *		this routine allocates the specified blocks from the dmap
  *		through a call to dbAllocBits(). if the allocation of the
  *		block range causes the maximum string of free blocks within
  *		the dmap to change (i.e. the value of the root of the dmap's
  *		dmtree), this routine will cause this change to be reflected
  *		up through the appropriate levels of the dmap control pages
  *		by a call to dbAdjCtl() for the L0 dmap control page that
  *		covers this dmap.
  *
  * PARAMETERS:
  *	bmp	-  pointer to bmap descriptor
  *	dp	-  pointer to dmap to allocate the block range from.
  *	blkno	-  starting block number of the block to be allocated.
  *	nblocks	-  number of blocks to be allocated.
  *
  * RETURN VALUES:
  *	0	- success
  *	-EIO	- i/o error
  *
  * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
  */
 static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks)
 {
 	s8 oldroot;
 	int rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
 	oldroot = dp->tree.stree[ROOT];
 
 	/* allocate the specified (blocks) bits */
 	dbAllocBits(bmp, dp, blkno, nblocks);
 
 	/* if the root has not changed, done. */
 	if (dp->tree.stree[ROOT] == oldroot)
 		return (0);
 
 	/* root changed. bubble the change up to the dmap control pages.
 	 * if the adjustment of the upper level control pages fails,
 	 * backout the bit allocation (thus making everything consistent).
 	 */
 	if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 1, 0)))
 		dbFreeBits(bmp, dp, blkno, nblocks);
 
 	return (rc);
 }
 
 
 /*
  * NAME:	dbFreeDmap()
  *
  * FUNCTION:	adjust the disk allocation map to reflect the allocation
  *		of a specified block range within a dmap.
  *
  *		this routine frees the specified blocks from the dmap through
  *		a call to dbFreeBits(). if the deallocation of the block range
  *		causes the maximum string of free blocks within the dmap to
  *		change (i.e. the value of the root of the dmap's dmtree), this
  *		routine will cause this change to be reflected up through the
  *		appropriate levels of the dmap control pages by a call to
  *		dbAdjCtl() for the L0 dmap control page that covers this dmap.
  *
  * PARAMETERS:
  *	bmp	-  pointer to bmap descriptor
  *	dp	-  pointer to dmap to free the block range from.
  *	blkno	-  starting block number of the block to be freed.
  *	nblocks	-  number of blocks to be freed.
  *
  * RETURN VALUES:
  *	0	- success
  *	-EIO	- i/o error
  *
  * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
  */
 static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		      int nblocks)
 {
 	s8 oldroot;
 	int rc = 0, word;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
 	oldroot = dp->tree.stree[ROOT];
 
 	/* free the specified (blocks) bits */
 	rc = dbFreeBits(bmp, dp, blkno, nblocks);
 
 	/* if error or the root has not changed, done. */
 	if (rc || (dp->tree.stree[ROOT] == oldroot))
 		return (rc);
 
 	/* root changed. bubble the change up to the dmap control pages.
 	 * if the adjustment of the upper level control pages fails,
 	 * backout the deallocation.
 	 */
 	if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 0, 0))) {
 		word = (blkno & (BPERDMAP - 1)) >> L2DBWORD;
 
 		/* as part of backing out the deallocation, we will have
 		 * to back split the dmap tree if the deallocation caused
 		 * the freed blocks to become part of a larger binary buddy
 		 * system.
 		 */
 		if (dp->tree.stree[word] == NOFREE)
 			dbBackSplit((dmtree_t *)&dp->tree, word, false);
 
 		dbAllocBits(bmp, dp, blkno, nblocks);
 	}
 
 	return (rc);
 }
 
 
 /*
  * NAME:	dbAllocBits()
  *
  * FUNCTION:	allocate a specified block range from a dmap.
  *
  *		this routine updates the dmap to reflect the working
  *		state allocation of the specified block range. it directly
  *		updates the bits of the working map and causes the adjustment
  *		of the binary buddy system described by the dmap's dmtree
  *		leaves to reflect the bits allocated.  it also causes the
  *		dmap's dmtree, as a whole, to reflect the allocated range.
  *
  * PARAMETERS:
  *	bmp	-  pointer to bmap descriptor
  *	dp	-  pointer to dmap to allocate bits from.
  *	blkno	-  starting block number of the bits to be allocated.
  *	nblocks	-  number of bits to be allocated.
  *
  * RETURN VALUES: none
  *
  * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
  */
@@ -3331,123 +3426,128 @@ int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks)
 
 
 static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
 			 int nblocks)
 {
 	int rc;
 	int dbitno, word, rembits, nb, nwords, wbitno, agno;
 	s8 oldroot;
 	struct dmaptree *tp = (struct dmaptree *) & dp->tree;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
 	oldroot = tp->stree[ROOT];
 
 	/* determine the bit number and word within the dmap of the
 	 * starting block.
 	 */
 	dbitno = blkno & (BPERDMAP - 1);
 	word = dbitno >> L2DBWORD;
 
 	/* block range better be within the dmap */
 	assert(dbitno + nblocks <= BPERDMAP);
 
 	/* allocate the bits of the dmap's words corresponding to the block
 	 * range. not all bits of the first and last words may be contained
 	 * within the block range.  if this is the case, we'll work against
 	 * those words (i.e. partial first and/or last) on an individual basis
 	 * (a single pass), allocating the bits of interest by hand and
 	 * updating the leaf corresponding to the dmap word. a single pass
 	 * will be used for all dmap words fully contained within the
 	 * specified range.  within this pass, the bits of all fully contained
 	 * dmap words will be marked as free in a single shot and the leaves
 	 * will be updated. a single leaf may describe the free space of
 	 * multiple dmap words, so we may update only a subset of the actual
 	 * leaves corresponding to the dmap words of the block range.
 	 */
 	for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
 		/* determine the bit number within the word and
 		 * the number of bits within the word.
 		 */
 		wbitno = dbitno & (DBWORD - 1);
 		nb = min(rembits, DBWORD - wbitno);
 
 		/* check if only part of a word is to be allocated.
 		 */
 		if (nb < DBWORD) {
 			/* allocate (set to 1) the appropriate bits within
 			 * this dmap word.
 			 */
 			dp->wmap[word] |= cpu_to_le32(ONES << (DBWORD - nb)
 						      >> wbitno);
 
 			word++;
 		} else {
 			/* one or more dmap words are fully contained
 			 * within the block range.  determine how many
 			 * words and allocate (set to 1) the bits of these
 			 * words.
 			 */
 			nwords = rembits >> L2DBWORD;
 			memset(&dp->wmap[word], (int) ONES, nwords * 4);
 
 			/* determine how many bits */
 			nb = nwords << L2DBWORD;
 			word += nwords;
 		}
 	}
 
 	/* update the free count for this dmap */
 	le32_add_cpu(&dp->nfree, -nblocks);
 
 	/* reconstruct summary tree */
 	dbInitDmapTree(dp);
 
 	BMAP_LOCK(bmp);
 
 	/* if this allocation group is completely free,
 	 * update the highest active allocation group number
 	 * if this allocation group is the new max.
 	 */
 	agno = blkno >> bmp->db_agl2size;
 	if (agno > bmp->db_maxag)
 		bmp->db_maxag = agno;
 
 	/* update the free count for the allocation group and map */
 	bmp->db_agfree[agno] -= nblocks;
 	bmp->db_nfree -= nblocks;
 
 	BMAP_UNLOCK(bmp);
 
 	/* if the root has not changed, done. */
 	if (tp->stree[ROOT] == oldroot)
 		return (0);
 
 	/* root changed. bubble the change up to the dmap control pages.
 	 * if the adjustment of the upper level control pages fails,
 	 * backout the bit allocation (thus making everything consistent).
 	 */
 	if ((rc = dbAdjCtl(bmp, blkno, tp->stree[ROOT], 1, 0)))
 		dbFreeBits(bmp, dp, blkno, nblocks);
 
 	return (rc);
 }
 
 
 /*
  * NAME:	dbExtendFS()
  *
  * FUNCTION:	extend bmap from blkno for nblocks;
  *		dbExtendFS() updates bmap ready for dbAllocBottomUp();
  *
  * L2
  *  |
  *   L1---------------------------------L1
  *    |					 |
  *     L0---------L0---------L0		  L0---------L0---------L0
  *      |	   |	      |		   |	      |		 |
  *	 d0,...,dn  d0,...,dn  d0,...,dn    d0,...,dn  d0,...,dn  d0,.,dm;
  * L2L1L0d0,...,dnL0d0,...,dnL0d0,...,dnL1L0d0,...,dnL0d0,...,dnL0d0,..dm
  *
  * <---old---><----------------------------extend----------------------->
  */
]

196/4 2026/06/30 14:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 47373
							output: 628
							thoughts: 512
						

Thoughts:
**Validation of the dmaptree Implementation**

Okay, the changes look solid, exactly what was specified. I've integrated `check_dmaptree` as requested, baking it into the relevant functions: `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. The patch diff confirms the implementation is precisely what I had in mind.

Now, let's just make sure there aren't any sneaky spots where `dmaptree` is used directly without that crucial validation. Let's trace it through: `dbInitDmapTree` and `dbInitDmap`, and `dbInitTree` all initialize it, so those are safe. `dbAdjTree` modifies it, but that's always called from `dbJoin` and `dbSplit`. Those are called from `dbFreeBits` and `dbAllocBits`, and *those* are now called by functions with the validation in place. `dbFindLeaf` gets called from `dbAllocDmapLev`, which has validation, and `dbAllocCtl` (for `dmapctl`), which also has validation. `dbBackSplit` is called from `dbFreeDmap` - which is also covered. `dbJoin` is called from `dbFreeBits`, which in turn is called from `dbFreeDmap`, `dbAllocDmapBU` and `dbAllocDmap`, all covered. Finally, `dbSplit` is called from `dbAllocBits`, which is called from `dbAllocDmap` and `dbFreeDmap` (covered), and `dbAdjCtl` (for `dmapctl`), also covered.

Alright, looks like every entry point that touches the `dmaptree` is now covered by the new validation. Seems comprehensive. I can formulate the final reply. This is a good solution to prevent out-of-bounds access.



197/3 2026/06/30 14:47 action test-patch
21m Results:
map[PatchDiff:diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index a841cf21d..4f2e0b78d 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -220,6 +220,85 @@ static bool check_dmapctl(struct dmapctl *dcp)
 	return true;
 }
 
+/*
+ * check_dmaptree - Validate integrity of a dmaptree structure
+ * @dtp: Pointer to the dmaptree structure to check
+ *
+ * Return: true if valid, false if corrupted
+ */
+static bool check_dmaptree(struct dmaptree *dtp)
+{
+	u32 nleafs, l2nleafs, leafidx, height;
+	int i;
+
+	nleafs = le32_to_cpu(dtp->nleafs);
+	/* Check basic field ranges */
+	if (unlikely(nleafs > LPERDMAP)) {
+		jfs_err("dmaptree: invalid nleafs %u (max %u)", nleafs,
+			LPERDMAP);
+		return false;
+	}
+
+	l2nleafs = le32_to_cpu(dtp->l2nleafs);
+	if (unlikely(l2nleafs > L2LPERDMAP)) {
+		jfs_err("dmaptree: invalid l2nleafs %u (max %u)", l2nleafs,
+			L2LPERDMAP);
+		return false;
+	}
+
+	/* Verify nleafs matches l2nleafs (must be power of two) */
+	if (unlikely((1U << l2nleafs) != nleafs)) {
+		jfs_err("dmaptree: nleafs %u != 2^%u", nleafs, l2nleafs);
+		return false;
+	}
+
+	leafidx = le32_to_cpu(dtp->leafidx);
+	/* Check leaf index matches expected position */
+	if (unlikely(leafidx != LEAFIND)) {
+		jfs_err("dmaptree: invalid leafidx %u (expected %u)", leafidx,
+			LEAFIND);
+		return false;
+	}
+
+	height = le32_to_cpu(dtp->height);
+	/* Check tree height is within valid range */
+	if (unlikely(height > 4)) {
+		jfs_err("dmaptree: invalid height %u (max 4)", height);
+		return false;
+	}
+
+	/* Check budmin is valid */
+	if (unlikely(dtp->budmin < BUDMIN)) {
+		jfs_err("dmaptree: invalid budmin %d (min %d)", dtp->budmin,
+			BUDMIN);
+		return false;
+	}
+
+	/* Check leaf nodes fit within stree array */
+	if (unlikely(leafidx + nleafs > TREESIZE)) {
+		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
+			leafidx + nleafs, TREESIZE);
+		return false;
+	}
+
+	/* Check leaf nodes have valid values */
+	for (i = leafidx; i < leafidx + nleafs; i++) {
+		s8 val = dtp->stree[i];
+
+		if (unlikely(val < NOFREE)) {
+			jfs_err("dmaptree: invalid leaf value %d at index %d",
+				val, i);
+			return false;
+		} else if (unlikely(val > 31)) {
+			jfs_err("dmaptree: leaf value %d too large at index %d",
+				val, i);
+			return false;
+		}
+	}
+
+	return true;
+}
+
 /*
  * NAME:	dbMount()
  *
@@ -1163,7 +1242,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 *leaf;
 	u32 mask;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
@@ -1293,7 +1372,7 @@ dbAllocNear(struct bmap * bmp,
 	int word, lword, rc;
 	s8 *leaf;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
@@ -2046,6 +2125,11 @@ dbAllocDmapLev(struct bmap * bmp,
 	s64 blkno;
 	int leafidx, rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* can't be more than a dmaps worth of blocks */
 	assert(l2nb <= L2BPERDMAP);
 
@@ -2112,6 +2196,11 @@ static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	int rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
@@ -2167,6 +2256,11 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	int rc = 0, word;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
@@ -3338,6 +3432,11 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	struct dmaptree *tp = (struct dmaptree *) & dp->tree;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
 TestError:]

198/1 2026/06/30 15:08 agent fixes-finder
13m Model:
best-expensive

Results:
map[FixesHash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2]

Instruction:
You are an experienced Linux kernel developer tasked with identifying the commit
that introduced the bug being fixed. Identifying the correct buggy commit is crucial
for proper kernel maintenance (backporting to stable trees, etc.).

Your investigation strategy:
1. Examine the patch that fixes the bug. Use git tools (like git-log or git-blame)
   to trace the history of the lines or functions modified by the patch.
2. Analyze the stack trace in the crash report. Identify the key files and functions
   involved in the crash and investigate their history to see when the problematic
   logic was introduced.
3. Compare the bug explanation with the commit history to find the point where
   the described logic error first appeared.

A bug is typically introduced when a piece of code is first written, or when
a refactoring changed its logic in a way that introduced the bug.
Trace the history of relevant symbols or find when specific code patterns were introduced/removed.

You must provide exactly one bug-introducing commit hash.
If you are unable to confidently determine the bug-introducing commit after investigation,
return an empty string rather than guessing.

Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
The crash is:

------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in /app/workdir/cache/src/7be5f73ee7b4d1978813accf8bb54cd892ccd800/fs/jfs/jfs_dmap.c:2867:24
index 4294967295 is out of range for type 's8[1365]' (aka 'signed char[1365]')
CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted syzkaller #1 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 ubsan_epilogue+0xa/0x30 lib/ubsan.c:233
 __ubsan_handle_out_of_bounds+0xe8/0xf0 lib/ubsan.c:455
 dbJoin+0xcc4/0xd60 fs/jfs/jfs_dmap.c:2867
 dbFreeBits+0x4a2/0xd70 fs/jfs/jfs_dmap.c:2427
 dbFreeDmap fs/jfs/jfs_dmap.c:2176 [inline]
 dbFree+0x324/0x650 fs/jfs/jfs_dmap.c:485
 txFreeMap+0x9e6/0xde0 fs/jfs/jfs_txnmgr.c:2517
 xtTruncate+0xd16/0x2eb0 fs/jfs/jfs_xtree.c:2481
 jfs_free_zero_link+0x35b/0x4c0 fs/jfs/namei.c:760
 jfs_evict_inode+0x356/0x430 fs/jfs/inode.c:159
 evict+0x624/0xb50 fs/inode.c:825
 txLazyCommit fs/jfs/jfs_txnmgr.c:2666 [inline]
 jfs_lazycommit+0x44c/0xac0 fs/jfs/jfs_txnmgr.c:2735
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
---[ end trace ]---



The explanation of the root cause is:

An array-index-out-of-bounds crash occurs in `dbJoin` when the JFS filesystem attempts to free blocks using a corrupted `dmap` structure read from disk.

### Root Cause

The JFS filesystem uses a binary buddy system to manage free space. The state of the buddy system is stored in `dmap` (for leaf levels) and `dmapctl` (for upper levels) structures on disk. 

When a `dmap` is read from disk, its `dmaptree` structure is not fully validated. Specifically, the `leafidx` field (which indicates the index of the first leaf in the `stree` array) is read directly from disk and used to compute pointers to the leaf nodes. 

If `leafidx` is corrupted (e.g., set to `0xffffffff` / `-1`), the computed pointer will point out of bounds of the `stree` array. When `dbFreeDmap` is called to free blocks, it calls `dbFreeBits`, which in turn calls `dbJoin` to update the buddy system. `dbJoin` uses the corrupted `leafidx` to access the leaf nodes:

```c
// fs/jfs/jfs_dmap.c:2867
leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
```

This results in an out-of-bounds memory access when `leaf[buddy]` is subsequently accessed.

While a similar integrity check (`check_dmapctl`) was recently added for `dmapctl` structures in commit `cce219b203c4` ("jfs: add dmapctl integrity check to prevent invalid operations"), the `dmap` structures (`dmaptree`) were left unchecked.

### Fix

Introduce a `check_dmaptree` function, similar to the existing `check_dmapctl` function, to validate the integrity of the `dmaptree` structure when it is used. 

The `check_dmaptree` function should verify that:
- `nleafs` is within bounds (`<= LPERDMAP`).
- `l2nleafs` is within bounds (`<= L2LPERDMAP`).
- `nleafs` matches `2^l2nleafs`.
- `leafidx` is exactly `LEAFIND`.
- `height` is within bounds (`<= 4`).
- `budmin` is valid (`>= BUDMIN`).
- The leaf nodes fit within the `stree` array (`leafidx + nleafs <= TREESIZE`).
- The values of the leaf nodes are valid (`>= NOFREE` and `<= 31`).

Call `check_dmaptree` in the functions that operate on the `dmap` structure, such as `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. If `check_dmaptree` fails, return `-EIO` to prevent further processing of the corrupted `dmap`. This will also replace the existing partial checks for `leafidx` in `dbAllocNext` and `dbAllocNear`.

```c
/*
 * check_dmaptree - Validate integrity of a dmaptree structure
 * @dtp: Pointer to the dmaptree structure to check
 *
 * Return: true if valid, false if corrupted
 */
static bool check_dmaptree(struct dmaptree *dtp)
{
	u32 nleafs, l2nleafs, leafidx, height;
	int i;

	nleafs = le32_to_cpu(dtp->nleafs);
	/* Check basic field ranges */
	if (unlikely(nleafs > LPERDMAP)) {
		jfs_err("dmaptree: invalid nleafs %u (max %u)",
			nleafs, LPERDMAP);
		return false;
	}

	l2nleafs = le32_to_cpu(dtp->l2nleafs);
	if (unlikely(l2nleafs > L2LPERDMAP)) {
		jfs_err("dmaptree: invalid l2nleafs %u (max %u)",
			l2nleafs, L2LPERDMAP);
		return false;
	}

	/* Verify nleafs matches l2nleafs (must be power of two) */
	if (unlikely((1U << l2nleafs) != nleafs)) {
		jfs_err("dmaptree: nleafs %u != 2^%u",
			nleafs, l2nleafs);
		return false;
	}

	leafidx = le32_to_cpu(dtp->leafidx);
	/* Check leaf index matches expected position */
	if (unlikely(leafidx != LEAFIND)) {
		jfs_err("dmaptree: invalid leafidx %u (expected %u)",
			leafidx, LEAFIND);
		return false;
	}

	height = le32_to_cpu(dtp->height);
	/* Check tree height is within valid range */
	if (unlikely(height > 4)) {
		jfs_err("dmaptree: invalid height %u (max 4)",
			height);
		return false;
	}

	/* Check budmin is valid */
	if (unlikely(dtp->budmin < BUDMIN)) {
		jfs_err("dmaptree: invalid budmin %d (min %d)",
			dtp->budmin, BUDMIN);
		return false;
	}

	/* Check leaf nodes fit within stree array */
	if (unlikely(leafidx + nleafs > TREESIZE)) {
		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
			leafidx + nleafs, TREESIZE);
		return false;
	}

	/* Check leaf nodes have valid values */
	for (i = leafidx; i < leafidx + nleafs; i++) {
		s8 val = dtp->stree[i];

		if (unlikely(val < NOFREE)) {
			jfs_err("dmaptree: invalid leaf value %d at index %d",
					val, i);
			return false;
		} else if (unlikely(val > 31)) {
			jfs_err("dmaptree: leaf value %d too large at index %d", val, i);
			return false;
		}
	}

	return true;
}
```

Then, in functions like `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`, add the check at the beginning:

```c
	if (unlikely(!check_dmaptree(&dp->tree))) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}
```


The patch that fixes the bug is:

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index a841cf21d..4f2e0b78d 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -220,6 +220,85 @@ static bool check_dmapctl(struct dmapctl *dcp)
 	return true;
 }
 
+/*
+ * check_dmaptree - Validate integrity of a dmaptree structure
+ * @dtp: Pointer to the dmaptree structure to check
+ *
+ * Return: true if valid, false if corrupted
+ */
+static bool check_dmaptree(struct dmaptree *dtp)
+{
+	u32 nleafs, l2nleafs, leafidx, height;
+	int i;
+
+	nleafs = le32_to_cpu(dtp->nleafs);
+	/* Check basic field ranges */
+	if (unlikely(nleafs > LPERDMAP)) {
+		jfs_err("dmaptree: invalid nleafs %u (max %u)", nleafs,
+			LPERDMAP);
+		return false;
+	}
+
+	l2nleafs = le32_to_cpu(dtp->l2nleafs);
+	if (unlikely(l2nleafs > L2LPERDMAP)) {
+		jfs_err("dmaptree: invalid l2nleafs %u (max %u)", l2nleafs,
+			L2LPERDMAP);
+		return false;
+	}
+
+	/* Verify nleafs matches l2nleafs (must be power of two) */
+	if (unlikely((1U << l2nleafs) != nleafs)) {
+		jfs_err("dmaptree: nleafs %u != 2^%u", nleafs, l2nleafs);
+		return false;
+	}
+
+	leafidx = le32_to_cpu(dtp->leafidx);
+	/* Check leaf index matches expected position */
+	if (unlikely(leafidx != LEAFIND)) {
+		jfs_err("dmaptree: invalid leafidx %u (expected %u)", leafidx,
+			LEAFIND);
+		return false;
+	}
+
+	height = le32_to_cpu(dtp->height);
+	/* Check tree height is within valid range */
+	if (unlikely(height > 4)) {
+		jfs_err("dmaptree: invalid height %u (max 4)", height);
+		return false;
+	}
+
+	/* Check budmin is valid */
+	if (unlikely(dtp->budmin < BUDMIN)) {
+		jfs_err("dmaptree: invalid budmin %d (min %d)", dtp->budmin,
+			BUDMIN);
+		return false;
+	}
+
+	/* Check leaf nodes fit within stree array */
+	if (unlikely(leafidx + nleafs > TREESIZE)) {
+		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
+			leafidx + nleafs, TREESIZE);
+		return false;
+	}
+
+	/* Check leaf nodes have valid values */
+	for (i = leafidx; i < leafidx + nleafs; i++) {
+		s8 val = dtp->stree[i];
+
+		if (unlikely(val < NOFREE)) {
+			jfs_err("dmaptree: invalid leaf value %d at index %d",
+				val, i);
+			return false;
+		} else if (unlikely(val > 31)) {
+			jfs_err("dmaptree: leaf value %d too large at index %d",
+				val, i);
+			return false;
+		}
+	}
+
+	return true;
+}
+
 /*
  * NAME:	dbMount()
  *
@@ -1163,7 +1242,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 *leaf;
 	u32 mask;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
@@ -1293,7 +1372,7 @@ dbAllocNear(struct bmap * bmp,
 	int word, lword, rc;
 	s8 *leaf;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
@@ -2046,6 +2125,11 @@ dbAllocDmapLev(struct bmap * bmp,
 	s64 blkno;
 	int leafidx, rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* can't be more than a dmaps worth of blocks */
 	assert(l2nb <= L2BPERDMAP);
 
@@ -2112,6 +2196,11 @@ static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	int rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
@@ -2167,6 +2256,11 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	int rc = 0, word;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
@@ -3338,6 +3432,11 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	struct dmaptree *tp = (struct dmaptree *) & dp->tree;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */


Search for the commit(s) that introduced this bug.

199/2 2026/06/30 15:08 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 8271
							output: 36
							thoughts: 212
						

Thoughts:
**Tracking Down the Root Cause of a JFS Bug**

Okay, here's the situation. I've got a patch in front of me that fixes an array-index-out-of-bounds bug, specifically in the `dbJoin` function within `fs/jfs/jfs_dmap.c`. My task is to pinpoint the exact commit that introduced this vulnerability. The description says the problem is that the `dmap` structures read from disk aren't being properly validated, particularly the `leafidx` field.

The fix itself introduces a new function, `check_dmaptree`, to handle this validation and replaces the original partial checks within `dbAllocNext` and `dbAllocNear`. So, essentially, we're dealing with a case where a value, `leafidx`, is being read directly from disk and then used without any bounds checking. That's a classic recipe for trouble.

Time to dive into `fs/jfs/jfs_dmap.c`. I need to figure out when either `dbJoin` or, maybe, `dbFreeDmap` was first introduced. JFS has been around for ages, so this could require some digging. Let's start by examining the commit history for this file. It should be a good starting point to locate the introduction of the relevant functions or their initial behavior.



200/2 2026/06/30 15:09 tool git-log
0m Error:
log-in to see details

Args:
map[PathPrefix:fs/jfs/jfs_dmap.c SymbolName:dbJoin]

Results:
map[Output:]

201/2 2026/06/30 15:09 llm fixes-finder
1m Model:
gemini-3.1-pro-preview

Tokens:
							input: 8826
							output: 36
							thoughts: 16
						

Thoughts:
Okay, here's the summary, rendered as a first-person thought process, keeping in mind the user is an expert:

**Navigating the Dependency Labyrinth**

Right, so I'm looking at this code, and it's crystal clear what's happening. I'm working with `SymbolName`, and I'm realizing, after a moment's consideration, that I was heading in the wrong direction with the pathing for this. The core of the issue, which is suddenly obvious, is the reliance on `SourcePath`. It's not about the `PathPrefix` as I initially thought; that was a red herring. It's the full, specific location described by the former, which is the crucial component here. I need to rethink the dependency resolution logic around `SourcePath` instead of messing around with `PathPrefix`, and refactor the code to accommodate this. This change is necessary to integrate the two.



202/2 2026/06/30 15:10 tool git-log
0m Args:
map[SourcePath:fs/jfs/jfs_dmap.c SymbolName:dbJoin]

Results:
map[Output:74ecdda68242 jfs: fix array-index-out-of-bounds in dbAdjTree
b6a47fd8ff08 JFS: Corrupted block map should not cause trap
56d1254917d9 JFS: Remove assert statement in dbJoin & return -EIO instead
1da177e4c3f4 Linux-2.6.12-rc2
]

203/2 2026/06/30 15:10 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 9187
							output: 38
							thoughts: 51
						

Thoughts:
Okay, here's my interpretation of those thoughts, tailored for an expert audience, presented in the first person:

**Investigating the Data Base Join Function's History**

Right, let's see, `dbJoin`... that function's been around for ages. I remember that commit, `1da177e4c3f4`. Yep, that's Linux-2.6.12-rc2. Okay, so we know its lineage. Now, I need to check when `dbFreeDmap` was introduced. It's crucial to understand the lifecycle of these related functions, and when support was actually put into place for de-allocating resources. It’ll give me a better grasp of the potential architectural changes that could have occurred between the join function and its complementary freeing function. This is vital context.



204/2 2026/06/30 15:10 tool git-log
0m Args:
map[SourcePath:fs/jfs/jfs_dmap.c SymbolName:dbFreeDmap]

Results:
map[Output:1da177e4c3f4 Linux-2.6.12-rc2
]

205/2 2026/06/30 15:10 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 9490
							output: 58
							thoughts: 177
						

Thoughts:
**Analyzing the JFS Bug**

Okay, so the issue seems to stem from `leafidx` being read directly from disk and then used without any validation checks. That's a classic vulnerability. Now, the explanation mentions a recent integrity check for `dmapctl` structures, implemented in `cce219b203c4`. It seems they patched similar structures but missed the `dmap` structures, specifically the `dmaptree` used for managing the allocation bitmaps. If this structure has been read from disk without validation since the beginning of JFS in Linux then the root cause of the bug must have been introduced with the initial commit `1da177e4c3f4`.

My immediate next step is to examine the partial checks for `leafidx` within `dbAllocNext` and `dbAllocNear`. Were these checks recently added? If not, were the checks ever comprehensive and correct? Understanding the history of these checks is crucial to assess the true scope and impact of this bug.



206/2 2026/06/30 15:10 tool git-log
10m Error:
log-in to see details

Args:
map[CodeRegexp:if \(dp->tree\.leafidx != cpu_to_le32\(LEAFIND\)\) SourcePath:fs/jfs/jfs_dmap.c]

Results:
map[Output:]

207/2 2026/06/30 15:20 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 9973
							output: 58
							thoughts: 9
						

Thoughts:
Okay, here's the summary, rendered as a first-person thought process, keeping in mind the user is an expert:

**Refining the Routing Strategy**

Right, so I'm thinking about the most elegant and efficient way to handle this routing configuration. The current approach feels a little clunky; there's a certain lack of finesse I'm sensing. I've got to find the optimal balance between clarity, maintainability, and performance. I need to get this right.

It hits me – the simplicity and directness I'm after? It's the `PathPrefix` directive. Of course. That's the key. That's the tool that offers the level of granularity and the clean organization I'm envisioning. I can structure the routes in a much more sensible and predictable way this time.



208/2 2026/06/30 15:20 tool git-log
0m Args:
map[CodeRegexp:if \(dp->tree\.leafidx != cpu_to_le32\(LEAFIND\)\) PathPrefix:fs/jfs/jfs_dmap.c]

Results:
map[Output:1da177e4c3f4 Linux-2.6.12-rc2
]

209/2 2026/06/30 15:20 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 10250
							output: 39
							thoughts: 53
						

Thoughts:
Okay, let's see...

**Analyzing the Commit: `1da177e4c3f4` and Partial Checks**

Right, so I'm picking up on these partial checks, and it seems like they were introduced around the time of commit `1da177e4c3f4`.  That's a good starting point. Now, let's drill down a bit deeper into that commit specifically. I need to understand *why* those partial checks might be present. My instincts tell me that it is likely there due to the changes that were implemented in that commit. Let me take a look at the `dbAllocNext` and `dbAllocNear` functions within that commit. That should illuminate the situation pretty quickly, I think.



210/2 2026/06/30 15:20 tool git-show
0m Args:
map[Commit:1da177e4c3f4:fs/jfs/jfs_dmap.c]

Results:
map[Output:
Full output is too long, showing 1000 out of 4272 lines.

[/*
  *   Copyright (C) International Business Machines Corp., 2000-2004
  *
  *   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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include <linux/fs.h>
 #include "jfs_incore.h"
 #include "jfs_superblock.h"
 #include "jfs_dmap.h"
 #include "jfs_imap.h"
 #include "jfs_lock.h"
 #include "jfs_metapage.h"
 #include "jfs_debug.h"
 
 /*
  *	Debug code for double-checking block map
  */
 /* #define	_JFS_DEBUG_DMAP	1 */
 
 #ifdef	_JFS_DEBUG_DMAP
 #define DBINITMAP(size,ipbmap,results) \
 	DBinitmap(size,ipbmap,results)
 #define DBALLOC(dbmap,mapsize,blkno,nblocks) \
 	DBAlloc(dbmap,mapsize,blkno,nblocks)
 #define DBFREE(dbmap,mapsize,blkno,nblocks) \
 	DBFree(dbmap,mapsize,blkno,nblocks)
 #define DBALLOCCK(dbmap,mapsize,blkno,nblocks) \
 	DBAllocCK(dbmap,mapsize,blkno,nblocks)
 #define DBFREECK(dbmap,mapsize,blkno,nblocks) \
 	DBFreeCK(dbmap,mapsize,blkno,nblocks)
 
 static void DBinitmap(s64, struct inode *, u32 **);
 static void DBAlloc(uint *, s64, s64, s64);
 static void DBFree(uint *, s64, s64, s64);
 static void DBAllocCK(uint *, s64, s64, s64);
 static void DBFreeCK(uint *, s64, s64, s64);
 #else
 #define DBINITMAP(size,ipbmap,results)
 #define DBALLOC(dbmap, mapsize, blkno, nblocks)
 #define DBFREE(dbmap, mapsize, blkno, nblocks)
 #define DBALLOCCK(dbmap, mapsize, blkno, nblocks)
 #define DBFREECK(dbmap, mapsize, blkno, nblocks)
 #endif				/* _JFS_DEBUG_DMAP */
 
 /*
  *	SERIALIZATION of the Block Allocation Map.
  *
  *	the working state of the block allocation map is accessed in
  *	two directions:
  *	
  *	1) allocation and free requests that start at the dmap
  *	   level and move up through the dmap control pages (i.e.
  *	   the vast majority of requests).
  * 
  * 	2) allocation requests that start at dmap control page
  *	   level and work down towards the dmaps.
  *	
  *	the serialization scheme used here is as follows. 
  *
  *	requests which start at the bottom are serialized against each 
  *	other through buffers and each requests holds onto its buffers 
  *	as it works it way up from a single dmap to the required level 
  *	of dmap control page.
  *	requests that start at the top are serialized against each other
  *	and request that start from the bottom by the multiple read/single
  *	write inode lock of the bmap inode. requests starting at the top
  *	take this lock in write mode while request starting at the bottom
  *	take the lock in read mode.  a single top-down request may proceed
  *	exclusively while multiple bottoms-up requests may proceed 
  * 	simultaneously (under the protection of busy buffers).
  *	
  *	in addition to information found in dmaps and dmap control pages,
  *	the working state of the block allocation map also includes read/
  *	write information maintained in the bmap descriptor (i.e. total
  *	free block count, allocation group level free block counts).
  *	a single exclusive lock (BMAP_LOCK) is used to guard this information
  *	in the face of multiple-bottoms up requests.
  *	(lock ordering: IREAD_LOCK, BMAP_LOCK);
  *	
  *	accesses to the persistent state of the block allocation map (limited
  *	to the persistent bitmaps in dmaps) is guarded by (busy) buffers.
  */
 
 #define BMAP_LOCK_INIT(bmp)	init_MUTEX(&bmp->db_bmaplock)
 #define BMAP_LOCK(bmp)		down(&bmp->db_bmaplock)
 #define BMAP_UNLOCK(bmp)	up(&bmp->db_bmaplock)
 
 /*
  * forward references
  */
 static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
 			int nblocks);
 static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval);
 static void dbBackSplit(dmtree_t * tp, int leafno);
 static void dbJoin(dmtree_t * tp, int leafno, int newval);
 static void dbAdjTree(dmtree_t * tp, int leafno, int newval);
 static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc,
 		    int level);
 static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results);
 static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks);
 static int dbAllocNear(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks,
 		       int l2nb, s64 * results);
 static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks);
 static int dbAllocDmapLev(struct bmap * bmp, struct dmap * dp, int nblocks,
 			  int l2nb,
 			  s64 * results);
 static int dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb,
 		     s64 * results);
 static int dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno,
 		      s64 * results);
 static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks);
 static int dbFindBits(u32 word, int l2nb);
 static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno);
 static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx);
 static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks);
 static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		      int nblocks);
 static int dbMaxBud(u8 * cp);
 s64 dbMapFileSizeToMapSize(struct inode *ipbmap);
 static int blkstol2(s64 nb);
 
 static int cntlz(u32 value);
 static int cnttz(u32 word);
 
 static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
 			 int nblocks);
 static int dbInitDmap(struct dmap * dp, s64 blkno, int nblocks);
 static int dbInitDmapTree(struct dmap * dp);
 static int dbInitTree(struct dmaptree * dtp);
 static int dbInitDmapCtl(struct dmapctl * dcp, int level, int i);
 static int dbGetL2AGSize(s64 nblocks);
 
 /*
  *	buddy table
  *
  * table used for determining buddy sizes within characters of 
  * dmap bitmap words.  the characters themselves serve as indexes
  * into the table, with the table elements yielding the maximum
  * binary buddy of free bits within the character.
  */
 static s8 budtab[256] = {
 	3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1
 };
 
 
 /*
  * NAME:    	dbMount()
  *
  * FUNCTION:	initializate the block allocation map.
  *
  *		memory is allocated for the in-core bmap descriptor and
  *		the in-core descriptor is initialized from disk.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *
  * RETURN VALUES:
  *      0	- success
  *      -ENOMEM	- insufficient memory
  *      -EIO	- i/o error
  */
 int dbMount(struct inode *ipbmap)
 {
 	struct bmap *bmp;
 	struct dbmap_disk *dbmp_le;
 	struct metapage *mp;
 	int i;
 
 	/*
 	 * allocate/initialize the in-memory bmap descriptor
 	 */
 	/* allocate memory for the in-memory bmap descriptor */
 	bmp = kmalloc(sizeof(struct bmap), GFP_KERNEL);
 	if (bmp == NULL)
 		return -ENOMEM;
 
 	/* read the on-disk bmap descriptor. */
 	mp = read_metapage(ipbmap,
 			   BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
 			   PSIZE, 0);
 	if (mp == NULL) {
 		kfree(bmp);
 		return -EIO;
 	}
 
 	/* copy the on-disk bmap descriptor to its in-memory version. */
 	dbmp_le = (struct dbmap_disk *) mp->data;
 	bmp->db_mapsize = le64_to_cpu(dbmp_le->dn_mapsize);
 	bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree);
 	bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage);
 	bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag);
 	bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel);
 	bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag);
 	bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref);
 	bmp->db_aglevel = le32_to_cpu(dbmp_le->dn_aglevel);
 	bmp->db_agheigth = le32_to_cpu(dbmp_le->dn_agheigth);
 	bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth);
 	bmp->db_agstart = le32_to_cpu(dbmp_le->dn_agstart);
 	bmp->db_agl2size = le32_to_cpu(dbmp_le->dn_agl2size);
 	for (i = 0; i < MAXAG; i++)
 		bmp->db_agfree[i] = le64_to_cpu(dbmp_le->dn_agfree[i]);
 	bmp->db_agsize = le64_to_cpu(dbmp_le->dn_agsize);
 	bmp->db_maxfreebud = dbmp_le->dn_maxfreebud;
 
 	/* release the buffer. */
 	release_metapage(mp);
 
 	/* bind the bmap inode and the bmap descriptor to each other. */
 	bmp->db_ipbmap = ipbmap;
 	JFS_SBI(ipbmap->i_sb)->bmap = bmp;
 
 	memset(bmp->db_active, 0, sizeof(bmp->db_active));
 	DBINITMAP(bmp->db_mapsize, ipbmap, &bmp->db_DBmap);
 
 	/*
 	 * allocate/initialize the bmap lock
 	 */
 	BMAP_LOCK_INIT(bmp);
 
 	return (0);
 }
 
 
 /*
  * NAME:    	dbUnmount()
  *
  * FUNCTION:	terminate the block allocation map in preparation for
  *		file system unmount.
  *
  * 		the in-core bmap descriptor is written to disk and
  *		the memory for this descriptor is freed.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *
  * RETURN VALUES:
  *      0	- success
  *      -EIO	- i/o error
  */
 int dbUnmount(struct inode *ipbmap, int mounterror)
 {
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 	int i;
 
 	if (!(mounterror || isReadOnly(ipbmap)))
 		dbSync(ipbmap);
 
 	/*
 	 * Invalidate the page cache buffers
 	 */
 	truncate_inode_pages(ipbmap->i_mapping, 0);
 
 	/*
 	 * Sanity Check
 	 */
 	for (i = 0; i < bmp->db_numag; i++)
 		if (atomic_read(&bmp->db_active[i]))
 			printk(KERN_ERR "dbUnmount: db_active[%d] = %d\n",
 			       i, atomic_read(&bmp->db_active[i]));
 
 	/* free the memory for the in-memory bmap. */
 	kfree(bmp);
 
 	return (0);
 }
 
 /*
  *	dbSync()
  */
 int dbSync(struct inode *ipbmap)
 {
 	struct dbmap_disk *dbmp_le;
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 	struct metapage *mp;
 	int i;
 
 	/*
 	 * write bmap global control page
 	 */
 	/* get the buffer for the on-disk bmap descriptor. */
 	mp = read_metapage(ipbmap,
 			   BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
 			   PSIZE, 0);
 	if (mp == NULL) {
 		jfs_err("dbSync: read_metapage failed!");
 		return -EIO;
 	}
 	/* copy the in-memory version of the bmap to the on-disk version */
 	dbmp_le = (struct dbmap_disk *) mp->data;
 	dbmp_le->dn_mapsize = cpu_to_le64(bmp->db_mapsize);
 	dbmp_le->dn_nfree = cpu_to_le64(bmp->db_nfree);
 	dbmp_le->dn_l2nbperpage = cpu_to_le32(bmp->db_l2nbperpage);
 	dbmp_le->dn_numag = cpu_to_le32(bmp->db_numag);
 	dbmp_le->dn_maxlevel = cpu_to_le32(bmp->db_maxlevel);
 	dbmp_le->dn_maxag = cpu_to_le32(bmp->db_maxag);
 	dbmp_le->dn_agpref = cpu_to_le32(bmp->db_agpref);
 	dbmp_le->dn_aglevel = cpu_to_le32(bmp->db_aglevel);
 	dbmp_le->dn_agheigth = cpu_to_le32(bmp->db_agheigth);
 	dbmp_le->dn_agwidth = cpu_to_le32(bmp->db_agwidth);
 	dbmp_le->dn_agstart = cpu_to_le32(bmp->db_agstart);
 	dbmp_le->dn_agl2size = cpu_to_le32(bmp->db_agl2size);
 	for (i = 0; i < MAXAG; i++)
 		dbmp_le->dn_agfree[i] = cpu_to_le64(bmp->db_agfree[i]);
 	dbmp_le->dn_agsize = cpu_to_le64(bmp->db_agsize);
 	dbmp_le->dn_maxfreebud = bmp->db_maxfreebud;
 
 	/* write the buffer */
 	write_metapage(mp);
 
 	/*
 	 * write out dirty pages of bmap
 	 */
 	filemap_fdatawrite(ipbmap->i_mapping);
 	filemap_fdatawait(ipbmap->i_mapping);
 
 	ipbmap->i_state |= I_DIRTY;
 	diWriteSpecial(ipbmap, 0);
 
 	return (0);
 }
 
 
 /*
  * NAME:    	dbFree()
  *
  * FUNCTION:	free the specified block range from the working block
  *		allocation map.
  *
  *		the blocks will be free from the working map one dmap
  *		at a time.
  *
  * PARAMETERS:
  *      ip	-  pointer to in-core inode;
  *      blkno	-  starting block number to be freed.
  *      nblocks	-  number of blocks to be freed.
  *
  * RETURN VALUES:
  *      0	- success
  *      -EIO	- i/o error
  */
 int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
 {
 	struct metapage *mp;
 	struct dmap *dp;
 	int nb, rc;
 	s64 lblkno, rem;
 	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
 	struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
 
 	IREAD_LOCK(ipbmap);
 
 	/* block to be freed better be within the mapsize. */
 	if (unlikely((blkno == 0) || (blkno + nblocks > bmp->db_mapsize))) {
 		IREAD_UNLOCK(ipbmap);
 		printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
 		       (unsigned long long) blkno,
 		       (unsigned long long) nblocks);
 		jfs_error(ip->i_sb,
 			  "dbFree: block to be freed is outside the map");
 		return -EIO;
 	}
 
 	/*
 	 * free the blocks a dmap at a time.
 	 */
 	mp = NULL;
 	for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) {
 		/* release previous dmap if any */
 		if (mp) {
 			write_metapage(mp);
 		}
 
 		/* get the buffer for the current dmap. */
 		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 		mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
 		if (mp == NULL) {
 			IREAD_UNLOCK(ipbmap);
 			return -EIO;
 		}
 		dp = (struct dmap *) mp->data;
 
 		/* determine the number of blocks to be freed from
 		 * this dmap.
 		 */
 		nb = min(rem, BPERDMAP - (blkno & (BPERDMAP - 1)));
 
 		DBALLOCCK(bmp->db_DBmap, bmp->db_mapsize, blkno, nb);
 
 		/* free the blocks. */
 		if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) {
 			release_metapage(mp);
 			IREAD_UNLOCK(ipbmap);
 			return (rc);
 		}
 
 		DBFREE(bmp->db_DBmap, bmp->db_mapsize, blkno, nb);
 	}
 
 	/* write the last buffer. */
 	write_metapage(mp);
 
 	IREAD_UNLOCK(ipbmap);
 
 	return (0);
 }
 
 
 /*
  * NAME:	dbUpdatePMap()
  *
  * FUNCTION:    update the allocation state (free or allocate) of the
  *		specified block range in the persistent block allocation map.
  *		
  *		the blocks will be updated in the persistent map one
  *		dmap at a time.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *      free	- TRUE if block range is to be freed from the persistent
  *		  map; FALSE if it is to   be allocated.
  *      blkno	-  starting block number of the range.
  *      nblocks	-  number of contiguous blocks in the range.
  *      tblk	-  transaction block;
  *
  * RETURN VALUES:
  *      0	- success
  *      -EIO	- i/o error
  */
 int
 dbUpdatePMap(struct inode *ipbmap,
 	     int free, s64 blkno, s64 nblocks, struct tblock * tblk)
 {
 	int nblks, dbitno, wbitno, rbits;
 	int word, nbits, nwords;
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 	s64 lblkno, rem, lastlblkno;
 	u32 mask;
 	struct dmap *dp;
 	struct metapage *mp;
 	struct jfs_log *log;
 	int lsn, difft, diffp;
 
 	/* the blocks better be within the mapsize. */
 	if (blkno + nblocks > bmp->db_mapsize) {
 		printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
 		       (unsigned long long) blkno,
 		       (unsigned long long) nblocks);
 		jfs_error(ipbmap->i_sb,
 			  "dbUpdatePMap: blocks are outside the map");
 		return -EIO;
 	}
 
 	/* compute delta of transaction lsn from log syncpt */
 	lsn = tblk->lsn;
 	log = (struct jfs_log *) JFS_SBI(tblk->sb)->log;
 	logdiff(difft, lsn, log);
 
 	/*
 	 * update the block state a dmap at a time.
 	 */
 	mp = NULL;
 	lastlblkno = 0;
 	for (rem = nblocks; rem > 0; rem -= nblks, blkno += nblks) {
 		/* get the buffer for the current dmap. */
 		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 		if (lblkno != lastlblkno) {
 			if (mp) {
 				write_metapage(mp);
 			}
 
 			mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE,
 					   0);
 			if (mp == NULL)
 				return -EIO;
 		}
 		dp = (struct dmap *) mp->data;
 
 		/* determine the bit number and word within the dmap of
 		 * the starting block.  also determine how many blocks
 		 * are to be updated within this dmap.
 		 */
 		dbitno = blkno & (BPERDMAP - 1);
 		word = dbitno >> L2DBWORD;
 		nblks = min(rem, (s64)BPERDMAP - dbitno);
 
 		/* update the bits of the dmap words. the first and last
 		 * words may only have a subset of their bits updated. if
 		 * this is the case, we'll work against that word (i.e.
 		 * partial first and/or last) only in a single pass.  a 
 		 * single pass will also be used to update all words that
 		 * are to have all their bits updated.
 		 */
 		for (rbits = nblks; rbits > 0;
 		     rbits -= nbits, dbitno += nbits) {
 			/* determine the bit number within the word and
 			 * the number of bits within the word.
 			 */
 			wbitno = dbitno & (DBWORD - 1);
 			nbits = min(rbits, DBWORD - wbitno);
 
 			/* check if only part of the word is to be updated. */
 			if (nbits < DBWORD) {
 				/* update (free or allocate) the bits
 				 * in this word.
 				 */
 				mask =
 				    (ONES << (DBWORD - nbits) >> wbitno);
 				if (free)
 					dp->pmap[word] &=
 					    cpu_to_le32(~mask);
 				else
 					dp->pmap[word] |=
 					    cpu_to_le32(mask);
 
 				word += 1;
 			} else {
 				/* one or more words are to have all
 				 * their bits updated.  determine how
 				 * many words and how many bits.
 				 */
 				nwords = rbits >> L2DBWORD;
 				nbits = nwords << L2DBWORD;
 
 				/* update (free or allocate) the bits
 				 * in these words.
 				 */
 				if (free)
 					memset(&dp->pmap[word], 0,
 					       nwords * 4);
 				else
 					memset(&dp->pmap[word], (int) ONES,
 					       nwords * 4);
 
 				word += nwords;
 			}
 		}
 
 		/*
 		 * update dmap lsn
 		 */
 		if (lblkno == lastlblkno)
 			continue;
 
 		lastlblkno = lblkno;
 
 		if (mp->lsn != 0) {
 			/* inherit older/smaller lsn */
 			logdiff(diffp, mp->lsn, log);
 			if (difft < diffp) {
 				mp->lsn = lsn;
 
 				/* move bp after tblock in logsync list */
 				LOGSYNC_LOCK(log);
 				list_move(&mp->synclist, &tblk->synclist);
 				LOGSYNC_UNLOCK(log);
 			}
 
 			/* inherit younger/larger clsn */
 			LOGSYNC_LOCK(log);
 			logdiff(difft, tblk->clsn, log);
 			logdiff(diffp, mp->clsn, log);
 			if (difft > diffp)
 				mp->clsn = tblk->clsn;
 			LOGSYNC_UNLOCK(log);
 		} else {
 			mp->log = log;
 			mp->lsn = lsn;
 
 			/* insert bp after tblock in logsync list */
 			LOGSYNC_LOCK(log);
 
 			log->count++;
 			list_add(&mp->synclist, &tblk->synclist);
 
 			mp->clsn = tblk->clsn;
 			LOGSYNC_UNLOCK(log);
 		}
 	}
 
 	/* write the last buffer. */
 	if (mp) {
 		write_metapage(mp);
 	}
 
 	return (0);
 }
 
 
 /*
  * NAME:	dbNextAG()
  *
  * FUNCTION:    find the preferred allocation group for new allocations.
  *
  *		Within the allocation groups, we maintain a preferred
  *		allocation group which consists of a group with at least
  *		average free space.  It is the preferred group that we target
  *		new inode allocation towards.  The tie-in between inode
  *		allocation and block allocation occurs as we allocate the
  *		first (data) block of an inode and specify the inode (block)
  *		as the allocation hint for this block.
  *
  *		We try to avoid having more than one open file growing in
  *		an allocation group, as this will lead to fragmentation.
  *		This differs from the old OS/2 method of trying to keep
  *		empty ags around for large allocations.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *
  * RETURN VALUES:
  *      the preferred allocation group number.
  */
 int dbNextAG(struct inode *ipbmap)
 {
 	s64 avgfree;
 	int agpref;
 	s64 hwm = 0;
 	int i;
 	int next_best = -1;
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 
 	BMAP_LOCK(bmp);
 
 	/* determine the average number of free blocks within the ags. */
 	avgfree = (u32)bmp->db_nfree / bmp->db_numag;
 
 	/*
 	 * if the current preferred ag does not have an active allocator
 	 * and has at least average freespace, return it
 	 */
 	agpref = bmp->db_agpref;
 	if ((atomic_read(&bmp->db_active[agpref]) == 0) &&
 	    (bmp->db_agfree[agpref] >= avgfree))
 		goto unlock;
 
 	/* From the last preferred ag, find the next one with at least
 	 * average free space.
 	 */
 	for (i = 0 ; i < bmp->db_numag; i++, agpref++) {
 		if (agpref == bmp->db_numag)
 			agpref = 0;
 
 		if (atomic_read(&bmp->db_active[agpref]))
 			/* open file is currently growing in this ag */
 			continue;
 		if (bmp->db_agfree[agpref] >= avgfree) {
 			/* Return this one */
 			bmp->db_agpref = agpref;
 			goto unlock;
 		} else if (bmp->db_agfree[agpref] > hwm) {
 			/* Less than avg. freespace, but best so far */
 			hwm = bmp->db_agfree[agpref];
 			next_best = agpref;
 		}
 	}
 
 	/*
 	 * If no inactive ag was found with average freespace, use the
 	 * next best
 	 */
 	if (next_best != -1)
 		bmp->db_agpref = next_best;
 	/* else leave db_agpref unchanged */
 unlock:
 	BMAP_UNLOCK(bmp);
 
 	/* return the preferred group.
 	 */
 	return (bmp->db_agpref);
 }
 
 /*
  * NAME:	dbAlloc()
  *
  * FUNCTION:    attempt to allocate a specified number of contiguous free
  *		blocks from the working allocation block map.
  *
  *		the block allocation policy uses hints and a multi-step
  *		approach.
  *
  *	  	for allocation requests smaller than the number of blocks
  *		per dmap, we first try to allocate the new blocks
  *		immediately following the hint.  if these blocks are not
  *		available, we try to allocate blocks near the hint.  if
  *		no blocks near the hint are available, we next try to 
  *		allocate within the same dmap as contains the hint.
  *
  *		if no blocks are available in the dmap or the allocation
  *		request is larger than the dmap size, we try to allocate
  *		within the same allocation group as contains the hint. if
  *		this does not succeed, we finally try to allocate anywhere
  *		within the aggregate.
  *
  *		we also try to allocate anywhere within the aggregate for
  *		for allocation requests larger than the allocation group
  *		size or requests that specify no hint value.
  *
  * PARAMETERS:
  *      ip	-  pointer to in-core inode;
  *      hint	- allocation hint.
  *      nblocks	- number of contiguous blocks in the range.
  *      results	- on successful return, set to the starting block number
  *		  of the newly allocated contiguous range.
  *
  * RETURN VALUES:
  *      0	- success
  *      -ENOSPC	- insufficient disk resources
  *      -EIO	- i/o error
  */
 int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
 {
 	int rc, agno;
 	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
 	struct bmap *bmp;
 	struct metapage *mp;
 	s64 lblkno, blkno;
 	struct dmap *dp;
 	int l2nb;
 	s64 mapSize;
 	int writers;
 
 	/* assert that nblocks is valid */
 	assert(nblocks > 0);
 
 #ifdef _STILL_TO_PORT
 	/* DASD limit check                                     F226941 */
 	if (OVER_LIMIT(ip, nblocks))
 		return -ENOSPC;
 #endif				/* _STILL_TO_PORT */
 
 	/* get the log2 number of blocks to be allocated.
 	 * if the number of blocks is not a log2 multiple, 
 	 * it will be rounded up to the next log2 multiple.
 	 */
 	l2nb = BLKSTOL2(nblocks);
 
 	bmp = JFS_SBI(ip->i_sb)->bmap;
 
 //retry:        /* serialize w.r.t.extendfs() */
 	mapSize = bmp->db_mapsize;
 
 	/* the hint should be within the map */
 	if (hint >= mapSize) {
 		jfs_error(ip->i_sb, "dbAlloc: the hint is outside the map");
 		return -EIO;
 	}
 
 	/* if the number of blocks to be allocated is greater than the
 	 * allocation group size, try to allocate anywhere.
 	 */
 	if (l2nb > bmp->db_agl2size) {
 		IWRITE_LOCK(ipbmap);
 
 		rc = dbAllocAny(bmp, nblocks, l2nb, results);
 		if (rc == 0) {
 			DBALLOC(bmp->db_DBmap, bmp->db_mapsize, *results,
 				nblocks);
 		}
 
 		goto write_unlock;
 	}
 
 	/*
 	 * If no hint, let dbNextAG recommend an allocation group
 	 */
 	if (hint == 0)
 		goto pref_ag;
 
 	/* we would like to allocate close to the hint.  adjust the
 	 * hint to the block following the hint since the allocators
 	 * will start looking for free space starting at this point.
 	 */
 	blkno = hint + 1;
 
 	if (blkno >= bmp->db_mapsize)
 		goto pref_ag;
 
 	agno = blkno >> bmp->db_agl2size;
 
 	/* check if blkno crosses over into a new allocation group.
 	 * if so, check if we should allow allocations within this
 	 * allocation group.
 	 */
 	if ((blkno & (bmp->db_agsize - 1)) == 0)
 		/* check if the AG is currenly being written to.
 		 * if so, call dbNextAG() to find a non-busy
 		 * AG with sufficient free space.
 		 */
 		if (atomic_read(&bmp->db_active[agno]))
 			goto pref_ag;
 
 	/* check if the allocation request size can be satisfied from a
 	 * single dmap.  if so, try to allocate from the dmap containing
 	 * the hint using a tiered strategy.
 	 */
 	if (nblocks <= BPERDMAP) {
 		IREAD_LOCK(ipbmap);
 
 		/* get the buffer for the dmap containing the hint.
 		 */
 		rc = -EIO;
 		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 		mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
 		if (mp == NULL)
 			goto read_unlock;
 
 		dp = (struct dmap *) mp->data;
 
 		/* first, try to satisfy the allocation request with the
 		 * blocks beginning at the hint.
 		 */
 		if ((rc = dbAllocNext(bmp, dp, blkno, (int) nblocks))
 		    != -ENOSPC) {
 			if (rc == 0) {
 				*results = blkno;
 				DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 					*results, nblocks);
 				mark_metapage_dirty(mp);
 			}
 
 			release_metapage(mp);
 			goto read_unlock;
 		}
 
 		writers = atomic_read(&bmp->db_active[agno]);
 		if ((writers > 1) ||
 		    ((writers == 1) && (JFS_IP(ip)->active_ag != agno))) {
 			/*
 			 * Someone else is writing in this allocation
 			 * group.  To avoid fragmenting, try another ag
 			 */
 			release_metapage(mp);
 			IREAD_UNLOCK(ipbmap);
 			goto pref_ag;
 		}
 
 		/* next, try to satisfy the allocation request with blocks
 		 * near the hint.
 		 */
 		if ((rc =
 		     dbAllocNear(bmp, dp, blkno, (int) nblocks, l2nb, results))
 		    != -ENOSPC) {
 			if (rc == 0) {
 				DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 					*results, nblocks);
 				mark_metapage_dirty(mp);
 			}
 
 			release_metapage(mp);
 			goto read_unlock;
 		}
 
 		/* try to satisfy the allocation request with blocks within
 		 * the same dmap as the hint.
 		 */
 		if ((rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results))
 		    != -ENOSPC) {
 			if (rc == 0) {
 				DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 					*results, nblocks);
 				mark_metapage_dirty(mp);
 			}
 
 			release_metapage(mp);
 			goto read_unlock;
 		}
 
 		release_metapage(mp);
 		IREAD_UNLOCK(ipbmap);
 	}
 
 	/* try to satisfy the allocation request with blocks within
 	 * the same allocation group as the hint.
 	 */
 	IWRITE_LOCK(ipbmap);
 	if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results))
 	    != -ENOSPC) {
 		if (rc == 0)
 			DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 				*results, nblocks);
 		goto write_unlock;
 	}
 	IWRITE_UNLOCK(ipbmap);
 
 
       pref_ag:
 	/*
 	 * Let dbNextAG recommend a preferred allocation group
 	 */
 	agno = dbNextAG(ipbmap);
 	IWRITE_LOCK(ipbmap);
 
 	/* Try to allocate within this allocation group.  if that fails, try to
 	 * allocate anywhere in the map.
 	 */
 	if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) == -ENOSPC)
 		rc = dbAllocAny(bmp, nblocks, l2nb, results);
 	if (rc == 0) {
 		DBALLOC(bmp->db_DBmap, bmp->db_mapsize, *results, nblocks);
 	}
 
       write_unlock:
 	IWRITE_UNLOCK(ipbmap);
 
 	return (rc);
 
       read_unlock:
 	IREAD_UNLOCK(ipbmap);
 
 	return (rc);
 }
 
 #ifdef _NOTYET
 /*
  * NAME:	dbAllocExact()
  *
  * FUNCTION:    try to allocate the requested extent;
  *
  * PARAMETERS:
  *      ip	- pointer to in-core inode;
  *      blkno	- extent address;
  *      nblocks	- extent length;
  *
  * RETURN VALUES:
  *      0	- success
  *      -ENOSPC	- insufficient disk resources
  *      -EIO	- i/o error
  */
 int dbAllocExact(struct inode *ip, s64 blkno, int nblocks)
 {
 	int rc;
 	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
 	struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
 	struct dmap *dp;
 	s64 lblkno;
 	struct metapage *mp;
 
 	IREAD_LOCK(ipbmap);
 
 	/*
 	 * validate extent request:
 	 *
 	 * note: defragfs policy:
 	 *  max 64 blocks will be moved.  
 	 *  allocation request size must be satisfied from a single dmap.
 	 */
 	if (nblocks <= 0 || nblocks > BPERDMAP || blkno >= bmp->db_mapsize) {
 		IREAD_UNLOCK(ipbmap);
 		return -EINVAL;
 	}
 
 	if (nblocks > ((s64) 1 << bmp->db_maxfreebud)) {
 		/* the free space is no longer available */
 		IREAD_UNLOCK(ipbmap);
 		return -ENOSPC;
 	}
 
 	/* read in the dmap covering the extent */
 	lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 	mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
 	if (mp == NULL) {
 		IREAD_UNLOCK(ipbmap);
 		return -EIO;
 	}
 	dp = (struct dmap *) mp->data;
 
 	/* try to allocate the requested extent */
 	rc = dbAllocNext(bmp, dp, blkno, nblocks);
]
]

211/2 2026/06/30 15:20 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 22426
							output: 39
							thoughts: 63
						

Thoughts:
Okay, here's my take on those thoughts, framed as an expert's internal monologue:

**Investigating a Truncated Output**

Alright, the output was cut off, which is a bit frustrating, but I can see it was pointing to `dbAllocNext` and `dbAllocNear`. Those are definitely defined in `fs/jfs/jfs_dmap.c`, part of the JFS filesystem, right? No surprises there. Since the issue likely involves allocation, let's zero in on `dbAllocNext`. It's almost always the culprit when you're looking at allocation issues. The kernel's going to need an open source code repository for that... and it has one at 1da177e4c3f4. Good, that's what I needed, now I can dig into the implementation of `dbAllocNext` and see how it interacts with its nearby functions. Time to crack open that code and see what the function is doing when allocating space in JFS, or when it's *supposed* to be allocating space, and figure out why the output was truncated. Hopefully, it's something simple.



212/2 2026/06/30 15:20 tool git-show
0m Args:
map[Commit:1da177e4c3f4:fs/jfs/jfs_dmap.c]

Results:
map[Output:
Full output is too long, showing 1000 out of 4272 lines.

[/*
  *   Copyright (C) International Business Machines Corp., 2000-2004
  *
  *   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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include <linux/fs.h>
 #include "jfs_incore.h"
 #include "jfs_superblock.h"
 #include "jfs_dmap.h"
 #include "jfs_imap.h"
 #include "jfs_lock.h"
 #include "jfs_metapage.h"
 #include "jfs_debug.h"
 
 /*
  *	Debug code for double-checking block map
  */
 /* #define	_JFS_DEBUG_DMAP	1 */
 
 #ifdef	_JFS_DEBUG_DMAP
 #define DBINITMAP(size,ipbmap,results) \
 	DBinitmap(size,ipbmap,results)
 #define DBALLOC(dbmap,mapsize,blkno,nblocks) \
 	DBAlloc(dbmap,mapsize,blkno,nblocks)
 #define DBFREE(dbmap,mapsize,blkno,nblocks) \
 	DBFree(dbmap,mapsize,blkno,nblocks)
 #define DBALLOCCK(dbmap,mapsize,blkno,nblocks) \
 	DBAllocCK(dbmap,mapsize,blkno,nblocks)
 #define DBFREECK(dbmap,mapsize,blkno,nblocks) \
 	DBFreeCK(dbmap,mapsize,blkno,nblocks)
 
 static void DBinitmap(s64, struct inode *, u32 **);
 static void DBAlloc(uint *, s64, s64, s64);
 static void DBFree(uint *, s64, s64, s64);
 static void DBAllocCK(uint *, s64, s64, s64);
 static void DBFreeCK(uint *, s64, s64, s64);
 #else
 #define DBINITMAP(size,ipbmap,results)
 #define DBALLOC(dbmap, mapsize, blkno, nblocks)
 #define DBFREE(dbmap, mapsize, blkno, nblocks)
 #define DBALLOCCK(dbmap, mapsize, blkno, nblocks)
 #define DBFREECK(dbmap, mapsize, blkno, nblocks)
 #endif				/* _JFS_DEBUG_DMAP */
 
 /*
  *	SERIALIZATION of the Block Allocation Map.
  *
  *	the working state of the block allocation map is accessed in
  *	two directions:
  *	
  *	1) allocation and free requests that start at the dmap
  *	   level and move up through the dmap control pages (i.e.
  *	   the vast majority of requests).
  * 
  * 	2) allocation requests that start at dmap control page
  *	   level and work down towards the dmaps.
  *	
  *	the serialization scheme used here is as follows. 
  *
  *	requests which start at the bottom are serialized against each 
  *	other through buffers and each requests holds onto its buffers 
  *	as it works it way up from a single dmap to the required level 
  *	of dmap control page.
  *	requests that start at the top are serialized against each other
  *	and request that start from the bottom by the multiple read/single
  *	write inode lock of the bmap inode. requests starting at the top
  *	take this lock in write mode while request starting at the bottom
  *	take the lock in read mode.  a single top-down request may proceed
  *	exclusively while multiple bottoms-up requests may proceed 
  * 	simultaneously (under the protection of busy buffers).
  *	
  *	in addition to information found in dmaps and dmap control pages,
  *	the working state of the block allocation map also includes read/
  *	write information maintained in the bmap descriptor (i.e. total
  *	free block count, allocation group level free block counts).
  *	a single exclusive lock (BMAP_LOCK) is used to guard this information
  *	in the face of multiple-bottoms up requests.
  *	(lock ordering: IREAD_LOCK, BMAP_LOCK);
  *	
  *	accesses to the persistent state of the block allocation map (limited
  *	to the persistent bitmaps in dmaps) is guarded by (busy) buffers.
  */
 
 #define BMAP_LOCK_INIT(bmp)	init_MUTEX(&bmp->db_bmaplock)
 #define BMAP_LOCK(bmp)		down(&bmp->db_bmaplock)
 #define BMAP_UNLOCK(bmp)	up(&bmp->db_bmaplock)
 
 /*
  * forward references
  */
 static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
 			int nblocks);
 static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval);
 static void dbBackSplit(dmtree_t * tp, int leafno);
 static void dbJoin(dmtree_t * tp, int leafno, int newval);
 static void dbAdjTree(dmtree_t * tp, int leafno, int newval);
 static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc,
 		    int level);
 static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results);
 static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks);
 static int dbAllocNear(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks,
 		       int l2nb, s64 * results);
 static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks);
 static int dbAllocDmapLev(struct bmap * bmp, struct dmap * dp, int nblocks,
 			  int l2nb,
 			  s64 * results);
 static int dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb,
 		     s64 * results);
 static int dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno,
 		      s64 * results);
 static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks);
 static int dbFindBits(u32 word, int l2nb);
 static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno);
 static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx);
 static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks);
 static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		      int nblocks);
 static int dbMaxBud(u8 * cp);
 s64 dbMapFileSizeToMapSize(struct inode *ipbmap);
 static int blkstol2(s64 nb);
 
 static int cntlz(u32 value);
 static int cnttz(u32 word);
 
 static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
 			 int nblocks);
 static int dbInitDmap(struct dmap * dp, s64 blkno, int nblocks);
 static int dbInitDmapTree(struct dmap * dp);
 static int dbInitTree(struct dmaptree * dtp);
 static int dbInitDmapCtl(struct dmapctl * dcp, int level, int i);
 static int dbGetL2AGSize(s64 nblocks);
 
 /*
  *	buddy table
  *
  * table used for determining buddy sizes within characters of 
  * dmap bitmap words.  the characters themselves serve as indexes
  * into the table, with the table elements yielding the maximum
  * binary buddy of free bits within the character.
  */
 static s8 budtab[256] = {
 	3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1
 };
 
 
 /*
  * NAME:    	dbMount()
  *
  * FUNCTION:	initializate the block allocation map.
  *
  *		memory is allocated for the in-core bmap descriptor and
  *		the in-core descriptor is initialized from disk.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *
  * RETURN VALUES:
  *      0	- success
  *      -ENOMEM	- insufficient memory
  *      -EIO	- i/o error
  */
 int dbMount(struct inode *ipbmap)
 {
 	struct bmap *bmp;
 	struct dbmap_disk *dbmp_le;
 	struct metapage *mp;
 	int i;
 
 	/*
 	 * allocate/initialize the in-memory bmap descriptor
 	 */
 	/* allocate memory for the in-memory bmap descriptor */
 	bmp = kmalloc(sizeof(struct bmap), GFP_KERNEL);
 	if (bmp == NULL)
 		return -ENOMEM;
 
 	/* read the on-disk bmap descriptor. */
 	mp = read_metapage(ipbmap,
 			   BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
 			   PSIZE, 0);
 	if (mp == NULL) {
 		kfree(bmp);
 		return -EIO;
 	}
 
 	/* copy the on-disk bmap descriptor to its in-memory version. */
 	dbmp_le = (struct dbmap_disk *) mp->data;
 	bmp->db_mapsize = le64_to_cpu(dbmp_le->dn_mapsize);
 	bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree);
 	bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage);
 	bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag);
 	bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel);
 	bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag);
 	bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref);
 	bmp->db_aglevel = le32_to_cpu(dbmp_le->dn_aglevel);
 	bmp->db_agheigth = le32_to_cpu(dbmp_le->dn_agheigth);
 	bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth);
 	bmp->db_agstart = le32_to_cpu(dbmp_le->dn_agstart);
 	bmp->db_agl2size = le32_to_cpu(dbmp_le->dn_agl2size);
 	for (i = 0; i < MAXAG; i++)
 		bmp->db_agfree[i] = le64_to_cpu(dbmp_le->dn_agfree[i]);
 	bmp->db_agsize = le64_to_cpu(dbmp_le->dn_agsize);
 	bmp->db_maxfreebud = dbmp_le->dn_maxfreebud;
 
 	/* release the buffer. */
 	release_metapage(mp);
 
 	/* bind the bmap inode and the bmap descriptor to each other. */
 	bmp->db_ipbmap = ipbmap;
 	JFS_SBI(ipbmap->i_sb)->bmap = bmp;
 
 	memset(bmp->db_active, 0, sizeof(bmp->db_active));
 	DBINITMAP(bmp->db_mapsize, ipbmap, &bmp->db_DBmap);
 
 	/*
 	 * allocate/initialize the bmap lock
 	 */
 	BMAP_LOCK_INIT(bmp);
 
 	return (0);
 }
 
 
 /*
  * NAME:    	dbUnmount()
  *
  * FUNCTION:	terminate the block allocation map in preparation for
  *		file system unmount.
  *
  * 		the in-core bmap descriptor is written to disk and
  *		the memory for this descriptor is freed.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *
  * RETURN VALUES:
  *      0	- success
  *      -EIO	- i/o error
  */
 int dbUnmount(struct inode *ipbmap, int mounterror)
 {
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 	int i;
 
 	if (!(mounterror || isReadOnly(ipbmap)))
 		dbSync(ipbmap);
 
 	/*
 	 * Invalidate the page cache buffers
 	 */
 	truncate_inode_pages(ipbmap->i_mapping, 0);
 
 	/*
 	 * Sanity Check
 	 */
 	for (i = 0; i < bmp->db_numag; i++)
 		if (atomic_read(&bmp->db_active[i]))
 			printk(KERN_ERR "dbUnmount: db_active[%d] = %d\n",
 			       i, atomic_read(&bmp->db_active[i]));
 
 	/* free the memory for the in-memory bmap. */
 	kfree(bmp);
 
 	return (0);
 }
 
 /*
  *	dbSync()
  */
 int dbSync(struct inode *ipbmap)
 {
 	struct dbmap_disk *dbmp_le;
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 	struct metapage *mp;
 	int i;
 
 	/*
 	 * write bmap global control page
 	 */
 	/* get the buffer for the on-disk bmap descriptor. */
 	mp = read_metapage(ipbmap,
 			   BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
 			   PSIZE, 0);
 	if (mp == NULL) {
 		jfs_err("dbSync: read_metapage failed!");
 		return -EIO;
 	}
 	/* copy the in-memory version of the bmap to the on-disk version */
 	dbmp_le = (struct dbmap_disk *) mp->data;
 	dbmp_le->dn_mapsize = cpu_to_le64(bmp->db_mapsize);
 	dbmp_le->dn_nfree = cpu_to_le64(bmp->db_nfree);
 	dbmp_le->dn_l2nbperpage = cpu_to_le32(bmp->db_l2nbperpage);
 	dbmp_le->dn_numag = cpu_to_le32(bmp->db_numag);
 	dbmp_le->dn_maxlevel = cpu_to_le32(bmp->db_maxlevel);
 	dbmp_le->dn_maxag = cpu_to_le32(bmp->db_maxag);
 	dbmp_le->dn_agpref = cpu_to_le32(bmp->db_agpref);
 	dbmp_le->dn_aglevel = cpu_to_le32(bmp->db_aglevel);
 	dbmp_le->dn_agheigth = cpu_to_le32(bmp->db_agheigth);
 	dbmp_le->dn_agwidth = cpu_to_le32(bmp->db_agwidth);
 	dbmp_le->dn_agstart = cpu_to_le32(bmp->db_agstart);
 	dbmp_le->dn_agl2size = cpu_to_le32(bmp->db_agl2size);
 	for (i = 0; i < MAXAG; i++)
 		dbmp_le->dn_agfree[i] = cpu_to_le64(bmp->db_agfree[i]);
 	dbmp_le->dn_agsize = cpu_to_le64(bmp->db_agsize);
 	dbmp_le->dn_maxfreebud = bmp->db_maxfreebud;
 
 	/* write the buffer */
 	write_metapage(mp);
 
 	/*
 	 * write out dirty pages of bmap
 	 */
 	filemap_fdatawrite(ipbmap->i_mapping);
 	filemap_fdatawait(ipbmap->i_mapping);
 
 	ipbmap->i_state |= I_DIRTY;
 	diWriteSpecial(ipbmap, 0);
 
 	return (0);
 }
 
 
 /*
  * NAME:    	dbFree()
  *
  * FUNCTION:	free the specified block range from the working block
  *		allocation map.
  *
  *		the blocks will be free from the working map one dmap
  *		at a time.
  *
  * PARAMETERS:
  *      ip	-  pointer to in-core inode;
  *      blkno	-  starting block number to be freed.
  *      nblocks	-  number of blocks to be freed.
  *
  * RETURN VALUES:
  *      0	- success
  *      -EIO	- i/o error
  */
 int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
 {
 	struct metapage *mp;
 	struct dmap *dp;
 	int nb, rc;
 	s64 lblkno, rem;
 	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
 	struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
 
 	IREAD_LOCK(ipbmap);
 
 	/* block to be freed better be within the mapsize. */
 	if (unlikely((blkno == 0) || (blkno + nblocks > bmp->db_mapsize))) {
 		IREAD_UNLOCK(ipbmap);
 		printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
 		       (unsigned long long) blkno,
 		       (unsigned long long) nblocks);
 		jfs_error(ip->i_sb,
 			  "dbFree: block to be freed is outside the map");
 		return -EIO;
 	}
 
 	/*
 	 * free the blocks a dmap at a time.
 	 */
 	mp = NULL;
 	for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) {
 		/* release previous dmap if any */
 		if (mp) {
 			write_metapage(mp);
 		}
 
 		/* get the buffer for the current dmap. */
 		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 		mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
 		if (mp == NULL) {
 			IREAD_UNLOCK(ipbmap);
 			return -EIO;
 		}
 		dp = (struct dmap *) mp->data;
 
 		/* determine the number of blocks to be freed from
 		 * this dmap.
 		 */
 		nb = min(rem, BPERDMAP - (blkno & (BPERDMAP - 1)));
 
 		DBALLOCCK(bmp->db_DBmap, bmp->db_mapsize, blkno, nb);
 
 		/* free the blocks. */
 		if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) {
 			release_metapage(mp);
 			IREAD_UNLOCK(ipbmap);
 			return (rc);
 		}
 
 		DBFREE(bmp->db_DBmap, bmp->db_mapsize, blkno, nb);
 	}
 
 	/* write the last buffer. */
 	write_metapage(mp);
 
 	IREAD_UNLOCK(ipbmap);
 
 	return (0);
 }
 
 
 /*
  * NAME:	dbUpdatePMap()
  *
  * FUNCTION:    update the allocation state (free or allocate) of the
  *		specified block range in the persistent block allocation map.
  *		
  *		the blocks will be updated in the persistent map one
  *		dmap at a time.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *      free	- TRUE if block range is to be freed from the persistent
  *		  map; FALSE if it is to   be allocated.
  *      blkno	-  starting block number of the range.
  *      nblocks	-  number of contiguous blocks in the range.
  *      tblk	-  transaction block;
  *
  * RETURN VALUES:
  *      0	- success
  *      -EIO	- i/o error
  */
 int
 dbUpdatePMap(struct inode *ipbmap,
 	     int free, s64 blkno, s64 nblocks, struct tblock * tblk)
 {
 	int nblks, dbitno, wbitno, rbits;
 	int word, nbits, nwords;
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 	s64 lblkno, rem, lastlblkno;
 	u32 mask;
 	struct dmap *dp;
 	struct metapage *mp;
 	struct jfs_log *log;
 	int lsn, difft, diffp;
 
 	/* the blocks better be within the mapsize. */
 	if (blkno + nblocks > bmp->db_mapsize) {
 		printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
 		       (unsigned long long) blkno,
 		       (unsigned long long) nblocks);
 		jfs_error(ipbmap->i_sb,
 			  "dbUpdatePMap: blocks are outside the map");
 		return -EIO;
 	}
 
 	/* compute delta of transaction lsn from log syncpt */
 	lsn = tblk->lsn;
 	log = (struct jfs_log *) JFS_SBI(tblk->sb)->log;
 	logdiff(difft, lsn, log);
 
 	/*
 	 * update the block state a dmap at a time.
 	 */
 	mp = NULL;
 	lastlblkno = 0;
 	for (rem = nblocks; rem > 0; rem -= nblks, blkno += nblks) {
 		/* get the buffer for the current dmap. */
 		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 		if (lblkno != lastlblkno) {
 			if (mp) {
 				write_metapage(mp);
 			}
 
 			mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE,
 					   0);
 			if (mp == NULL)
 				return -EIO;
 		}
 		dp = (struct dmap *) mp->data;
 
 		/* determine the bit number and word within the dmap of
 		 * the starting block.  also determine how many blocks
 		 * are to be updated within this dmap.
 		 */
 		dbitno = blkno & (BPERDMAP - 1);
 		word = dbitno >> L2DBWORD;
 		nblks = min(rem, (s64)BPERDMAP - dbitno);
 
 		/* update the bits of the dmap words. the first and last
 		 * words may only have a subset of their bits updated. if
 		 * this is the case, we'll work against that word (i.e.
 		 * partial first and/or last) only in a single pass.  a 
 		 * single pass will also be used to update all words that
 		 * are to have all their bits updated.
 		 */
 		for (rbits = nblks; rbits > 0;
 		     rbits -= nbits, dbitno += nbits) {
 			/* determine the bit number within the word and
 			 * the number of bits within the word.
 			 */
 			wbitno = dbitno & (DBWORD - 1);
 			nbits = min(rbits, DBWORD - wbitno);
 
 			/* check if only part of the word is to be updated. */
 			if (nbits < DBWORD) {
 				/* update (free or allocate) the bits
 				 * in this word.
 				 */
 				mask =
 				    (ONES << (DBWORD - nbits) >> wbitno);
 				if (free)
 					dp->pmap[word] &=
 					    cpu_to_le32(~mask);
 				else
 					dp->pmap[word] |=
 					    cpu_to_le32(mask);
 
 				word += 1;
 			} else {
 				/* one or more words are to have all
 				 * their bits updated.  determine how
 				 * many words and how many bits.
 				 */
 				nwords = rbits >> L2DBWORD;
 				nbits = nwords << L2DBWORD;
 
 				/* update (free or allocate) the bits
 				 * in these words.
 				 */
 				if (free)
 					memset(&dp->pmap[word], 0,
 					       nwords * 4);
 				else
 					memset(&dp->pmap[word], (int) ONES,
 					       nwords * 4);
 
 				word += nwords;
 			}
 		}
 
 		/*
 		 * update dmap lsn
 		 */
 		if (lblkno == lastlblkno)
 			continue;
 
 		lastlblkno = lblkno;
 
 		if (mp->lsn != 0) {
 			/* inherit older/smaller lsn */
 			logdiff(diffp, mp->lsn, log);
 			if (difft < diffp) {
 				mp->lsn = lsn;
 
 				/* move bp after tblock in logsync list */
 				LOGSYNC_LOCK(log);
 				list_move(&mp->synclist, &tblk->synclist);
 				LOGSYNC_UNLOCK(log);
 			}
 
 			/* inherit younger/larger clsn */
 			LOGSYNC_LOCK(log);
 			logdiff(difft, tblk->clsn, log);
 			logdiff(diffp, mp->clsn, log);
 			if (difft > diffp)
 				mp->clsn = tblk->clsn;
 			LOGSYNC_UNLOCK(log);
 		} else {
 			mp->log = log;
 			mp->lsn = lsn;
 
 			/* insert bp after tblock in logsync list */
 			LOGSYNC_LOCK(log);
 
 			log->count++;
 			list_add(&mp->synclist, &tblk->synclist);
 
 			mp->clsn = tblk->clsn;
 			LOGSYNC_UNLOCK(log);
 		}
 	}
 
 	/* write the last buffer. */
 	if (mp) {
 		write_metapage(mp);
 	}
 
 	return (0);
 }
 
 
 /*
  * NAME:	dbNextAG()
  *
  * FUNCTION:    find the preferred allocation group for new allocations.
  *
  *		Within the allocation groups, we maintain a preferred
  *		allocation group which consists of a group with at least
  *		average free space.  It is the preferred group that we target
  *		new inode allocation towards.  The tie-in between inode
  *		allocation and block allocation occurs as we allocate the
  *		first (data) block of an inode and specify the inode (block)
  *		as the allocation hint for this block.
  *
  *		We try to avoid having more than one open file growing in
  *		an allocation group, as this will lead to fragmentation.
  *		This differs from the old OS/2 method of trying to keep
  *		empty ags around for large allocations.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *
  * RETURN VALUES:
  *      the preferred allocation group number.
  */
 int dbNextAG(struct inode *ipbmap)
 {
 	s64 avgfree;
 	int agpref;
 	s64 hwm = 0;
 	int i;
 	int next_best = -1;
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 
 	BMAP_LOCK(bmp);
 
 	/* determine the average number of free blocks within the ags. */
 	avgfree = (u32)bmp->db_nfree / bmp->db_numag;
 
 	/*
 	 * if the current preferred ag does not have an active allocator
 	 * and has at least average freespace, return it
 	 */
 	agpref = bmp->db_agpref;
 	if ((atomic_read(&bmp->db_active[agpref]) == 0) &&
 	    (bmp->db_agfree[agpref] >= avgfree))
 		goto unlock;
 
 	/* From the last preferred ag, find the next one with at least
 	 * average free space.
 	 */
 	for (i = 0 ; i < bmp->db_numag; i++, agpref++) {
 		if (agpref == bmp->db_numag)
 			agpref = 0;
 
 		if (atomic_read(&bmp->db_active[agpref]))
 			/* open file is currently growing in this ag */
 			continue;
 		if (bmp->db_agfree[agpref] >= avgfree) {
 			/* Return this one */
 			bmp->db_agpref = agpref;
 			goto unlock;
 		} else if (bmp->db_agfree[agpref] > hwm) {
 			/* Less than avg. freespace, but best so far */
 			hwm = bmp->db_agfree[agpref];
 			next_best = agpref;
 		}
 	}
 
 	/*
 	 * If no inactive ag was found with average freespace, use the
 	 * next best
 	 */
 	if (next_best != -1)
 		bmp->db_agpref = next_best;
 	/* else leave db_agpref unchanged */
 unlock:
 	BMAP_UNLOCK(bmp);
 
 	/* return the preferred group.
 	 */
 	return (bmp->db_agpref);
 }
 
 /*
  * NAME:	dbAlloc()
  *
  * FUNCTION:    attempt to allocate a specified number of contiguous free
  *		blocks from the working allocation block map.
  *
  *		the block allocation policy uses hints and a multi-step
  *		approach.
  *
  *	  	for allocation requests smaller than the number of blocks
  *		per dmap, we first try to allocate the new blocks
  *		immediately following the hint.  if these blocks are not
  *		available, we try to allocate blocks near the hint.  if
  *		no blocks near the hint are available, we next try to 
  *		allocate within the same dmap as contains the hint.
  *
  *		if no blocks are available in the dmap or the allocation
  *		request is larger than the dmap size, we try to allocate
  *		within the same allocation group as contains the hint. if
  *		this does not succeed, we finally try to allocate anywhere
  *		within the aggregate.
  *
  *		we also try to allocate anywhere within the aggregate for
  *		for allocation requests larger than the allocation group
  *		size or requests that specify no hint value.
  *
  * PARAMETERS:
  *      ip	-  pointer to in-core inode;
  *      hint	- allocation hint.
  *      nblocks	- number of contiguous blocks in the range.
  *      results	- on successful return, set to the starting block number
  *		  of the newly allocated contiguous range.
  *
  * RETURN VALUES:
  *      0	- success
  *      -ENOSPC	- insufficient disk resources
  *      -EIO	- i/o error
  */
 int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
 {
 	int rc, agno;
 	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
 	struct bmap *bmp;
 	struct metapage *mp;
 	s64 lblkno, blkno;
 	struct dmap *dp;
 	int l2nb;
 	s64 mapSize;
 	int writers;
 
 	/* assert that nblocks is valid */
 	assert(nblocks > 0);
 
 #ifdef _STILL_TO_PORT
 	/* DASD limit check                                     F226941 */
 	if (OVER_LIMIT(ip, nblocks))
 		return -ENOSPC;
 #endif				/* _STILL_TO_PORT */
 
 	/* get the log2 number of blocks to be allocated.
 	 * if the number of blocks is not a log2 multiple, 
 	 * it will be rounded up to the next log2 multiple.
 	 */
 	l2nb = BLKSTOL2(nblocks);
 
 	bmp = JFS_SBI(ip->i_sb)->bmap;
 
 //retry:        /* serialize w.r.t.extendfs() */
 	mapSize = bmp->db_mapsize;
 
 	/* the hint should be within the map */
 	if (hint >= mapSize) {
 		jfs_error(ip->i_sb, "dbAlloc: the hint is outside the map");
 		return -EIO;
 	}
 
 	/* if the number of blocks to be allocated is greater than the
 	 * allocation group size, try to allocate anywhere.
 	 */
 	if (l2nb > bmp->db_agl2size) {
 		IWRITE_LOCK(ipbmap);
 
 		rc = dbAllocAny(bmp, nblocks, l2nb, results);
 		if (rc == 0) {
 			DBALLOC(bmp->db_DBmap, bmp->db_mapsize, *results,
 				nblocks);
 		}
 
 		goto write_unlock;
 	}
 
 	/*
 	 * If no hint, let dbNextAG recommend an allocation group
 	 */
 	if (hint == 0)
 		goto pref_ag;
 
 	/* we would like to allocate close to the hint.  adjust the
 	 * hint to the block following the hint since the allocators
 	 * will start looking for free space starting at this point.
 	 */
 	blkno = hint + 1;
 
 	if (blkno >= bmp->db_mapsize)
 		goto pref_ag;
 
 	agno = blkno >> bmp->db_agl2size;
 
 	/* check if blkno crosses over into a new allocation group.
 	 * if so, check if we should allow allocations within this
 	 * allocation group.
 	 */
 	if ((blkno & (bmp->db_agsize - 1)) == 0)
 		/* check if the AG is currenly being written to.
 		 * if so, call dbNextAG() to find a non-busy
 		 * AG with sufficient free space.
 		 */
 		if (atomic_read(&bmp->db_active[agno]))
 			goto pref_ag;
 
 	/* check if the allocation request size can be satisfied from a
 	 * single dmap.  if so, try to allocate from the dmap containing
 	 * the hint using a tiered strategy.
 	 */
 	if (nblocks <= BPERDMAP) {
 		IREAD_LOCK(ipbmap);
 
 		/* get the buffer for the dmap containing the hint.
 		 */
 		rc = -EIO;
 		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 		mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
 		if (mp == NULL)
 			goto read_unlock;
 
 		dp = (struct dmap *) mp->data;
 
 		/* first, try to satisfy the allocation request with the
 		 * blocks beginning at the hint.
 		 */
 		if ((rc = dbAllocNext(bmp, dp, blkno, (int) nblocks))
 		    != -ENOSPC) {
 			if (rc == 0) {
 				*results = blkno;
 				DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 					*results, nblocks);
 				mark_metapage_dirty(mp);
 			}
 
 			release_metapage(mp);
 			goto read_unlock;
 		}
 
 		writers = atomic_read(&bmp->db_active[agno]);
 		if ((writers > 1) ||
 		    ((writers == 1) && (JFS_IP(ip)->active_ag != agno))) {
 			/*
 			 * Someone else is writing in this allocation
 			 * group.  To avoid fragmenting, try another ag
 			 */
 			release_metapage(mp);
 			IREAD_UNLOCK(ipbmap);
 			goto pref_ag;
 		}
 
 		/* next, try to satisfy the allocation request with blocks
 		 * near the hint.
 		 */
 		if ((rc =
 		     dbAllocNear(bmp, dp, blkno, (int) nblocks, l2nb, results))
 		    != -ENOSPC) {
 			if (rc == 0) {
 				DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 					*results, nblocks);
 				mark_metapage_dirty(mp);
 			}
 
 			release_metapage(mp);
 			goto read_unlock;
 		}
 
 		/* try to satisfy the allocation request with blocks within
 		 * the same dmap as the hint.
 		 */
 		if ((rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results))
 		    != -ENOSPC) {
 			if (rc == 0) {
 				DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 					*results, nblocks);
 				mark_metapage_dirty(mp);
 			}
 
 			release_metapage(mp);
 			goto read_unlock;
 		}
 
 		release_metapage(mp);
 		IREAD_UNLOCK(ipbmap);
 	}
 
 	/* try to satisfy the allocation request with blocks within
 	 * the same allocation group as the hint.
 	 */
 	IWRITE_LOCK(ipbmap);
 	if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results))
 	    != -ENOSPC) {
 		if (rc == 0)
 			DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 				*results, nblocks);
 		goto write_unlock;
 	}
 	IWRITE_UNLOCK(ipbmap);
 
 
       pref_ag:
 	/*
 	 * Let dbNextAG recommend a preferred allocation group
 	 */
 	agno = dbNextAG(ipbmap);
 	IWRITE_LOCK(ipbmap);
 
 	/* Try to allocate within this allocation group.  if that fails, try to
 	 * allocate anywhere in the map.
 	 */
 	if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) == -ENOSPC)
 		rc = dbAllocAny(bmp, nblocks, l2nb, results);
 	if (rc == 0) {
 		DBALLOC(bmp->db_DBmap, bmp->db_mapsize, *results, nblocks);
 	}
 
       write_unlock:
 	IWRITE_UNLOCK(ipbmap);
 
 	return (rc);
 
       read_unlock:
 	IREAD_UNLOCK(ipbmap);
 
 	return (rc);
 }
 
 #ifdef _NOTYET
 /*
  * NAME:	dbAllocExact()
  *
  * FUNCTION:    try to allocate the requested extent;
  *
  * PARAMETERS:
  *      ip	- pointer to in-core inode;
  *      blkno	- extent address;
  *      nblocks	- extent length;
  *
  * RETURN VALUES:
  *      0	- success
  *      -ENOSPC	- insufficient disk resources
  *      -EIO	- i/o error
  */
 int dbAllocExact(struct inode *ip, s64 blkno, int nblocks)
 {
 	int rc;
 	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
 	struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
 	struct dmap *dp;
 	s64 lblkno;
 	struct metapage *mp;
 
 	IREAD_LOCK(ipbmap);
 
 	/*
 	 * validate extent request:
 	 *
 	 * note: defragfs policy:
 	 *  max 64 blocks will be moved.  
 	 *  allocation request size must be satisfied from a single dmap.
 	 */
 	if (nblocks <= 0 || nblocks > BPERDMAP || blkno >= bmp->db_mapsize) {
 		IREAD_UNLOCK(ipbmap);
 		return -EINVAL;
 	}
 
 	if (nblocks > ((s64) 1 << bmp->db_maxfreebud)) {
 		/* the free space is no longer available */
 		IREAD_UNLOCK(ipbmap);
 		return -ENOSPC;
 	}
 
 	/* read in the dmap covering the extent */
 	lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 	mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
 	if (mp == NULL) {
 		IREAD_UNLOCK(ipbmap);
 		return -EIO;
 	}
 	dp = (struct dmap *) mp->data;
 
 	/* try to allocate the requested extent */
 	rc = dbAllocNext(bmp, dp, blkno, nblocks);
]
]

213/2 2026/06/30 15:20 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 34697
							output: 54
							thoughts: 124
						

Thoughts:
**Investigating the Leaf Index Condition**

Okay, first thought: I need to pinpoint the introduction of that specific conditional statement, `if (dp->tree.leafidx != cpu_to_le32(LEAFIND))`. It's a key piece of logic I'm tracking down. My initial instinct is to leverage `git blame` or even `git log -S` for the code, it's the obvious go-to for finding the insertion point.

Wait a second... didn't I already *do* that? I vaguely recall running `git log` and searching for that exact condition. Let me quickly check the output. Ah, yes! The commit hash I got back from that search was `1da177e4c3f4`. Good, I've got a starting point.

Now, just to be thorough and exclude other possibilities, I should do one more check. I'll search for any *other* commits that might have touched the `leafidx` variable, while also involving either the `dbAllocNext` or `dbAllocNear` functions, to see if they are involved somehow. It's possible related changes might hold the explanation.



214/2 2026/06/30 15:21 tool git-log
0m Args:
map[CodeRegexp:dp->tree\.leafidx != cpu_to_le32\(LEAFIND\) PathPrefix:fs/jfs/jfs_dmap.c]

Results:
map[Output:1da177e4c3f4 Linux-2.6.12-rc2
]

215/2 2026/06/30 15:21 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 35162
							output: 39
							thoughts: 173
						

Thoughts:
**Analyzing the JFS Bug: A Deep Dive**

Okay, so let me get this straight. The bug report is highlighting a critical deficiency in JFS's integrity checks. The explanation clearly states that a check was *added* for `dmapctl` structures – referencing commit `cce219b203c4`. This is good, but the key issue is that, astonishingly, the *`dmaptree` structures* themselves – the core of the `dmap` logic – have been completely unvalidated since the very beginning.

My mind is racing. This lack of validation has been present since the project's inception. Specifically, that would be commit `1da177e4c3f4`, which is the initial commit for Linux 2.6.12-rc2! This is a long-standing potential vulnerability.

Now, I need to focus. My immediate concern is whether this oversight directly impacts `dbJoin`, which is a critical function within the database-joining operation. I need to trace the evolution of `dbJoin` to determine if this out-of-bounds access has been there from the start. That would be a frightening realization if it's the case! The next step is a deep dive into the code history...



216/2 2026/06/30 15:21 tool git-show
0m Args:
map[Commit:1da177e4c3f4:fs/jfs/jfs_dmap.c]

Results:
map[Output:
Full output is too long, showing 1000 out of 4272 lines.

[/*
  *   Copyright (C) International Business Machines Corp., 2000-2004
  *
  *   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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include <linux/fs.h>
 #include "jfs_incore.h"
 #include "jfs_superblock.h"
 #include "jfs_dmap.h"
 #include "jfs_imap.h"
 #include "jfs_lock.h"
 #include "jfs_metapage.h"
 #include "jfs_debug.h"
 
 /*
  *	Debug code for double-checking block map
  */
 /* #define	_JFS_DEBUG_DMAP	1 */
 
 #ifdef	_JFS_DEBUG_DMAP
 #define DBINITMAP(size,ipbmap,results) \
 	DBinitmap(size,ipbmap,results)
 #define DBALLOC(dbmap,mapsize,blkno,nblocks) \
 	DBAlloc(dbmap,mapsize,blkno,nblocks)
 #define DBFREE(dbmap,mapsize,blkno,nblocks) \
 	DBFree(dbmap,mapsize,blkno,nblocks)
 #define DBALLOCCK(dbmap,mapsize,blkno,nblocks) \
 	DBAllocCK(dbmap,mapsize,blkno,nblocks)
 #define DBFREECK(dbmap,mapsize,blkno,nblocks) \
 	DBFreeCK(dbmap,mapsize,blkno,nblocks)
 
 static void DBinitmap(s64, struct inode *, u32 **);
 static void DBAlloc(uint *, s64, s64, s64);
 static void DBFree(uint *, s64, s64, s64);
 static void DBAllocCK(uint *, s64, s64, s64);
 static void DBFreeCK(uint *, s64, s64, s64);
 #else
 #define DBINITMAP(size,ipbmap,results)
 #define DBALLOC(dbmap, mapsize, blkno, nblocks)
 #define DBFREE(dbmap, mapsize, blkno, nblocks)
 #define DBALLOCCK(dbmap, mapsize, blkno, nblocks)
 #define DBFREECK(dbmap, mapsize, blkno, nblocks)
 #endif				/* _JFS_DEBUG_DMAP */
 
 /*
  *	SERIALIZATION of the Block Allocation Map.
  *
  *	the working state of the block allocation map is accessed in
  *	two directions:
  *	
  *	1) allocation and free requests that start at the dmap
  *	   level and move up through the dmap control pages (i.e.
  *	   the vast majority of requests).
  * 
  * 	2) allocation requests that start at dmap control page
  *	   level and work down towards the dmaps.
  *	
  *	the serialization scheme used here is as follows. 
  *
  *	requests which start at the bottom are serialized against each 
  *	other through buffers and each requests holds onto its buffers 
  *	as it works it way up from a single dmap to the required level 
  *	of dmap control page.
  *	requests that start at the top are serialized against each other
  *	and request that start from the bottom by the multiple read/single
  *	write inode lock of the bmap inode. requests starting at the top
  *	take this lock in write mode while request starting at the bottom
  *	take the lock in read mode.  a single top-down request may proceed
  *	exclusively while multiple bottoms-up requests may proceed 
  * 	simultaneously (under the protection of busy buffers).
  *	
  *	in addition to information found in dmaps and dmap control pages,
  *	the working state of the block allocation map also includes read/
  *	write information maintained in the bmap descriptor (i.e. total
  *	free block count, allocation group level free block counts).
  *	a single exclusive lock (BMAP_LOCK) is used to guard this information
  *	in the face of multiple-bottoms up requests.
  *	(lock ordering: IREAD_LOCK, BMAP_LOCK);
  *	
  *	accesses to the persistent state of the block allocation map (limited
  *	to the persistent bitmaps in dmaps) is guarded by (busy) buffers.
  */
 
 #define BMAP_LOCK_INIT(bmp)	init_MUTEX(&bmp->db_bmaplock)
 #define BMAP_LOCK(bmp)		down(&bmp->db_bmaplock)
 #define BMAP_UNLOCK(bmp)	up(&bmp->db_bmaplock)
 
 /*
  * forward references
  */
 static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
 			int nblocks);
 static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval);
 static void dbBackSplit(dmtree_t * tp, int leafno);
 static void dbJoin(dmtree_t * tp, int leafno, int newval);
 static void dbAdjTree(dmtree_t * tp, int leafno, int newval);
 static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc,
 		    int level);
 static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results);
 static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks);
 static int dbAllocNear(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks,
 		       int l2nb, s64 * results);
 static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks);
 static int dbAllocDmapLev(struct bmap * bmp, struct dmap * dp, int nblocks,
 			  int l2nb,
 			  s64 * results);
 static int dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb,
 		     s64 * results);
 static int dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno,
 		      s64 * results);
 static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks);
 static int dbFindBits(u32 word, int l2nb);
 static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno);
 static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx);
 static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		       int nblocks);
 static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 		      int nblocks);
 static int dbMaxBud(u8 * cp);
 s64 dbMapFileSizeToMapSize(struct inode *ipbmap);
 static int blkstol2(s64 nb);
 
 static int cntlz(u32 value);
 static int cnttz(u32 word);
 
 static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
 			 int nblocks);
 static int dbInitDmap(struct dmap * dp, s64 blkno, int nblocks);
 static int dbInitDmapTree(struct dmap * dp);
 static int dbInitTree(struct dmaptree * dtp);
 static int dbInitDmapCtl(struct dmapctl * dcp, int level, int i);
 static int dbGetL2AGSize(s64 nblocks);
 
 /*
  *	buddy table
  *
  * table used for determining buddy sizes within characters of 
  * dmap bitmap words.  the characters themselves serve as indexes
  * into the table, with the table elements yielding the maximum
  * binary buddy of free bits within the character.
  */
 static s8 budtab[256] = {
 	3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
 	2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1
 };
 
 
 /*
  * NAME:    	dbMount()
  *
  * FUNCTION:	initializate the block allocation map.
  *
  *		memory is allocated for the in-core bmap descriptor and
  *		the in-core descriptor is initialized from disk.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *
  * RETURN VALUES:
  *      0	- success
  *      -ENOMEM	- insufficient memory
  *      -EIO	- i/o error
  */
 int dbMount(struct inode *ipbmap)
 {
 	struct bmap *bmp;
 	struct dbmap_disk *dbmp_le;
 	struct metapage *mp;
 	int i;
 
 	/*
 	 * allocate/initialize the in-memory bmap descriptor
 	 */
 	/* allocate memory for the in-memory bmap descriptor */
 	bmp = kmalloc(sizeof(struct bmap), GFP_KERNEL);
 	if (bmp == NULL)
 		return -ENOMEM;
 
 	/* read the on-disk bmap descriptor. */
 	mp = read_metapage(ipbmap,
 			   BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
 			   PSIZE, 0);
 	if (mp == NULL) {
 		kfree(bmp);
 		return -EIO;
 	}
 
 	/* copy the on-disk bmap descriptor to its in-memory version. */
 	dbmp_le = (struct dbmap_disk *) mp->data;
 	bmp->db_mapsize = le64_to_cpu(dbmp_le->dn_mapsize);
 	bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree);
 	bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage);
 	bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag);
 	bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel);
 	bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag);
 	bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref);
 	bmp->db_aglevel = le32_to_cpu(dbmp_le->dn_aglevel);
 	bmp->db_agheigth = le32_to_cpu(dbmp_le->dn_agheigth);
 	bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth);
 	bmp->db_agstart = le32_to_cpu(dbmp_le->dn_agstart);
 	bmp->db_agl2size = le32_to_cpu(dbmp_le->dn_agl2size);
 	for (i = 0; i < MAXAG; i++)
 		bmp->db_agfree[i] = le64_to_cpu(dbmp_le->dn_agfree[i]);
 	bmp->db_agsize = le64_to_cpu(dbmp_le->dn_agsize);
 	bmp->db_maxfreebud = dbmp_le->dn_maxfreebud;
 
 	/* release the buffer. */
 	release_metapage(mp);
 
 	/* bind the bmap inode and the bmap descriptor to each other. */
 	bmp->db_ipbmap = ipbmap;
 	JFS_SBI(ipbmap->i_sb)->bmap = bmp;
 
 	memset(bmp->db_active, 0, sizeof(bmp->db_active));
 	DBINITMAP(bmp->db_mapsize, ipbmap, &bmp->db_DBmap);
 
 	/*
 	 * allocate/initialize the bmap lock
 	 */
 	BMAP_LOCK_INIT(bmp);
 
 	return (0);
 }
 
 
 /*
  * NAME:    	dbUnmount()
  *
  * FUNCTION:	terminate the block allocation map in preparation for
  *		file system unmount.
  *
  * 		the in-core bmap descriptor is written to disk and
  *		the memory for this descriptor is freed.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *
  * RETURN VALUES:
  *      0	- success
  *      -EIO	- i/o error
  */
 int dbUnmount(struct inode *ipbmap, int mounterror)
 {
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 	int i;
 
 	if (!(mounterror || isReadOnly(ipbmap)))
 		dbSync(ipbmap);
 
 	/*
 	 * Invalidate the page cache buffers
 	 */
 	truncate_inode_pages(ipbmap->i_mapping, 0);
 
 	/*
 	 * Sanity Check
 	 */
 	for (i = 0; i < bmp->db_numag; i++)
 		if (atomic_read(&bmp->db_active[i]))
 			printk(KERN_ERR "dbUnmount: db_active[%d] = %d\n",
 			       i, atomic_read(&bmp->db_active[i]));
 
 	/* free the memory for the in-memory bmap. */
 	kfree(bmp);
 
 	return (0);
 }
 
 /*
  *	dbSync()
  */
 int dbSync(struct inode *ipbmap)
 {
 	struct dbmap_disk *dbmp_le;
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 	struct metapage *mp;
 	int i;
 
 	/*
 	 * write bmap global control page
 	 */
 	/* get the buffer for the on-disk bmap descriptor. */
 	mp = read_metapage(ipbmap,
 			   BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
 			   PSIZE, 0);
 	if (mp == NULL) {
 		jfs_err("dbSync: read_metapage failed!");
 		return -EIO;
 	}
 	/* copy the in-memory version of the bmap to the on-disk version */
 	dbmp_le = (struct dbmap_disk *) mp->data;
 	dbmp_le->dn_mapsize = cpu_to_le64(bmp->db_mapsize);
 	dbmp_le->dn_nfree = cpu_to_le64(bmp->db_nfree);
 	dbmp_le->dn_l2nbperpage = cpu_to_le32(bmp->db_l2nbperpage);
 	dbmp_le->dn_numag = cpu_to_le32(bmp->db_numag);
 	dbmp_le->dn_maxlevel = cpu_to_le32(bmp->db_maxlevel);
 	dbmp_le->dn_maxag = cpu_to_le32(bmp->db_maxag);
 	dbmp_le->dn_agpref = cpu_to_le32(bmp->db_agpref);
 	dbmp_le->dn_aglevel = cpu_to_le32(bmp->db_aglevel);
 	dbmp_le->dn_agheigth = cpu_to_le32(bmp->db_agheigth);
 	dbmp_le->dn_agwidth = cpu_to_le32(bmp->db_agwidth);
 	dbmp_le->dn_agstart = cpu_to_le32(bmp->db_agstart);
 	dbmp_le->dn_agl2size = cpu_to_le32(bmp->db_agl2size);
 	for (i = 0; i < MAXAG; i++)
 		dbmp_le->dn_agfree[i] = cpu_to_le64(bmp->db_agfree[i]);
 	dbmp_le->dn_agsize = cpu_to_le64(bmp->db_agsize);
 	dbmp_le->dn_maxfreebud = bmp->db_maxfreebud;
 
 	/* write the buffer */
 	write_metapage(mp);
 
 	/*
 	 * write out dirty pages of bmap
 	 */
 	filemap_fdatawrite(ipbmap->i_mapping);
 	filemap_fdatawait(ipbmap->i_mapping);
 
 	ipbmap->i_state |= I_DIRTY;
 	diWriteSpecial(ipbmap, 0);
 
 	return (0);
 }
 
 
 /*
  * NAME:    	dbFree()
  *
  * FUNCTION:	free the specified block range from the working block
  *		allocation map.
  *
  *		the blocks will be free from the working map one dmap
  *		at a time.
  *
  * PARAMETERS:
  *      ip	-  pointer to in-core inode;
  *      blkno	-  starting block number to be freed.
  *      nblocks	-  number of blocks to be freed.
  *
  * RETURN VALUES:
  *      0	- success
  *      -EIO	- i/o error
  */
 int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
 {
 	struct metapage *mp;
 	struct dmap *dp;
 	int nb, rc;
 	s64 lblkno, rem;
 	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
 	struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
 
 	IREAD_LOCK(ipbmap);
 
 	/* block to be freed better be within the mapsize. */
 	if (unlikely((blkno == 0) || (blkno + nblocks > bmp->db_mapsize))) {
 		IREAD_UNLOCK(ipbmap);
 		printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
 		       (unsigned long long) blkno,
 		       (unsigned long long) nblocks);
 		jfs_error(ip->i_sb,
 			  "dbFree: block to be freed is outside the map");
 		return -EIO;
 	}
 
 	/*
 	 * free the blocks a dmap at a time.
 	 */
 	mp = NULL;
 	for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) {
 		/* release previous dmap if any */
 		if (mp) {
 			write_metapage(mp);
 		}
 
 		/* get the buffer for the current dmap. */
 		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 		mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
 		if (mp == NULL) {
 			IREAD_UNLOCK(ipbmap);
 			return -EIO;
 		}
 		dp = (struct dmap *) mp->data;
 
 		/* determine the number of blocks to be freed from
 		 * this dmap.
 		 */
 		nb = min(rem, BPERDMAP - (blkno & (BPERDMAP - 1)));
 
 		DBALLOCCK(bmp->db_DBmap, bmp->db_mapsize, blkno, nb);
 
 		/* free the blocks. */
 		if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) {
 			release_metapage(mp);
 			IREAD_UNLOCK(ipbmap);
 			return (rc);
 		}
 
 		DBFREE(bmp->db_DBmap, bmp->db_mapsize, blkno, nb);
 	}
 
 	/* write the last buffer. */
 	write_metapage(mp);
 
 	IREAD_UNLOCK(ipbmap);
 
 	return (0);
 }
 
 
 /*
  * NAME:	dbUpdatePMap()
  *
  * FUNCTION:    update the allocation state (free or allocate) of the
  *		specified block range in the persistent block allocation map.
  *		
  *		the blocks will be updated in the persistent map one
  *		dmap at a time.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *      free	- TRUE if block range is to be freed from the persistent
  *		  map; FALSE if it is to   be allocated.
  *      blkno	-  starting block number of the range.
  *      nblocks	-  number of contiguous blocks in the range.
  *      tblk	-  transaction block;
  *
  * RETURN VALUES:
  *      0	- success
  *      -EIO	- i/o error
  */
 int
 dbUpdatePMap(struct inode *ipbmap,
 	     int free, s64 blkno, s64 nblocks, struct tblock * tblk)
 {
 	int nblks, dbitno, wbitno, rbits;
 	int word, nbits, nwords;
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 	s64 lblkno, rem, lastlblkno;
 	u32 mask;
 	struct dmap *dp;
 	struct metapage *mp;
 	struct jfs_log *log;
 	int lsn, difft, diffp;
 
 	/* the blocks better be within the mapsize. */
 	if (blkno + nblocks > bmp->db_mapsize) {
 		printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
 		       (unsigned long long) blkno,
 		       (unsigned long long) nblocks);
 		jfs_error(ipbmap->i_sb,
 			  "dbUpdatePMap: blocks are outside the map");
 		return -EIO;
 	}
 
 	/* compute delta of transaction lsn from log syncpt */
 	lsn = tblk->lsn;
 	log = (struct jfs_log *) JFS_SBI(tblk->sb)->log;
 	logdiff(difft, lsn, log);
 
 	/*
 	 * update the block state a dmap at a time.
 	 */
 	mp = NULL;
 	lastlblkno = 0;
 	for (rem = nblocks; rem > 0; rem -= nblks, blkno += nblks) {
 		/* get the buffer for the current dmap. */
 		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 		if (lblkno != lastlblkno) {
 			if (mp) {
 				write_metapage(mp);
 			}
 
 			mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE,
 					   0);
 			if (mp == NULL)
 				return -EIO;
 		}
 		dp = (struct dmap *) mp->data;
 
 		/* determine the bit number and word within the dmap of
 		 * the starting block.  also determine how many blocks
 		 * are to be updated within this dmap.
 		 */
 		dbitno = blkno & (BPERDMAP - 1);
 		word = dbitno >> L2DBWORD;
 		nblks = min(rem, (s64)BPERDMAP - dbitno);
 
 		/* update the bits of the dmap words. the first and last
 		 * words may only have a subset of their bits updated. if
 		 * this is the case, we'll work against that word (i.e.
 		 * partial first and/or last) only in a single pass.  a 
 		 * single pass will also be used to update all words that
 		 * are to have all their bits updated.
 		 */
 		for (rbits = nblks; rbits > 0;
 		     rbits -= nbits, dbitno += nbits) {
 			/* determine the bit number within the word and
 			 * the number of bits within the word.
 			 */
 			wbitno = dbitno & (DBWORD - 1);
 			nbits = min(rbits, DBWORD - wbitno);
 
 			/* check if only part of the word is to be updated. */
 			if (nbits < DBWORD) {
 				/* update (free or allocate) the bits
 				 * in this word.
 				 */
 				mask =
 				    (ONES << (DBWORD - nbits) >> wbitno);
 				if (free)
 					dp->pmap[word] &=
 					    cpu_to_le32(~mask);
 				else
 					dp->pmap[word] |=
 					    cpu_to_le32(mask);
 
 				word += 1;
 			} else {
 				/* one or more words are to have all
 				 * their bits updated.  determine how
 				 * many words and how many bits.
 				 */
 				nwords = rbits >> L2DBWORD;
 				nbits = nwords << L2DBWORD;
 
 				/* update (free or allocate) the bits
 				 * in these words.
 				 */
 				if (free)
 					memset(&dp->pmap[word], 0,
 					       nwords * 4);
 				else
 					memset(&dp->pmap[word], (int) ONES,
 					       nwords * 4);
 
 				word += nwords;
 			}
 		}
 
 		/*
 		 * update dmap lsn
 		 */
 		if (lblkno == lastlblkno)
 			continue;
 
 		lastlblkno = lblkno;
 
 		if (mp->lsn != 0) {
 			/* inherit older/smaller lsn */
 			logdiff(diffp, mp->lsn, log);
 			if (difft < diffp) {
 				mp->lsn = lsn;
 
 				/* move bp after tblock in logsync list */
 				LOGSYNC_LOCK(log);
 				list_move(&mp->synclist, &tblk->synclist);
 				LOGSYNC_UNLOCK(log);
 			}
 
 			/* inherit younger/larger clsn */
 			LOGSYNC_LOCK(log);
 			logdiff(difft, tblk->clsn, log);
 			logdiff(diffp, mp->clsn, log);
 			if (difft > diffp)
 				mp->clsn = tblk->clsn;
 			LOGSYNC_UNLOCK(log);
 		} else {
 			mp->log = log;
 			mp->lsn = lsn;
 
 			/* insert bp after tblock in logsync list */
 			LOGSYNC_LOCK(log);
 
 			log->count++;
 			list_add(&mp->synclist, &tblk->synclist);
 
 			mp->clsn = tblk->clsn;
 			LOGSYNC_UNLOCK(log);
 		}
 	}
 
 	/* write the last buffer. */
 	if (mp) {
 		write_metapage(mp);
 	}
 
 	return (0);
 }
 
 
 /*
  * NAME:	dbNextAG()
  *
  * FUNCTION:    find the preferred allocation group for new allocations.
  *
  *		Within the allocation groups, we maintain a preferred
  *		allocation group which consists of a group with at least
  *		average free space.  It is the preferred group that we target
  *		new inode allocation towards.  The tie-in between inode
  *		allocation and block allocation occurs as we allocate the
  *		first (data) block of an inode and specify the inode (block)
  *		as the allocation hint for this block.
  *
  *		We try to avoid having more than one open file growing in
  *		an allocation group, as this will lead to fragmentation.
  *		This differs from the old OS/2 method of trying to keep
  *		empty ags around for large allocations.
  *
  * PARAMETERS:
  *      ipbmap	-  pointer to in-core inode for the block map.
  *
  * RETURN VALUES:
  *      the preferred allocation group number.
  */
 int dbNextAG(struct inode *ipbmap)
 {
 	s64 avgfree;
 	int agpref;
 	s64 hwm = 0;
 	int i;
 	int next_best = -1;
 	struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
 
 	BMAP_LOCK(bmp);
 
 	/* determine the average number of free blocks within the ags. */
 	avgfree = (u32)bmp->db_nfree / bmp->db_numag;
 
 	/*
 	 * if the current preferred ag does not have an active allocator
 	 * and has at least average freespace, return it
 	 */
 	agpref = bmp->db_agpref;
 	if ((atomic_read(&bmp->db_active[agpref]) == 0) &&
 	    (bmp->db_agfree[agpref] >= avgfree))
 		goto unlock;
 
 	/* From the last preferred ag, find the next one with at least
 	 * average free space.
 	 */
 	for (i = 0 ; i < bmp->db_numag; i++, agpref++) {
 		if (agpref == bmp->db_numag)
 			agpref = 0;
 
 		if (atomic_read(&bmp->db_active[agpref]))
 			/* open file is currently growing in this ag */
 			continue;
 		if (bmp->db_agfree[agpref] >= avgfree) {
 			/* Return this one */
 			bmp->db_agpref = agpref;
 			goto unlock;
 		} else if (bmp->db_agfree[agpref] > hwm) {
 			/* Less than avg. freespace, but best so far */
 			hwm = bmp->db_agfree[agpref];
 			next_best = agpref;
 		}
 	}
 
 	/*
 	 * If no inactive ag was found with average freespace, use the
 	 * next best
 	 */
 	if (next_best != -1)
 		bmp->db_agpref = next_best;
 	/* else leave db_agpref unchanged */
 unlock:
 	BMAP_UNLOCK(bmp);
 
 	/* return the preferred group.
 	 */
 	return (bmp->db_agpref);
 }
 
 /*
  * NAME:	dbAlloc()
  *
  * FUNCTION:    attempt to allocate a specified number of contiguous free
  *		blocks from the working allocation block map.
  *
  *		the block allocation policy uses hints and a multi-step
  *		approach.
  *
  *	  	for allocation requests smaller than the number of blocks
  *		per dmap, we first try to allocate the new blocks
  *		immediately following the hint.  if these blocks are not
  *		available, we try to allocate blocks near the hint.  if
  *		no blocks near the hint are available, we next try to 
  *		allocate within the same dmap as contains the hint.
  *
  *		if no blocks are available in the dmap or the allocation
  *		request is larger than the dmap size, we try to allocate
  *		within the same allocation group as contains the hint. if
  *		this does not succeed, we finally try to allocate anywhere
  *		within the aggregate.
  *
  *		we also try to allocate anywhere within the aggregate for
  *		for allocation requests larger than the allocation group
  *		size or requests that specify no hint value.
  *
  * PARAMETERS:
  *      ip	-  pointer to in-core inode;
  *      hint	- allocation hint.
  *      nblocks	- number of contiguous blocks in the range.
  *      results	- on successful return, set to the starting block number
  *		  of the newly allocated contiguous range.
  *
  * RETURN VALUES:
  *      0	- success
  *      -ENOSPC	- insufficient disk resources
  *      -EIO	- i/o error
  */
 int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
 {
 	int rc, agno;
 	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
 	struct bmap *bmp;
 	struct metapage *mp;
 	s64 lblkno, blkno;
 	struct dmap *dp;
 	int l2nb;
 	s64 mapSize;
 	int writers;
 
 	/* assert that nblocks is valid */
 	assert(nblocks > 0);
 
 #ifdef _STILL_TO_PORT
 	/* DASD limit check                                     F226941 */
 	if (OVER_LIMIT(ip, nblocks))
 		return -ENOSPC;
 #endif				/* _STILL_TO_PORT */
 
 	/* get the log2 number of blocks to be allocated.
 	 * if the number of blocks is not a log2 multiple, 
 	 * it will be rounded up to the next log2 multiple.
 	 */
 	l2nb = BLKSTOL2(nblocks);
 
 	bmp = JFS_SBI(ip->i_sb)->bmap;
 
 //retry:        /* serialize w.r.t.extendfs() */
 	mapSize = bmp->db_mapsize;
 
 	/* the hint should be within the map */
 	if (hint >= mapSize) {
 		jfs_error(ip->i_sb, "dbAlloc: the hint is outside the map");
 		return -EIO;
 	}
 
 	/* if the number of blocks to be allocated is greater than the
 	 * allocation group size, try to allocate anywhere.
 	 */
 	if (l2nb > bmp->db_agl2size) {
 		IWRITE_LOCK(ipbmap);
 
 		rc = dbAllocAny(bmp, nblocks, l2nb, results);
 		if (rc == 0) {
 			DBALLOC(bmp->db_DBmap, bmp->db_mapsize, *results,
 				nblocks);
 		}
 
 		goto write_unlock;
 	}
 
 	/*
 	 * If no hint, let dbNextAG recommend an allocation group
 	 */
 	if (hint == 0)
 		goto pref_ag;
 
 	/* we would like to allocate close to the hint.  adjust the
 	 * hint to the block following the hint since the allocators
 	 * will start looking for free space starting at this point.
 	 */
 	blkno = hint + 1;
 
 	if (blkno >= bmp->db_mapsize)
 		goto pref_ag;
 
 	agno = blkno >> bmp->db_agl2size;
 
 	/* check if blkno crosses over into a new allocation group.
 	 * if so, check if we should allow allocations within this
 	 * allocation group.
 	 */
 	if ((blkno & (bmp->db_agsize - 1)) == 0)
 		/* check if the AG is currenly being written to.
 		 * if so, call dbNextAG() to find a non-busy
 		 * AG with sufficient free space.
 		 */
 		if (atomic_read(&bmp->db_active[agno]))
 			goto pref_ag;
 
 	/* check if the allocation request size can be satisfied from a
 	 * single dmap.  if so, try to allocate from the dmap containing
 	 * the hint using a tiered strategy.
 	 */
 	if (nblocks <= BPERDMAP) {
 		IREAD_LOCK(ipbmap);
 
 		/* get the buffer for the dmap containing the hint.
 		 */
 		rc = -EIO;
 		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 		mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
 		if (mp == NULL)
 			goto read_unlock;
 
 		dp = (struct dmap *) mp->data;
 
 		/* first, try to satisfy the allocation request with the
 		 * blocks beginning at the hint.
 		 */
 		if ((rc = dbAllocNext(bmp, dp, blkno, (int) nblocks))
 		    != -ENOSPC) {
 			if (rc == 0) {
 				*results = blkno;
 				DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 					*results, nblocks);
 				mark_metapage_dirty(mp);
 			}
 
 			release_metapage(mp);
 			goto read_unlock;
 		}
 
 		writers = atomic_read(&bmp->db_active[agno]);
 		if ((writers > 1) ||
 		    ((writers == 1) && (JFS_IP(ip)->active_ag != agno))) {
 			/*
 			 * Someone else is writing in this allocation
 			 * group.  To avoid fragmenting, try another ag
 			 */
 			release_metapage(mp);
 			IREAD_UNLOCK(ipbmap);
 			goto pref_ag;
 		}
 
 		/* next, try to satisfy the allocation request with blocks
 		 * near the hint.
 		 */
 		if ((rc =
 		     dbAllocNear(bmp, dp, blkno, (int) nblocks, l2nb, results))
 		    != -ENOSPC) {
 			if (rc == 0) {
 				DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 					*results, nblocks);
 				mark_metapage_dirty(mp);
 			}
 
 			release_metapage(mp);
 			goto read_unlock;
 		}
 
 		/* try to satisfy the allocation request with blocks within
 		 * the same dmap as the hint.
 		 */
 		if ((rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results))
 		    != -ENOSPC) {
 			if (rc == 0) {
 				DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 					*results, nblocks);
 				mark_metapage_dirty(mp);
 			}
 
 			release_metapage(mp);
 			goto read_unlock;
 		}
 
 		release_metapage(mp);
 		IREAD_UNLOCK(ipbmap);
 	}
 
 	/* try to satisfy the allocation request with blocks within
 	 * the same allocation group as the hint.
 	 */
 	IWRITE_LOCK(ipbmap);
 	if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results))
 	    != -ENOSPC) {
 		if (rc == 0)
 			DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
 				*results, nblocks);
 		goto write_unlock;
 	}
 	IWRITE_UNLOCK(ipbmap);
 
 
       pref_ag:
 	/*
 	 * Let dbNextAG recommend a preferred allocation group
 	 */
 	agno = dbNextAG(ipbmap);
 	IWRITE_LOCK(ipbmap);
 
 	/* Try to allocate within this allocation group.  if that fails, try to
 	 * allocate anywhere in the map.
 	 */
 	if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) == -ENOSPC)
 		rc = dbAllocAny(bmp, nblocks, l2nb, results);
 	if (rc == 0) {
 		DBALLOC(bmp->db_DBmap, bmp->db_mapsize, *results, nblocks);
 	}
 
       write_unlock:
 	IWRITE_UNLOCK(ipbmap);
 
 	return (rc);
 
       read_unlock:
 	IREAD_UNLOCK(ipbmap);
 
 	return (rc);
 }
 
 #ifdef _NOTYET
 /*
  * NAME:	dbAllocExact()
  *
  * FUNCTION:    try to allocate the requested extent;
  *
  * PARAMETERS:
  *      ip	- pointer to in-core inode;
  *      blkno	- extent address;
  *      nblocks	- extent length;
  *
  * RETURN VALUES:
  *      0	- success
  *      -ENOSPC	- insufficient disk resources
  *      -EIO	- i/o error
  */
 int dbAllocExact(struct inode *ip, s64 blkno, int nblocks)
 {
 	int rc;
 	struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
 	struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
 	struct dmap *dp;
 	s64 lblkno;
 	struct metapage *mp;
 
 	IREAD_LOCK(ipbmap);
 
 	/*
 	 * validate extent request:
 	 *
 	 * note: defragfs policy:
 	 *  max 64 blocks will be moved.  
 	 *  allocation request size must be satisfied from a single dmap.
 	 */
 	if (nblocks <= 0 || nblocks > BPERDMAP || blkno >= bmp->db_mapsize) {
 		IREAD_UNLOCK(ipbmap);
 		return -EINVAL;
 	}
 
 	if (nblocks > ((s64) 1 << bmp->db_maxfreebud)) {
 		/* the free space is no longer available */
 		IREAD_UNLOCK(ipbmap);
 		return -ENOSPC;
 	}
 
 	/* read in the dmap covering the extent */
 	lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 	mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
 	if (mp == NULL) {
 		IREAD_UNLOCK(ipbmap);
 		return -EIO;
 	}
 	dp = (struct dmap *) mp->data;
 
 	/* try to allocate the requested extent */
 	rc = dbAllocNext(bmp, dp, blkno, nblocks);
]
]

217/2 2026/06/30 15:21 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 47565
							output: 63
							thoughts: 51
						

Thoughts:
Okay, let's break this down.

**Potential Security Vulnerability Analysis**

Right, so I've got a bug report in front of me. It looks like we're potentially missing some critical validation steps for the `dmaptree` structures. This is particularly concerning because the lack of validation dates all the way back to the initial JFS merge. That's a long time for a potential vulnerability to be lurking! We need to make sure this isn't exploitable.

My initial thought is to dive into the `dbJoin` function. Specifically, I'm going to pull up commit `1da177e4c3f4`. That's likely where the core logic related to `dmaptree` interaction, and potentially validation, was introduced or modified in the past. Understanding the `dbJoin` function in that context is going to be my key to understanding if this bug is real, and how bad it might be. Let's see what we're looking at there.



218/2 2026/06/30 15:21 tool git-log
0m Args:
map[CodeRegexp:leaf = tp->dmt_stree \+ le32_to_cpu\(tp->dmt_leafidx\); PathPrefix:fs/jfs/jfs_dmap.c]

Results:
map[Output:1da177e4c3f4 Linux-2.6.12-rc2
]

219/2 2026/06/30 15:21 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 47927
							output: 39
							thoughts: 454
						

Thoughts:
**Analyzing the Dmap Tree Vulnerability**

Okay, so I've got this bug report, and it looks like a classic out-of-bounds read in the JFS dmap tree. The key line, `leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);`, has been around since commit `1da177e4c3f4`.  The crux of the problem, as I see it, is that `leafidx` comes directly from disk without any validation. That's a textbook recipe for disaster.

The fix, as described, introduces `check_dmaptree` to validate `leafidx` and other fields.  Seems sensible. Given the lack of validation, I'm fairly confident that `1da177e4c3f4` is the introducer.

Let's quickly double-check that this is indeed the single point of failure. The bug report mentions a similar integrity check (`check_dmapctl`) was added for `dmapctl` structures in `cce219b203c4`.  This reinforces my initial assessment. It highlights the general lack of validation in these structures, which was only recently addressed. Essentially, the vulnerability was present from the initial introduction of this code.

To be absolutely certain, let me just verify the complete commit hash for `1da177e4c3f4`. Yep, it's `1da177e4c3f41524e886b7f1b8a0c1fc7321cac2`. I'll use either the abbreviated form or the full hash depending on the context.

Just to be absolutely sure, let me take a quick look at `dbJoin` in `fs/jfs/jfs_dmap.c` within that problematic commit, just to remove any doubt.



220/2 2026/06/30 15:22 tool git-show
0m Error:
log-in to see details

Args:
map[Commit:1da177e4c3f4:fs/jfs/jfs_dmap.c]

221/2 2026/06/30 15:22 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 48897
							output: 42
							thoughts: 40
						

Thoughts:
Okay, here's my take on those thoughts, tailored for an expert audience:

**Quick Analysis After Retrieval**

Right, I've got the initial retrieval, but it looks like the information is truncated. No worries. I need to dig deeper into the code around `dbJoin` within the JFS file system. A quick and dirty way to ascertain when a particular function was added and who was responsible is to use `git-blame`. The relevant file is likely `fs/jfs/jfs_dmap.c`. That should give me the commit history and contributors surrounding that specific function. I'll get the context I need. Let's fire that up.



222/2 2026/06/30 15:22 tool git-blame
0m Args:
map[End:2867 File:fs/jfs/jfs_dmap.c Start:2860]

Results:
map[Output:^1da177e4c3f4 2860) 	s8 *leaf;
^1da177e4c3f4 2861) 
^1da177e4c3f4 2862) 	/* can the new leaf value require a join with other leaves ?
^1da177e4c3f4 2863) 	 */
^1da177e4c3f4 2864) 	if (newval >= tp->dmt_budmin) {
^1da177e4c3f4 2865) 		/* pickup a pointer to the leaves of the tree.
^1da177e4c3f4 2866) 		 */
^1da177e4c3f4 2867) 		leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
]

223/2 2026/06/30 15:22 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 49374
							output: 53
							thoughts: 106
						

Thoughts:
**Bug Found in Tree Validation**

Okay, so I've pinpointed it. The line `leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);` was introduced in commit `1da177e4c3f4`. Looks like a potential vulnerability there. My initial assessment is that the code is missing crucial validation steps. Specifically, the bug appears to stem from a lack of proper checks. I've tracked the faulty commit down to `1da177e4c3f41524e886b7f1b8a0c1fc7321cac2`. Now, I'm setting the stage for remediation.



224/2 2026/06/30 15:22 tool set-results
0m Args:
map[FixesHash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2]

Results:
map[FixesHash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2]

225/1 2026/06/30 15:22 action format-fixes
0m Results:
map[Fixes:map[Hash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Title:Linux-2.6.12-rc2]]

226/1 2026/06/30 15:22 action get-maintainers
0m Results:
map[Recipients:[map[Email:contact@arnaud-lcm.com Name:Arnaud Lecomte To:false] map[Email:jfs-discussion@lists.sourceforge.net Name: To:true] map[Email:kees@kernel.org Name:Kees Cook To:false] map[Email:linux-kernel@vger.kernel.org Name: To:false] map[Email:shaggy@kernel.org Name:Dave Kleikamp To:true] map[Email:yun.zhou@windriver.com Name:Yun Zhou To:false] map[Email:zheng.yu@northwestern.edu Name:Zheng Yu To:false]]]

227/1 2026/06/30 15:22 action get-recent-commits
0m Results:
map[RecentCommits:jfs: add dmapctl integrity check to prevent invalid operations
Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
jfs: fix metapage reference count leak in dbAllocCtl
jfs: upper bound check of tree index in dbAllocAG
jfs: validate AG parameters in dbMount() to prevent crashes
fs/jfs: consolidate sanity checking in dbMount
jfs: add sanity check for agwidth in dbMount
fs/jfs: Prevent integer overflow in AG size calculation
fs/jfs: cast inactags to s64 to prevent potential overflow
jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree
jfs: fix shift-out-of-bounds in dbSplit
jfs: Fix sanity check in dbMount
jfs: check if leafidx greater than num leaves per dmap tree
jfs: fix out-of-bounds in dbNextAG() and diAlloc()
jfs: UBSAN: shift-out-of-bounds in dbFindBits
jfs: Fix shift-out-of-bounds in dbDiscardAG
Revert "jfs: fix shift-out-of-bounds in dbJoin"
jfs: fix shift-out-of-bounds in dbJoin
jfs: fix array-index-out-of-bounds in dbAdjTree
]

228/1 2026/06/30 15:22 agent description-generator
0m Model:
best-expensive

Instruction:
You are an experienced Linux kernel developer tasked with writing a commit description for
a kernel bug fixing commit. The description should start with a one-line summary,
and then include description of the bug being fixed, and how it's fixed by the provided patch.
The one-line summary should describe the change being made, rather than mention the tool that
detected the bug.

The description must not contain lines starting with '#' because they will dropped by git as comments.
The description must not contain lines starting with '--' or '---' (including inline code diffs)
because they may confuse git/patch utilities.

Your final reply should contain only the text of the commit description.


The one-line summary must be not longer than 72 characters.

IMPORTANT: Do not wrap lines manually (e.g., at 80 characters); we will reformat the text
automatically, so keep paragraphs as single lines without newlines.

Generally try to phrase the description without mentioning syzkaller
(avoid phrases like "the bug was triggered by syzkaller" or "the bug was triggered by fuzzer", etc).
How the bug was triggered is generally an irrelevant detail.
Any bug triggered by a fuzzer can also be triggered by a malicious user, or a buggy program.

If the crash is reported by a sanitizer (e.g., KASAN, KMSAN, lockdep), include the relevant
parts of the sanitizer output to illustrate the problem. Exclude less relevant sections,
as the stack trace can be very long. Describe the execution path that leads to the manifestation
of the kernel bug.



Prefer calling several tools at the same time to save round-trips.

Prompt:
The crash that corresponds to the bug is:

------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in /app/workdir/cache/src/7be5f73ee7b4d1978813accf8bb54cd892ccd800/fs/jfs/jfs_dmap.c:2867:24
index 4294967295 is out of range for type 's8[1365]' (aka 'signed char[1365]')
CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted syzkaller #1 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 ubsan_epilogue+0xa/0x30 lib/ubsan.c:233
 __ubsan_handle_out_of_bounds+0xe8/0xf0 lib/ubsan.c:455
 dbJoin+0xcc4/0xd60 fs/jfs/jfs_dmap.c:2867
 dbFreeBits+0x4a2/0xd70 fs/jfs/jfs_dmap.c:2427
 dbFreeDmap fs/jfs/jfs_dmap.c:2176 [inline]
 dbFree+0x324/0x650 fs/jfs/jfs_dmap.c:485
 txFreeMap+0x9e6/0xde0 fs/jfs/jfs_txnmgr.c:2517
 xtTruncate+0xd16/0x2eb0 fs/jfs/jfs_xtree.c:2481
 jfs_free_zero_link+0x35b/0x4c0 fs/jfs/namei.c:760
 jfs_evict_inode+0x356/0x430 fs/jfs/inode.c:159
 evict+0x624/0xb50 fs/inode.c:825
 txLazyCommit fs/jfs/jfs_txnmgr.c:2666 [inline]
 jfs_lazycommit+0x44c/0xac0 fs/jfs/jfs_txnmgr.c:2735
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
---[ end trace ]---




The explanation of the root cause of the bug is:

An array-index-out-of-bounds crash occurs in `dbJoin` when the JFS filesystem attempts to free blocks using a corrupted `dmap` structure read from disk.

### Root Cause

The JFS filesystem uses a binary buddy system to manage free space. The state of the buddy system is stored in `dmap` (for leaf levels) and `dmapctl` (for upper levels) structures on disk. 

When a `dmap` is read from disk, its `dmaptree` structure is not fully validated. Specifically, the `leafidx` field (which indicates the index of the first leaf in the `stree` array) is read directly from disk and used to compute pointers to the leaf nodes. 

If `leafidx` is corrupted (e.g., set to `0xffffffff` / `-1`), the computed pointer will point out of bounds of the `stree` array. When `dbFreeDmap` is called to free blocks, it calls `dbFreeBits`, which in turn calls `dbJoin` to update the buddy system. `dbJoin` uses the corrupted `leafidx` to access the leaf nodes:

```c
// fs/jfs/jfs_dmap.c:2867
leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
```

This results in an out-of-bounds memory access when `leaf[buddy]` is subsequently accessed.

While a similar integrity check (`check_dmapctl`) was recently added for `dmapctl` structures in commit `cce219b203c4` ("jfs: add dmapctl integrity check to prevent invalid operations"), the `dmap` structures (`dmaptree`) were left unchecked.

### Fix

Introduce a `check_dmaptree` function, similar to the existing `check_dmapctl` function, to validate the integrity of the `dmaptree` structure when it is used. 

The `check_dmaptree` function should verify that:
- `nleafs` is within bounds (`<= LPERDMAP`).
- `l2nleafs` is within bounds (`<= L2LPERDMAP`).
- `nleafs` matches `2^l2nleafs`.
- `leafidx` is exactly `LEAFIND`.
- `height` is within bounds (`<= 4`).
- `budmin` is valid (`>= BUDMIN`).
- The leaf nodes fit within the `stree` array (`leafidx + nleafs <= TREESIZE`).
- The values of the leaf nodes are valid (`>= NOFREE` and `<= 31`).

Call `check_dmaptree` in the functions that operate on the `dmap` structure, such as `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. If `check_dmaptree` fails, return `-EIO` to prevent further processing of the corrupted `dmap`. This will also replace the existing partial checks for `leafidx` in `dbAllocNext` and `dbAllocNear`.

```c
/*
 * check_dmaptree - Validate integrity of a dmaptree structure
 * @dtp: Pointer to the dmaptree structure to check
 *
 * Return: true if valid, false if corrupted
 */
static bool check_dmaptree(struct dmaptree *dtp)
{
	u32 nleafs, l2nleafs, leafidx, height;
	int i;

	nleafs = le32_to_cpu(dtp->nleafs);
	/* Check basic field ranges */
	if (unlikely(nleafs > LPERDMAP)) {
		jfs_err("dmaptree: invalid nleafs %u (max %u)",
			nleafs, LPERDMAP);
		return false;
	}

	l2nleafs = le32_to_cpu(dtp->l2nleafs);
	if (unlikely(l2nleafs > L2LPERDMAP)) {
		jfs_err("dmaptree: invalid l2nleafs %u (max %u)",
			l2nleafs, L2LPERDMAP);
		return false;
	}

	/* Verify nleafs matches l2nleafs (must be power of two) */
	if (unlikely((1U << l2nleafs) != nleafs)) {
		jfs_err("dmaptree: nleafs %u != 2^%u",
			nleafs, l2nleafs);
		return false;
	}

	leafidx = le32_to_cpu(dtp->leafidx);
	/* Check leaf index matches expected position */
	if (unlikely(leafidx != LEAFIND)) {
		jfs_err("dmaptree: invalid leafidx %u (expected %u)",
			leafidx, LEAFIND);
		return false;
	}

	height = le32_to_cpu(dtp->height);
	/* Check tree height is within valid range */
	if (unlikely(height > 4)) {
		jfs_err("dmaptree: invalid height %u (max 4)",
			height);
		return false;
	}

	/* Check budmin is valid */
	if (unlikely(dtp->budmin < BUDMIN)) {
		jfs_err("dmaptree: invalid budmin %d (min %d)",
			dtp->budmin, BUDMIN);
		return false;
	}

	/* Check leaf nodes fit within stree array */
	if (unlikely(leafidx + nleafs > TREESIZE)) {
		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
			leafidx + nleafs, TREESIZE);
		return false;
	}

	/* Check leaf nodes have valid values */
	for (i = leafidx; i < leafidx + nleafs; i++) {
		s8 val = dtp->stree[i];

		if (unlikely(val < NOFREE)) {
			jfs_err("dmaptree: invalid leaf value %d at index %d",
					val, i);
			return false;
		} else if (unlikely(val > 31)) {
			jfs_err("dmaptree: leaf value %d too large at index %d", val, i);
			return false;
		}
	}

	return true;
}
```

Then, in functions like `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`, add the check at the beginning:

```c
	if (unlikely(!check_dmaptree(&dp->tree))) {
		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
		return -EIO;
	}
```

The diff of the bug fix is:

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index a841cf21d..4f2e0b78d 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -220,6 +220,85 @@ static bool check_dmapctl(struct dmapctl *dcp)
 	return true;
 }
 
+/*
+ * check_dmaptree - Validate integrity of a dmaptree structure
+ * @dtp: Pointer to the dmaptree structure to check
+ *
+ * Return: true if valid, false if corrupted
+ */
+static bool check_dmaptree(struct dmaptree *dtp)
+{
+	u32 nleafs, l2nleafs, leafidx, height;
+	int i;
+
+	nleafs = le32_to_cpu(dtp->nleafs);
+	/* Check basic field ranges */
+	if (unlikely(nleafs > LPERDMAP)) {
+		jfs_err("dmaptree: invalid nleafs %u (max %u)", nleafs,
+			LPERDMAP);
+		return false;
+	}
+
+	l2nleafs = le32_to_cpu(dtp->l2nleafs);
+	if (unlikely(l2nleafs > L2LPERDMAP)) {
+		jfs_err("dmaptree: invalid l2nleafs %u (max %u)", l2nleafs,
+			L2LPERDMAP);
+		return false;
+	}
+
+	/* Verify nleafs matches l2nleafs (must be power of two) */
+	if (unlikely((1U << l2nleafs) != nleafs)) {
+		jfs_err("dmaptree: nleafs %u != 2^%u", nleafs, l2nleafs);
+		return false;
+	}
+
+	leafidx = le32_to_cpu(dtp->leafidx);
+	/* Check leaf index matches expected position */
+	if (unlikely(leafidx != LEAFIND)) {
+		jfs_err("dmaptree: invalid leafidx %u (expected %u)", leafidx,
+			LEAFIND);
+		return false;
+	}
+
+	height = le32_to_cpu(dtp->height);
+	/* Check tree height is within valid range */
+	if (unlikely(height > 4)) {
+		jfs_err("dmaptree: invalid height %u (max 4)", height);
+		return false;
+	}
+
+	/* Check budmin is valid */
+	if (unlikely(dtp->budmin < BUDMIN)) {
+		jfs_err("dmaptree: invalid budmin %d (min %d)", dtp->budmin,
+			BUDMIN);
+		return false;
+	}
+
+	/* Check leaf nodes fit within stree array */
+	if (unlikely(leafidx + nleafs > TREESIZE)) {
+		jfs_err("dmaptree: leaf range exceeds stree size (end %u > %u)",
+			leafidx + nleafs, TREESIZE);
+		return false;
+	}
+
+	/* Check leaf nodes have valid values */
+	for (i = leafidx; i < leafidx + nleafs; i++) {
+		s8 val = dtp->stree[i];
+
+		if (unlikely(val < NOFREE)) {
+			jfs_err("dmaptree: invalid leaf value %d at index %d",
+				val, i);
+			return false;
+		} else if (unlikely(val > 31)) {
+			jfs_err("dmaptree: leaf value %d too large at index %d",
+				val, i);
+			return false;
+		}
+	}
+
+	return true;
+}
+
 /*
  * NAME:	dbMount()
  *
@@ -1163,7 +1242,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 *leaf;
 	u32 mask;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
@@ -1293,7 +1372,7 @@ dbAllocNear(struct bmap * bmp,
 	int word, lword, rc;
 	s8 *leaf;
 
-	if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
+	if (unlikely(!check_dmaptree(&dp->tree))) {
 		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
 		return -EIO;
 	}
@@ -2046,6 +2125,11 @@ dbAllocDmapLev(struct bmap * bmp,
 	s64 blkno;
 	int leafidx, rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* can't be more than a dmaps worth of blocks */
 	assert(l2nb <= L2BPERDMAP);
 
@@ -2112,6 +2196,11 @@ static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	int rc;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
@@ -2167,6 +2256,11 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	int rc = 0, word;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */
@@ -3338,6 +3432,11 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
 	s8 oldroot;
 	struct dmaptree *tp = (struct dmaptree *) & dp->tree;
 
+	if (unlikely(!check_dmaptree(&dp->tree))) {
+		jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
+		return -EIO;
+	}
+
 	/* save the current value of the root (i.e. maximum free string)
 	 * of the dmap tree.
 	 */


Additional description of the patch:

I have implemented the fix by introducing a dedicated validation function `check_dmaptree()` and calling it at the entry points of all functions that operate on the `dmap` structure.

### What I did in the patch:
1. **Introduced `check_dmaptree()`**: I added a new function in `fs/jfs/jfs_dmap.c` right after `check_dmapctl()`. This function thoroughly validates the integrity of a `dmaptree` structure by checking its fields (`nleafs`, `l2nleafs`, `leafidx`, `height`, `budmin`) against their expected bounds and ensuring internal consistency (e.g., `nleafs == 2^l2nleafs`). It also iterates over the leaf nodes to ensure their values are within the valid range (`NOFREE` to 31) and that the leaf range does not exceed the `stree` array size.
2. **Added Validation Checks**: I added `if (unlikely(!check_dmaptree(&dp->tree)))` checks at the beginning of the following functions:
   - `dbFreeDmap()`
   - `dbAllocNext()`
   - `dbAllocNear()`
   - `dbAllocDmapLev()`
   - `dbAllocDmapBU()`
   - `dbAllocDmap()`
3. **Replaced Partial Checks**: In `dbAllocNext()` and `dbAllocNear()`, I replaced the existing partial checks (`if (dp->tree.leafidx != cpu_to_le32(LEAFIND))`) with the comprehensive `check_dmaptree()` call.
4. **Error Handling**: If the validation fails, the functions log a generic filesystem error using `jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");` and immediately return `-EIO`.

### Why this is the best approach:
- **Fail-Fast Mechanism**: By placing the validation checks at the very beginning of the entry-point functions, we ensure that corrupted metadata is caught before any calculations or array indexing occur. This prevents out-of-bounds memory accesses (like the one in `dbJoin()`) and avoids propagating corrupted state into the buddy system.
- **Comprehensive Validation**: The previous partial checks only verified `leafidx`, leaving other fields like `nleafs` and the actual leaf values unchecked. `check_dmaptree()` provides a robust defense against various forms of disk corruption.
- **Consistency**: This approach mirrors the existing pattern established by `check_dmapctl()` for `dmapctl` structures, maintaining consistency in how JFS handles on-disk metadata validation.
- **Locking Safety**: The checks are performed synchronously within the existing locking context (e.g., `IREAD_LOCK` or `IWRITE_LOCK` on `ipbmap`), requiring no new locks and ensuring thread-safe validation.

Here are summaries of recent commits that touched the same files.
Format the summary line consistently with these, look how prefixes
are specified, letter capitalization, style, etc. 

jfs: add dmapctl integrity check to prevent invalid operations
Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
jfs: fix metapage reference count leak in dbAllocCtl
jfs: upper bound check of tree index in dbAllocAG
jfs: validate AG parameters in dbMount() to prevent crashes
fs/jfs: consolidate sanity checking in dbMount
jfs: add sanity check for agwidth in dbMount
fs/jfs: Prevent integer overflow in AG size calculation
fs/jfs: cast inactags to s64 to prevent potential overflow
jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree
jfs: fix shift-out-of-bounds in dbSplit
jfs: Fix sanity check in dbMount
jfs: check if leafidx greater than num leaves per dmap tree
jfs: fix out-of-bounds in dbNextAG() and diAlloc()
jfs: UBSAN: shift-out-of-bounds in dbFindBits
jfs: Fix shift-out-of-bounds in dbDiscardAG
Revert "jfs: fix shift-out-of-bounds in dbJoin"
jfs: fix shift-out-of-bounds in dbJoin
jfs: fix array-index-out-of-bounds in dbAdjTree


Reply:
jfs: add dmaptree integrity check to prevent array-index-out-of-bounds

An array-index-out-of-bounds issue occurs in dbJoin() when the JFS
filesystem attempts to free blocks using a corrupted dmap structure read
from disk.

The JFS filesystem uses a binary buddy system to manage free space. The
state of the buddy system is stored in dmap (for leaf levels) and dmapctl
(for upper levels) structures on disk. When a dmap is read from disk, its
dmaptree structure is not fully validated. Specifically, the leafidx field
(which indicates the index of the first leaf in the stree array) is read
directly from disk and used to compute pointers to the leaf nodes.

If leafidx is corrupted (e.g., set to 0xffffffff), the computed pointer
will point out of bounds of the stree array. When dbFreeDmap() is called to
free blocks, it calls dbFreeBits(), which in turn calls dbJoin() to update
the buddy system. dbJoin() uses the corrupted leafidx to access the leaf
nodes, resulting in an out-of-bounds memory access.

While a similar integrity check (check_dmapctl()) was recently added for
dmapctl structures, the dmap structures (dmaptree) were left unchecked.

Introduce a check_dmaptree() function, similar to the existing
check_dmapctl() function, to validate the integrity of the dmaptree
structure when it is used. The function verifies that fields like nleafs,
l2nleafs, leafidx, height, and budmin are within their expected bounds and
internally consistent. It also ensures that the leaf nodes fit within the
stree array and have valid values.

Call check_dmaptree() at the entry points of functions that operate on the
dmap structure (dbFreeDmap(), dbAllocNext(), dbAllocNear(),
dbAllocDmapLev(), dbAllocDmapBU(), and dbAllocDmap()). If the validation
fails, log an error and return -EIO to prevent further processing of the
corrupted dmap. This also replaces the existing partial checks for leafidx
in dbAllocNext() and dbAllocNear().

UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2867:24
index 4294967295 is out of range for type 's8[1365]' (aka 'signed
char[1365]')
CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150
 ubsan_epilogue+0xa/0x30
 __ubsan_handle_out_of_bounds+0xe8/0xf0
 dbJoin+0xcc4/0xd60
 dbFreeBits+0x4a2/0xd70
 dbFreeDmap
 dbFree+0x324/0x650
 txFreeMap+0x9e6/0xde0
 xtTruncate+0xd16/0x2eb0
 jfs_free_zero_link+0x35b/0x4c0
 jfs_evict_inode+0x356/0x430
 evict+0x624/0xb50
 txLazyCommit
 jfs_lazycommit+0x44c/0xac0
 kthread+0x388/0x470
 ret_from_fork+0x514/0xb70
 ret_from_fork_asm+0x1a/0x30
 </TASK>

229/2 2026/06/30 15:22 llm description-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 9220
							output: 878
							thoughts: 4735
						

Thoughts:
**jfs: add dmaptree integrity check to prevent array-index-out-of-bounds**

Okay, so I've been tracking down this nasty array-index-out-of-bounds bug in JFS. It's happening in `dbJoin`, specifically when trying to free blocks, and it's because the `dmaptree` structure isn't being fully validated when read from disk. The JFS filesystem uses a buddy system, right? And the free space information is stored in `dmap` (leaf levels) and `dmapctl` (upper levels). Now, the critical thing here is `leafidx` within the `dmaptree`. This field, read directly from disk, is used to calculate pointers into the `stree` array. If this `leafidx` is corrupted, let's say set to `-1` or something garbage, the resulting pointer will be completely out of bounds. The issue manifests when `dbFreeDmap` is called (during block freeing), which leads to `dbFreeBits` then to `dbJoin`, and finally a crash with the corrupted index. We added `check_dmapctl()` recently, but the `dmaptree` structures were being skipped.

The fix is to introduce `check_dmaptree`, mirroring the functionality of `check_dmapctl`, to validate the `dmaptree`. This function now carefully checks `nleafs`, `l2nleafs`, `leafidx`, `height`, `budmin`, and the actual leaf values themselves to ensure they're consistent and within expected boundaries. We'll be calling `check_dmaptree` at the beginning of all the functions that use the `dmap` structure like `dbFreeDmap`, `dbAllocNext`, `dbAllocNear`, `dbAllocDmapLev`, `dbAllocDmapBU`, and `dbAllocDmap`. If the validation fails, a helpful error is logged, and the function returns `-EIO` to prevent further operations on the corrupt data, which is better than a kernel crash. This also replaces the partial `leafidx` checks that were present in `dbAllocNext` and `dbAllocNear`.

UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2867:24
index 4294967295 is out of range for type 's8[1365]' (aka 'signed char[1365]')
CPU: 0 UID: 0 PID: 123 Comm: jfsCommit Not tainted
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150
 ubsan_epilogue+0xa/0x30
 __ubsan_handle_out_of_bounds+0xe8/0xf0
 dbJoin+0xcc4/0xd60
 dbFreeBits+0x4a2/0xd70
 dbFreeDmap
 dbFree+0x324/0x650
 txFreeMap+0x9e6/0xde0
 xtTruncate+0xd16/0x2eb0
 jfs_free_zero_link+0x35b/0x4c0
 jfs_evict_inode+0x356/0x430
 evict+0x624/0xb50
 txLazyCommit
 jfs_lazycommit+0x44c/0xac0
 kthread+0x388/0x470
 ret_from_fork+0x514/0xb70
 ret_from_fork_asm+0x1a/0x30
 </TASK>



LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)