linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maciej Hrebien <m_hrebien@wp.pl>
To: linuxassembly@unusedino.de
Cc: linux-assembly@vger.kernel.org
Subject: SMC article
Date: Fri, 06 Aug 2004 11:25:29 +0200	[thread overview]
Message-ID: <41134E89.6487ABC9@wp.pl> (raw)

Hi Karsten,

long time ago i had briefly looked at your SMC article placed at
linuxassembly.org but yesterday i opened it once again (by accident) and
read it more careful ;) The code is quite tricky i admire but i have one
small suggestion: you write only about .bss, placing the code in and
execute in it. It gives the illusion that SMC technique can only be used
in .bss. I think you should consider writing something about
un-mprotect-ing .text and doing SMC on it just to avoid this kind of
illusion. Let me illustrate what i mean:

.set PAGE_SZ, 4096
.set PROT_RD, 1
.set PROT_WR, 2
.set PROT_EX, 4

.text

.globl _start
_start:
        mov     $125,%eax         # change protection of code seg...
        mov     $_start,%ebx
        mov     $PAGE_SZ,%ecx
        and     $~(PAGE_SZ-1),%ebx
        mov     $(PROT_RD|PROT_WR|PROT_EX),%edx
        int     $0x80
hello:
        mov     $4,%eax           # write some text...
        mov     $1,%ebx
        mov     $msg,%ecx
        mov     $msglen,%edx
        int     $0x80

        mov     $exit,%esi        # change our "hello" a little bit...
        mov     $hello,%edi
        mov     $(end-exit),%ecx
        rep     movsb

        jmp     hello             # and print it again... ;)
exit:
        mov     $1,%eax
        xor     %ebx,%ebx
        int     $0x80
end:
        msg:    .ascii "hello :)\n"
        msglen  = .- msg
.end


Please consider my suggestion in your future update(s) of the
article. With regards,

-- 
Maciej Hrebien


             reply	other threads:[~2004-08-06  9:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-06  9:25 Maciej Hrebien [this message]
     [not found] ` <20040810190412.G20945@codepoet.unixcoders.org>
2004-08-12  6:00   ` SMC article Maciej Hrebien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41134E89.6487ABC9@wp.pl \
    --to=m_hrebien@wp.pl \
    --cc=linux-assembly@vger.kernel.org \
    --cc=linuxassembly@unusedino.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).