Module Name: src Committed By: ryo Date: Sat Sep 15 23:03:27 UTC 2018
Modified Files: src/sys/arch/aarch64/aarch64: db_interface.c Log Message: fixed to keep PROT_EXECUTE when writing the page/block. this is required when the L2 block to which the target address belongs and the L2 block to which this function itself belongs are the same. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/db_interface.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/aarch64/aarch64/db_interface.c diff -u src/sys/arch/aarch64/aarch64/db_interface.c:1.5 src/sys/arch/aarch64/aarch64/db_interface.c:1.6 --- src/sys/arch/aarch64/aarch64/db_interface.c:1.5 Mon Aug 6 12:50:56 2018 +++ src/sys/arch/aarch64/aarch64/db_interface.c Sat Sep 15 23:03:27 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.5 2018/08/06 12:50:56 ryo Exp $ */ +/* $NetBSD: db_interface.c,v 1.6 2018/09/15 23:03:27 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu <r...@nerv.org> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.5 2018/08/06 12:50:56 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.6 2018/09/15 23:03:27 ryo Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -114,8 +114,13 @@ db_write_text(vaddr_t addr, size_t size, /* save pte */ pte = *ptep; - /* change to writable */ - pmap_kvattr(addr, VM_PROT_READ|VM_PROT_WRITE); + /* + * change to writable. require to keep execute permission. + * because if the block/page to which the target address belongs and + * the block/page to which this function itself belongs are the same, + * if drop PROT_EXECUTE and TLB invalidate, the program stop... + */ + pmap_kvattr(addr, VM_PROT_EXECUTE|VM_PROT_READ|VM_PROT_WRITE); aarch64_tlbi_all(); s = size;