Re: [PATCH v3 2/7] uaccess: Tell user_access_begin() if it's for a write or not

2020-01-24 Thread Tony Luck
On Thu, Jan 23, 2020 at 10:03 AM Linus Torvalds wrote: > We used to have a read/write argument to the old "verify_area()" and > "access_ok()" model, and it was a mistake. It was due to odd i386 user > access issues. We got rid of it. I'm not convinced this is any better > - it looks very similar a

Re: [PATCH v4 1/6] libnvdimm/namespace: Make namespace size validation arch dependent

2020-01-24 Thread Dan Williams
On Fri, Jan 24, 2020 at 9:07 AM Aneesh Kumar K.V wrote: > > On 1/24/20 10:15 PM, Dan Williams wrote: > > On Thu, Jan 23, 2020 at 11:34 PM Aneesh Kumar K.V > > wrote: > >> > >> On 1/24/20 11:27 AM, Dan Williams wrote: > >>> On Mon, Jan 20, 2020 at 6:08 AM Aneesh Kumar K.V > >>> > >> > >> > >>

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.5-6 tag

2020-01-24 Thread pr-tracker-bot
The pull request you sent on Fri, 24 Jan 2020 23:13:30 +1100: > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git > tags/powerpc-5.5-6 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/3c45d7510cf563be2ebc04f6864b70bc69f68cb9 Thank you! -- Deet-doot-do

Re: [PATCH v4 1/6] libnvdimm/namespace: Make namespace size validation arch dependent

2020-01-24 Thread Aneesh Kumar K.V
On 1/24/20 10:15 PM, Dan Williams wrote: On Thu, Jan 23, 2020 at 11:34 PM Aneesh Kumar K.V wrote: On 1/24/20 11:27 AM, Dan Williams wrote: On Mon, Jan 20, 2020 at 6:08 AM Aneesh Kumar K.V +unsigned long arch_namespace_map_size(void) +{ + return PAGE_SIZE; +} +EXPORT_SYMBOL_GP

[PATCH v2] powerpc/32: Warn and return ENOSYS on syscalls from kernel

2020-01-24 Thread Christophe Leroy
Since commit b86fb88855ea ("powerpc/32: implement fast entry for syscalls on non BOOKE") and commit 1a4b739bbb4f ("powerpc/32: implement fast entry for syscalls on BOOKE"), syscalls from kernel are unexpected and can have catastrophic consequences as it will destroy the kernel stack. Test MSR_PR o

[PATCH] powerpc/32: Add missing context synchronisation with CONFIG_VMAP_STACK

2020-01-24 Thread Christophe Leroy
After reactivation of data translation by modifying MSR[DR], a isync is required to ensure the translation is effective. Signed-off-by: Christophe Leroy --- Rebased on powerpc/merge-test @mpe: If not too late: - change to head_32.h should be squashed into "powerpc/32: prepare for CONFIG_VMAP_ST

Re: vmlinux ELF header sometimes corrupt

2020-01-24 Thread Andreas Schwab
On Jan 22 2020, Rasmus Villemoes wrote: > So the inode number and mtime/ctime are exactly the same, but for some > reason Blocks: has changed? This is on an ext4 filesystem, but I don't > suspect the filesystem to be broken, because it's always just vmlinux > that ends up corrupt, and always in ex

[GIT PULL] Please pull powerpc/linux.git powerpc-5.5-6 tag

2020-01-24 Thread Michael Ellerman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi Linus, Please pull some more powerpc fixes for 5.5: The following changes since commit 6da3eced8c5f3b03340b0c395bacd552c4d52411: powerpc/spinlocks: Include correct header for static key (2019-12-30 21:20:41 +1100) are available in the git r

[PATCH v4 7/7] powerpc: Implement user_access_save() and user_access_restore()

2020-01-24 Thread Christophe Leroy
Implement user_access_save() and user_access_restore() On 8xx and radix: - On save, get the value of the associated special register then prevent user access. - On restore, set back the saved value to the associated special register. On book3s/32: - On save, get the value stored in current->threa

[PATCH v4 6/7] powerpc: Implement user_access_begin and friends

2020-01-24 Thread Christophe Leroy
Today, when a function like strncpy_from_user() is called, the userspace access protection is de-activated and re-activated for every word read. By implementing user_access_begin and friends, the protection is de-activated at the beginning of the copy and re-activated at the end. Implement user_a

[PATCH v4 5/7] powerpc/32s: prepare prevent_user_access() for user_access_end()

2020-01-24 Thread Christophe Leroy
In preparation of implementing user_access_begin and friends on powerpc, the book3s/32 version of prevent_user_access() need to be prepared for user_access_end(). user_access_end() doesn't provide the address and size which were passed to user_access_begin(), required by prevent_user_access() to k

[PATCH v4 4/7] powerpc/32s: Drop NULL addr verification

2020-01-24 Thread Christophe Leroy
NULL addr is a user address. Don't waste time checking it. If someone tries to access it, it will SIGFAULT the same way as for address 1, so no need to make it special. The special case is when not doing a write, in that case we want to drop the entire function. This is now handled by 'dir' param

[PATCH v4 3/7] powerpc/kuap: Fix set direction in allow/prevent_user_access()

