Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show failing instruction on SIGILL #22134

Merged
merged 2 commits into from
Jun 2, 2017
Merged

Show failing instruction on SIGILL #22134

merged 2 commits into from
Jun 2, 2017

Conversation

yuyichao
Copy link
Contributor

No description provided.

@yuyichao
Copy link
Contributor Author

@jlbuild !filter=arm,ppc,aarch64

@jlbuild
Copy link

jlbuild commented May 30, 2017

Status of f8f391c builds:

Builder Name Build Download
linuxaarch64 COMPLETE Download
linuxarmv7l COMPLETE Download
linuxppc64le COMPLETE Download

{
#if defined(_CPU_X86_64_) || defined(_CPU_X86_)
uintptr_t pc = 0;
# if defined(_OS_LINUX_) && defined(_CPU_X86_64_)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation in the preprocessor logic here is weird and seems to be inconsistent with other files (e.g. debuginfo.c), which don't use indentation on nested conditions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are quite a few of these in the codebase. I usually use them when the nested one has more than one condition/blocks. Distinguish them with comments gets harder in these cases.

}
}
#else
# if defined(_OS_FREEBSD_) || defined(_OS_DARWIN_)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always knew you had a soft spot for FreeBSD 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this one was due to macOS CI....

# else
unsigned char mvec;
# endif
valid = mincore((void*)next_page, jl_page_size, &mvec) != -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found that if (msync((void*)(fault_addr & ~(jl_page_size - 1)), 1, MS_ASYNC) != 0) is more accurate (tests whether the kernel has defined a memory region for that virtual address, rather than testing if that address currently resides in physical memory)

int len = sizeof(inst);
// since we got a SIGILL and not a SIGSEGV or SIGBUS assume that
// the `pc` is pointed to valid memory.
// However, this does not mean that `pc + 14` is valid memory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this implementation seems sort of crazy to have all in one functions. maybe we should have a safe_read function? (mapping to, on macOS mach_vm_read_overwrite; on windows and linux read(mmap); and on others, jl_safe_try { memcpy })

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'll just do a loop of volatile byte read with safe context setup?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's what I meant by my last option

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree this could be factored into a few functions. Also get_pc_from_ctx.

@yuyichao
Copy link
Contributor Author

I just go with the catch segfault approach. It's simplest to implement, useful in other cases and I don't actually expect any segfault here in >99% of the cases anyway....

@yuyichao
Copy link
Contributor Author

@jlbuild !filter=arm,ppc,aarch64

@jlbuild
Copy link

jlbuild commented May 31, 2017

Status of b3f5a59 builds:

Builder Name Build Download
linuxaarch64 ERRORED N/A
linuxarmv7l ERRORED N/A
linuxppc64le COMPLETE Download

@yuyichao yuyichao force-pushed the yyc/signals/ill branch 2 times, most recently from 54df26f to f575d63 Compare May 31, 2017 13:10
@yuyichao
Copy link
Contributor Author

yuyichao commented Jun 2, 2017

@jlbuild !filter=arm,ppc,aarch64

@jlbuild
Copy link

jlbuild commented Jun 2, 2017

Status of e5983d7 builds:

Builder Name Build Download
linuxaarch64 COMPLETE Download
linuxarmv7l COMPLETE Download
linuxppc64le COMPLETE Download

@yuyichao yuyichao merged commit 54158fe into master Jun 2, 2017
@yuyichao yuyichao deleted the yyc/signals/ill branch June 2, 2017 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants