Skip to content

Commit

Permalink
mm/usercopy: Switch to using lm_alias
Browse files Browse the repository at this point in the history
The usercopy checking code currently calls __va(__pa(...)) to check for
aliases on symbols. Switch to using lm_alias instead.

Reviewed-by: Mark Rutland <[email protected]>
Tested-by: Mark Rutland <[email protected]>
Acked-by: Kees Cook <[email protected]>
Signed-off-by: Laura Abbott <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
  • Loading branch information
labbott authored and wildea01 committed Jan 11, 2017
1 parent 5c6a84a commit 46f6236
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/usercopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ static inline const char *check_kernel_text_object(const void *ptr,
* __pa() is not just the reverse of __va(). This can be detected
* and checked:
*/
textlow_linear = (unsigned long)__va(__pa(textlow));
textlow_linear = (unsigned long)lm_alias(textlow);
/* No different mapping: we're done. */
if (textlow_linear == textlow)
return NULL;

/* Check the secondary mapping... */
texthigh_linear = (unsigned long)__va(__pa(texthigh));
texthigh_linear = (unsigned long)lm_alias(texthigh);
if (overlaps(ptr, n, textlow_linear, texthigh_linear))
return "<linear kernel text>";

Expand Down

0 comments on commit 46f6236

Please sign in to comment.