2020-01-24 Thread Christophe Leroy
__builtin_constant_p() always return 0 for pointers, so on RADIX we always end up opening both direction (by writing 0 in SPR29): 0170 <._copy_to_user>: ... 1b0: 4c 00 01 2c isync 1b4: 39 20 00 00 li r9,0 1b8: 7d 3d 03 a6 mtspr 29,r9 1bc: 4c 00 01 2c

[PATCH v4 2/7] powerpc/32s: Fix bad_kuap_fault()

2020-01-24 Thread Christophe Leroy
At the moment, bad_kuap_fault() reports a fault only if a bad access to userspace occurred while access to userspace was not granted. But if a fault occurs for a write outside the allowed userspace segment(s) that have been unlocked, bad_kuap_fault() fails to detect it and the kernel loops forever

[PATCH v4 1/7] readdir: make user_access_begin() use the real access range

2020-01-24 Thread Christophe Leroy
From: Linus Torvalds In commit 9f79b78ef744 ("Convert filldir[64]() from __put_user() to unsafe_put_user()") I changed filldir to not do individual __put_user() accesses, but instead use unsafe_put_user() surrounded by the proper user_access_begin/end() pair. That make them enormously faster on

Re: [FSL P5020 P5040 PPC] Onboard SD card doesn't work anymore after the 'mmc-v5.4-2' updates

2020-01-24 Thread Michael Ellerman
Ulf Hansson writes: > On Thu, 16 Jan 2020 at 12:18, Christian Zigotzky > wrote: >> >> Hi All, >> >> We still need the attached patch for our onboard SD card interface >> [1,2]. Could you please add this patch to the tree? > > No, because according to previous discussion that isn't the correct >

Re: [PATCH v2 6/6] powerpc: Implement user_access_begin and friends

2020-01-24 Thread Christophe Leroy
Le 23/01/2020 à 13:31, Michael Ellerman a écrit : Michael Ellerman writes: Christophe Leroy writes: Today, when a function like strncpy_from_user() is called, the userspace access protection is de-activated and re-activated for every word read. By implementing user_access_begin and friend

[PATCH 4.19 447/639] perf/ioctl: Add check for the sample_period value

2020-01-24 Thread Greg Kroah-Hartman
From: Ravi Bangoria [ Upstream commit 913a90bc5a3a06b1f04c337320e9aeee2328dd77 ] perf_event_open() limits the sample_period to 63 bits. See: 0819b2e30ccb ("perf: Limit perf_event_attr::sample_period to 63 bits") Make ioctl() consistent with it. Also on PowerPC, negative sample_period could

Re: vmlinux ELF header sometimes corrupt

2020-01-24 Thread Rasmus Villemoes
On 24/01/2020 11.50, Michael Ellerman wrote: > Rasmus Villemoes writes: >> I'm building for a ppc32 (mpc8309) target using Yocto, and I'm hitting a >> very hard to debug problem that maybe someone else has encountered. This >> doesn't happen always, perhaps 1 in 8 times or something like that. >>

Re: vmlinux ELF header sometimes corrupt

2020-01-24 Thread Michael Ellerman
Rasmus Villemoes writes: > I'm building for a ppc32 (mpc8309) target using Yocto, and I'm hitting a > very hard to debug problem that maybe someone else has encountered. This > doesn't happen always, perhaps 1 in 8 times or something like that. > > The issue is that when the build gets to do "${CR

Re: [PATCH v2 1/6] fs/readdir: Fix filldir() and filldir64() use of user_access_begin()

2020-01-24 Thread Michael Ellerman
Linus Torvalds writes: > On Thu, Jan 23, 2020 at 4:00 AM Michael Ellerman wrote: >> >> So I guess I'll wait and see what happens with patch 1. > > I've committed my fixes to filldir[64]() directly - they really were > fixing me being lazy about the range, and the name length checking > really is

[PATCH 4.14 243/343] perf/ioctl: Add check for the sample_period value

2020-01-24 Thread Greg Kroah-Hartman
From: Ravi Bangoria [ Upstream commit 913a90bc5a3a06b1f04c337320e9aeee2328dd77 ] perf_event_open() limits the sample_period to 63 bits. See: 0819b2e30ccb ("perf: Limit perf_event_attr::sample_period to 63 bits") Make ioctl() consistent with it. Also on PowerPC, negative sample_period could

Re: [PATCH 1/2] powerpc/irq: don't use current_stack_pointer() in check_stack_overflow()

2020-01-24 Thread Segher Boessenkool
On Fri, Jan 24, 2020 at 07:03:36AM +, Christophe Leroy wrote: > >Le 24/01/2020 à 06:46, Michael Ellerman a écrit : > >> > >>If I do this it seems to work, but feels a little dicey: > >> > >>asm ("" : "=r" (r1)); > >>sp = r1 & (THREAD_SIZE - 1); > > > > > >Or we could do add in asm/reg.h

Re: [PATCH 1/2] powerpc/irq: don't use current_stack_pointer() in check_stack_overflow()

2020-01-24 Thread Segher Boessenkool
Hi! On Fri, Jan 24, 2020 at 04:46:24PM +1100, Michael Ellerman wrote: > Christophe Leroy writes: > > static inline void check_stack_overflow(void) > > { > > #ifdef CONFIG_DEBUG_STACKOVERFLOW > > - long sp; > > - > > - sp = current_stack_pointer() & (THREAD_SIZE-1); > > + register unsigne