Skip to contentSkip to conversation

setgroups32 syscall changes RCX register

DISCUSSION Pavel N. Iakovenko 1 participant 1 message Jun 9, 2010

lore
Share & tools
lore
#0 lore raw

Hello

I noticed that setgroups32 syscall changes the value of RCX register. In my case  - it is increased by PAGE_SIZE. Is it an acceptable behavior? Kernel version is 2.6.31.6. Testing program is enclosed.

Please CC me on reply.

Best regards,
Pavel Iakovenko

#include <unistd.h>
#include <sys/types.h>
#include <syscall.h>
#include <grp.h>
#include <stdio.h>
#include <errno.h>

int main()
{
            gid_t groups;
            unsigned long rcx;
            int r ;

            r = initgroups("root", groups);
            if (r) {
                printf("initgroups failed\n");
                goto out;
            }

            printf("before setgroups32: RCX = 0x%lx\n", (unsigned long)&groups);

            asm
            (
                        "int $0x80"
                        : "=a" (r), "=c" (rcx)
                        : "a" (SYS_setgroups32), "b"(1), "c" (&groups) );

            if (r) {
                printf("setgroups32 failed\n"); goto out;
            }

            printf("after setgroups32: RCX = 0x%lx\n", rcx);

out:
            return 0;
}

__________ Information from ESET NOD32 Antivirus, version of virus signature database 5184 (20100609) __________

The message was checked by ESET NOD32 Antivirus.

http://www.esetnod32.ru/.ml

ЪТХ╨{.nг+┴╥÷╝┴╜├+%┼кЪ╠Ищ╤╔┼wЪ╨{.nг+┴╥╔┼{╠ЧG╚²ИЪ┼{ay╨й┤з≥К,j╜╒fё╒╥h ▐О│ЙЪ▒ЙГz_Х╝(╜И ▌┼щ╒j"²З╤m╖ЪЪ╬╚ЧG╚²ИЪ╒╦?≥╗Х╜з&ёЬ╖~▐А╤iO∙Ф╛z╥ vь^╤m╖ЪЪц Ъ╤ЛЪ╒╦?√I╔