kisskb: OK linus/axs101_defconfig/arcompact Wed Jan 15, 18:07
OK linus/axs101_defconfig/arcompact Wed Jan 15, 18:07 http://kisskb.ellerman.id.au/kisskb/buildresult/14095390/ Commit: Merge branch 'dhowells' (patches from DavidH) e033e7d4a8081852b2cca53e530e2c0f4e6769c0 Compiler: arc-buildroot-linux-uclibc-gcc (Buildroot 2015.08.1) 4.8.4 / GNU ld (GNU Binutils) 2.23.2 No errors found in log Possible warnings (2) -- :1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] net/ipv4/tcp_input.c:4389:49: warning: array subscript is above array bounds [-Warray-bounds] ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
kisskb: OK linus/axs103_smp_defconfig/arcv2 Wed Jan 15, 18:06
OK linus/axs103_smp_defconfig/arcv2 Wed Jan 15, 18:06 http://kisskb.ellerman.id.au/kisskb/buildresult/14095389/ Commit: Merge branch 'dhowells' (patches from DavidH) e033e7d4a8081852b2cca53e530e2c0f4e6769c0 Compiler: arc-linux-gcc.br_real (Buildroot 2016.11-git-00613-ge98b4dd) 6.2.1 20160824 / GNU ld (GNU Binutils) 2.27.51.20160928 Possible errors --- #define KERN_ERR KERN_SOH "3" /* error conditions */ #define KERN_ERR KERN_SOH "3" /* error conditions */ #define KERN_ERR KERN_SOH "3" /* error conditions */ #define KERN_ERR KERN_SOH "3" /* error conditions */ Possible warnings (89) -- :1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] init/main.c:381:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat=] init/main.c:385:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat=] init/main.c:389:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat=] init/main.c:825:37: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type '__kernel_size_t {aka unsigned int}' [-Wformat=] kernel/dma/direct.c:32:4: warning: format '%zu' expects argument of type 'size_t', but argument 4 has type 'unsigned int' [-Wformat=] include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kern_levels.h:5:18: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'unsigned int' [-Wformat=] include/linux/kern_levels.h:5:18: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'unsigned int' [-Wformat=] drivers/base/component.c:196:24: warning: format '%zu' expects argument of type 'size_t', but argument 4 has type 'unsigned int' [-Wformat=] drivers/base/regmap/regmap.c:1526:22: warning: format '%zu' expects argument of type 'size_t', but argument 5 has type 'unsigned int' [-Wformat=] include/linux/kern_levels.h:5:18: warning: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka const unsigned int}' [-Wformat=] include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast include/linux/overflow.h:59:15: warning: comparison of distinct pointer types lacks a cast include/linux/overflow.h:60:15: warning: comparison of distinct pointer types lacks a cast drivers/base/regmap/regcache.c:715:20: warning: format '%zu' expects argument of type 'size_t', but argument 4 has type 'unsigned int' [-Wformat=] include/linux/kern_levels.h:5:18: warning: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=] include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast drivers/dma-buf/dma-buf.c:402:26: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat=] mm/percpu.c:1334:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat=] mm/percpu.c:1349:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat=] mm/percpu.c:1356:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat=] mm/percpu.c:1362:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat=] mm/percpu.c:1616:17: warning: format '%zu' expects argument of type
Re: [PATCH] PR 92846: [ARC] generate signaling FDCMPF for hard float comparisons
On 1/14/20 3:49 PM, Vineet Gupta wrote: > On 12/9/19 11:02 AM, Vineet Gupta wrote: >> ARC gcc generates FDCMP instructions which raises Invalid operation for >> signaling NaN only. This causes glibc iseqsig() primitives to fail (in >> the current ongoing glibc port to ARC) >> >> So split up the hard float compares into two categories and for unordered >> compares generate the FDCMPF instruction (vs. FDCMP) which raises exception >> for either NaNs. >> >> With this fix testsuite/gcc.dg/torture/pr52451.c passes for ARC. >> >> Also passes 6 additional tests in glibc testsuite (test*iseqsig) and no >> regressions > Can this be backported to gcc-9 please ? > glibc testing uses gcc-9 Never mind, I see that it is present in upstream/releases/gcc-9 ! Thx, -Vineet ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH] PR 92846: [ARC] generate signaling FDCMPF for hard float comparisons
On 12/9/19 11:02 AM, Vineet Gupta wrote: > ARC gcc generates FDCMP instructions which raises Invalid operation for > signaling NaN only. This causes glibc iseqsig() primitives to fail (in > the current ongoing glibc port to ARC) > > So split up the hard float compares into two categories and for unordered > compares generate the FDCMPF instruction (vs. FDCMP) which raises exception > for either NaNs. > > With this fix testsuite/gcc.dg/torture/pr52451.c passes for ARC. > > Also passes 6 additional tests in glibc testsuite (test*iseqsig) and no > regressions Can this be backported to gcc-9 please ? glibc testing uses gcc-9 Thx, -Vineet ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [RFC 2/4] lib/strncpy_from_user: Remove redundant user space pointer range check
On Tue, Jan 14, 2020 at 01:22:07PM -0800, Linus Torvalds wrote: > The fact is, copying a string from user space is *very* different from > copying a fixed number of bytes, and that whole dance with > > max_addr = user_addr_max(); > > is absolutely required and necessary. > > You completely broke string copying. BTW, a quick grep through the callers has found something odd - static ssize_t kmemleak_write(struct file *file, const char __user *user_buf, size_t size, loff_t *ppos) { char buf[64]; int buf_size; int ret; buf_size = min(size, (sizeof(buf) - 1)); if (strncpy_from_user(buf, user_buf, buf_size) < 0) return -EFAULT; buf[buf_size] = 0; What the hell? If somebody is calling write(fd, buf, n) they'd better be ready to see any byte from buf[0] up to buf[n - 1] fetched, and if something is unmapped - deal with -EFAULT. Is something really doing that and if so, why does kmemleak try to accomodate that idiocy? The same goes for several more ->write() instances - mtrr_write(), armada_debugfs_crtc_reg_write() and cio_ignore_write(); IMO that's seriously misguided (and cio one ought use vmemdup_user() instead of what it's doing)... ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [RFC 2/4] lib/strncpy_from_user: Remove redundant user space pointer range check
On 1/14/20 1:22 PM, Linus Torvalds wrote: > On Tue, Jan 14, 2020 at 12:09 PM Vineet Gupta > wrote: >> >> This came up when switching ARC to word-at-a-time interface and using >> generic/optimized strncpy_from_user >> >> It seems the existing code checks for user buffer/string range multiple >> times and one of tem cn be avoided. > > NO! > > DO NOT DO THIS. > > This is seriously buggy. > >> long strncpy_from_user(char *dst, const char __user *src, long count) >> { >> - unsigned long max_addr, src_addr; >> - >> if (unlikely(count <= 0)) >> return 0; >> >> - max_addr = user_addr_max(); >> - src_addr = (unsigned long)untagged_addr(src); >> - if (likely(src_addr < max_addr)) { >> - unsigned long max = max_addr - src_addr; >> + kasan_check_write(dst, count); >> + check_object_size(dst, count, false); >> + if (user_access_begin(src, count)) { > > You can't do that "user_access_begin(src, count)", because "count" is > the maximum _possible_ length, but it is *NOT* necessarily the actual > length of the string we really get from user space! > > Think of this situation: > > - user has a 5-byte string at the end of the address space > > - kernel does a > > n = strncpy_from_user(uaddr, page, PAGE_SIZE) > > now your "user_access_begin(src, count)" will _fail_, because "uaddr" > is close to the end of the user address space, and there's not room > for PAGE_SIZE bytes any more. Oops indeed that was the case I didn't comprehend. In my initial tests with debugger, every single hit on strncpy_from_user() had user addresses well into the address space such that @max was ridiculously large (0x_ - ptr) compared to @count. > But "count" isn't actually how many bytes we will access from user > space, it's only the maximum limit on the *target*. IOW, it's about a > kernel buffer size, not about the user access size. Right I understood all that, but missed the case when user buffer is towards end of address space and access_ok() will erroneously flag it. > Because we'll only access that 5-byte string, which fits just fine in > the user space, and doing that "user_access_begin(src, count)" gives > the wrong answer. > > The fact is, copying a string from user space is *very* different from > copying a fixed number of bytes, and that whole dance with > > max_addr = user_addr_max(); > > is absolutely required and necessary. > > You completely broke string copying. I'm sorry and I wasn't sure to begin with hence the disclaimer in 0/4 > It is very possible that string copying was horribly broken on ARC > before too - almost nobody ever gets this right, but the generic > routine does. No it is not. It is just dog slow since it does byte copy and uses the Zero delay loops which I'm trying to get rid of. That's when I recalled the word-at-a-time API which I'd meaning to go back to for last 7 years :-) -Vineet ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [RFC 4/4] ARC: uaccess: use optimized generic __strnlen_user/__strncpy_from_user
On Tue, Jan 14, 2020 at 1:37 PM Vineet Gupta wrote: > > On 1/14/20 12:42 PM, Arnd Bergmann wrote: > > > > What's wrong with the generic version on little-endian? Any > > chance you can find a way to make it work as well for you as > > this copy? > > find_zero() by default doesn't use pop count instructions. Don't you think the generic find_zero() is likely just as fast as the pop count instruction? On 32-bit, I think it's like a shift and a mask and a couple of additions. The 64-bit case has a multiply that is likely expensive unless you have a good multiplication unit (but what 64-bit architecture doesn't?), but the generic 32-bit LE code should already be pretty close to optimal, and it might not be worth it to worry about it. (The big-endian case is very different, and architectures really can do much better. But LE allows for bit tricks using the carry chain) Linus ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [RFC 4/4] ARC: uaccess: use optimized generic __strnlen_user/__strncpy_from_user
On 1/14/20 12:42 PM, Arnd Bergmann wrote: > On Tue, Jan 14, 2020 at 9:08 PM Vineet Gupta > wrote: > >> diff --git a/arch/arc/include/asm/word-at-a-time.h >> b/arch/arc/include/asm/word-at-a-time.h >> new file mode 100644 >> index ..00e92be70987 >> --- /dev/null >> +++ b/arch/arc/include/asm/word-at-a-time.h >> @@ -0,0 +1,49 @@ >> +/* SPDX-License-Identifier: GPL-2.0-only */ >> +/* >> + * Copyright (C) 2020 Synopsys Inc. >> + */ >> +#ifndef __ASM_ARC_WORD_AT_A_TIME_H >> +#define __ASM_ARC_WORD_AT_A_TIME_H >> + >> +#ifdef __LITTLE_ENDIAN__ >> + >> +#include >> + >> +struct word_at_a_time { >> + const unsigned long one_bits, high_bits; >> +}; > > What's wrong with the generic version on little-endian? Any > chance you can find a way to make it work as well for you as > this copy? find_zero() by default doesn't use pop count instructions. I didn't like the copy either but wasn't sure of the best way to make this 4 API interface reusable. Are you suggesting we allow partial over-ride starting with #ifndef find_zero ? >> +static inline unsigned long find_zero(unsigned long mask) >> +{ >> +#ifdef CONFIG_64BIT >> + return fls64(mask) >> 3; >> +#else >> + return fls(mask) >> 3; >> +#endif > > The CONFIG_64BIT check not be needed, unless you are adding > support for 64-bit ARC really soon. :-) Indeed that was the premise ! Thx for the quick review. -Vineet ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [RFC 1/4] asm-generic/uaccess: don't define inline functions if noinline lib/* in use
On Tue, Jan 14, 2020 at 12:09 PM Vineet Gupta wrote: > > There are 2 generic varaints of strncpy_from_user() / strnlen_user() > (1). inline version in asm-generic/uaccess.h I think we should get rid of this entirely. It's just a buggy garbage implementation that nobody should ever actually use. It does just about everything wrong that you *can* do, wrong, including doing the NUL-filling termination of standard strncpy() that "strncpy_from_user()" doesn't actually do. So: - the asm-generic/uaccess.h __strncpy_from_user() function is just horribly wrong - the generic/uaccess.h version of strncpy_from_user() shouldn't be an inline function either, since the only thing it can do inline is the bogus one-byte access check that _barely_ makes security work (you also need to have a guard page to _actually_ make it work, and I'm not atr all convinced that people do). the whole thing is just broken and should be removed from a header file. > (2). optimized word-at-a-time version in lib/* That is - outside of the original x86 strncpy_from_user() - the only copy of this function that historically gets all the corner cases right. And even those we've gotten wrong occasionally. I would suggest that anybody who uses asm-generic/uaccess.h needs to simply use the generic library version. Linus ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [RFC 2/4] lib/strncpy_from_user: Remove redundant user space pointer range check
On Tue, Jan 14, 2020 at 12:09 PM Vineet Gupta wrote: > > This came up when switching ARC to word-at-a-time interface and using > generic/optimized strncpy_from_user > > It seems the existing code checks for user buffer/string range multiple > times and one of tem cn be avoided. NO! DO NOT DO THIS. This is seriously buggy. > long strncpy_from_user(char *dst, const char __user *src, long count) > { > - unsigned long max_addr, src_addr; > - > if (unlikely(count <= 0)) > return 0; > > - max_addr = user_addr_max(); > - src_addr = (unsigned long)untagged_addr(src); > - if (likely(src_addr < max_addr)) { > - unsigned long max = max_addr - src_addr; > + kasan_check_write(dst, count); > + check_object_size(dst, count, false); > + if (user_access_begin(src, count)) { You can't do that "user_access_begin(src, count)", because "count" is the maximum _possible_ length, but it is *NOT* necessarily the actual length of the string we really get from user space! Think of this situation: - user has a 5-byte string at the end of the address space - kernel does a n = strncpy_from_user(uaddr, page, PAGE_SIZE) now your "user_access_begin(src, count)" will _fail_, because "uaddr" is close to the end of the user address space, and there's not room for PAGE_SIZE bytes any more. But "count" isn't actually how many bytes we will access from user space, it's only the maximum limit on the *target*. IOW, it's about a kernel buffer size, not about the user access size. Because we'll only access that 5-byte string, which fits just fine in the user space, and doing that "user_access_begin(src, count)" gives the wrong answer. The fact is, copying a string from user space is *very* different from copying a fixed number of bytes, and that whole dance with max_addr = user_addr_max(); is absolutely required and necessary. You completely broke string copying. It is very possible that string copying was horribly broken on ARC before too - almost nobody ever gets this right, but the generic routine does. So the generic routine is not only faster, it is *correct*, and your change broke it. Don't touch generic code. If you want to use the generic code, please do so. But DO NOT TOUCH IT. It is correct, your patch is wrong. The exact same issue is true in strnlen_user(). Don't break it. Linus ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [RFC 1/4] asm-generic/uaccess: don't define inline functions if noinline lib/* in use
On Tue, Jan 14, 2020 at 9:08 PM Vineet Gupta wrote: > > There are 2 generic varaints of strncpy_from_user() / strnlen_user() > (1). inline version in asm-generic/uaccess.h > (2). optimized word-at-a-time version in lib/* > > This patch disables #1 if #2 selected. This allows arches to continue > reusing asm-generic/uaccess.h for rest of code > > This came up when switching ARC to generic word-at-a-time interface > > Signed-off-by: Vineet Gupta This looks like a useful change, but I think we can do even better: It seems that there are no callers of __strnlen_user or __strncpy_from_user in the kernel today, so these should not be defined either when the Kconfig symbols are set. Also, I would suggest moving the 'extern' declaration for the two functions into the #else branch of the conditional so it does not need to be duplicated. Arnd ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [RFC 4/4] ARC: uaccess: use optimized generic __strnlen_user/__strncpy_from_user
On Tue, Jan 14, 2020 at 9:08 PM Vineet Gupta wrote: > diff --git a/arch/arc/include/asm/word-at-a-time.h > b/arch/arc/include/asm/word-at-a-time.h > new file mode 100644 > index ..00e92be70987 > --- /dev/null > +++ b/arch/arc/include/asm/word-at-a-time.h > @@ -0,0 +1,49 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * Copyright (C) 2020 Synopsys Inc. > + */ > +#ifndef __ASM_ARC_WORD_AT_A_TIME_H > +#define __ASM_ARC_WORD_AT_A_TIME_H > + > +#ifdef __LITTLE_ENDIAN__ > + > +#include > + > +struct word_at_a_time { > + const unsigned long one_bits, high_bits; > +}; What's wrong with the generic version on little-endian? Any chance you can find a way to make it work as well for you as this copy? > +static inline unsigned long find_zero(unsigned long mask) > +{ > +#ifdef CONFIG_64BIT > + return fls64(mask) >> 3; > +#else > + return fls(mask) >> 3; > +#endif The CONFIG_64BIT check not be needed, unless you are adding support for 64-bit ARC really soon. Arnd ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[RFC 1/4] asm-generic/uaccess: don't define inline functions if noinline lib/* in use
There are 2 generic varaints of strncpy_from_user() / strnlen_user() (1). inline version in asm-generic/uaccess.h (2). optimized word-at-a-time version in lib/* This patch disables #1 if #2 selected. This allows arches to continue reusing asm-generic/uaccess.h for rest of code This came up when switching ARC to generic word-at-a-time interface Signed-off-by: Vineet Gupta --- include/asm-generic/uaccess.h | 4 1 file changed, 4 insertions(+) diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index e935318804f8..74c14211377b 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h @@ -227,6 +227,7 @@ __strncpy_from_user(char *dst, const char __user *src, long count) } #endif +#ifndef CONFIG_GENERIC_STRNCPY_FROM_USER static inline long strncpy_from_user(char *dst, const char __user *src, long count) { @@ -234,6 +235,7 @@ strncpy_from_user(char *dst, const char __user *src, long count) return -EFAULT; return __strncpy_from_user(dst, src, count); } +#endif /* * Return the size of a string (including the ending 0) @@ -244,6 +246,7 @@ strncpy_from_user(char *dst, const char __user *src, long count) #define __strnlen_user(s, n) (strnlen((s), (n)) + 1) #endif +#ifndef CONFIG_GENERIC_STRNLEN_USER /* * Unlike strnlen, strnlen_user includes the nul terminator in * its returned count. Callers should check for a returned value @@ -255,6 +258,7 @@ static inline long strnlen_user(const char __user *src, long n) return 0; return __strnlen_user(src, n); } +#endif /* * Zero Userspace -- 2.20.1 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[RFC 0/4] Switching ARC to optimized generic strncpy_from_user
Hi, This came up when trying to move ARC over to generic word-at-a-time interface. - 1/4 is a trivial fix (and needed for ARC switch) - 2/4 is mucking with internals hence the RFC. I could very likely be overlooking some possible DoS / exploit issues and apologies in advance if thats the case but I felt like sharing it anyways to see what others think. - 3/4, 4/4 are ARC changes to remove the existing ARC version and switch to generic (needs 1/4). Thx, -Vineet Vineet Gupta (4): asm-generic/uaccess: don't define inline functions if noinline lib/* in use lib/strncpy_from_user: Remove redundant user space pointer range check ARC: uaccess: remove noinline variants of __strncpy_from_user() and friends ARC: uaccess: use optimized generic __strnlen_user/__strncpy_from_user arch/arc/Kconfig | 2 + arch/arc/include/asm/Kbuild | 1 - arch/arc/include/asm/uaccess.h| 87 ++- arch/arc/include/asm/word-at-a-time.h | 49 +++ arch/arc/mm/extable.c | 23 --- include/asm-generic/uaccess.h | 4 ++ lib/strncpy_from_user.c | 36 --- lib/strnlen_user.c| 28 +++-- 8 files changed, 79 insertions(+), 151 deletions(-) create mode 100644 arch/arc/include/asm/word-at-a-time.h -- 2.20.1 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[RFC 4/4] ARC: uaccess: use optimized generic __strnlen_user/__strncpy_from_user
These rely on word access rather than byte loop Signed-off-by: Vineet Gupta --- arch/arc/Kconfig | 2 + arch/arc/include/asm/Kbuild | 1 - arch/arc/include/asm/uaccess.h| 71 ++- arch/arc/include/asm/word-at-a-time.h | 49 ++ 4 files changed, 56 insertions(+), 67 deletions(-) create mode 100644 arch/arc/include/asm/word-at-a-time.h diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 26108ea785c2..3b074c4d31fb 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -26,6 +26,8 @@ config ARC select GENERIC_PENDING_IRQ if SMP select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD + select GENERIC_STRNCPY_FROM_USER if MMU + select GENERIC_STRNLEN_USER if MMU select HAVE_ARCH_KGDB select HAVE_ARCH_TRACEHOOK select HAVE_DEBUG_STACKOVERFLOW diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild index 1b505694691e..cb8d459b7f56 100644 --- a/arch/arc/include/asm/Kbuild +++ b/arch/arc/include/asm/Kbuild @@ -24,5 +24,4 @@ generic-y += topology.h generic-y += trace_clock.h generic-y += user.h generic-y += vga.h -generic-y += word-at-a-time.h generic-y += xor.h diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h index 0b34c152086f..f579e06447a9 100644 --- a/arch/arc/include/asm/uaccess.h +++ b/arch/arc/include/asm/uaccess.h @@ -23,7 +23,6 @@ #include /* for generic string functions */ - #define __kernel_ok(uaccess_kernel()) /* @@ -52,6 +51,8 @@ #define __access_ok(addr, sz) (unlikely(__kernel_ok) || \ likely(__user_ok((addr), (sz +#define user_addr_max()(uaccess_kernel() ? ~0UL : get_fs()) + /*** Single byte/hword/word copies **/ #define __get_user_fn(sz, u, k)\ @@ -655,75 +656,13 @@ static inline unsigned long __clear_user(void __user *to, unsigned long n) return res; } -static inline long -__strncpy_from_user(char *dst, const char __user *src, long count) -{ - long res = 0; - char val; - - if (count == 0) - return 0; - - __asm__ __volatile__( - " mov lp_count, %5\n" - " lp 3f \n" - "1: ldb.ab %3, [%2, 1] \n" - " breq.d %3, 0, 3f \n" - " stb.ab %3, [%1, 1] \n" - " add %0, %0, 1 # Num of NON NULL bytes copied \n" - "3: \n" - " .section .fixup, \"ax\" \n" - " .align 4\n" - "4: mov %0, %4 # sets @res as -EFAULT \n" - " j 3b \n" - " .previous \n" - " .section __ex_table, \"a\" \n" - " .align 4\n" - " .word 1b, 4b \n" - " .previous \n" - : "+r"(res), "+r"(dst), "+r"(src), "=r"(val) - : "g"(-EFAULT), "r"(count) - : "lp_count", "memory"); - - return res; -} - -static inline long __strnlen_user(const char __user *s, long n) -{ - long res, tmp1, cnt; - char val; - - __asm__ __volatile__( - " mov %2, %1 \n" - "1: ldb.ab %3, [%0, 1] \n" - " breq.d %3, 0, 2f \n" - " sub.f %2, %2, 1 \n" - " bnz 1b \n" - " sub %2, %2, 1 \n" - "2: sub %0, %1, %2 \n" - "3: ;nop\n" - " .section .fixup, \"ax\" \n" - " .align 4\n" - "4: mov %0, 0 \n" - " j 3b \n" - " .previous \n" - " .section __ex_table, \"a\" \n" - " .align 4\n" - " .word 1b, 4b\n" - " .previous \n" - : "=r"(res), "=r"(tmp1), "=r"(cnt), "=r"(val) - : "0"(s), "1"(n) - : "memory"); - - return res; -} - #define INLINE_COPY_TO_USER #define INLINE_COPY_FROM_USER #define __clear_user __clear_user -#define __strncpy_from_user__strncpy_from_user -#define __strnlen_user __strnlen_user + +extern long strncpy_from_user(char *dest, const char __user *src, long count); +extern __must_check long strnlen_user(const char __user *str, long n); #include #include diff --git a/arch/arc/include/asm/word-at-a-time.h b/arch/arc/include/asm/word-at-a-time.h new file mode 100644 index ..00e92be70987 ---
[RFC 2/4] lib/strncpy_from_user: Remove redundant user space pointer range check
This came up when switching ARC to word-at-a-time interface and using generic/optimized strncpy_from_user It seems the existing code checks for user buffer/string range multiple times and one of tem cn be avoided. There's an open-coded range check which computes @max off of user_addr_max() and thus typically way larger than the kernel buffer @count and subsequently discarded in do_strncpy_from_user() if (max > count) max = count; The canonical user_access_begin() => access_ok() follow anyways and even with @count it should suffice for an intial range check as is true for any copy_{to,from}_user() And in case actual user space buffer is smaller than kernel dest pointer (i.e. @max < @count) the usual string copy, null byte detection would abort the process early anyways Signed-off-by: Vineet Gupta --- lib/strncpy_from_user.c | 36 +++- lib/strnlen_user.c | 28 +++- 2 files changed, 18 insertions(+), 46 deletions(-) diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index dccb95af6003..a1622d71f037 100644 --- a/lib/strncpy_from_user.c +++ b/lib/strncpy_from_user.c @@ -21,22 +21,15 @@ /* * Do a strncpy, return length of string without final '\0'. * 'count' is the user-supplied count (return 'count' if we - * hit it), 'max' is the address space maximum (and we return - * -EFAULT if we hit it). + * hit it). If access fails, return -EFAULT. */ static inline long do_strncpy_from_user(char *dst, const char __user *src, - unsigned long count, unsigned long max) + unsigned long count) { const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; + unsigned long max = count; unsigned long res = 0; - /* -* Truncate 'max' to the user-specified limit, so that -* we only have one limit we need to check in the loop -*/ - if (max > count) - max = count; - if (IS_UNALIGNED(src, dst)) goto byte_at_a_time; @@ -72,7 +65,7 @@ static inline long do_strncpy_from_user(char *dst, const char __user *src, * Uhhuh. We hit 'max'. But was that the user-specified maximum * too? If so, that's ok - we got as much as the user asked for. */ - if (res >= count) + if (res == count) return res; /* @@ -103,25 +96,18 @@ static inline long do_strncpy_from_user(char *dst, const char __user *src, */ long strncpy_from_user(char *dst, const char __user *src, long count) { - unsigned long max_addr, src_addr; - if (unlikely(count <= 0)) return 0; - max_addr = user_addr_max(); - src_addr = (unsigned long)untagged_addr(src); - if (likely(src_addr < max_addr)) { - unsigned long max = max_addr - src_addr; + kasan_check_write(dst, count); + check_object_size(dst, count, false); + if (user_access_begin(src, count)) { long retval; - - kasan_check_write(dst, count); - check_object_size(dst, count, false); - if (user_access_begin(src, max)) { - retval = do_strncpy_from_user(dst, src, count, max); - user_access_end(); - return retval; - } + retval = do_strncpy_from_user(dst, src, count); + user_access_end(); + return retval; } + return -EFAULT; } EXPORT_SYMBOL(strncpy_from_user); diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c index 6c0005d5dd5c..5ce61f303d6e 100644 --- a/lib/strnlen_user.c +++ b/lib/strnlen_user.c @@ -20,19 +20,13 @@ * if it fits in a aligned 'long'. The caller needs to check * the return value against "> max". */ -static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max) +static inline long do_strnlen_user(const char __user *src, unsigned long count) { const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; unsigned long align, res = 0; + unsigned long max = count; unsigned long c; - /* -* Truncate 'max' to the user-specified limit, so that -* we only have one limit we need to check in the loop -*/ - if (max > count) - max = count; - /* * Do everything aligned. But that means that we * need to also expand the maximum.. @@ -64,7 +58,7 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count, * Uhhuh. We hit 'max'. But was that the user-specified maximum * too? If so, return the marker for "too long". */ - if (res >= count) + if (res == count) return count+1; /* @@ -98,22 +92,14 @@ static inline long do_strnlen_user(const char __user *src, unsigned
[RFC 3/4] ARC: uaccess: remove noinline variants of __strncpy_from_user() and friends
This helps with subsequent removal of arch specific variants in favour of optimized generic routines (word vs byte access) Signed-off-by: Vineet Gupta --- arch/arc/include/asm/uaccess.h | 26 ++ arch/arc/mm/extable.c | 23 --- 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h index ea40ec7f6cae..0b34c152086f 100644 --- a/arch/arc/include/asm/uaccess.h +++ b/arch/arc/include/asm/uaccess.h @@ -613,7 +613,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n) return res; } -static inline unsigned long __arc_clear_user(void __user *to, unsigned long n) +static inline unsigned long __clear_user(void __user *to, unsigned long n) { long res = n; unsigned char *d_char = to; @@ -656,7 +656,7 @@ static inline unsigned long __arc_clear_user(void __user *to, unsigned long n) } static inline long -__arc_strncpy_from_user(char *dst, const char __user *src, long count) +__strncpy_from_user(char *dst, const char __user *src, long count) { long res = 0; char val; @@ -688,7 +688,7 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count) return res; } -static inline long __arc_strnlen_user(const char __user *s, long n) +static inline long __strnlen_user(const char __user *s, long n) { long res, tmp1, cnt; char val; @@ -718,26 +718,12 @@ static inline long __arc_strnlen_user(const char __user *s, long n) return res; } -#ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE - #define INLINE_COPY_TO_USER #define INLINE_COPY_FROM_USER -#define __clear_user(d, n) __arc_clear_user(d, n) -#define __strncpy_from_user(d, s, n) __arc_strncpy_from_user(d, s, n) -#define __strnlen_user(s, n) __arc_strnlen_user(s, n) -#else -extern unsigned long arc_clear_user_noinline(void __user *to, - unsigned long n); -extern long arc_strncpy_from_user_noinline (char *dst, const char __user *src, - long count); -extern long arc_strnlen_user_noinline(const char __user *src, long n); - -#define __clear_user(d, n) arc_clear_user_noinline(d, n) -#define __strncpy_from_user(d, s, n) arc_strncpy_from_user_noinline(d, s, n) -#define __strnlen_user(s, n) arc_strnlen_user_noinline(s, n) - -#endif +#define __clear_user __clear_user +#define __strncpy_from_user__strncpy_from_user +#define __strnlen_user __strnlen_user #include #include diff --git a/arch/arc/mm/extable.c b/arch/arc/mm/extable.c index b06b09ddf924..88fa3a4d4906 100644 --- a/arch/arc/mm/extable.c +++ b/arch/arc/mm/extable.c @@ -22,26 +22,3 @@ int fixup_exception(struct pt_regs *regs) return 0; } - -#ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE - -unsigned long arc_clear_user_noinline(void __user *to, - unsigned long n) -{ - return __arc_clear_user(to, n); -} -EXPORT_SYMBOL(arc_clear_user_noinline); - -long arc_strncpy_from_user_noinline(char *dst, const char __user *src, - long count) -{ - return __arc_strncpy_from_user(dst, src, count); -} -EXPORT_SYMBOL(arc_strncpy_from_user_noinline); - -long arc_strnlen_user_noinline(const char __user *src, long n) -{ - return __arc_strnlen_user(src, n); -} -EXPORT_SYMBOL(arc_strnlen_user_noinline); -#endif -- 2.20.1 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH net 4/4] ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node
On 1/14/20 8:09 AM, Jose Abreu wrote: > Add a missing property to GMAC node so that multicast filtering works > correctly. > > Fixes: 556cc1c5f528 ("ARC: [axs101] Add support for AXS101 SDP (software > development platform)") > Signed-off-by: Jose Abreu Added to for-curr. Thx, -Vineet ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
RE: [PATCH net 4/4] ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node
Hi Jose, > -Original Message- > From: Jose Abreu > Sent: Tuesday, January 14, 2020 7:09 PM > To: net...@vger.kernel.org > Cc: Joao Pinto ; Jose Abreu ; > Alexey Brodkin > ; Rob Herring ; Mark Rutland > ; Vineet > Gupta ; devicet...@vger.kernel.org; > linux-snps-arc@lists.infradead.org; linux- > ker...@vger.kernel.org > Subject: [PATCH net 4/4] ARC: [plat-axs10x]: Add missing multicast filter > number to GMAC node > > Add a missing property to GMAC node so that multicast filtering works > correctly. > > Fixes: 556cc1c5f528 ("ARC: [axs101] Add support for AXS101 SDP (software > development platform)") > Signed-off-by: Jose Abreu Acked-by: Alexey Brodkin ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH net 0/4] net: stmmac: Fix selftests in Synopsys AXS101 board
Set of fixes for sefltests so that they work in Synopsys AXS101 board. Final output: $ ethtool -t eth0 The test result is PASS The test extra info: 1. MAC Loopback 0 2. PHY Loopback -95 3. MMC Counters 0 4. EEE -95 5. Hash Filter MC 0 6. Perfect Filter UC0 7. MC Filter0 8. UC Filter0 9. Flow Control -95 10. RSS -95 11. VLAN Filtering -95 12. VLAN Filtering (perf)-95 13. Double VLAN Filter -95 14. Double VLAN Filter (perf)-95 15. Flexible RX Parser -95 16. SA Insertion (desc) -95 17. SA Replacement (desc)-95 18. SA Insertion (reg) -95 19. SA Replacement (reg) -95 20. VLAN TX Insertion-95 21. SVLAN TX Insertion -95 22. L3 DA Filtering -95 23. L3 SA Filtering -95 24. L4 DA TCP Filtering -95 25. L4 SA TCP Filtering -95 26. L4 DA UDP Filtering -95 27. L4 SA UDP Filtering -95 28. ARP Offload -95 29. Jumbo Frame 0 30. Multichannel Jumbo -95 31. Split Header -95 Description: 1) Fixes the unaligned accesses that caused CPU halt in Synopsys AXS101 boards. 2) Fixes the VLAN tests when filtering failed to work. 3) Fixes the VLAN Perfect tests when filtering is not available in HW. 4) Fixes the Ethernet DT bindings for AXS101 board. --- Cc: Giuseppe Cavallaro Cc: Alexandre Torgue Cc: Jose Abreu Cc: "David S. Miller" Cc: Maxime Coquelin Cc: net...@vger.kernel.org Cc: linux-st...@st-md-mailman.stormreply.com Cc: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org Cc: Alexey Brodkin Cc: Vineet Gupta Cc: linux-snps-arc@lists.infradead.org --- Jose Abreu (4): net: stmmac: selftests: Make it work in Synopsys AXS101 boards net: stmmac: selftests: Mark as fail when received VLAN ID != expected net: stmmac: selftests: Guard VLAN Perfect test against non supported HW ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node arch/arc/boot/dts/axs10x_mb.dtsi | 1 + .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 32 +++--- 2 files changed, 23 insertions(+), 10 deletions(-) -- 2.7.4 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH net 3/4] net: stmmac: selftests: Guard VLAN Perfect test against non supported HW
When HW does not support perfect filtering the feature will not be enabled in the net_device. Add a check for this to prevent failures. Fixes: 1b2250a04c1f ("net: stmmac: selftests: Add tests for VLAN Perfect Filtering") Signed-off-by: Jose Abreu --- Cc: Giuseppe Cavallaro Cc: Alexandre Torgue Cc: Jose Abreu Cc: "David S. Miller" Cc: Maxime Coquelin Cc: net...@vger.kernel.org Cc: linux-st...@st-md-mailman.stormreply.com Cc: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org Cc: Alexey Brodkin Cc: Vineet Gupta Cc: linux-snps-arc@lists.infradead.org --- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c index 7edee3c87ac9..450d7dac3ea6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c @@ -971,6 +971,9 @@ static int stmmac_test_vlanfilt_perfect(struct stmmac_priv *priv) { int ret, prev_cap = priv->dma_cap.vlhash; + if (!(priv->dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) + return -EOPNOTSUPP; + priv->dma_cap.vlhash = 0; ret = __stmmac_test_vlanfilt(priv); priv->dma_cap.vlhash = prev_cap; @@ -1063,6 +1066,9 @@ static int stmmac_test_dvlanfilt_perfect(struct stmmac_priv *priv) { int ret, prev_cap = priv->dma_cap.vlhash; + if (!(priv->dev->features & NETIF_F_HW_VLAN_STAG_FILTER)) + return -EOPNOTSUPP; + priv->dma_cap.vlhash = 0; ret = __stmmac_test_dvlanfilt(priv); priv->dma_cap.vlhash = prev_cap; -- 2.7.4 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH net 1/4] net: stmmac: selftests: Make it work in Synopsys AXS101 boards
Synopsys AXS101 boards do not support unaligned memory loads or stores. Change the selftests mechanism to explicity: - Not add extra alignment in TX SKB - Use the unaligned version of ether_addr_equal() Fixes: 091810dbded9 ("net: stmmac: Introduce selftests support") Signed-off-by: Jose Abreu --- Cc: Giuseppe Cavallaro Cc: Alexandre Torgue Cc: Jose Abreu Cc: "David S. Miller" Cc: Maxime Coquelin Cc: net...@vger.kernel.org Cc: linux-st...@st-md-mailman.stormreply.com Cc: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org Cc: Alexey Brodkin Cc: Vineet Gupta Cc: linux-snps-arc@lists.infradead.org --- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c index 36a4c43a799a..6516d65e84b8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c @@ -80,7 +80,7 @@ static struct sk_buff *stmmac_test_get_udp_skb(struct stmmac_priv *priv, if (attr->max_size && (attr->max_size > size)) size = attr->max_size; - skb = netdev_alloc_skb_ip_align(priv->dev, size); + skb = netdev_alloc_skb(priv->dev, size); if (!skb) return NULL; @@ -244,6 +244,8 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb, struct net_device *orig_ndev) { struct stmmac_test_priv *tpriv = pt->af_packet_priv; + unsigned char *src = tpriv->packet->src; + unsigned char *dst = tpriv->packet->dst; struct stmmachdr *shdr; struct ethhdr *ehdr; struct udphdr *uhdr; @@ -260,15 +262,15 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb, goto out; ehdr = (struct ethhdr *)skb_mac_header(skb); - if (tpriv->packet->dst) { - if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->dst)) + if (dst) { + if (!ether_addr_equal_unaligned(ehdr->h_dest, dst)) goto out; } if (tpriv->packet->sarc) { - if (!ether_addr_equal(ehdr->h_source, ehdr->h_dest)) + if (!ether_addr_equal_unaligned(ehdr->h_source, ehdr->h_dest)) goto out; - } else if (tpriv->packet->src) { - if (!ether_addr_equal(ehdr->h_source, tpriv->packet->src)) + } else if (src) { + if (!ether_addr_equal_unaligned(ehdr->h_source, src)) goto out; } @@ -714,7 +716,7 @@ static int stmmac_test_flowctrl_validate(struct sk_buff *skb, struct ethhdr *ehdr; ehdr = (struct ethhdr *)skb_mac_header(skb); - if (!ether_addr_equal(ehdr->h_source, orig_ndev->dev_addr)) + if (!ether_addr_equal_unaligned(ehdr->h_source, orig_ndev->dev_addr)) goto out; if (ehdr->h_proto != htons(ETH_P_PAUSE)) goto out; @@ -856,7 +858,7 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb, } ehdr = (struct ethhdr *)skb_mac_header(skb); - if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->dst)) + if (!ether_addr_equal_unaligned(ehdr->h_dest, tpriv->packet->dst)) goto out; ihdr = ip_hdr(skb); @@ -1586,7 +1588,7 @@ static int stmmac_test_arp_validate(struct sk_buff *skb, struct arphdr *ahdr; ehdr = (struct ethhdr *)skb_mac_header(skb); - if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->src)) + if (!ether_addr_equal_unaligned(ehdr->h_dest, tpriv->packet->src)) goto out; ahdr = arp_hdr(skb); -- 2.7.4 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH net 4/4] ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node
Add a missing property to GMAC node so that multicast filtering works correctly. Fixes: 556cc1c5f528 ("ARC: [axs101] Add support for AXS101 SDP (software development platform)") Signed-off-by: Jose Abreu --- Cc: Alexey Brodkin Cc: Rob Herring Cc: Mark Rutland Cc: Vineet Gupta Cc: devicet...@vger.kernel.org Cc: linux-snps-arc@lists.infradead.org Cc: linux-ker...@vger.kernel.org --- arch/arc/boot/dts/axs10x_mb.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi index f9a5c9ddcae7..1d109b06e7d8 100644 --- a/arch/arc/boot/dts/axs10x_mb.dtsi +++ b/arch/arc/boot/dts/axs10x_mb.dtsi @@ -78,6 +78,7 @@ interrupt-names = "macirq"; phy-mode = "rgmii"; snps,pbl = < 32 >; + snps,multicast-filter-bins = <256>; clocks = <>; clock-names = "stmmaceth"; max-speed = <100>; -- 2.7.4 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH net 2/4] net: stmmac: selftests: Mark as fail when received VLAN ID != expected
When the VLAN ID does not match the expected one it means filter failed in HW. Fix it. Fixes: 94e18382003c ("net: stmmac: selftests: Add selftest for VLAN TX Offload") Signed-off-by: Jose Abreu --- Cc: Giuseppe Cavallaro Cc: Alexandre Torgue Cc: Jose Abreu Cc: "David S. Miller" Cc: Maxime Coquelin Cc: net...@vger.kernel.org Cc: linux-st...@st-md-mailman.stormreply.com Cc: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org Cc: Alexey Brodkin Cc: Vineet Gupta Cc: linux-snps-arc@lists.infradead.org --- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c index 6516d65e84b8..7edee3c87ac9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c @@ -853,8 +853,12 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb, if (tpriv->vlan_id) { if (skb->vlan_proto != htons(proto)) goto out; - if (skb->vlan_tci != tpriv->vlan_id) + if (skb->vlan_tci != tpriv->vlan_id) { + /* Means filter did not work. */ + tpriv->ok = false; + complete(>comp); goto out; + } } ehdr = (struct ethhdr *)skb_mac_header(skb); -- 2.7.4 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc