MemGuardを加えました

追加

# DEBUG_MEMGUARD builds and enables memguard(9), a replacement allocator
# for the kernel used to detect modify-after-free scenarios.  See the
# memguard(9) man page for more information on usage.
# DEBUG_MEMGUARDはmodify-after-freeシナリオを検出するのに使用されるカーネルの
# ための代替アロケータ、memguard(9)を構築し、有効にします。使用方法に関する
# 詳しい情報にはmemguard(9)マニュアルページを参照してください。

options DEBUG_MEMGUARD

commit log

Bring in MemGuard, a very simple and small replacement allocator designed to help detect tamper-after-free scenarios, a problem more and more common and likely with multithreaded kernels where race conditions are more prevalent.
導入したMemGuardは、競合条件がより多くあるマルチスレッド化されたカーネルでますます一般的でありがちな問題、解放後変更(tamper-after-free)シナリオを検出するのを助けるように設計された、非常に簡単で小さい代替アロケータです。
Currently MemGuard can only take over malloc()/realloc()/free() for particular (a) malloc type(s) and the code brought in with this change manually instruments it to take over M_SUBPROC allocations as an example. If you are planning to use it, for now you must:
現在のMemGuardは特定のmallocタイプのためにmalloc()/realloc()/free()を引き継ぐことができるだけで、この変更により導入されたコードは、例えばM_SUBPROCアロケーションを引き継ぐために手動で取り付けます。これの使用を計画しているなら、あなたは次のようにしなければなりません。

  1. Put "options DEBUG_MEMGUARD" in your kernel config.
    あなたのカーネル設定ファイルに「options DEBUG_MEMGUARD」を加えます。
  2. Edit src/sys/kern/kern_malloc.c manually, look for "XXX CHANGEME" and replace the M_SUBPROC comparison with the appropriate malloc type (this might require additional but small/simple code modification if, say, the malloc type is declared out of scope).
    手動でsrc/sys/kern/kern_malloc.cを編集し、「XXX CHANGEME」を見つけてM_SUBPROCの比較を特定のmallocタイプに置き換えて下さい(これは付加的な要求ですが、もしmallocタイプが宣言スコープ外ならば、小さな/単純なコード修正が必要です)。
  3. Build and install your kernel. Tune vm.memguard_divisor boot-time tunable which is used to scale how much of kmem_map you want to allott for MemGuard's use. The default is 10, so kmem_size/10.
    カーネルを構築しインストールします。MemGuardが使用するために割り当てたいkmem_mapの尺度として使用される、ブート時に調整可能なvm.memguard_divisorを調整します。デフォルトは10、つまりkmem_size/10です。

ToDo:

  1. Bring in a memguard(9) man page.
    memguard(9)マニュアルページの導入
  2. Better instrumentation (e.g., boot-time) of MemGuard taking over malloc types.
    mallocタイプを引き継ぐMemGuardのよりよい手段(例えばブート時)
  3. Teach UMA about MemGuard to allow MemGuard to override zone allocations too.
    MemGuardがゾーン割付けも書き換えることを可能にするMemGuardに関してUMAに教える
  4. Improve MemGuard if necessary.
    必要に応じたMemGuardの改善

This work is partly based on some old patches from Ian Dowse.
これは部分的にIan Dowseからのいくつかの古いパッチに基づいています。
$FreeBSD: src/sys/conf/NOTES,v 1.1296 2005/01/21 18:09:16 bmilekic Exp $