osalbahr / pmem-redirection

I/O Redirection of Workflows to Local and Disaggregate Persistent Memory. This repo is for CSC 499, Summer 2023.
https://arcb.csc.ncsu.edu/~mueller/cluster/arc/
GNU Affero General Public License v3.0
1 stars 1 forks source link

Memkind-file-io does not work on Ubuntu #1

Closed osalbahr closed 1 year ago

osalbahr commented 1 year ago

For some reason, interceptingmalloc fails on Ubuntu but passes on CentOS 7. Unfortunately, there is no CentOS/Fedora runner provided by GitHub (yet? actions/runner-images#1443). I could use docker/podman as a workaround, but I will postpone fiixing this since intercepting malloc() isn't one of my main concerns anyways. Here is the output on Ubuntu 22.04.2 LTS x86_64:

osalbahr@vclvm177-213:~/ld-preload-practice/memkind-file-io$ LD_PRELOAD=./mymalloc.so ./fake-malloc
Segmentation fault (core dumped)
osalbahr@vclvm177-213:~/ld-preload-practice/memkind-file-io$ ./fake-malloc
Flushing at 11
Calling malloc sizeof(int) ...
iptr = 0x556b737de6b0
Flushing at 15
*iptr = 41
Flushing at 17
Calling malloc sizeof(char) ...
cptr = 0x556b737de6b0
Flushing at 22
*cptr = A
Flushing at 24
Calling malloc 0 ...
zero = 0x556b737de6b0
Flushing at 29
osalbahr@vclvm177-213:~/ld-preload-practice/memkind-file-io$ LD_PRELOAD=./mymalloc.so ./fake-malloc
Segmentation fault (core dumped)
osalbahr@vclvm177-213:~/ld-preload-practice/memkind-file-io$ ltrace ./fake-malloc
Flushing at 11
Calling malloc sizeof(int) ...
iptr = 0x561786bc96b0
Flushing at 15
*iptr = 41
Flushing at 17
Calling malloc sizeof(char) ...
cptr = 0x561786bc96b0
Flushing at 22
*cptr = A
Flushing at 24
Calling malloc 0 ...
zero = 0x561786bc96b0
Flushing at 29
+++ exited (status 0) +++
osalbahr@vclvm177-213:~/ld-preload-practice/memkind-file-io$ ltrace ls
err.txt  fake-malloc    fancy-file-io    Makefile  myio.so     mymalloc.so     optanemalloc.so  README.md
exp  fake-malloc.c  fancy-file-io.c  myio.c    mymalloc.c  optanemalloc.c  out.txt      test.sh
+++ exited (status 0) +++
osalbahr@vclvm177-213:~/ld-preload-practice/memkind-file-io$ LD_PRELOAD=./mymalloc.so ls
Segmentation fault (core dumped)
osalbahr@vclvm177-213:~/ld-preload-practice/memkind-file-io$ LD_PRELOAD=./mymalloc.so cd
osalbahr@vclvm177-213:~$ ltrace cd
osalbahr@vclvm177-213:~$ sudo apt upgrade -y ltrace
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ltrace is already the newest version (0.7.3-6.1ubuntu6).
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  exo-utils libpostproc55 libavcodec58 libavutil56 libswscale5 libexo-2-0
  libswresample3 libavformat58 libexo-common libavfilter7
Learn more about Ubuntu Pro at https://ubuntu.com/pro
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
osalbahr@vclvm177-213:~$ 
fmuelle4711 commented 1 year ago

I can guess why it fails, we had the same problem w/ dlsym(). But it's not important right now. Ask me on the next telecon.

On Sat, 13 May 2023 23:42:40 -0700 Osama Albahrani @.***> wrote:

For some reason, interceptingmalloc fails on Ubuntu but passes on CentOS 7. Unfortunately, there is no CentOS/Fedora runner provided by GitHub (yet? actions/runner-images#1443). I could use docker/podman as a workaround, but I will postpone fiixing this since intercepting malloc() isn't one of my main concerns anyways. Here is the output on Ubuntu 22.04.2 LTS x86_64:

***@***.***:~/ld-preload-practice/memkind-file-io$
LD_PRELOAD=./mymalloc.so ./fake-malloc Segmentation fault (core
dumped) ***@***.***:~/ld-preload-practice/memkind-file-io$
./fake-malloc Flushing at 11
Calling malloc sizeof(int) ...
iptr = 0x556b737de6b0
Flushing at 15
*iptr = 41
Flushing at 17
Calling malloc sizeof(char) ...
cptr = 0x556b737de6b0
Flushing at 22
*cptr = A
Flushing at 24
Calling malloc 0 ...
zero = 0x556b737de6b0
Flushing at 29
***@***.***:~/ld-preload-practice/memkind-file-io$
LD_PRELOAD=./mymalloc.so ./fake-malloc Segmentation fault (core
dumped) ***@***.***:~/ld-preload-practice/memkind-file-io$
ltrace ./fake-malloc Flushing at 11
Calling malloc sizeof(int) ...
iptr = 0x561786bc96b0
Flushing at 15
*iptr = 41
Flushing at 17
Calling malloc sizeof(char) ...
cptr = 0x561786bc96b0
Flushing at 22
*cptr = A
Flushing at 24
Calling malloc 0 ...
zero = 0x561786bc96b0
Flushing at 29
+++ exited (status 0) +++
***@***.***:~/ld-preload-practice/memkind-file-io$ ltrace ls
err.txt  fake-malloc  fancy-file-io    Makefile  myio.so
  mymalloc.so     optanemalloc.so README.md exp
fake-malloc.c fancy-file-io.c  myio.c    mymalloc.c
optanemalloc.c  out.txt       test.sh +++ exited (status 0)
+++ ***@***.***:~/ld-preload-practice/memkind-file-io$
LD_PRELOAD=./mymalloc.so ls Segmentation fault (core dumped)
***@***.***:~/ld-preload-practice/memkind-file-io$
LD_PRELOAD=./mymalloc.so cd ***@***.***:~$ ltrace cd
***@***.***:~$ sudo apt upgrade -y ltrace Reading package
lists... Done Building dependency tree... Done
Reading state information... Done
ltrace is already the newest version (0.7.3-6.1ubuntu6).
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  exo-utils libpostproc55 libavcodec58 libavutil56 libswscale5
libexo-2-0 libswresample3 libavformat58 libexo-common libavfilter7
Learn more about Ubuntu Pro at https://ubuntu.com/pro
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
***@***.***:~$ 

-- Frank Mueller Department of Computer Science North Carolina State University 3266 EB2 Raleigh, NC 27695-8206

Office: EB2 building Room: 3266 Phone:+1.919.515.7889 Fax:+1.919.515.7896

@.*** http://moss.csc.ncsu.edu/~mueller/

osalbahr commented 1 year ago

Agreed. I mostly created this issue for documentation purposes. It’s not my priority to get it working on Ubuntu right now, but it would be nice to eventually do that since it seems to be the OS most used for this type of research. For example, https://github.com/utsaslab/SplitFS#system-requirements, https://github.com/utsaslab/WineFS#system-requirements, and https://github.com/utsaslab/chipmunk/tree/main#system-requirements. Or it could just be UT Austin.

I don’t know if it’s an issue with dlsym() per se, since “Test fake-fopen” seemed to work fine on the same GitHub Actions build. The next step of isolation would be to try using memkind_malloc() without intercepting libc malloc since it crashes before the program even starts. I was able to fix a similar error on CentOS by intercepting realloc in a similar fashion. I’m guessing Ubuntu uses calloc() at program startup or something. For some reason, ltrace on Ubuntu as seen above didn’t say much. It might be an issue with the VCL image, not sure.