[dm-crypt] The weird bug again: semid XXXXXX: semop failed for cookie 0xdeadbeef: incorrect semaphore state

Milan Broz mbroz at redhat.com
Thu Aug 18 12:25:47 CEST 2011


On 08/18/2011 11:56 AM, Thomas Bächler wrote:
> Am 18.08.2011 10:56, schrieb Milan Broz:
>> I will report that upstream because this is quite unexpected result, easily
>> reproducible with simple clone() and dmsetup.
> 
> Can you describe the test you are doing in more detail (or give me a few
> shell commands or a C program to reproduce)?

https://lkml.org/lkml/2011/8/18/112

Run

dmsetup create aaa --table "0 100 zero" -vvvv
dmsetup remove aaa -vvvv

(it should work)

Then run e.g. such program in parallel:
(uevent fails and dmsetup receive "uevent not sent" taking
wrong error path)

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sched.h>
#include <sys/types.h>
#include <sys/wait.h>

#define STACK_MIN 4096

int clone_start(void* x)
{
        printf("child running...\n");
        sleep(30);

        return 0;
}

int main (int argc, char *argv[])
{
        char stack[STACK_MIN];
        int waitpid_status;
        int clone_flags = SIGCHLD | CLONE_NEWNET;

        pid_t pid = clone(clone_start, stack + STACK_MIN, clone_flags, (void *) argv);
        if (pid == -1) {
                printf("clone()\n");
                exit(1);
        }

        printf("waiting for pid: %d ...\n", (int) pid);
        pid = waitpid(pid, &waitpid_status, 0);
        if (pid < 0) {
                printf("waitpid()\n");
                exit(1);
        }

        return 0;
}



More information about the dm-crypt mailing list