Comments (6)
sysdeps or kernel, frankly, though we should probably provide some cross-thread communication utilities for this and other cases that need it
from mlibc.
Handling this seems really extremely horrible. I don't think many programs use these functions in multithreaded environments, so maybe we could get away with some assertion that no threads are spawned and wait for a proper kernel fix.
from mlibc.
Handling this seems really extremely horrible. I don't think many programs use these functions in multithreaded environments, so maybe we could get away with some assertion that no threads are spawned and wait for a proper kernel fix.
there most likely won't be a proper kernel fix, afaik
I agree that we should do this in the Linux sysdeps until the necessity of a real fix is observed, and it should likely be:
- a global credentials lock that prevents forking and cloning as well as other setxid ops,
- enumerating threads via /proc/self/tasks or w/e it's called,
- setting some atomic counter to the number of threads found,
- deliver each SIG32 or something,
- wait, with a futex+timeout or something, for all threads to change xid,
- if any didn't (counter != 0), abort, else
- iterate Tcbs to find the xid errnos,
- if any but not all failed or if they failed differently, abort, else return errno
- if none failed, return 0
(edit for elaboration: assert thread count == 0, for the time being, if it becomes necessary, implement the above, or try to bargain with the Linux devs)
it's horrible but it is what it is
from mlibc.
It's not necessary (or useful) to iterate over /proc/self/tasks since we can simply keep a global list of threads. But the remainder of the procedure sounds right.
from mlibc.
It's not necessary (or useful) to iterate over /proc/self/tasks since we can simply keep a global list of threads. But the remainder of the procedure sounds right.
the usefulness is that it covers the edge case of the program itself cloning without using pthread_create (I think the signal handler should be inherited well enough for this)
from mlibc.
If a program does syscall(SYS_CLONE)
, all hope to implement anything thread-related in a sane way is lost anyway. For example, such threads won't have a working TLS.
from mlibc.
Related Issues (20)
- mbtowc: is broken HOT 1
- posix: pthread_cancel test fails intermittently on RISC-V Linux HOT 4
- options: allow logging and debugging to be configured by environment variables
- rtdl: env vars LD_LIBRARY_PATH, LD_PRELOAD and friends are unimplemented HOT 1
- rtdl: TCB is not deallocated on thread exit
- options/posix: review locking in syslog implementation HOT 1
- pthread_condattr_* are not correctly implemented HOT 1
- mbtowc does not handle decoding errors
- x86 port HOT 5
- ansi: strxfrm unimplemented HOT 1
- frigg: slab_pool corruption HOT 2
- calloc() does not check for overflow
- implement `freopen` for `mem_file`
- code formatting rules? HOT 4
- Functions with weak attribute sometimes don't get built into executables if built as a static library HOT 2
- posix_memalign alignment assertion fail
- Certain combinations of TLS segments lead to misaligned TLS pointers
- implement `mincore` HOT 8
- dirent has wrong ABI on linux HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlibc.