• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/binutils/2.27/0131-xtensa-fix-memory-corruption-by-broken-sysregs.patch
Max FilippovMax Filippov committed 83f7fb0d5bd02 Aug 2017
Raw file
Source viewDiff to previous
 
1
From 3c8788dbb70b40e737d4b8e30cab81406e5c5091 Mon Sep 17 00:00:00 2001
2
From: Max Filippov <jcmvbkbc@gmail.com>
3
Date: Wed, 2 Aug 2017 00:36:05 -0700
4
Subject: [PATCH] xtensa: fix memory corruption by broken sysregs
5
​
6
In some xtensa configurations there may be system/user registers in
7
xtensa-modules with negative index. ISA initialization for such config
8
may clobber heap and result in program termination.
9
Don't update lookup table entries for register with negative indices.
10
They are not directly accessible via RSR/WSR/XSR or RUR/WUR, so this
11
change should not affect processing of valid assembly/binary code.
12
​
13
bfd/
14
2017-08-02  Max Filippov  <jcmvbkbc@gmail.com>
15
​
16
    * xtensa-isa.c (xtensa_isa_init): Don't update lookup table
17
    entries for sysregs with negative indices.
18
​
19
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
20
---
21
Backported from: d84ed528d4817b0ff854006b65a9f6ec75f0407a
22
​
23
 bfd/xtensa-isa.c | 3 ++-
24
 1 file changed, 2 insertions(+), 1 deletion(-)
25
​
26
diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c
27
index 8da75bea8109..8c6ee88fdeae 100644
28
--- a/bfd/xtensa-isa.c
29
+++ b/bfd/xtensa-isa.c
30
@@ -292,7 +292,8 @@ xtensa_isa_init (xtensa_isa_status *errno_p, char **error_msg_p)
31
       xtensa_sysreg_internal *sreg = &isa->sysregs[n];
32
       is_user = sreg->is_user;
33
 
34
-      isa->sysreg_table[is_user][sreg->number] = n;
35
+      if (sreg->number >= 0)
36
+   isa->sysreg_table[is_user][sreg->number] = n;
37
     }
38
 
39
   /* Set up the interface lookup table.  */
40
-- 
41
2.1.4
42
​
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.