Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Charles Southerland
frama-c
Commits
b6744460
Commit
b6744460
authored
7 years ago
by
Kostyantyn Vorobyov
Browse files
Options
Downloads
Patches
Plain Diff
Checks for mspace move
parent
1eef58f2
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/plugins/e-acsl/share/e-acsl/e_acsl_malloc.h
+4
-0
4 additions, 0 deletions
src/plugins/e-acsl/share/e-acsl/e_acsl_malloc.h
src/plugins/e-acsl/share/e-acsl/segment_model/e_acsl_segment_tracking.h
+9
-0
9 additions, 0 deletions
...acsl/share/e-acsl/segment_model/e_acsl_segment_tracking.h
with
13 additions
and
0 deletions
src/plugins/e-acsl/share/e-acsl/e_acsl_malloc.h
+
4
−
0
View file @
b6744460
...
@@ -54,6 +54,7 @@ static struct memory_spaces {
...
@@ -54,6 +54,7 @@ static struct memory_spaces {
mspace
heap_mspace
;
/* `public` (application) mspace */
mspace
heap_mspace
;
/* `public` (application) mspace */
uintptr_t
heap_start
;
/* least address in application mspace */
uintptr_t
heap_start
;
/* least address in application mspace */
uintptr_t
heap_end
;
/* greatest address in application mspace */
uintptr_t
heap_end
;
/* greatest address in application mspace */
uintptr_t
heap_mspace_least
;
/* Initial least address in heap mspace */
}
mem_spaces
;
}
mem_spaces
;
/* While it is possible to generate prefixes using an extra level of
/* While it is possible to generate prefixes using an extra level of
...
@@ -125,6 +126,9 @@ static void make_memory_spaces(size_t rtl_size, size_t heap_size) {
...
@@ -125,6 +126,9 @@ static void make_memory_spaces(size_t rtl_size, size_t heap_size) {
mspace header. */
mspace header. */
mem_spaces
.
heap_start
=
(
uintptr_t
)
mspace_malloc
(
mem_spaces
.
heap_mspace
,
1
);
mem_spaces
.
heap_start
=
(
uintptr_t
)
mspace_malloc
(
mem_spaces
.
heap_mspace
,
1
);
mem_spaces
.
heap_end
=
mem_spaces
.
heap_start
+
heap_size
;
mem_spaces
.
heap_end
=
mem_spaces
.
heap_start
+
heap_size
;
/* Save initial least address of heap memspace. This address is used later
to check whether memspace has been moved. */
mem_spaces
.
heap_mspace_least
=
(
uintptr_t
)
mspace_least_addr
(
mem_spaces
.
heap_mspace
);
}
}
static
void
destroy_memory_spaces
()
{
static
void
destroy_memory_spaces
()
{
...
...
This diff is collapsed.
Click to expand it.
src/plugins/e-acsl/share/e-acsl/segment_model/e_acsl_segment_tracking.h
+
9
−
0
View file @
b6744460
...
@@ -833,6 +833,15 @@ static void mark_readonly_region (uintptr_t addr, long size) {
...
@@ -833,6 +833,15 @@ static void mark_readonly_region (uintptr_t addr, long size) {
static
void
set_heap_segment
(
void
*
ptr
,
size_t
size
,
size_t
alloc_size
,
static
void
set_heap_segment
(
void
*
ptr
,
size_t
size
,
size_t
alloc_size
,
size_t
init
,
const
char
*
function
)
{
size_t
init
,
const
char
*
function
)
{
/* Make sure that heap memspace has not been moved. This is likely if
a really large chunk has been requested to be allocated. */
vassert
(
mem_spaces
.
heap_mspace_least
==
(
uintptr_t
)
mspace_least_addr
(
mem_spaces
.
heap_mspace
),
"Exceeded heap allocation limit of %luMB -- heap memory space moved.
\n
"
,
E_ACSL_HEAP_SIZE
);
/* Similar check, make sure that allocated space does not exceed given
allocation limit for mspace */
uintptr_t
max_addr
=
(
uintptr_t
)
ptr
+
alloc_size
;
uintptr_t
max_addr
=
(
uintptr_t
)
ptr
+
alloc_size
;
vassert
(
mem_spaces
.
heap_end
>
max_addr
,
vassert
(
mem_spaces
.
heap_end
>
max_addr
,
"Exceeded heap allocation limit of %luMB
\n
"
,
E_ACSL_HEAP_SIZE
);
"Exceeded heap allocation limit of %luMB
\n
"
,
E_ACSL_HEAP_SIZE
);
...
...
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