[tip:x86/pti] x86/uapi: Fix asm/bootparam.h userspace compilation errors

2018-04-05 Thread tip-bot for Dmitry V. Levin
Commit-ID:  9820e1c3376c641299624dd24646aed3167ad5b1
Gitweb: https://git.kernel.org/tip/9820e1c3376c641299624dd24646aed3167ad5b1
Author: Dmitry V. Levin 
AuthorDate: Thu, 5 Apr 2018 07:32:10 +0300
Committer:  Ingo Molnar 
CommitDate: Thu, 5 Apr 2018 10:05:21 +0200

x86/uapi: Fix asm/bootparam.h userspace compilation errors

Consistently use types provided by  to fix the following
asm/bootparam.h userspace compilation errors:

/usr/include/asm/bootparam.h:140:2: error: unknown type name 'u16'
  u16 version;
/usr/include/asm/bootparam.h:141:2: error: unknown type name 'u16'
  u16 compatible_version;
/usr/include/asm/bootparam.h:142:2: error: unknown type name 'u16'
  u16 pm_timer_address;
/usr/include/asm/bootparam.h:143:2: error: unknown type name 'u16'
  u16 num_cpus;
/usr/include/asm/bootparam.h:144:2: error: unknown type name 'u64'
  u64 pci_mmconfig_base;
/usr/include/asm/bootparam.h:145:2: error: unknown type name 'u32'
  u32 tsc_khz;
/usr/include/asm/bootparam.h:146:2: error: unknown type name 'u32'
  u32 apic_khz;
/usr/include/asm/bootparam.h:147:2: error: unknown type name 'u8'
  u8 standard_ioapic;
/usr/include/asm/bootparam.h:148:2: error: unknown type name 'u8'
  u8 cpu_ids[255];

Signed-off-by: Dmitry V. Levin 
Acked-by: Jan Kiszka 
Cc:  # v4.16
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Fixes: 4a362601baa6 ("x86/jailhouse: Add infrastructure for running in non-root 
cell")
Link: http://lkml.kernel.org/r/20180405043210.ga13...@altlinux.org
Signed-off-by: Ingo Molnar 
---
 arch/x86/include/uapi/asm/bootparam.h | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/uapi/asm/bootparam.h 
b/arch/x86/include/uapi/asm/bootparam.h
index aebf60357758..a06cbf019744 100644
--- a/arch/x86/include/uapi/asm/bootparam.h
+++ b/arch/x86/include/uapi/asm/bootparam.h
@@ -137,15 +137,15 @@ struct boot_e820_entry {
  * setup data structure.
  */
 struct jailhouse_setup_data {
-   u16 version;
-   u16 compatible_version;
-   u16 pm_timer_address;
-   u16 num_cpus;
-   u64 pci_mmconfig_base;
-   u32 tsc_khz;
-   u32 apic_khz;
-   u8  standard_ioapic;
-   u8  cpu_ids[255];
+   __u16   version;
+   __u16   compatible_version;
+   __u16   pm_timer_address;
+   __u16   num_cpus;
+   __u64   pci_mmconfig_base;
+   __u32   tsc_khz;
+   __u32   apic_khz;
+   __u8standard_ioapic;
+   __u8cpu_ids[255];
 } __attribute__((packed));
 
 /* The so-called "zeropage" */


[tip:sched/urgent] sched/headers/uapi: Fix linux/sched/types.h userspace compilation errors

2017-07-08 Thread tip-bot for Dmitry V. Levin
Commit-ID:  242fc35290bd8cf0effc6e3474e3a417985de2f3
Gitweb: http://git.kernel.org/tip/242fc35290bd8cf0effc6e3474e3a417985de2f3
Author: Dmitry V. Levin 
AuthorDate: Wed, 5 Jul 2017 19:23:28 +0300
Committer:  Ingo Molnar 
CommitDate: Sat, 8 Jul 2017 11:17:55 +0200

sched/headers/uapi: Fix linux/sched/types.h userspace compilation errors

Consistently use types provided by  to fix the following
linux/sched/types.h userspace compilation errors:

  /usr/include/linux/sched/types.h:57:2: error: unknown type name 'u32'
u32 size;
  ...
  u64 sched_period;

Signed-off-by: Dmitry V. Levin 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: sta...@vger.kernel.org # v4.12
Fixes: e2d1e2aec572 ("sched/headers: Move various ABI definitions to 
")
Link: http://lkml.kernel.org/r/20170705162328.ga11...@altlinux.org
Signed-off-by: Ingo Molnar 
---
 include/uapi/linux/sched/types.h | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/uapi/linux/sched/types.h b/include/uapi/linux/sched/types.h
index 307acbc..34b81aa 100644
--- a/include/uapi/linux/sched/types.h
+++ b/include/uapi/linux/sched/types.h
@@ -54,21 +54,21 @@ struct sched_param {
  * available in the scheduling class file or in Documentation/.
  */
 struct sched_attr {
-   u32 size;
+   __u32 size;
 
-   u32 sched_policy;
-   u64 sched_flags;
+   __u32 sched_policy;
+   __u64 sched_flags;
 
/* SCHED_NORMAL, SCHED_BATCH */
-   s32 sched_nice;
+   __s32 sched_nice;
 
/* SCHED_FIFO, SCHED_RR */
-   u32 sched_priority;
+   __u32 sched_priority;
 
/* SCHED_DEADLINE */
-   u64 sched_runtime;
-   u64 sched_deadline;
-   u64 sched_period;
+   __u64 sched_runtime;
+   __u64 sched_deadline;
+   __u64 sched_period;
 };
 
 #endif /* _UAPI_LINUX_SCHED_TYPES_H */


[tip:x86/urgent] x86: Use compat version for preadv2 and pwritev2

2016-05-12 Thread tip-bot for Dmitry V. Levin
Commit-ID:  9a7a076e8e4ffcfec05e3cafe4c4e31d41ddbaa0
Gitweb: http://git.kernel.org/tip/9a7a076e8e4ffcfec05e3cafe4c4e31d41ddbaa0
Author: Dmitry V. Levin 
AuthorDate: Wed, 11 May 2016 11:48:17 +0300
Committer:  Thomas Gleixner 
CommitDate: Thu, 12 May 2016 14:27:13 +0200

x86: Use compat version for preadv2 and pwritev2

Similar to preadv and pwritev, preadv2 and pwritev2 need compat entries
in the 32-bit syscall table.

This bug was found by strace test suite.

Fixes: 4babf2c5efb7 ("x86: wire up preadv2 and pwritev2")
Signed-off-by: Dmitry V. Levin 
Acked-by: Christoph Hellwig 
Link: http://lkml.kernel.org/r/20160511084817.ga29...@altlinux.org
Signed-off-by: Thomas Gleixner 

---
 arch/x86/entry/syscalls/syscall_32.tbl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/syscalls/syscall_32.tbl 
b/arch/x86/entry/syscalls/syscall_32.tbl
index b30dd81..4cddd17 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -384,5 +384,5 @@
 375i386membarrier  sys_membarrier
 376i386mlock2  sys_mlock2
 377i386copy_file_range sys_copy_file_range
-378i386preadv2 sys_preadv2
-379i386pwritev2sys_pwritev2
+378i386preadv2 sys_preadv2 
compat_sys_preadv2
+379i386pwritev2sys_pwritev2
compat_sys_pwritev2


[tip:x86/urgent] x86/signal: Fix restart_syscall number for x32 tasks

2015-12-05 Thread tip-bot for Dmitry V. Levin
Commit-ID:  22eab1108781eff09961ae7001704f7bd8fb1dce
Gitweb: http://git.kernel.org/tip/22eab1108781eff09961ae7001704f7bd8fb1dce
Author: Dmitry V. Levin 
AuthorDate: Tue, 1 Dec 2015 00:54:36 +0300
Committer:  Thomas Gleixner 
CommitDate: Sat, 5 Dec 2015 18:52:14 +0100

x86/signal: Fix restart_syscall number for x32 tasks

When restarting a syscall with regs->ax == -ERESTART_RESTARTBLOCK,
regs->ax is assigned to a restart_syscall number.  For x32 tasks, this
syscall number must have __X32_SYSCALL_BIT set, otherwise it will be
an x86_64 syscall number instead of a valid x32 syscall number. This
issue has been there since the introduction of x32.

Reported-by: strace/tests/restart_syscall.test
Reported-and-tested-by: Elvira Khabirova 
Signed-off-by: Dmitry V. Levin 
Cc: Elvira Khabirova 
Cc: sta...@vger.kernel.org
Link: http://lkml.kernel.org/r/20151130215436.ga25...@altlinux.org
Signed-off-by: Thomas Gleixner 
---
 arch/x86/kernel/signal.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index b7ffb7c..cb6282c 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -690,12 +690,15 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
signal_setup_done(failed, ksig, stepping);
 }
 
-#ifdef CONFIG_X86_32
-#define NR_restart_syscall __NR_restart_syscall
-#else /* !CONFIG_X86_32 */
-#define NR_restart_syscall \
-   test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : 
__NR_restart_syscall
-#endif /* CONFIG_X86_32 */
+static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
+{
+#if defined(CONFIG_X86_32) || !defined(CONFIG_X86_64)
+   return __NR_restart_syscall;
+#else /* !CONFIG_X86_32 && CONFIG_X86_64 */
+   return test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall :
+   __NR_restart_syscall | (regs->orig_ax & __X32_SYSCALL_BIT);
+#endif /* CONFIG_X86_32 || !CONFIG_X86_64 */
+}
 
 /*
  * Note that 'init' is a special process: it doesn't get signals it doesn't
@@ -724,7 +727,7 @@ void do_signal(struct pt_regs *regs)
break;
 
case -ERESTART_RESTARTBLOCK:
-   regs->ax = NR_restart_syscall;
+   regs->ax = get_nr_restart_syscall(regs);
regs->ip -= 2;
break;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/