* Re: [PATCH v1] sefltest/ima: support appended signatures (modsig)
From: shuah @ 2019-08-28 15:53 UTC (permalink / raw)
To: Mimi Zohar, linux-integrity
Cc: shuah, Dave Young, linux-kernel, Petr Vorel, linux-kselftest,
Jessica Yu, linuxppc-dev, Thiago Jung Bauermann
In-Reply-To: <1567005240-12912-1-git-send-email-zohar@linux.ibm.com>
On 8/28/19 9:14 AM, Mimi Zohar wrote:
> In addition to the PE/COFF and IMA xattr signatures, the kexec kernel
> image can be signed with an appended signature, using the same
> scripts/sign-file tool that is used to sign kernel modules.
>
> This patch adds support for detecting a kernel image signed with an
> appended signature and updates the existing test messages
> appropriately.
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
> ---
Thanks Mimi. This commit log looks good. My Ack for the patch
to go through the IMA tree.
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
thanks,
-- Shuah
^ permalink raw reply
* Re: [PATCH v1] sefltest/ima: support appended signatures (modsig)
From: Mimi Zohar @ 2019-08-28 15:55 UTC (permalink / raw)
To: shuah, linux-integrity
Cc: Dave Young, linux-kernel, Petr Vorel, linux-kselftest, Jessica Yu,
linuxppc-dev, Thiago Jung Bauermann
In-Reply-To: <4a9f9cd3-c550-98e4-1513-14ef161c34c2@kernel.org>
On Wed, 2019-08-28 at 09:53 -0600, shuah wrote:
> On 8/28/19 9:14 AM, Mimi Zohar wrote:
> > In addition to the PE/COFF and IMA xattr signatures, the kexec kernel
> > image can be signed with an appended signature, using the same
> > scripts/sign-file tool that is used to sign kernel modules.
> >
> > This patch adds support for detecting a kernel image signed with an
> > appended signature and updates the existing test messages
> > appropriately.
> >
> > Reviewed-by: Petr Vorel <pvorel@suse.cz>
> > Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
> > ---
>
> Thanks Mimi. This commit log looks good. My Ack for the patch
> to go through the IMA tree.
>
> Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Thanks!
Mimi
^ permalink raw reply
* Re: [PATCH RESEND v11 7/8] open: openat2(2) syscall
From: Jeff Layton @ 2019-08-28 15:55 UTC (permalink / raw)
To: sbaugh, linux-fsdevel
Cc: linux-arch, linux-ia64, linux-parisc, linux-sh, linux-api,
linux-kernel, linux-mips, linuxppc-dev, linux-alpha, sparclinux,
linux-arm-kernel
In-Reply-To: <854l2366zp.fsf@catern.com>
On Mon, 2019-08-26 at 19:50 +0000, sbaugh@catern.com wrote:
> Aleksa Sarai <cyphar@cyphar.com> writes:
> > To this end, we introduce the openat2(2) syscall. It provides all of the
> > features of openat(2) through the @how->flags argument, but also
> > also provides a new @how->resolve argument which exposes RESOLVE_* flags
> > that map to our new LOOKUP_* flags. It also eliminates the long-standing
> > ugliness of variadic-open(2) by embedding it in a struct.
>
> I don't like this usage of a structure in memory to pass arguments that
> would fit in registers. This would be quite inconvenient for me as a
> userspace developer.
>
> Others have brought up issues with this: the issue of seccomp, and the
> issue of mismatch between the userspace interface and the kernel
> interface, are the most important for me. I want to add another,
> admittedly somewhat niche, concern.
>
> This interfaces requires a program to allocate memory (even on the
> stack) just to pass arguments to the kernel which could be passed
> without allocating that memory. That makes it more difficult and less
> efficient to use this syscall in any case where memory is not so easily
> allocatable: such as early program startup or assembly, where the stack
> may be limited in size or not even available yet, or when injecting a
> syscall while ptracing.
>
> A struct-passing interface was needed for clone, since we ran out of
> registers; but we have not run out of registers yet for openat, so it
> would be nice to avoid this if we can. We can always expand later...
>
We can't really expand later like you suggest.
Suppose in a couple of years that we need to add some new argument to
openat2 that isn't just a new flag. If all these values are passed by
individual arguments, you can't add one later without adding yet another
syscall.
Using a struct for this allows this to be extended later, OTOH. You can
extend it, and add a flag that tells the kernel that it can access the
new field. No new syscall required.
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply
* Re: [PATCH] ASoC: fsl_ssi: Fix clock control issue in master mode
From: Fabio Estevam @ 2019-08-28 16:02 UTC (permalink / raw)
To: Shengjiu Wang
Cc: Linux-ALSA, Timur Tabi, Xiubo Li, linux-kernel, Takashi Iwai,
Liam Girdwood, Jaroslav Kysela, Nicolin Chen, Mark Brown,
linuxppc-dev
In-Reply-To: <1567012817-12625-1-git-send-email-shengjiu.wang@nxp.com>
Hi Shengjiu,
On Wed, Aug 28, 2019 at 2:21 AM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
>
> The test case is
> arecord -Dhw:0 -d 10 -f S16_LE -r 48000 -c 2 temp.wav &
> aplay -Dhw:0 -d 30 -f S16_LE -r 48000 -c 2 test.wav
>
> There will be error after end of arecord:
> aplay: pcm_write:2051: write error: Input/output error
>
> Capture and Playback work in parallel in master mode, one
> substream stops, the other substream is impacted, the
> reason is that clock is disabled wrongly.
>
> The clock's reference count is not increased when second
> substream starts, the hw_param() function returns in the
> beginning because first substream is enabled, then in end
> of first substream, the hw_free() disables the clock.
>
> This patch is to move the clock enablement to the place
> before checking of the device enablement in hw_param().
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
It would be nice if you could add a Fixes tag as well.
^ permalink raw reply
* Re: [PATCH 1/4] fs: always build llseek.
From: Michal Suchánek @ 2019-08-28 16:15 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Michael Neuling, Eric W. Biederman, David Hildenbrand,
Greg Kroah-Hartman, Nicholas Piggin, linux-kernel, Steven Rostedt,
Dmitry V. Levin, Breno Leitao, Max Filippov, Hari Bathini,
Paul Mackerras, Alexander Viro, Andrew Donnellan, linux-fsdevel,
Firoz Khan, Thomas Gleixner, linuxppc-dev, Andrew Morton,
Allison Randal, Joel Stanley
In-Reply-To: <20190828151552.GA16855@infradead.org>
On Wed, 28 Aug 2019 08:15:52 -0700
Christoph Hellwig <hch@infradead.org> wrote:
> On Tue, Aug 27, 2019 at 10:21:06PM +0200, Michal Suchanek wrote:
> > 64bit !COMPAT does not build because the llseek syscall is in the tables.
>
> Well, this will bloat thinkgs like 64-bit RISC-V for no good reason.
> Please introduce a WANT_LSEEK like symbol that ppc64 can select instead.
It also builds when llseek is marked as 32bit only in syscall.tbl
It seems it was handled specially in some way before syscall.tbl was
added, though (removed in ab66dcc76d6ab8fae9d69d149ae38c42605e7fc5)
Thanks
Michal
^ permalink raw reply
* [PATCH v3 0/4] Disable compat cruft on ppc64le v3
From: Michal Suchanek @ 2019-08-28 16:43 UTC (permalink / raw)
To: linuxppc-dev
Cc: David Hildenbrand, Heiko Carstens, David Howells, Paul Mackerras,
Breno Leitao, Michael Neuling, Nicolai Stange, Allison Randal,
Geert Uytterhoeven, Joel Stanley, Firoz Khan, Michal Suchanek,
Arnd Bergmann, Nicholas Piggin, Thomas Gleixner,
Christian Brauner, Greg Kroah-Hartman, linux-kernel,
Eric W. Biederman, Andrew Donnellan, Hari Bathini
Less code means less bugs so add a knob to skip the compat stuff.
This is tested on ppc64le top of
https://patchwork.ozlabs.org/cover/1153556/
Changes in v2: saner CONFIG_COMPAT ifdefs
Changes in v3:
- change llseek to 32bit instead of builing it unconditionally in fs
- clanup the makefile conditionals
- remove some ifdefs or convert to IS_DEFINED where possible
Michal Suchanek (4):
powerpc: make llseek 32bit-only.
powerpc: move common register copy functions from signal_32.c to
signal.c
powerpc/64: make buildable without CONFIG_COMPAT
powerpc/64: Make COMPAT user-selectable disable on littleendian by
default.
arch/powerpc/Kconfig | 5 +-
arch/powerpc/kernel/Makefile | 9 +-
arch/powerpc/kernel/entry_64.S | 2 +
arch/powerpc/kernel/signal.c | 143 ++++++++++++++++++++++-
arch/powerpc/kernel/signal_32.c | 140 ----------------------
arch/powerpc/kernel/syscall_64.c | 2 +-
arch/powerpc/kernel/syscalls/syscall.tbl | 2 +-
arch/powerpc/kernel/vdso.c | 5 +-
arch/powerpc/perf/callchain.c | 13 ++-
9 files changed, 165 insertions(+), 156 deletions(-)
--
2.22.0
^ permalink raw reply
* [PATCH v3 1/4] powerpc: make llseek 32bit-only.
From: Michal Suchanek @ 2019-08-28 16:43 UTC (permalink / raw)
To: linuxppc-dev
Cc: David Hildenbrand, Heiko Carstens, David Howells, Paul Mackerras,
Breno Leitao, Michael Neuling, Nicolai Stange, Allison Randal,
Geert Uytterhoeven, Joel Stanley, Firoz Khan, Michal Suchanek,
Arnd Bergmann, Nicholas Piggin, Thomas Gleixner,
Christian Brauner, Greg Kroah-Hartman, linux-kernel,
Eric W. Biederman, Andrew Donnellan, Hari Bathini
In-Reply-To: <cover.1567007242.git.msuchanek@suse.de>
Fixes: aff850393200 ("powerpc: add system call table generation support")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
arch/powerpc/kernel/syscalls/syscall.tbl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index 010b9f445586..53e427606f6c 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -188,7 +188,7 @@
137 common afs_syscall sys_ni_syscall
138 common setfsuid sys_setfsuid
139 common setfsgid sys_setfsgid
-140 common _llseek sys_llseek
+140 32 _llseek sys_llseek
141 common getdents sys_getdents compat_sys_getdents
142 common _newselect sys_select compat_sys_select
143 common flock sys_flock
--
2.22.0
^ permalink raw reply related
* [PATCH v3 2/4] powerpc: move common register copy functions from signal_32.c to signal.c
From: Michal Suchanek @ 2019-08-28 16:43 UTC (permalink / raw)
To: linuxppc-dev
Cc: David Hildenbrand, Heiko Carstens, David Howells, Paul Mackerras,
Breno Leitao, Michael Neuling, Nicolai Stange, Allison Randal,
Geert Uytterhoeven, Joel Stanley, Firoz Khan, Michal Suchanek,
Arnd Bergmann, Nicholas Piggin, Thomas Gleixner,
Christian Brauner, Greg Kroah-Hartman, linux-kernel,
Eric W. Biederman, Andrew Donnellan, Hari Bathini
In-Reply-To: <cover.1567007242.git.msuchanek@suse.de>
These functions are required for 64bit as well.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
arch/powerpc/kernel/signal.c | 141 ++++++++++++++++++++++++++++++++
arch/powerpc/kernel/signal_32.c | 140 -------------------------------
2 files changed, 141 insertions(+), 140 deletions(-)
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index e6c30cee6abf..60436432399f 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -18,12 +18,153 @@
#include <linux/syscalls.h>
#include <asm/hw_breakpoint.h>
#include <linux/uaccess.h>
+#include <asm/switch_to.h>
#include <asm/unistd.h>
#include <asm/debug.h>
#include <asm/tm.h>
#include "signal.h"
+#ifdef CONFIG_VSX
+unsigned long copy_fpr_to_user(void __user *to,
+ struct task_struct *task)
+{
+ u64 buf[ELF_NFPREG];
+ int i;
+
+ /* save FPR copy to local buffer then write to the thread_struct */
+ for (i = 0; i < (ELF_NFPREG - 1) ; i++)
+ buf[i] = task->thread.TS_FPR(i);
+ buf[i] = task->thread.fp_state.fpscr;
+ return __copy_to_user(to, buf, ELF_NFPREG * sizeof(double));
+}
+
+unsigned long copy_fpr_from_user(struct task_struct *task,
+ void __user *from)
+{
+ u64 buf[ELF_NFPREG];
+ int i;
+
+ if (__copy_from_user(buf, from, ELF_NFPREG * sizeof(double)))
+ return 1;
+ for (i = 0; i < (ELF_NFPREG - 1) ; i++)
+ task->thread.TS_FPR(i) = buf[i];
+ task->thread.fp_state.fpscr = buf[i];
+
+ return 0;
+}
+
+unsigned long copy_vsx_to_user(void __user *to,
+ struct task_struct *task)
+{
+ u64 buf[ELF_NVSRHALFREG];
+ int i;
+
+ /* save FPR copy to local buffer then write to the thread_struct */
+ for (i = 0; i < ELF_NVSRHALFREG; i++)
+ buf[i] = task->thread.fp_state.fpr[i][TS_VSRLOWOFFSET];
+ return __copy_to_user(to, buf, ELF_NVSRHALFREG * sizeof(double));
+}
+
+unsigned long copy_vsx_from_user(struct task_struct *task,
+ void __user *from)
+{
+ u64 buf[ELF_NVSRHALFREG];
+ int i;
+
+ if (__copy_from_user(buf, from, ELF_NVSRHALFREG * sizeof(double)))
+ return 1;
+ for (i = 0; i < ELF_NVSRHALFREG ; i++)
+ task->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = buf[i];
+ return 0;
+}
+
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+unsigned long copy_ckfpr_to_user(void __user *to,
+ struct task_struct *task)
+{
+ u64 buf[ELF_NFPREG];
+ int i;
+
+ /* save FPR copy to local buffer then write to the thread_struct */
+ for (i = 0; i < (ELF_NFPREG - 1) ; i++)
+ buf[i] = task->thread.TS_CKFPR(i);
+ buf[i] = task->thread.ckfp_state.fpscr;
+ return __copy_to_user(to, buf, ELF_NFPREG * sizeof(double));
+}
+
+unsigned long copy_ckfpr_from_user(struct task_struct *task,
+ void __user *from)
+{
+ u64 buf[ELF_NFPREG];
+ int i;
+
+ if (__copy_from_user(buf, from, ELF_NFPREG * sizeof(double)))
+ return 1;
+ for (i = 0; i < (ELF_NFPREG - 1) ; i++)
+ task->thread.TS_CKFPR(i) = buf[i];
+ task->thread.ckfp_state.fpscr = buf[i];
+
+ return 0;
+}
+
+unsigned long copy_ckvsx_to_user(void __user *to,
+ struct task_struct *task)
+{
+ u64 buf[ELF_NVSRHALFREG];
+ int i;
+
+ /* save FPR copy to local buffer then write to the thread_struct */
+ for (i = 0; i < ELF_NVSRHALFREG; i++)
+ buf[i] = task->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET];
+ return __copy_to_user(to, buf, ELF_NVSRHALFREG * sizeof(double));
+}
+
+unsigned long copy_ckvsx_from_user(struct task_struct *task,
+ void __user *from)
+{
+ u64 buf[ELF_NVSRHALFREG];
+ int i;
+
+ if (__copy_from_user(buf, from, ELF_NVSRHALFREG * sizeof(double)))
+ return 1;
+ for (i = 0; i < ELF_NVSRHALFREG ; i++)
+ task->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET] = buf[i];
+ return 0;
+}
+#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
+#else
+inline unsigned long copy_fpr_to_user(void __user *to,
+ struct task_struct *task)
+{
+ return __copy_to_user(to, task->thread.fp_state.fpr,
+ ELF_NFPREG * sizeof(double));
+}
+
+inline unsigned long copy_fpr_from_user(struct task_struct *task,
+ void __user *from)
+{
+ return __copy_from_user(task->thread.fp_state.fpr, from,
+ ELF_NFPREG * sizeof(double));
+}
+
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+inline unsigned long copy_ckfpr_to_user(void __user *to,
+ struct task_struct *task)
+{
+ return __copy_to_user(to, task->thread.ckfp_state.fpr,
+ ELF_NFPREG * sizeof(double));
+}
+
+inline unsigned long copy_ckfpr_from_user(struct task_struct *task,
+ void __user *from)
+{
+ return __copy_from_user(task->thread.ckfp_state.fpr, from,
+ ELF_NFPREG * sizeof(double));
+}
+#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
+#endif
+
/* Log an error when sending an unhandled signal to a process. Controlled
* through debug.exception-trace sysctl.
*/
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 98600b276f76..c93c937ea568 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -235,146 +235,6 @@ struct rt_sigframe {
int abigap[56];
};
-#ifdef CONFIG_VSX
-unsigned long copy_fpr_to_user(void __user *to,
- struct task_struct *task)
-{
- u64 buf[ELF_NFPREG];
- int i;
-
- /* save FPR copy to local buffer then write to the thread_struct */
- for (i = 0; i < (ELF_NFPREG - 1) ; i++)
- buf[i] = task->thread.TS_FPR(i);
- buf[i] = task->thread.fp_state.fpscr;
- return __copy_to_user(to, buf, ELF_NFPREG * sizeof(double));
-}
-
-unsigned long copy_fpr_from_user(struct task_struct *task,
- void __user *from)
-{
- u64 buf[ELF_NFPREG];
- int i;
-
- if (__copy_from_user(buf, from, ELF_NFPREG * sizeof(double)))
- return 1;
- for (i = 0; i < (ELF_NFPREG - 1) ; i++)
- task->thread.TS_FPR(i) = buf[i];
- task->thread.fp_state.fpscr = buf[i];
-
- return 0;
-}
-
-unsigned long copy_vsx_to_user(void __user *to,
- struct task_struct *task)
-{
- u64 buf[ELF_NVSRHALFREG];
- int i;
-
- /* save FPR copy to local buffer then write to the thread_struct */
- for (i = 0; i < ELF_NVSRHALFREG; i++)
- buf[i] = task->thread.fp_state.fpr[i][TS_VSRLOWOFFSET];
- return __copy_to_user(to, buf, ELF_NVSRHALFREG * sizeof(double));
-}
-
-unsigned long copy_vsx_from_user(struct task_struct *task,
- void __user *from)
-{
- u64 buf[ELF_NVSRHALFREG];
- int i;
-
- if (__copy_from_user(buf, from, ELF_NVSRHALFREG * sizeof(double)))
- return 1;
- for (i = 0; i < ELF_NVSRHALFREG ; i++)
- task->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = buf[i];
- return 0;
-}
-
-#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
-unsigned long copy_ckfpr_to_user(void __user *to,
- struct task_struct *task)
-{
- u64 buf[ELF_NFPREG];
- int i;
-
- /* save FPR copy to local buffer then write to the thread_struct */
- for (i = 0; i < (ELF_NFPREG - 1) ; i++)
- buf[i] = task->thread.TS_CKFPR(i);
- buf[i] = task->thread.ckfp_state.fpscr;
- return __copy_to_user(to, buf, ELF_NFPREG * sizeof(double));
-}
-
-unsigned long copy_ckfpr_from_user(struct task_struct *task,
- void __user *from)
-{
- u64 buf[ELF_NFPREG];
- int i;
-
- if (__copy_from_user(buf, from, ELF_NFPREG * sizeof(double)))
- return 1;
- for (i = 0; i < (ELF_NFPREG - 1) ; i++)
- task->thread.TS_CKFPR(i) = buf[i];
- task->thread.ckfp_state.fpscr = buf[i];
-
- return 0;
-}
-
-unsigned long copy_ckvsx_to_user(void __user *to,
- struct task_struct *task)
-{
- u64 buf[ELF_NVSRHALFREG];
- int i;
-
- /* save FPR copy to local buffer then write to the thread_struct */
- for (i = 0; i < ELF_NVSRHALFREG; i++)
- buf[i] = task->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET];
- return __copy_to_user(to, buf, ELF_NVSRHALFREG * sizeof(double));
-}
-
-unsigned long copy_ckvsx_from_user(struct task_struct *task,
- void __user *from)
-{
- u64 buf[ELF_NVSRHALFREG];
- int i;
-
- if (__copy_from_user(buf, from, ELF_NVSRHALFREG * sizeof(double)))
- return 1;
- for (i = 0; i < ELF_NVSRHALFREG ; i++)
- task->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET] = buf[i];
- return 0;
-}
-#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
-#else
-inline unsigned long copy_fpr_to_user(void __user *to,
- struct task_struct *task)
-{
- return __copy_to_user(to, task->thread.fp_state.fpr,
- ELF_NFPREG * sizeof(double));
-}
-
-inline unsigned long copy_fpr_from_user(struct task_struct *task,
- void __user *from)
-{
- return __copy_from_user(task->thread.fp_state.fpr, from,
- ELF_NFPREG * sizeof(double));
-}
-
-#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
-inline unsigned long copy_ckfpr_to_user(void __user *to,
- struct task_struct *task)
-{
- return __copy_to_user(to, task->thread.ckfp_state.fpr,
- ELF_NFPREG * sizeof(double));
-}
-
-inline unsigned long copy_ckfpr_from_user(struct task_struct *task,
- void __user *from)
-{
- return __copy_from_user(task->thread.ckfp_state.fpr, from,
- ELF_NFPREG * sizeof(double));
-}
-#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
-#endif
-
/*
* Save the current user registers on the user stack.
* We only save the altivec/spe registers if the process has used
--
2.22.0
^ permalink raw reply related
* [PATCH v3 3/4] powerpc/64: make buildable without CONFIG_COMPAT
From: Michal Suchanek @ 2019-08-28 16:43 UTC (permalink / raw)
To: linuxppc-dev
Cc: David Hildenbrand, Heiko Carstens, David Howells, Paul Mackerras,
Breno Leitao, Michael Neuling, Nicolai Stange, Allison Randal,
Geert Uytterhoeven, Joel Stanley, Firoz Khan, Michal Suchanek,
Arnd Bergmann, Nicholas Piggin, Thomas Gleixner,
Christian Brauner, Greg Kroah-Hartman, linux-kernel,
Eric W. Biederman, Andrew Donnellan, Hari Bathini
In-Reply-To: <cover.1567007242.git.msuchanek@suse.de>
There are numerous references to 32bit functions in generic and 64bit
code so ifdef them out.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v2:
- fix 32bit ifdef condition in signal.c
- simplify the compat ifdef condition in vdso.c - 64bit is redundant
- simplify the compat ifdef condition in callchain.c - 64bit is redundant
v3:
- use IS_ENABLED and maybe_unused where possible
- do not ifdef declarations
- clean up Makefile
---
arch/powerpc/kernel/Makefile | 9 +++++----
arch/powerpc/kernel/entry_64.S | 2 ++
arch/powerpc/kernel/signal.c | 2 +-
arch/powerpc/kernel/syscall_64.c | 2 +-
arch/powerpc/kernel/vdso.c | 5 ++---
arch/powerpc/perf/callchain.c | 13 +++++++++----
6 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 1d646a94d96c..de1fbb21daf5 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -44,16 +44,17 @@ CFLAGS_btext.o += -DDISABLE_BRANCH_PROFILING
endif
obj-y := cputable.o ptrace.o syscalls.o \
- irq.o align.o signal_32.o pmc.o vdso.o \
+ irq.o align.o signal_$(BITS).o pmc.o vdso.o \
process.o systbl.o idle.o \
signal.o sysfs.o cacheinfo.o time.o \
prom.o traps.o setup-common.o \
udbg.o misc.o io.o misc_$(BITS).o \
of_platform.o prom_parse.o
-obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
- signal_64.o ptrace32.o \
- paca.o nvram_64.o firmware.o \
+obj-$(CONFIG_PPC64) += setup_64.o paca.o nvram_64.o firmware.o \
syscall_64.o
+ifdef CONFIG_COMPAT
+obj-y += sys_ppc32.o ptrace32.o signal_32.o
+endif
obj-$(CONFIG_VDSO32) += vdso32/
obj-$(CONFIG_PPC_WATCHDOG) += watchdog.o
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 2ec825a85f5b..a2dbf216f607 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -51,8 +51,10 @@
SYS_CALL_TABLE:
.tc sys_call_table[TC],sys_call_table
+#ifdef CONFIG_COMPAT
COMPAT_SYS_CALL_TABLE:
.tc compat_sys_call_table[TC],compat_sys_call_table
+#endif
/* This value is used to mark exception frames on the stack. */
exception_marker:
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index 60436432399f..73d0f53ffc1a 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -277,7 +277,7 @@ static void do_signal(struct task_struct *tsk)
rseq_signal_deliver(&ksig, tsk->thread.regs);
- if (is32) {
+ if ((IS_ENABLED(CONFIG_PPC32) || IS_ENABLED(CONFIG_COMPAT)) && is32) {
if (ksig.ka.sa.sa_flags & SA_SIGINFO)
ret = handle_rt_signal32(&ksig, oldset, tsk);
else
diff --git a/arch/powerpc/kernel/syscall_64.c b/arch/powerpc/kernel/syscall_64.c
index 98ed970796d5..bdd9dcf156f8 100644
--- a/arch/powerpc/kernel/syscall_64.c
+++ b/arch/powerpc/kernel/syscall_64.c
@@ -100,7 +100,7 @@ long system_call_exception(long r3, long r4, long r5, long r6, long r7, long r8,
/* May be faster to do array_index_nospec? */
barrier_nospec();
- if (unlikely(ti_flags & _TIF_32BIT)) {
+ if (IS_ENABLED(CONFIG_COMPAT) && unlikely(ti_flags & _TIF_32BIT)) {
f = (void *)compat_sys_call_table[r0];
r3 &= 0x00000000ffffffffULL;
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index d60598113a9f..6d4a077f74d6 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -667,9 +667,7 @@ static void __init vdso_setup_syscall_map(void)
{
unsigned int i;
extern unsigned long *sys_call_table;
-#ifdef CONFIG_PPC64
extern unsigned long *compat_sys_call_table;
-#endif
extern unsigned long sys_ni_syscall;
@@ -678,7 +676,8 @@ static void __init vdso_setup_syscall_map(void)
if (sys_call_table[i] != sys_ni_syscall)
vdso_data->syscall_map_64[i >> 5] |=
0x80000000UL >> (i & 0x1f);
- if (compat_sys_call_table[i] != sys_ni_syscall)
+ if (IS_ENABLED(CONFIG_COMPAT) &&
+ compat_sys_call_table[i] != sys_ni_syscall)
vdso_data->syscall_map_32[i >> 5] |=
0x80000000UL >> (i & 0x1f);
#else /* CONFIG_PPC64 */
diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
index c84bbd4298a0..d4e6bf22e0cc 100644
--- a/arch/powerpc/perf/callchain.c
+++ b/arch/powerpc/perf/callchain.c
@@ -15,7 +15,7 @@
#include <asm/sigcontext.h>
#include <asm/ucontext.h>
#include <asm/vdso.h>
-#ifdef CONFIG_PPC64
+#ifdef CONFIG_COMPAT
#include "../kernel/ppc32.h"
#endif
#include <asm/pte-walk.h>
@@ -165,6 +165,7 @@ static int read_user_stack_64(unsigned long __user *ptr, unsigned long *ret)
return read_user_stack_slow(ptr, ret, 8);
}
+__maybe_unused
static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
{
if ((unsigned long)ptr > TASK_SIZE - sizeof(unsigned int) ||
@@ -341,6 +342,7 @@ static inline int valid_user_sp(unsigned long sp, int is_64)
#endif /* CONFIG_PPC64 */
+#if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT)
/*
* Layout for non-RT signal frames
*/
@@ -482,12 +484,15 @@ static void perf_callchain_user_32(struct perf_callchain_entry_ctx *entry,
sp = next_sp;
}
}
+#endif /* 32bit */
void
perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs)
{
- if (current_is_64bit())
- perf_callchain_user_64(entry, regs);
- else
+#if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT)
+ if (!current_is_64bit())
perf_callchain_user_32(entry, regs);
+ else
+#endif
+ perf_callchain_user_64(entry, regs);
}
--
2.22.0
^ permalink raw reply related
* [PATCH v3 4/4] powerpc/64: Make COMPAT user-selectable disabled on littleendian by default.
From: Michal Suchanek @ 2019-08-28 16:43 UTC (permalink / raw)
To: linuxppc-dev
Cc: David Hildenbrand, Heiko Carstens, David Howells, Paul Mackerras,
Breno Leitao, Michael Neuling, Nicolai Stange, Allison Randal,
Geert Uytterhoeven, Joel Stanley, Firoz Khan, Michal Suchanek,
Arnd Bergmann, Nicholas Piggin, Thomas Gleixner,
Christian Brauner, Greg Kroah-Hartman, linux-kernel,
Eric W. Biederman, Andrew Donnellan, Hari Bathini
In-Reply-To: <cover.1567007242.git.msuchanek@suse.de>
On bigendian ppc64 it is common to have 32bit legacy binaries but much
less so on littleendian.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v3: make configurable
---
arch/powerpc/Kconfig | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 5bab0bb6b833..b0339e892329 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -264,8 +264,9 @@ config PANIC_TIMEOUT
default 180
config COMPAT
- bool
- default y if PPC64
+ bool "Enable support for 32bit binaries"
+ depends on PPC64
+ default y if !CPU_LITTLE_ENDIAN
select COMPAT_BINFMT_ELF
select ARCH_WANT_OLD_COMPAT_IPC
select COMPAT_OLD_SIGACTION
--
2.22.0
^ permalink raw reply related
* Re: [PATCH v6 06/12] powerpc/fsl_booke/32: implement KASLR infrastructure
From: Scott Wood @ 2019-08-28 16:44 UTC (permalink / raw)
To: Jason Yan
Cc: wangkefeng.wang, keescook, kernel-hardening, linux-kernel,
npiggin, jingxiangfeng, diana.craciun, paulus, zhaohongjiang,
thunder.leizhen, fanchengyang, linuxppc-dev, yebin10
In-Reply-To: <de603506-5c4e-4ca3-bd77-e3a69af9faef@huawei.com>
On Wed, 2019-08-28 at 19:03 +0800, Jason Yan wrote:
>
> On 2019/8/28 12:54, Scott Wood wrote:
> > On Fri, Aug 09, 2019 at 06:07:54PM +0800, Jason Yan wrote:
> > > +/*
> > > + * To see if we need to relocate the kernel to a random offset
> > > + * void *dt_ptr - address of the device tree
> > > + * phys_addr_t size - size of the first memory block
> > > + */
> > > +notrace void __init kaslr_early_init(void *dt_ptr, phys_addr_t size)
> > > +{
> > > + unsigned long tlb_virt;
> > > + phys_addr_t tlb_phys;
> > > + unsigned long offset;
> > > + unsigned long kernel_sz;
> > > +
> > > + kernel_sz = (unsigned long)_end - KERNELBASE;
> >
> > Why KERNELBASE and not kernstart_addr?
> >
>
> Did you mean kernstart_virt_addr? It should be kernstart_virt_addr.
Yes, kernstart_virt_addr. KERNELBASE will be incorrect if the kernel was
loaded at a nonzero physical address without CONFIG_PHYSICAL_START being
adjusted to match.
-Scott
^ permalink raw reply
* Re: [PATCH rebased] powerpc/fadump: when fadump is supported register the fadump sysfs files.
From: Michal Suchánek @ 2019-08-28 17:07 UTC (permalink / raw)
To: Hari Bathini
Cc: Yangtao Li, Mahesh Salgaonkar, linux-kernel, Paul Mackerras,
Hari Bathini, Thomas Gleixner, linuxppc-dev
In-Reply-To: <e7fad352-48f3-f01d-1b19-a589a3b95c07@linux.ibm.com>
On Tue, 27 Aug 2019 17:57:31 +0530
Hari Bathini <hbathini@linux.ibm.com> wrote:
> Hi Michal,
>
> Thanks for the patch.
>
> On 20/08/19 11:42 PM, Michal Suchanek wrote:
> > Currently it is not possible to distinguish the case when fadump is
> > supported by firmware and disabled in kernel and completely unsupported
> > using the kernel sysfs interface. User can investigate the devicetree
> > but it is more reasonable to provide sysfs files in case we get some
> > fadumpv2 in the future.
> >
> > With this patch sysfs files are available whenever fadump is supported
> > by firmware.
> >
> > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > ---
> > Rebase on top of http://patchwork.ozlabs.org/patch/1150160/
> > [v5,31/31] powernv/fadump: support holes in kernel boot memory area
> > ---
> > arch/powerpc/kernel/fadump.c | 33 ++++++++++++++++++---------------
> > 1 file changed, 18 insertions(+), 15 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> > index 4b1bb3c55cf9..7ad424729e9c 100644
> > --- a/arch/powerpc/kernel/fadump.c
> > +++ b/arch/powerpc/kernel/fadump.c
> > @@ -1319,13 +1319,9 @@ static void fadump_init_files(void)
> > */
> > int __init setup_fadump(void)
> > {
> > - if (!fw_dump.fadump_enabled)
> > - return 0;
> > -
> > - if (!fw_dump.fadump_supported) {
> > + if (!fw_dump.fadump_supported && fw_dump.fadump_enabled) {
> > printk(KERN_ERR "Firmware-assisted dump is not supported on"
> > " this hardware\n");
> > - return 0;
> > }
> >
> > fadump_show_config();
> > @@ -1333,19 +1329,26 @@ int __init setup_fadump(void)
> > * If dump data is available then see if it is valid and prepare for
> > * saving it to the disk.
> > */
> > - if (fw_dump.dump_active) {
> > + if (fw_dump.fadump_enabled) {
> > + if (fw_dump.dump_active) {
> > + /*
> > + * if dump process fails then invalidate the
> > + * registration and release memory before proceeding
> > + * for re-registration.
> > + */
> > + if (fw_dump.ops->fadump_process(&fw_dump) < 0)
> > + fadump_invalidate_release_mem();
> > + }
> > /*
> > - * if dump process fails then invalidate the registration
> > - * and release memory before proceeding for re-registration.
> > + * Initialize the kernel dump memory structure for FAD
> > + * registration.
> > */
> > - if (fw_dump.ops->fadump_process(&fw_dump) < 0)
> > - fadump_invalidate_release_mem();
> > - }
> > - /* Initialize the kernel dump memory structure for FAD registration. */
> > - else if (fw_dump.reserve_dump_area_size)
> > - fw_dump.ops->fadump_init_mem_struct(&fw_dump);
> > + else if (fw_dump.reserve_dump_area_size)
> > + fw_dump.ops->fadump_init_mem_struct(&fw_dump);
> >
> > - fadump_init_files();
> > + }
> > + if (fw_dump.fadump_supported)
> > + fadump_init_files();
> >
> > return 1;
> > }
> >
>
>
> Could you please move up fadump_init_files() call and return after it instead of
> nesting rest of the function.
That sounds reasonable.
> Also, get rid of the error message when fadump is
> not supported as it is already taken care of in fadump_reserve_mem() function.
That should not be called in that case, should it?
Anyway, I find the message right next to the message about reserving
memory for kdump. So it really looks helpful in the log.
> I mean:
>
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index 2015b1f..0e9b028 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -1322,16 +1322,16 @@ static void fadump_init_files(void)
> */
> int __init setup_fadump(void)
> {
> - if (!fw_dump.fadump_enabled)
> + if (!fw_dump.fadump_supported)
> return 0;
>
> - if (!fw_dump.fadump_supported) {
> - printk(KERN_ERR "Firmware-assisted dump is not supported on"
> - " this hardware\n");
> - return 0;
> - }
> + fadump_init_files();
>
> fadump_show_config();
> +
> + if (!fw_dump.fadump_enabled)
> + return 0;
Should the init function return 0 when it did something that needs to
be undone later (ie registering the sysfs files)? This is probably not
very meaningful for fadump but what is the correct way to not set a bad
example?
Thanks
Michal
^ permalink raw reply
* [PATCH v2] powerpc/fadump: when fadump is supported register the fadump sysfs files.
From: Michal Suchanek @ 2019-08-28 17:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Yangtao Li, Mahesh Salgaonkar, linux-kernel, Paul Mackerras,
Hari Bathini, Thomas Gleixner, Michal Suchanek
In-Reply-To: <e7fad352-48f3-f01d-1b19-a589a3b95c07@linux.ibm.com>
Currently it is not possible to distinguish the case when fadump is
supported by firmware and disabled in kernel and completely unsupported
using the kernel sysfs interface. User can investigate the devicetree
but it is more reasonable to provide sysfs files in case we get some
fadumpv2 in the future.
With this patch sysfs files are available whenever fadump is supported
by firmware.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v2: move the sysfs initialization earlier to avoid condition nesting
---
arch/powerpc/kernel/fadump.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 4eab97292cc2..13741380b2f7 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1671,16 +1671,20 @@ static void fadump_init_files(void)
*/
int __init setup_fadump(void)
{
- if (!fw_dump.fadump_enabled)
- return 0;
-
- if (!fw_dump.fadump_supported) {
+ if (!fw_dump.fadump_supported && fw_dump.fadump_enabled) {
printk(KERN_ERR "Firmware-assisted dump is not supported on"
" this hardware\n");
- return 0;
}
+ if (!fw_dump.fadump_supported)
+ return 0;
+
+ fadump_init_files();
fadump_show_config();
+
+ if (!fw_dump.fadump_enabled)
+ return 1;
+
/*
* If dump data is available then see if it is valid and prepare for
* saving it to the disk.
@@ -1696,7 +1700,6 @@ int __init setup_fadump(void)
/* Initialize the kernel dump memory structure for FAD registration. */
else if (fw_dump.reserve_dump_area_size)
init_fadump_mem_struct(&fdm, fw_dump.reserve_dump_area_start);
- fadump_init_files();
return 1;
}
--
2.22.0
^ permalink raw reply related
* Re: [linux-next][BUG][driver/scsi/lpfc][c00f62e6] Kernel panics when booting next kernel on my Power 9 box
From: Abdul Haleem @ 2019-08-28 17:42 UTC (permalink / raw)
To: James Smart
Cc: sachinp, Stephen Rothwell, dick.kennedy, Martin K. Petersen,
linux-scsi, manvanth, linux-kernel, linux-next, dougmill,
Brian King, linuxppc-dev
In-Reply-To: <601365f6-c753-96f6-5d61-481f54d95440@gmail.com>
On Wed, 2019-08-28 at 08:22 -0700, James Smart wrote:
> On 8/27/2019 10:02 PM, Abdul Haleem wrote:
> > Greetings,
> >
> > linux-next kernel 5.3.0-rc1 failed to boot with kernel Oops on Power 9
> > box
> >
> > I see a recent changes to lpfc code was from commit
> > 10541f03 scsi: lpfc: Update lpfc version to 12.4.0.0
> >
> > Recent boot logs:
> >
> > [..snip..]
>
> see https://www.spinics.net/lists/linux-scsi/msg133343.html
>
> It hasn't been tested yet, but appears to be the issue.
Ah, commit c00f62e6 (scsi: lpfc: Merge per-protocol...) is the bad one
and Yes the patch fixes it, System booted fine with below code change
--- a/drivers/scsi/lpfc/lpfc_sli.c 2019-08-23 13:55:18.253546775 -0700
+++ b/drivers/scsi/lpfc_sli.c 2019-08-27 17:04:51.095330056 -0700
@@ -5553,7 +5553,7 @@ lpfc_sli4_arm_cqeq_intr(struct lpfc_hba
for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) {
qp = &sli4_hba->hdwq[qidx];
/* ARM the corresponding CQ */
- sli4_hba->sli4_write_cq_db(phba, qp[qidx].io_cq, 0,
+ sli4_hba->sli4_write_cq_db(phba, qp->io_cq, 0,
LPFC_QUEUE_REARM);
Tested-by: Abdul Haleem <abdhalee@linux.vnet.ibm.com>
--
Regard's
Abdul Haleem
IBM Linux Technology Centre
^ permalink raw reply
* Re: [PATCH] powerpc: Avoid clang warnings around setjmp and longjmp
From: Nathan Chancellor @ 2019-08-28 17:53 UTC (permalink / raw)
To: Michael Ellerman
Cc: Nick Desaulniers, linux-kernel, stable, clang-built-linux,
Paul Mackerras, linuxppc-dev
In-Reply-To: <878srdv206.fsf@mpe.ellerman.id.au>
On Wed, Aug 28, 2019 at 11:43:53PM +1000, Michael Ellerman wrote:
> Nathan Chancellor <natechancellor@gmail.com> writes:
>
> > Commit aea447141c7e ("powerpc: Disable -Wbuiltin-requires-header when
> > setjmp is used") disabled -Wbuiltin-requires-header because of a warning
> > about the setjmp and longjmp declarations.
> >
> > r367387 in clang added another diagnostic around this, complaining that
> > there is no jmp_buf declaration.
> >
> > In file included from ../arch/powerpc/xmon/xmon.c:47:
> > ../arch/powerpc/include/asm/setjmp.h:10:13: error: declaration of
> > built-in function 'setjmp' requires the declaration of the 'jmp_buf'
> > type, commonly provided in the header <setjmp.h>.
> > [-Werror,-Wincomplete-setjmp-declaration]
> > extern long setjmp(long *);
> > ^
> > ../arch/powerpc/include/asm/setjmp.h:11:13: error: declaration of
> > built-in function 'longjmp' requires the declaration of the 'jmp_buf'
> > type, commonly provided in the header <setjmp.h>.
> > [-Werror,-Wincomplete-setjmp-declaration]
> > extern void longjmp(long *, long);
> > ^
> > 2 errors generated.
> >
> > Take the same approach as the above commit by disabling the warning for
> > the same reason, we provide our own longjmp/setjmp function.
> >
> > Cc: stable@vger.kernel.org # 4.19+
> > Link: https://github.com/ClangBuiltLinux/linux/issues/625
> > Link: https://github.com/llvm/llvm-project/commit/3be25e79477db2d31ac46493d97eca8c20592b07
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >
> > It may be worth using -fno-builtin-setjmp and -fno-builtin-longjmp
> > instead as it makes it clear to clang that we are not using the builtin
> > longjmp and setjmp functions, which I think is why these warnings are
> > appearing (at least according to the commit that introduced this waring).
> >
> > Sample patch:
> > https://github.com/ClangBuiltLinux/linux/issues/625#issuecomment-519251372
>
> Couldn't we just add those flags to CFLAGS for the whole kernel? Rather
> than making them per-file.
Yes, I don't think this would be unreasonable. Are you referring to the
cc-disable-warning flags or the -fno-builtin flags? I personally think
the -fno-builtin flags convey to clang what the kernel is intending to
do better than disabling the warnings outright.
> I mean there's no kernel code that wants to use clang's builtin
> setjmp/longjmp implementation at all right?
>
> cheers
I did a quick search of the tree and it looks like powerpc and x86/um
are the only architectures that do anything with setjmp/longjmp. x86/um
avoids this by using a define flag to change setjmp to kernel_setjmp:
arch/um/Makefile: -Dlongjmp=kernel_longjmp -Dsetjmp=kernel_setjmp \
Seems like adding those flags should be safe.
Cheers,
Nathan
^ permalink raw reply
* Re: [PATCH] powerpc: Avoid clang warnings around setjmp and longjmp
From: Nick Desaulniers @ 2019-08-28 18:01 UTC (permalink / raw)
To: Nathan Chancellor
Cc: LKML, # 3.4.x, clang-built-linux, Paul Mackerras, linuxppc-dev
In-Reply-To: <20190828175322.GA121833@archlinux-threadripper>
On Wed, Aug 28, 2019 at 10:53 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Wed, Aug 28, 2019 at 11:43:53PM +1000, Michael Ellerman wrote:
> > Nathan Chancellor <natechancellor@gmail.com> writes:
> >
> > > Commit aea447141c7e ("powerpc: Disable -Wbuiltin-requires-header when
> > > setjmp is used") disabled -Wbuiltin-requires-header because of a warning
> > > about the setjmp and longjmp declarations.
> > >
> > > r367387 in clang added another diagnostic around this, complaining that
> > > there is no jmp_buf declaration.
> > >
> > > In file included from ../arch/powerpc/xmon/xmon.c:47:
> > > ../arch/powerpc/include/asm/setjmp.h:10:13: error: declaration of
> > > built-in function 'setjmp' requires the declaration of the 'jmp_buf'
> > > type, commonly provided in the header <setjmp.h>.
> > > [-Werror,-Wincomplete-setjmp-declaration]
> > > extern long setjmp(long *);
> > > ^
> > > ../arch/powerpc/include/asm/setjmp.h:11:13: error: declaration of
> > > built-in function 'longjmp' requires the declaration of the 'jmp_buf'
> > > type, commonly provided in the header <setjmp.h>.
> > > [-Werror,-Wincomplete-setjmp-declaration]
> > > extern void longjmp(long *, long);
> > > ^
> > > 2 errors generated.
> > >
> > > Take the same approach as the above commit by disabling the warning for
> > > the same reason, we provide our own longjmp/setjmp function.
> > >
> > > Cc: stable@vger.kernel.org # 4.19+
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/625
> > > Link: https://github.com/llvm/llvm-project/commit/3be25e79477db2d31ac46493d97eca8c20592b07
> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > ---
> > >
> > > It may be worth using -fno-builtin-setjmp and -fno-builtin-longjmp
> > > instead as it makes it clear to clang that we are not using the builtin
> > > longjmp and setjmp functions, which I think is why these warnings are
> > > appearing (at least according to the commit that introduced this waring).
> > >
> > > Sample patch:
> > > https://github.com/ClangBuiltLinux/linux/issues/625#issuecomment-519251372
> >
> > Couldn't we just add those flags to CFLAGS for the whole kernel? Rather
> > than making them per-file.
>
> Yes, I don't think this would be unreasonable. Are you referring to the
> cc-disable-warning flags or the -fno-builtin flags? I personally think
> the -fno-builtin flags convey to clang what the kernel is intending to
> do better than disabling the warnings outright.
The `-f` family of flags have dire implications for codegen, I'd
really prefer we think long and hard before adding/removing them to
suppress warnings. I don't think it's a solution for this particular
problem.
>
> > I mean there's no kernel code that wants to use clang's builtin
> > setjmp/longjmp implementation at all right?
> >
> > cheers
>
> I did a quick search of the tree and it looks like powerpc and x86/um
> are the only architectures that do anything with setjmp/longjmp. x86/um
> avoids this by using a define flag to change setjmp to kernel_setjmp:
>
> arch/um/Makefile: -Dlongjmp=kernel_longjmp -Dsetjmp=kernel_setjmp \
>
> Seems like adding those flags should be safe.
>
> Cheers,
> Nathan
--
Thanks,
~Nick Desaulniers
^ permalink raw reply
* Re: [PATCH 1/4] fs: always build llseek.
From: Eric W. Biederman @ 2019-08-28 18:16 UTC (permalink / raw)
To: Michal Suchanek
Cc: David Hildenbrand, Dmitry V. Levin, Max Filippov, Paul Mackerras,
Breno Leitao, Michael Neuling, Firoz Khan, Hari Bathini,
Joel Stanley, Nicholas Piggin, Steven Rostedt, Thomas Gleixner,
Allison Randal, Greg Kroah-Hartman, linux-kernel,
Andrew Donnellan, linux-fsdevel, Andrew Morton, linuxppc-dev,
Alexander Viro
In-Reply-To: <8736hlyx8r.fsf@x220.int.ebiederm.org>
ebiederm@xmission.com (Eric W. Biederman) writes:
> Michal Suchanek <msuchanek@suse.de> writes:
>
>> 64bit !COMPAT does not build because the llseek syscall is in the
>> tables.
>
> Do I read this right you have a 128 bit offset to llseek on ppc64?
>
> Looking at the signature it does not appear to make sense to build this
> function on any 64bit platform.
>
> Perhaps the proper fix to to take llseek out of your syscall tables?
Sorry I missed seeing the 2 newer version of the patchset in my inbox
it seems you have already made the change I am suggesting.
Never mind.
Eric
^ permalink raw reply
* Re: [PATCH] powerpc: Avoid clang warnings around setjmp and longjmp
From: Nathan Chancellor @ 2019-08-28 18:45 UTC (permalink / raw)
To: Nick Desaulniers
Cc: LKML, # 3.4.x, clang-built-linux, Paul Mackerras, linuxppc-dev
In-Reply-To: <CAKwvOdmXbYrR6n-cxKt3XxkE4Lmj0sSoZBUtHVb0V2LTUFHmug@mail.gmail.com>
On Wed, Aug 28, 2019 at 11:01:14AM -0700, Nick Desaulniers wrote:
> On Wed, Aug 28, 2019 at 10:53 AM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > On Wed, Aug 28, 2019 at 11:43:53PM +1000, Michael Ellerman wrote:
> > > Nathan Chancellor <natechancellor@gmail.com> writes:
> > >
> > > > Commit aea447141c7e ("powerpc: Disable -Wbuiltin-requires-header when
> > > > setjmp is used") disabled -Wbuiltin-requires-header because of a warning
> > > > about the setjmp and longjmp declarations.
> > > >
> > > > r367387 in clang added another diagnostic around this, complaining that
> > > > there is no jmp_buf declaration.
> > > >
> > > > In file included from ../arch/powerpc/xmon/xmon.c:47:
> > > > ../arch/powerpc/include/asm/setjmp.h:10:13: error: declaration of
> > > > built-in function 'setjmp' requires the declaration of the 'jmp_buf'
> > > > type, commonly provided in the header <setjmp.h>.
> > > > [-Werror,-Wincomplete-setjmp-declaration]
> > > > extern long setjmp(long *);
> > > > ^
> > > > ../arch/powerpc/include/asm/setjmp.h:11:13: error: declaration of
> > > > built-in function 'longjmp' requires the declaration of the 'jmp_buf'
> > > > type, commonly provided in the header <setjmp.h>.
> > > > [-Werror,-Wincomplete-setjmp-declaration]
> > > > extern void longjmp(long *, long);
> > > > ^
> > > > 2 errors generated.
> > > >
> > > > Take the same approach as the above commit by disabling the warning for
> > > > the same reason, we provide our own longjmp/setjmp function.
> > > >
> > > > Cc: stable@vger.kernel.org # 4.19+
> > > > Link: https://github.com/ClangBuiltLinux/linux/issues/625
> > > > Link: https://github.com/llvm/llvm-project/commit/3be25e79477db2d31ac46493d97eca8c20592b07
> > > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > > ---
> > > >
> > > > It may be worth using -fno-builtin-setjmp and -fno-builtin-longjmp
> > > > instead as it makes it clear to clang that we are not using the builtin
> > > > longjmp and setjmp functions, which I think is why these warnings are
> > > > appearing (at least according to the commit that introduced this waring).
> > > >
> > > > Sample patch:
> > > > https://github.com/ClangBuiltLinux/linux/issues/625#issuecomment-519251372
> > >
> > > Couldn't we just add those flags to CFLAGS for the whole kernel? Rather
> > > than making them per-file.
> >
> > Yes, I don't think this would be unreasonable. Are you referring to the
> > cc-disable-warning flags or the -fno-builtin flags? I personally think
> > the -fno-builtin flags convey to clang what the kernel is intending to
> > do better than disabling the warnings outright.
>
> The `-f` family of flags have dire implications for codegen, I'd
> really prefer we think long and hard before adding/removing them to
> suppress warnings. I don't think it's a solution for this particular
> problem.
I am fine with whatever approach gets this warning fixed to the
maintainer's satisfaction...
However, I think that -fno-builtin-* would be appropriate here because
we are providing our own setjmp implementation, meaning clang should not
be trying to do anything with the builtin implementation like building a
declaration for it.
Cheers,
Nathan
^ permalink raw reply
* Re: [PATCH 1/4] fs: always build llseek.
From: Eric W. Biederman @ 2019-08-28 18:13 UTC (permalink / raw)
To: Michal Suchanek
Cc: David Hildenbrand, Dmitry V. Levin, Max Filippov, Paul Mackerras,
Breno Leitao, Michael Neuling, Firoz Khan, Hari Bathini,
Joel Stanley, Nicholas Piggin, Steven Rostedt, Thomas Gleixner,
Allison Randal, Greg Kroah-Hartman, linux-kernel,
Andrew Donnellan, linux-fsdevel, Andrew Morton, linuxppc-dev,
Alexander Viro
In-Reply-To: <80b1955b86fb81e4642881d498068b5a540ef029.1566936688.git.msuchanek@suse.de>
Michal Suchanek <msuchanek@suse.de> writes:
> 64bit !COMPAT does not build because the llseek syscall is in the
> tables.
Do I read this right you have a 128 bit offset to llseek on ppc64?
Looking at the signature it does not appear to make sense to build this
function on any 64bit platform.
Perhaps the proper fix to to take llseek out of your syscall tables?
Eric
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
> fs/read_write.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/read_write.c b/fs/read_write.c
> index 5bbf587f5bc1..9db56931eb26 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -331,7 +331,6 @@ COMPAT_SYSCALL_DEFINE3(lseek, unsigned int, fd, compat_off_t, offset, unsigned i
> }
> #endif
>
> -#if !defined(CONFIG_64BIT) || defined(CONFIG_COMPAT)
> SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
> unsigned long, offset_low, loff_t __user *, result,
> unsigned int, whence)
> @@ -360,7 +359,6 @@ SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
> fdput_pos(f);
> return retval;
> }
> -#endif
>
> int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_t count)
> {
^ permalink raw reply
* Re: [PATCH RESEND v11 7/8] open: openat2(2) syscall
From: Spencer Baugh @ 2019-08-28 20:17 UTC (permalink / raw)
To: Jeff Layton, linux-fsdevel
Cc: linux-arch, linux-ia64, linux-parisc, linux-sh, linux-api,
linux-kernel, linux-mips, linuxppc-dev, linux-alpha, sparclinux,
linux-arm-kernel
In-Reply-To: <4da231cd52880991d8a038adb8fbb2ef3d724db9.camel@kernel.org>
Jeff Layton <jlayton@kernel.org> writes:
> On Mon, 2019-08-26 at 19:50 +0000, sbaugh@catern.com wrote:
>> Aleksa Sarai <cyphar@cyphar.com> writes:
>> > To this end, we introduce the openat2(2) syscall. It provides all of the
>> > features of openat(2) through the @how->flags argument, but also
>> > also provides a new @how->resolve argument which exposes RESOLVE_* flags
>> > that map to our new LOOKUP_* flags. It also eliminates the long-standing
>> > ugliness of variadic-open(2) by embedding it in a struct.
>>
>> I don't like this usage of a structure in memory to pass arguments that
>> would fit in registers. This would be quite inconvenient for me as a
>> userspace developer.
>>
>> Others have brought up issues with this: the issue of seccomp, and the
>> issue of mismatch between the userspace interface and the kernel
>> interface, are the most important for me. I want to add another,
>> admittedly somewhat niche, concern.
>>
>> This interfaces requires a program to allocate memory (even on the
>> stack) just to pass arguments to the kernel which could be passed
>> without allocating that memory. That makes it more difficult and less
>> efficient to use this syscall in any case where memory is not so easily
>> allocatable: such as early program startup or assembly, where the stack
>> may be limited in size or not even available yet, or when injecting a
>> syscall while ptracing.
>>
>> A struct-passing interface was needed for clone, since we ran out of
>> registers; but we have not run out of registers yet for openat, so it
>> would be nice to avoid this if we can. We can always expand later...
>>
>
> We can't really expand later like you suggest.
>
> Suppose in a couple of years that we need to add some new argument to
> openat2 that isn't just a new flag. If all these values are passed by
> individual arguments, you can't add one later without adding yet another
> syscall.
Sure we can. This new syscall doesn't need to use all 6 available
arguments. It can enforce that the unused ones are 0. Then if we
eventually run out of flags and need to switch to pass arguments via
struct, we can just use one of the unused arguments for that purpose.
Even if we used all 6 arguments, in the worst-case scenario, the last
flag we add could change the interpretation of some other argument so it
can be used to pass a pointer to a struct.
^ permalink raw reply
* Re: [PATCH v4 1/2] powerpc/powernv/opal-msglog: Refactor memcons code
From: Claudio Carvalho @ 2019-08-28 22:13 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev
In-Reply-To: <20190828130521.26764-1-mpe@ellerman.id.au>
On 8/28/19 10:05 AM, Michael Ellerman wrote:
> From: Claudio Carvalho <cclaudio@linux.ibm.com>
>
> This patch refactors the code in opal-msglog that operates on the OPAL
> memory console in order to make it cleaner and also allow the reuse of
> the new memcons_* functions.
Tested-by: Claudio Carvalho <cclaudio@linux.ibm.com>
Thanks,
Claudio
> Signed-off-by: Claudio Carvalho <cclaudio@linux.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
> v4: mpe: Rename memcons_load_from_dt() to memcons_init().
> Make memcons_init() and memcons_get_size() non-static.
> Continue to use opal_msglog_copy() in opal_msglog_read().
> ---
> arch/powerpc/platforms/powernv/opal-msglog.c | 57 +++++++++++++-------
> 1 file changed, 39 insertions(+), 18 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/opal-msglog.c b/arch/powerpc/platforms/powernv/opal-msglog.c
> index dc51d03c6370..d26da19a611f 100644
> --- a/arch/powerpc/platforms/powernv/opal-msglog.c
> +++ b/arch/powerpc/platforms/powernv/opal-msglog.c
> @@ -29,23 +29,23 @@ struct memcons {
>
> static struct memcons *opal_memcons = NULL;
>
> -ssize_t opal_msglog_copy(char *to, loff_t pos, size_t count)
> +ssize_t memcons_copy(struct memcons *mc, char *to, loff_t pos, size_t count)
> {
> const char *conbuf;
> ssize_t ret;
> size_t first_read = 0;
> uint32_t out_pos, avail;
>
> - if (!opal_memcons)
> + if (!mc)
> return -ENODEV;
>
> - out_pos = be32_to_cpu(READ_ONCE(opal_memcons->out_pos));
> + out_pos = be32_to_cpu(READ_ONCE(mc->out_pos));
>
> /* Now we've read out_pos, put a barrier in before reading the new
> * data it points to in conbuf. */
> smp_rmb();
>
> - conbuf = phys_to_virt(be64_to_cpu(opal_memcons->obuf_phys));
> + conbuf = phys_to_virt(be64_to_cpu(mc->obuf_phys));
>
> /* When the buffer has wrapped, read from the out_pos marker to the end
> * of the buffer, and then read the remaining data as in the un-wrapped
> @@ -53,7 +53,7 @@ ssize_t opal_msglog_copy(char *to, loff_t pos, size_t count)
> if (out_pos & MEMCONS_OUT_POS_WRAP) {
>
> out_pos &= MEMCONS_OUT_POS_MASK;
> - avail = be32_to_cpu(opal_memcons->obuf_size) - out_pos;
> + avail = be32_to_cpu(mc->obuf_size) - out_pos;
>
> ret = memory_read_from_buffer(to, count, &pos,
> conbuf + out_pos, avail);
> @@ -71,7 +71,7 @@ ssize_t opal_msglog_copy(char *to, loff_t pos, size_t count)
> }
>
> /* Sanity check. The firmware should not do this to us. */
> - if (out_pos > be32_to_cpu(opal_memcons->obuf_size)) {
> + if (out_pos > be32_to_cpu(mc->obuf_size)) {
> pr_err("OPAL: memory console corruption. Aborting read.\n");
> return -EINVAL;
> }
> @@ -86,6 +86,11 @@ ssize_t opal_msglog_copy(char *to, loff_t pos, size_t count)
> return ret;
> }
>
> +ssize_t opal_msglog_copy(char *to, loff_t pos, size_t count)
> +{
> + return memcons_copy(opal_memcons, to, pos, count);
> +}
> +
> static ssize_t opal_msglog_read(struct file *file, struct kobject *kobj,
> struct bin_attribute *bin_attr, char *to,
> loff_t pos, size_t count)
> @@ -98,32 +103,48 @@ static struct bin_attribute opal_msglog_attr = {
> .read = opal_msglog_read
> };
>
> -void __init opal_msglog_init(void)
> +struct memcons *memcons_init(struct device_node *node, const char *mc_prop_name)
> {
> u64 mcaddr;
> struct memcons *mc;
>
> - if (of_property_read_u64(opal_node, "ibm,opal-memcons", &mcaddr)) {
> - pr_warn("OPAL: Property ibm,opal-memcons not found, no message log\n");
> - return;
> + if (of_property_read_u64(node, mc_prop_name, &mcaddr)) {
> + pr_warn("%s property not found, no message log\n",
> + mc_prop_name);
> + goto out_err;
> }
>
> mc = phys_to_virt(mcaddr);
> if (!mc) {
> - pr_warn("OPAL: memory console address is invalid\n");
> - return;
> + pr_warn("memory console address is invalid\n");
> + goto out_err;
> }
>
> if (be64_to_cpu(mc->magic) != MEMCONS_MAGIC) {
> - pr_warn("OPAL: memory console version is invalid\n");
> - return;
> + pr_warn("memory console version is invalid\n");
> + goto out_err;
> }
>
> - /* Report maximum size */
> - opal_msglog_attr.size = be32_to_cpu(mc->ibuf_size) +
> - be32_to_cpu(mc->obuf_size);
> + return mc;
> +
> +out_err:
> + return NULL;
> +}
> +
> +u32 memcons_get_size(struct memcons *mc)
> +{
> + return be32_to_cpu(mc->ibuf_size) + be32_to_cpu(mc->obuf_size);
> +}
> +
> +void __init opal_msglog_init(void)
> +{
> + opal_memcons = memcons_init(opal_node, "ibm,opal-memcons");
> + if (!opal_memcons) {
> + pr_warn("OPAL: memcons failed to load from ibm,opal-memcons\n");
> + return;
> + }
>
> - opal_memcons = mc;
> + opal_msglog_attr.size = memcons_get_size(opal_memcons);
> }
>
> void __init opal_msglog_sysfs_init(void)
^ permalink raw reply
* Re: [PATCH v4 2/2] powerpc/powernv: Add ultravisor message log interface
From: Claudio Carvalho @ 2019-08-28 22:14 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev
In-Reply-To: <20190828130521.26764-2-mpe@ellerman.id.au>
On 8/28/19 10:05 AM, Michael Ellerman wrote:
> From: Claudio Carvalho <cclaudio@linux.ibm.com>
>
> The ultravisor (UV) provides an in-memory console which follows the
> OPAL in-memory console structure.
>
> This patch extends the OPAL msglog code to initialize the UV memory
> console and provide the "/sys/firmware/ultravisor/msglog" interface
> for userspace to view the UV message log.
Tested-by: Claudio Carvalho <cclaudio@linux.ibm.com>
Thanks,
Claudio
>
> Signed-off-by: Claudio Carvalho <cclaudio@linux.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
> v4: mpe: Move all the code into ultravisor.c.
> Consistently use "uv_" as the prefix not "ultra_".
> Use powernv.h for routines that are shared within the platform.
> Rather than bloating the kernel with strings for every rare error
> case, return error codes from the init routine which can be
> seen with initcall_debug.
> ---
> arch/powerpc/platforms/powernv/powernv.h | 5 +++
> arch/powerpc/platforms/powernv/ultravisor.c | 45 +++++++++++++++++++++
> 2 files changed, 50 insertions(+)
>
> diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h
> index fd4a1c5a6369..1aa51c4fa904 100644
> --- a/arch/powerpc/platforms/powernv/powernv.h
> +++ b/arch/powerpc/platforms/powernv/powernv.h
> @@ -30,4 +30,9 @@ extern void opal_event_shutdown(void);
>
> bool cpu_core_split_required(void);
>
> +struct memcons;
> +ssize_t memcons_copy(struct memcons *mc, char *to, loff_t pos, size_t count);
> +u32 memcons_get_size(struct memcons *mc);
> +struct memcons *memcons_init(struct device_node *node, const char *mc_prop_name);
> +
> #endif /* _POWERNV_H */
> diff --git a/arch/powerpc/platforms/powernv/ultravisor.c b/arch/powerpc/platforms/powernv/ultravisor.c
> index 02ac57b4bded..e4a00ad06f9d 100644
> --- a/arch/powerpc/platforms/powernv/ultravisor.c
> +++ b/arch/powerpc/platforms/powernv/ultravisor.c
> @@ -8,9 +8,15 @@
> #include <linux/init.h>
> #include <linux/printk.h>
> #include <linux/of_fdt.h>
> +#include <linux/of.h>
>
> #include <asm/ultravisor.h>
> #include <asm/firmware.h>
> +#include <asm/machdep.h>
> +
> +#include "powernv.h"
> +
> +static struct kobject *ultravisor_kobj;
>
> int __init early_init_dt_scan_ultravisor(unsigned long node, const char *uname,
> int depth, void *data)
> @@ -22,3 +28,42 @@ int __init early_init_dt_scan_ultravisor(unsigned long node, const char *uname,
> pr_debug("Ultravisor detected!\n");
> return 1;
> }
> +
> +static struct memcons *uv_memcons;
> +
> +static ssize_t uv_msglog_read(struct file *file, struct kobject *kobj,
> + struct bin_attribute *bin_attr, char *to,
> + loff_t pos, size_t count)
> +{
> + return memcons_copy(uv_memcons, to, pos, count);
> +}
> +
> +static struct bin_attribute uv_msglog_attr = {
> + .attr = {.name = "msglog", .mode = 0400},
> + .read = uv_msglog_read
> +};
> +
> +static int __init uv_init(void)
> +{
> + struct device_node *node;
> +
> + if (!firmware_has_feature(FW_FEATURE_ULTRAVISOR))
> + return 0;
> +
> + node = of_find_compatible_node(NULL, NULL, "ibm,uv-firmware");
> + if (!node)
> + return -ENODEV;
> +
> + uv_memcons = memcons_init(node, "memcons");
> + if (!uv_memcons)
> + return -ENOENT;
> +
> + uv_msglog_attr.size = memcons_get_size(uv_memcons);
> +
> + ultravisor_kobj = kobject_create_and_add("ultravisor", firmware_kobj);
> + if (!ultravisor_kobj)
> + return -ENOMEM;
> +
> + return sysfs_create_bin_file(ultravisor_kobj, &uv_msglog_attr);
> +}
> +machine_subsys_initcall(powernv, uv_init);
^ permalink raw reply
* Re: [PATCH] powerpc: Avoid clang warnings around setjmp and longjmp
From: Nick Desaulniers @ 2019-08-28 22:16 UTC (permalink / raw)
To: Nathan Chancellor
Cc: LKML, # 3.4.x, clang-built-linux, Paul Mackerras, linuxppc-dev
In-Reply-To: <20190828184529.GC127646@archlinux-threadripper>
On Wed, Aug 28, 2019 at 11:45 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Wed, Aug 28, 2019 at 11:01:14AM -0700, Nick Desaulniers wrote:
> > On Wed, Aug 28, 2019 at 10:53 AM Nathan Chancellor
> > <natechancellor@gmail.com> wrote:
> > >
> > > Yes, I don't think this would be unreasonable. Are you referring to the
> > > cc-disable-warning flags or the -fno-builtin flags? I personally think
> > > the -fno-builtin flags convey to clang what the kernel is intending to
> > > do better than disabling the warnings outright.
> >
> > The `-f` family of flags have dire implications for codegen, I'd
> > really prefer we think long and hard before adding/removing them to
> > suppress warnings. I don't think it's a solution for this particular
> > problem.
>
> I am fine with whatever approach gets this warning fixed to the
> maintainer's satisfaction...
>
> However, I think that -fno-builtin-* would be appropriate here because
> we are providing our own setjmp implementation, meaning clang should not
> be trying to do anything with the builtin implementation like building a
> declaration for it.
That's a good reason IMO. IIRC, the -fno-builtin-* flags don't warn
if * is some unrecognized value, so -fno-builtin-setjmp may not
actually do anything, and you may need to scan the source (of clang or
llvm).
--
Thanks,
~Nick Desaulniers
^ permalink raw reply
* Re: [PATCH v2 4/4] powerpc/64: system call implement the bulk of the logic in C
From: Nicholas Piggin @ 2019-08-28 22:19 UTC (permalink / raw)
To: Michal Suchánek; +Cc: linuxppc-dev
In-Reply-To: <20190828173049.3a34df30@naga>
Michal Suchánek's on August 29, 2019 1:30 am:
> On Tue, 27 Aug 2019 23:55:48 +1000
> Nicholas Piggin <npiggin@gmail.com> wrote:
>
>> System call entry and particularly exit code is beyond the limit of what
>> is reasonable to implement in asm.
>>
>> This conversion moves all conditional branches out of the asm code,
>> except for the case that all GPRs should be restored at exit.
>>
>> Null syscall test is about 5% faster after this patch, because the exit
>> work is handled under local_irq_disable, and the hard mask and pending
>> interrupt replay is handled after that, which avoids games with MSR.
>>
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> ---
>> Changes since v1:
>> - Improve changelog
>> - Lot of code cleanups, moving helpers out to proper header locations,
>> etc (Christophe).
>> - Split unnecessary change that affected ppc32 out. I will submit it
>> independently (Christophe).
>>
>> arch/powerpc/include/asm/asm-prototypes.h | 11 -
>> .../powerpc/include/asm/book3s/64/kup-radix.h | 12 +-
>> arch/powerpc/include/asm/cputime.h | 22 ++
>> arch/powerpc/include/asm/ptrace.h | 3 +
>> arch/powerpc/include/asm/signal.h | 2 +
>> arch/powerpc/include/asm/switch_to.h | 5 +
>> arch/powerpc/include/asm/time.h | 3 +
>> arch/powerpc/kernel/Makefile | 3 +-
>> arch/powerpc/kernel/entry_64.S | 340 +++---------------
>> arch/powerpc/kernel/signal.h | 2 -
>> arch/powerpc/kernel/syscall_64.c | 177 +++++++++
>> 11 files changed, 273 insertions(+), 307 deletions(-)
>> create mode 100644 arch/powerpc/kernel/syscall_64.c
>>
>> diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h
>> index ec1c97a8e8cb..f00ef8924a99 100644
>> --- a/arch/powerpc/include/asm/asm-prototypes.h
>> +++ b/arch/powerpc/include/asm/asm-prototypes.h
>> @@ -92,14 +92,6 @@ long sys_switch_endian(void);
>> notrace unsigned int __check_irq_replay(void);
>> void notrace restore_interrupts(void);
>>
>> -/* ptrace */
>> -long do_syscall_trace_enter(struct pt_regs *regs);
>> -void do_syscall_trace_leave(struct pt_regs *regs);
>> -
>> -/* process */
>> -void restore_math(struct pt_regs *regs);
>> -void restore_tm_state(struct pt_regs *regs);
>> -
>> /* prom_init (OpenFirmware) */
>> unsigned long __init prom_init(unsigned long r3, unsigned long r4,
>> unsigned long pp,
>> @@ -110,9 +102,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
>> void __init early_setup(unsigned long dt_ptr);
>> void early_setup_secondary(void);
>>
>> -/* time */
>> -void accumulate_stolen_time(void);
>> -
>> /* misc runtime */
>> extern u64 __bswapdi2(u64);
>> extern s64 __lshrdi3(s64, int);
>> diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h b/arch/powerpc/include/asm/book3s/64/kup-radix.h
>> index f254de956d6a..ef2e65ea8a73 100644
>> --- a/arch/powerpc/include/asm/book3s/64/kup-radix.h
>> +++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h
>> @@ -3,6 +3,7 @@
>> #define _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H
>>
>> #include <linux/const.h>
>> +#include <asm/reg.h>
>>
>> #define AMR_KUAP_BLOCK_READ UL(0x4000000000000000)
>> #define AMR_KUAP_BLOCK_WRITE UL(0x8000000000000000)
>> @@ -56,7 +57,16 @@
>>
>> #ifdef CONFIG_PPC_KUAP
>>
>> -#include <asm/reg.h>
>> +#include <asm/mmu.h>
>> +#include <asm/ptrace.h>
>> +
>> +static inline void kuap_check_amr(void)
>> +{
>> +#ifdef CONFIG_PPC_KUAP_DEBUG
>> + if (mmu_has_feature(MMU_FTR_RADIX_KUAP))
>> + WARN_ON_ONCE(mfspr(SPRN_AMR) != AMR_KUAP_BLOCKED);
>> +#endif
>> +}
>>
>> /*
>> * We support individually allowing read or write, but we don't support nesting
>> diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h
>> index 2431b4ada2fa..f3aa9db1a3cc 100644
>> --- a/arch/powerpc/include/asm/cputime.h
>> +++ b/arch/powerpc/include/asm/cputime.h
>> @@ -60,6 +60,28 @@ static inline void arch_vtime_task_switch(struct task_struct *prev)
>> }
>> #endif
>>
>> +static inline void account_cpu_user_entry(void)
>> +{
>> + unsigned long tb = mftb();
>> +
>> + get_accounting(current)->utime += (tb - get_accounting(current)->starttime_user);
>> + get_accounting(current)->starttime = tb;
>> +}
>> +static inline void account_cpu_user_exit(void)
>> +{
>> + unsigned long tb = mftb();
>> +
>> + get_accounting(current)->stime += (tb - get_accounting(current)->starttime);
>> + get_accounting(current)->starttime_user = tb;
>> +}
>> +
>> #endif /* __KERNEL__ */
>> +#else /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
>> +static inline void account_cpu_user_entry(void)
>> +{
>> +}
>> +static inline void account_cpu_user_exit(void)
>> +{
>> +}
>> #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
>> #endif /* __POWERPC_CPUTIME_H */
>> diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
>> index feee1b21bbd5..af363086403a 100644
>> --- a/arch/powerpc/include/asm/ptrace.h
>> +++ b/arch/powerpc/include/asm/ptrace.h
>> @@ -138,6 +138,9 @@ extern unsigned long profile_pc(struct pt_regs *regs);
>> #define profile_pc(regs) instruction_pointer(regs)
>> #endif
>>
>> +long do_syscall_trace_enter(struct pt_regs *regs);
>> +void do_syscall_trace_leave(struct pt_regs *regs);
>> +
>> #define kernel_stack_pointer(regs) ((regs)->gpr[1])
>> static inline int is_syscall_success(struct pt_regs *regs)
>> {
>> diff --git a/arch/powerpc/include/asm/signal.h b/arch/powerpc/include/asm/signal.h
>> index 0803ca8b9149..0113be8dcb59 100644
>> --- a/arch/powerpc/include/asm/signal.h
>> +++ b/arch/powerpc/include/asm/signal.h
>> @@ -6,4 +6,6 @@
>> #include <uapi/asm/signal.h>
>> #include <uapi/asm/ptrace.h>
>>
>> +void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags);
>> +
> /srv/kernel/arch/powerpc/include/asm/signal.h:9:30: warning: ‘struct pt_regs’ declared inside parameter list will not be visible outside of this definition or declaration
> void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags);
Thanks I didn't see that.
> uapi/asm/ptrace.h defines user_pt_regs and asm/ptrace.h pt_regs.
>
> I am not really sure which you wanted.
pt_regs. That is the struct that gets saved on the kernel stack by
interrupts. user_pt_regs is part of the ptrace user ABI.
Thanks,
Nick
^ permalink raw reply
* Re: [PATCH net] ibmvnic: Do not process reset during or after device removal
From: David Miller @ 2019-08-28 22:46 UTC (permalink / raw)
To: tlfalcon; +Cc: netdev, linuxppc-dev
In-Reply-To: <1566922204-8770-1-git-send-email-tlfalcon@linux.ibm.com>
From: Thomas Falcon <tlfalcon@linux.ibm.com>
Date: Tue, 27 Aug 2019 11:10:04 -0500
> Currently, the ibmvnic driver will not schedule device resets
> if the device is being removed, but does not check the device
> state before the reset is actually processed. This leads to a race
> where a reset is scheduled with a valid device state but is
> processed after the driver has been removed, resulting in an oops.
>
> Fix this by checking the device state before processing a queued
> reset event.
>
> Reported-by: Abdul Haleem <abdhalee@linux.vnet.ibm.com>
> Tested-by: Abdul Haleem <abdhalee@linux.vnet.ibm.com>
> Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>
Applied.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox