Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753393AbaJGInr (ORCPT ); Tue, 7 Oct 2014 04:43:47 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:33064 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753092AbaJGInm (ORCPT ); Tue, 7 Oct 2014 04:43:42 -0400 Message-ID: <5433A7BB.1090207@imgtec.com> Date: Tue, 7 Oct 2014 09:43:39 +0100 From: James Hogan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: David Daney , , , , , , , , , , , , , , , , , , , , CC: , , , David Daney Subject: Re: [PATCH] MIPS: Allow FPU emulator to use non-stack area. References: <1412626317-4128-1-git-send-email-ddaney.cavm@gmail.com> In-Reply-To: <1412626317-4128-1-git-send-email-ddaney.cavm@gmail.com> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.154.101] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi David, On 06/10/14 21:11, David Daney wrote: > Any userspace thread desiring a non-executable stack, > must allocate a 4-byte aligned area at least 8 bytes long > +SYSCALL_DEFINE1(set_fpuemul_xol_area, unsigned long, addr) > +{ > + struct thread_info *ti = task_thread_info(current); > + > + ti->fpu_emul_xol = addr; > + return 0; > +} > + > - /* Ensure that the two instructions are in the same cache line */ > - fr = (struct emuframe __user *) > - ((regs->regs[29] - sizeof(struct emuframe)) & ~0x7); > + if (ti->fpu_emul_xol != ~0ul) > + fr = (struct emuframe *)ti->fpu_emul_xol; > + else > + /* Ensure that the two instructions are in the same cache line */ > + fr = (struct emuframe __user *) > + ((regs->regs[29] - sizeof(struct emuframe)) & ~0x7); I know your patch was more an RFC, but on a technical note, this comment/code seems to imply that the address should be 8 byte aligned (rather than 4 byte) so they both land in the same cache line. Also, I think the alignment should be validated in the syscall. Cheers James -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/