mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
arm64: kgdb: handle read-only text / modules
Handle read-only cases when CONFIG_DEBUG_RODATA (4.0) or CONFIG_DEBUG_SET_MODULE_RONX (3.18) are enabled by using aarch64_insn_write() instead of probe_kernel_write() as introduced by commit2f896d5866
("arm64: use fixmap for text patching") in 4.0. Fixes:11d91a770f
("arm64: Add CONFIG_DEBUG_SET_MODULE_RONX support") Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
This commit is contained in:
parent
c18df0adab
commit
67787b68ec
2 changed files with 24 additions and 14 deletions
|
@ -61,8 +61,6 @@
|
||||||
|
|
||||||
#define AARCH64_BREAK_KGDB_DYN_DBG \
|
#define AARCH64_BREAK_KGDB_DYN_DBG \
|
||||||
(AARCH64_BREAK_MON | (KGDB_DYN_DBG_BRK_IMM << 5))
|
(AARCH64_BREAK_MON | (KGDB_DYN_DBG_BRK_IMM << 5))
|
||||||
#define KGDB_DYN_BRK_INS_BYTE(x) \
|
|
||||||
((AARCH64_BREAK_KGDB_DYN_DBG >> (8 * (x))) & 0xff)
|
|
||||||
|
|
||||||
#define CACHE_FLUSH_IS_SAFE 1
|
#define CACHE_FLUSH_IS_SAFE 1
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,13 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/bug.h>
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
#include <linux/kdebug.h>
|
#include <linux/kdebug.h>
|
||||||
#include <linux/kgdb.h>
|
#include <linux/kgdb.h>
|
||||||
#include <linux/kprobes.h>
|
#include <linux/kprobes.h>
|
||||||
|
#include <asm/debug-monitors.h>
|
||||||
|
#include <asm/insn.h>
|
||||||
#include <asm/traps.h>
|
#include <asm/traps.h>
|
||||||
|
|
||||||
struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = {
|
struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = {
|
||||||
|
@ -338,15 +341,24 @@ void kgdb_arch_exit(void)
|
||||||
unregister_die_notifier(&kgdb_notifier);
|
unregister_die_notifier(&kgdb_notifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
struct kgdb_arch arch_kgdb_ops;
|
||||||
* ARM instructions are always in LE.
|
|
||||||
* Break instruction is encoded in LE format
|
int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt)
|
||||||
*/
|
{
|
||||||
struct kgdb_arch arch_kgdb_ops = {
|
int err;
|
||||||
.gdb_bpt_instr = {
|
|
||||||
KGDB_DYN_BRK_INS_BYTE(0),
|
BUILD_BUG_ON(AARCH64_INSN_SIZE != BREAK_INSTR_SIZE);
|
||||||
KGDB_DYN_BRK_INS_BYTE(1),
|
|
||||||
KGDB_DYN_BRK_INS_BYTE(2),
|
err = aarch64_insn_read((void *)bpt->bpt_addr, (u32 *)bpt->saved_instr);
|
||||||
KGDB_DYN_BRK_INS_BYTE(3),
|
if (err)
|
||||||
}
|
return err;
|
||||||
};
|
|
||||||
|
return aarch64_insn_write((void *)bpt->bpt_addr,
|
||||||
|
(u32)AARCH64_BREAK_KGDB_DYN_DBG);
|
||||||
|
}
|
||||||
|
|
||||||
|
int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt)
|
||||||
|
{
|
||||||
|
return aarch64_insn_write((void *)bpt->bpt_addr,
|
||||||
|
*(u32 *)bpt->saved_instr);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue