-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OMPT] Segment fault caused by calling NULL tsan function pointers #93524
Comments
The Since those tsan functions are missing, pointers to them will not be set and remain NULL. Later calling those NULL pointers will cause a segment fault.
|
I'll create a fix PR soon. |
@llvm/issue-subscribers-openmp Author: Franklin Zhang (FLZ101)
The LLVM version tested:
How I built LLVM:
A test casegreet.c: #include <Python.h>
#include <omp.h>
static omp_lock_t lock_timer;
static PyObject * greet_name(PyObject *self, PyObject *args) {
const char *name;
if (!PyArg_ParseTuple(args, "s", &name))
return NULL;
printf("Hello %s!\n", name);
omp_init_lock(&lock_timer);
omp_set_lock(&lock_timer);
omp_unset_lock(&lock_timer);
Py_RETURN_NONE;
}
static PyMethodDef GreetMethods[] = {
{"greet", greet_name, METH_VARARGS, "Greet an entity."},
{NULL, NULL, 0, NULL}
};
static struct PyModuleDef greet = { PyModuleDef_HEAD_INIT, "greet", "", -1, GreetMethods };
PyMODINIT_FUNC PyInit_greet(void) { return PyModule_Create(&greet); } main.py: if __name__ == '__main__':
import greet
greet.greet('World') go.sh: #!/bin/bash
set -e
llvm_dir=/home/z30026696/opt/CompilerKernel-2/BiSheng/install-vscode
export PATH=$llvm_dir/bin:$PATH
export LD_LIBRARY_PATH=$llvm_dir/lib:$llvm_dir/lib/aarch64-unknown-linux-gnu
clang -g -fPIC --shared $(python3-config --includes) greet.c -o greet.so -fopenmp
export OMP_TOOL_VERBOSE_INIT=STDOUT
# gdb --args
python main.py result:
|
Avoid calling NULL function pointers in cases where ompt_start_tool succeeds but those tsan functions do not really exist. Fix #93524 --------- Co-authored-by: Joachim <protze@rz.rwth-aachen.de>
Avoid calling NULL function pointers in cases where ompt_start_tool succeeds but those tsan functions do not really exist. Fix llvm#93524 --------- Co-authored-by: Joachim <protze@rz.rwth-aachen.de>
The LLVM version tested:
How I built LLVM:
A test case
greet.c:
main.py:
go.sh:
result:
The text was updated successfully, but these errors were encountered: