Skip to contentSkip to conversation

powerpc: Move core kernel logic into arch/powerpc/Kbuild

PATCH Applied Michael Ellerman 5 participants 19 messages Oct 10, 2018 – Oct 19, 2018

Subsystems (2)
lore
Share & tools
lore

Michael Ellerman

author reviewer
#0 lore raw

PATCH 1/4 powerpc: Move core kernel logic into arch/powerpc/Kbuild

This is a nice cleanup, arch/powerpc/Makefile is long and messy so moving this out helps a little.

It also allows us to do:

  $ make arch/powerpc

Which can be helpful if you just want to compile test some changes to arch code and not link everything.

Finally it also gives us a single place to do subdir-cc-flags assignments which affect the whole of arch/powerpc, which we will do in a future patch.

---
 arch/powerpc/Kbuild   | 14 ++++++++++++++
 arch/powerpc/Makefile | 14 ++------------
 2 files changed, 16 insertions(+), 12 deletions(-)
 create mode 100644 arch/powerpc/Kbuild
arch/powerpc/Kbuild new file +14 -0
new file mode 100644
index 000000000000..690a498da050
@@ -0,0 +1,14 @@
+obj-y += kernel/
+obj-y += mm/
+obj-y += lib/
+obj-y += sysdev/
+obj-y += platforms/
+obj-y += math-emu/
+obj-y += crypto/
+obj-y += net/
+
+obj-$(CONFIG_XMON) += xmon/
+obj-$(CONFIG_KVM)  += kvm/
+
+obj-$(CONFIG_PERF_EVENTS) += perf/
+obj-$(CONFIG_KEXEC_FILE)  += purgatory/
arch/powerpc/Makefile +2 -12
index 974103254aed..e623abaa573e 100644
@@ -269,18 +269,8 @@ head-$(CONFIG_PPC_FPU)		+= arch/powerpc/kernel/fpu.o
 head-$(CONFIG_ALTIVEC)		+= arch/powerpc/kernel/vector.o
 head-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE)  += arch/powerpc/kernel/prom_init.o
 
-core-y				+= arch/powerpc/kernel/ \
-				   arch/powerpc/mm/ \
-				   arch/powerpc/lib/ \
-				   arch/powerpc/sysdev/ \
-				   arch/powerpc/platforms/ \
-				   arch/powerpc/math-emu/ \
-				   arch/powerpc/crypto/ \
-				   arch/powerpc/net/
-core-$(CONFIG_XMON)		+= arch/powerpc/xmon/
-core-$(CONFIG_KVM) 		+= arch/powerpc/kvm/
-core-$(CONFIG_PERF_EVENTS)	+= arch/powerpc/perf/
-core-$(CONFIG_KEXEC_FILE)	+= arch/powerpc/purgatory/
+# See arch/powerpc/Kbuild for content of core part of the kernel
+core-y += arch/powerpc/
 
 drivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
 
Signature · 1 line
2.17.1
author reviewer
#1 lore raw

PATCH 2/4 powerpc: Add -Werror at arch/powerpc level

Back when I added -Werror in commit ba55bd74360e ("powerpc: Add configurable -Werror for arch/powerpc") I did it by adding it to most of the arch Makefiles.

At the time we excluded math-emu, because apparently it didn't build cleanly. But that seems to have been fixed somewhere in the interim.

So move the -Werror addition to the top-level of the arch, this saves us from repeating it in every Makefile and means we won't forget to add it to any new sub-dirs.

---
 arch/powerpc/Kbuild                | 2 ++
 arch/powerpc/kernel/Makefile       | 2 --
 arch/powerpc/kernel/trace/Makefile | 2 --
 arch/powerpc/kvm/Makefile          | 2 --
 arch/powerpc/lib/Makefile          | 2 --
 arch/powerpc/mm/Makefile           | 2 --
 arch/powerpc/oprofile/Makefile     | 1 -
 arch/powerpc/perf/Makefile         | 1 -
 arch/powerpc/platforms/Makefile    | 2 --
 arch/powerpc/sysdev/Makefile       | 3 ---
 arch/powerpc/sysdev/xics/Makefile  | 1 -
 arch/powerpc/sysdev/xive/Makefile  | 1 -
 arch/powerpc/xmon/Makefile         | 2 --
 13 files changed, 2 insertions(+), 21 deletions(-)
arch/powerpc/Kbuild +2 -0
index 690a498da050..1625a06802ca 100644
@@ -1,3 +1,5 @@
+subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
+
 obj-y += kernel/
 obj-y += mm/
 obj-y += lib/
arch/powerpc/kernel/Makefile +0 -2
index 85ffa488dfb5..006e391814ed 100644
@@ -5,8 +5,6 @@
 
 CFLAGS_ptrace.o		+= -DUTS_MACHINE='"$(UTS_MACHINE)"'
 
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
-
 ifdef CONFIG_PPC64
 CFLAGS_prom_init.o	+= $(NO_MINIMAL_TOC)
 endif
arch/powerpc/kernel/trace/Makefile +0 -2
index d868ba42032f..b1725ad3e13d 100644
@@ -3,8 +3,6 @@
 # Makefile for the powerpc trace subsystem
 #
 
-subdir-ccflags-$(CONFIG_PPC_WERROR)	:= -Werror
-
 ifdef CONFIG_FUNCTION_TRACER
 # do not trace tracer code
 CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE)
arch/powerpc/kvm/Makefile +0 -2
index f872c04bb5b1..e9d579921a96 100644
@@ -3,8 +3,6 @@
 # Makefile for Kernel-based Virtual Machine module
 #
 
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
-
 ccflags-y := -Ivirt/kvm -Iarch/powerpc/kvm
 KVM := ../../../virt/kvm
 
