Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: libcod on Arch Linux

  1. #11
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by kung foo man View Post
    It can be either the dereferencing of value for writing (would be very strange) or the dereferencing of arg for reading.

    Try:


    PHP Code:
    printf("scriptengine> test c4 value=%.8x scriptStack=%.8x arg=%.8x\n"valuescriptStackarg); 
    scriptengine> test c4 value=ff805778 scriptStack=00000000 arg=00000000

  2. #12
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    For some reason the stack pointer isn't pointing to the stack on Arch linux. I have no idea how that should happen. Some ideas:

    - are you messing with some other functions before this happens?
    - which compiler do you use?
    - are there maybe some security "features" in Arch linux which denies read/write/execute rights for LD_PRELOAD
    timescale 0.01

  3. #13
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Code:
    [09:37] kung foo man: 	#if COD_VERSION == COD4_1_7
    
    //08048000-0817d000 rwxp 00000000 00:8e 8716292 /root/helper/game_cod4/cod4_1_7-bin
    //0817d000-0826a000 r-xp 00135000 00:8e 8716292 /root/helper/game_cod4/cod4_1_7-bin
    //0826a000-08274000 rw-p 00221000 00:8e 8716292 /root/helper/game_cod4/cod4_1_7-bin
    
    mprotect((void *)0x08048000, 0x135000, PROT_READ | PROT_WRITE | PROT_EXEC);
    mprotect((void *)0x0817d000, 0xED000, PROT_READ | PROT_WRITE | PROT_EXEC);
    mprotect((void *)0x0826a000, 0xA000, PROT_READ | PROT_WRITE | PROT_EXEC);
    #else
    
    // allow to write in executable memory
    mprotect((void *)0x08048000, 0x135000, PROT_READ | PROT_WRITE | PROT_EXEC);
    #endif
    [09:37] kung foo man: in https://github.com/kungfooman/libcod/blob/master/libcod.cpp
    [09:37] kung foo man: maybe those addresses changed
    [09:37] kung foo man: cat /proc/$cod2pid/maps
    
    [mitch@Gazpacho cod2]$ cat /proc/1739/maps
    08048000-0817d000 r-xp 00000000 fe:00 110100910                          /mnt/cobra/Spellen/cod2/cod2_lnxded
    0817d000-08189000 rw-p 00134000 fe:00 110100910                          /mnt/cobra/Spellen/cod2/cod2_lnxded
    08189000-08a70000 rw-p 00000000 00:00 0
    0a8c7000-0ad53000 rw-p 00000000 00:00 0                                  [heap]
    e5560000-e5631000 r-xp 00000000 fe:00 111019504                          /mnt/cobra/Spellen/cod2/pb/pbcls.so
    e5631000-e5640000 rw-p 000d0000 fe:00 111019504                          /mnt/cobra/Spellen/cod2/pb/pbcls.so
    e5640000-e57ad000 rw-p 00000000 00:00 0
    e57ad000-e58f5000 r-xp 00000000 fe:00 111019510                          /mnt/cobra/Spellen/cod2/pb/pbsv.so
    e58f5000-e5902000 rw-p 00147000 fe:00 111019510                          /mnt/cobra/Spellen/cod2/pb/pbsv.so
    e5902000-ed124000 rw-p 00000000 00:00 0
    ed124000-ed137000 r-xp 00000000 00:0f 147677                             /usr/lib32/libresolv-2.18.so
    ed137000-ed138000 ---p 00013000 00:0f 147677                             /usr/lib32/libresolv-2.18.so
    ed138000-ed139000 r--p 00013000 00:0f 147677                             /usr/lib32/libresolv-2.18.so
    ed139000-ed13a000 rw-p 00014000 00:0f 147677                             /usr/lib32/libresolv-2.18.so
    ed13a000-ed13c000 rw-p 00000000 00:00 0
    ed13c000-ed141000 r-xp 00000000 00:0f 147669                             /usr/lib32/libnss_dns-2.18.so
    ed141000-ed142000 r--p 00004000 00:0f 147669                             /usr/lib32/libnss_dns-2.18.so
    ed142000-ed143000 rw-p 00005000 00:0f 147669                             /usr/lib32/libnss_dns-2.18.so
    ed143000-ed14e000 r-xp 00000000 00:0f 147670                             /usr/lib32/libnss_files-2.18.so
    ed14e000-ed14f000 r--p 0000a000 00:0f 147670                             /usr/lib32/libnss_files-2.18.so
    ed14f000-ed150000 rw-p 0000b000 00:0f 147670                             /usr/lib32/libnss_files-2.18.so
    ed15f000-ed165000 r-xp 00000000 fe:00 111019498                          /mnt/cobra/Spellen/cod2/pb/pbags.so
    ed165000-ed168000 rw-p 00005000 fe:00 111019498                          /mnt/cobra/Spellen/cod2/pb/pbags.so
    ed168000-f716d000 rw-p 00000000 00:00 0
    f716f000-f7408000 rw-p 00000000 00:00 0
    f7408000-f75b1000 r-xp 00000000 00:0f 147622                             /usr/lib32/libc-2.18.so
    f75b1000-f75b3000 r--p 001a9000 00:0f 147622                             /usr/lib32/libc-2.18.so
    f75b3000-f75b4000 rw-p 001ab000 00:0f 147622                             /usr/lib32/libc-2.18.so
    f75b4000-f75b7000 rw-p 00000000 00:00 0
    f75b7000-f75d0000 r-xp 00000000 00:0f 147970                             /usr/lib32/libgcc_s.so.1
    f75d0000-f75d1000 rw-p 00018000 00:0f 147970                             /usr/lib32/libgcc_s.so.1
    f75d1000-f75d2000 rw-p 00000000 00:00 0
    f75d2000-f7616000 r-xp 00000000 00:0f 147675                             /usr/lib32/libm-2.18.so
    f7616000-f7617000 r--p 00043000 00:0f 147675                             /usr/lib32/libm-2.18.so
    f7617000-f7618000 rw-p 00044000 00:0f 147675                             /usr/lib32/libm-2.18.so
    f7618000-f76c8000 r-xp 00000000 00:0f 135561                             /usr/lib32/libstdc++.so.5.0.7
    f76c8000-f76cd000 rw-p 000b0000 00:0f 135561                             /usr/lib32/libstdc++.so.5.0.7
    f76cd000-f76d2000 rw-p 00000000 00:00 0
    f76d2000-f76ea000 r-xp 00000000 00:0f 147604                             /usr/lib32/libpthread-2.18.so
    f76ea000-f76eb000 r--p 00017000 00:0f 147604                             /usr/lib32/libpthread-2.18.so
    f76eb000-f76ec000 rw-p 00018000 00:0f 147604                             /usr/lib32/libpthread-2.18.so
    f76ec000-f76ee000 rw-p 00000000 00:00 0
    f76ee000-f76f1000 r-xp 00000000 00:0f 147674                             /usr/lib32/libdl-2.18.so
    f76f1000-f76f2000 r--p 00002000 00:0f 147674                             /usr/lib32/libdl-2.18.so
    f76f2000-f76f3000 rw-p 00003000 00:0f 147674                             /usr/lib32/libdl-2.18.so
    f76f3000-f7710000 rw-p 00000000 00:00 0
    f7710000-f7711000 r-xp 00000000 00:00 0                                  [vdso]
    f7711000-f7731000 r-xp 00000000 00:0f 147621                             /usr/lib32/ld-2.18.so
    f7731000-f7732000 r--p 0001f000 00:0f 147621                             /usr/lib32/ld-2.18.so
    f7732000-f7733000 rw-p 00020000 00:0f 147621                             /usr/lib32/ld-2.18.so
    ffb8d000-ffbad000 rwxp 00000000 00:00 0                                  [stack]
    ffbad000-ffbae000 rw-p 00000000 00:00 0

  4. #14
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Code:
    08048000-0817d000 r-xp 00000000 fe:00 110100910                          /mnt/cobra/Spellen/cod2/cod2_lnxded
    0817d000-08189000 rw-p 00134000 fe:00 110100910                          /mnt/cobra/Spellen/cod2/cod2_lnxded
    The first two lines represent the memory of cod2, the 1nd is already in libcod:

    https://github.com/kungfooman/libcod...ter/libcod.cpp

    PHP Code:
    mprotect((void *)0x080480000x135000PROT_READ PROT_WRITE PROT_EXEC); 
    0x135000 is calculated by 0817d000 - 08048000.

    Try to add this mprotect:
    PHP Code:
    mprotect((void *)0x080480000x135000PROT_READ PROT_WRITE PROT_EXEC);
    mprotect((void *)0x0817d0000xC000PROT_READ PROT_WRITE PROT_EXEC); 
    timescale 0.01

  5. #15
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    It is solved now in the latest commit (1.0 support), but you need to edit doit.sh. Because now COD2_VERSION is renamed to COD_VERSION and in the doit.sh this isn't set right yet for 1.3.

  6. #16
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Nice that it works now, oals fixed the wrong define now on git.
    timescale 0.01

  7. #17
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    Just a heads up to anyone running cod2 server on arch linux, they just removed lib32-libstdc++5 from official packages and the one in AUR doesn't even build so just get prebuilt one from archlinux32 repo https://packages.archlinux32.org/extra/i686/libstdc++5/ you can just place it in cod2 folder or move it to your lib32.
    sudo apt-get rekt

  8. The Following 2 Users Say Thank You to voron00 For This Useful Post:

    kung foo man (25th December 2018),serthy (25th December 2018)

  9. #18
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Could you please upload the `libstdc++.so` file, Voron? I tried to download from that site but "404 Not Found"

    I still have ForeignLinux installed on Windows10 (which is Arch basically), but the `libstdc++.so`from Debian doesn't work, so I would like to test the native file.
    timescale 0.01

  10. #19
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    Quote Originally Posted by kung foo man View Post
    Could you please upload the `libstdc++.so` file, Voron? I tried to download from that site but "404 Not Found"

    I still have ForeignLinux installed on Windows10 (which is Arch basically), but the `libstdc++.so`from Debian doesn't work, so I would like to test the native file.
    libstdc++.so.zip
    sudo apt-get rekt

  11. #20
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Thank you alot and fuck my life, IT WORKS

    Not tested with full server and libcod yet, but this looks very good:

    Click image for larger version. 

Name:	cod2_on_foreignlinux_arch.png 
Views:	19 
Size:	51.0 KB 
ID:	1576

    Arch + ForeignLinux manages what WSL can't, LOL

    I'm a bit of an Arch potato, so gonna slowly figure some stuff out... installing gcc etc.

    Code:
    [root@ForeignLinux ~]# LD_LIBRARY_PATH=. ./cod2_lnxded_1_2
    GitHub repo: https://github.com/wishstudio/flinux

    Direct download of arch linux with .exe etc. for starting /bin/bash: https://xysun.me/static/flinux-archlinux.7z
    timescale 0.01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •