static struct seclog_ctx slog_ctx;
static struct sec_log_info *sec_log[NR_CPUS];
+static inline uint32_t exynos_seclog_check_va_validation(uint64_t ptr)
+{
+ uint64_t base = (uint64_t)ldata.virt_addr;
+ uint64_t end = base + ldata.size;
+
+ if (base <= ptr && end > ptr)
+ return 0;
+
+ return -1;
+}
static void exynos_ldfw_error(struct platform_device *pdev,
int error)
}
}
+ if (exynos_seclog_check_va_validation((uint64_t)v_log_addr)) {
+ /* v_log_addr is not valid. print debugging info */
+ pr_err("[SECLOG_ERR C%d] read_cnt[%d]\n",
+ cpu, sec_log[cpu]->log_read_cnt);
+ pr_err("[SECLOG_ERR C%d] write_cnt[%d]\n",
+ cpu, sec_log[cpu]->log_write_cnt);
+ pr_err("[SECLOG_ERR C%d] return_cnt[%d]\n",
+ cpu, sec_log[cpu]->log_return_cnt);
+ pr_err("[SECLOG_ERR C%d] v_log_addr[%#lx]\n",
+ cpu, v_log_addr);
+ pr_err("[SECLOG_ERR C%d] start_log_addr[%#lx]\n",
+ cpu, sec_log[cpu]->start_log_addr);
+ pr_err("[SECLOG_ERR C%d] initial_log_addr[%#lx]\n",
+ cpu, sec_log[cpu]->initial_log_addr);
+ pr_err("[SECLOG_ERR C%d] p_log_addr[%#lx]\n",
+ cpu,
+ v_log_addr
+ - (unsigned long)ldata.virt_addr
+ + ldata.phys_addr);
+
+ /* make panic for debugging */
+ BUG();
+ }
+
/* For debug */
pr_debug("[SECLOG_DEBUG C%d] read_cnt[%d]\n",
cpu, sec_log[cpu]->log_read_cnt);
}
dev_info(&pdev->dev,
- "Message buffer address[%#lx], Message buffer size[%#lx]\n",
- ldata.phys_addr, ldata.size);
+ "Message buffer address[PA : %#lx, VA : %#lx], Message buffer size[%#lx]\n",
+ ldata.phys_addr, ldata.virt_addr, ldata.size);
dev_info(&pdev->dev, "Exynos Secure Log driver probe done!\n");
return 0;