arch/powerpc/lib/Makefile +0 -2
index 670286808928..703afa1808ed 100644
@@ -3,8 +3,6 @@
 # Makefile for ppc-specific library files..
 #
 
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
-
 ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
 
 CFLAGS_REMOVE_code-patching.o = $(CC_FLAGS_FTRACE)
arch/powerpc/mm/Makefile +0 -2
index cdf6a9960046..90e103ab44fb 100644
@@ -3,8 +3,6 @@
 # Makefile for the linux ppc-specific parts of the memory manager.
 #
 
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
-
 ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
 
 obj-y				:= fault.o mem.o pgtable.o mmap.o \
arch/powerpc/oprofile/Makefile +0 -1
index 7a7834c39f64..8d26d7416481 100644
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
 
 ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
 
arch/powerpc/perf/Makefile +0 -1
index 82986d2acd9b..ab26df5bacb9 100644
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
 
 obj-$(CONFIG_PERF_EVENTS)	+= callchain.o perf_regs.o
 
arch/powerpc/platforms/Makefile +0 -2
index e46bb7ea710f..143d4417f6cc 100644
@@ -1,7 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
-
 obj-$(CONFIG_FSL_ULI1575)	+= fsl_uli1575.o
 
 obj-$(CONFIG_PPC_PMAC)		+= powermac/
arch/powerpc/sysdev/Makefile +0 -3
index f730539074c4..2caa4defdfb6 100644
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
 
 ccflags-$(CONFIG_PPC64)		:= $(NO_MINIMAL_TOC)
 
@@ -56,8 +55,6 @@ obj-$(CONFIG_PPC_SCOM)		+= scom.o
 
 obj-$(CONFIG_PPC_EARLY_DEBUG_MEMCONS)	+= udbg_memcons.o
 
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
-
 obj-$(CONFIG_PPC_XICS)		+= xics/
 obj-$(CONFIG_PPC_XIVE)		+= xive/
 
arch/powerpc/sysdev/xics/Makefile +0 -1
index 5d438d92472b..ba1e3117b1c0 100644
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
 
 obj-y				+= xics-common.o
 obj-$(CONFIG_PPC_ICP_NATIVE)	+= icp-native.o
arch/powerpc/sysdev/xive/Makefile +0 -1
index 536d6e5706e3..dea2abc23f4d 100644
@@ -1,4 +1,3 @@
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
 
 obj-y				+= common.o
 obj-$(CONFIG_PPC_XIVE_NATIVE)	+= native.o
arch/powerpc/xmon/Makefile +0 -2
index 93cc1f1b8b61..ab5f66affb06 100644
@@ -1,8 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for xmon
 
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
-
 GCOV_PROFILE := n
 UBSAN_SANITIZE := n
 
Signature · 1 line
2.17.1
#2 lore raw

Re: [2/4] powerpc: Add -Werror at arch/powerpc level

Quoted 4 lines · Michael Ellerman

Back when I added -Werror in commit ba55bd74360e ("powerpc: Add configurable -Werror for arch/powerpc") I did it by adding it to most of the arch Makefiles.

Quoted 8 lines

At the time we excluded math-emu, because apparently it didn't build cleanly. But that seems to have been fixed somewhere in the interim.

So move the -Werror addition to the top-level of the arch, this saves us from repeating it in every Makefile and means we won't forget to add it to any new sub-dirs.

Applied to powerpc next.

https://git.kernel.org/powerpc/c/23ad1a2700725d46ee7760920974c6

cheers

author reviewer
#3 lore raw

PATCH 3/4 powerpc: Add -Wvla to arch CFLAGS

In reply to Michael Ellerman

Upstream has declared that Variable Length Array's (VLAs) are a bad idea, and eventually -Wvla will be added to the top-level Makefile. We can go one better and make sure we don't introduce any more by adding it to the arch Makefile.

---
 arch/powerpc/Kbuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/Kbuild +2 -1
index 1625a06802ca..86b261d6bde5 100644
@@ -1,4 +1,5 @@
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
+subdir-ccflags-y := $(call cc-option, -Wvla)
+subdir-ccflags-$(CONFIG_PPC_WERROR) += -Werror
 
 obj-y += kernel/
 obj-y += mm/
Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH 3/4] powerpc: Add -Wvla to arch CFLAGS

Quoted 15 lines · Michael Ellerman

Upstream has declared that Variable Length Array's (VLAs) are a bad idea, and eventually -Wvla will be added to the top-level Makefile. We can go one better and make sure we don't introduce any more by adding it to the arch Makefile.

---
 arch/powerpc/Kbuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/Kbuild +0 -0
index 1625a06802ca..86b261d6bde5 100644

arch/powerpc/Kbuild line 5

Quoted 6 lines
arch/powerpc/Kbuild +2 -1
@@ -1,4 +1,5 @@
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
+subdir-ccflags-y := $(call cc-option, -Wvla)
+subdir-ccflags-$(CONFIG_PPC_WERROR) += -Werror
 
 obj-y += kernel/
 obj-y += mm/

-Wvla will be going into the top-level Makefile in the merge window (see linux-next), so this will be redundant.

-Kees

Signature · 2 lines
Kees Cook
Pixel Security
author reviewer
#5 lore raw

Re: [PATCH 3/4] powerpc: Add -Wvla to arch CFLAGS

Quoted 20 lines · Kees Cook
Quoted 19 lines · Michael Ellerman

Upstream has declared that Variable Length Array's (VLAs) are a bad idea, and eventually -Wvla will be added to the top-level Makefile. We can go one better and make sure we don't introduce any more by adding it to the arch Makefile.

---
 arch/powerpc/Kbuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/Kbuild +2 -1
index 1625a06802ca..86b261d6bde5 100644
@@ -1,4 +1,5 @@
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
+subdir-ccflags-y := $(call cc-option, -Wvla)
+subdir-ccflags-$(CONFIG_PPC_WERROR) += -Werror
 
Quoted 5 lines

arch/powerpc/Kbuild line 5

Quoted 2 lines
arch/powerpc/Kbuild +0 -0
 obj-y += kernel/
 obj-y += mm/

-Wvla will be going into the top-level Makefile in the merge window (see linux-next), so this will be redundant.

Thanks, yeah I saw that after I posted. Will drop this one.

cheers

author reviewer
#6 lore raw

PATCH 4/4 powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

In reply to Michael Ellerman

Warn whenever a switch statement has a fallthrough without a comment annotating it.

---
 arch/powerpc/Kbuild | 1 +
 1 file changed, 1 insertion(+)
arch/powerpc/Kbuild +1 -0
index 86b261d6bde5..ef625f1db576 100644
@@ -1,4 +1,5 @@
 subdir-ccflags-y := $(call cc-option, -Wvla)
+subdir-ccflags-y += $(call cc-option, -Wimplicit-fallthrough)
 subdir-ccflags-$(CONFIG_PPC_WERROR) += -Werror
 
 obj-y += kernel/
Signature · 1 line
2.17.1
Reviewed-by on v1 4/4
#7 lore raw

Re: [PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

Quoted 4 lines · Michael Ellerman

Warn whenever a switch statement has a fallthrough without a comment annotating it.

Yes please. :)

-Kees

Quoted 17 lines
---
 arch/powerpc/Kbuild | 1 +
 1 file changed, 1 insertion(+)
arch/powerpc/Kbuild +1 -1
index 86b261d6bde5..ef625f1db576 100644
@@ -1,4 +1,5 @@
 subdir-ccflags-y := $(call cc-option, -Wvla)
+subdir-ccflags-y += $(call cc-option, -Wimplicit-fallthrough)
 subdir-ccflags-$(CONFIG_PPC_WERROR) += -Werror
 
 obj-y += kernel/
--

2.17.1

Signature · 2 lines
Kees Cook
Pixel Security
author reviewer
#8 lore raw

Re: [PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

Quoted 9 lines · Kees Cook
Quoted 4 lines · Michael Ellerman

Warn whenever a switch statement has a fallthrough without a comment annotating it.

Yes please. :)

Haha, thanks.

It still pops a few errors, including in linux/signal.h & compat.h, so it's somewhat aspirational until we can get those fixed up :)

cheers

#9 lore raw

Re: [PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

Quoted 7 lines · Michael Ellerman
Quoted 6 lines · Kees Cook
Quoted 4 lines · Michael Ellerman

Warn whenever a switch statement has a fallthrough without a comment annotating it.

Quoted 8 lines
Quoted 3 lines

Yes please. :)

Haha, thanks.

It still pops a few errors, including in linux/signal.h & compat.h, so it's somewhat aspirational until we can get those fixed up :)

Gustavo, any chance you can target those two files? It could get us a whole architecture using the flag. :)

-Kees

Signature · 2 lines
Kees Cook
Pixel Security
#10 lore raw

Re: [PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

Quoted 12 lines · Kees Cook
Quoted 11 lines · Michael Ellerman
Quoted 9 lines · Kees Cook
Quoted 4 lines · Michael Ellerman

Warn whenever a switch statement has a fallthrough without a comment annotating it.

Yes please. :)

Quoted 8 lines
Quoted 4 lines

Haha, thanks.

It still pops a few errors, including in linux/signal.h & compat.h, so it's somewhat aspirational until we can get those fixed up :)

Gustavo, any chance you can target those two files? It could get us a whole architecture using the flag. :)

Yep. Sure thing.

I'm already taking a look.

Thanks
--
Gustavo

#11 lore raw

Re: [PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

In reply to Michael Ellerman

Hi Michael,

Quoted 3 lines · Michael Ellerman

It still pops a few errors, including in linux/signal.h & compat.h, so it's somewhat aspirational until we can get those fixed up :)

I wonder if you have a log containing those warnings that you can share with me.

I'd like to fix them up.

Thanks
--
Gustavo

author reviewer
#12 lore raw

Re: [PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

Quoted 10 lines · Gustavo A. R. Silva

Hi Michael,

Quoted 3 lines · Michael Ellerman

It still pops a few errors, including in linux/signal.h & compat.h, so it's somewhat aspirational until we can get those fixed up :)

I wonder if you have a log containing those warnings that you can share with me.

Sure. The kbuild report up thread has some or most of them.

But here's a full list:

Failed 279/290
http://kisskb.ellerman.id.au/kisskb/head/1d59e2c78793d8aea9949ca71323c4583c78f488/
Failed: powerpc-next/ppc64_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542791/log/)
/kisskb/src/arch/powerpc/platforms/powermac/feature.c:1477:6: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/signal.h:180:22: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:495:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:496:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:494:51: error: this statement may fall through [-Werror=implicit-fallthrough=]
Failed: powerpc-next/corenet64_smp_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542786/log/)
/kisskb/src/include/linux/compat.h:494:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:495:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:496:51: error: this statement may fall through [-Werror=implicit-fallthrough=]
Failed: powerpc-next/ppc64le_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542777/log/)
/kisskb/src/include/linux/signal.h:180:22: error: this statement may fall through [-Werror=implicit-fallthrough=]
Failed: powerpc-next/powernv_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542776/log/)
/kisskb/src/include/linux/signal.h:180:22: error: this statement may fall through [-Werror=implicit-fallthrough=]

