On Fri, Oct 14, 2011 at 02:35:15PM -0700, Marcel Moolenaar wrote: > > On Oct 14, 2011, at 11:24 AM, Kostik Belousov wrote: > >>> > > After more thought about the issue, I do not agree with you. > > Elf specification says about the PF_R flag that only read permission > > for the memory image of the segment is required, but read and execute > > is allowed. > > The ELF specification does not contain CPU specifics. Those are > always covered by processor supplements. Since this is very i386 > specific behaviour we're talking about, it's a non sequitur to > use the generic ELF specification to argue a point in this > respect. This is not quite accurate. The ELF specification does contain the CPU-specific bits for i386. But, the interpretation of the PF_R/PF_X flags in the program header is described under the OS-specific section, and not under the CPU-specific. That is, I am sure that the situation shall be interpreted as the bug in the program.
> > > > I want to commit the following refinement: > > The patch is good. Thanks, committed. > > > diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c > > index 669c652..9970386 100644 > > --- a/sys/kern/imgact_elf.c > > +++ b/sys/kern/imgact_elf.c > > @@ -118,11 +118,24 @@ static int elf_legacy_coredump = 0; > > SYSCTL_INT(_debug, OID_AUTO, __elfN(legacy_coredump), CTLFLAG_RW, > > &elf_legacy_coredump, 0, ""); > > > > -static int __elfN(nxstack) = 0; > > +static int __elfN(nxstack) = > > +#if defined(__amd64__) || defined(__powerpc__) /* both 64 and 32 bit */ > > + 1; > > +#else > > + 0; > > +#endif > > SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, > > nxstack, CTLFLAG_RW, &__elfN(nxstack), 0, > > __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": enable non-executable > > stack"); > > Please do not commit this change with the rest. It's > not to the point. In fact, if you're changing it to > the above, please add ia64 to the list as well. Yes, sure. The inclusion of the chunk was a mistake.
pgp76vlqCofCj.pgp
Description: PGP signature