On Thu, Dec 07, 2023 at 01:33:42AM +0000, HAGIO KAZUHITO(萩尾 一仁) wrote:
Hi Kazu,
On 2023/12/05 0:04, Alexander Gordeev wrote:
> +static bool is_read_proc_kcore(void)
> +{
> + struct stat kcore_stat, fd_stat;
> + int fd;
> + int rc;
> +
> + rc = stat("/proc/kcore", &kcore_stat);
> + if (rc)
> + return false;
> +
> + fd = REMOTE_MEMSRC() ? pc->sockfd : (ACTIVE() ? pc->mfd : pc->dfd);
> + rc = fstat(fd, &fd_stat);
> + if (rc)
> + return false;
> +
> + return (fd_stat.st_ino == kcore_stat.st_ino) &&
> + (fd_stat.st_dev == kcore_stat.st_dev);
> +}
> +
> +static bool s390x_init_vm(void)
> +{
> + struct vm_info vm_info;
> +
> + if (is_read_proc_kcore()) {
Just to clarify, does this mean that "pc->flags & PROC_KCORE" cannot be
used here?
Indeed, it can be used instead. I will post v3 of this patch. The
interdiff is:
diff -u b/s390x.c b/s390x.c
--- b/s390x.c
+++ b/s390x.c
@@ -665,30 +665,11 @@
return !vm_info->__kaslr_offset;
}
-static bool is_read_proc_kcore(void)
-{
- struct stat kcore_stat, fd_stat;
- int kcore_fd, fd;
- int rc;
-
- rc = stat("/proc/kcore", &kcore_stat);
- if (rc)
- return false;
-
- fd = REMOTE_MEMSRC() ? pc->sockfd : (ACTIVE() ? pc->mfd : pc->dfd);
- rc = fstat(fd, &fd_stat);
- if (rc)
- return false;
-
- return (fd_stat.st_ino == kcore_stat.st_ino) &&
- (fd_stat.st_dev == kcore_stat.st_dev);
-}
-
static bool s390x_init_vm(void)
{
struct vm_info vm_info;
- if (is_read_proc_kcore()) {
+ if (pc->flags & PROC_KCORE) {
if (!vmcoreinfo_read_vm_info(&vm_info))
return true;
} else {
@Lianbo, would you keep your Ack?
Thanks,
Kazu
Thanks!