hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/arch/parisc/kernel/sys_parisc.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12
23 /*
34 * PARISC specific syscalls
....@@ -5,22 +6,7 @@
56 * Copyright (C) 1999-2003 Matthew Wilcox <willy at parisc-linux.org>
67 * Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org>
78 * Copyright (C) 2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org>
8
- * Copyright (C) 1999-2014 Helge Deller <deller@gmx.de>
9
- *
10
- *
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License as published by
13
- * the Free Software Foundation; either version 2 of the License, or
14
- * (at your option) any later version.
15
- *
16
- * This program is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU General Public License
22
- * along with this program; if not, write to the Free Software
23
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9
+ * Copyright (C) 1999-2020 Helge Deller <deller@gmx.de>
2410 */
2511
2612 #include <linux/uaccess.h>
....@@ -37,6 +23,7 @@
3723 #include <linux/utsname.h>
3824 #include <linux/personality.h>
3925 #include <linux/random.h>
26
+#include <linux/compat.h>
4027
4128 /* we construct an artificial offset for the mapping based on the physical
4229 * address of the kernel mapping variable */
....@@ -86,7 +73,8 @@
8673 stack_base = STACK_SIZE_MAX;
8774
8875 /* Add space for stack randomization. */
89
- stack_base += (STACK_RND_MASK << PAGE_SHIFT);
76
+ if (current->flags & PF_RANDOMIZE)
77
+ stack_base += (STACK_RND_MASK << PAGE_SHIFT);
9078
9179 return PAGE_ALIGN(STACK_TOP - stack_base);
9280 }
....@@ -386,3 +374,73 @@
386374
387375 return err;
388376 }
377
+
378
+/*
379
+ * Up to kernel v5.9 we defined O_NONBLOCK as 000200004,
380
+ * since then O_NONBLOCK is defined as 000200000.
381
+ *
382
+ * The following wrapper functions mask out the old
383
+ * O_NDELAY bit from calls which use O_NONBLOCK.
384
+ *
385
+ * XXX: Remove those in year 2022 (or later)?
386
+ */
387
+
388
+#define O_NONBLOCK_OLD 000200004
389
+#define O_NONBLOCK_MASK_OUT (O_NONBLOCK_OLD & ~O_NONBLOCK)
390
+
391
+static int FIX_O_NONBLOCK(int flags)
392
+{
393
+ if (flags & O_NONBLOCK_MASK_OUT) {
394
+ struct task_struct *tsk = current;
395
+ pr_warn_once("%s(%d) uses a deprecated O_NONBLOCK value.\n",
396
+ tsk->comm, tsk->pid);
397
+ }
398
+ return flags & ~O_NONBLOCK_MASK_OUT;
399
+}
400
+
401
+asmlinkage long parisc_timerfd_create(int clockid, int flags)
402
+{
403
+ flags = FIX_O_NONBLOCK(flags);
404
+ return sys_timerfd_create(clockid, flags);
405
+}
406
+
407
+asmlinkage long parisc_signalfd4(int ufd, sigset_t __user *user_mask,
408
+ size_t sizemask, int flags)
409
+{
410
+ flags = FIX_O_NONBLOCK(flags);
411
+ return sys_signalfd4(ufd, user_mask, sizemask, flags);
412
+}
413
+
414
+#ifdef CONFIG_COMPAT
415
+asmlinkage long parisc_compat_signalfd4(int ufd,
416
+ compat_sigset_t __user *user_mask,
417
+ compat_size_t sizemask, int flags)
418
+{
419
+ flags = FIX_O_NONBLOCK(flags);
420
+ return compat_sys_signalfd4(ufd, user_mask, sizemask, flags);
421
+}
422
+#endif
423
+
424
+asmlinkage long parisc_eventfd2(unsigned int count, int flags)
425
+{
426
+ flags = FIX_O_NONBLOCK(flags);
427
+ return sys_eventfd2(count, flags);
428
+}
429
+
430
+asmlinkage long parisc_userfaultfd(int flags)
431
+{
432
+ flags = FIX_O_NONBLOCK(flags);
433
+ return sys_userfaultfd(flags);
434
+}
435
+
436
+asmlinkage long parisc_pipe2(int __user *fildes, int flags)
437
+{
438
+ flags = FIX_O_NONBLOCK(flags);
439
+ return sys_pipe2(fildes, flags);
440
+}
441
+
442
+asmlinkage long parisc_inotify_init1(int flags)
443
+{
444
+ flags = FIX_O_NONBLOCK(flags);
445
+ return sys_inotify_init1(flags);
446
+}