Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Limkilde Svendsen
relibc
Commits
83f89912
Verified
Commit
83f89912
authored
5 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Do not copy kernel-allocated TLS
parent
b9e03cba
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ld_so/tcb.rs
+7
-6
7 additions, 6 deletions
src/ld_so/tcb.rs
src/platform/pte.rs
+9
-5
9 additions, 5 deletions
src/platform/pte.rs
with
16 additions
and
11 deletions
src/ld_so/tcb.rs
+
7
−
6
View file @
83f89912
...
...
@@ -55,6 +55,7 @@ impl Tcb {
let
(
tls
,
tcb_page
)
=
Self
::
os_new
(
size
)
?
;
let
tcb_ptr
=
tcb_page
.as_mut_ptr
()
as
*
mut
Self
;
// println!("New TCB: {:p}", tcb_ptr);
ptr
::
write
(
tcb_ptr
,
Self
{
tls_end
:
tls
.as_mut_ptr
()
.add
(
tls
.len
()),
tls_len
:
tls
.len
(),
...
...
@@ -111,12 +112,12 @@ impl Tcb {
let
range
=
master
.range
();
let
data
=
master
.data
();
if
let
Some
(
tls_data
)
=
tls
.get_mut
(
range
)
{
println!
(
"tls master {}: {:p}, {:#x}: {:p}, {:#x}"
,
i
,
data
.as_ptr
(),
data
.len
(),
tls_data
.as_mut_ptr
(),
tls_data
.len
()
);
//
println!(
//
"tls master {}: {:p}, {:#x}: {:p}, {:#x}",
//
i,
//
data.as_ptr(), data.len(),
//
tls_data.as_mut_ptr(), tls_data.len()
//
);
tls_data
.copy_from_slice
(
data
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/platform/pte.rs
+
9
−
5
View file @
83f89912
...
...
@@ -68,11 +68,15 @@ unsafe extern "C" fn pte_osThreadShim(
tls_masters_ptr
:
*
mut
Master
,
tls_masters_len
:
usize
)
{
let
mut
tcb
=
Tcb
::
new
(
tls_size
)
.unwrap
();
tcb
.masters_ptr
=
tls_masters_ptr
;
tcb
.masters_len
=
tls_masters_len
;
tcb
.copy_masters
()
.unwrap
();
tcb
.activate
();
// The kernel allocated TLS does not have masters set, so do not attempt to copy it.
// It will be copied by the kernel.
if
!
tls_masters_ptr
.is_null
()
{
let
mut
tcb
=
Tcb
::
new
(
tls_size
)
.unwrap
();
tcb
.masters_ptr
=
tls_masters_ptr
;
tcb
.masters_len
=
tls_masters_len
;
tcb
.copy_masters
()
.unwrap
();
tcb
.activate
();
}
// Wait until pte_osThreadStart
pte_osMutexLock
(
mutex
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment