GithubHelp home page GithubHelp logo

crun list segfault (1.12) about crun HOT 5 CLOSED

alekspri avatar alekspri commented on May 25, 2024
crun list segfault (1.12)

from crun.

Comments (5)

giuseppe avatar giuseppe commented on May 25, 2024

could you share with me the content of the /run/crun directory?

from crun.

alekspri avatar alekspri commented on May 25, 2024

could you share with me the content of the /run/crun directory?

crun.tar.gz

edited some sensitive data

from crun.

giuseppe avatar giuseppe commented on May 25, 2024

thanks, I am still unable to reproduce it locally though.

Is it possible for you to try a patch?

diff --git a/src/list.c b/src/list.c
index b310ac9..792e878 100644
--- a/src/list.c
+++ b/src/list.c
@@ -97,7 +97,7 @@ crun_command_list (struct crun_global_arguments *global_args, int argc, char **a
   libcrun_context_t crun_context = {
     0,
   };
-  libcrun_container_list_t *list, *it;
+  libcrun_container_list_t *list = NULL, *it;
 
   list_options.format = LIST_TABLE;

I think could fix the issue, but I am not able to confirm it

from crun.

alekspri avatar alekspri commented on May 25, 2024

thanks, I am still unable to reproduce it locally though.

Is it possible for you to try a patch?

diff --git a/src/list.c b/src/list.c
index b310ac9..792e878 100644
--- a/src/list.c
+++ b/src/list.c
@@ -97,7 +97,7 @@ crun_command_list (struct crun_global_arguments *global_args, int argc, char **a
   libcrun_context_t crun_context = {
     0,
   };
-  libcrun_container_list_t *list, *it;
+  libcrun_container_list_t *list = NULL, *it;
 
   list_options.format = LIST_TABLE;

I think could fix the issue, but I am not able to confirm it

Hello, thank you for the patch.

In the attached archive I noticed that there is no file which contains the PID of the container (abcdef-123456.pid), it’s my fault ((

I have the following launch parameter in systemd unit, like this:

PIDFile=/run/crun/%i.pid
Environment=CRUNROOT=/run/crun
ExecStart=/usr/bin/crun --root=${CRUNROOT} run --pid-file=${CRUNROOT}/%i.pid -f /home/users/%i/config.json -d %i

PID of the container located in /run/crun/abcdef-123456.pid

[root@web ~]# strace crun.12.patched list
execve("/bin/crun.12.patched", ["crun.12.patched", "list"], 0x7ffe1e4714c8 /* 36 vars */) = 0
...
...

mkdirat(AT_FDCWD, "/run/crun", 0700)    = -1 EEXIST (File exists)
statx(AT_FDCWD, "/run/crun", AT_STATX_DONT_SYNC, STATX_TYPE, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0700, stx_size=100, ...}) = 0
openat(AT_FDCWD, "/run/crun", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
fstat(3, {st_mode=S_IFDIR|0700, st_size=100, ...}) = 0
getdents64(3, 0x913cd0 /* 5 entries */, 32768) = 152
access("/run/crun/abcdef-123456/status", F_OK) = 0
access("/run/crun/abcdef-123456.pid/status", F_OK) = -1 ENOTDIR (Not a directory)
close(3)                                = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=NULL} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)

if move the PID file to another location or rename to dot.PID (hidden) , then everything is fine )

[root@web crun]# crun.12.orig list
NAME       PID       STATUS   BUNDLE PATH                             CREATED                        OWNER
abcdef-123456 21950     running  /                                       2023-12-14T15:15:38.666662Z    root

[root@web crun]# crun.12.patched list
NAME       PID       STATUS   BUNDLE PATH                             CREATED                        OWNER
abcdef-123456 21950     running  /                                       2023-12-14T15:15:38.666662Z    root
[root@web crun]# ls -al
total 4
drwx------.  4 root root  100 Dec 14 18:15 .
drwxr-xr-x. 41 root root 1220 Dec 14 17:41 ..
drwx------.  3 root root   60 Dec 14 17:32 .cache
drwx------.  2 root root  100 Dec 14 18:15 abcdef-123456
-rwx------.  1 root root    5 Dec 14 18:15 .abcdef-123456.pid

Thanks

from crun.

giuseppe avatar giuseppe commented on May 25, 2024

you should not really mess with the crun directory, that is private and it is supposed to be used only by crun.

On the other hand, crun should report an error not crash, for this problem I've opened a PR: #1374

from crun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.