├── .editorconfig ├── README.md ├── benchmarks ├── fxmark │ ├── .gitignore │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── bin │ │ ├── cpu-sequences │ │ ├── cpubars │ │ ├── cpuinfo.py │ │ ├── dbench-workloads │ │ │ ├── client.txt │ │ │ ├── iscsi.txt │ │ │ ├── iscsi │ │ │ │ ├── prout_register_twice.txt │ │ │ │ ├── prout_release_parallel_1.txt │ │ │ │ ├── prout_release_parallel_2.txt │ │ │ │ ├── prout_release_twice.txt │ │ │ │ ├── prout_reserve_parallel_1.txt │ │ │ │ ├── prout_reserve_parallel_2.txt │ │ │ │ ├── prout_reserve_repeat.txt │ │ │ │ ├── prout_reserve_twice.txt │ │ │ │ ├── register_twice.txt │ │ │ │ ├── release_parallel.sh │ │ │ │ ├── release_parallel_1.txt │ │ │ │ ├── release_parallel_2.txt │ │ │ │ ├── release_twice.txt │ │ │ │ ├── repeat.txt │ │ │ │ ├── reserve_parallel.sh │ │ │ │ ├── reserve_parallel_1.txt │ │ │ │ ├── reserve_parallel_2.txt │ │ │ │ └── reserve_twice.txt │ │ │ ├── nfs.txt │ │ │ ├── nfs_2.txt │ │ │ ├── nfs_3.load │ │ │ ├── scsi.txt │ │ │ ├── smb.txt │ │ │ ├── smb_1.txt │ │ │ ├── smb_2.txt │ │ │ └── smb_3.txt │ │ ├── drop-caches │ │ ├── filebench-workloads │ │ │ ├── compflow_demo.f │ │ │ ├── copyfiles.f │ │ │ ├── createfiles.f │ │ │ ├── filemicro_create.f │ │ │ ├── filemicro_createfiles.f │ │ │ ├── filemicro_createrand.f │ │ │ ├── filemicro_delete.f │ │ │ ├── filemicro_rread.f │ │ │ ├── filemicro_rwrite.f │ │ │ ├── filemicro_rwritedsync.f │ │ │ ├── filemicro_rwritefsync.f │ │ │ ├── filemicro_seqread.f │ │ │ ├── filemicro_seqwrite.f │ │ │ ├── filemicro_seqwriterand.f │ │ │ ├── filemicro_seqwriterandvargam.f │ │ │ ├── filemicro_seqwriterandvartab.f │ │ │ ├── filemicro_statfile.f │ │ │ ├── filemicro_writefsync.f │ │ │ ├── fileserver.f │ │ │ ├── fivestreamread.f │ │ │ ├── fivestreamreaddirect.f │ │ │ ├── fivestreamwrite.f │ │ │ ├── fivestreamwritedirect.f │ │ │ ├── listdirs.f │ │ │ ├── makedirs.f │ │ │ ├── mongo.f │ │ │ ├── netsfs.f │ │ │ ├── networkfs.f │ │ │ ├── oltp.f │ │ │ ├── openfiles.f │ │ │ ├── randomfileaccess.f │ │ │ ├── randomread.f │ │ │ ├── randomrw.f │ │ │ ├── randomwrite.f │ │ │ ├── ratelimcopyfiles.f │ │ │ ├── removedirs.f │ │ │ ├── singlestreamread.f │ │ │ ├── singlestreamreaddirect.f │ │ │ ├── singlestreamwrite.f │ │ │ ├── singlestreamwritedirect.f │ │ │ ├── tpcso.f │ │ │ ├── varmail.f │ │ │ ├── videoserver.f │ │ │ ├── webproxy.f │ │ │ └── webserver.f │ │ ├── fs_locking_table.py │ │ ├── gen_corepolicy │ │ ├── grubonce │ │ ├── install-fs-tools.sh │ │ ├── kibt.py │ │ ├── list-cpus │ │ ├── parser.py │ │ ├── perfmon.py │ │ ├── perfstdio.py │ │ ├── plotter.py │ │ ├── run-dbench.py │ │ ├── run-filebench.py │ │ ├── run-fxmark.py │ │ ├── set-cpus │ │ └── turnoff-aslr │ ├── scripts │ │ ├── create_external_log_xfs.sh │ │ └── create_journal_ext4.sh │ └── src │ │ ├── DRBH.c │ │ ├── DRBH_bg.c │ │ ├── DRBL.c │ │ ├── DRBL_bg.c │ │ ├── DRBM.c │ │ ├── DRBM_bg.c │ │ ├── DWAL.c │ │ ├── DWOL.c │ │ ├── DWOM.c │ │ ├── DWSL.c │ │ ├── DWTL.c │ │ ├── MRDL.c │ │ ├── MRDL_bg.c │ │ ├── MRDM.c │ │ ├── MRDM_bg.c │ │ ├── MRPH.c │ │ ├── MRPL.c │ │ ├── MRPM.c │ │ ├── MRPM_bg.c │ │ ├── MWCL.c │ │ ├── MWCM.c │ │ ├── MWRL.c │ │ ├── MWRM.c │ │ ├── MWUL.c │ │ ├── MWUM.c │ │ ├── bench.c │ │ ├── bench.h │ │ ├── fxmark.c │ │ ├── fxmark.h │ │ ├── rdtsc.c │ │ ├── rdtsc.h │ │ ├── util.c │ │ └── util.h ├── leveldb │ ├── bin │ │ └── drop-caches │ ├── leveldb-1.20 │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── AUTHORS │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── NEWS │ │ ├── README.md │ │ ├── TODO │ │ ├── build_detect_platform │ │ ├── db │ │ │ ├── autocompact_test.cc │ │ │ ├── builder.cc │ │ │ ├── builder.h │ │ │ ├── c.cc │ │ │ ├── c_test.c │ │ │ ├── corruption_test.cc │ │ │ ├── db_bench.cc │ │ │ ├── db_impl.cc │ │ │ ├── db_impl.h │ │ │ ├── db_iter.cc │ │ │ ├── db_iter.h │ │ │ ├── db_test.cc │ │ │ ├── dbformat.cc │ │ │ ├── dbformat.h │ │ │ ├── dbformat_test.cc │ │ │ ├── dumpfile.cc │ │ │ ├── fault_injection_test.cc │ │ │ ├── filename.cc │ │ │ ├── filename.h │ │ │ ├── filename_test.cc │ │ │ ├── leveldbutil.cc │ │ │ ├── log_format.h │ │ │ ├── log_reader.cc │ │ │ ├── log_reader.h │ │ │ ├── log_test.cc │ │ │ ├── log_writer.cc │ │ │ ├── log_writer.h │ │ │ ├── memtable.cc │ │ │ ├── memtable.h │ │ │ ├── recovery_test.cc │ │ │ ├── repair.cc │ │ │ ├── skiplist.h │ │ │ ├── skiplist_test.cc │ │ │ ├── snapshot.h │ │ │ ├── table_cache.cc │ │ │ ├── table_cache.h │ │ │ ├── version_edit.cc │ │ │ ├── version_edit.h │ │ │ ├── version_edit_test.cc │ │ │ ├── version_set.cc │ │ │ ├── version_set.h │ │ │ ├── version_set_test.cc │ │ │ ├── write_batch.cc │ │ │ ├── write_batch_internal.h │ │ │ └── write_batch_test.cc │ │ ├── doc │ │ │ ├── bench │ │ │ │ ├── db_bench_sqlite3.cc │ │ │ │ └── db_bench_tree_db.cc │ │ │ ├── benchmark.html │ │ │ ├── impl.md │ │ │ ├── index.md │ │ │ ├── log_format.md │ │ │ └── table_format.md │ │ ├── helpers │ │ │ └── memenv │ │ │ │ ├── memenv.cc │ │ │ │ ├── memenv.h │ │ │ │ └── memenv_test.cc │ │ ├── include │ │ │ └── leveldb │ │ │ │ ├── c.h │ │ │ │ ├── cache.h │ │ │ │ ├── comparator.h │ │ │ │ ├── db.h │ │ │ │ ├── dumpfile.h │ │ │ │ ├── env.h │ │ │ │ ├── filter_policy.h │ │ │ │ ├── iterator.h │ │ │ │ ├── options.h │ │ │ │ ├── slice.h │ │ │ │ ├── status.h │ │ │ │ ├── table.h │ │ │ │ ├── table_builder.h │ │ │ │ └── write_batch.h │ │ ├── issues │ │ │ ├── issue178_test.cc │ │ │ └── issue200_test.cc │ │ ├── port │ │ │ ├── README │ │ │ ├── atomic_pointer.h │ │ │ ├── port.h │ │ │ ├── port_example.h │ │ │ ├── port_posix.cc │ │ │ ├── port_posix.h │ │ │ ├── port_posix_sse.cc │ │ │ ├── thread_annotations.h │ │ │ └── win │ │ │ │ └── stdint.h │ │ ├── table │ │ │ ├── block.cc │ │ │ ├── block.h │ │ │ ├── block_builder.cc │ │ │ ├── block_builder.h │ │ │ ├── filter_block.cc │ │ │ ├── filter_block.h │ │ │ ├── filter_block_test.cc │ │ │ ├── format.cc │ │ │ ├── format.h │ │ │ ├── iterator.cc │ │ │ ├── iterator_wrapper.h │ │ │ ├── merger.cc │ │ │ ├── merger.h │ │ │ ├── table.cc │ │ │ ├── table_builder.cc │ │ │ ├── table_test.cc │ │ │ ├── two_level_iterator.cc │ │ │ └── two_level_iterator.h │ │ └── util │ │ │ ├── arena.cc │ │ │ ├── arena.h │ │ │ ├── arena_test.cc │ │ │ ├── bloom.cc │ │ │ ├── bloom_test.cc │ │ │ ├── cache.cc │ │ │ ├── cache_test.cc │ │ │ ├── coding.cc │ │ │ ├── coding.h │ │ │ ├── coding_test.cc │ │ │ ├── comparator.cc │ │ │ ├── crc32c.cc │ │ │ ├── crc32c.h │ │ │ ├── crc32c_test.cc │ │ │ ├── env.cc │ │ │ ├── env_posix.cc │ │ │ ├── env_posix_test.cc │ │ │ ├── env_posix_test_helper.h │ │ │ ├── env_test.cc │ │ │ ├── filter_policy.cc │ │ │ ├── hash.cc │ │ │ ├── hash.h │ │ │ ├── hash_test.cc │ │ │ ├── histogram.cc │ │ │ ├── histogram.h │ │ │ ├── logging.cc │ │ │ ├── logging.h │ │ │ ├── mutexlock.h │ │ │ ├── options.cc │ │ │ ├── posix_logger.h │ │ │ ├── random.h │ │ │ ├── status.cc │ │ │ ├── testharness.cc │ │ │ ├── testharness.h │ │ │ ├── testutil.cc │ │ │ └── testutil.h │ ├── plot.py │ └── run_db_bench.sh ├── lockstat │ └── get-lockstat │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── README.md │ │ ├── bpf.c │ │ ├── bpf.h │ │ ├── bpf_load.c │ │ ├── bpf_load.h │ │ ├── get_bpflockstat.c │ │ ├── include │ │ ├── bpf_helpers.h │ │ ├── concord.h │ │ └── linux │ │ │ └── types.h │ │ ├── libbpf.h │ │ ├── libbpf_internal.h │ │ └── perf-sys.h ├── metis │ ├── .gitignore │ ├── GNUmakefile │ ├── README │ ├── __init__.py │ ├── __init__.pyc │ ├── app │ │ ├── hist.c │ │ ├── kmeans.c │ │ ├── linear_regression.c │ │ ├── matrix_mult.c │ │ ├── pca.c │ │ ├── string_match.c │ │ ├── wc.c │ │ ├── wr.c │ │ └── wrmem.c │ ├── format.pl │ ├── lib │ │ ├── Makefrag │ │ ├── appendbktmgr.c │ │ ├── apphelper.c │ │ ├── apphelper.h │ │ ├── arraybktmgr.c │ │ ├── bench.h │ │ ├── bsearch.c │ │ ├── bsearch.h │ │ ├── btreebktmgr.c │ │ ├── cpumap.c │ │ ├── cpumap.h │ │ ├── defsplitter.c │ │ ├── estimation.c │ │ ├── estimation.h │ │ ├── ibs.c │ │ ├── ibs.h │ │ ├── keyval_array.c │ │ ├── keyvals_array.c │ │ ├── keyvals_btree.c │ │ ├── keyvals_len_array.c │ │ ├── kvstore.c │ │ ├── kvstore.h │ │ ├── mbktsmgr.h │ │ ├── mergesort.c │ │ ├── mergesort.h │ │ ├── mr-conf.h │ │ ├── mr-sched.c │ │ ├── mr-sched.h │ │ ├── mr-types.h │ │ ├── pchandler.h │ │ ├── perf.c │ │ ├── perf.h │ │ ├── platform.c │ │ ├── platform.h │ │ ├── pmcreg.h │ │ ├── presplitter.c │ │ ├── presplitter.h │ │ ├── profile.c │ │ ├── profile.h │ │ ├── psrs.c │ │ ├── psrs.h │ │ ├── pthreadpool.c │ │ ├── rbktsmgr.c │ │ ├── rbktsmgr.h │ │ ├── reduce.c │ │ ├── reduce.h │ │ ├── thread.h │ │ ├── value_helper.c │ │ └── value_helper.h │ ├── libstreamflow.so │ ├── mergedep.pl │ ├── micro │ │ ├── Makefrag │ │ ├── config.c │ │ ├── fault.c │ │ ├── memcpy_local.c │ │ ├── memcpy_scan.c │ │ ├── memmultiread_remote.c │ │ ├── memmultiread_remote2.c │ │ ├── memread.c │ │ ├── memread_dct0.c │ │ ├── memread_remote.c │ │ ├── memread_scan.c │ │ ├── memwrite.c │ │ └── sf_sample.c │ ├── parser.py │ ├── pkg │ │ └── streamflow │ │ │ ├── Makefile │ │ │ ├── Makefrag │ │ │ ├── README │ │ │ ├── include-ia64 │ │ │ ├── atomic.h │ │ │ ├── bitops.h │ │ │ └── queue.h │ │ │ ├── include-ppc64 │ │ │ ├── atomic.h │ │ │ ├── bitops.h │ │ │ └── queue.h │ │ │ ├── include-x86 │ │ │ ├── atomic.h │ │ │ ├── bitops.h │ │ │ └── queue.h │ │ │ ├── include-x86_64 │ │ │ ├── atomic.h │ │ │ ├── bitops.h │ │ │ └── queue.h │ │ │ ├── lock.h │ │ │ ├── malloc_new.cpp │ │ │ ├── override.c │ │ │ ├── streamflow.c │ │ │ ├── streamflow.h │ │ │ ├── ummap.c │ │ │ └── ummap.h │ ├── test │ │ ├── comsubs.pl │ │ └── test.pl │ └── tools │ │ ├── double_bmp.pl │ │ ├── gen.c │ │ ├── merge.c │ │ ├── mergedir.c │ │ ├── mount.sh │ │ └── umount.sh ├── will-it-scale │ ├── .gitignore │ ├── .travis.yml │ ├── Makefile │ ├── README.md │ ├── main.c │ ├── plot.js │ ├── postprocess.py │ ├── runscript.sh │ ├── runtest.py │ └── tests │ │ ├── brk1.c │ │ ├── context_switch1.c │ │ ├── dup1.c │ │ ├── eventfd1.c │ │ ├── fallocate1.c │ │ ├── fallocate2.c │ │ ├── futex1.c │ │ ├── futex2.c │ │ ├── futex3.c │ │ ├── futex4.c │ │ ├── getppid1.c │ │ ├── lock1.c │ │ ├── lock2.c │ │ ├── lseek1.c │ │ ├── lseek2.c │ │ ├── malloc1.c │ │ ├── malloc2.c │ │ ├── mmap1.c │ │ ├── mmap2.c │ │ ├── open1.c │ │ ├── open2.c │ │ ├── open3.c │ │ ├── page_fault1.c │ │ ├── page_fault2.c │ │ ├── page_fault3.c │ │ ├── pipe1.c │ │ ├── poll1.c │ │ ├── poll2.c │ │ ├── posix_semaphore1.c │ │ ├── pread1.c │ │ ├── pread2.c │ │ ├── pread3.c │ │ ├── pthread_mutex1.c │ │ ├── pthread_mutex2.c │ │ ├── pthread_mutex3.c │ │ ├── pthread_mutex4.c │ │ ├── pwrite1.c │ │ ├── pwrite2.c │ │ ├── pwrite3.c │ │ ├── read1.c │ │ ├── read2.c │ │ ├── read3.c │ │ ├── read4.c │ │ ├── readseek1.c │ │ ├── readseek2.c │ │ ├── readseek3.c │ │ ├── sched_yield.c │ │ ├── signal1.c │ │ ├── tlb_flush1.c │ │ ├── tlb_flush2.c │ │ ├── tlb_flush3.c │ │ ├── unix1.c │ │ ├── unlink1.c │ │ ├── unlink2.c │ │ ├── write1.c │ │ ├── writeseek1.c │ │ ├── writeseek2.c │ │ └── writeseek3.c └── xDir-rename │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── benchmark.c │ ├── plot.py │ └── run_bench.py ├── scripts ├── .gitignore ├── change-cpu-freq.sh ├── config-cna ├── config-syncord ├── get-pip.py ├── pin-vcpu.py ├── qmp.py ├── run-vm.sh └── uninstall_policy.sh └── src ├── concord ├── .gitignore ├── __init__.py ├── bpf │ ├── Makefile │ ├── bpf.c │ ├── bpf.h │ ├── bpf_load.c │ ├── bpf_load.h │ ├── include │ │ ├── bpf_helpers.h │ │ └── linux │ │ │ └── types.h │ ├── libbpf.h │ ├── libbpf_internal.h │ ├── perf-sys.h │ ├── skeleton_kern.c │ └── skeleton_user.c ├── bpfgen.py ├── concord.py ├── config.py ├── instance.py ├── list_APIs.h ├── livepatch.py ├── patch │ ├── pre_patch_callback.patch │ ├── rwsem_custom_cmp_func.patch │ └── single_lock.patch ├── patches │ ├── amp-mwrl.patch │ ├── amp.patch │ ├── bravo.patch │ ├── lockstat.patch │ ├── numa-grouping-cna.patch │ ├── numa-grouping.patch │ ├── numa-scl.patch │ └── scl.patch ├── policy │ ├── amp │ │ ├── amp.h │ │ └── amp_cont_lock.pfile │ ├── bravo │ │ ├── bravo.h │ │ ├── bravo_acqed_lock.pfile │ │ ├── bravo_bypass_acq_lock.pfile │ │ └── bravo_bypass_release_lock.pfile │ ├── lock_policy.h │ ├── lockstat │ │ ├── lockstat.h │ │ ├── lockstat.map │ │ ├── lockstat_lock_acquired.pfile │ │ ├── lockstat_lock_to_release.pfile │ │ └── lockstat_to_enter_slow_path.pfile │ ├── numa-grouping-cna │ │ ├── numa-grouping-cna.h │ │ └── numa-grouping-cna.pfile │ ├── numa-grouping │ │ ├── numa-grouping.h │ │ └── numa-grouping.pfile │ ├── numa-scl │ │ ├── scl.h │ │ ├── scl_acqed_lock.pfile │ │ ├── scl_cmp.pfile │ │ ├── scl_cont_lock.pfile │ │ └── scl_release_lock.pfile │ └── scl │ │ ├── scl.h │ │ ├── scl_acqed_lock.pfile │ │ ├── scl_cmp.pfile │ │ ├── scl_cont_lock.pfile │ │ └── scl_release_lock.pfile ├── requirements.txt └── util.py └── kpatch ├── .gitignore ├── .gitmodules ├── .travis.yml ├── COPYING ├── Makefile ├── Makefile.inc ├── README.md ├── contrib ├── Makefile ├── kpatch.conf ├── kpatch.service └── kpatch.spec ├── doc └── patch-author-guide.md ├── examples ├── tcp_cubic-better-follow-cubic-curve-converted.patch └── tcp_cubic-better-follow-cubic-curve-original.patch ├── kmod ├── Makefile ├── core │ ├── Makefile │ ├── core.c │ ├── kpatch.h │ └── shadow.c └── patch │ ├── Makefile │ ├── kpatch-macros.h │ ├── kpatch-patch-hook.c │ ├── kpatch-patch.h │ ├── kpatch.h │ ├── kpatch.lds │ ├── kpatch.lds.S │ ├── livepatch-patch-hook.c │ ├── modules.order │ └── patch-hook.c ├── kpatch-build ├── Makefile ├── create-diff-object.c ├── create-klp-module.c ├── create-kpatch-module.c ├── gcc-plugins │ ├── gcc-common.h │ ├── gcc-generate-rtl-pass.h │ └── ppc64le-plugin.c ├── insn │ ├── asm │ │ ├── inat.h │ │ ├── inat_types.h │ │ └── insn.h │ ├── inat-tables.c │ ├── inat.c │ └── insn.c ├── kpatch-build ├── kpatch-elf.c ├── kpatch-elf.h ├── kpatch-gcc ├── kpatch-intermediate.h ├── kpatch.h ├── list.h ├── log.h ├── lookup.c └── lookup.h ├── kpatch ├── Makefile └── kpatch ├── man ├── Makefile ├── kpatch-build.1 └── kpatch.1 └── test ├── difftree.sh ├── integration ├── .gitignore ├── Makefile ├── centos-7 ├── common │ └── multiple.template ├── fedora-27 │ ├── README │ ├── data-new-LOADED.test │ ├── data-new.patch │ ├── gcc-static-local-var-6.patch │ ├── macro-callbacks.patch │ ├── meminfo-cmdline-rebuild-SLOW-LOADED.test.disabled │ ├── meminfo-cmdline-rebuild-SLOW.patch.disabled │ ├── module-call-external.patch │ ├── module-shadow.patch.disabled │ ├── multiple.test │ ├── new-function.patch │ ├── new-globals.patch │ ├── remote-setup │ ├── shadow-newpid-LOADED.test │ ├── shadow-newpid.patch.disabled │ └── warn-detect-FAIL.patch ├── kpatch-test ├── lib.sh ├── rebase-patches ├── rhel-7.4 │ ├── bug-table-section.patch │ ├── cmdline-string-LOADED.test │ ├── cmdline-string.patch │ ├── data-new-LOADED.test │ ├── data-new.patch │ ├── data-read-mostly.patch.disabled │ ├── fixup-section.patch │ ├── gcc-constprop.patch │ ├── gcc-isra.patch │ ├── gcc-mangled-3.patch │ ├── gcc-static-local-var-2.patch │ ├── gcc-static-local-var-3.patch │ ├── gcc-static-local-var-4.patch │ ├── gcc-static-local-var-4.test │ ├── gcc-static-local-var-5.patch │ ├── gcc-static-local-var-6.patch │ ├── gcc-static-local-var.patch │ ├── macro-callbacks.patch │ ├── macro-printk.patch │ ├── meminfo-init-FAIL.patch │ ├── meminfo-init2-FAIL.patch │ ├── meminfo-string-LOADED.test │ ├── meminfo-string.patch │ ├── module-call-external.patch │ ├── module-kvm-fixup.patch │ ├── module-shadow.patch │ ├── multiple.test │ ├── new-function.patch │ ├── new-globals.patch │ ├── parainstructions-section.patch │ ├── replace-section-references.patch │ ├── shadow-newpid-LOADED.test │ ├── shadow-newpid.patch │ ├── smp-locks-section.patch │ ├── special-static-2.patch │ ├── special-static.patch │ ├── tracepoints-section.patch │ └── warn-detect-FAIL.patch ├── rhel-7.5 │ ├── bug-table-section.patch │ ├── cmdline-string-LOADED.test │ ├── cmdline-string.patch │ ├── data-new-LOADED.test │ ├── data-new.patch │ ├── data-read-mostly.patch.disabled │ ├── fixup-section.patch │ ├── gcc-constprop.patch │ ├── gcc-isra.patch │ ├── gcc-mangled-3.patch │ ├── gcc-static-local-var-2.patch │ ├── gcc-static-local-var-3.patch │ ├── gcc-static-local-var-4.patch │ ├── gcc-static-local-var-4.test │ ├── gcc-static-local-var-5.patch │ ├── gcc-static-local-var-6.patch │ ├── gcc-static-local-var.patch │ ├── macro-callbacks.patch │ ├── macro-printk.patch │ ├── meminfo-init-FAIL.patch │ ├── meminfo-init2-FAIL.patch │ ├── meminfo-string-LOADED.test │ ├── meminfo-string.patch │ ├── module-call-external.patch │ ├── module-kvm-fixup.patch │ ├── module-shadow.patch.disabled │ ├── multiple.test │ ├── new-function.patch │ ├── new-globals.patch │ ├── parainstructions-section.patch │ ├── replace-section-references.patch │ ├── shadow-newpid-LOADED.test │ ├── shadow-newpid.patch │ ├── smp-locks-section.patch │ ├── special-static-2.patch │ ├── special-static.patch │ ├── tracepoints-section.patch │ └── warn-detect-FAIL.patch ├── rhel-7.6 │ ├── bug-table-section.patch │ ├── cmdline-string-LOADED.test │ ├── cmdline-string.patch │ ├── data-new-LOADED.test │ ├── data-new.patch │ ├── data-read-mostly.patch.disabled │ ├── fixup-section.patch │ ├── gcc-constprop.patch.disabled │ ├── gcc-isra.patch │ ├── gcc-mangled-3.patch │ ├── gcc-static-local-var-2.patch │ ├── gcc-static-local-var-3.patch │ ├── gcc-static-local-var-4.patch │ ├── gcc-static-local-var-4.test │ ├── gcc-static-local-var-5.patch │ ├── gcc-static-local-var-6.patch │ ├── macro-callbacks.patch │ ├── macro-printk.patch │ ├── meminfo-init-FAIL.patch │ ├── meminfo-init2-FAIL.patch │ ├── meminfo-string-LOADED.test │ ├── meminfo-string.patch │ ├── module-call-external.patch │ ├── multiple.test │ ├── new-function.patch │ ├── new-globals.patch │ ├── parainstructions-section.patch │ ├── shadow-newpid-LOADED.test │ ├── shadow-newpid.patch │ ├── smp-locks-section.patch │ ├── special-static.patch │ ├── tracepoints-section.patch │ └── warn-detect-FAIL.patch ├── rhel-7.7 │ ├── bug-table-section.patch │ ├── cmdline-string-LOADED.test │ ├── cmdline-string.patch │ ├── data-new-LOADED.test │ ├── data-new.patch │ ├── data-read-mostly.patch.disabled │ ├── fixup-section.patch │ ├── gcc-constprop.patch.disabled │ ├── gcc-isra.patch │ ├── gcc-mangled-3.patch │ ├── gcc-static-local-var-2.patch │ ├── gcc-static-local-var-3.patch │ ├── gcc-static-local-var-4.patch │ ├── gcc-static-local-var-4.test │ ├── gcc-static-local-var-5.patch │ ├── gcc-static-local-var-6.patch │ ├── macro-callbacks.patch │ ├── macro-printk.patch │ ├── meminfo-init-FAIL.patch │ ├── meminfo-init2-FAIL.patch │ ├── meminfo-string-LOADED.test │ ├── meminfo-string.patch │ ├── module-call-external.patch │ ├── multiple.test │ ├── new-function.patch │ ├── new-globals.patch │ ├── parainstructions-section.patch │ ├── shadow-newpid-LOADED.test │ ├── shadow-newpid.patch │ ├── smp-locks-section.patch │ ├── special-static.patch │ ├── tracepoints-section.patch │ └── warn-detect-FAIL.patch ├── rhel-7.8 │ ├── bug-table-section.patch │ ├── cmdline-string-LOADED.test │ ├── cmdline-string.patch │ ├── data-new-LOADED.test │ ├── data-new.patch │ ├── data-read-mostly.patch.disabled │ ├── fixup-section.patch │ ├── gcc-constprop.patch.disabled │ ├── gcc-isra.patch │ ├── gcc-mangled-3.patch │ ├── gcc-static-local-var-2.patch │ ├── gcc-static-local-var-3.patch │ ├── gcc-static-local-var-4.patch │ ├── gcc-static-local-var-4.test │ ├── gcc-static-local-var-5.patch │ ├── gcc-static-local-var-6.patch │ ├── macro-callbacks.patch │ ├── macro-printk.patch │ ├── meminfo-init-FAIL.patch │ ├── meminfo-init2-FAIL.patch │ ├── meminfo-string-LOADED.test │ ├── meminfo-string.patch │ ├── module-call-external.patch │ ├── multiple.test │ ├── new-function.patch │ ├── new-globals.patch │ ├── parainstructions-section.patch │ ├── shadow-newpid-LOADED.test │ ├── shadow-newpid.patch │ ├── smp-locks-section.patch │ ├── special-static.patch │ ├── tracepoints-section.patch │ └── warn-detect-FAIL.patch ├── rhel-8.0 │ ├── README │ ├── bug-table-section.patch │ ├── cmdline-string-LOADED.test │ ├── cmdline-string.patch │ ├── data-new-LOADED.test │ ├── data-new.patch │ ├── data-read-mostly.patch.disabled │ ├── fixup-section.patch │ ├── gcc-constprop.patch.disabled │ ├── gcc-isra.patch │ ├── gcc-mangled-3.patch │ ├── gcc-static-local-var-2.patch │ ├── gcc-static-local-var-3.patch │ ├── gcc-static-local-var-4.patch.disabled │ ├── gcc-static-local-var-4.test │ ├── gcc-static-local-var-5.patch │ ├── gcc-static-local-var-6.patch │ ├── macro-callbacks.patch │ ├── macro-printk.patch.disabled │ ├── meminfo-init-FAIL.patch │ ├── meminfo-init2-FAIL.patch │ ├── meminfo-string-LOADED.test │ ├── meminfo-string.patch │ ├── module-call-external.patch │ ├── multiple.test │ ├── new-function.patch │ ├── new-globals.patch │ ├── parainstructions-section.patch │ ├── shadow-newpid-LOADED.test │ ├── shadow-newpid.patch.disabled │ ├── smp-locks-section.patch │ ├── special-static.patch │ ├── tracepoints-section.patch │ └── warn-detect-FAIL.patch ├── rhel-8.1 │ ├── bug-table-section.patch │ ├── cmdline-string-LOADED.test │ ├── cmdline-string.patch │ ├── data-new-LOADED.test │ ├── data-new.patch │ ├── data-read-mostly.patch.disabled │ ├── fixup-section.patch │ ├── gcc-constprop.patch.disabled │ ├── gcc-isra.patch │ ├── gcc-mangled-3.patch │ ├── gcc-static-local-var-2.patch │ ├── gcc-static-local-var-3.patch │ ├── gcc-static-local-var-4.patch.disabled │ ├── gcc-static-local-var-4.test.disabled │ ├── gcc-static-local-var-5.patch │ ├── gcc-static-local-var-6.patch │ ├── macro-callbacks.patch │ ├── macro-printk.patch.disabled │ ├── meminfo-init-FAIL.patch │ ├── meminfo-init2-FAIL.patch │ ├── meminfo-string-LOADED.test │ ├── meminfo-string.patch │ ├── module-LOADED.test │ ├── module.patch │ ├── multiple.test │ ├── new-function.patch │ ├── new-globals.patch │ ├── parainstructions-section.patch │ ├── shadow-newpid-LOADED.test.disabled │ ├── shadow-newpid.patch.disabled │ ├── smp-locks-section.patch │ ├── special-static.patch.disabled │ ├── tracepoints-section.patch │ └── warn-detect-FAIL.patch ├── rhel-8.2 │ ├── bug-table-section.patch │ ├── cmdline-string-LOADED.test │ ├── cmdline-string.patch │ ├── data-new-LOADED.test │ ├── data-new.patch │ ├── data-read-mostly.patch.disabled │ ├── fixup-section.patch │ ├── gcc-constprop.patch │ ├── gcc-isra.patch │ ├── gcc-mangled-3.patch │ ├── gcc-static-local-var-2.patch │ ├── gcc-static-local-var-3.patch │ ├── gcc-static-local-var-4.patch.disabled │ ├── gcc-static-local-var-4.test.disabled │ ├── gcc-static-local-var-5.patch │ ├── gcc-static-local-var-6.patch │ ├── macro-callbacks.patch │ ├── macro-printk.patch │ ├── meminfo-init-FAIL.patch │ ├── meminfo-init2-FAIL.patch │ ├── meminfo-string-LOADED.test │ ├── meminfo-string.patch │ ├── module-LOADED.test │ ├── module.patch │ ├── multiple.test │ ├── new-function.patch │ ├── new-globals.patch │ ├── parainstructions-section.patch │ ├── shadow-newpid-LOADED.test.disabled │ ├── shadow-newpid.patch.disabled │ ├── smp-locks-section.patch │ ├── special-static.patch.disabled │ ├── tracepoints-section.patch │ └── warn-detect-FAIL.patch ├── test-vagrant ├── ubuntu-16.04 │ ├── README │ ├── bug-table-section.patch │ ├── cmdline-string-LOADED.test │ ├── cmdline-string.patch │ ├── data-new-LOADED.test │ ├── data-new.patch │ ├── data-read-mostly.patch │ ├── fixup-section.patch │ ├── gcc-constprop.patch │ ├── gcc-isra.patch │ ├── gcc-mangled-3.patch.disabled │ ├── gcc-static-local-var-2.patch │ ├── gcc-static-local-var-3.patch │ ├── gcc-static-local-var-4.patch │ ├── gcc-static-local-var-4.test │ ├── gcc-static-local-var-5.patch │ ├── gcc-static-local-var-6.patch │ ├── gcc-static-local-var.patch │ ├── macro-callbacks.patch │ ├── macro-printk.patch │ ├── meminfo-cmdline-rebuild-SLOW-LOADED.test.disabled │ ├── meminfo-cmdline-rebuild-SLOW.patch.disabled │ ├── meminfo-init-FAIL.patch │ ├── meminfo-init2-FAIL.patch │ ├── meminfo-string-LOADED.test │ ├── meminfo-string.patch │ ├── module-call-external.patch.disable │ ├── module-kvm-fixup.patch │ ├── multiple.test │ ├── new-function.patch │ ├── new-globals.patch │ ├── parainstructions-section.patch │ ├── replace-section-references.patch │ ├── smp-locks-section.patch │ ├── special-static-2.patch │ ├── special-static.patch │ ├── tracepoints-section.patch │ └── warn-detect-FAIL.patch └── vm-integration-run ├── test-functions.sh └── unit ├── Makefile └── Makefile.include /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | 9 | [*.py] 10 | indent_style = space 11 | indent_size = 4 12 | 13 | [Makefile*] 14 | indent_style = tab 15 | tab_width = 4 16 | 17 | [*.sh] 18 | indent_style = tab 19 | indent_size = 4 20 | 21 | [*.[ch]] 22 | indent_style = tab 23 | indent_size = 4 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Application-Informed Kernel Synchronization Primitives 2 | 3 | SynCord is a framework to modify kernel locks without recompiling or rebooting 4 | the kernel. It abstracts key behaviors of kernel locks and exposes them as APIs 5 | for designing user-defined kernel locks. SynCord provides the mechanisms to 6 | customize kernel locks safely and correctly from userspace. 7 | 8 | For more details, see the [webpage](https://rs3lab.github.io/SynCord/). 9 | -------------------------------------------------------------------------------- /benchmarks/fxmark/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *# 3 | __pycache__ 4 | *.pyc 5 | perf.data 6 | src/cpuinfo* 7 | src/cpupol.h 8 | src/tags 9 | src/cscope.* 10 | bin/cpupol.py 11 | bin/*.o 12 | bin/fxmark 13 | bin/root 14 | bin/.tmp 15 | logs/ 16 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/cpubars: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rs3lab/SynCord/a2641f3cc403514c16b24e29035736f538952e99/benchmarks/fxmark/bin/cpubars -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/prout_register_twice.txt: -------------------------------------------------------------------------------- 1 | # Register a key, then reserve using type = 0x01 (Write exlusive). 2 | # Then try to reserve using type = 0x03 (Access exlusive), without 3 | # releasing the target, so it should fail with 0x18 (Reserve Conflict). 4 | 5 | # Register 6 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 7 | # Reserve (type = 1) 8 | 1.000 PROUT 1 1 0xdeadbeef 0 0x00 9 | # Reserve (type = 2) 10 | 1.000 PROUT 1 3 0xdeadbeef 0 0x18 11 | #release 12 | 1.000 PROUT 2 1 0xdeadbeef 0 0x00 13 | # Register again 14 | 0.000 PROUT 0 0 0xdeadbeef 0 0x00 15 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/prout_release_parallel_1.txt: -------------------------------------------------------------------------------- 1 | # Just register a key, reserve a target, wait some seconds 2 | # and then release the target and unregister the key 3 | 4 | #Register 5 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 6 | # Reserve (type = 1) 7 | 0.000 PROUT 1 1 0xdeadbeef 0 0x00 8 | 9 | 10 | ## WAITING..... 11 | 12 | 13 | # Release (type = 1) 14 | 20.000 PROUT 2 1 0xdeadbeef 0 0x00 15 | # Unregister 16 | 20.000 PROUT 0 0 0xdeadbeef 0 0x00 17 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/prout_release_parallel_2.txt: -------------------------------------------------------------------------------- 1 | # Just try to release a reservation not done by this 2 | # instance. So, it should fail 3 | 4 | # Release (type = 1) 5 | 20.000 PROUT 2 1 0xdeadbeef 0 0x02 6 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/prout_release_twice.txt: -------------------------------------------------------------------------------- 1 | # Just register a key, release a target and then release it 2 | # two times, which should be Ok. 3 | 4 | # Register 5 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 6 | # Reserve (type = 1) 7 | 1.000 PROUT 1 1 0xdeadbeef 0 0x00 8 | # Release 9 | 1.000 PROUT 2 1 0xdeadbeef 0 0x00 10 | 1.000 PROUT 2 1 0xdeadbeef 0 0x00 11 | # Unregister 12 | 2.000 PROUT 0 0 0xdeadbeef 0 0x00 13 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/prout_reserve_parallel_1.txt: -------------------------------------------------------------------------------- 1 | # Just register a key, reserve a device and then wait some minutes 2 | # and release the device and unregister the key. 3 | # To be used in parallel with reserve_parallel_2.txt 4 | 5 | #Register 6 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 7 | # Reserve (type = 1) 8 | 0.000 PROUT 1 1 0xdeadbeef 0 0x00 9 | 10 | 11 | ## WAITING..... 12 | 13 | 14 | # Release (type = 1) 15 | 20.000 PROUT 2 1 0xdeadbeef 0 0x00 16 | # Unregister 17 | 20.000 PROUT 0 0 0xdeadbeef 0 0x00 18 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/prout_reserve_parallel_2.txt: -------------------------------------------------------------------------------- 1 | # Just register a key and try to reserve a target 2 | # that was previously reserved by reserve_parallel_1.txt 3 | 4 | # Register 0xfee 5 | 1.000 PROUT 0 0 0 0xfee 0x00 6 | # Reserve (type = 1) 7 | 1.000 PROUT 1 1 0xfee 0 0x18 8 | # Release (type = 1) 9 | 1.000 PROUT 2 1 0xfee 0 0x00 10 | # Unregister 11 | 1.000 PROUT 0 0 0xfee 0 0x00 12 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/prout_reserve_repeat.txt: -------------------------------------------------------------------------------- 1 | # Just register a key and then reserve the target two times with the same 2 | # type = 0x01 (Write exclusive). 3 | 4 | # Register 5 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 6 | # Reserve (type = 1) 7 | 1.000 PROUT 1 1 0xdeadbeef 0 0x00 8 | 1.000 PROUT 1 1 0xdeadbeef 0 0x00 9 | 1.000 PROUT 2 1 0xdeadbeef 0 0x00 10 | 2.000 PROUT 0 0 0xdeadbeef 0 0x00 11 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/prout_reserve_twice.txt: -------------------------------------------------------------------------------- 1 | # Just register a key and then reserve the target with 2 | # type = 0x01 (Write exclusive). Then tries to reserve with type 3 | # = 0x03 (Exclusive access). Since the first reservation was not 4 | # released, then it should fail in the second reservation with 5 | # 0x18 (Reservation Conflict). 6 | 7 | # Register 8 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 9 | # Reserve (type = 1) 10 | 1.000 PROUT 1 1 0xdeadbeef 0 0x00 11 | 1.000 PROUT 1 3 0xdeadbeef 0 0x18 12 | 1.000 PROUT 2 1 0xdeadbeef 0 0x00 13 | 2.000 PROUT 0 0 0xdeadbeef 0 0x00 14 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/register_twice.txt: -------------------------------------------------------------------------------- 1 | # Register 2 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 3 | # Reserve (type = 1) 4 | 1.000 PROUT 1 1 0xdeadbeef 0 0x00 5 | 1.000 PROUT 2 1 0xdeadbeef 0 0x00 6 | # Register again 7 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 8 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/release_parallel_1.txt: -------------------------------------------------------------------------------- 1 | #Register 2 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 3 | # Reserve (type = 1) 4 | 0.000 PROUT 1 1 0xdeadbeef 0 0x00 5 | 6 | 7 | ## WAITING..... 8 | 9 | 10 | # Release (type = 1) 11 | 20.000 PROUT 2 1 0xdeadbeef 0 0x00 12 | # Unregister 13 | 20.000 PROUT 0 0 0xdeadbeef 0 0x00 14 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/release_parallel_2.txt: -------------------------------------------------------------------------------- 1 | # Release (type = 1) 2 | 20.000 PROUT 2 1 0xdeadbeef 0 0x02 3 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/release_twice.txt: -------------------------------------------------------------------------------- 1 | # Register 2 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 3 | # Reserve (type = 1) 4 | 1.000 PROUT 1 1 0xdeadbeef 0 0x00 5 | # Release 6 | 1.000 PROUT 2 1 0xdeadbeef 0 0x00 7 | 1.000 PROUT 2 1 0xdeadbeef 0 0x00 8 | # Unregister 9 | 2.000 PROUT 0 0 0xdeadbeef 0 0x00 10 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/repeat.txt: -------------------------------------------------------------------------------- 1 | # Register 2 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 3 | # Reserve (type = 1) 4 | 1.000 PROUT 1 1 0xdeadbeef 0 0x00 5 | 1.000 PROUT 1 1 0xdeadbeef 0 0x00 6 | 1.000 PROUT 2 1 0xdeadbeef 0 0x00 7 | 2.000 PROUT 0 0 0xdeadbeef 0 0x00 8 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/reserve_parallel_1.txt: -------------------------------------------------------------------------------- 1 | #Register 2 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 3 | # Reserve (type = 1) 4 | 0.000 PROUT 1 1 0xdeadbeef 0 0x00 5 | 6 | 7 | ## WAITING..... 8 | 9 | 10 | # Release (type = 1) 11 | 20.000 PROUT 2 1 0xdeadbeef 0 0x00 12 | # Unregister 13 | 20.000 PROUT 0 0 0xdeadbeef 0 0x00 14 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/reserve_parallel_2.txt: -------------------------------------------------------------------------------- 1 | # Register 0xfee 2 | 1.000 PROUT 0 0 0 0xfee 0x00 3 | # Reserve (type = 1) 4 | 1.000 PROUT 1 1 0xfee 0 0x18 5 | # Release (type = 1) 6 | 1.000 PROUT 2 1 0xfee 0 0x00 7 | # Unregister 8 | 1.000 PROUT 0 0 0xfee 0 0x00 9 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/iscsi/reserve_twice.txt: -------------------------------------------------------------------------------- 1 | # Register 2 | 0.000 PROUT 0 0 0 0xdeadbeef 0x00 3 | # Reserve (type = 1) 4 | 1.000 PROUT 1 1 0xdeadbeef 0 0x00 5 | 1.000 PROUT 1 1 0xdeadbeef 0 0x00 6 | 1.000 PROUT 2 1 0xdeadbeef 0 0x00 7 | 2.000 PROUT 0 0 0xdeadbeef 0 0x00 8 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/nfs_2.txt: -------------------------------------------------------------------------------- 1 | RANDOMSTRING 1 "/test[0123456789][01234567890].file" 2 | # 3 | # the LOOP/ENDLOOP construct will loop over an entire section of the loadfile 4 | # 5 | LOOP 5 6 | CREATE3 $1 * 7 | LOOKUP3 $1 0x00000000 8 | WRITE3 $1 0 1024 0 0x00000000 9 | WRITE3 $1 1024 1024 0 0x00000000 10 | ENDLOOP 11 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/smb_1.txt: -------------------------------------------------------------------------------- 1 | # example loadfile for SMB 2 | # create a file and write 4kb to it at random offsets 3 | # make sure the offset is between 0 and 0x10000000 and that it is aligned to 4kb 4 | # boundaries 5 | # 6 | MKDIR "/client1" * 7 | OPEN "/client1/test.txt" 0x0c SUCCESS 8 | REPEAT 10 9 | WRITE "/client1/test.txt" *%0x10000000/4096 4096 SUCCESS 10 | CLOSE "/client1/test.txt" SUCCESS 11 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/dbench-workloads/smb_2.txt: -------------------------------------------------------------------------------- 1 | # example loadfile for SMB 2 | # create a file and write 40k to it at sequentially, 4kb at a time 3 | # 4 | #MKDIR "/client1" * 5 | OPEN "/client1/test.txt" 0x0c SUCCESS 6 | WRITE "/client1/test.txt" 0 4096 SUCCESS 7 | REPEAT 9 8 | WRITE "/client1/test.txt" +4096 4096 SUCCESS 9 | CLOSE "/client1/test.txt" SUCCESS 10 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/drop-caches: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # Clears pagecache, dentries, and inodes 6 | echo 3 > /proc/sys/vm/drop_caches 7 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/grubonce: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MENU=/boot/grub/grub.cfg 4 | GRUB=/etc/default/grub 5 | 6 | OPT_SAVED="GRUB_DEFAULT=saved" 7 | (cat $GRUB | grep $OPT_SAVED > /dev/null) || { 8 | echo "Please set $OPT_SAVED in $GRUB" 9 | echo "# grub-set-default 0" 10 | echo "# update-grub" 11 | exit 1 12 | } 13 | 14 | if [[ $# == 0 ]]; then 15 | CNT=0 16 | while read entry ; do 17 | ENTRY=$(echo $entry | cut -d' ' -f2- | awk -F'--' '{print $1}' | tr "'\"" " ") 18 | echo "$CNT: $ENTRY" 19 | CNT=$((CNT+1)) 20 | done < <(sudo cat $MENU | grep "menuentry ") 21 | echo "NOTE." 22 | sudo grub-editenv list 23 | else 24 | sudo grub-reboot $1 && sudo reboot -d 25 | fi 26 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/install-fs-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sudo apt-get install xfsprogs btrfs-tools f2fs-tools jfsutils reiserfsprogs nilfs-tools 3 | -------------------------------------------------------------------------------- /benchmarks/fxmark/bin/turnoff-aslr: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # turn off aslr 4 | echo 0 > /proc/sys/kernel/randomize_va_space 5 | -------------------------------------------------------------------------------- /benchmarks/fxmark/src/util.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int mkdir_p(const char *path) 6 | { 7 | char cmd[PATH_MAX*2]; 8 | snprintf(cmd, PATH_MAX*2, "mkdir -p %s", path); 9 | return system(cmd); 10 | } 11 | -------------------------------------------------------------------------------- /benchmarks/fxmark/src/util.h: -------------------------------------------------------------------------------- 1 | #ifndef __UTIL_H__ 2 | #define __UTIL_H__ 3 | 4 | int mkdir_p(const char *path); 5 | 6 | inline static unsigned int pseudo_random(unsigned int x_n) 7 | { 8 | /* 9 | * NOTE: linear congruential generator 10 | * http://en.wikipedia.org/wiki/Linear_congruential_generator 11 | */ 12 | return 1103515245 * x_n + 12345; 13 | } 14 | 15 | #endif /* __UTIL_H__ */ 16 | -------------------------------------------------------------------------------- /benchmarks/leveldb/bin/drop-caches: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # Clears pagecache, dentries, and inodes 6 | echo 3 > /proc/sys/vm/drop_caches 7 | -------------------------------------------------------------------------------- /benchmarks/leveldb/leveldb-1.20/.gitignore: -------------------------------------------------------------------------------- 1 | build_config.mk 2 | *.a 3 | *.o 4 | *.dylib* 5 | *.so 6 | *.so.* 7 | *_test 8 | db_bench 9 | leveldbutil 10 | -------------------------------------------------------------------------------- /benchmarks/leveldb/leveldb-1.20/.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | compiler: 3 | - clang 4 | - gcc 5 | os: 6 | - linux 7 | - osx 8 | sudo: false 9 | before_install: 10 | - echo $LANG 11 | - echo $LC_ALL 12 | script: 13 | - make -j 4 check 14 | -------------------------------------------------------------------------------- /benchmarks/leveldb/leveldb-1.20/AUTHORS: -------------------------------------------------------------------------------- 1 | # Names should be added to this file like so: 2 | # Name or Organization 3 | 4 | Google Inc. 5 | 6 | # Initial version authors: 7 | Jeffrey Dean 8 | Sanjay Ghemawat 9 | 10 | # Partial list of contributors: 11 | Kevin Regan 12 | Johan Bilien 13 | -------------------------------------------------------------------------------- /benchmarks/leveldb/leveldb-1.20/NEWS: -------------------------------------------------------------------------------- 1 | Release 1.2 2011-05-16 2 | ---------------------- 3 | 4 | Fixes for larger databases (tested up to one billion 100-byte entries, 5 | i.e., ~100GB). 6 | 7 | (1) Place hard limit on number of level-0 files. This fixes errors 8 | of the form "too many open files". 9 | 10 | (2) Fixed memtable management. Before the fix, a heavy write burst 11 | could cause unbounded memory usage. 12 | 13 | A fix for a logging bug where the reader would incorrectly complain 14 | about corruption. 15 | 16 | Allow public access to WriteBatch contents so that users can easily 17 | wrap a DB. 18 | -------------------------------------------------------------------------------- /benchmarks/leveldb/leveldb-1.20/TODO: -------------------------------------------------------------------------------- 1 | ss 2 | - Stats 3 | 4 | db 5 | - Maybe implement DB::BulkDeleteForRange(start_key, end_key) 6 | that would blow away files whose ranges are entirely contained 7 | within [start_key..end_key]? For Chrome, deletion of obsolete 8 | object stores, etc. can be done in the background anyway, so 9 | probably not that important. 10 | - There have been requests for MultiGet. 11 | 12 | After a range is completely deleted, what gets rid of the 13 | corresponding files if we do no future changes to that range. Make 14 | the conditions for triggering compactions fire in more situations? 15 | -------------------------------------------------------------------------------- /benchmarks/leveldb/leveldb-1.20/port/README: -------------------------------------------------------------------------------- 1 | This directory contains interfaces and implementations that isolate the 2 | rest of the package from platform details. 3 | 4 | Code in the rest of the package includes "port.h" from this directory. 5 | "port.h" in turn includes a platform specific "port_.h" file 6 | that provides the platform specific implementation. 7 | 8 | See port_posix.h for an example of what must be provided in a platform 9 | specific header file. 10 | 11 | -------------------------------------------------------------------------------- /benchmarks/leveldb/leveldb-1.20/port/port.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_PORT_PORT_H_ 6 | #define STORAGE_LEVELDB_PORT_PORT_H_ 7 | 8 | #include 9 | 10 | // Include the appropriate platform specific file below. If you are 11 | // porting to a new platform, see "port_example.h" for documentation 12 | // of what the new port_.h file must provide. 13 | #if defined(LEVELDB_PLATFORM_POSIX) 14 | # include "port/port_posix.h" 15 | #elif defined(LEVELDB_PLATFORM_CHROMIUM) 16 | # include "port/port_chromium.h" 17 | #endif 18 | 19 | #endif // STORAGE_LEVELDB_PORT_PORT_H_ 20 | -------------------------------------------------------------------------------- /benchmarks/leveldb/leveldb-1.20/util/filter_policy.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #include "leveldb/filter_policy.h" 6 | 7 | namespace leveldb { 8 | 9 | FilterPolicy::~FilterPolicy() { } 10 | 11 | } // namespace leveldb 12 | -------------------------------------------------------------------------------- /benchmarks/leveldb/leveldb-1.20/util/hash.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // Simple hash function used for internal data structures 6 | 7 | #ifndef STORAGE_LEVELDB_UTIL_HASH_H_ 8 | #define STORAGE_LEVELDB_UTIL_HASH_H_ 9 | 10 | #include 11 | #include 12 | 13 | namespace leveldb { 14 | 15 | extern uint32_t Hash(const char* data, size_t n, uint32_t seed); 16 | 17 | } 18 | 19 | #endif // STORAGE_LEVELDB_UTIL_HASH_H_ 20 | -------------------------------------------------------------------------------- /benchmarks/leveldb/run_db_bench.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | result_dir=$1 4 | DB_BENCH=./leveldb-1.20/out-static/db_bench 5 | cores=(1 2 4 8 16 28 56 84 112 140 168 196 224) 6 | DB_PATH=/tmp/db 7 | 8 | # Create result directory 9 | mkdir $result_dir 10 | 11 | for c in ${cores[@]} 12 | do 13 | # sudo mount -t tmpfs -o size=10G tmpfs $DB_PATH 14 | # Create DB with db_bench 15 | $DB_BENCH --db=$DB_PATH --benchmarks=fillseq --threads=1 16 | # sync 17 | # sudo ./bin/drop-caches 18 | $DB_BENCH --benchmarks=readrandom --use_existing_db=1 --db=$DB_PATH --threads=$c | tee ./$result_dir/readrandom.$c 19 | 20 | sudo rm -rf $DB_PATH/* 21 | # sudo umount $DB_PATH 22 | sleep 5 23 | done 24 | 25 | -------------------------------------------------------------------------------- /benchmarks/lockstat/get-lockstat/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | get_bpflockstat 3 | -------------------------------------------------------------------------------- /benchmarks/metis/.gitignore: -------------------------------------------------------------------------------- 1 | obj 2 | data 3 | obj.default/ 4 | obj.hugetlb/ 5 | -------------------------------------------------------------------------------- /benchmarks/metis/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rs3lab/SynCord/a2641f3cc403514c16b24e29035736f538952e99/benchmarks/metis/__init__.pyc -------------------------------------------------------------------------------- /benchmarks/metis/format.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # This file automatically format all the .c and .h files in this project 4 | # using indent. 5 | 6 | use File::Find; 7 | use Shell; 8 | my $dir = pwd(); 9 | $dir = trim($dir); 10 | find(\&edits, $dir); 11 | sub trim($) 12 | { 13 | my $string = shift; 14 | $string =~ s/^\s+//; 15 | $string =~ s/\s+$//; 16 | return $string; 17 | } 18 | 19 | sub edits() 20 | { 21 | my $opts = "-nbad -bap -nbc -bbo -br -brs -ncdb -ce -cp1 -cs -di4 -ndj -nfc1 -nfca -hnl -i4 -lp -npcs -nprs -psl -saf -sai -saw -nsc -nsob -ss"; 22 | if ($File::Find::name =~ /\.c$/ || $File::Find::name =~ /\.h$/) 23 | { 24 | system("indent $opts $File::Find::name"); 25 | system("rm $File::Find::name~"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/apphelper.h: -------------------------------------------------------------------------------- 1 | #ifndef APPHELPER_H 2 | #define APPHELPER_H 3 | 4 | #include "mr-types.h" 5 | 6 | extern app_arg_t the_app; 7 | void app_set_arg(app_arg_t * app); 8 | void app_set_final_results(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/bsearch.h: -------------------------------------------------------------------------------- 1 | #ifndef BSEARCH_H 2 | #define BSEARCH_H 3 | 4 | #include "mr-types.h" 5 | 6 | typedef int (*bsearch_cmp_t) (const void *, const void *); 7 | // return the position of the first element that is greater than or eqaul to key. 8 | int bsearch_eq(const void *key, const void *base, int nelems, size_t size, 9 | bsearch_cmp_t keycmp, int *bfound); 10 | // return the position of the first element that is greater than key 11 | int bsearch_lar(const void *key, const void *base, int nelems, size_t size, 12 | bsearch_cmp_t keycmp); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/cpumap.h: -------------------------------------------------------------------------------- 1 | #ifndef CPUMAP_H 2 | #define CPUMAP_H 3 | 4 | extern int lcpu_to_pcpu[JOS_NCPU]; 5 | void cpumap_init(); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/estimation.h: -------------------------------------------------------------------------------- 1 | #ifndef ESTIMATION_H 2 | #define ESTIMATION_H 3 | 4 | #include "mr-types.h" 5 | 6 | enum { nkeys_per_bkt = 10 }; 7 | 8 | void est_init(); 9 | void est_newpair(int row, int newkey); 10 | void est_task_finished(int row); 11 | void est_estimate(uint64_t * nkeys, uint64_t * npairs, int row, int ntotal); 12 | int est_get_finished(int row); 13 | #endif 14 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/ibs.h: -------------------------------------------------------------------------------- 1 | #ifndef IBS_H 2 | #define IBS_H 3 | #include 4 | 5 | void ibs_start(int cid); 6 | void ibs_stop(int cid); 7 | 8 | uint64_t ibs_read_count(int cid); 9 | uint64_t ibs_read_latency(int cid); 10 | #endif 11 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/mergesort.h: -------------------------------------------------------------------------------- 1 | #ifndef MERGESORT_H 2 | #define MERGESORT_H 3 | 4 | #include "pchandler.h" 5 | 6 | void mergesort(void *acolls, int ncolls, const pc_handler_t * pch, 7 | int ncpus, int lcpu, pair_cmp_t pcmp); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/perf.h: -------------------------------------------------------------------------------- 1 | #ifndef PERF_H 2 | #define PERF_H 3 | #include "mr-types.h" 4 | 5 | void perf_start(task_type_t phase); 6 | void perf_end(); 7 | 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/psrs.h: -------------------------------------------------------------------------------- 1 | #ifndef PSRS_H 2 | #define PSRS_H 3 | 4 | #include "pchandler.h" 5 | 6 | void psrs(void *acoll, int ncoll, int ncpus, int lcpu, 7 | const pc_handler_t * pch, pair_cmp_t pcmp, int doreduce); 8 | #endif 9 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/rbktsmgr.h: -------------------------------------------------------------------------------- 1 | #ifndef RBKTSMGR_H 2 | #define RBKTSMGR_H 3 | 4 | #include "mr-types.h" 5 | #include "pchandler.h" 6 | 7 | void rbkts_set_final_results(void); 8 | void rbkts_set_pch(const pc_handler_t * pch); 9 | void rbkts_init(int n); 10 | void *rbkts_get(int ibkt); 11 | void rbkts_destroy(void); 12 | void rbkts_set_elems(int ibkt, keyval_t * elems, int nelems, int bsorted); 13 | void rbkts_emit_kv(void *key, void *val); 14 | void rbkts_emit_kvs_len(void *key, void **vals, uint64_t len); 15 | void rbkts_set_util(key_cmp_t kcmp); 16 | void rbkts_merge(int ncpus, int lcpu); 17 | void rbkts_set_reduce_task(int itask); 18 | void rbkts_merge_reduce(const pc_handler_t * pch, void *acoll, int ncoll, 19 | int ncpus, int lcpu); 20 | #endif 21 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/reduce.h: -------------------------------------------------------------------------------- 1 | #ifndef REDUCE_H 2 | #define REDUCE_H 3 | 4 | #include "mr-types.h" 5 | #include "pchandler.h" 6 | 7 | // kvs.vals is owned by callee 8 | typedef void (*group_emit_t) (void *arg, const keyvals_t * kvs); 9 | 10 | void reduce_or_group_setcmp(key_cmp_t cmp); 11 | 12 | // Each node contains an iteratable collection of keyval_t 13 | void reduce_or_groupkv(const pc_handler_t * pch, void **colls, int n, 14 | group_emit_t meth, void *arg); 15 | // Each node contains an iteratable collection of keyvals_t 16 | void reduce_or_groupkvs(const pc_handler_t * pch, void **colls, int n); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/thread.h: -------------------------------------------------------------------------------- 1 | #ifndef _MR_THREAD_H_ 2 | #define _MR_THREAD_H_ 3 | 4 | #include 5 | #include 6 | 7 | void mthread_init(int used_nlcpus, int main_lcpu); 8 | void mthread_finalize(void); 9 | void mthread_create(pthread_t * tid, int lid, 10 | void *(*start_routine) (void *), void *arg); 11 | void mthread_join(pthread_t tid, int lid, void **exitcode); 12 | int mthread_is_mainlcpu(int lcpu); 13 | #endif 14 | -------------------------------------------------------------------------------- /benchmarks/metis/lib/value_helper.h: -------------------------------------------------------------------------------- 1 | #ifndef VALUES_H 2 | #define VALUES_H 3 | 4 | #include "mr-types.h" 5 | 6 | void values_insert(keyvals_t * kvs, void *val); 7 | void values_deep_free(keyvals_t * kvs); 8 | void values_mv(keyvals_t * dst, keyvals_t * src); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /benchmarks/metis/libstreamflow.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rs3lab/SynCord/a2641f3cc403514c16b24e29035736f538952e99/benchmarks/metis/libstreamflow.so -------------------------------------------------------------------------------- /benchmarks/metis/micro/Makefrag: -------------------------------------------------------------------------------- 1 | OBJDIRS += micro 2 | 3 | $(O)/micro/%.o: micro/%.c 4 | mkdir -p $(@D) 5 | $(CC) $(CFLAGS) -o $@ -c $< 6 | 7 | -------------------------------------------------------------------------------- /benchmarks/metis/parser.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import re 4 | 5 | cores = [1,2,4,8,14,28,56,84,112,140,168,196,224] 6 | 7 | print("CORE, RUNTIME") 8 | for core in cores: 9 | dir_path = sys.argv[1]+"/result."+str(core) 10 | 11 | try: 12 | with open(dir_path) as f: 13 | lines = f.read() 14 | runtime = re.findall('Real:\s+(\d+)', lines) 15 | 16 | print('%3d, %s' % (core,runtime[0])) 17 | except Exception as e: 18 | print() 19 | 20 | -------------------------------------------------------------------------------- /benchmarks/metis/pkg/streamflow/ummap.h: -------------------------------------------------------------------------------- 1 | #ifndef UMMAP_H 2 | #define UMMAP_H 3 | #include 4 | 5 | int ummap_alloc_init(void); 6 | int ummap_finit(void); 7 | void *u_mmap(void *addr, size_t len, ...); 8 | void *u_mmap_align(size_t alignment, size_t len); 9 | int u_munmap(void *addr, size_t len, ...); 10 | void *u_mremap(void *__addr, size_t __old_len, size_t __new_len, int __flags, 11 | ...); 12 | 13 | typedef struct { 14 | uint64_t last; 15 | } memusage_t; 16 | 17 | void ummap_init_usage(memusage_t * usage); 18 | void ummap_print_usage(memusage_t * usage); 19 | 20 | uint64_t ummap_prefault(uint64_t segsize); 21 | #endif 22 | -------------------------------------------------------------------------------- /benchmarks/metis/test/comsubs.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | my $sfpath = 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:obj/lib'; 4 | my $hugetlbfs = "/mnt/huge"; 5 | 6 | sub do_test { 7 | my $appname = shift; 8 | my $args = shift; 9 | system("rm $hugetlbfs/* >/dev/null 2>&1"); 10 | 11 | my $cmd ="$sfpath ./obj/app/$appname.sf $args"; 12 | print "$cmd\n"; 13 | system($cmd); 14 | print "\n"; 15 | #system("./obj/app/$appname $args"); 16 | }; 17 | 18 | 1; 19 | -------------------------------------------------------------------------------- /benchmarks/metis/tools/mount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | user=`id -un` 4 | 5 | if [ $user != "root" ]; then 6 | echo "Change the size of huge page pool requires login as root!" 7 | exit; 8 | fi 9 | 10 | if [ "$#" -ne "1" ]; then 11 | echo "usage: $0 [number of super-pages]" 12 | exit; 13 | fi 14 | 15 | echo $1 > /proc/sys/vm/nr_hugepages 16 | 17 | hpagekb=`grep Hugepagesize /proc/meminfo | sed -e s/Hugepagesize:// \ 18 | -e s/kB// -e 's/[ ]*//'` 19 | 20 | npages=$1 21 | 22 | poolmb=$((npages*hpagekb/1024)) 23 | 24 | mount -t hugetlbfs -o mode=0777,size=${poolmb}m none /mnt/huge 25 | -------------------------------------------------------------------------------- /benchmarks/metis/tools/umount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | user=`id -un` 4 | 5 | if [ $user != "root" ]; then 6 | echo "Change the size of huge page pool requires login as root!" 7 | exit; 8 | fi 9 | 10 | umount /mnt/huge 11 | 12 | echo 0 > /proc/sys/vm/nr_hugepages 13 | 14 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *_processes 3 | *_threads 4 | tests/*.o 5 | *.csv 6 | *.title 7 | *.html 8 | gmon.out 9 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | cache: ccache 3 | os: 4 | - linux 5 | - linux-ppc64le 6 | addons: 7 | apt: 8 | packages: 9 | - libhwloc-dev 10 | script: make 11 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-Wall -O2 -g -pg 2 | 3 | ifdef wl 4 | workload=tests/$(wl).c 5 | else 6 | workload=$(wildcard tests/*.c) 7 | endif 8 | 9 | processes := $(patsubst tests/%.c,%_processes,$(workload)) 10 | threads := $(patsubst tests/%.c,%_threads,$(workload)) 11 | 12 | all: build_dir | processes threads 13 | 14 | processes: $(processes) 15 | 16 | threads: $(threads) 17 | 18 | posix_semaphore1_processes_FLAGS=-lpthread 19 | 20 | build_dir: 21 | mkdir -p build 22 | 23 | $(processes): %_processes: tests/%.o main.c 24 | $(CC) $(CFLAGS) main.c $< $($@_FLAGS) $(LDFLAGS) -o build/$@ 25 | 26 | $(threads): %_threads: tests/%.o main.c 27 | $(CC) -DTHREADS $(CFLAGS) main.c $< -pthread $(LDFLAGS) -o build/$@ 28 | 29 | clean: 30 | rm -f tests/*.o 31 | rm -rf build 32 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/runscript.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | workload=(mmap1 mmap2 lock1 lock2 page_fault1 page_fault2) 4 | 5 | for wl in ${workload[@]} 6 | do 7 | sudo mount -t tmpfs -o size=10G tmpfs /mnt/tmpfs/ 8 | 9 | echo "# stock : $wl" 10 | python runtest.py $wl 11 | 12 | sudo umount /mnt/tmpfs/ 13 | done 14 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/brk1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char *testcase_description = "brk increase/decrease of one page"; 6 | 7 | void testcase(unsigned long long *iterations, unsigned long nr) 8 | { 9 | void *addr = sbrk(0); 10 | unsigned long page_size = getpagesize(); 11 | 12 | while (1) { 13 | addr += page_size; 14 | assert(brk(addr) == 0); 15 | 16 | addr -= page_size; 17 | assert(brk(addr) == 0); 18 | 19 | (*iterations) += 2; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/dup1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char *testcase_description = "Separate file dup/close"; 6 | 7 | void testcase(unsigned long long *iterations, unsigned long nr) 8 | { 9 | char tmpfile[] = "/tmp/willitscale.XXXXXX"; 10 | int fd = mkstemp(tmpfile); 11 | 12 | assert(fd >= 0); 13 | 14 | while (1) { 15 | int fd2 = dup(fd); 16 | 17 | assert(fd2 >= 0); 18 | close(fd2); 19 | 20 | (*iterations)++; 21 | } 22 | 23 | close(fd); 24 | unlink(tmpfile); 25 | } 26 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/futex1.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include 5 | 6 | #define futex(A, B, C, D, E, F) syscall(__NR_futex, A, B, C, D, E, F) 7 | 8 | char *testcase_description = "futex(FUTEX_WAKE)"; 9 | 10 | void testcase(unsigned long long *iterations, unsigned long nr) 11 | { 12 | while (1) { 13 | unsigned int addr = 0; 14 | 15 | futex(&addr, FUTEX_WAKE, 1, NULL, NULL, 0); 16 | 17 | (*iterations)++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/futex2.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include 5 | 6 | #define futex(A, B, C, D, E, F) syscall(__NR_futex, A, B, C, D, E, F) 7 | 8 | char *testcase_description = "futex(FUTEX_WAIT)"; 9 | 10 | void testcase(unsigned long long *iterations, unsigned long nr) 11 | { 12 | while (1) { 13 | unsigned int addr = 0; 14 | 15 | futex(&addr, FUTEX_WAIT, 1, NULL, NULL, 0); 16 | 17 | (*iterations)++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/futex3.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include 5 | 6 | #define futex(A, B, C, D, E, F) syscall(__NR_futex, A, B, C, D, E, F) 7 | 8 | char *testcase_description = "futex(FUTEX_WAKE_PRIVATE)"; 9 | 10 | void testcase(unsigned long long *iterations, unsigned long nr) 11 | { 12 | while (1) { 13 | unsigned int addr = 0; 14 | 15 | futex(&addr, FUTEX_WAKE_PRIVATE, 1, NULL, NULL, 0); 16 | 17 | (*iterations)++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/futex4.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include 5 | 6 | #define futex(A, B, C, D, E, F) syscall(__NR_futex, A, B, C, D, E, F) 7 | 8 | char *testcase_description = "futex(FUTEX_WAIT_PRIVATE)"; 9 | 10 | void testcase(unsigned long long *iterations, unsigned long nr) 11 | { 12 | while (1) { 13 | unsigned int addr = 0; 14 | 15 | futex(&addr, FUTEX_WAIT_PRIVATE, 1, NULL, NULL, 0); 16 | 17 | (*iterations)++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/getppid1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *testcase_description = "getppid"; 5 | 6 | void testcase(unsigned long long *iterations, unsigned long nr) 7 | { 8 | while (1) { 9 | getppid(); 10 | 11 | (*iterations)++; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/lseek1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define BUFLEN 4096 7 | 8 | char *testcase_description = "Separate file lseek"; 9 | 10 | void testcase(unsigned long long *iterations, unsigned long nr) 11 | { 12 | char buf[BUFLEN]; 13 | char tmpfile[] = "/tmp/willitscale.XXXXXX"; 14 | int fd = mkstemp(tmpfile); 15 | 16 | assert(fd >= 0); 17 | unlink(tmpfile); 18 | 19 | assert(write(fd, buf, sizeof(buf)) == sizeof(buf)); 20 | 21 | while (1) { 22 | lseek(fd, 0, SEEK_SET); 23 | 24 | (*iterations)++; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/malloc1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define SIZE (128UL * 1024 * 1024) 7 | 8 | char *testcase_description = "malloc/free of 128MB"; 9 | 10 | void testcase(unsigned long long *iterations, unsigned long nr) 11 | { 12 | while (1) { 13 | void *addr = malloc(SIZE); 14 | assert(addr != NULL); 15 | free(addr); 16 | 17 | (*iterations)++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/malloc2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define SIZE (1UL * 1024) 7 | 8 | char *testcase_description = "malloc/free of 1kB"; 9 | 10 | void testcase(unsigned long long *iterations, unsigned long nr) 11 | { 12 | while (1) { 13 | void *addr = malloc(SIZE); 14 | assert(addr != NULL); 15 | free(addr); 16 | 17 | (*iterations)++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/mmap1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define MEMSIZE (128 * 1024 * 1024) 7 | 8 | char *testcase_description = "Anonymous memory mmap/munmap of 128MB"; 9 | 10 | void testcase(unsigned long long *iterations, unsigned long nr) 11 | { 12 | while (1) { 13 | char *c = mmap(NULL, MEMSIZE, PROT_READ|PROT_WRITE, 14 | MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); 15 | assert(c != MAP_FAILED); 16 | munmap(c, MEMSIZE); 17 | 18 | (*iterations)++; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/mmap2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define MEMSIZE (128 * 1024 * 1024) 8 | 9 | char *testcase_description = "Separate file mmap/munmap of 128MB"; 10 | 11 | void testcase(unsigned long long *iterations, unsigned long nr) 12 | { 13 | char tmpfile[] = "/tmp/willitscale.XXXXXX"; 14 | int fd = mkstemp(tmpfile); 15 | 16 | assert(ftruncate(fd, MEMSIZE) == 0); 17 | unlink(tmpfile); 18 | 19 | while (1) { 20 | char *c = mmap(NULL, MEMSIZE, PROT_READ|PROT_WRITE, 21 | MAP_PRIVATE, fd, 0); 22 | assert(c != MAP_FAILED); 23 | munmap(c, MEMSIZE); 24 | 25 | (*iterations)++; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/open1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | char *testcase_description = "Separate file open/close"; 9 | 10 | void testcase(unsigned long long *iterations, unsigned long nr) 11 | { 12 | char tmpfile[] = "/tmp/willitscale.XXXXXX"; 13 | int fd = mkstemp(tmpfile); 14 | 15 | assert(fd >= 0); 16 | close(fd); 17 | 18 | while (1) { 19 | int fd = open(tmpfile, O_RDWR); 20 | assert(fd >= 0); 21 | close(fd); 22 | 23 | (*iterations)++; 24 | } 25 | 26 | unlink(tmpfile); 27 | } 28 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/open3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | static char tmpfile[] = "/tmp/willitscale.XXXXXX"; 9 | 10 | char *testcase_description = "Same file open/close"; 11 | 12 | void testcase_prepare(unsigned long nr_tasks) 13 | { 14 | int fd = mkstemp(tmpfile); 15 | 16 | assert(fd >= 0); 17 | close(fd); 18 | } 19 | 20 | void testcase(unsigned long long *iterations, unsigned long nr) 21 | { 22 | while (1) { 23 | int fd = open(tmpfile, O_RDWR); 24 | assert(fd >= 0); 25 | close(fd); 26 | 27 | (*iterations)++; 28 | } 29 | } 30 | 31 | void testcase_cleanup(void) 32 | { 33 | unlink(tmpfile); 34 | } 35 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/page_fault1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define MEMSIZE (128 * 1024 * 1024) 7 | 8 | char *testcase_description = "Anonymous memory page fault"; 9 | 10 | void testcase(unsigned long long *iterations, unsigned long nr) 11 | { 12 | unsigned long pgsize = getpagesize(); 13 | 14 | while (1) { 15 | unsigned long i; 16 | 17 | char *c = mmap(NULL, MEMSIZE, PROT_READ|PROT_WRITE, 18 | MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); 19 | assert(c != MAP_FAILED); 20 | 21 | for (i = 0; i < MEMSIZE; i += pgsize) { 22 | c[i] = 0; 23 | (*iterations)++; 24 | } 25 | 26 | munmap(c, MEMSIZE); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/pipe1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define READ 0 7 | #define WRITE 1 8 | 9 | char *testcase_description = "pipe read/write"; 10 | 11 | void testcase(unsigned long long *iterations, unsigned long nr) 12 | { 13 | int fd[2]; 14 | 15 | assert(pipe(fd) == 0); 16 | 17 | while (1) { 18 | char c = 0; 19 | int ret; 20 | 21 | do { 22 | ret = write(fd[WRITE], &c, 1); 23 | } while (ret != 1 && errno == EINTR); 24 | 25 | do { 26 | ret = read(fd[READ], &c, 1); 27 | } while (ret != 1 && errno == EINTR); 28 | 29 | (*iterations)++; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/poll1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | char *testcase_description = "poll of 1 fd"; 8 | 9 | void testcase(unsigned long long *iterations, unsigned long nr) 10 | { 11 | char tmpfile[] = "/tmp/willitscale.XXXXXX"; 12 | int fd = mkstemp(tmpfile); 13 | 14 | assert(fd >= 0); 15 | unlink(tmpfile); 16 | 17 | while (1) { 18 | struct pollfd pfd[1]; 19 | 20 | memset(&pfd, 0, sizeof(pfd)); 21 | pfd[0].fd = fd; 22 | pfd[0].events = POLLOUT; 23 | 24 | assert(poll(pfd, 1, 0) >= 0); 25 | 26 | (*iterations)++; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/posix_semaphore1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *testcase_description = "POSIX semaphores"; 4 | 5 | void testcase(unsigned long long *iterations, unsigned long nr) 6 | { 7 | sem_t sem; 8 | 9 | sem_init(&sem, 0, 1); 10 | 11 | while (1) { 12 | sem_wait(&sem); 13 | sem_post(&sem); 14 | (*iterations)++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/pread1.c: -------------------------------------------------------------------------------- 1 | #define _XOPEN_SOURCE 500 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define BUFLEN 4096 8 | 9 | char *testcase_description = "Separate file pread"; 10 | 11 | void testcase(unsigned long long *iterations, unsigned long nr) 12 | { 13 | char buf[BUFLEN]; 14 | char tmpfile[] = "/tmp/willitscale.XXXXXX"; 15 | int fd = mkstemp(tmpfile); 16 | 17 | memset(buf, 0, sizeof(buf)); 18 | assert(fd >= 0); 19 | assert(write(fd, buf, sizeof(buf)) == sizeof(buf)); 20 | unlink(tmpfile); 21 | 22 | while (1) { 23 | assert(pread(fd, buf, BUFLEN, 0) == BUFLEN); 24 | 25 | (*iterations)++; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/pthread_mutex1.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | char *testcase_description = "Contended pthread mutex"; 5 | 6 | pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 7 | 8 | void testcase(unsigned long long *iterations, unsigned long nr) 9 | { 10 | while (1) { 11 | pthread_mutex_lock(&mutex); 12 | pthread_mutex_unlock(&mutex); 13 | 14 | (*iterations)++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/pthread_mutex2.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | char *testcase_description = "Uncontended pthread mutex"; 5 | 6 | void testcase(unsigned long long *iterations, unsigned long nr) 7 | { 8 | pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 9 | 10 | while (1) { 11 | pthread_mutex_lock(&mutex); 12 | pthread_mutex_unlock(&mutex); 13 | 14 | (*iterations)++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/pthread_mutex3.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | char *testcase_description = "Contended pthread mutex with global update"; 5 | 6 | pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 7 | unsigned long val; 8 | 9 | void testcase(unsigned long long *iterations, unsigned long nr) 10 | { 11 | while (1) { 12 | pthread_mutex_lock(&mutex); 13 | val++; 14 | pthread_mutex_unlock(&mutex); 15 | 16 | (*iterations)++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/pthread_mutex4.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | char *testcase_description = "Contended pthread mutex with local update"; 5 | 6 | pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 7 | 8 | void testcase(unsigned long long *iterations, unsigned long nr) 9 | { 10 | unsigned long val; 11 | 12 | while (1) { 13 | pthread_mutex_lock(&mutex); 14 | val++; 15 | pthread_mutex_unlock(&mutex); 16 | 17 | (*iterations)++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/pwrite1.c: -------------------------------------------------------------------------------- 1 | #define _XOPEN_SOURCE 500 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define BUFLEN 4096 8 | 9 | char *testcase_description = "Separate file pwrite"; 10 | 11 | void testcase(unsigned long long *iterations, unsigned long nr) 12 | { 13 | char buf[BUFLEN]; 14 | char tmpfile[] = "/tmp/willitscale.XXXXXX"; 15 | int fd = mkstemp(tmpfile); 16 | 17 | memset(buf, 0, sizeof(buf)); 18 | assert(fd >= 0); 19 | unlink(tmpfile); 20 | 21 | while (1) { 22 | assert(pwrite(fd, buf, BUFLEN, 0) == BUFLEN); 23 | 24 | (*iterations)++; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/read1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define BUFLEN 4096 8 | #define FILESIZE (1 * 1024 * 1024) 9 | 10 | char *testcase_description = "Separate file read"; 11 | 12 | void testcase(unsigned long long *iterations, unsigned long nr) 13 | { 14 | char buf[FILESIZE]; 15 | char tmpfile[] = "/tmp/willitscale.XXXXXX"; 16 | int fd = mkstemp(tmpfile); 17 | 18 | unlink(tmpfile); 19 | 20 | memset(buf, 0, sizeof(buf)); 21 | assert(fd >= 0); 22 | assert(write(fd, buf, sizeof(buf)) == sizeof(buf)); 23 | 24 | while (1) { 25 | int len = read(fd, buf, BUFLEN); 26 | assert(len >= 0); 27 | if (len == 0) 28 | lseek(fd, 0, SEEK_SET); 29 | 30 | (*iterations)++; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/readseek1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define BUFLEN 4096 8 | 9 | char *testcase_description = "Separate file seek+read"; 10 | 11 | void testcase(unsigned long long *iterations, unsigned long nr) 12 | { 13 | char buf[BUFLEN]; 14 | char tmpfile[] = "/tmp/willitscale.XXXXXX"; 15 | int fd = mkstemp(tmpfile); 16 | 17 | memset(buf, 0, sizeof(buf)); 18 | assert(fd >= 0); 19 | assert(write(fd, buf, sizeof(buf)) == sizeof(buf)); 20 | unlink(tmpfile); 21 | 22 | while (1) { 23 | lseek(fd, 0, SEEK_SET); 24 | assert(read(fd, buf, BUFLEN) == BUFLEN); 25 | 26 | (*iterations)++; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/sched_yield.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *testcase_description = "sched_yield"; 5 | 6 | void testcase(unsigned long long *iterations, unsigned long nr) 7 | { 8 | while (1) { 9 | assert(sched_yield() == 0); 10 | 11 | (*iterations)++; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/signal1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | void handler(int junk) 8 | { 9 | /* Do Nothing */ 10 | } 11 | 12 | char *testcase_description = "signal delivery"; 13 | 14 | void testcase(unsigned long long *iterations, unsigned long nr) 15 | { 16 | struct sigaction act; 17 | 18 | memset(&act, 0, sizeof(act)); 19 | act.sa_handler = handler; 20 | sigaction(SIGUSR1, &act, NULL); 21 | 22 | while (1) { 23 | raise(SIGUSR1); 24 | 25 | (*iterations)++; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/unix1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define READ 0 8 | #define WRITE 1 9 | 10 | char *testcase_description = "unix domain socket read/write"; 11 | 12 | void testcase(unsigned long long *iterations, unsigned long nr) 13 | { 14 | int fd[2]; 15 | char c; 16 | int ret; 17 | 18 | socketpair(AF_UNIX, SOCK_STREAM, 0, fd); 19 | 20 | while (1) { 21 | do { 22 | ret = write(fd[WRITE], &c, 1); 23 | } while (ret != 1 && errno == EINTR); 24 | 25 | do { 26 | ret = read(fd[READ], &c, 1); 27 | } while (ret != 1 && errno == EINTR); 28 | 29 | (*iterations)++; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/unlink1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | char *testcase_description = "Separate file open/close/unlink"; 9 | 10 | void testcase(unsigned long long *iterations, unsigned long nr) 11 | { 12 | char tmpfile[] = "/tmp/willitscale.XXXXXX"; 13 | int fd = mkstemp(tmpfile); 14 | 15 | assert(fd >= 0); 16 | close(fd); 17 | unlink(tmpfile); 18 | 19 | while (1) { 20 | fd = open(tmpfile, O_RDWR|O_CREAT, 0600); 21 | assert(fd >= 0); 22 | close(fd); 23 | unlink(tmpfile); 24 | 25 | (*iterations)++; 26 | } 27 | 28 | unlink(tmpfile); 29 | } 30 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/unlink2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | char *testcase_description = "Separate file open/close in different directories"; 11 | 12 | void testcase(unsigned long long *iterations, unsigned long nr) 13 | { 14 | char tmpdir[] = "/tmp/willitscale.XXXXXX"; 15 | char tmpfile[PATH_MAX]; 16 | 17 | assert(mkdtemp(tmpdir) != NULL); 18 | sprintf(tmpfile, "%s/willitscale", tmpdir); 19 | 20 | while (1) { 21 | int fd = open(tmpfile, O_RDWR|O_CREAT, 0600); 22 | assert(fd >= 0); 23 | close(fd); 24 | unlink(tmpfile); 25 | 26 | (*iterations)++; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /benchmarks/will-it-scale/tests/writeseek1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define BUFLEN 4096 8 | 9 | char *testcase_description = "Separate file seek+write"; 10 | 11 | void testcase(unsigned long long *iterations, unsigned long nr) 12 | { 13 | char buf[BUFLEN]; 14 | char tmpfile[] = "/tmp/willitscale.XXXXXX"; 15 | int fd = mkstemp(tmpfile); 16 | 17 | memset(buf, 0, sizeof(buf)); 18 | assert(fd >= 0); 19 | unlink(tmpfile); 20 | 21 | while (1) { 22 | lseek(fd, 0, SEEK_SET); 23 | assert(write(fd, buf, BUFLEN) == BUFLEN); 24 | 25 | (*iterations)++; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /benchmarks/xDir-rename/.gitignore: -------------------------------------------------------------------------------- 1 | dst_empty 2 | src_empty 3 | dst_*_files 4 | benchmark 5 | -------------------------------------------------------------------------------- /benchmarks/xDir-rename/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: default clean 2 | 3 | default: benchmark 4 | 5 | benchmark: benchmark.c 6 | gcc -o benchmark benchmark.c -lpthread 7 | 8 | clean: 9 | rm -rf benchmark dst_empty src_empty 10 | -------------------------------------------------------------------------------- /benchmarks/xDir-rename/README.md: -------------------------------------------------------------------------------- 1 | SCL Bench 2 | ========= 3 | 4 | # Preparation 5 | 6 | 1. Turn off directory index feature 7 | 8 | ``` 9 | $ tune2fs -O ^dir_index /dev/sda1 # Turn off 10 | $ tune2fs -l /dev/sda1 # Check 11 | ``` 12 | 13 | 2. Make three directories (src, dst, dst_dirty). 14 | src and dst is empty, while dst_dirty has a million empty files. 15 | 16 | ``` 17 | $ python3 script.py 18 | ``` 19 | 20 | # Run 21 | 22 | 1. Run the benchmark 23 | 24 | ``` 25 | $ ./benchmark src dst_dirty dst 30 30 30 > result 26 | ``` 27 | 28 | 29 | -------------------------------------------------------------------------------- /scripts/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /scripts/uninstall_policy.sh: -------------------------------------------------------------------------------- 1 | echo 0 > /sys/kernel/livepatch/livepatch_concord/enabled 2 | rm /sys/fs/bpf/* 3 | sleep 5 4 | sudo rmmod livepatch_concord 5 | -------------------------------------------------------------------------------- /src/concord/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | .idea 3 | output/ 4 | -------------------------------------------------------------------------------- /src/concord/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rs3lab/SynCord/a2641f3cc403514c16b24e29035736f538952e99/src/concord/__init__.py -------------------------------------------------------------------------------- /src/concord/bpf/skeleton_kern.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "bpf_helpers.h" 3 | #include "concord.h" 4 | 5 | ${API_CONTENTS} 6 | 7 | char _license[] SEC("license") = "GPL"; 8 | -------------------------------------------------------------------------------- /src/concord/list_APIs.h: -------------------------------------------------------------------------------- 1 | // ============ Available APIs ============ 2 | 3 | // -- General -- 4 | void lock_to_acquire(struct __lock_policy_args *args); 5 | void lock_acquired(struct __lock_policy_args *args); 6 | void lock_to_release(struct __lock_policy_args *args); 7 | void lock_released(struct __lock_policy_args *args); 8 | 9 | // -- Fastpath -- 10 | void lock_to_enter_slowpath(struct __lock_policy_args *args); 11 | bool lock_enable_fastpath(struct __lock_policy_args *args); 12 | 13 | // -- Reordering -- 14 | bool should_reorder(struct __lock_policy_args *args); 15 | bool skip_reorder(struct __lock_policy_args *args); 16 | 17 | // -- Bypass -- 18 | bool lock_bypass_acquire(struct __lock_policy_args *args); 19 | bool lock_bypass_release(struct __lock_policy_args *args); 20 | -------------------------------------------------------------------------------- /src/concord/patch/single_lock.patch: -------------------------------------------------------------------------------- 1 | diff --git a/mm/filemap.c b/mm/filemap.c 2 | index 85b7d08..419a7b5 100644 3 | --- a/mm/filemap.c 4 | +++ b/mm/filemap.c 5 | @@ -3460,11 +3460,11 @@ ssize_t generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from) 6 | struct inode *inode = file->f_mapping->host; 7 | ssize_t ret; 8 | 9 | - inode_lock(inode); 10 | + bpf_down_write(&inode->i_rwsem); 11 | ret = generic_write_checks(iocb, from); 12 | if (ret > 0) 13 | ret = __generic_file_write_iter(iocb, from); 14 | - inode_unlock(inode); 15 | + up_write(&inode->i_rwsem); 16 | 17 | if (ret > 0) 18 | ret = generic_write_sync(iocb, ret); 19 | -------------------------------------------------------------------------------- /src/concord/policy/amp/amp_cont_lock.pfile: -------------------------------------------------------------------------------- 1 | #define CORE_PER_SOCKET 28 2 | #define AMP_PATIENCE_TICK 22000000 3 | 4 | SEC("lock_qspinlock_contended") 5 | int custom_lock_contended(struct __lock_policy_args *args) 6 | { 7 | unsigned long cpu = bpf_get_smp_processor_id(); 8 | 9 | if (cpu % CORE_PER_SOCKET >= CORE_PER_SOCKET / 2) { 10 | bpf_back_off(args->lock_ptr, AMP_PATIENCE_TICK); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /src/concord/policy/bravo/bravo_acqed_lock.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_rwsem_acquired") 2 | int custom_lock_acquired(struct __lock_policy_args *args) 3 | { 4 | 5 | /* unsigned long time = bpf_ktime_get_ns(); */ 6 | /* bpf_printk("[acqed] %lu && %lu > %lu ?\n", args->RBias, time, args->InhibitUntil); */ 7 | 8 | if(args->RBias == 0){ 9 | /* bpf_printk("RBias Set\n"); */ 10 | args->RBias = 1; 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /src/concord/policy/bravo/bravo_bypass_acq_lock.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_rwsem_bypass_acquire") 2 | int custom_lock_bypass_acquire(struct __lock_policy_args *args) 3 | { 4 | /* bpf_printk("[acq ] %lu | %lu | %lu \n", args->InhibitUntil, args->RBias, args->per_cpu_data); */ 5 | 6 | u32 pid = bpf_get_current_pid_tgid(); 7 | 8 | if(args->RBias == 1){ 9 | if(args->per_cpu_data == 0){ 10 | args->per_cpu_data = pid; 11 | 12 | if(args->RBias == 1){ // Recheck 13 | return 1; // fast_path 14 | } 15 | else{ // Raced; RBias changed 16 | args->per_cpu_data = 0; 17 | } 18 | } 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /src/concord/policy/bravo/bravo_bypass_release_lock.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_rwsem_bypass_release") 2 | int custom_lock_bypass_release(struct __lock_policy_args *args) 3 | { 4 | /* bpf_printk("[release] %lu | %lu | %lu \n", args->InhibitUntil, args->RBias, args->per_cpu_data); */ 5 | u32 pid = bpf_get_current_pid_tgid(); 6 | 7 | if(args->per_cpu_data == pid){ 8 | // fast path 9 | args->per_cpu_data = 0; 10 | return 1; 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /src/concord/policy/lockstat/lockstat.map: -------------------------------------------------------------------------------- 1 | struct time_stat{ 2 | unsigned long min; 3 | unsigned long max; 4 | unsigned long total; 5 | }; 6 | 7 | struct data_t{ 8 | /* User-defined additional data */ 9 | unsigned long prev_cpu; 10 | 11 | /* lock_to_enter_slow_path */ 12 | unsigned long contentions; 13 | unsigned long con_bounces; 14 | struct time_stat waittime; 15 | 16 | /* lock_acquired */ 17 | unsigned long acquisitions; 18 | unsigned long acq_bounces; 19 | struct time_stat holdtime; 20 | 21 | }; 22 | 23 | struct bpf_map_def SEC("maps") hash_map = { 24 | .type = BPF_MAP_TYPE_HASH, 25 | .key_size = sizeof(unsigned long), 26 | .value_size = sizeof(struct data_t), 27 | .max_entries = 10000, 28 | }; 29 | -------------------------------------------------------------------------------- /src/concord/policy/lockstat/lockstat_to_enter_slow_path.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_qspinlock_contended") 2 | int custom_to_enter_slow_path(struct __lock_policy_args *args) 3 | { 4 | unsigned long key = args->lock_ptr; 5 | struct data_t *data_ptr; 6 | data_ptr = bpf_map_lookup_elem(&hash_map, &key); 7 | 8 | if(!data_ptr){ 9 | // data still not there; let's just skip this round 10 | bpf_printk("skip this turn\n"); 11 | return 0; 12 | } 13 | 14 | data_ptr->contentions++; 15 | args->per_cpu_data = bpf_ktime_get_ns(); 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /src/concord/policy/numa-grouping-cna/numa-grouping-cna.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_qspinlock") 2 | bool custom_should_reorder(struct __lock_policy_args *args) 3 | { 4 | int numa_node = args->numa_node; 5 | int next_numa_node = args->next_numa_node; 6 | 7 | return (next_numa_node != numa_node && next_numa_node != 0xffff); 8 | } 9 | -------------------------------------------------------------------------------- /src/concord/policy/numa-grouping/numa-grouping.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_qspinlock_cmp") 2 | bool custom_cmp_func(struct __lock_policy_args *args) 3 | { 4 | return (args->numa_node == args->next_numa_node); 5 | } 6 | -------------------------------------------------------------------------------- /src/concord/policy/numa-scl/scl_acqed_lock.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_qspinlock_acqed") 2 | int custom_lock_acquired(struct __lock_policy_args *args) 3 | { 4 | // start measure critical section 5 | unsigned long now = bpf_ktime_get_ns(); 6 | args->start_ts = now; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/concord/policy/numa-scl/scl_cmp.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_qspinlock_cmp") 2 | bool custom_cmp_func(struct __lock_policy_args *args) 3 | { 4 | // only compare numa id 5 | return (args->numa_node == args->next_numa_node); 6 | } 7 | -------------------------------------------------------------------------------- /src/concord/policy/numa-scl/scl_cont_lock.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_qspinlock_contended") 2 | int custom_lock_contended(struct __lock_policy_args *args) 3 | { 4 | unsigned long num_threads = args->arg7; 5 | 6 | if(num_threads == 0){ 7 | return 0; 8 | } 9 | 10 | /* When joining the queue */ 11 | unsigned long quota = args->tot_lock_hold / num_threads; 12 | 13 | /* save current thread's tot lock time inside the node */ 14 | unsigned long lock_hold = args->lock_hold; 15 | args->lock_hold_capture = lock_hold; 16 | 17 | if (args->lock_hold * num_threads > args->tot_lock_hold){ 18 | unsigned long need_to_wait = args->lock_hold * num_threads - args->tot_lock_hold; 19 | bpf_back_off(NULL, need_to_wait); // No stealing 20 | } 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /src/concord/policy/numa-scl/scl_release_lock.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_qspinlock_release") 2 | bool custom_lock_release(struct __lock_policy_args *args) 3 | { 4 | // Get the length of critical section 5 | unsigned long now = bpf_ktime_get_ns(); 6 | unsigned long cs_len = now - args->start_ts; 7 | 8 | args->lock_hold += cs_len; //per-thread 9 | args->tot_lock_hold += cs_len; //per-lock 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /src/concord/policy/scl/scl_acqed_lock.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_qspinlock_acqed") 2 | int custom_lock_acquired(struct __lock_policy_args *args) 3 | { 4 | // start measure critical section 5 | unsigned long now = bpf_ktime_get_ns(); 6 | args->start_ts = now; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/concord/policy/scl/scl_cmp.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_qspinlock_cmp") 2 | bool custom_cmp_func(struct __lock_policy_args *args) 3 | { 4 | // only compare numa id 5 | return false; 6 | } 7 | -------------------------------------------------------------------------------- /src/concord/policy/scl/scl_cont_lock.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_qspinlock_contended") 2 | int custom_lock_contended(struct __lock_policy_args *args) 3 | { 4 | unsigned long num_threads = args->arg7; 5 | 6 | if(num_threads == 0){ 7 | return 0; 8 | } 9 | 10 | /* When joining the queue */ 11 | unsigned long quota = args->tot_lock_hold / num_threads; 12 | 13 | /* save current thread's tot lock time inside the node */ 14 | unsigned long lock_hold = args->lock_hold; 15 | args->lock_hold_capture = lock_hold; 16 | 17 | if (args->lock_hold * num_threads > args->tot_lock_hold){ 18 | unsigned long need_to_wait = args->lock_hold * num_threads - args->tot_lock_hold; 19 | bpf_back_off(NULL, need_to_wait); // No stealing 20 | } 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /src/concord/policy/scl/scl_release_lock.pfile: -------------------------------------------------------------------------------- 1 | SEC("lock_qspinlock_release") 2 | bool custom_lock_release(struct __lock_policy_args *args) 3 | { 4 | // Get the length of critical section 5 | unsigned long now = bpf_ktime_get_ns(); 6 | unsigned long cs_len = now - args->start_ts; 7 | 8 | args->lock_hold += cs_len; //per-thread 9 | args->tot_lock_hold += cs_len; //per-lock 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /src/concord/requirements.txt: -------------------------------------------------------------------------------- 1 | GitPython 2 | -------------------------------------------------------------------------------- /src/kpatch/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.o.cmd 3 | *.o.d 4 | *.ko.cmd 5 | *.mod.c 6 | *.swp 7 | *.d 8 | *.so 9 | .tmp_versions 10 | Module.symvers 11 | kmod/core/.cache.mk 12 | kpatch-build/lookup 13 | kpatch-build/create-diff-object 14 | kpatch-build/create-klp-module 15 | kpatch-build/create-kpatch-module 16 | man/kpatch.1.gz 17 | man/kpatch-build.1.gz 18 | -------------------------------------------------------------------------------- /src/kpatch/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test/unit/objs"] 2 | path = test/unit/objs 3 | url = https://github.com/dynup/kpatch-unit-test-objs.git 4 | -------------------------------------------------------------------------------- /src/kpatch/.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | before_install: 3 | - sudo apt-get -qq update 4 | - sudo apt-get install -y libelf-dev linux-headers-$(uname -r) shellcheck elfutils 5 | 6 | script: 7 | - make 8 | - make unit 9 | - make check 10 | - sudo make install 11 | -------------------------------------------------------------------------------- /src/kpatch/Makefile.inc: -------------------------------------------------------------------------------- 1 | SHELL = /bin/sh 2 | CC = gcc 3 | 4 | INSTALL = /usr/bin/install 5 | 6 | ARCH = $(shell uname -m) 7 | 8 | PREFIX ?= /usr/local 9 | LIBDIR ?= lib 10 | LIBEXEC ?= libexec 11 | BINDIR = $(DESTDIR)$(PREFIX)/bin 12 | SBINDIR = $(DESTDIR)$(PREFIX)/sbin 13 | MODULESDIR = $(DESTDIR)$(PREFIX)/$(LIBDIR)/kpatch 14 | LIBEXECDIR = $(DESTDIR)$(PREFIX)/$(LIBEXEC)/kpatch 15 | DATADIR = $(DESTDIR)$(PREFIX)/share/kpatch 16 | MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1 17 | SYSTEMDDIR = $(DESTDIR)$(PREFIX)/lib/systemd/system 18 | UPSTARTDIR = $(DESTDIR)/etc/init 19 | 20 | .PHONY: all install clean 21 | .DEFAULT: all 22 | -------------------------------------------------------------------------------- /src/kpatch/contrib/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.inc 2 | 3 | all: 4 | 5 | install: all 6 | $(INSTALL) -d $(SYSTEMDDIR) 7 | $(INSTALL) -m 0644 kpatch.service $(SYSTEMDDIR) 8 | sed -i 's~PREFIX~$(PREFIX)~' $(SYSTEMDDIR)/kpatch.service 9 | $(INSTALL) -d $(UPSTARTDIR) 10 | $(INSTALL) -m 0644 kpatch.conf $(UPSTARTDIR) 11 | sed -i 's~PREFIX~$(PREFIX)~' $(UPSTARTDIR)/kpatch.conf 12 | 13 | uninstall: 14 | $(RM) $(SYSTEMDDIR)/kpatch.service 15 | $(RM) $(UPSTARTDIR)/kpatch.conf 16 | 17 | clean: 18 | -------------------------------------------------------------------------------- /src/kpatch/contrib/kpatch.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description="Apply kpatch kernel patches" 3 | ConditionKernelCommandLine=!kpatch.enable=0 4 | Before=network-pre.target 5 | Wants=network-pre.target 6 | 7 | [Service] 8 | Type=oneshot 9 | RemainAfterExit=yes 10 | ExecStart=PREFIX/sbin/kpatch load --all 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /src/kpatch/kmod/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.inc 2 | KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build 3 | KERNELRELEASE := $(lastword $(subst /, , $(dir $(KPATCH_BUILD)))) 4 | 5 | all: clean 6 | ifeq ($(BUILDMOD),yes) 7 | $(MAKE) -C core 8 | endif 9 | 10 | install: 11 | ifeq ($(BUILDMOD),yes) 12 | $(INSTALL) -d $(MODULESDIR)/$(KERNELRELEASE) 13 | $(INSTALL) -m 644 core/kpatch.ko $(MODULESDIR)/$(KERNELRELEASE) 14 | $(INSTALL) -m 644 core/Module.symvers $(MODULESDIR)/$(KERNELRELEASE) 15 | endif 16 | $(INSTALL) -d $(DATADIR)/patch 17 | $(INSTALL) -m 644 patch/* $(DATADIR)/patch 18 | 19 | uninstall: 20 | ifeq ($(BUILDMOD),yes) 21 | $(RM) -R $(MODULESDIR) 22 | endif 23 | $(RM) -R $(DATADIR) 24 | 25 | clean: 26 | ifeq ($(BUILDMOD),yes) 27 | $(MAKE) -C core clean 28 | endif 29 | -------------------------------------------------------------------------------- /src/kpatch/kmod/core/Makefile: -------------------------------------------------------------------------------- 1 | # make rules 2 | KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build 3 | KERNELRELEASE := $(lastword $(subst /, , $(dir $(patsubst %/,%,$(KPATCH_BUILD))))) 4 | THISDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) 5 | 6 | ifeq ($(wildcard $(KPATCH_BUILD)),) 7 | $(error $(KPATCH_BUILD) doesn\'t exist. Try installing the kernel-devel-$(KERNELRELEASE) RPM or linux-headers-$(KERNELRELEASE) DEB.) 8 | endif 9 | 10 | KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(THISDIR) 11 | 12 | kpatch.ko: core.c 13 | $(KPATCH_MAKE) kpatch.ko 14 | 15 | all: kpatch.ko 16 | 17 | clean: 18 | $(RM) -Rf .*.o.cmd .*.ko.cmd .tmp_versions *.o *.ko *.mod.c \ 19 | Module.symvers 20 | 21 | 22 | # kbuild rules 23 | obj-m := kpatch.o 24 | kpatch-y := core.o shadow.o 25 | -------------------------------------------------------------------------------- /src/kpatch/kmod/patch/kpatch.h: -------------------------------------------------------------------------------- 1 | ../core/kpatch.h -------------------------------------------------------------------------------- /src/kpatch/kmod/patch/modules.order: -------------------------------------------------------------------------------- 1 | kernel//home/sujin/rs3-policy-aware-locks/src/kpatch/kmod/patch/.ko 2 | -------------------------------------------------------------------------------- /src/kpatch/kpatch-build/kpatch.h: -------------------------------------------------------------------------------- 1 | #ifndef _KPATCH_H_ 2 | #define _KPATCH_H_ 3 | 4 | enum exit_status { 5 | EXIT_STATUS_SUCCESS = 0, 6 | EXIT_STATUS_ERROR = 1, 7 | EXIT_STATUS_DIFF_FATAL = 2, 8 | EXIT_STATUS_NO_CHANGE = 3, 9 | }; 10 | 11 | #endif /* _KPATCH_H_ */ 12 | -------------------------------------------------------------------------------- /src/kpatch/kpatch-build/log.h: -------------------------------------------------------------------------------- 1 | #ifndef _LOG_H_ 2 | #define _LOG_H_ 3 | 4 | #include 5 | #include "kpatch.h" 6 | 7 | /* Files that include log.h must define loglevel and childobj */ 8 | extern enum loglevel loglevel; 9 | extern char *childobj; 10 | 11 | #define ERROR(format, ...) \ 12 | error(EXIT_STATUS_ERROR, 0, "ERROR: %s: %s: %d: " format, childobj, __FUNCTION__, __LINE__, ##__VA_ARGS__) 13 | 14 | #define log_debug(format, ...) log(DEBUG, format, ##__VA_ARGS__) 15 | #define log_normal(format, ...) log(NORMAL, "%s: " format, childobj, ##__VA_ARGS__) 16 | 17 | #define log(level, format, ...) \ 18 | ({ \ 19 | if (loglevel <= (level)) \ 20 | printf(format, ##__VA_ARGS__); \ 21 | }) 22 | 23 | enum loglevel { 24 | DEBUG, 25 | NORMAL 26 | }; 27 | #endif /* _LOG_H_ */ 28 | -------------------------------------------------------------------------------- /src/kpatch/kpatch-build/lookup.h: -------------------------------------------------------------------------------- 1 | #ifndef _LOOKUP_H_ 2 | #define _LOOKUP_H_ 3 | 4 | #include 5 | 6 | struct lookup_table; 7 | 8 | struct lookup_result { 9 | char *objname; 10 | unsigned long addr; 11 | unsigned long size; 12 | unsigned long sympos; 13 | bool global, exported; 14 | }; 15 | 16 | struct sym_compare_type { 17 | char *name; 18 | int type; 19 | }; 20 | 21 | struct lookup_table *lookup_open(char *symtab_path, char *objname, 22 | char *symvers_path, char *hint, 23 | struct sym_compare_type *locals); 24 | void lookup_close(struct lookup_table *table); 25 | bool lookup_symbol(struct lookup_table *table, char *name, 26 | struct lookup_result *result); 27 | 28 | #endif /* _LOOKUP_H_ */ 29 | -------------------------------------------------------------------------------- /src/kpatch/kpatch/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.inc 2 | 3 | all: 4 | 5 | install: all 6 | $(INSTALL) -d $(SBINDIR) 7 | $(INSTALL) kpatch $(SBINDIR) 8 | 9 | uninstall: 10 | $(RM) $(SBINDIR)/kpatch 11 | 12 | clean: 13 | -------------------------------------------------------------------------------- /src/kpatch/man/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.inc 2 | 3 | all: kpatch.1.gz kpatch-build.1.gz 4 | 5 | kpatch.1.gz: kpatch.1 6 | gzip -c -9 $< > $@ 7 | 8 | kpatch-build.1.gz: kpatch-build.1 9 | gzip -c -9 $< > $@ 10 | 11 | install: all 12 | $(INSTALL) -d $(MANDIR) 13 | $(INSTALL) -m 644 kpatch.1.gz $(MANDIR) 14 | $(INSTALL) -m 644 kpatch-build.1.gz $(MANDIR) 15 | 16 | uninstall: 17 | $(RM) $(MANDIR)/kpatch.1* 18 | $(RM) $(MANDIR)/kpatch-build.1* 19 | 20 | clean: 21 | $(RM) kpatch.1.gz 22 | $(RM) kpatch-build.1.gz 23 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/.gitignore: -------------------------------------------------------------------------------- 1 | test.log 2 | COMBINED.patch 3 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/centos-7: -------------------------------------------------------------------------------- 1 | rhel-7.8/ -------------------------------------------------------------------------------- /src/kpatch/test/integration/fedora-27/README: -------------------------------------------------------------------------------- 1 | 4.13.9-300.fc27.x86_64 2 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/fedora-27/data-new-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep "kpatch: 5" /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/fedora-27/data-new.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2017-11-17 15:58:41.113211972 -0500 3 | +++ src/fs/proc/meminfo.c 2017-11-17 15:58:58.554211972 -0500 4 | @@ -42,6 +42,8 @@ static void show_val_kb(struct seq_file 5 | seq_write(m, " kB\n", 4); 6 | } 7 | 8 | +static int foo = 5; 9 | + 10 | static int meminfo_proc_show(struct seq_file *m, void *v) 11 | { 12 | struct sysinfo i; 13 | @@ -153,6 +155,7 @@ static int meminfo_proc_show(struct seq_ 14 | show_val_kb(m, "CmaFree: ", 15 | global_page_state(NR_FREE_CMA_PAGES)); 16 | #endif 17 | + seq_printf(m, "kpatch: %d\n", foo); 18 | 19 | hugetlb_report_meminfo(m); 20 | 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/fedora-27/gcc-static-local-var-6.patch: -------------------------------------------------------------------------------- 1 | diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c 2 | index 9bf2604..026ac6c 100644 3 | --- a/net/ipv6/netfilter.c 4 | +++ b/net/ipv6/netfilter.c 5 | @@ -109,6 +109,8 @@ static int nf_ip6_reroute(struct net *net, struct sk_buff *skb, 6 | return 0; 7 | } 8 | 9 | +#include "kpatch-macros.h" 10 | + 11 | static int nf_ip6_route(struct net *net, struct dst_entry **dst, 12 | struct flowi *fl, bool strict) 13 | { 14 | @@ -122,6 +124,9 @@ static int nf_ip6_route(struct net *net, struct dst_entry **dst, 15 | struct dst_entry *result; 16 | int err; 17 | 18 | + if (!jiffies) 19 | + printk("kpatch nf_ip6_route foo\n"); 20 | + 21 | result = ip6_route_output(net, sk, &fl->u.ip6); 22 | err = result->error; 23 | if (err) 24 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW-LOADED.test.disabled: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep VMALLOCCHUNK /proc/meminfo && grep kpatch=1 /proc/cmdline 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/fedora-27/multiple.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" 4 | 5 | declare -a blacklist=(meminfo-cmdline-rebuild-SLOW-LOADED.test) 6 | 7 | source ${SCRIPTDIR}/../common/multiple.template 8 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/fedora-27/shadow-newpid-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep -q newpid: /proc/$$/status 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/fedora-27/warn-detect-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff --git a/net/core/dev.c b/net/core/dev.c 2 | index ef0cc6ea5f8d..9a840ec54270 100644 3 | --- a/net/core/dev.c 4 | +++ b/net/core/dev.c 5 | @@ -1,3 +1,4 @@ 6 | + 7 | /* 8 | * NET3 Protocol independent device support routines. 9 | * 10 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/bug-table-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src.orig/fs/proc/proc_sysctl.c 2017-09-22 15:27:21.698056175 -0400 3 | +++ src/fs/proc/proc_sysctl.c 2017-09-22 15:27:21.769056469 -0400 4 | @@ -266,6 +266,8 @@ void sysctl_head_put(struct ctl_table_he 5 | 6 | static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 7 | { 8 | + if (jiffies == 0) 9 | + printk("kpatch-test: testing __bug_table section changes\n"); 10 | BUG_ON(!head); 11 | spin_lock(&sysctl_lock); 12 | if (!use_table(head)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/cmdline-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep kpatch=1 /proc/cmdline 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/cmdline-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c 2 | --- src.orig/fs/proc/cmdline.c 2017-09-22 15:27:21.698056175 -0400 3 | +++ src/fs/proc/cmdline.c 2017-09-22 15:27:22.955061380 -0400 4 | @@ -5,7 +5,7 @@ 5 | 6 | static int cmdline_proc_show(struct seq_file *m, void *v) 7 | { 8 | - seq_printf(m, "%s\n", saved_command_line); 9 | + seq_printf(m, "%s kpatch=1\n", saved_command_line); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/data-new-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep "kpatch: 5" /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/data-read-mostly.patch.disabled: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/net/core/dev.c src/net/core/dev.c 2 | --- src.orig/net/core/dev.c 2017-09-22 15:27:21.759056428 -0400 3 | +++ src/net/core/dev.c 2017-09-22 15:27:25.244070859 -0400 4 | @@ -4012,6 +4012,7 @@ ncls: 5 | case RX_HANDLER_PASS: 6 | break; 7 | default: 8 | + printk("BUG!\n"); 9 | BUG(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/fixup-section.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/readdir.c b/fs/readdir.c 2 | index fee38e04fae4..bce1e5ce74e5 100644 3 | --- a/fs/readdir.c 4 | +++ b/fs/readdir.c 5 | @@ -166,6 +166,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, 6 | goto efault; 7 | } 8 | dirent = buf->current_dir; 9 | + asm("nop"); 10 | if (__put_user(d_ino, &dirent->d_ino)) 11 | goto efault; 12 | if (__put_user(reclen, &dirent->d_reclen)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/gcc-constprop.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/time/timekeeping.c src/kernel/time/timekeeping.c 2 | --- src.orig/kernel/time/timekeeping.c 2017-09-22 15:27:21.602055778 -0400 3 | +++ src/kernel/time/timekeeping.c 2017-09-22 15:27:27.522080292 -0400 4 | @@ -877,6 +877,9 @@ void do_gettimeofday(struct timeval *tv) 5 | { 6 | struct timespec64 now; 7 | 8 | + if (!tv) 9 | + return; 10 | + 11 | getnstimeofday64(&now); 12 | tv->tv_sec = now.tv_sec; 13 | tv->tv_usec = now.tv_nsec/1000; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/gcc-isra.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src.orig/fs/proc/proc_sysctl.c 2017-09-22 15:27:21.698056175 -0400 3 | +++ src/fs/proc/proc_sysctl.c 2017-09-22 15:27:28.670085046 -0400 4 | @@ -24,6 +24,7 @@ void proc_sys_poll_notify(struct ctl_tab 5 | if (!poll) 6 | return; 7 | 8 | + printk("kpatch-test: testing gcc .isra function name mangling\n"); 9 | atomic_inc(&poll->event); 10 | wake_up_interruptible(&poll->wait); 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/gcc-mangled-3.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/mm/slub.c src/mm/slub.c 2 | --- src.orig/mm/slub.c 2017-09-22 15:27:21.618055844 -0400 3 | +++ src/mm/slub.c 2017-09-22 15:27:29.830089850 -0400 4 | @@ -5528,6 +5528,9 @@ void get_slabinfo(struct kmem_cache *s, 5 | unsigned long nr_free = 0; 6 | int node; 7 | 8 | + if (!jiffies) 9 | + printk("slabinfo\n"); 10 | + 11 | for_each_online_node(node) { 12 | struct kmem_cache_node *n = get_node(s, node); 13 | 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/gcc-static-local-var-2.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/mm/mmap.c src/mm/mmap.c 2 | --- src.orig/mm/mmap.c 2017-09-22 15:27:21.618055844 -0400 3 | +++ src/mm/mmap.c 2017-09-22 15:27:31.024094794 -0400 4 | @@ -1687,6 +1688,9 @@ unsigned long mmap_region(struct file *f 5 | struct rb_node **rb_link, *rb_parent; 6 | unsigned long charged = 0; 7 | 8 | + if (!jiffies) 9 | + printk("kpatch mmap foo\n"); 10 | + 11 | /* Check against address space limit. */ 12 | if (!may_expand_vm(mm, len >> PAGE_SHIFT)) { 13 | unsigned long nr_pages; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/gcc-static-local-var-3.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/sys.c src/kernel/sys.c 2 | --- src.orig/kernel/sys.c 2017-09-22 15:27:21.601055773 -0400 3 | +++ src/kernel/sys.c 2017-09-22 15:27:32.170099540 -0400 4 | @@ -554,8 +554,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int 5 | return ret; 6 | } 7 | 8 | +void kpatch_bar(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch_foo\n"); 12 | +} 13 | + 14 | static void deferred_cad(struct work_struct *dummy) 15 | { 16 | + kpatch_bar(); 17 | kernel_restart(NULL); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/gcc-static-local-var-4.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/aio.c src/fs/aio.c 2 | --- src.orig/fs/aio.c 2017-09-22 15:27:21.702056192 -0400 3 | +++ src/fs/aio.c 2017-09-22 15:27:33.299104215 -0400 4 | @@ -219,9 +219,16 @@ static int __init aio_setup(void) 5 | } 6 | __initcall(aio_setup); 7 | 8 | +void kpatch_aio_foo(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch aio foo\n"); 12 | +} 13 | + 14 | static void put_aio_ring_file(struct kioctx *ctx) 15 | { 16 | struct file *aio_ring_file = ctx->aio_ring_file; 17 | + kpatch_aio_foo(); 18 | if (aio_ring_file) { 19 | truncate_setsize(aio_ring_file->f_inode, 0); 20 | 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/gcc-static-local-var-4.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o pipefail 4 | if ! $(eu-readelf --wide --symbols test-gcc-static-local-var-4.ko | awk '$NF == "free_ioctx" { exit 1 }'); then 5 | exit 1 6 | else 7 | exit 0 8 | fi 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/gcc-static-local-var-6.patch: -------------------------------------------------------------------------------- 1 | diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c 2 | index a9d587a..23336ed 100644 3 | --- a/net/ipv6/netfilter.c 4 | +++ b/net/ipv6/netfilter.c 5 | @@ -106,6 +106,8 @@ static int nf_ip6_reroute(struct sk_buff *skb, 6 | return 0; 7 | } 8 | 9 | +#include "kpatch-macros.h" 10 | + 11 | static int nf_ip6_route(struct net *net, struct dst_entry **dst, 12 | struct flowi *fl, bool strict) 13 | { 14 | @@ -119,6 +121,9 @@ static int nf_ip6_route(struct net *net, struct dst_entry **dst, 15 | struct dst_entry *result; 16 | int err; 17 | 18 | + if (!jiffies) 19 | + printk("kpatch nf_ip6_route foo\n"); 20 | + 21 | result = ip6_route_output(net, sk, &fl->u.ip6); 22 | err = result->error; 23 | if (err) 24 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/meminfo-init-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2017-09-22 15:27:21.699056179 -0400 3 | +++ src/fs/proc/meminfo.c 2017-09-22 15:27:40.130132502 -0400 4 | @@ -191,6 +191,7 @@ static const struct file_operations memi 5 | 6 | static int __init proc_meminfo_init(void) 7 | { 8 | + printk("a\n"); 9 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/meminfo-init2-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2017-09-22 15:27:21.699056179 -0400 3 | +++ src/fs/proc/meminfo.c 2017-09-22 15:27:38.972127707 -0400 4 | @@ -30,6 +30,7 @@ static int meminfo_proc_show(struct seq_ 5 | unsigned long pages[NR_LRU_LISTS]; 6 | int lru; 7 | 8 | + printk("a\n"); 9 | /* 10 | * display in kilobytes. 11 | */ 12 | @@ -191,6 +192,7 @@ static const struct file_operations memi 13 | 14 | static int __init proc_meminfo_init(void) 15 | { 16 | + printk("a\n"); 17 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/meminfo-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep VMALLOCCHUNK /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/meminfo-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2017-09-22 15:27:21.699056179 -0400 3 | +++ src/fs/proc/meminfo.c 2017-09-22 15:27:41.274137239 -0400 4 | @@ -99,7 +99,7 @@ static int meminfo_proc_show(struct seq_ 5 | "Committed_AS: %8lu kB\n" 6 | "VmallocTotal: %8lu kB\n" 7 | "VmallocUsed: %8lu kB\n" 8 | - "VmallocChunk: %8lu kB\n" 9 | + "VMALLOCCHUNK: %8lu kB\n" 10 | #ifdef CONFIG_MEMORY_FAILURE 11 | "HardwareCorrupted: %5lu kB\n" 12 | #endif 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/module-kvm-fixup.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/vmx.c src/arch/x86/kvm/vmx.c 2 | --- src.orig/arch/x86/kvm/vmx.c 2017-09-22 15:27:20.853052676 -0400 3 | +++ src/arch/x86/kvm/vmx.c 2017-09-22 15:27:43.583146801 -0400 4 | @@ -10597,6 +10597,8 @@ static int vmx_check_intercept(struct kv 5 | struct x86_instruction_info *info, 6 | enum x86_intercept_stage stage) 7 | { 8 | + if (!jiffies) 9 | + printk("kpatch vmx_check_intercept\n"); 10 | return X86EMUL_CONTINUE; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/multiple.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" 4 | 5 | declare -a blacklist=(meminfo-string-LOADED.test) 6 | 7 | source ${SCRIPTDIR}/../common/multiple.template 8 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/parainstructions-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/generic.c src/fs/proc/generic.c 2 | --- src.orig/fs/proc/generic.c 2017-09-22 15:27:21.698056175 -0400 3 | +++ src/fs/proc/generic.c 2017-09-22 15:27:48.190165879 -0400 4 | @@ -194,6 +194,7 @@ int proc_alloc_inum(unsigned int *inum) 5 | unsigned int i; 6 | int error; 7 | 8 | + printk("kpatch-test: testing change to .parainstructions section\n"); 9 | retry: 10 | if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL)) 11 | return -ENOMEM; 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/replace-section-references.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c 2 | --- src.orig/arch/x86/kvm/x86.c 2017-09-22 15:27:20.852052672 -0400 3 | +++ src/arch/x86/kvm/x86.c 2017-09-22 15:27:49.362170732 -0400 4 | @@ -248,6 +248,8 @@ static void shared_msr_update(unsigned s 5 | 6 | void kvm_define_shared_msr(unsigned slot, u32 msr) 7 | { 8 | + if (!jiffies) 9 | + printk("kpatch kvm define shared msr\n"); 10 | BUG_ON(slot >= KVM_NR_SHARED_MSRS); 11 | shared_msrs_global.msrs[slot] = msr; 12 | if (slot >= shared_msrs_global.nr) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/shadow-newpid-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep -q newpid: /proc/$$/status 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/smp-locks-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/drivers/tty/tty_buffer.c src/drivers/tty/tty_buffer.c 2 | --- src.orig/drivers/tty/tty_buffer.c 2017-09-22 15:27:21.077053604 -0400 3 | +++ src/drivers/tty/tty_buffer.c 2017-09-22 15:27:50.542175618 -0400 4 | @@ -217,6 +217,10 @@ int tty_buffer_request_room(struct tty_p 5 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to 6 | remove this conditional if its worth it. This would be invisible 7 | to the callers */ 8 | + 9 | + if (!size) 10 | + printk("kpatch-test: testing .smp_locks section changes\n"); 11 | + 12 | b = buf->tail; 13 | if (b != NULL) 14 | left = b->size - b->used; 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/special-static.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/fork.c src/kernel/fork.c 2 | --- src.orig/kernel/fork.c 2017-09-22 15:27:21.600055769 -0400 3 | +++ src/kernel/fork.c 2017-09-22 15:27:53.052186012 -0400 4 | @@ -1129,10 +1129,18 @@ static void posix_cpu_timers_init_group( 5 | INIT_LIST_HEAD(&sig->cpu_timers[2]); 6 | } 7 | 8 | +void kpatch_foo(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch copy signal\n"); 12 | +} 13 | + 14 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 15 | { 16 | struct signal_struct *sig; 17 | 18 | + kpatch_foo(); 19 | + 20 | if (clone_flags & CLONE_THREAD) 21 | return 0; 22 | 23 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/tracepoints-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/timer.c src/kernel/timer.c 2 | --- src.orig/kernel/timer.c 2017-09-22 15:27:21.600055769 -0400 3 | +++ src/kernel/timer.c 2017-09-22 15:27:54.288191131 -0400 4 | @@ -1390,6 +1390,9 @@ static void run_timer_softirq(struct sof 5 | { 6 | struct tvec_base *base = __this_cpu_read(tvec_bases); 7 | 8 | + if (!base) 9 | + printk("kpatch-test: testing __tracepoints section changes\n"); 10 | + 11 | if (time_after_eq(jiffies, base->timer_jiffies)) 12 | __run_timers(base); 13 | } 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.4/warn-detect-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c 2 | --- src.orig/arch/x86/kvm/x86.c 2017-09-22 15:27:20.852052672 -0400 3 | +++ src/arch/x86/kvm/x86.c 2017-09-22 15:27:55.489196104 -0400 4 | @@ -1,3 +1,4 @@ 5 | + 6 | /* 7 | * Kernel-based Virtual Machine driver for Linux 8 | * 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/bug-table-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src.orig/fs/proc/proc_sysctl.c 2017-09-22 15:27:21.698056175 -0400 3 | +++ src/fs/proc/proc_sysctl.c 2017-09-22 15:27:21.769056469 -0400 4 | @@ -266,6 +266,8 @@ void sysctl_head_put(struct ctl_table_he 5 | 6 | static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 7 | { 8 | + if (jiffies == 0) 9 | + printk("kpatch-test: testing __bug_table section changes\n"); 10 | BUG_ON(!head); 11 | spin_lock(&sysctl_lock); 12 | if (!use_table(head)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/cmdline-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep kpatch=1 /proc/cmdline 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/cmdline-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c 2 | --- src.orig/fs/proc/cmdline.c 2017-09-22 15:27:21.698056175 -0400 3 | +++ src/fs/proc/cmdline.c 2017-09-22 15:27:22.955061380 -0400 4 | @@ -5,7 +5,7 @@ 5 | 6 | static int cmdline_proc_show(struct seq_file *m, void *v) 7 | { 8 | - seq_printf(m, "%s\n", saved_command_line); 9 | + seq_printf(m, "%s kpatch=1\n", saved_command_line); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/data-new-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep "kpatch: 5" /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/data-read-mostly.patch.disabled: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/net/core/dev.c src/net/core/dev.c 2 | --- src.orig/net/core/dev.c 2017-09-22 15:27:21.759056428 -0400 3 | +++ src/net/core/dev.c 2017-09-22 15:27:25.244070859 -0400 4 | @@ -4012,6 +4012,7 @@ ncls: 5 | case RX_HANDLER_PASS: 6 | break; 7 | default: 8 | + printk("BUG!\n"); 9 | BUG(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/fixup-section.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/readdir.c b/fs/readdir.c 2 | index febd02dfbe2d..064db7bd70d0 100644 3 | --- a/fs/readdir.c 4 | +++ b/fs/readdir.c 5 | @@ -176,6 +176,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, 6 | goto efault; 7 | } 8 | dirent = buf->current_dir; 9 | + asm("nop"); 10 | if (__put_user(d_ino, &dirent->d_ino)) 11 | goto efault; 12 | if (__put_user(reclen, &dirent->d_reclen)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/gcc-constprop.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/time/timekeeping.c src/kernel/time/timekeeping.c 2 | --- src.orig/kernel/time/timekeeping.c 2017-09-22 15:27:21.602055778 -0400 3 | +++ src/kernel/time/timekeeping.c 2017-09-22 15:27:27.522080292 -0400 4 | @@ -877,6 +877,9 @@ void do_gettimeofday(struct timeval *tv) 5 | { 6 | struct timespec64 now; 7 | 8 | + if (!tv) 9 | + return; 10 | + 11 | getnstimeofday64(&now); 12 | tv->tv_sec = now.tv_sec; 13 | tv->tv_usec = now.tv_nsec/1000; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/gcc-isra.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src.orig/fs/proc/proc_sysctl.c 2017-09-22 15:27:21.698056175 -0400 3 | +++ src/fs/proc/proc_sysctl.c 2017-09-22 15:27:28.670085046 -0400 4 | @@ -24,6 +24,7 @@ void proc_sys_poll_notify(struct ctl_tab 5 | if (!poll) 6 | return; 7 | 8 | + printk("kpatch-test: testing gcc .isra function name mangling\n"); 9 | atomic_inc(&poll->event); 10 | wake_up_interruptible(&poll->wait); 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/gcc-mangled-3.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/mm/slub.c src/mm/slub.c 2 | --- src.orig/mm/slub.c 2017-09-22 15:27:21.618055844 -0400 3 | +++ src/mm/slub.c 2017-09-22 15:27:29.830089850 -0400 4 | @@ -5528,6 +5528,9 @@ void get_slabinfo(struct kmem_cache *s, 5 | unsigned long nr_free = 0; 6 | int node; 7 | 8 | + if (!jiffies) 9 | + printk("slabinfo\n"); 10 | + 11 | for_each_online_node(node) { 12 | struct kmem_cache_node *n = get_node(s, node); 13 | 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/gcc-static-local-var-2.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/mm/mmap.c src/mm/mmap.c 2 | --- src.orig/mm/mmap.c 2017-09-22 15:27:21.618055844 -0400 3 | +++ src/mm/mmap.c 2017-09-22 15:27:31.024094794 -0400 4 | @@ -1687,6 +1688,9 @@ unsigned long mmap_region(struct file *f 5 | struct rb_node **rb_link, *rb_parent; 6 | unsigned long charged = 0; 7 | 8 | + if (!jiffies) 9 | + printk("kpatch mmap foo\n"); 10 | + 11 | /* Check against address space limit. */ 12 | if (!may_expand_vm(mm, len >> PAGE_SHIFT)) { 13 | unsigned long nr_pages; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/gcc-static-local-var-3.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/sys.c src/kernel/sys.c 2 | --- src.orig/kernel/sys.c 2017-09-22 15:27:21.601055773 -0400 3 | +++ src/kernel/sys.c 2017-09-22 15:27:32.170099540 -0400 4 | @@ -554,8 +554,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int 5 | return ret; 6 | } 7 | 8 | +void kpatch_bar(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch_foo\n"); 12 | +} 13 | + 14 | static void deferred_cad(struct work_struct *dummy) 15 | { 16 | + kpatch_bar(); 17 | kernel_restart(NULL); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/gcc-static-local-var-4.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/aio.c src/fs/aio.c 2 | --- src.orig/fs/aio.c 2017-09-22 15:27:21.702056192 -0400 3 | +++ src/fs/aio.c 2017-09-22 15:27:33.299104215 -0400 4 | @@ -219,9 +219,16 @@ static int __init aio_setup(void) 5 | } 6 | __initcall(aio_setup); 7 | 8 | +void kpatch_aio_foo(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch aio foo\n"); 12 | +} 13 | + 14 | static void put_aio_ring_file(struct kioctx *ctx) 15 | { 16 | struct file *aio_ring_file = ctx->aio_ring_file; 17 | + kpatch_aio_foo(); 18 | if (aio_ring_file) { 19 | truncate_setsize(aio_ring_file->f_inode, 0); 20 | 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/gcc-static-local-var-4.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o pipefail 4 | if ! $(eu-readelf --wide --symbols test-gcc-static-local-var-4.ko | awk '$NF == "free_ioctx" { exit 1 }'); then 5 | exit 1 6 | else 7 | exit 0 8 | fi 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/gcc-static-local-var-6.patch: -------------------------------------------------------------------------------- 1 | diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c 2 | index a9d587a..23336ed 100644 3 | --- a/net/ipv6/netfilter.c 4 | +++ b/net/ipv6/netfilter.c 5 | @@ -106,6 +106,8 @@ static int nf_ip6_reroute(struct sk_buff *skb, 6 | return 0; 7 | } 8 | 9 | +#include "kpatch-macros.h" 10 | + 11 | static int nf_ip6_route(struct net *net, struct dst_entry **dst, 12 | struct flowi *fl, bool strict) 13 | { 14 | @@ -119,6 +121,9 @@ static int nf_ip6_route(struct net *net, struct dst_entry **dst, 15 | struct dst_entry *result; 16 | int err; 17 | 18 | + if (!jiffies) 19 | + printk("kpatch nf_ip6_route foo\n"); 20 | + 21 | result = ip6_route_output(net, sk, &fl->u.ip6); 22 | err = result->error; 23 | if (err) 24 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/meminfo-init-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2017-09-22 15:27:21.699056179 -0400 3 | +++ src/fs/proc/meminfo.c 2017-09-22 15:27:40.130132502 -0400 4 | @@ -191,6 +191,7 @@ static const struct file_operations memi 5 | 6 | static int __init proc_meminfo_init(void) 7 | { 8 | + printk("a\n"); 9 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/meminfo-init2-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2017-09-22 15:27:21.699056179 -0400 3 | +++ src/fs/proc/meminfo.c 2017-09-22 15:27:38.972127707 -0400 4 | @@ -30,6 +30,7 @@ static int meminfo_proc_show(struct seq_ 5 | unsigned long pages[NR_LRU_LISTS]; 6 | int lru; 7 | 8 | + printk("a\n"); 9 | /* 10 | * display in kilobytes. 11 | */ 12 | @@ -191,6 +192,7 @@ static const struct file_operations memi 13 | 14 | static int __init proc_meminfo_init(void) 15 | { 16 | + printk("a\n"); 17 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/meminfo-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep VMALLOCCHUNK /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/meminfo-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2017-09-22 15:27:21.699056179 -0400 3 | +++ src/fs/proc/meminfo.c 2017-09-22 15:27:41.274137239 -0400 4 | @@ -99,7 +99,7 @@ static int meminfo_proc_show(struct seq_ 5 | "Committed_AS: %8lu kB\n" 6 | "VmallocTotal: %8lu kB\n" 7 | "VmallocUsed: %8lu kB\n" 8 | - "VmallocChunk: %8lu kB\n" 9 | + "VMALLOCCHUNK: %8lu kB\n" 10 | #ifdef CONFIG_MEMORY_FAILURE 11 | "HardwareCorrupted: %5lu kB\n" 12 | #endif 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/module-kvm-fixup.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/vmx.c src/arch/x86/kvm/vmx.c 2 | --- src.orig/arch/x86/kvm/vmx.c 2017-09-22 15:27:20.853052676 -0400 3 | +++ src/arch/x86/kvm/vmx.c 2017-09-22 15:27:43.583146801 -0400 4 | @@ -10597,6 +10597,8 @@ static int vmx_check_intercept(struct kv 5 | struct x86_instruction_info *info, 6 | enum x86_intercept_stage stage) 7 | { 8 | + if (!jiffies) 9 | + printk("kpatch vmx_check_intercept\n"); 10 | return X86EMUL_CONTINUE; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/multiple.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" 4 | 5 | declare -a blacklist=(meminfo-string-LOADED.test) 6 | 7 | source ${SCRIPTDIR}/../common/multiple.template 8 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/parainstructions-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/generic.c src/fs/proc/generic.c 2 | --- src.orig/fs/proc/generic.c 2017-09-22 15:27:21.698056175 -0400 3 | +++ src/fs/proc/generic.c 2017-09-22 15:27:48.190165879 -0400 4 | @@ -194,6 +194,7 @@ int proc_alloc_inum(unsigned int *inum) 5 | unsigned int i; 6 | int error; 7 | 8 | + printk("kpatch-test: testing change to .parainstructions section\n"); 9 | retry: 10 | if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL)) 11 | return -ENOMEM; 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/replace-section-references.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c 2 | --- src.orig/arch/x86/kvm/x86.c 2017-09-22 15:27:20.852052672 -0400 3 | +++ src/arch/x86/kvm/x86.c 2017-09-22 15:27:49.362170732 -0400 4 | @@ -248,6 +248,8 @@ static void shared_msr_update(unsigned s 5 | 6 | void kvm_define_shared_msr(unsigned slot, u32 msr) 7 | { 8 | + if (!jiffies) 9 | + printk("kpatch kvm define shared msr\n"); 10 | BUG_ON(slot >= KVM_NR_SHARED_MSRS); 11 | shared_msrs_global.msrs[slot] = msr; 12 | if (slot >= shared_msrs_global.nr) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/shadow-newpid-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep -q newpid: /proc/$$/status 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/smp-locks-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/drivers/tty/tty_buffer.c src/drivers/tty/tty_buffer.c 2 | --- src.orig/drivers/tty/tty_buffer.c 2017-09-22 15:27:21.077053604 -0400 3 | +++ src/drivers/tty/tty_buffer.c 2017-09-22 15:27:50.542175618 -0400 4 | @@ -217,6 +217,10 @@ int tty_buffer_request_room(struct tty_p 5 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to 6 | remove this conditional if its worth it. This would be invisible 7 | to the callers */ 8 | + 9 | + if (!size) 10 | + printk("kpatch-test: testing .smp_locks section changes\n"); 11 | + 12 | b = buf->tail; 13 | if (b != NULL) 14 | left = b->size - b->used; 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/special-static.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/fork.c src/kernel/fork.c 2 | --- src.orig/kernel/fork.c 2017-09-22 15:27:21.600055769 -0400 3 | +++ src/kernel/fork.c 2017-09-22 15:27:53.052186012 -0400 4 | @@ -1129,10 +1129,18 @@ static void posix_cpu_timers_init_group( 5 | INIT_LIST_HEAD(&sig->cpu_timers[2]); 6 | } 7 | 8 | +void kpatch_foo(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch copy signal\n"); 12 | +} 13 | + 14 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 15 | { 16 | struct signal_struct *sig; 17 | 18 | + kpatch_foo(); 19 | + 20 | if (clone_flags & CLONE_THREAD) 21 | return 0; 22 | 23 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/tracepoints-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/timer.c src/kernel/timer.c 2 | --- src.orig/kernel/timer.c 2017-09-22 15:27:21.600055769 -0400 3 | +++ src/kernel/timer.c 2017-09-22 15:27:54.288191131 -0400 4 | @@ -1390,6 +1390,9 @@ static void run_timer_softirq(struct sof 5 | { 6 | struct tvec_base *base = __this_cpu_read(tvec_bases); 7 | 8 | + if (!base) 9 | + printk("kpatch-test: testing __tracepoints section changes\n"); 10 | + 11 | if (time_after_eq(jiffies, base->timer_jiffies)) 12 | __run_timers(base); 13 | } 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.5/warn-detect-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c 2 | --- src.orig/arch/x86/kvm/x86.c 2017-09-22 15:27:20.852052672 -0400 3 | +++ src/arch/x86/kvm/x86.c 2017-09-22 15:27:55.489196104 -0400 4 | @@ -1,3 +1,4 @@ 5 | + 6 | /* 7 | * Kernel-based Virtual Machine driver for Linux 8 | * 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/bug-table-section.patch: -------------------------------------------------------------------------------- 1 | Index: kernel-rhel7/fs/proc/proc_sysctl.c 2 | =================================================================== 3 | --- kernel-rhel7.orig/fs/proc/proc_sysctl.c 4 | +++ kernel-rhel7/fs/proc/proc_sysctl.c 5 | @@ -301,6 +301,8 @@ void sysctl_head_put(struct ctl_table_he 6 | 7 | static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 8 | { 9 | + if (jiffies == 0) 10 | + printk("kpatch-test: testing __bug_table section changes\n"); 11 | BUG_ON(!head); 12 | spin_lock(&sysctl_lock); 13 | if (!use_table(head)) 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/cmdline-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep kpatch=1 /proc/cmdline 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/cmdline-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c 2 | --- src.orig/fs/proc/cmdline.c 2017-09-22 15:27:21.698056175 -0400 3 | +++ src/fs/proc/cmdline.c 2017-09-22 15:27:22.955061380 -0400 4 | @@ -5,7 +5,7 @@ 5 | 6 | static int cmdline_proc_show(struct seq_file *m, void *v) 7 | { 8 | - seq_printf(m, "%s\n", saved_command_line); 9 | + seq_printf(m, "%s kpatch=1\n", saved_command_line); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/data-new-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep "kpatch: 5" /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/data-read-mostly.patch.disabled: -------------------------------------------------------------------------------- 1 | Index: kernel-rhel7/net/core/dev.c 2 | =================================================================== 3 | --- kernel-rhel7.orig/net/core/dev.c 4 | +++ kernel-rhel7/net/core/dev.c 5 | @@ -4199,6 +4199,7 @@ skip_classify: 6 | case RX_HANDLER_PASS: 7 | break; 8 | default: 9 | + printk("BUG!\n"); 10 | BUG(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/fixup-section.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/readdir.c b/fs/readdir.c 2 | index febd02dfbe2d..064db7bd70d0 100644 3 | --- a/fs/readdir.c 4 | +++ b/fs/readdir.c 5 | @@ -176,6 +176,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, 6 | goto efault; 7 | } 8 | dirent = buf->current_dir; 9 | + asm("nop"); 10 | if (__put_user(d_ino, &dirent->d_ino)) 11 | goto efault; 12 | if (__put_user(reclen, &dirent->d_reclen)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/gcc-constprop.patch.disabled: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/time/timekeeping.c src/kernel/time/timekeeping.c 2 | --- src.orig/kernel/time/timekeeping.c 2017-09-22 15:27:21.602055778 -0400 3 | +++ src/kernel/time/timekeeping.c 2017-09-22 15:27:27.522080292 -0400 4 | @@ -877,6 +877,9 @@ void do_gettimeofday(struct timeval *tv) 5 | { 6 | struct timespec64 now; 7 | 8 | + if (!tv) 9 | + return; 10 | + 11 | getnstimeofday64(&now); 12 | tv->tv_sec = now.tv_sec; 13 | tv->tv_usec = now.tv_nsec/1000; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/gcc-isra.patch: -------------------------------------------------------------------------------- 1 | Index: kernel-rhel7/fs/proc/proc_sysctl.c 2 | =================================================================== 3 | --- kernel-rhel7.orig/fs/proc/proc_sysctl.c 4 | +++ kernel-rhel7/fs/proc/proc_sysctl.c 5 | @@ -46,6 +46,7 @@ void proc_sys_poll_notify(struct ctl_tab 6 | if (!poll) 7 | return; 8 | 9 | + printk("kpatch-test: testing gcc .isra function name mangling\n"); 10 | atomic_inc(&poll->event); 11 | wake_up_interruptible(&poll->wait); 12 | } 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/gcc-mangled-3.patch: -------------------------------------------------------------------------------- 1 | Index: kernel-rhel7/mm/slub.c 2 | =================================================================== 3 | --- kernel-rhel7.orig/mm/slub.c 4 | +++ kernel-rhel7/mm/slub.c 5 | @@ -5611,6 +5611,9 @@ void get_slabinfo(struct kmem_cache *s, 6 | unsigned long nr_free = 0; 7 | int node; 8 | 9 | + if (!jiffies) 10 | + printk("slabinfo\n"); 11 | + 12 | for_each_online_node(node) { 13 | struct kmem_cache_node *n = get_node(s, node); 14 | 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/gcc-static-local-var-2.patch: -------------------------------------------------------------------------------- 1 | Index: kernel-rhel7/mm/mmap.c 2 | =================================================================== 3 | --- kernel-rhel7.orig/mm/mmap.c 4 | +++ kernel-rhel7/mm/mmap.c 5 | @@ -1715,6 +1715,9 @@ unsigned long mmap_region(struct file *f 6 | struct rb_node **rb_link, *rb_parent; 7 | unsigned long charged = 0; 8 | 9 | + if (!jiffies) 10 | + printk("kpatch mmap foo\n"); 11 | + 12 | /* Check against address space limit. */ 13 | if (!may_expand_vm(mm, len >> PAGE_SHIFT)) { 14 | unsigned long nr_pages; 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/gcc-static-local-var-3.patch: -------------------------------------------------------------------------------- 1 | Index: kernel-rhel7/kernel/sys.c 2 | =================================================================== 3 | --- kernel-rhel7.orig/kernel/sys.c 4 | +++ kernel-rhel7/kernel/sys.c 5 | @@ -559,8 +559,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int 6 | return ret; 7 | } 8 | 9 | +void kpatch_bar(void) 10 | +{ 11 | + if (!jiffies) 12 | + printk("kpatch_foo\n"); 13 | +} 14 | + 15 | static void deferred_cad(struct work_struct *dummy) 16 | { 17 | + kpatch_bar(); 18 | kernel_restart(NULL); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/gcc-static-local-var-4.patch: -------------------------------------------------------------------------------- 1 | Index: kernel-rhel7/fs/aio.c 2 | =================================================================== 3 | --- kernel-rhel7.orig/fs/aio.c 4 | +++ kernel-rhel7/fs/aio.c 5 | @@ -223,9 +223,16 @@ static int __init aio_setup(void) 6 | } 7 | __initcall(aio_setup); 8 | 9 | +void kpatch_aio_foo(void) 10 | +{ 11 | + if (!jiffies) 12 | + printk("kpatch aio foo\n"); 13 | +} 14 | + 15 | static void put_aio_ring_file(struct kioctx *ctx) 16 | { 17 | struct file *aio_ring_file = ctx->aio_ring_file; 18 | + kpatch_aio_foo(); 19 | if (aio_ring_file) { 20 | truncate_setsize(aio_ring_file->f_inode, 0); 21 | 22 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/gcc-static-local-var-4.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o pipefail 4 | if ! $(eu-readelf --wide --symbols test-gcc-static-local-var-4.ko | awk '$NF == "free_ioctx" { exit 1 }'); then 5 | exit 1 6 | else 7 | exit 0 8 | fi 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/gcc-static-local-var-6.patch: -------------------------------------------------------------------------------- 1 | diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c 2 | index a9d587a..23336ed 100644 3 | --- a/net/ipv6/netfilter.c 4 | +++ b/net/ipv6/netfilter.c 5 | @@ -106,6 +106,8 @@ static int nf_ip6_reroute(struct sk_buff *skb, 6 | return 0; 7 | } 8 | 9 | +#include "kpatch-macros.h" 10 | + 11 | static int nf_ip6_route(struct net *net, struct dst_entry **dst, 12 | struct flowi *fl, bool strict) 13 | { 14 | @@ -119,6 +121,9 @@ static int nf_ip6_route(struct net *net, struct dst_entry **dst, 15 | struct dst_entry *result; 16 | int err; 17 | 18 | + if (!jiffies) 19 | + printk("kpatch nf_ip6_route foo\n"); 20 | + 21 | result = ip6_route_output(net, sk, &fl->u.ip6); 22 | err = result->error; 23 | if (err) 24 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/meminfo-init-FAIL.patch: -------------------------------------------------------------------------------- 1 | Index: kernel-rhel7/fs/proc/meminfo.c 2 | =================================================================== 3 | --- kernel-rhel7.orig/fs/proc/meminfo.c 4 | +++ kernel-rhel7/fs/proc/meminfo.c 5 | @@ -199,6 +199,7 @@ static const struct file_operations memi 6 | 7 | static int __init proc_meminfo_init(void) 8 | { 9 | + printk("a\n"); 10 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/meminfo-init2-FAIL.patch: -------------------------------------------------------------------------------- 1 | Index: kernel-rhel7/fs/proc/meminfo.c 2 | =================================================================== 3 | --- kernel-rhel7.orig/fs/proc/meminfo.c 4 | +++ kernel-rhel7/fs/proc/meminfo.c 5 | @@ -30,6 +30,7 @@ static int meminfo_proc_show(struct seq_ 6 | unsigned long pages[NR_LRU_LISTS]; 7 | int lru; 8 | 9 | + printk("a\n"); 10 | /* 11 | * display in kilobytes. 12 | */ 13 | @@ -199,6 +200,7 @@ static const struct file_operations memi 14 | 15 | static int __init proc_meminfo_init(void) 16 | { 17 | + printk("a\n"); 18 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/meminfo-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep VMALLOCCHUNK /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/meminfo-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2017-09-22 15:27:21.699056179 -0400 3 | +++ src/fs/proc/meminfo.c 2017-09-22 15:27:41.274137239 -0400 4 | @@ -99,7 +99,7 @@ static int meminfo_proc_show(struct seq_ 5 | "Committed_AS: %8lu kB\n" 6 | "VmallocTotal: %8lu kB\n" 7 | "VmallocUsed: %8lu kB\n" 8 | - "VmallocChunk: %8lu kB\n" 9 | + "VMALLOCCHUNK: %8lu kB\n" 10 | #ifdef CONFIG_MEMORY_FAILURE 11 | "HardwareCorrupted: %5lu kB\n" 12 | #endif 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/multiple.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" 4 | 5 | declare -a blacklist=(meminfo-string-LOADED.test) 6 | 7 | source ${SCRIPTDIR}/../common/multiple.template 8 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/parainstructions-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/generic.c src/fs/proc/generic.c 2 | --- src.orig/fs/proc/generic.c 2017-09-22 15:27:21.698056175 -0400 3 | +++ src/fs/proc/generic.c 2017-09-22 15:27:48.190165879 -0400 4 | @@ -194,6 +194,7 @@ int proc_alloc_inum(unsigned int *inum) 5 | unsigned int i; 6 | int error; 7 | 8 | + printk("kpatch-test: testing change to .parainstructions section\n"); 9 | retry: 10 | if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL)) 11 | return -ENOMEM; 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/shadow-newpid-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep -q newpid: /proc/$$/status 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/smp-locks-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/drivers/tty/tty_buffer.c src/drivers/tty/tty_buffer.c 2 | --- src.orig/drivers/tty/tty_buffer.c 2017-09-22 15:27:21.077053604 -0400 3 | +++ src/drivers/tty/tty_buffer.c 2017-09-22 15:27:50.542175618 -0400 4 | @@ -217,6 +217,10 @@ int tty_buffer_request_room(struct tty_p 5 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to 6 | remove this conditional if its worth it. This would be invisible 7 | to the callers */ 8 | + 9 | + if (!size) 10 | + printk("kpatch-test: testing .smp_locks section changes\n"); 11 | + 12 | b = buf->tail; 13 | if (b != NULL) 14 | left = b->size - b->used; 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/special-static.patch: -------------------------------------------------------------------------------- 1 | Index: kernel-rhel7/kernel/fork.c 2 | =================================================================== 3 | --- kernel-rhel7.orig/kernel/fork.c 4 | +++ kernel-rhel7/kernel/fork.c 5 | @@ -1146,10 +1146,18 @@ static void posix_cpu_timers_init_group( 6 | INIT_LIST_HEAD(&sig->cpu_timers[2]); 7 | } 8 | 9 | +void kpatch_foo(void) 10 | +{ 11 | + if (!jiffies) 12 | + printk("kpatch copy signal\n"); 13 | +} 14 | + 15 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 16 | { 17 | struct signal_struct *sig; 18 | 19 | + kpatch_foo(); 20 | + 21 | if (clone_flags & CLONE_THREAD) 22 | return 0; 23 | 24 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/tracepoints-section.patch: -------------------------------------------------------------------------------- 1 | Index: kernel-rhel7/kernel/timer.c 2 | =================================================================== 3 | --- kernel-rhel7.orig/kernel/timer.c 4 | +++ kernel-rhel7/kernel/timer.c 5 | @@ -1454,6 +1454,9 @@ static void run_timer_softirq(struct sof 6 | { 7 | struct tvec_base *base = __this_cpu_read(tvec_bases); 8 | 9 | + if (!base) 10 | + printk("kpatch-test: testing __tracepoints section changes\n"); 11 | + 12 | if (time_after_eq(jiffies, base->timer_jiffies)) 13 | __run_timers(base); 14 | } 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.6/warn-detect-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c 2 | --- src.orig/arch/x86/kvm/x86.c 2017-09-22 15:27:20.852052672 -0400 3 | +++ src/arch/x86/kvm/x86.c 2017-09-22 15:27:55.489196104 -0400 4 | @@ -1,3 +1,4 @@ 5 | + 6 | /* 7 | * Kernel-based Virtual Machine driver for Linux 8 | * 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/bug-table-section.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/fs/proc/proc_sysctl.c 2 | =================================================================== 3 | --- kernel.orig/fs/proc/proc_sysctl.c 4 | +++ kernel/fs/proc/proc_sysctl.c 5 | @@ -301,6 +301,8 @@ void sysctl_head_put(struct ctl_table_he 6 | 7 | static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 8 | { 9 | + if (jiffies == 0) 10 | + printk("kpatch-test: testing __bug_table section changes\n"); 11 | BUG_ON(!head); 12 | spin_lock(&sysctl_lock); 13 | if (!use_table(head)) 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/cmdline-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep kpatch=1 /proc/cmdline 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/cmdline-string.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/fs/proc/cmdline.c 2 | =================================================================== 3 | --- kernel.orig/fs/proc/cmdline.c 4 | +++ kernel/fs/proc/cmdline.c 5 | @@ -5,7 +5,7 @@ 6 | 7 | static int cmdline_proc_show(struct seq_file *m, void *v) 8 | { 9 | - seq_printf(m, "%s\n", saved_command_line); 10 | + seq_printf(m, "%s kpatch=1\n", saved_command_line); 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/data-new-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep "kpatch: 5" /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/data-read-mostly.patch.disabled: -------------------------------------------------------------------------------- 1 | Index: kernel/net/core/dev.c 2 | =================================================================== 3 | --- kernel.orig/net/core/dev.c 4 | +++ kernel/net/core/dev.c 5 | @@ -4327,6 +4327,7 @@ skip_classify: 6 | case RX_HANDLER_PASS: 7 | break; 8 | default: 9 | + printk("BUG!\n"); 10 | BUG(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/fixup-section.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/fs/readdir.c 2 | =================================================================== 3 | --- kernel.orig/fs/readdir.c 4 | +++ kernel/fs/readdir.c 5 | @@ -176,6 +176,7 @@ static int filldir(void * __buf, const c 6 | goto efault; 7 | } 8 | dirent = buf->current_dir; 9 | + asm("nop"); 10 | if (__put_user(d_ino, &dirent->d_ino)) 11 | goto efault; 12 | if (__put_user(reclen, &dirent->d_reclen)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/gcc-constprop.patch.disabled: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/time/timekeeping.c src/kernel/time/timekeeping.c 2 | --- src.orig/kernel/time/timekeeping.c 2017-09-22 15:27:21.602055778 -0400 3 | +++ src/kernel/time/timekeeping.c 2017-09-22 15:27:27.522080292 -0400 4 | @@ -877,6 +877,9 @@ void do_gettimeofday(struct timeval *tv) 5 | { 6 | struct timespec64 now; 7 | 8 | + if (!tv) 9 | + return; 10 | + 11 | getnstimeofday64(&now); 12 | tv->tv_sec = now.tv_sec; 13 | tv->tv_usec = now.tv_nsec/1000; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/gcc-isra.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/fs/proc/proc_sysctl.c 2 | =================================================================== 3 | --- kernel.orig/fs/proc/proc_sysctl.c 4 | +++ kernel/fs/proc/proc_sysctl.c 5 | @@ -46,6 +46,7 @@ void proc_sys_poll_notify(struct ctl_tab 6 | if (!poll) 7 | return; 8 | 9 | + printk("kpatch-test: testing gcc .isra function name mangling\n"); 10 | atomic_inc(&poll->event); 11 | wake_up_interruptible(&poll->wait); 12 | } 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/gcc-mangled-3.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/mm/slub.c 2 | =================================================================== 3 | --- kernel.orig/mm/slub.c 4 | +++ kernel/mm/slub.c 5 | @@ -5675,6 +5675,9 @@ void get_slabinfo(struct kmem_cache *s, 6 | unsigned long nr_free = 0; 7 | int node; 8 | 9 | + if (!jiffies) 10 | + printk("slabinfo\n"); 11 | + 12 | for_each_online_node(node) { 13 | struct kmem_cache_node *n = get_node(s, node); 14 | 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/gcc-static-local-var-2.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/mm/mmap.c 2 | =================================================================== 3 | --- kernel.orig/mm/mmap.c 4 | +++ kernel/mm/mmap.c 5 | @@ -1716,6 +1716,9 @@ unsigned long mmap_region(struct file *f 6 | struct rb_node **rb_link, *rb_parent; 7 | unsigned long charged = 0; 8 | 9 | + if (!jiffies) 10 | + printk("kpatch mmap foo\n"); 11 | + 12 | /* Check against address space limit. */ 13 | if (!may_expand_vm(mm, len >> PAGE_SHIFT)) { 14 | unsigned long nr_pages; 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/gcc-static-local-var-3.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/kernel/sys.c 2 | =================================================================== 3 | --- kernel.orig/kernel/sys.c 4 | +++ kernel/kernel/sys.c 5 | @@ -559,8 +559,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int 6 | return ret; 7 | } 8 | 9 | +void kpatch_bar(void) 10 | +{ 11 | + if (!jiffies) 12 | + printk("kpatch_foo\n"); 13 | +} 14 | + 15 | static void deferred_cad(struct work_struct *dummy) 16 | { 17 | + kpatch_bar(); 18 | kernel_restart(NULL); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/gcc-static-local-var-4.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/fs/aio.c 2 | =================================================================== 3 | --- kernel.orig/fs/aio.c 4 | +++ kernel/fs/aio.c 5 | @@ -223,9 +223,16 @@ static int __init aio_setup(void) 6 | } 7 | __initcall(aio_setup); 8 | 9 | +void kpatch_aio_foo(void) 10 | +{ 11 | + if (!jiffies) 12 | + printk("kpatch aio foo\n"); 13 | +} 14 | + 15 | static void put_aio_ring_file(struct kioctx *ctx) 16 | { 17 | struct file *aio_ring_file = ctx->aio_ring_file; 18 | + kpatch_aio_foo(); 19 | if (aio_ring_file) { 20 | truncate_setsize(aio_ring_file->f_inode, 0); 21 | 22 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/gcc-static-local-var-4.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o pipefail 4 | if ! $(eu-readelf --wide --symbols test-gcc-static-local-var-4.ko | awk '$NF == "free_ioctx" { exit 1 }'); then 5 | exit 1 6 | else 7 | exit 0 8 | fi 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/gcc-static-local-var-6.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/net/ipv6/netfilter.c 2 | =================================================================== 3 | --- kernel.orig/net/ipv6/netfilter.c 4 | +++ kernel/net/ipv6/netfilter.c 5 | @@ -112,6 +112,8 @@ static int nf_ip6_reroute(struct sk_buff 6 | return 0; 7 | } 8 | 9 | +#include "kpatch-macros.h" 10 | + 11 | static int nf_ip6_route(struct net *net, struct dst_entry **dst, 12 | struct flowi *fl, bool strict) 13 | { 14 | @@ -125,6 +127,9 @@ static int nf_ip6_route(struct net *net, 15 | struct dst_entry *result; 16 | int err; 17 | 18 | + if (!jiffies) 19 | + printk("kpatch nf_ip6_route foo\n"); 20 | + 21 | result = ip6_route_output(net, sk, &fl->u.ip6); 22 | err = result->error; 23 | if (err) 24 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/meminfo-init-FAIL.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/fs/proc/meminfo.c 2 | =================================================================== 3 | --- kernel.orig/fs/proc/meminfo.c 4 | +++ kernel/fs/proc/meminfo.c 5 | @@ -199,6 +199,7 @@ static const struct file_operations memi 6 | 7 | static int __init proc_meminfo_init(void) 8 | { 9 | + printk("a\n"); 10 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/meminfo-init2-FAIL.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/fs/proc/meminfo.c 2 | =================================================================== 3 | --- kernel.orig/fs/proc/meminfo.c 4 | +++ kernel/fs/proc/meminfo.c 5 | @@ -30,6 +30,7 @@ static int meminfo_proc_show(struct seq_ 6 | unsigned long pages[NR_LRU_LISTS]; 7 | int lru; 8 | 9 | + printk("a\n"); 10 | /* 11 | * display in kilobytes. 12 | */ 13 | @@ -199,6 +200,7 @@ static const struct file_operations memi 14 | 15 | static int __init proc_meminfo_init(void) 16 | { 17 | + printk("a\n"); 18 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/meminfo-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep VMALLOCCHUNK /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/meminfo-string.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/fs/proc/meminfo.c 2 | =================================================================== 3 | --- kernel.orig/fs/proc/meminfo.c 4 | +++ kernel/fs/proc/meminfo.c 5 | @@ -99,7 +99,7 @@ static int meminfo_proc_show(struct seq_ 6 | "Committed_AS: %8lu kB\n" 7 | "VmallocTotal: %8lu kB\n" 8 | "VmallocUsed: %8lu kB\n" 9 | - "VmallocChunk: %8lu kB\n" 10 | + "VMALLOCCHUNK: %8lu kB\n" 11 | #ifdef CONFIG_MEMORY_FAILURE 12 | "HardwareCorrupted: %5lu kB\n" 13 | #endif 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/multiple.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" 4 | 5 | declare -a blacklist=(meminfo-string-LOADED.test) 6 | 7 | source ${SCRIPTDIR}/../common/multiple.template 8 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/parainstructions-section.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/fs/proc/generic.c 2 | =================================================================== 3 | --- kernel.orig/fs/proc/generic.c 4 | +++ kernel/fs/proc/generic.c 5 | @@ -194,6 +194,7 @@ int proc_alloc_inum(unsigned int *inum) 6 | unsigned int i; 7 | int error; 8 | 9 | + printk("kpatch-test: testing change to .parainstructions section\n"); 10 | retry: 11 | if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL)) 12 | return -ENOMEM; 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/shadow-newpid-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep -q newpid: /proc/$$/status 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/smp-locks-section.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/drivers/tty/tty_buffer.c 2 | =================================================================== 3 | --- kernel.orig/drivers/tty/tty_buffer.c 4 | +++ kernel/drivers/tty/tty_buffer.c 5 | @@ -217,6 +217,10 @@ int tty_buffer_request_room(struct tty_p 6 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to 7 | remove this conditional if its worth it. This would be invisible 8 | to the callers */ 9 | + 10 | + if (!size) 11 | + printk("kpatch-test: testing .smp_locks section changes\n"); 12 | + 13 | b = buf->tail; 14 | if (b != NULL) 15 | left = b->size - b->used; 16 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/special-static.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/kernel/fork.c 2 | =================================================================== 3 | --- kernel.orig/kernel/fork.c 4 | +++ kernel/kernel/fork.c 5 | @@ -1146,10 +1146,18 @@ static void posix_cpu_timers_init_group( 6 | INIT_LIST_HEAD(&sig->cpu_timers[2]); 7 | } 8 | 9 | +void kpatch_foo(void) 10 | +{ 11 | + if (!jiffies) 12 | + printk("kpatch copy signal\n"); 13 | +} 14 | + 15 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 16 | { 17 | struct signal_struct *sig; 18 | 19 | + kpatch_foo(); 20 | + 21 | if (clone_flags & CLONE_THREAD) 22 | return 0; 23 | 24 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/tracepoints-section.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/kernel/timer.c 2 | =================================================================== 3 | --- kernel.orig/kernel/timer.c 4 | +++ kernel/kernel/timer.c 5 | @@ -1454,6 +1454,9 @@ static void run_timer_softirq(struct sof 6 | { 7 | struct tvec_base *base = __this_cpu_read(tvec_bases); 8 | 9 | + if (!base) 10 | + printk("kpatch-test: testing __tracepoints section changes\n"); 11 | + 12 | if (time_after_eq(jiffies, base->timer_jiffies)) 13 | __run_timers(base); 14 | } 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.7/warn-detect-FAIL.patch: -------------------------------------------------------------------------------- 1 | Index: kernel/arch/x86/kvm/x86.c 2 | =================================================================== 3 | --- kernel.orig/arch/x86/kvm/x86.c 4 | +++ kernel/arch/x86/kvm/x86.c 5 | @@ -1,3 +1,4 @@ 6 | + 7 | /* 8 | * Kernel-based Virtual Machine driver for Linux 9 | * 10 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/bug-table-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src.orig/fs/proc/proc_sysctl.c 2020-03-10 10:35:54.568563834 -0400 3 | +++ src/fs/proc/proc_sysctl.c 2020-03-10 10:35:57.040558842 -0400 4 | @@ -331,6 +331,8 @@ static void start_unregistering(struct c 5 | 6 | static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 7 | { 8 | + if (jiffies == 0) 9 | + printk("kpatch-test: testing __bug_table section changes\n"); 10 | BUG_ON(!head); 11 | spin_lock(&sysctl_lock); 12 | if (!use_table(head)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/cmdline-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep kpatch=1 /proc/cmdline 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/cmdline-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c 2 | --- src.orig/fs/proc/cmdline.c 2020-03-10 10:35:54.567563836 -0400 3 | +++ src/fs/proc/cmdline.c 2020-03-10 10:36:03.207546389 -0400 4 | @@ -5,7 +5,7 @@ 5 | 6 | static int cmdline_proc_show(struct seq_file *m, void *v) 7 | { 8 | - seq_printf(m, "%s\n", saved_command_line); 9 | + seq_printf(m, "%s kpatch=1\n", saved_command_line); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/data-new-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep "kpatch: 5" /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/data-read-mostly.patch.disabled: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/net/core/dev.c src/net/core/dev.c 2 | --- src.orig/net/core/dev.c 2020-03-10 10:35:55.176562607 -0400 3 | +++ src/net/core/dev.c 2020-03-10 10:37:54.458302249 -0400 4 | @@ -4327,6 +4327,7 @@ skip_classify: 5 | case RX_HANDLER_PASS: 6 | break; 7 | default: 8 | + printk("BUG!\n"); 9 | BUG(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/fixup-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/readdir.c src/fs/readdir.c 2 | --- src.orig/fs/readdir.c 2020-03-10 10:35:54.574563822 -0400 3 | +++ src/fs/readdir.c 2020-03-10 10:36:12.621527378 -0400 4 | @@ -176,6 +176,7 @@ static int filldir(void * __buf, const c 5 | goto efault; 6 | } 7 | dirent = buf->current_dir; 8 | + asm("nop"); 9 | if (__put_user(d_ino, &dirent->d_ino)) 10 | goto efault; 11 | if (__put_user(reclen, &dirent->d_reclen)) 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/gcc-constprop.patch.disabled: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/time/timekeeping.c src/kernel/time/timekeeping.c 2 | --- src.orig/kernel/time/timekeeping.c 2020-03-10 10:35:55.091562778 -0400 3 | +++ src/kernel/time/timekeeping.c 2020-03-10 10:37:59.105290886 -0400 4 | @@ -852,6 +852,9 @@ void do_gettimeofday(struct timeval *tv) 5 | { 6 | struct timespec64 now; 7 | 8 | + if (!tv) 9 | + return; 10 | + 11 | getnstimeofday64(&now); 12 | tv->tv_sec = now.tv_sec; 13 | tv->tv_usec = now.tv_nsec/1000; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/gcc-isra.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src.orig/fs/proc/proc_sysctl.c 2020-03-10 10:35:54.568563834 -0400 3 | +++ src/fs/proc/proc_sysctl.c 2020-03-10 10:36:17.393517742 -0400 4 | @@ -46,6 +46,7 @@ void proc_sys_poll_notify(struct ctl_tab 5 | if (!poll) 6 | return; 7 | 8 | + printk("kpatch-test: testing gcc .isra function name mangling\n"); 9 | atomic_inc(&poll->event); 10 | wake_up_interruptible(&poll->wait); 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/gcc-mangled-3.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/mm/slub.c src/mm/slub.c 2 | --- src.orig/mm/slub.c 2020-03-10 10:35:55.138562683 -0400 3 | +++ src/mm/slub.c 2020-03-10 10:36:22.189508057 -0400 4 | @@ -5716,6 +5716,9 @@ void get_slabinfo(struct kmem_cache *s, 5 | unsigned long nr_free = 0; 6 | int node; 7 | 8 | + if (!jiffies) 9 | + printk("slabinfo\n"); 10 | + 11 | for_each_online_node(node) { 12 | struct kmem_cache_node *n = get_node(s, node); 13 | 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/gcc-static-local-var-2.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/mm/mmap.c src/mm/mmap.c 2 | --- src.orig/mm/mmap.c 2020-03-10 10:35:55.133562693 -0400 3 | +++ src/mm/mmap.c 2020-03-10 10:36:26.787498772 -0400 4 | @@ -1721,6 +1721,9 @@ unsigned long mmap_region(struct file *f 5 | struct rb_node **rb_link, *rb_parent; 6 | unsigned long charged = 0; 7 | 8 | + if (!jiffies) 9 | + printk("kpatch mmap foo\n"); 10 | + 11 | /* Check against address space limit. */ 12 | if (!may_expand_vm(mm, len >> PAGE_SHIFT)) { 13 | unsigned long nr_pages; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/gcc-static-local-var-3.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/sys.c src/kernel/sys.c 2 | --- src.orig/kernel/sys.c 2020-03-10 10:35:55.088562784 -0400 3 | +++ src/kernel/sys.c 2020-03-10 10:36:31.420489416 -0400 4 | @@ -559,8 +559,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int 5 | return ret; 6 | } 7 | 8 | +void kpatch_bar(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch_foo\n"); 12 | +} 13 | + 14 | static void deferred_cad(struct work_struct *dummy) 15 | { 16 | + kpatch_bar(); 17 | kernel_restart(NULL); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/gcc-static-local-var-4.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/aio.c src/fs/aio.c 2 | --- src.orig/fs/aio.c 2020-03-10 10:35:54.403564168 -0400 3 | +++ src/fs/aio.c 2020-03-10 10:36:36.025480117 -0400 4 | @@ -223,9 +223,16 @@ static int __init aio_setup(void) 5 | } 6 | __initcall(aio_setup); 7 | 8 | +void kpatch_aio_foo(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch aio foo\n"); 12 | +} 13 | + 14 | static void put_aio_ring_file(struct kioctx *ctx) 15 | { 16 | struct file *aio_ring_file = ctx->aio_ring_file; 17 | + kpatch_aio_foo(); 18 | if (aio_ring_file) { 19 | truncate_setsize(aio_ring_file->f_inode, 0); 20 | 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/gcc-static-local-var-4.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o pipefail 4 | if ! $(eu-readelf --wide --symbols test-gcc-static-local-var-4.ko | awk '$NF == "free_ioctx" { exit 1 }'); then 5 | exit 1 6 | else 7 | exit 0 8 | fi 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/gcc-static-local-var-6.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/net/ipv6/netfilter.c src/net/ipv6/netfilter.c 2 | --- src.orig/net/ipv6/netfilter.c 2020-03-10 10:35:55.213562532 -0400 3 | +++ src/net/ipv6/netfilter.c 2020-03-10 10:36:47.062455553 -0400 4 | @@ -112,6 +112,8 @@ static int nf_ip6_reroute(struct sk_buff 5 | return 0; 6 | } 7 | 8 | +#include "kpatch-macros.h" 9 | + 10 | static int nf_ip6_route(struct net *net, struct dst_entry **dst, 11 | struct flowi *fl, bool strict) 12 | { 13 | @@ -125,6 +127,9 @@ static int nf_ip6_route(struct net *net, 14 | struct dst_entry *result; 15 | int err; 16 | 17 | + if (!jiffies) 18 | + printk("kpatch nf_ip6_route foo\n"); 19 | + 20 | result = ip6_route_output(net, sk, &fl->u.ip6); 21 | err = result->error; 22 | if (err) 23 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/meminfo-init-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2020-03-10 10:35:54.568563834 -0400 3 | +++ src/fs/proc/meminfo.c 2020-03-10 10:37:07.161410729 -0400 4 | @@ -202,6 +202,7 @@ static const struct file_operations memi 5 | 6 | static int __init proc_meminfo_init(void) 7 | { 8 | + printk("a\n"); 9 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/meminfo-init2-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2020-03-10 10:35:54.568563834 -0400 3 | +++ src/fs/proc/meminfo.c 2020-03-10 10:37:00.986424500 -0400 4 | @@ -31,6 +31,7 @@ static int meminfo_proc_show(struct seq_ 5 | unsigned long pages[NR_LRU_LISTS]; 6 | int lru; 7 | 8 | + printk("a\n"); 9 | /* 10 | * display in kilobytes. 11 | */ 12 | @@ -202,6 +203,7 @@ static const struct file_operations memi 13 | 14 | static int __init proc_meminfo_init(void) 15 | { 16 | + printk("a\n"); 17 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/meminfo-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep VMALLOCCHUNK /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/meminfo-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr linux-3.10.0-1127.fc30.x86_64.orig/fs/proc/meminfo.c linux-3.10.0-1127.fc30.x86_64/fs/proc/meminfo.c 2 | --- linux-3.10.0-1127.fc30.x86_64.orig/fs/proc/meminfo.c 2020-03-10 09:40:37.849666782 -0400 3 | +++ linux-3.10.0-1127.fc30.x86_64/fs/proc/meminfo.c 2020-03-10 09:50:26.871990501 -0400 4 | @@ -100,7 +100,7 @@ static int meminfo_proc_show(struct seq_ 5 | "Committed_AS: %8lu kB\n" 6 | "VmallocTotal: %8lu kB\n" 7 | "VmallocUsed: %8lu kB\n" 8 | - "VmallocChunk: %8lu kB\n" 9 | + "VMALLOCCHUNK: %8lu kB\n" 10 | "Percpu: %8lu kB\n" 11 | #ifdef CONFIG_MEMORY_FAILURE 12 | "HardwareCorrupted: %5lu kB\n" 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/multiple.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" 4 | 5 | declare -a blacklist=(meminfo-string-LOADED.test) 6 | 7 | source ${SCRIPTDIR}/../common/multiple.template 8 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/parainstructions-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/generic.c src/fs/proc/generic.c 2 | --- src.orig/fs/proc/generic.c 2020-03-10 10:35:54.567563836 -0400 3 | +++ src/fs/proc/generic.c 2020-03-10 10:37:25.973368774 -0400 4 | @@ -194,6 +194,7 @@ int proc_alloc_inum(unsigned int *inum) 5 | unsigned int i; 6 | int error; 7 | 8 | + printk("kpatch-test: testing change to .parainstructions section\n"); 9 | retry: 10 | if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL)) 11 | return -ENOMEM; 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/shadow-newpid-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep -q newpid: /proc/$$/status 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/smp-locks-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/drivers/tty/tty_buffer.c src/drivers/tty/tty_buffer.c 2 | --- src.orig/drivers/tty/tty_buffer.c 2020-03-10 10:35:54.155564668 -0400 3 | +++ src/drivers/tty/tty_buffer.c 2020-03-10 10:37:35.446347648 -0400 4 | @@ -217,6 +217,10 @@ int tty_buffer_request_room(struct tty_p 5 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to 6 | remove this conditional if its worth it. This would be invisible 7 | to the callers */ 8 | + 9 | + if (!size) 10 | + printk("kpatch-test: testing .smp_locks section changes\n"); 11 | + 12 | b = buf->tail; 13 | if (b != NULL) 14 | left = b->size - b->used; 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/special-static.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/fork.c src/kernel/fork.c 2 | --- src.orig/kernel/fork.c 2020-03-10 10:35:55.068562825 -0400 3 | +++ src/kernel/fork.c 2020-03-10 10:37:40.182337086 -0400 4 | @@ -1153,10 +1153,18 @@ static void posix_cpu_timers_init_group( 5 | INIT_LIST_HEAD(&sig->cpu_timers[2]); 6 | } 7 | 8 | +void kpatch_foo(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch copy signal\n"); 12 | +} 13 | + 14 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 15 | { 16 | struct signal_struct *sig; 17 | 18 | + kpatch_foo(); 19 | + 20 | if (clone_flags & CLONE_THREAD) 21 | return 0; 22 | 23 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/tracepoints-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/timer.c src/kernel/timer.c 2 | --- src.orig/kernel/timer.c 2020-03-10 10:35:55.092562776 -0400 3 | +++ src/kernel/timer.c 2020-03-10 10:37:44.918325578 -0400 4 | @@ -1454,6 +1454,9 @@ static void run_timer_softirq(struct sof 5 | { 6 | struct tvec_base *base = __this_cpu_read(tvec_bases); 7 | 8 | + if (!base) 9 | + printk("kpatch-test: testing __tracepoints section changes\n"); 10 | + 11 | if (time_after_eq(jiffies, base->timer_jiffies)) 12 | __run_timers(base); 13 | } 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-7.8/warn-detect-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c 2 | --- src.orig/arch/x86/kvm/x86.c 2020-03-10 10:35:51.514570002 -0400 3 | +++ src/arch/x86/kvm/x86.c 2020-03-10 10:37:49.745313774 -0400 4 | @@ -1,3 +1,4 @@ 5 | + 6 | /* 7 | * Kernel-based Virtual Machine driver for Linux 8 | * 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/README: -------------------------------------------------------------------------------- 1 | 4.18.0-80.el8 2 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/bug-table-section.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c 2 | index 89921a0..ac129b6 100644 3 | --- a/fs/proc/proc_sysctl.c 4 | +++ b/fs/proc/proc_sysctl.c 5 | @@ -333,6 +333,8 @@ static void start_unregistering(struct ctl_table_header *p) 6 | 7 | static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 8 | { 9 | + if (jiffies == 0) 10 | + printk("kpatch-test: testing __bug_table section changes\n"); 11 | BUG_ON(!head); 12 | spin_lock(&sysctl_lock); 13 | if (!use_table(head)) 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/cmdline-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep kpatch=1 /proc/cmdline 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/cmdline-string.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/proc/cmdline.c b/fs/proc/cmdline.c 2 | index fa762c5..bd66027 100644 3 | --- a/fs/proc/cmdline.c 4 | +++ b/fs/proc/cmdline.c 5 | @@ -6,8 +6,7 @@ 6 | 7 | static int cmdline_proc_show(struct seq_file *m, void *v) 8 | { 9 | - seq_puts(m, saved_command_line); 10 | - seq_putc(m, '\n'); 11 | + seq_printf(m, "%s kpatch=1\n", saved_command_line); 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/data-new-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep "kpatch: 5" /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/data-new.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c 2 | index 2fb0484..79ead86 100644 3 | --- a/fs/proc/meminfo.c 4 | +++ b/fs/proc/meminfo.c 5 | @@ -30,6 +30,8 @@ static void show_val_kb(struct seq_file *m, const char *s, unsigned long num) 6 | seq_write(m, " kB\n", 4); 7 | } 8 | 9 | +static int foo = 5; 10 | + 11 | static int meminfo_proc_show(struct seq_file *m, void *v) 12 | { 13 | struct sysinfo i; 14 | @@ -141,6 +143,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) 15 | show_val_kb(m, "CmaFree: ", 16 | global_zone_page_state(NR_FREE_CMA_PAGES)); 17 | #endif 18 | + seq_printf(m, "kpatch: %d\n", foo); 19 | 20 | hugetlb_report_meminfo(m); 21 | 22 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/data-read-mostly.patch.disabled: -------------------------------------------------------------------------------- 1 | Disabled due to https://github.com/dynup/kpatch/issues/940 2 | --- 3 | diff --git a/net/core/dev.c b/net/core/dev.c 4 | index b6f9647..b376a48 100644 5 | --- a/net/core/dev.c 6 | +++ b/net/core/dev.c 7 | @@ -4858,6 +4858,7 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc) 8 | case RX_HANDLER_PASS: 9 | break; 10 | default: 11 | + printk("BUG!\n"); 12 | BUG(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/fixup-section.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/readdir.c b/fs/readdir.c 2 | index d97f548..58863b6 100644 3 | --- a/fs/readdir.c 4 | +++ b/fs/readdir.c 5 | @@ -189,6 +189,7 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, 6 | goto efault; 7 | } 8 | dirent = buf->current_dir; 9 | + asm("nop"); 10 | if (__put_user(d_ino, &dirent->d_ino)) 11 | goto efault; 12 | if (__put_user(reclen, &dirent->d_reclen)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/gcc-constprop.patch.disabled: -------------------------------------------------------------------------------- 1 | diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c 2 | index 4786df9..c73a687 100644 3 | --- a/kernel/time/timekeeping.c 4 | +++ b/kernel/time/timekeeping.c 5 | @@ -1211,6 +1211,9 @@ void do_gettimeofday(struct timeval *tv) 6 | { 7 | struct timespec64 now; 8 | 9 | + if (!tv) 10 | + return; 11 | + 12 | getnstimeofday64(&now); 13 | tv->tv_sec = now.tv_sec; 14 | tv->tv_usec = now.tv_nsec/1000; 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/gcc-isra.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c 2 | index 89921a0..199b1d7 100644 3 | --- a/fs/proc/proc_sysctl.c 4 | +++ b/fs/proc/proc_sysctl.c 5 | @@ -48,6 +48,7 @@ void proc_sys_poll_notify(struct ctl_table_poll *poll) 6 | if (!poll) 7 | return; 8 | 9 | + printk("kpatch-test: testing gcc .isra function name mangling\n"); 10 | atomic_inc(&poll->event); 11 | wake_up_interruptible(&poll->wait); 12 | } 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/gcc-mangled-3.patch: -------------------------------------------------------------------------------- 1 | diff --git a/mm/slub.c b/mm/slub.c 2 | index 51258ef..3cb5264 100644 3 | --- a/mm/slub.c 4 | +++ b/mm/slub.c 5 | @@ -5852,6 +5852,9 @@ void get_slabinfo(struct kmem_cache *s, struct slabinfo *sinfo) 6 | int node; 7 | struct kmem_cache_node *n; 8 | 9 | + if (!jiffies) 10 | + printk("slabinfo\n"); 11 | + 12 | for_each_kmem_cache_node(s, node, n) { 13 | nr_slabs += node_nr_slabs(n); 14 | nr_objs += node_nr_objs(n); 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/gcc-static-local-var-2.patch: -------------------------------------------------------------------------------- 1 | diff --git a/mm/mmap.c b/mm/mmap.c 2 | index bf46096..4bc085c 100644 3 | --- a/mm/mmap.c 4 | +++ b/mm/mmap.c 5 | @@ -1684,6 +1684,9 @@ unsigned long mmap_region(struct file *file, unsigned long addr, 6 | struct rb_node **rb_link, *rb_parent; 7 | unsigned long charged = 0; 8 | 9 | + if (!jiffies) 10 | + printk("kpatch mmap foo\n"); 11 | + 12 | /* Check against address space limit. */ 13 | if (!may_expand_vm(mm, vm_flags, len >> PAGE_SHIFT)) { 14 | unsigned long nr_pages; 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/gcc-static-local-var-3.patch: -------------------------------------------------------------------------------- 1 | diff --git a/kernel/reboot.c b/kernel/reboot.c 2 | index e4ced88..0c0b5a2 100644 3 | --- a/kernel/reboot.c 4 | +++ b/kernel/reboot.c 5 | @@ -393,8 +393,15 @@ void kernel_power_off(void) 6 | return ret; 7 | } 8 | 9 | +void kpatch_bar(void) 10 | +{ 11 | + if (!jiffies) 12 | + printk("kpatch_foo\n"); 13 | +} 14 | + 15 | static void deferred_cad(struct work_struct *dummy) 16 | { 17 | + kpatch_bar(); 18 | kernel_restart(NULL); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/gcc-static-local-var-4.patch.disabled: -------------------------------------------------------------------------------- 1 | Disabled due to https://github.com/dynup/kpatch/issues/940 2 | --- 3 | diff --git a/fs/aio.c b/fs/aio.c 4 | index e1f8f01..4dfb05c 100644 5 | --- a/fs/aio.c 6 | +++ b/fs/aio.c 7 | @@ -263,11 +263,18 @@ static int __init aio_setup(void) 8 | } 9 | __initcall(aio_setup); 10 | 11 | +void kpatch_aio_foo(void) 12 | +{ 13 | + if (!jiffies) 14 | + printk("kpatch aio foo\n"); 15 | +} 16 | + 17 | static void put_aio_ring_file(struct kioctx *ctx) 18 | { 19 | struct file *aio_ring_file = ctx->aio_ring_file; 20 | struct address_space *i_mapping; 21 | 22 | + kpatch_aio_foo(); 23 | if (aio_ring_file) { 24 | truncate_setsize(file_inode(aio_ring_file), 0); 25 | 26 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/gcc-static-local-var-4.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o pipefail 4 | if ! $(eu-readelf --wide --symbols test-gcc-static-local-var-4.ko | awk '$NF == "free_ioctx" { exit 1 }'); then 5 | exit 1 6 | else 7 | exit 0 8 | fi 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/gcc-static-local-var-6.patch: -------------------------------------------------------------------------------- 1 | diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c 2 | index 531d695..a536c74 100644 3 | --- a/net/ipv6/netfilter.c 4 | +++ b/net/ipv6/netfilter.c 5 | @@ -84,6 +84,8 @@ static int nf_ip6_reroute(struct sk_buff *skb, 6 | return 0; 7 | } 8 | 9 | +#include "kpatch-macros.h" 10 | + 11 | static int nf_ip6_route(struct net *net, struct dst_entry **dst, 12 | struct flowi *fl, bool strict) 13 | { 14 | @@ -97,6 +99,9 @@ static int nf_ip6_route(struct net *net, struct dst_entry **dst, 15 | struct dst_entry *result; 16 | int err; 17 | 18 | + if (!jiffies) 19 | + printk("kpatch nf_ip6_route foo\n"); 20 | + 21 | result = ip6_route_output(net, sk, &fl->u.ip6); 22 | err = result->error; 23 | if (err) 24 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/meminfo-init-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c 2 | index 2fb0484..b981fab 100644 3 | --- a/fs/proc/meminfo.c 4 | +++ b/fs/proc/meminfo.c 5 | @@ -151,6 +151,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) 6 | 7 | static int __init proc_meminfo_init(void) 8 | { 9 | + printk("a\n"); 10 | proc_create_single("meminfo", 0, NULL, meminfo_proc_show); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/meminfo-init2-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c 2 | index 2fb0484..eb61884 100644 3 | --- a/fs/proc/meminfo.c 4 | +++ b/fs/proc/meminfo.c 5 | @@ -39,6 +39,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) 6 | unsigned long pages[NR_LRU_LISTS]; 7 | int lru; 8 | 9 | + printk("a\n"); 10 | si_meminfo(&i); 11 | si_swapinfo(&i); 12 | committed = percpu_counter_read_positive(&vm_committed_as); 13 | @@ -151,6 +152,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) 14 | 15 | static int __init proc_meminfo_init(void) 16 | { 17 | + printk("a\n"); 18 | proc_create_single("meminfo", 0, NULL, meminfo_proc_show); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/meminfo-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep VMALLOCCHUNK /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/meminfo-string.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c 2 | index 2fb0484..804bc35 100644 3 | --- a/fs/proc/meminfo.c 4 | +++ b/fs/proc/meminfo.c 5 | @@ -120,7 +120,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) 6 | seq_printf(m, "VmallocTotal: %8lu kB\n", 7 | (unsigned long)VMALLOC_TOTAL >> 10); 8 | show_val_kb(m, "VmallocUsed: ", 0ul); 9 | - show_val_kb(m, "VmallocChunk: ", 0ul); 10 | + show_val_kb(m, "VMALLOCCHUNK: ", 0ul); 11 | 12 | #ifdef CONFIG_MEMORY_FAILURE 13 | seq_printf(m, "HardwareCorrupted: %5lu kB\n", 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/multiple.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" 4 | 5 | declare -a blacklist=(meminfo-string-LOADED.test) 6 | 7 | source ${SCRIPTDIR}/../common/multiple.template 8 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/parainstructions-section.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/proc/generic.c b/fs/proc/generic.c 2 | index bb1c162..2b3f7ec 100644 3 | --- a/fs/proc/generic.c 4 | +++ b/fs/proc/generic.c 5 | @@ -205,6 +205,7 @@ int proc_alloc_inum(unsigned int *inum) 6 | { 7 | int i; 8 | 9 | + printk("kpatch-test: testing change to .parainstructions section\n"); 10 | i = ida_simple_get(&proc_inum_ida, 0, UINT_MAX - PROC_DYNAMIC_FIRST + 1, 11 | GFP_KERNEL); 12 | if (i < 0) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/shadow-newpid-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep -q newpid: /proc/$$/status 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/smp-locks-section.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c 2 | index ae3ce33..37727fe 100644 3 | --- a/drivers/tty/tty_buffer.c 4 | +++ b/drivers/tty/tty_buffer.c 5 | @@ -256,6 +256,9 @@ static int __tty_buffer_request_room(struct tty_port *port, size_t size, 6 | struct tty_buffer *b, *n; 7 | int left, change; 8 | 9 | + if (!size) 10 | + printk("kpatch-test: testing .smp_locks section changes\n"); 11 | + 12 | b = buf->tail; 13 | if (b->flags & TTYB_NORMAL) 14 | left = 2 * b->size - b->used; 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/special-static.patch: -------------------------------------------------------------------------------- 1 | diff --git a/kernel/fork.c b/kernel/fork.c 2 | index 3311231..f6e66b7 100644 3 | --- a/kernel/fork.c 4 | +++ b/kernel/fork.c 5 | @@ -1461,10 +1461,18 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig) 6 | static inline void posix_cpu_timers_init_group(struct signal_struct *sig) { } 7 | #endif 8 | 9 | +void kpatch_foo(void) 10 | +{ 11 | + if (!jiffies) 12 | + printk("kpatch copy signal\n"); 13 | +} 14 | + 15 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 16 | { 17 | struct signal_struct *sig; 18 | 19 | + kpatch_foo(); 20 | + 21 | if (clone_flags & CLONE_THREAD) 22 | return 0; 23 | 24 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/tracepoints-section.patch: -------------------------------------------------------------------------------- 1 | diff --git a/kernel/time/timer.c b/kernel/time/timer.c 2 | index 786f8c0..1105697 100644 3 | --- a/kernel/time/timer.c 4 | +++ b/kernel/time/timer.c 5 | @@ -1692,6 +1692,9 @@ static __latent_entropy void run_timer_softirq(struct softirq_action *h) 6 | { 7 | struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); 8 | 9 | + if (!base) 10 | + printk("kpatch-test: testing __tracepoints section changes\n"); 11 | + 12 | __run_timers(base); 13 | if (IS_ENABLED(CONFIG_NO_HZ_COMMON)) 14 | __run_timers(this_cpu_ptr(&timer_bases[BASE_DEF])); 15 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.0/warn-detect-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c 2 | index 4fa858b..ef1a710 100644 3 | --- a/arch/x86/kvm/x86.c 4 | +++ b/arch/x86/kvm/x86.c 5 | @@ -1,3 +1,4 @@ 6 | + 7 | /* 8 | * Kernel-based Virtual Machine driver for Linux 9 | * 10 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/bug-table-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src/fs/proc/proc_sysctl.c 2020-03-11 11:23:26.886602663 +0000 3 | +++ src/fs/proc/proc_sysctl.c 2020-03-11 11:23:39.822895153 +0000 4 | @@ -333,6 +333,8 @@ static void start_unregistering(struct c 5 | 6 | static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 7 | { 8 | + if (jiffies == 0) 9 | + printk("kpatch-test: testing __bug_table section changes\n"); 10 | BUG_ON(!head); 11 | spin_lock(&sysctl_lock); 12 | if (!use_table(head)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/cmdline-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep kpatch=1 /proc/cmdline 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/cmdline-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/fs/proc/cmdline.c src/fs/proc/cmdline.c 2 | --- src/fs/proc/cmdline.c 2020-03-11 11:23:26.878602482 +0000 3 | +++ src/fs/proc/cmdline.c 2020-03-11 11:24:37.984218859 +0000 4 | @@ -6,8 +6,7 @@ 5 | 6 | static int cmdline_proc_show(struct seq_file *m, void *v) 7 | { 8 | - seq_puts(m, saved_command_line); 9 | - seq_putc(m, '\n'); 10 | + seq_printf(m, "%s kpatch=1\n", saved_command_line); 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/data-new-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep "kpatch: 5" /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/data-new.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src/fs/proc/meminfo.c 2020-03-11 11:23:26.882602572 +0000 3 | +++ src/fs/proc/meminfo.c 2020-03-11 11:25:35.401538436 +0000 4 | @@ -30,6 +30,8 @@ static void show_val_kb(struct seq_file 5 | seq_write(m, " kB\n", 4); 6 | } 7 | 8 | +static int foo = 5; 9 | + 10 | static int meminfo_proc_show(struct seq_file *m, void *v) 11 | { 12 | struct sysinfo i; 13 | @@ -141,6 +143,7 @@ static int meminfo_proc_show(struct seq_ 14 | show_val_kb(m, "CmaFree: ", 15 | global_zone_page_state(NR_FREE_CMA_PAGES)); 16 | #endif 17 | + seq_printf(m, "kpatch: %d\n", foo); 18 | 19 | hugetlb_report_meminfo(m); 20 | 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/data-read-mostly.patch.disabled: -------------------------------------------------------------------------------- 1 | Disabled due to https:/github.com/dynup/kpatch/issues/940 2 | --- 3 | diff -Nupr src/net/core/dev.c src/net/core/dev.c 4 | --- src/net/core/dev.c 2020-03-11 11:23:32.550730639 +0000 5 | +++ src/net/core/dev.c 2020-03-11 11:43:53.348022834 +0000 6 | @@ -4893,6 +4893,7 @@ skip_classify: 7 | case RX_HANDLER_PASS: 8 | break; 9 | default: 10 | + printk("BUG!\n"); 11 | BUG(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/fixup-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/fs/readdir.c src/fs/readdir.c 2 | --- src/fs/readdir.c 2020-03-11 11:23:24.210542249 +0000 3 | +++ src/fs/readdir.c 2020-03-11 11:26:32.322857837 +0000 4 | @@ -189,6 +189,7 @@ static int filldir(struct dir_context *c 5 | goto efault; 6 | } 7 | dirent = buf->current_dir; 8 | + asm("nop"); 9 | if (__put_user(d_ino, &dirent->d_ino)) 10 | goto efault; 11 | if (__put_user(reclen, &dirent->d_reclen)) 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/gcc-constprop.patch.disabled: -------------------------------------------------------------------------------- 1 | diff -Nupr src/kernel/time/timekeeping.c src/kernel/time/timekeeping.c 2 | --- src/kernel/time/timekeeping.c 2020-03-11 11:23:30.538685163 +0000 3 | +++ src/kernel/time/timekeeping.c 2020-03-11 11:44:47.885367244 +0000 4 | @@ -1221,6 +1221,9 @@ void do_gettimeofday(struct timeval *tv) 5 | { 6 | struct timespec64 now; 7 | 8 | + if (!tv) 9 | + return; 10 | + 11 | getnstimeofday64(&now); 12 | tv->tv_sec = now.tv_sec; 13 | tv->tv_usec = now.tv_nsec/1000; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/gcc-isra.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src/fs/proc/proc_sysctl.c 2020-03-11 11:23:26.886602663 +0000 3 | +++ src/fs/proc/proc_sysctl.c 2020-03-11 11:27:30.392214139 +0000 4 | @@ -48,6 +48,7 @@ void proc_sys_poll_notify(struct ctl_tab 5 | if (!poll) 6 | return; 7 | 8 | + printk("kpatch-test: testing gcc .isra function name mangling\n"); 9 | atomic_inc(&poll->event); 10 | wake_up_interruptible(&poll->wait); 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/gcc-mangled-3.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/mm/slub.c src/mm/slub.c 2 | --- src/mm/slub.c 2020-03-11 11:23:32.406727384 +0000 3 | +++ src/mm/slub.c 2020-03-11 11:28:27.973568215 +0000 4 | @@ -5836,6 +5836,9 @@ void get_slabinfo(struct kmem_cache *s, 5 | int node; 6 | struct kmem_cache_node *n; 7 | 8 | + if (!jiffies) 9 | + printk("slabinfo\n"); 10 | + 11 | for_each_kmem_cache_node(s, node, n) { 12 | nr_slabs += node_nr_slabs(n); 13 | nr_objs += node_nr_objs(n); 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/gcc-static-local-var-2.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/mm/mmap.c src/mm/mmap.c 2 | --- src/mm/mmap.c 2020-03-11 11:23:32.386726932 +0000 3 | +++ src/mm/mmap.c 2020-03-11 11:29:26.610955502 +0000 4 | @@ -1685,6 +1685,9 @@ unsigned long mmap_region(struct file *f 5 | struct rb_node **rb_link, *rb_parent; 6 | unsigned long charged = 0; 7 | 8 | + if (!jiffies) 9 | + printk("kpatch mmap foo\n"); 10 | + 11 | /* Check against address space limit. */ 12 | if (!may_expand_vm(mm, vm_flags, len >> PAGE_SHIFT)) { 13 | unsigned long nr_pages; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/gcc-static-local-var-3.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/kernel/reboot.c src/kernel/reboot.c 2 | --- src/kernel/reboot.c 2020-03-11 11:23:30.502684349 +0000 3 | +++ src/kernel/reboot.c 2020-03-11 11:30:24.412330397 +0000 4 | @@ -393,8 +393,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int 5 | return ret; 6 | } 7 | 8 | +void kpatch_bar(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch_foo\n"); 12 | +} 13 | + 14 | static void deferred_cad(struct work_struct *dummy) 15 | { 16 | + kpatch_bar(); 17 | kernel_restart(NULL); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/gcc-static-local-var-4.patch.disabled: -------------------------------------------------------------------------------- 1 | Disabled due to https:/github.com/dynup/kpatch/issues/940 2 | --- 3 | diff -Nupr src/fs/aio.c src/fs/aio.c 4 | --- src/fs/aio.c 2020-03-11 11:23:24.150540895 +0000 5 | +++ src/fs/aio.c 2020-03-11 11:45:44.710769201 +0000 6 | @@ -251,11 +251,18 @@ static int __init aio_setup(void) 7 | } 8 | __initcall(aio_setup); 9 | 10 | +void kpatch_aio_foo(void) 11 | +{ 12 | + if (!jiffies) 13 | + printk("kpatch aio foo\n"); 14 | +} 15 | + 16 | static void put_aio_ring_file(struct kioctx *ctx) 17 | { 18 | struct file *aio_ring_file = ctx->aio_ring_file; 19 | struct address_space *i_mapping; 20 | 21 | + kpatch_aio_foo(); 22 | if (aio_ring_file) { 23 | truncate_setsize(file_inode(aio_ring_file), 0); 24 | 25 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/gcc-static-local-var-4.test.disabled: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o pipefail 4 | if ! $(eu-readelf --wide --symbols test-gcc-static-local-var-4.ko | awk '$NF == "free_ioctx" { exit 1 }'); then 5 | exit 1 6 | else 7 | exit 0 8 | fi 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/gcc-static-local-var-6.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/net/ipv6/netfilter.c src/net/ipv6/netfilter.c 2 | --- src/net/ipv6/netfilter.c 2020-03-11 11:23:32.702734076 +0000 3 | +++ src/net/ipv6/netfilter.c 2020-03-11 11:31:22.397716246 +0000 4 | @@ -87,6 +87,8 @@ static int nf_ip6_reroute(struct sk_buff 5 | return 0; 6 | } 7 | 8 | +#include "kpatch-macros.h" 9 | + 10 | static int nf_ip6_route(struct net *net, struct dst_entry **dst, 11 | struct flowi *fl, bool strict) 12 | { 13 | @@ -100,6 +102,9 @@ static int nf_ip6_route(struct net *net, 14 | struct dst_entry *result; 15 | int err; 16 | 17 | + if (!jiffies) 18 | + printk("kpatch nf_ip6_route foo\n"); 19 | + 20 | result = ip6_route_output(net, sk, &fl->u.ip6); 21 | err = result->error; 22 | if (err) 23 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/meminfo-init-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src/fs/proc/meminfo.c 2020-03-11 11:23:26.882602572 +0000 3 | +++ src/fs/proc/meminfo.c 2020-03-11 11:34:17.189926874 +0000 4 | @@ -151,6 +151,7 @@ static int meminfo_proc_show(struct seq_ 5 | 6 | static int __init proc_meminfo_init(void) 7 | { 8 | + printk("a\n"); 9 | proc_create_single("meminfo", 0, NULL, meminfo_proc_show); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/meminfo-init2-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src/fs/proc/meminfo.c 2020-03-11 11:23:26.882602572 +0000 3 | +++ src/fs/proc/meminfo.c 2020-03-11 11:33:19.732537882 +0000 4 | @@ -40,6 +40,7 @@ static int meminfo_proc_show(struct seq_ 5 | unsigned long sreclaimable, sunreclaim; 6 | int lru; 7 | 8 | + printk("a\n"); 9 | si_meminfo(&i); 10 | si_swapinfo(&i); 11 | committed = percpu_counter_read_positive(&vm_committed_as); 12 | @@ -151,6 +152,7 @@ static int meminfo_proc_show(struct seq_ 13 | 14 | static int __init proc_meminfo_init(void) 15 | { 16 | + printk("a\n"); 17 | proc_create_single("meminfo", 0, NULL, meminfo_proc_show); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/meminfo-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep VMALLOCCHUNK /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/meminfo-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src/fs/proc/meminfo.c 2020-03-11 11:23:26.882602572 +0000 3 | +++ src/fs/proc/meminfo.c 2020-03-11 11:35:15.879349884 +0000 4 | @@ -120,7 +120,7 @@ static int meminfo_proc_show(struct seq_ 5 | seq_printf(m, "VmallocTotal: %8lu kB\n", 6 | (unsigned long)VMALLOC_TOTAL >> 10); 7 | show_val_kb(m, "VmallocUsed: ", 0ul); 8 | - show_val_kb(m, "VmallocChunk: ", 0ul); 9 | + show_val_kb(m, "VMALLOCCHUNK: ", 0ul); 10 | 11 | #ifdef CONFIG_MEMORY_FAILURE 12 | seq_printf(m, "HardwareCorrupted: %5lu kB\n", 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/module-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | sudo modprobe nfsd 6 | sleep 5 7 | grep -q kpatch /proc/fs/nfs/exports 8 | 9 | # TODO: This will trigger a printk on newer kernels which have the .klp.arch 10 | # removal. Don't actually do the grep until running on a newer kernel. 11 | echo "file fs/nfsd/export.c +p" > /sys/kernel/debug/dynamic_debug/control 12 | cat /proc/fs/nfs/exports > /dev/null 13 | # dmesg | grep -q "kpatch: pr_debug" 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/multiple.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" 4 | 5 | declare -a blacklist=(meminfo-string-LOADED.test) 6 | 7 | source ${SCRIPTDIR}/../common/multiple.template 8 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/parainstructions-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/fs/proc/generic.c src/fs/proc/generic.c 2 | --- src/fs/proc/generic.c 2020-03-11 11:23:26.878602482 +0000 3 | +++ src/fs/proc/generic.c 2020-03-11 11:39:07.677003695 +0000 4 | @@ -205,6 +205,7 @@ int proc_alloc_inum(unsigned int *inum) 5 | { 6 | int i; 7 | 8 | + printk("kpatch-test: testing change to .parainstructions section\n"); 9 | i = ida_simple_get(&proc_inum_ida, 0, UINT_MAX - PROC_DYNAMIC_FIRST + 1, 10 | GFP_KERNEL); 11 | if (i < 0) 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/shadow-newpid-LOADED.test.disabled: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep -q newpid: /proc/$$/status 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/smp-locks-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/drivers/tty/tty_buffer.c src/drivers/tty/tty_buffer.c 2 | --- src/drivers/tty/tty_buffer.c 2020-03-11 11:23:23.138518056 +0000 3 | +++ src/drivers/tty/tty_buffer.c 2020-03-11 11:40:04.174388205 +0000 4 | @@ -256,6 +256,9 @@ static int __tty_buffer_request_room(str 5 | struct tty_buffer *b, *n; 6 | int left, change; 7 | 8 | + if (!size) 9 | + printk("kpatch-test: testing .smp_locks section changes\n"); 10 | + 11 | b = buf->tail; 12 | if (b->flags & TTYB_NORMAL) 13 | left = 2 * b->size - b->used; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/special-static.patch.disabled: -------------------------------------------------------------------------------- 1 | diff -Nupr src/kernel/fork.c src/kernel/fork.c 2 | --- src/kernel/fork.c 2020-03-11 11:23:30.438682903 +0000 3 | +++ src/kernel/fork.c 2020-03-11 11:41:01.567796732 +0000 4 | @@ -1524,10 +1524,18 @@ static void posix_cpu_timers_init_group( 5 | static inline void posix_cpu_timers_init_group(struct signal_struct *sig) { } 6 | #endif 7 | 8 | +void kpatch_foo(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch copy signal\n"); 12 | +} 13 | + 14 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 15 | { 16 | struct signal_struct *sig; 17 | 18 | + kpatch_foo(); 19 | + 20 | if (clone_flags & CLONE_THREAD) 21 | return 0; 22 | 23 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/tracepoints-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/kernel/time/timer.c src/kernel/time/timer.c 2 | --- src/kernel/time/timer.c 2020-03-11 11:23:30.542685253 +0000 3 | +++ src/kernel/time/timer.c 2020-03-11 11:41:58.129186658 +0000 4 | @@ -1692,6 +1692,9 @@ static __latent_entropy void run_timer_s 5 | { 6 | struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); 7 | 8 | + if (!base) 9 | + printk("kpatch-test: testing __tracepoints section changes\n"); 10 | + 11 | __run_timers(base); 12 | if (IS_ENABLED(CONFIG_NO_HZ_COMMON)) 13 | __run_timers(this_cpu_ptr(&timer_bases[BASE_DEF])); 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.1/warn-detect-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c 2 | --- src/arch/x86/kvm/x86.c 2020-03-11 11:22:57.389938541 +0000 3 | +++ src/arch/x86/kvm/x86.c 2020-03-11 11:42:55.798605475 +0000 4 | @@ -1,3 +1,4 @@ 5 | + 6 | /* 7 | * Kernel-based Virtual Machine driver for Linux 8 | * 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/bug-table-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src.orig/fs/proc/proc_sysctl.c 2020-05-12 11:14:29.250791853 -0400 3 | +++ src/fs/proc/proc_sysctl.c 2020-05-12 11:14:36.220489794 -0400 4 | @@ -338,6 +338,8 @@ static void start_unregistering(struct c 5 | 6 | static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 7 | { 8 | + if (jiffies == 0) 9 | + printk("kpatch-test: testing __bug_table section changes\n"); 10 | BUG_ON(!head); 11 | spin_lock(&sysctl_lock); 12 | if (!use_table(head)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/cmdline-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep kpatch=1 /proc/cmdline 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/cmdline-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c 2 | --- src.orig/fs/proc/cmdline.c 2020-05-12 11:14:29.250791853 -0400 3 | +++ src/fs/proc/cmdline.c 2020-05-12 11:14:40.110321212 -0400 4 | @@ -6,8 +6,7 @@ 5 | 6 | static int cmdline_proc_show(struct seq_file *m, void *v) 7 | { 8 | - seq_puts(m, saved_command_line); 9 | - seq_putc(m, '\n'); 10 | + seq_printf(m, "%s kpatch=1\n", saved_command_line); 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/data-new-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep "kpatch: 5" /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/data-new.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2020-05-12 11:14:29.250791853 -0400 3 | +++ src/fs/proc/meminfo.c 2020-05-12 11:14:43.210186867 -0400 4 | @@ -31,6 +31,8 @@ static void show_val_kb(struct seq_file 5 | seq_write(m, " kB\n", 4); 6 | } 7 | 8 | +static int foo = 5; 9 | + 10 | static int meminfo_proc_show(struct seq_file *m, void *v) 11 | { 12 | struct sysinfo i; 13 | @@ -143,6 +145,7 @@ static int meminfo_proc_show(struct seq_ 14 | show_val_kb(m, "CmaFree: ", 15 | global_zone_page_state(NR_FREE_CMA_PAGES)); 16 | #endif 17 | + seq_printf(m, "kpatch: %d\n", foo); 18 | 19 | hugetlb_report_meminfo(m); 20 | 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/data-read-mostly.patch.disabled: -------------------------------------------------------------------------------- 1 | Disabled due to https:/github.com/dynup/kpatch/issues/940 2 | --- 3 | diff -Nupr src.orig/net/core/dev.c src/net/core/dev.c 4 | --- src.orig/net/core/dev.c 2020-05-12 11:14:29.800768017 -0400 5 | +++ src/net/core/dev.c 2020-05-12 11:15:38.827776462 -0400 6 | @@ -4893,6 +4893,7 @@ skip_classify: 7 | case RX_HANDLER_PASS: 8 | break; 9 | default: 10 | + printk("BUG!\n"); 11 | BUG(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/fixup-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/readdir.c src/fs/readdir.c 2 | --- src.orig/fs/readdir.c 2020-05-12 11:14:29.170795319 -0400 3 | +++ src/fs/readdir.c 2020-05-12 11:14:46.280053823 -0400 4 | @@ -189,6 +189,7 @@ static int filldir(struct dir_context *c 5 | goto efault; 6 | } 7 | dirent = buf->current_dir; 8 | + asm("nop"); 9 | if (__put_user(d_ino, &dirent->d_ino)) 10 | goto efault; 11 | if (__put_user(reclen, &dirent->d_reclen)) 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/gcc-constprop.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/time/timekeeping.c src/kernel/time/timekeeping.c 2 | --- src.orig/kernel/time/timekeeping.c 2020-05-12 11:14:29.670773651 -0400 3 | +++ src/kernel/time/timekeeping.c 2020-05-12 11:15:41.897643417 -0400 4 | @@ -1221,6 +1221,9 @@ void do_gettimeofday(struct timeval *tv) 5 | { 6 | struct timespec64 now; 7 | 8 | + if (!tv) 9 | + return; 10 | + 11 | getnstimeofday64(&now); 12 | tv->tv_sec = now.tv_sec; 13 | tv->tv_usec = now.tv_nsec/1000; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/gcc-isra.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src.orig/fs/proc/proc_sysctl.c 2020-05-12 11:14:29.250791853 -0400 3 | +++ src/fs/proc/proc_sysctl.c 2020-05-12 11:14:49.359920345 -0400 4 | @@ -53,6 +53,7 @@ void proc_sys_poll_notify(struct ctl_tab 5 | if (!poll) 6 | return; 7 | 8 | + printk("kpatch-test: testing gcc .isra function name mangling\n"); 9 | atomic_inc(&poll->event); 10 | wake_up_interruptible(&poll->wait); 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/gcc-mangled-3.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/mm/slub.c src/mm/slub.c 2 | --- src.orig/mm/slub.c 2020-05-12 11:14:32.110667908 -0400 3 | +++ src/mm/slub.c 2020-05-12 11:14:52.439786867 -0400 4 | @@ -5852,6 +5852,9 @@ void get_slabinfo(struct kmem_cache *s, 5 | int node; 6 | struct kmem_cache_node *n; 7 | 8 | + if (!jiffies) 9 | + printk("slabinfo\n"); 10 | + 11 | for_each_kmem_cache_node(s, node, n) { 12 | nr_slabs += node_nr_slabs(n); 13 | nr_objs += node_nr_objs(n); 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/gcc-static-local-var-2.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/mm/mmap.c src/mm/mmap.c 2 | --- src.orig/mm/mmap.c 2020-05-12 11:14:32.110667908 -0400 3 | +++ src/mm/mmap.c 2020-05-12 11:14:55.529652955 -0400 4 | @@ -1679,6 +1679,9 @@ unsigned long mmap_region(struct file *f 5 | struct rb_node **rb_link, *rb_parent; 6 | unsigned long charged = 0; 7 | 8 | + if (!jiffies) 9 | + printk("kpatch mmap foo\n"); 10 | + 11 | /* Check against address space limit. */ 12 | if (!may_expand_vm(mm, vm_flags, len >> PAGE_SHIFT)) { 13 | unsigned long nr_pages; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/gcc-static-local-var-3.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/reboot.c src/kernel/reboot.c 2 | --- src.orig/kernel/reboot.c 2020-05-12 11:14:29.670773651 -0400 3 | +++ src/kernel/reboot.c 2020-05-12 11:14:58.579520777 -0400 4 | @@ -393,8 +393,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int 5 | return ret; 6 | } 7 | 8 | +void kpatch_bar(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch_foo\n"); 12 | +} 13 | + 14 | static void deferred_cad(struct work_struct *dummy) 15 | { 16 | + kpatch_bar(); 17 | kernel_restart(NULL); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/gcc-static-local-var-4.patch.disabled: -------------------------------------------------------------------------------- 1 | Disabled due to https:/github.com/dynup/kpatch/issues/940 2 | --- 3 | diff -Nupr src.orig/fs/aio.c src/fs/aio.c 4 | --- src.orig/fs/aio.c 2020-05-12 11:14:29.130797053 -0400 5 | +++ src/fs/aio.c 2020-05-12 11:15:44.967510372 -0400 6 | @@ -251,11 +251,18 @@ static int __init aio_setup(void) 7 | } 8 | __initcall(aio_setup); 9 | 10 | +void kpatch_aio_foo(void) 11 | +{ 12 | + if (!jiffies) 13 | + printk("kpatch aio foo\n"); 14 | +} 15 | + 16 | static void put_aio_ring_file(struct kioctx *ctx) 17 | { 18 | struct file *aio_ring_file = ctx->aio_ring_file; 19 | struct address_space *i_mapping; 20 | 21 | + kpatch_aio_foo(); 22 | if (aio_ring_file) { 23 | truncate_setsize(file_inode(aio_ring_file), 0); 24 | 25 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/gcc-static-local-var-4.test.disabled: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o pipefail 4 | if ! $(eu-readelf --wide --symbols test-gcc-static-local-var-4.ko | awk '$NF == "free_ioctx" { exit 1 }'); then 5 | exit 1 6 | else 7 | exit 0 8 | fi 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/gcc-static-local-var-6.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/net/ipv6/netfilter.c src/net/ipv6/netfilter.c 2 | --- src.orig/net/ipv6/netfilter.c 2020-05-12 11:14:29.820767150 -0400 3 | +++ src/net/ipv6/netfilter.c 2020-05-12 11:15:01.659387299 -0400 4 | @@ -87,6 +87,8 @@ static int nf_ip6_reroute(struct sk_buff 5 | return 0; 6 | } 7 | 8 | +#include "kpatch-macros.h" 9 | + 10 | static int nf_ip6_route(struct net *net, struct dst_entry **dst, 11 | struct flowi *fl, bool strict) 12 | { 13 | @@ -100,6 +102,9 @@ static int nf_ip6_route(struct net *net, 14 | struct dst_entry *result; 15 | int err; 16 | 17 | + if (!jiffies) 18 | + printk("kpatch nf_ip6_route foo\n"); 19 | + 20 | result = ip6_route_output(net, sk, &fl->u.ip6); 21 | err = result->error; 22 | if (err) 23 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/meminfo-init-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2020-05-12 11:14:29.250791853 -0400 3 | +++ src/fs/proc/meminfo.c 2020-05-12 11:15:13.848859021 -0400 4 | @@ -153,6 +153,7 @@ static int meminfo_proc_show(struct seq_ 5 | 6 | static int __init proc_meminfo_init(void) 7 | { 8 | + printk("a\n"); 9 | proc_create_single("meminfo", 0, NULL, meminfo_proc_show); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/meminfo-init2-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2020-05-12 11:14:29.250791853 -0400 3 | +++ src/fs/proc/meminfo.c 2020-05-12 11:15:10.778992066 -0400 4 | @@ -41,6 +41,7 @@ static int meminfo_proc_show(struct seq_ 5 | unsigned long sreclaimable, sunreclaim; 6 | int lru; 7 | 8 | + printk("a\n"); 9 | si_meminfo(&i); 10 | si_swapinfo(&i); 11 | committed = percpu_counter_read_positive(&vm_committed_as); 12 | @@ -153,6 +154,7 @@ static int meminfo_proc_show(struct seq_ 13 | 14 | static int __init proc_meminfo_init(void) 15 | { 16 | + printk("a\n"); 17 | proc_create_single("meminfo", 0, NULL, meminfo_proc_show); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/meminfo-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep VMALLOCCHUNK /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/meminfo-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2020-05-12 11:24:25.954931343 -0400 3 | +++ src/fs/proc/meminfo.c 2020-05-12 11:24:33.774592448 -0400 4 | @@ -121,7 +121,7 @@ static int meminfo_proc_show(struct seq_ 5 | seq_printf(m, "VmallocTotal: %8lu kB\n", 6 | (unsigned long)VMALLOC_TOTAL >> 10); 7 | show_val_kb(m, "VmallocUsed: ", 0ul); 8 | - show_val_kb(m, "VmallocChunk: ", 0ul); 9 | + show_val_kb(m, "VMALLOCCHUNK: ", 0ul); 10 | show_val_kb(m, "Percpu: ", pcpu_nr_pages()); 11 | 12 | #ifdef CONFIG_MEMORY_FAILURE 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/module-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | sudo modprobe nfsd 6 | sleep 5 7 | grep -q kpatch /proc/fs/nfs/exports 8 | 9 | # TODO: This will trigger a printk on newer kernels which have the .klp.arch 10 | # removal. Don't actually do the grep until running on a newer kernel. 11 | echo "file fs/nfsd/export.c +p" > /sys/kernel/debug/dynamic_debug/control 12 | cat /proc/fs/nfs/exports > /dev/null 13 | # dmesg | grep -q "kpatch: pr_debug" 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/multiple.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" 4 | 5 | declare -a blacklist=(meminfo-string-LOADED.test) 6 | 7 | source ${SCRIPTDIR}/../common/multiple.template 8 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/parainstructions-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/generic.c src/fs/proc/generic.c 2 | --- src.orig/fs/proc/generic.c 2020-05-12 11:14:29.250791853 -0400 3 | +++ src/fs/proc/generic.c 2020-05-12 11:15:26.558308207 -0400 4 | @@ -205,6 +205,7 @@ int proc_alloc_inum(unsigned int *inum) 5 | { 6 | int i; 7 | 8 | + printk("kpatch-test: testing change to .parainstructions section\n"); 9 | i = ida_simple_get(&proc_inum_ida, 0, UINT_MAX - PROC_DYNAMIC_FIRST + 1, 10 | GFP_KERNEL); 11 | if (i < 0) 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/shadow-newpid-LOADED.test.disabled: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep -q newpid: /proc/$$/status 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/smp-locks-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/drivers/tty/tty_buffer.c src/drivers/tty/tty_buffer.c 2 | --- src.orig/drivers/tty/tty_buffer.c 2020-05-12 11:14:32.780638873 -0400 3 | +++ src/drivers/tty/tty_buffer.c 2020-05-12 11:15:29.618175596 -0400 4 | @@ -256,6 +256,9 @@ static int __tty_buffer_request_room(str 5 | struct tty_buffer *b, *n; 6 | int left, change; 7 | 8 | + if (!size) 9 | + printk("kpatch-test: testing .smp_locks section changes\n"); 10 | + 11 | b = buf->tail; 12 | if (b->flags & TTYB_NORMAL) 13 | left = 2 * b->size - b->used; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/special-static.patch.disabled: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/fork.c src/kernel/fork.c 2 | --- src.orig/kernel/fork.c 2020-05-12 11:14:29.670773651 -0400 3 | +++ src/kernel/fork.c 2020-05-12 11:15:54.197110372 -0400 4 | @@ -1523,10 +1523,18 @@ static void posix_cpu_timers_init_group( 5 | static inline void posix_cpu_timers_init_group(struct signal_struct *sig) { } 6 | #endif 7 | 8 | +void kpatch_foo(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch copy signal\n"); 12 | +} 13 | + 14 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 15 | { 16 | struct signal_struct *sig; 17 | 18 | + kpatch_foo(); 19 | + 20 | if (clone_flags & CLONE_THREAD) 21 | return 0; 22 | 23 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/tracepoints-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/time/timer.c src/kernel/time/timer.c 2 | --- src.orig/kernel/time/timer.c 2020-05-12 11:14:29.670773651 -0400 3 | +++ src/kernel/time/timer.c 2020-05-12 11:15:32.688042552 -0400 4 | @@ -1696,6 +1696,9 @@ static __latent_entropy void run_timer_s 5 | { 6 | struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); 7 | 8 | + if (!base) 9 | + printk("kpatch-test: testing __tracepoints section changes\n"); 10 | + 11 | __run_timers(base); 12 | if (IS_ENABLED(CONFIG_NO_HZ_COMMON)) 13 | __run_timers(this_cpu_ptr(&timer_bases[BASE_DEF])); 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/rhel-8.2/warn-detect-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c 2 | --- src.orig/arch/x86/kvm/x86.c 2020-05-12 11:14:30.610732914 -0400 3 | +++ src/arch/x86/kvm/x86.c 2020-05-12 11:15:35.767909073 -0400 4 | @@ -1,3 +1,4 @@ 5 | + 6 | /* 7 | * Kernel-based Virtual Machine driver for Linux 8 | * 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/README: -------------------------------------------------------------------------------- 1 | 4.4.0-53-generic 2 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/bug-table-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src.orig/fs/proc/proc_sysctl.c 2016-12-15 19:55:39.084000000 +0000 3 | +++ src/fs/proc/proc_sysctl.c 2016-12-15 19:56:00.204000000 +0000 4 | @@ -301,6 +301,8 @@ void sysctl_head_put(struct ctl_table_he 5 | 6 | static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 7 | { 8 | + if (jiffies == 0) 9 | + printk("kpatch-test: testing __bug_table section changes\n"); 10 | BUG_ON(!head); 11 | spin_lock(&sysctl_lock); 12 | if (!use_table(head)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/cmdline-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep kpatch=1 /proc/cmdline 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/cmdline-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c 2 | --- src.orig/fs/proc/cmdline.c 2016-12-15 19:55:39.084000000 +0000 3 | +++ src/fs/proc/cmdline.c 2016-12-15 19:56:12.848000000 +0000 4 | @@ -5,7 +5,7 @@ 5 | 6 | static int cmdline_proc_show(struct seq_file *m, void *v) 7 | { 8 | - seq_printf(m, "%s\n", saved_command_line); 9 | + seq_printf(m, "%s kpatch=1\n", saved_command_line); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/data-new-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep "kpatch: 5" /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/data-read-mostly.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/net/core/dev.c src/net/core/dev.c 2 | --- src.orig/net/core/dev.c 2016-12-15 19:55:39.848000000 +0000 3 | +++ src/net/core/dev.c 2016-12-15 19:56:21.344000000 +0000 4 | @@ -3926,6 +3926,7 @@ ncls: 5 | case RX_HANDLER_PASS: 6 | break; 7 | default: 8 | + printk("BUG!\n"); 9 | BUG(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/fixup-section.patch: -------------------------------------------------------------------------------- 1 | diff --git a/fs/readdir.c b/fs/readdir.c 2 | index ced679179cac..7fb338324582 100644 3 | --- a/fs/readdir.c 4 | +++ b/fs/readdir.c 5 | @@ -173,6 +173,7 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, 6 | goto efault; 7 | } 8 | dirent = buf->current_dir; 9 | + asm("nop"); 10 | if (__put_user(d_ino, &dirent->d_ino)) 11 | goto efault; 12 | if (__put_user(reclen, &dirent->d_reclen)) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/gcc-constprop.patch: -------------------------------------------------------------------------------- 1 | ensure timekeeping_forward_now.constprop.8 and 2 | timekeeping_forward_now.constprop.9 are correlated. 3 | 4 | diff -Nupr src.orig/kernel/time/timekeeping.c src/kernel/time/timekeeping.c 5 | --- src.orig/kernel/time/timekeeping.c 2016-12-15 19:56:00.136000000 +0000 6 | +++ src/kernel/time/timekeeping.c 2016-12-15 19:56:30.496000000 +0000 7 | @@ -1148,6 +1148,9 @@ void do_gettimeofday(struct timeval *tv) 8 | { 9 | struct timespec64 now; 10 | 11 | + if (!tv) 12 | + return; 13 | + 14 | getnstimeofday64(&now); 15 | tv->tv_sec = now.tv_sec; 16 | tv->tv_usec = now.tv_nsec/1000; 17 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/gcc-isra.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c 2 | --- src.orig/fs/proc/proc_sysctl.c 2016-12-15 19:55:39.084000000 +0000 3 | +++ src/fs/proc/proc_sysctl.c 2016-12-15 19:56:34.800000000 +0000 4 | @@ -46,6 +46,7 @@ void proc_sys_poll_notify(struct ctl_tab 5 | if (!poll) 6 | return; 7 | 8 | + printk("kpatch-test: testing gcc .isra function name mangling\n"); 9 | atomic_inc(&poll->event); 10 | wake_up_interruptible(&poll->wait); 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/gcc-mangled-3.patch.disabled: -------------------------------------------------------------------------------- 1 | ensure that __cmpxchg_double_slab.isra.45 and 2 | __cmpxchg_double_slab.isra.45.part.46 aren't correlated. 3 | 4 | Disabled: __flush_cpu_slab() is present in vmlinux.symtab but is optimized 5 | out during kpatch builds 6 | 7 | diff -Nupr src.orig/mm/slub.c src/mm/slub.c 8 | --- src.orig/mm/slub.c 2016-12-15 19:55:38.988000000 +0000 9 | +++ src/mm/slub.c 2016-12-15 19:56:39.068000000 +0000 10 | @@ -5531,6 +5531,9 @@ void get_slabinfo(struct kmem_cache *s, 11 | int node; 12 | struct kmem_cache_node *n; 13 | 14 | + if (!jiffies) 15 | + printk("slabinfo\n"); 16 | + 17 | for_each_kmem_cache_node(s, node, n) { 18 | nr_slabs += node_nr_slabs(n); 19 | nr_objs += node_nr_objs(n); 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/gcc-static-local-var-2.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/mm/mmap.c src/mm/mmap.c 2 | --- src.orig/mm/mmap.c 2016-12-15 19:55:38.992000000 +0000 3 | +++ src/mm/mmap.c 2016-12-15 19:56:43.684000000 +0000 4 | @@ -1547,6 +1548,9 @@ unsigned long mmap_region(struct file *f 5 | struct rb_node **rb_link, *rb_parent; 6 | unsigned long charged = 0; 7 | 8 | + if (!jiffies) 9 | + printk("kpatch mmap foo\n"); 10 | + 11 | /* Check against address space limit. */ 12 | if (!may_expand_vm(mm, len >> PAGE_SHIFT)) { 13 | unsigned long nr_pages; 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/gcc-static-local-var-3.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/reboot.c src/kernel/reboot.c 2 | --- src.orig/kernel/reboot.c 2016-12-15 19:56:00.196000000 +0000 3 | +++ src/kernel/reboot.c 2016-12-15 19:56:48.264000000 +0000 4 | @@ -366,8 +366,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int 5 | return ret; 6 | } 7 | 8 | +void kpatch_bar(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch_foo\n"); 12 | +} 13 | + 14 | static void deferred_cad(struct work_struct *dummy) 15 | { 16 | + kpatch_bar(); 17 | kernel_restart(NULL); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/gcc-static-local-var-4.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/aio.c src/fs/aio.c 2 | --- src.orig/fs/aio.c 2016-12-15 19:55:38.992000000 +0000 3 | +++ src/fs/aio.c 2016-12-15 19:56:52.588000000 +0000 4 | @@ -271,9 +271,16 @@ static int __init aio_setup(void) 5 | } 6 | __initcall(aio_setup); 7 | 8 | +void kpatch_aio_foo(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch aio foo\n"); 12 | +} 13 | + 14 | static void put_aio_ring_file(struct kioctx *ctx) 15 | { 16 | struct file *aio_ring_file = ctx->aio_ring_file; 17 | + kpatch_aio_foo(); 18 | if (aio_ring_file) { 19 | truncate_setsize(aio_ring_file->f_inode, 0); 20 | 21 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/gcc-static-local-var-4.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o pipefail 4 | if ! $(eu-readelf --wide --symbols test-gcc-static-local-var-4.ko | awk '$NF == "free_ioctx" { exit 1 }'); then 5 | exit 1 6 | else 7 | exit 0 8 | fi 9 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/gcc-static-local-var-6.patch: -------------------------------------------------------------------------------- 1 | diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c 2 | index 39970e2..85e750d 100644 3 | --- a/net/ipv6/netfilter.c 4 | +++ b/net/ipv6/netfilter.c 5 | @@ -108,6 +108,8 @@ static int nf_ip6_reroute(struct net *net, struct sk_buff *skb, 6 | return 0; 7 | } 8 | 9 | +#include "kpatch-macros.h" 10 | + 11 | static int nf_ip6_route(struct net *net, struct dst_entry **dst, 12 | struct flowi *fl, bool strict) 13 | { 14 | @@ -121,6 +123,9 @@ static int nf_ip6_route(struct net *net, struct dst_entry **dst, 15 | struct dst_entry *result; 16 | int err; 17 | 18 | + if (!jiffies) 19 | + printk("kpatch nf_ip6_route foo\n"); 20 | + 21 | result = ip6_route_output(net, sk, &fl->u.ip6); 22 | err = result->error; 23 | if (err) 24 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/meminfo-cmdline-rebuild-SLOW-LOADED.test.disabled: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep VMALLOCCHUNK /proc/meminfo && grep kpatch=1 /proc/cmdline 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/meminfo-init-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2016-12-15 19:55:39.084000000 +0000 3 | +++ src/fs/proc/meminfo.c 2016-12-15 19:57:22.564000000 +0000 4 | @@ -193,6 +193,7 @@ static const struct file_operations memi 5 | 6 | static int __init proc_meminfo_init(void) 7 | { 8 | + printk("a\n"); 9 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/meminfo-init2-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2016-12-15 19:55:39.084000000 +0000 3 | +++ src/fs/proc/meminfo.c 2016-12-15 19:57:18.240000000 +0000 4 | @@ -32,6 +32,7 @@ static int meminfo_proc_show(struct seq_ 5 | unsigned long pages[NR_LRU_LISTS]; 6 | int lru; 7 | 8 | + printk("a\n"); 9 | /* 10 | * display in kilobytes. 11 | */ 12 | @@ -193,6 +194,7 @@ static const struct file_operations memi 13 | 14 | static int __init proc_meminfo_init(void) 15 | { 16 | + printk("a\n"); 17 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/meminfo-string-LOADED.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grep VMALLOCCHUNK /proc/meminfo 4 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/meminfo-string.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c 2 | --- src.orig/fs/proc/meminfo.c 2016-12-15 19:55:39.084000000 +0000 3 | +++ src/fs/proc/meminfo.c 2016-12-15 19:57:26.828000000 +0000 4 | @@ -99,7 +99,7 @@ static int meminfo_proc_show(struct seq_ 5 | "Committed_AS: %8lu kB\n" 6 | "VmallocTotal: %8lu kB\n" 7 | "VmallocUsed: %8lu kB\n" 8 | - "VmallocChunk: %8lu kB\n" 9 | + "VMALLOCCHUNK: %8lu kB\n" 10 | #ifdef CONFIG_MEMORY_FAILURE 11 | "HardwareCorrupted: %5lu kB\n" 12 | #endif 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/module-kvm-fixup.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/vmx.c src/arch/x86/kvm/vmx.c 2 | --- src.orig/arch/x86/kvm/vmx.c 2016-12-15 19:55:57.436000000 +0000 3 | +++ src/arch/x86/kvm/vmx.c 2016-12-15 19:57:35.344000000 +0000 4 | @@ -10574,6 +10574,8 @@ static int vmx_check_intercept(struct kv 5 | struct x86_instruction_info *info, 6 | enum x86_intercept_stage stage) 7 | { 8 | + if (!jiffies) 9 | + printk("kpatch vmx_check_intercept\n"); 10 | return X86EMUL_CONTINUE; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/multiple.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" 4 | 5 | declare -a blacklist=(data-new-LOADED.test meminfo-cmdline-rebuild-SLOW-LOADED.test) 6 | 7 | source ${SCRIPTDIR}/../common/multiple.template 8 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/parainstructions-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/fs/proc/generic.c src/fs/proc/generic.c 2 | --- src.orig/fs/proc/generic.c 2016-12-15 19:55:39.076000000 +0000 3 | +++ src/fs/proc/generic.c 2016-12-15 19:57:52.340000000 +0000 4 | @@ -195,6 +195,7 @@ int proc_alloc_inum(unsigned int *inum) 5 | unsigned int i; 6 | int error; 7 | 8 | + printk("kpatch-test: testing change to .parainstructions section\n"); 9 | retry: 10 | if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL)) 11 | return -ENOMEM; 12 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/replace-section-references.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c 2 | --- src.orig/arch/x86/kvm/x86.c 2016-12-15 19:55:57.436000000 +0000 3 | +++ src/arch/x86/kvm/x86.c 2016-12-15 19:57:56.596000000 +0000 4 | @@ -230,6 +230,8 @@ static void shared_msr_update(unsigned s 5 | 6 | void kvm_define_shared_msr(unsigned slot, u32 msr) 7 | { 8 | + if (!jiffies) 9 | + printk("kpatch kvm define shared msr\n"); 10 | BUG_ON(slot >= KVM_NR_SHARED_MSRS); 11 | shared_msrs_global.msrs[slot] = msr; 12 | if (slot >= shared_msrs_global.nr) 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/smp-locks-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/drivers/tty/tty_buffer.c src/drivers/tty/tty_buffer.c 2 | --- src.orig/drivers/tty/tty_buffer.c 2016-12-15 19:55:54.840000000 +0000 3 | +++ src/drivers/tty/tty_buffer.c 2016-12-15 19:58:05.088000000 +0000 4 | @@ -255,6 +255,8 @@ static int __tty_buffer_request_room(str 5 | struct tty_buffer *b, *n; 6 | int left, change; 7 | 8 | + if (!size) 9 | + printk("kpatch-test: testing .smp_locks section changes\n"); 10 | b = buf->tail; 11 | if (b->flags & TTYB_NORMAL) 12 | left = 2 * b->size - b->used; 13 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/special-static.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/fork.c src/kernel/fork.c 2 | --- src.orig/kernel/fork.c 2016-12-15 19:56:00.184000000 +0000 3 | +++ src/kernel/fork.c 2016-12-15 19:58:13.588000000 +0000 4 | @@ -1143,10 +1143,18 @@ static void posix_cpu_timers_init_group( 5 | INIT_LIST_HEAD(&sig->cpu_timers[2]); 6 | } 7 | 8 | +void kpatch_foo(void) 9 | +{ 10 | + if (!jiffies) 11 | + printk("kpatch copy signal\n"); 12 | +} 13 | + 14 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 15 | { 16 | struct signal_struct *sig; 17 | 18 | + kpatch_foo(); 19 | + 20 | if (clone_flags & CLONE_THREAD) 21 | return 0; 22 | 23 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/tracepoints-section.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/kernel/time/timer.c src/kernel/time/timer.c 2 | --- src.orig/kernel/time/timer.c 2016-01-10 23:01:32.000000000 +0000 3 | +++ src/kernel/time/timer.c 2016-12-15 20:27:00.368000000 +0000 4 | @@ -1433,6 +1433,9 @@ static void run_timer_softirq(struct sof 5 | { 6 | struct tvec_base *base = this_cpu_ptr(&tvec_bases); 7 | 8 | + if (!base) 9 | + printk("kpatch-test: testing __tracepoints section changes\n"); 10 | + 11 | if (time_after_eq(jiffies, base->timer_jiffies)) 12 | __run_timers(base); 13 | } 14 | -------------------------------------------------------------------------------- /src/kpatch/test/integration/ubuntu-16.04/warn-detect-FAIL.patch: -------------------------------------------------------------------------------- 1 | diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c 2 | --- src.orig/arch/x86/kvm/x86.c 2016-12-15 19:55:57.436000000 +0000 3 | +++ src/arch/x86/kvm/x86.c 2016-12-15 19:58:17.844000000 +0000 4 | @@ -1,3 +1,4 @@ 5 | + 6 | /* 7 | * Kernel-based Virtual Machine driver for Linux 8 | * 9 | -------------------------------------------------------------------------------- /src/kpatch/test/test-functions.sh: -------------------------------------------------------------------------------- 1 | FILE=$1 2 | 3 | assert_num_funcs() { 4 | local num_funcs=$(nm $FILE | grep -i " t " | wc -l) 5 | 6 | if [[ $num_funcs != $1 ]]; then 7 | echo "$FILE: assertion failed: file has $num_funcs funcs, expected $1" 1>&2 8 | exit 1 9 | fi 10 | 11 | return 0 12 | } 13 | -------------------------------------------------------------------------------- /src/kpatch/test/unit/Makefile: -------------------------------------------------------------------------------- 1 | ARCH = $(shell uname -m) 2 | OBJDIR ?= objs/$(ARCH) 3 | 4 | .PHONY: all clean 5 | 6 | all: Makefile.include 7 | @cd $(shell git rev-parse --show-toplevel) && \ 8 | git diff-index --quiet HEAD test/unit/objs || \ 9 | echo -e "\nWARNING: unit tests are out of date - run \"git submodule update\"\n" 10 | $(MAKE) -C $(OBJDIR) 11 | 12 | clean: Makefile.include 13 | if [ -d $(OBJDIR) ]; then $(MAKE) -C $(OBJDIR) clean; fi 14 | --------------------------------------------------------------------------------