summaryrefslogtreecommitdiff
path: root/Tests/Kernel/null-deref-crash-during-pthread_join.cpp
blob: 15872d92fd5051adf7af91e00ba9634f0fc12416 (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);
            asm volatile("ud2");
            return nullptr;
        },
        nullptr);

    pthread_join(tid, nullptr);

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