<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mmxsrup</author_name>
  <author_url>https://blog.hatena.ne.jp/mmxsrup/</author_url>
  <blog_title>srupのメモ帳</blog_title>
  <blog_url>https://mmxsrup.hatenablog.com/</blog_url>
  <categories>
    <anon>バイナリ</anon>
  </categories>
  <description>自己書き換えコードとは, 実行時に自分自身の命令を書き換えるコードのことである. 以下のコードでは, foo() 関数の i++ の命令を i += 2に自己書き換えしている. 順に説明していくと, まず mprotect() 関数でfoo関数の命令が書かれているページに読み, 書き, 実行の権限を与える. foo() 関数を書き換えるので, 書き換え権限を与えなければならない. 通常セキュリティーの観点から関数などのコードが書かれている領域は書き込み権限がない. 次に, 普通に foo() を呼び出した後, foo() 関数の先頭から 18 byte進んだ位置のbyteに 0x2 を書き込ん…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmmxsrup.hatenablog.com%2Fentry%2F2019%2F04%2F23%2F225540&quot; title=&quot;自己書き換えコード(self-modifying code) - srupのメモ帳&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-04-23 22:55:40</published>
  <title>自己書き換えコード(self-modifying code)</title>
  <type>rich</type>
  <url>https://mmxsrup.hatenablog.com/entry/2019/04/23/225540</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