cheers

#13 lore raw

Re: [PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

Quoted 5 lines · Michael Ellerman

Sure. The kbuild report up thread has some or most of them.

But here's a full list:

Quoted 17 lines

Failed 279/290
http://kisskb.ellerman.id.au/kisskb/head/1d59e2c78793d8aea9949ca71323c4583c78f488/
Failed: powerpc-next/ppc64_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542791/log/)
/kisskb/src/arch/powerpc/platforms/powermac/feature.c:1477:6: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/signal.h:180:22: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:495:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:496:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:494:51: error: this statement may fall through [-Werror=implicit-fallthrough=]
Failed: powerpc-next/corenet64_smp_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542786/log/)
/kisskb/src/include/linux/compat.h:494:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:495:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:496:51: error: this statement may fall through [-Werror=implicit-fallthrough=]
Failed: powerpc-next/ppc64le_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542777/log/)
/kisskb/src/include/linux/signal.h:180:22: error: this statement may fall through [-Werror=implicit-fallthrough=]
Failed: powerpc-next/powernv_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542776/log/)
/kisskb/src/include/linux/signal.h:180:22: error: this statement may fall through [-Werror=implicit-fallthrough=]

Thanks, Michael.

Kees, can you take the patches?

Apparently, neither signal.h nor compat.h have a dedicated maintainer:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/linux/signal.h
[email protected] (open list)
$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/linux/compat.h
[email protected] (open list)

Thanks
--
Gustavo

#14 lore raw

