Message ID | 5411698E.3000402@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Sep 11, 2014 at 10:21:18AM +0100, Yang Yingliang wrote: > From: Yang Yingliang <yangyingliang@huawei.com> > > Add guard macros for uapi/asm/unistd.h, asm/unistd.h and > asm/unistd32.h. Hmm, so I applied this and now my machine panics when we hit userspace. I think the issue is that we no longer generate our syscall table in arch/arm64/kernel/sys.c, because unistd.h is already included via linux/syscalls.h but without the __SYSCALL definition. So, a couple of questions: (1) Is the lack of header guards actually causing you a problem? (2) How did you test this? I've dropped the patch. Will
On 2014/9/11 23:02, Will Deacon wrote: > On Thu, Sep 11, 2014 at 10:21:18AM +0100, Yang Yingliang wrote: >> From: Yang Yingliang <yangyingliang@huawei.com> >> >> Add guard macros for uapi/asm/unistd.h, asm/unistd.h and >> asm/unistd32.h. > > Hmm, so I applied this and now my machine panics when we hit userspace. I > think the issue is that we no longer generate our syscall table in > arch/arm64/kernel/sys.c, because unistd.h is already included via > linux/syscalls.h but without the __SYSCALL definition. > > So, a couple of questions: > > (1) Is the lack of header guards actually causing you a problem? > (2) How did you test this? > > I've dropped the patch. > > Will > > Oh, my bad, sorry for that. I found asm/unistd.h have no guard macro when I was migrate a userspace program from x86_64 to arm64. The program uses the macro _ASM_X86_UNISTD_64_H, but arm64 does not have this(arm has __ASM_ARM_UNISTD_H). So I tried to add the guard macro. Regards, Yang
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 6d2bf41..21a7dec 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -13,6 +13,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef __ASM_ARM64_UNISTD_H +#define __ASM_ARM64_UNISTD_H + #ifdef CONFIG_COMPAT #define __ARCH_WANT_COMPAT_SYS_GETDENTS64 #define __ARCH_WANT_COMPAT_STAT64 @@ -48,3 +51,5 @@ #include <uapi/asm/unistd.h> #define NR_syscalls (__NR_syscalls) + +#endif /* __ASM_ARM64_UNISTD_H */ diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index da1f06b..8f5e78e 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h @@ -16,6 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef __ASM_ARM64_UNISTD32_H +#define __ASM_ARM64_UNISTD32_H #ifndef __SYSCALL #define __SYSCALL(x, y) @@ -792,3 +794,5 @@ __SYSCALL(__NR_renameat2, sys_renameat2) __SYSCALL(__NR_getrandom, sys_getrandom) #define __NR_memfd_create 385 __SYSCALL(__NR_memfd_create, sys_memfd_create) + +#endif /* __ASM_ARM64_UNISTD32_H */ diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h index 1caadc2..ab72cac 100644 --- a/arch/arm64/include/uapi/asm/unistd.h +++ b/arch/arm64/include/uapi/asm/unistd.h @@ -13,4 +13,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef _UAPI__ASM_ARM64_UNISTD_H +#define _UAPI__ASM_ARM64_UNISTD_H + #include <asm-generic/unistd.h> + +#endif /* _UAPI__ASM_ARM64_UNISTD_H */