Amitoj Kaur Chawla | 14 Jun 08:43 2016

[PATCH] parisc: Change structure intialisation to C99 style

Replace the in order struct initialisation style with explicit field

The Coccinelle semantic patch used to make this change is as follows:

 <at> decl <at> 
identifier i1,fld;
type T;
field list[n] fs;
 <at>  <at> 

struct i1 {
 T fld;

 <at>  <at> 
identifier decl.i1,i2,decl.fld;
expression e;
position bad.p, bad.fix;
 <at>  <at> 

struct i1 i2 <at> p = { ...,
+ .fld = e
- e <at> fix

Signed-off-by: Amitoj Kaur Chawla <amitoj1606 <at>>
 arch/parisc/lib/iomap.c | 64 ++++++++++++++++++++++++-------------------------
(Continue reading)

Helge Deller | 10 Jun 22:39 2016

[PATCH][SCSI] 53c700: Use proper debug printk format specifiers

When enabling the debug options NCR_700_DEBUG and NCR_700_TAG_DEBUG
various printk format warnings can be seen like:
drivers/scsi/53c700.c:357:2: warning: format ‘%p’ expects argument of type ‘void *’, but
argument 4 has type ‘dma_addr_t’ [-Wformat=]
  script_patch_32(hostdata->dev, script, MessageLocation,

Fix them by using the right printk format specifiers.

Signed-off-by: Helge Deller <deller <at>>

diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index d4c2856..56bec27 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
 <at>  <at>  -1892,7 +1892,7  <at>  <at>  NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
 		slot->SG[i].ins = bS_to_host(SCRIPT_RETURN);
 		slot->SG[i].pAddr = 0;
 		dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG), DMA_TO_DEVICE);
-		DEBUG((" SETTING %08lx to %x\n",
+		DEBUG((" SETTING %p to %x\n",
diff --git a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h
index e06bdfe..fd32971 100644
--- a/drivers/scsi/53c700.h
+++ b/drivers/scsi/53c700.h
 <at>  <at>  -423,23 +423,25  <at>  <at>  struct NCR_700_Host_Parameters {
 #define script_patch_32(dev, script, symbol, value) \
 { \
(Continue reading)

Kees Cook | 9 Jun 23:01 2016

[PATCH 00/14] run seccomp after ptrace

There has been a long-standing (and documented) issue with seccomp
where ptrace can be used to change a syscall out from under seccomp.
This is a problem for containers and other wider seccomp filtered
environments where ptrace needs to remain available, as it allows
for an escape of the seccomp filter.

Since the ptrace attack surface is available for any allowed syscall,
moving seccomp after ptrace doesn't increase the actually available
attack surface. And this actually improves tracing since, for
example, tracers will be notified of syscall entry before seccomp
sends a SIGSYS, which makes debugging filters much easier.

The per-architecture changes do make one (hopefully small)
semantic change, which is that since ptrace comes first, it may
request a syscall be skipped. Running seccomp after this doesn't
make sense, so if ptrace wants to skip a syscall, it will bail
out early similarly to how seccomp was. This means that skipped
syscalls will not be fed through audit, though that likely means
we're actually avoiding noise this way.

This series first cleans up seccomp to remove the now unneeded
two-phase entry, fixes the SECCOMP_RET_TRACE hole (same as the
ptrace hole above), and then reorders seccomp after ptrace on
each architecture.


To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
(Continue reading)

Helge Deller | 9 Jun 21:36 2016

kernel BUG in drivers/scsi/53c700.c:1129

Hi James,

I just tried Debian kernel 4.6.1-1 on my historic 715/64 machine, and it
ran into this  BUG() in the LASI scsi driver:

 scsi 0:0:6:0: no saved request for untagged cmd

Any idea?


[    0.000000] Linux version 4.6.0-1-parisc (debian-kernel <at> (gcc version 5.4.0
20160603 (Debian 5.4.0-3) ) #1 Debian 4.6.1-1 (2016-06-06)
[    0.000000] Determining PDC firmware type: Snake.
[    0.000000] model 000060a0 00000481 00000000 00000000 773c7d2c 00000000 00000004 00000072 00000072
[    0.000000] vers  0000000c
[    0.000000] model 9000/715
[    0.000000] Total Memory: 160 MB
[   43.180000] SCSI subsystem initialized
[   45.076000] 53c700: Version 2.8 By James.Bottomley <at>
[   45.156000] scsi0: 53c710 rev 2 
[   46.204000] scsi host0: LASI SCSI 53c700
[   58.268000] scsi 0:0:6:0: no saved request for untagged cmd
[   58.336000] ------------[ cut here ]------------
[   58.392000] kernel BUG at /build/linux-XAODSw/linux-4.6.1/drivers/scsi/53c700.c:1129!
[   58.484000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.6.0-1-parisc #1 Debian 4.6.1-1
[   58.580000] task: 1083cdd8 ti: 107b1000 task.ti: 107b1000
[   58.644000] 
(Continue reading)

George Spelvin | 7 Jun 03:22 2016

[PATCH v3] parisc: add <asm/hash.h>

PA-RISC is interesting; integer multiplies are implemented in the
FPU, so are painful in the kernel.  But it tries to be friendly to
shift-and-add sequences.

__hash_32 is implemented using the same shift-and-add sequence as
Microblaze, just scheduled for the PA7100.  (It's 2-way superscalar
but in-order, like the Pentium.)

hash_64 was tricky, but a suggestion from Jason Thong allowed a good
solution by breaking up the multiplier.  After an embarrassing amount
of fiddling about, I found a 19-instruction sequence for the multiply
that can be executed in 10 cycles using only 4 temporaries.

(The PA8xxx can issue 4 instructions per cycle, but 2 must be ALU ops
and 2 must be loads/stores.  And the final add can't be paired.)

An alternative implementation is included, but not enabled by default:
Thomas Wang's 64-to-32-bit hash.  This is more compact than the multiply,
but has a slightly longer dependency chain.

Signed-off-by: George Spelvin <linux <at>>
Cc: Helge Deller <deller <at>>
Cc: linux-parisc <at>
Okay, I'm happy with this one.  Helge, could you test it whenever you
get a chance?

I've left the alternate hash_64 path in for now, but the one not chosen
should be deleted before sending to Linus.

(Continue reading)

Helge Deller | 5 Jun 14:20 2016

[GIT PULL] parisc architecture fixes for 4.7-rc2

Hi Linus,

Please pull some parisc architecture fixes for kernel 4.7-rc2 from 
  git:// parisc-4.7-2

Changes in this patch set:

- Fix printk time stamps on SMP systems which got wrong due to a patch which
  was added during the merge window
- Fix two bugs in the stack backtrace code: Races in module unloading and
  possible invalid accesses to memory due to wrong instruction decoding
  (Mikulas Patocka)
- Fix userspace crash when syscalls access invalid unaligned userspace
  addresses. Those syscalls will now return EFAULT as expected. (tagged for
  stable kernel series)


Helge Deller (3):
      parisc: Fix printk time during boot
      parisc: Fix pagefault crash in unaligned __get_user() call
      parisc: Move die_if_kernel() prototype into traps.h header

Mikulas Patocka (1):
      parisc: Fix backtrace on PA-RISC

 arch/parisc/include/asm/traps.h |  2 ++
 arch/parisc/kernel/processor.c  |  5 +++--
(Continue reading)

Helge Deller | 4 Jun 17:38 2016

[PATCH] parisc: Move die_if_kernel() prototype into traps.h header

Signed-off-by: Helge Deller <deller <at>>

diff --git a/arch/parisc/include/asm/traps.h b/arch/parisc/include/asm/traps.h
index 4736020..5e953ab 100644
--- a/arch/parisc/include/asm/traps.h
+++ b/arch/parisc/include/asm/traps.h
 <at>  <at>  -8,6 +8,8  <at>  <at>  struct pt_regs;
 void parisc_terminate(char *msg, struct pt_regs *regs,
 		int code, unsigned long offset) __noreturn __cold;

+void die_if_kernel(char *str, struct pt_regs *regs, long err);
 /* mm/fault.c */
 void do_page_fault(struct pt_regs *regs, unsigned long code,
 		unsigned long address);
diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
index d7c0acb..2b65c01 100644
--- a/arch/parisc/kernel/unaligned.c
+++ b/arch/parisc/kernel/unaligned.c
 <at>  <at>  -28,6 +28,7  <at>  <at> 
 #include <linux/ratelimit.h>
 #include <asm/uaccess.h>
 #include <asm/hardirq.h>
+#include <asm/traps.h>

 /* #define DEBUG_UNALIGNED 1 */

 <at>  <at>  -130,8 +131,6  <at>  <at> 

 int unaligned_enabled __read_mostly = 1;
(Continue reading)

Helge Deller | 4 Jun 17:21 2016

[PATCH] parisc: Fix pagefault crash in unaligned __get_user() call

One of the debian buildd servers had this crash in the syslog without
any other information:

 Unaligned handler failed, ret = -2
 clock_adjtime (pid 22578): Unaligned data reference (code 28)
 CPU: 1 PID: 22578 Comm: clock_adjtime Tainted: G  E  4.5.0-2-parisc64-smp #1 Debian 4.5.4-1
 task: 000000007d9960f8 ti: 00000001bde7c000 task.ti: 00000001bde7c000

 PSW: 00001000000001001111100000001111 Tainted: G            E  
 r00-03  000000ff0804f80f 00000001bde7c2b0 00000000402d2be8 00000001bde7c2b0
 r04-07  00000000409e1fd0 00000000fa6f7fff 00000001bde7c148 00000000fa6f7fff
 r08-11  0000000000000000 00000000ffffffff 00000000fac9bb7b 000000000002b4d4
 r12-15  000000000015241c 000000000015242c 000000000000002d 00000000fac9bb7b
 r16-19  0000000000028800 0000000000000001 0000000000000070 00000001bde7c218
 r20-23  0000000000000000 00000001bde7c210 0000000000000002 0000000000000000
 r24-27  0000000000000000 0000000000000000 00000001bde7c148 00000000409e1fd0
 r28-31  0000000000000001 00000001bde7c320 00000001bde7c350 00000001bde7c218
 sr00-03  0000000001200000 0000000001200000 0000000000000000 0000000001200000
 sr04-07  0000000000000000 0000000000000000 0000000000000000 0000000000000000

 IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000402d2e84 00000000402d2e88
  IIR: 0ca0d089    ISR: 0000000001200000  IOR: 00000000fa6f7fff
  CPU:        1   CR30: 00000001bde7c000 CR31: ffffffffffffffff
  ORIG_R28: 00000002369fe628
  IAOQ[0]: compat_get_timex+0x2dc/0x3c0
  IAOQ[1]: compat_get_timex+0x2e0/0x3c0
  RP(r2): compat_get_timex+0x40/0x3c0
  [<00000000402d4608>] compat_SyS_clock_adjtime+0x40/0xc0
(Continue reading)

Helge Deller | 3 Jun 19:19 2016

[PATCH] soreuseport: Fix reuseport_bpf testcase on 32bit architectures

This fixes the following compiler warnings when compiling the
reuseport_bpf testcase on a 32 bit platform:

reuseport_bpf.c: In function ‘attach_ebpf’:
reuseport_bpf.c:114:15: warning: cast from pointer to integer of ifferent size [-Wpointer-to-int-cast]

Signed-off-by: Helge Deller <deller <at>>

diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/selftests/net/reuseport_bpf.c
index 96ba386..4a82174 100644
--- a/tools/testing/selftests/net/reuseport_bpf.c
+++ b/tools/testing/selftests/net/reuseport_bpf.c
 <at>  <at>  -111,9 +111,9  <at>  <at>  static void attach_ebpf(int fd, uint16_t mod)
 	memset(&attr, 0, sizeof(attr));
 	attr.prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
 	attr.insn_cnt = ARRAY_SIZE(prog);
-	attr.insns = (uint64_t)prog;
-	attr.license = (uint64_t)bpf_license;
-	attr.log_buf = (uint64_t)bpf_log_buf;
+	attr.insns = (unsigned long) &prog;
+	attr.license = (unsigned long) &bpf_license;
+	attr.log_buf = (unsigned long) &bpf_log_buf;
 	attr.log_size = sizeof(bpf_log_buf);
 	attr.log_level = 1;
 	attr.kern_version = 0;
 <at>  <at>  -351,8 +351,8  <at>  <at>  static void test_filter_no_reuseport(const struct test_params p)
 	memset(&eprog, 0, sizeof(eprog));
 	eprog.prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
 	eprog.insn_cnt = ARRAY_SIZE(ecode);
-	eprog.insns = (uint64_t)ecode;
(Continue reading)

Helge Deller | 3 Jun 19:18 2016

[PATCH] soreuseport: add compat case for setsockopt SO_ATTACH_REUSEPORT_CBPF

Commit 538950a ("soreuseport: setsockopt SO_ATTACH_REUSEPORT_[CE]BPF")
missed to add the compat case for the SO_ATTACH_REUSEPORT_CBPF
setsockoption() option.

sock_fprog let's combine the handling of both.

Signed-off-by: Helge Deller <deller <at>>

diff --git a/net/compat.c b/net/compat.c
index 5cfd26a..7e2aac9 100644
--- a/net/compat.c
+++ b/net/compat.c
 <at>  <at>  -309,7 +309,7  <at>  <at>  void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm)

-static int do_set_attach_filter(struct socket *sock, int level, int optname,
+static int do_sockopt_fix_sock_fprog(struct socket *sock, int level, int optname,
 				char __user *optval, unsigned int optlen)
 	struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval;
 <at>  <at>  -354,8 +354,9  <at>  <at>  static int do_set_sock_timeout(struct socket *sock, int level,
 static int compat_sock_setsockopt(struct socket *sock, int level, int optname,
 				char __user *optval, unsigned int optlen)
-	if (optname == SO_ATTACH_FILTER)
-		return do_set_attach_filter(sock, level, optname,
+	if (optname == SO_ATTACH_FILTER ||
+	    optname == SO_ATTACH_REUSEPORT_CBPF)
(Continue reading)

George Spelvin | 31 May 15:41 2016

[DRAFT PATCH] parisc: add <asm/hash.h>

PA-RISC is interesting; integer multiplies are implemented in
the FPU, so are painful in the kernel.  But it tries to be
friendly to shift-and-add sequences.

__hash_32 is implemented using the same shift-and-add sequence as
Microblaze, just scheduled for the PA7100.  (It's 2-way superscalar
but in-order, like the Pentium.)

hash_64 was tricky.  My tools can't find good shift-and-add sequence
for the large multiplier, but the multiplier can be factored and two
sequences for smaller multipliers cascaded.

An alternative implementation is included, but not enabled by default:
Thomas Wang's 64-to-32-bit hash.  This is more compact than the multiply,
but has the same length dependency chain.

Signed-off-by: George Spelvin <linux <at>>
Cc: Helge Deller <deller <at>>
Cc: linux-parisc <at>
Definitely an interesting architecture.  How did I do?
This should pass the self-test in test_hash.ko.

 arch/parisc/Kconfig            |   1 +
 arch/parisc/include/asm/hash.h | 164 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 165 insertions(+)
 create mode 100644 arch/parisc/include/asm/hash.h

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 88cfaa8..8ed2a44 100644
(Continue reading)