Re: [PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

Quoted 31 lines · Gustavo A. R. Silva
Quoted 5 lines · Michael Ellerman

Sure. The kbuild report up thread has some or most of them.

But here's a full list:

Quoted 17 lines

Failed 279/290
http://kisskb.ellerman.id.au/kisskb/head/1d59e2c78793d8aea9949ca71323c4583c78f488/
Failed: powerpc-next/ppc64_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542791/log/)
/kisskb/src/arch/powerpc/platforms/powermac/feature.c:1477:6: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/signal.h:180:22: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:495:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:496:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:494:51: error: this statement may fall through [-Werror=implicit-fallthrough=]
Failed: powerpc-next/corenet64_smp_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542786/log/)
/kisskb/src/include/linux/compat.h:494:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:495:51: error: this statement may fall through [-Werror=implicit-fallthrough=] /kisskb/src/include/linux/compat.h:496:51: error: this statement may fall through [-Werror=implicit-fallthrough=]
Failed: powerpc-next/ppc64le_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542777/log/)
/kisskb/src/include/linux/signal.h:180:22: error: this statement may fall through [-Werror=implicit-fallthrough=]
Failed: powerpc-next/powernv_defconfig/powerpc-gcc8 (http://kisskb.ellerman.id.au/kisskb/buildresult/13542776/log/)
/kisskb/src/include/linux/signal.h:180:22: error: this statement may fall through [-Werror=implicit-fallthrough=]

Thanks, Michael.

Kees, can you take the patches?

Quoted 7 lines

Apparently, neither signal.h nor compat.h have a dedicated maintainer:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/linux/signal.h
[email protected] (open list)
$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/linux/compat.h
[email protected] (open list)

Normally things like that go through akpm, but I'm happy to carry them if needed.

-Kees

Signature · 2 lines
Kees Cook
Pixel Security
#15 lore raw

Re: [PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

Quoted 7 lines · Kees Cook
Quoted 3 lines
$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/linux/compat.h
[email protected] (open list)

Normally things like that go through akpm, but I'm happy to carry them if needed.

Oh okay. Let me try through apkm first. :)

Thanks
--
Gustavo

#16 lore raw

Re: [PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

In reply to Michael Ellerman
I love your patch! Yet something to improve:

Hi Michael,

I love your patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.19-rc7 next-20181010]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Michael-Ellerman/powerpc-Move-core-kernel-logic-into-arch-powerpc-Kbuild/20181010-205834
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-socrates_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc

All errors (new ones prefixed by >>):

arch/powerpc/kernel/align.c: In function 'emulate_spe':

>> arch/powerpc/kernel/align.c:183:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
       ret |= __get_user_inatomic(temp.v[3], p++);
           ^~
   arch/powerpc/kernel/align.c:184:3: note: here
      case 4:
      ^~~~
   arch/powerpc/kernel/align.c:186:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
       ret |= __get_user_inatomic(temp.v[5], p++);
           ^~
   arch/powerpc/kernel/align.c:187:3: note: here
      case 2:
      ^~~~
   arch/powerpc/kernel/align.c:266:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
       ret |= __put_user_inatomic(data.v[3], p++);
           ^~
   arch/powerpc/kernel/align.c:267:3: note: here
      case 4:
      ^~~~
   arch/powerpc/kernel/align.c:269:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
       ret |= __put_user_inatomic(data.v[5], p++);
           ^~
   arch/powerpc/kernel/align.c:270:3: note: here
      case 2:
      ^~~~

cc1: all warnings being treated as errors

vim +183 arch/powerpc/kernel/align.c

26caeb2e Kumar Gala             2007-08-24  104  
26caeb2e Kumar Gala             2007-08-24  105  /*
26caeb2e Kumar Gala             2007-08-24  106   * Emulate SPE loads and stores.
26caeb2e Kumar Gala             2007-08-24  107   * Only Book-E has these instructions, and it does true little-endian,
26caeb2e Kumar Gala             2007-08-24  108   * so we don't need the address swizzling.
26caeb2e Kumar Gala             2007-08-24  109   */
26caeb2e Kumar Gala             2007-08-24  110  static int emulate_spe(struct pt_regs *regs, unsigned int reg,
26caeb2e Kumar Gala             2007-08-24  111  		       unsigned int instr)
26caeb2e Kumar Gala             2007-08-24  112  {
f626190d Anton Blanchard        2013-09-23  113  	int ret;
26caeb2e Kumar Gala             2007-08-24  114  	union {
26caeb2e Kumar Gala             2007-08-24  115  		u64 ll;
26caeb2e Kumar Gala             2007-08-24  116  		u32 w[2];
26caeb2e Kumar Gala             2007-08-24  117  		u16 h[4];
26caeb2e Kumar Gala             2007-08-24  118  		u8 v[8];
26caeb2e Kumar Gala             2007-08-24  119  	} data, temp;
26caeb2e Kumar Gala             2007-08-24  120  	unsigned char __user *p, *addr;
26caeb2e Kumar Gala             2007-08-24  121  	unsigned long *evr = &current->thread.evr[reg];
26caeb2e Kumar Gala             2007-08-24  122  	unsigned int nb, flags;
26caeb2e Kumar Gala             2007-08-24  123  
26caeb2e Kumar Gala             2007-08-24  124  	instr = (instr >> 1) & 0x1f;
26caeb2e Kumar Gala             2007-08-24  125  
26caeb2e Kumar Gala             2007-08-24  126  	/* DAR has the operand effective address */
26caeb2e Kumar Gala             2007-08-24  127  	addr = (unsigned char __user *)regs->dar;
26caeb2e Kumar Gala             2007-08-24  128  
26caeb2e Kumar Gala             2007-08-24  129  	nb = spe_aligninfo[instr].len;
26caeb2e Kumar Gala             2007-08-24  130  	flags = spe_aligninfo[instr].flags;
26caeb2e Kumar Gala             2007-08-24  131  
26caeb2e Kumar Gala             2007-08-24  132  	/* Verify the address of the operand */
26caeb2e Kumar Gala             2007-08-24  133  	if (unlikely(user_mode(regs) &&
26caeb2e Kumar Gala             2007-08-24  134  		     !access_ok((flags & ST ? VERIFY_WRITE : VERIFY_READ),
26caeb2e Kumar Gala             2007-08-24  135  				addr, nb)))
26caeb2e Kumar Gala             2007-08-24  136  		return -EFAULT;
26caeb2e Kumar Gala             2007-08-24  137  
26caeb2e Kumar Gala             2007-08-24  138  	/* userland only */
26caeb2e Kumar Gala             2007-08-24  139  	if (unlikely(!user_mode(regs)))
26caeb2e Kumar Gala             2007-08-24  140  		return 0;
26caeb2e Kumar Gala             2007-08-24  141  
26caeb2e Kumar Gala             2007-08-24  142  	flush_spe_to_thread(current);
26caeb2e Kumar Gala             2007-08-24  143  
26caeb2e Kumar Gala             2007-08-24  144  	/* If we are loading, get the data from user space, else
26caeb2e Kumar Gala             2007-08-24  145  	 * get it from register values
26caeb2e Kumar Gala             2007-08-24  146  	 */
26caeb2e Kumar Gala             2007-08-24  147  	if (flags & ST) {
26caeb2e Kumar Gala             2007-08-24  148  		data.ll = 0;
26caeb2e Kumar Gala             2007-08-24  149  		switch (instr) {
26caeb2e Kumar Gala             2007-08-24  150  		case EVSTDD:
26caeb2e Kumar Gala             2007-08-24  151  		case EVSTDW:
26caeb2e Kumar Gala             2007-08-24  152  		case EVSTDH:
26caeb2e Kumar Gala             2007-08-24  153  			data.w[0] = *evr;
26caeb2e Kumar Gala             2007-08-24  154  			data.w[1] = regs->gpr[reg];
26caeb2e Kumar Gala             2007-08-24  155  			break;
26caeb2e Kumar Gala             2007-08-24  156  		case EVSTWHE:
26caeb2e Kumar Gala             2007-08-24  157  			data.h[2] = *evr >> 16;
26caeb2e Kumar Gala             2007-08-24  158  			data.h[3] = regs->gpr[reg] >> 16;
26caeb2e Kumar Gala             2007-08-24  159  			break;
26caeb2e Kumar Gala             2007-08-24  160  		case EVSTWHO:
26caeb2e Kumar Gala             2007-08-24  161  			data.h[2] = *evr & 0xffff;
26caeb2e Kumar Gala             2007-08-24  162  			data.h[3] = regs->gpr[reg] & 0xffff;
26caeb2e Kumar Gala             2007-08-24  163  			break;
26caeb2e Kumar Gala             2007-08-24  164  		case EVSTWWE:
26caeb2e Kumar Gala             2007-08-24  165  			data.w[1] = *evr;
26caeb2e Kumar Gala             2007-08-24  166  			break;
26caeb2e Kumar Gala             2007-08-24  167  		case EVSTWWO:
26caeb2e Kumar Gala             2007-08-24  168  			data.w[1] = regs->gpr[reg];
26caeb2e Kumar Gala             2007-08-24  169  			break;
26caeb2e Kumar Gala             2007-08-24  170  		default:
26caeb2e Kumar Gala             2007-08-24  171  			return -EINVAL;
26caeb2e Kumar Gala             2007-08-24  172  		}
26caeb2e Kumar Gala             2007-08-24  173  	} else {
26caeb2e Kumar Gala             2007-08-24  174  		temp.ll = data.ll = 0;
26caeb2e Kumar Gala             2007-08-24  175  		ret = 0;
26caeb2e Kumar Gala             2007-08-24  176  		p = addr;
26caeb2e Kumar Gala             2007-08-24  177  
26caeb2e Kumar Gala             2007-08-24  178  		switch (nb) {
26caeb2e Kumar Gala             2007-08-24  179  		case 8:
26caeb2e Kumar Gala             2007-08-24  180  			ret |= __get_user_inatomic(temp.v[0], p++);
26caeb2e Kumar Gala             2007-08-24  181  			ret |= __get_user_inatomic(temp.v[1], p++);
26caeb2e Kumar Gala             2007-08-24  182  			ret |= __get_user_inatomic(temp.v[2], p++);
26caeb2e Kumar Gala             2007-08-24 @183  			ret |= __get_user_inatomic(temp.v[3], p++);
26caeb2e Kumar Gala             2007-08-24  184  		case 4:
26caeb2e Kumar Gala             2007-08-24  185  			ret |= __get_user_inatomic(temp.v[4], p++);
26caeb2e Kumar Gala             2007-08-24  186  			ret |= __get_user_inatomic(temp.v[5], p++);
26caeb2e Kumar Gala             2007-08-24  187  		case 2:
26caeb2e Kumar Gala             2007-08-24  188  			ret |= __get_user_inatomic(temp.v[6], p++);
26caeb2e Kumar Gala             2007-08-24  189  			ret |= __get_user_inatomic(temp.v[7], p++);
26caeb2e Kumar Gala             2007-08-24  190  			if (unlikely(ret))
26caeb2e Kumar Gala             2007-08-24  191  				return -EFAULT;
26caeb2e Kumar Gala             2007-08-24  192  		}
26caeb2e Kumar Gala             2007-08-24  193  
26caeb2e Kumar Gala             2007-08-24  194  		switch (instr) {
26caeb2e Kumar Gala             2007-08-24  195  		case EVLDD:
26caeb2e Kumar Gala             2007-08-24  196  		case EVLDW:
26caeb2e Kumar Gala             2007-08-24  197  		case EVLDH:
26caeb2e Kumar Gala             2007-08-24  198  			data.ll = temp.ll;
26caeb2e Kumar Gala             2007-08-24  199  			break;
26caeb2e Kumar Gala             2007-08-24  200  		case EVLHHESPLAT:
26caeb2e Kumar Gala             2007-08-24  201  			data.h[0] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  202  			data.h[2] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  203  			break;
26caeb2e Kumar Gala             2007-08-24  204  		case EVLHHOUSPLAT:
26caeb2e Kumar Gala             2007-08-24  205  		case EVLHHOSSPLAT:
26caeb2e Kumar Gala             2007-08-24  206  			data.h[1] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  207  			data.h[3] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  208  			break;
26caeb2e Kumar Gala             2007-08-24  209  		case EVLWHE:
26caeb2e Kumar Gala             2007-08-24  210  			data.h[0] = temp.h[2];
26caeb2e Kumar Gala             2007-08-24  211  			data.h[2] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  212  			break;
26caeb2e Kumar Gala             2007-08-24  213  		case EVLWHOU:
26caeb2e Kumar Gala             2007-08-24  214  		case EVLWHOS:
26caeb2e Kumar Gala             2007-08-24  215  			data.h[1] = temp.h[2];
26caeb2e Kumar Gala             2007-08-24  216  			data.h[3] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  217  			break;
26caeb2e Kumar Gala             2007-08-24  218  		case EVLWWSPLAT:
26caeb2e Kumar Gala             2007-08-24  219  			data.w[0] = temp.w[1];
26caeb2e Kumar Gala             2007-08-24  220  			data.w[1] = temp.w[1];
26caeb2e Kumar Gala             2007-08-24  221  			break;
26caeb2e Kumar Gala             2007-08-24  222  		case EVLWHSPLAT:
26caeb2e Kumar Gala             2007-08-24  223  			data.h[0] = temp.h[2];
26caeb2e Kumar Gala             2007-08-24  224  			data.h[1] = temp.h[2];
26caeb2e Kumar Gala             2007-08-24  225  			data.h[2] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  226  			data.h[3] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  227  			break;
26caeb2e Kumar Gala             2007-08-24  228  		default:
26caeb2e Kumar Gala             2007-08-24  229  			return -EINVAL;
26caeb2e Kumar Gala             2007-08-24  230  		}
26caeb2e Kumar Gala             2007-08-24  231  	}
26caeb2e Kumar Gala             2007-08-24  232  
26caeb2e Kumar Gala             2007-08-24  233  	if (flags & SW) {
26caeb2e Kumar Gala             2007-08-24  234  		switch (flags & 0xf0) {
26caeb2e Kumar Gala             2007-08-24  235  		case E8:
f626190d Anton Blanchard        2013-09-23  236  			data.ll = swab64(data.ll);
26caeb2e Kumar Gala             2007-08-24  237  			break;
26caeb2e Kumar Gala             2007-08-24  238  		case E4:
f626190d Anton Blanchard        2013-09-23  239  			data.w[0] = swab32(data.w[0]);
f626190d Anton Blanchard        2013-09-23  240  			data.w[1] = swab32(data.w[1]);
26caeb2e Kumar Gala             2007-08-24  241  			break;
26caeb2e Kumar Gala             2007-08-24  242  		/* Its half word endian */
26caeb2e Kumar Gala             2007-08-24  243  		default:
f626190d Anton Blanchard        2013-09-23  244  			data.h[0] = swab16(data.h[0]);
f626190d Anton Blanchard        2013-09-23  245  			data.h[1] = swab16(data.h[1]);
f626190d Anton Blanchard        2013-09-23  246  			data.h[2] = swab16(data.h[2]);
f626190d Anton Blanchard        2013-09-23  247  			data.h[3] = swab16(data.h[3]);
26caeb2e Kumar Gala             2007-08-24  248  			break;
26caeb2e Kumar Gala             2007-08-24  249  		}
26caeb2e Kumar Gala             2007-08-24  250  	}
26caeb2e Kumar Gala             2007-08-24  251  
26caeb2e Kumar Gala             2007-08-24  252  	if (flags & SE) {
26caeb2e Kumar Gala             2007-08-24  253  		data.w[0] = (s16)data.h[1];
26caeb2e Kumar Gala             2007-08-24  254  		data.w[1] = (s16)data.h[3];
26caeb2e Kumar Gala             2007-08-24  255  	}
26caeb2e Kumar Gala             2007-08-24  256  
26caeb2e Kumar Gala             2007-08-24  257  	/* Store result to memory or update registers */
26caeb2e Kumar Gala             2007-08-24  258  	if (flags & ST) {
26caeb2e Kumar Gala             2007-08-24  259  		ret = 0;
26caeb2e Kumar Gala             2007-08-24  260  		p = addr;
26caeb2e Kumar Gala             2007-08-24  261  		switch (nb) {
26caeb2e Kumar Gala             2007-08-24  262  		case 8:
26caeb2e Kumar Gala             2007-08-24  263  			ret |= __put_user_inatomic(data.v[0], p++);
26caeb2e Kumar Gala             2007-08-24  264  			ret |= __put_user_inatomic(data.v[1], p++);
26caeb2e Kumar Gala             2007-08-24  265  			ret |= __put_user_inatomic(data.v[2], p++);
26caeb2e Kumar Gala             2007-08-24  266  			ret |= __put_user_inatomic(data.v[3], p++);
26caeb2e Kumar Gala             2007-08-24  267  		case 4:
26caeb2e Kumar Gala             2007-08-24  268  			ret |= __put_user_inatomic(data.v[4], p++);
26caeb2e Kumar Gala             2007-08-24  269  			ret |= __put_user_inatomic(data.v[5], p++);
26caeb2e Kumar Gala             2007-08-24  270  		case 2:
26caeb2e Kumar Gala             2007-08-24  271  			ret |= __put_user_inatomic(data.v[6], p++);
26caeb2e Kumar Gala             2007-08-24  272  			ret |= __put_user_inatomic(data.v[7], p++);
26caeb2e Kumar Gala             2007-08-24  273  		}
26caeb2e Kumar Gala             2007-08-24  274  		if (unlikely(ret))
26caeb2e Kumar Gala             2007-08-24  275  			return -EFAULT;
26caeb2e Kumar Gala             2007-08-24  276  	} else {
26caeb2e Kumar Gala             2007-08-24  277  		*evr = data.w[0];
26caeb2e Kumar Gala             2007-08-24  278  		regs->gpr[reg] = data.w[1];
26caeb2e Kumar Gala             2007-08-24  279  	}
26caeb2e Kumar Gala             2007-08-24  280  
26caeb2e Kumar Gala             2007-08-24  281  	return 1;
26caeb2e Kumar Gala             2007-08-24  282  }
26caeb2e Kumar Gala             2007-08-24  283  #endif /* CONFIG_SPE */

5daf9071 Benjamin Herrenschmidt 2005-11-18 284

:::::: The code at line 183 was first introduced by commit
:::::: 26caeb2ee1924d564e8d8190aa783a569532f81a [POWERPC] Handle alignment faults on SPE load/store instructions

:::::: TO: Kumar Gala <[email protected]> :::::: CC: Kumar Gala <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#17 lore raw

Re: [PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

In reply to Michael Ellerman
I love your patch! Yet something to improve:

Hi Michael,

I love your patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.19-rc7 next-20181010]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Michael-Ellerman/powerpc-Move-core-kernel-logic-into-arch-powerpc-Kbuild/20181010-205834
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc

All errors (new ones prefixed by >>):

In file included from arch/powerpc/kernel/signal_32.c:32:0:
include/linux/compat.h: In function 'put_compat_sigset':

>> include/linux/compat.h:494:51: error: this statement may fall through [-Werror=implicit-fallthrough=]
     case 4: v.sig[7] = (set->sig[3] >> 32); v.sig[6] = set->sig[3];
                                             ~~~~~~~~~^~~~~~~~~~~~~
   include/linux/compat.h:495:2: note: here
     case 3: v.sig[5] = (set->sig[2] >> 32); v.sig[4] = set->sig[2];
     ^~~~
   include/linux/compat.h:495:51: error: this statement may fall through [-Werror=implicit-fallthrough=]
     case 3: v.sig[5] = (set->sig[2] >> 32); v.sig[4] = set->sig[2];
                                             ~~~~~~~~~^~~~~~~~~~~~~
   include/linux/compat.h:496:2: note: here
     case 2: v.sig[3] = (set->sig[1] >> 32); v.sig[2] = set->sig[1];
     ^~~~
   include/linux/compat.h:496:51: error: this statement may fall through [-Werror=implicit-fallthrough=]
     case 2: v.sig[3] = (set->sig[1] >> 32); v.sig[2] = set->sig[1];
                                             ~~~~~~~~~^~~~~~~~~~~~~
   include/linux/compat.h:497:2: note: here
     case 1: v.sig[1] = (set->sig[0] >> 32); v.sig[0] = set->sig[0];
     ^~~~
   cc1: all warnings being treated as errors
--
   arch/powerpc/kernel/nvram_64.c: In function 'dev_nvram_ioctl':
>> arch/powerpc/kernel/nvram_64.c:811:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
      printk(KERN_WARNING "nvram: Using obsolete PMAC_NVRAM_GET_OFFSET ioctl\n");
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/kernel/nvram_64.c:812:2: note: here
     case IOC_NVRAM_GET_OFFSET: {
     ^~~~
   cc1: all warnings being treated as errors
--
   In file included from include/linux/kvm_host.h:14:0,
                    from arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:21:
   include/linux/signal.h: In function 'sigemptyset':
>> include/linux/signal.h:180:22: error: this statement may fall through [-Werror=implicit-fallthrough=]
     case 2: set->sig[1] = 0;
             ~~~~~~~~~~~~^~~
   include/linux/signal.h:181:2: note: here
     case 1: set->sig[0] = 0;
     ^~~~
   cc1: all warnings being treated as errors
--
   arch/powerpc/platforms/powermac/feature.c: In function 'g5_i2s_enable':
>> arch/powerpc/platforms/powermac/feature.c:1477:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
      if (macio->type == macio_shasta)
         ^
   arch/powerpc/platforms/powermac/feature.c:1479:2: note: here
     default:
     ^~~~~~~
   cc1: all warnings being treated as errors
--
   arch/powerpc/xmon/xmon.c: In function 'do_spu_cmd':
>> arch/powerpc/xmon/xmon.c:4023:24: error: this statement may fall through [-Werror=implicit-fallthrough=]
      if (isxdigit(subcmd) || subcmd == '\n')
   arch/powerpc/xmon/xmon.c:4025:2: note: here
     case 'f':
     ^~~~

cc1: all warnings being treated as errors

vim +494 include/linux/compat.h

fde9fc76 Matt Redfearn 2018-02-19  481  
fde9fc76 Matt Redfearn 2018-02-19  482  /*
fde9fc76 Matt Redfearn 2018-02-19  483   * Defined inline such that size can be compile time constant, which avoids
fde9fc76 Matt Redfearn 2018-02-19  484   * CONFIG_HARDENED_USERCOPY complaining about copies from task_struct
fde9fc76 Matt Redfearn 2018-02-19  485   */
fde9fc76 Matt Redfearn 2018-02-19  486  static inline int
fde9fc76 Matt Redfearn 2018-02-19  487  put_compat_sigset(compat_sigset_t __user *compat, const sigset_t *set,
fde9fc76 Matt Redfearn 2018-02-19  488  		  unsigned int size)
fde9fc76 Matt Redfearn 2018-02-19  489  {
fde9fc76 Matt Redfearn 2018-02-19  490  	/* size <= sizeof(compat_sigset_t) <= sizeof(sigset_t) */
fde9fc76 Matt Redfearn 2018-02-19  491  #ifdef __BIG_ENDIAN
fde9fc76 Matt Redfearn 2018-02-19  492  	compat_sigset_t v;
fde9fc76 Matt Redfearn 2018-02-19  493  	switch (_NSIG_WORDS) {
fde9fc76 Matt Redfearn 2018-02-19 @494  	case 4: v.sig[7] = (set->sig[3] >> 32); v.sig[6] = set->sig[3];
fde9fc76 Matt Redfearn 2018-02-19  495  	case 3: v.sig[5] = (set->sig[2] >> 32); v.sig[4] = set->sig[2];
fde9fc76 Matt Redfearn 2018-02-19  496  	case 2: v.sig[3] = (set->sig[1] >> 32); v.sig[2] = set->sig[1];
fde9fc76 Matt Redfearn 2018-02-19  497  	case 1: v.sig[1] = (set->sig[0] >> 32); v.sig[0] = set->sig[0];
fde9fc76 Matt Redfearn 2018-02-19  498  	}
fde9fc76 Matt Redfearn 2018-02-19  499  	return copy_to_user(compat, &v, size) ? -EFAULT : 0;
fde9fc76 Matt Redfearn 2018-02-19  500  #else
fde9fc76 Matt Redfearn 2018-02-19  501  	return copy_to_user(compat, set, size) ? -EFAULT : 0;
fde9fc76 Matt Redfearn 2018-02-19  502  #endif
fde9fc76 Matt Redfearn 2018-02-19  503  }

bebfa101 Andi Kleen 2006-06-26 504

:::::: The code at line 494 was first introduced by commit
:::::: fde9fc766e96c494b82931b1d270a9a751be07c0 signals: Move put_compat_sigset to compat.h to silence hardened usercopy

:::::: TO: Matt Redfearn <[email protected]> :::::: CC: James Hogan <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#18 lore raw
In reply to Michael Ellerman
Quoted 7 lines · Michael Ellerman

This is a nice cleanup, arch/powerpc/Makefile is long and messy so moving this out helps a little.

It also allows us to do:

  $ make arch/powerpc
Quoted 8 lines

Which can be helpful if you just want to compile test some changes to arch code and not link everything.

Finally it also gives us a single place to do subdir-cc-flags assignments which affect the whole of arch/powerpc, which we will do in a future patch.

Applied to powerpc next.

https://git.kernel.org/powerpc/c/c47ca98d32a22a412ddbc69916cf62

cheers