summaryrefslogtreecommitdiff
path: root/Tests/Kernel/null-deref-crash-during-pthread_join.cpp
blob: f48c40e388361111df13e09aaa81ff3b1f1fe38c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * Copyright (c) 2018-2020, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <pthread.h>
#include <stdio.h>
#include <sys/select.h>
#include <unistd.h>

int main(int, char**)
{
    pthread_t tid;
    pthread_create(
        &tid, nullptr, [](void*) -> void* {
            sleep(1);
            __builtin_trap();
            return nullptr;
        },
        nullptr);

    pthread_join(tid, nullptr);

    printf("ok\n");
    return 0;
}