Re: Unaligned user pointer issues..

2019-10-07 Thread Michael Cree
On Sun, Oct 06, 2019 at 08:25:05PM -0700, Linus Torvalds wrote: > So Guenther Roeck reported that my fancy readdir() user access > optimization broke alpha and sparc64 boot for him. > > (It really improves things on x86 - I swear! The cost of telling the > CPU over and over again to "please allow

Re: Bug report (with fix) for DEC Tulip driver (de2104x.c)

2019-10-02 Thread Maciej W. Rozycki
On Wed, 18 Sep 2019, Thomas Bogendoerfer wrote: > > >> Likewise, I'm at a loss for testing with real hardware. It's hard to > > >> find such things, now. > > > How does de2104x compare to ds2142/43?  I have a c3750 with ds2142/43 > > > tulip.  Helge > > > or some others might have a machine with

Re: [PATCH 18/29] arm64: Move EXCEPTION_TABLE to RO_DATA segment

2019-10-01 Thread Kees Cook
we want to map the thing read-only, it > really has to be aligned either side. Actually, taking a closer look, this appears to be redundant: RO_DATA() ends with: . = ALIGN(align) (where "align" is the "PAGE_SIZE" argument to RO_DATA()) > Anyway, that's only a ni

Re: [PATCH 14/29] vmlinux.lds.h: Allow EXCEPTION_TABLE to live in RO_DATA

2019-10-01 Thread Will Deacon
On Thu, Sep 26, 2019 at 10:55:47AM -0700, Kees Cook wrote: > Many architectures have an EXCEPTION_TABLE that needs only to be > read-only. As such, it should live in RO_DATA. This creates a macro to > identify this case for the architectures that can move EXCEPTION_TABLE > into RO_DATA. > >

Re: [PATCH 18/29] arm64: Move EXCEPTION_TABLE to RO_DATA segment

2019-10-01 Thread Will Deacon
Hi Kees, On Thu, Sep 26, 2019 at 10:55:51AM -0700, Kees Cook wrote: > The EXCEPTION_TABLE is read-only, so collapse it into RO_DATA. > > Signed-off-by: Kees Cook > --- > arch/arm64/kernel/vmlinux.lds.S | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git

Re: [PATCH v13 7/9] open: openat2(2) syscall

2019-09-30 Thread kbuild test robot
* If we have O_PATH in the open flag. Then we 1002 * cannot have anything other than the below set of flags 1003 */ 1004 flags &= O_DIRECTORY | O_NOFOLLOW | O_PATH; 1005 acc_mode = 0; 1006 1007

Re: [PATCH v13 7/9] open: openat2(2) syscall

2019-09-30 Thread kbuild test robot
Hi Aleksa, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [cannot apply to v5.4-rc1 next-20190930] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify

Re: [PATCH v13 3/9] open: O_EMPTYPATH: procfs-less file descriptor re-opening

2019-09-30 Thread Aleksa Sarai
On 2019-10-01, kbuild test robot wrote: > Hi Aleksa, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on linus/master] > [cannot apply to v5.4-rc1 next-20190930] > [if your patch is applied to the wrong git tree, please drop us a note to help > improve the

Re: [PATCH v13 3/9] open: O_EMPTYPATH: procfs-less file descriptor re-opening

2019-09-30 Thread kbuild test robot
Hi Aleksa, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [cannot apply to v5.4-rc1 next-20190930] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify

Re: [PATCH v13 7/9] open: openat2(2) syscall

2019-09-30 Thread Aleksa Sarai
On 2019-10-01, kbuild test robot wrote: > Hi Aleksa, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on linus/master] > [cannot apply to v5.4-rc1 next-20190930] > [if your patch is applied to the wrong git tree, please drop us a note to help > improve the

Re: [PATCH RESEND v3 00/26] Add definition for the number of standard PCI BARs

2019-09-30 Thread Bjorn Helgaas
On Sat, Sep 28, 2019 at 02:40:26AM +0300, Denis Efremov wrote: > Code that iterates over all standard PCI BARs typically uses > PCI_STD_RESOURCE_END, but this is error-prone because it requires > "i <= PCI_STD_RESOURCE_END" rather than something like > "i < PCI_STD_NUM_BARS". We could add such a

[PATCH v13 3/9] open: O_EMPTYPATH: procfs-less file descriptor re-opening

2019-09-30 Thread Aleksa Sarai
Userspace has made use of /proc/self/fd very liberally to allow for descriptors to be re-opened. There are a wide variety of uses for this feature, but it has always required constructing a pathname and could not be done without procfs mounted. The obvious solution for this is to extend openat(2

Re: [PATCH v13 7/9] open: openat2(2) syscall

2019-09-30 Thread kbuild test robot
Hi Aleksa, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [cannot apply to v5.4-rc1 next-20190930] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-26 Thread Peter Zijlstra
On Thu, Sep 26, 2019 at 11:05:59AM +0200, Peter Zijlstra wrote: > On Wed, Sep 25, 2019 at 11:45:26PM +0200, Peter Zijlstra wrote: > > [7.149889] [Firmware Bug]: device: 'pci:7f': no node assigned on > > NUMA capable HW > > [7.882888] [Firmware Bug]: device: 'pci:ff': no node

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-26 Thread Peter Zijlstra
On Wed, Sep 25, 2019 at 11:45:26PM +0200, Peter Zijlstra wrote: > [7.149889] [Firmware Bug]: device: 'pci:7f': no node assigned on NUMA > capable HW > [7.882888] [Firmware Bug]: device: 'pci:ff': no node assigned on NUMA > capable HW Going by the limited number of intel numa

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-25 Thread Peter Zijlstra
On Wed, Sep 25, 2019 at 06:31:54PM +0200, Peter Zijlstra wrote: > On Wed, Sep 25, 2019 at 03:25:44PM +0200, Michal Hocko wrote: > > I am sorry but I still do not understand why you consider this whack a > > mole better then simply live with the fact that NUMA_NO_NODE is a > > reality and that

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-25 Thread Michal Hocko
On Wed 25-09-19 12:40:40, Peter Zijlstra wrote: > On Tue, Sep 24, 2019 at 03:19:39PM +0200, Michal Hocko wrote: > > > > The below would get rid of the PMU and workqueue warnings with no > > > side-effects (the device isn't used for anything except sysfs). > > > > Hardcoding to 0 is simply wrong,

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-25 Thread Peter Zijlstra
On Wed, Sep 25, 2019 at 05:14:20PM +0800, Yunsheng Lin wrote: > From the discussion above, It seems making the node_to_cpumask_map() > NUMA_NO_NODE aware is the most feasible way to move forwad. That's still wrong.

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-25 Thread Peter Zijlstra
On Tue, Sep 24, 2019 at 03:19:39PM +0200, Michal Hocko wrote: > > The below would get rid of the PMU and workqueue warnings with no > > side-effects (the device isn't used for anything except sysfs). > > Hardcoding to 0 is simply wrong, if the node0 is cpuless for example... It doesn't

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-25 Thread Yunsheng Lin
On 2019/9/24 21:19, Michal Hocko wrote: > On Tue 24-09-19 14:59:36, Peter Zijlstra wrote: >> On Tue, Sep 24, 2019 at 02:43:25PM +0200, Peter Zijlstra wrote: >>> On Tue, Sep 24, 2019 at 02:25:00PM +0200, Michal Hocko wrote: On Tue 24-09-19 14:09:43, Peter Zijlstra wrote: >>> > We can push

Re: [PATCH v2 00/21] Refine memblock API

2019-09-24 Thread Adam Ford
On Mon, Jan 21, 2019 at 2:05 AM Mike Rapoport wrote: > > Hi, > > Current memblock API is quite extensive and, which is more annoying, > duplicated. Except the low-level functions that allow searching for a free > memory region and marking it as reserved, memblock provides three (well, > two and a

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Michal Hocko
On Tue 24-09-19 14:59:36, Peter Zijlstra wrote: > On Tue, Sep 24, 2019 at 02:43:25PM +0200, Peter Zijlstra wrote: > > On Tue, Sep 24, 2019 at 02:25:00PM +0200, Michal Hocko wrote: > > > On Tue 24-09-19 14:09:43, Peter Zijlstra wrote: > > > > > > We can push back and say we don't respect the

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Peter Zijlstra
On Tue, Sep 24, 2019 at 02:43:25PM +0200, Peter Zijlstra wrote: > On Tue, Sep 24, 2019 at 02:25:00PM +0200, Michal Hocko wrote: > > On Tue 24-09-19 14:09:43, Peter Zijlstra wrote: > > > > We can push back and say we don't respect the specification because it > > > is batshit insane ;-) > > > >

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Peter Zijlstra
On Tue, Sep 24, 2019 at 02:25:00PM +0200, Michal Hocko wrote: > On Tue 24-09-19 14:09:43, Peter Zijlstra wrote: > > We can push back and say we don't respect the specification because it > > is batshit insane ;-) > > Here is my fingers crossed. > > [...] > > > Now granted; there's a number of

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Michal Hocko
On Tue 24-09-19 14:09:43, Peter Zijlstra wrote: > On Tue, Sep 24, 2019 at 01:54:01PM +0200, Michal Hocko wrote: > > On Tue 24-09-19 13:23:49, Peter Zijlstra wrote: > > > On Tue, Sep 24, 2019 at 12:56:22PM +0200, Michal Hocko wrote: > > [...] > > > > To be honest I really fail to see why to object

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Yunsheng Lin
On 2019/9/24 19:58, Peter Zijlstra wrote: > On Tue, Sep 24, 2019 at 07:44:28PM +0800, Yunsheng Lin wrote: >> From [1], there is a lot of devices with node id of NUMA_NO_NODE with the >> FW_BUG. >> >> [1] >> https://lore.kernel.org/lkml/5a188e2b-6c07-a9db-fbaa-561e9362d...@huawei.com/ > > So

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Yunsheng Lin
On 2019/9/24 19:28, Peter Zijlstra wrote: > On Tue, Sep 24, 2019 at 07:07:36PM +0800, Yunsheng Lin wrote: >> On 2019/9/24 17:25, Peter Zijlstra wrote: >>> On Tue, Sep 24, 2019 at 09:29:50AM +0800, Yunsheng Lin wrote: On 2019/9/24 4:34, Peter Zijlstra wrote: >>> > I'm saying the ACPI

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Peter Zijlstra
On Tue, Sep 24, 2019 at 07:07:36PM +0800, Yunsheng Lin wrote: > On 2019/9/24 17:25, Peter Zijlstra wrote: > > On Tue, Sep 24, 2019 at 09:29:50AM +0800, Yunsheng Lin wrote: > >> On 2019/9/24 4:34, Peter Zijlstra wrote: > > > >>> I'm saying the ACPI standard is wrong. Explain to me how it is > >>>

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Peter Zijlstra
On Tue, Sep 24, 2019 at 12:56:22PM +0200, Michal Hocko wrote: > On Tue 24-09-19 11:17:14, Peter Zijlstra wrote: > > On Tue, Sep 24, 2019 at 09:47:51AM +0200, Michal Hocko wrote: > > > On Mon 23-09-19 22:34:10, Peter Zijlstra wrote: > > > > On Mon, Sep 23, 2019 at 06:52:35PM +0200, Michal Hocko

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Yunsheng Lin
On 2019/9/24 17:25, Peter Zijlstra wrote: > On Tue, Sep 24, 2019 at 09:29:50AM +0800, Yunsheng Lin wrote: >> On 2019/9/24 4:34, Peter Zijlstra wrote: > >>> I'm saying the ACPI standard is wrong. Explain to me how it is >>> physically possible to have a device without NUMA affinity in a NUMA >>>

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Michal Hocko
On Tue 24-09-19 11:17:14, Peter Zijlstra wrote: > On Tue, Sep 24, 2019 at 09:47:51AM +0200, Michal Hocko wrote: > > On Mon 23-09-19 22:34:10, Peter Zijlstra wrote: > > > On Mon, Sep 23, 2019 at 06:52:35PM +0200, Michal Hocko wrote: > > [...] > > > > I even the > > > > ACPI standard is considering

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Peter Zijlstra
On Tue, Sep 24, 2019 at 09:29:50AM +0800, Yunsheng Lin wrote: > On 2019/9/24 4:34, Peter Zijlstra wrote: > > I'm saying the ACPI standard is wrong. Explain to me how it is > > physically possible to have a device without NUMA affinity in a NUMA > > system? > > > > 1) The fundamental

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Peter Zijlstra
On Tue, Sep 24, 2019 at 09:47:51AM +0200, Michal Hocko wrote: > On Mon 23-09-19 22:34:10, Peter Zijlstra wrote: > > On Mon, Sep 23, 2019 at 06:52:35PM +0200, Michal Hocko wrote: > [...] > > > I even the > > > ACPI standard is considering this optional. Yunsheng Lin has referred to > > > the

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-24 Thread Michal Hocko
On Mon 23-09-19 22:34:10, Peter Zijlstra wrote: > On Mon, Sep 23, 2019 at 06:52:35PM +0200, Michal Hocko wrote: [...] > > I even the > > ACPI standard is considering this optional. Yunsheng Lin has referred to > > the specific part of the standard in one of the earlier discussions. > > Trying to

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-23 Thread Yunsheng Lin
On 2019/9/24 4:34, Peter Zijlstra wrote: > On Mon, Sep 23, 2019 at 06:52:35PM +0200, Michal Hocko wrote: >> On Mon 23-09-19 17:48:52, Peter Zijlstra wrote: > >> To the NUMA_NO_NODE itself. Your earlier email noted: >> : > + >> : > if ((unsigned)node >= nr_node_ids) { >> : >

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-23 Thread Peter Zijlstra
On Mon, Sep 23, 2019 at 06:52:35PM +0200, Michal Hocko wrote: > On Mon 23-09-19 17:48:52, Peter Zijlstra wrote: > To the NUMA_NO_NODE itself. Your earlier email noted: > : > + > : > if ((unsigned)node >= nr_node_ids) { > : > printk(KERN_WARNING > : >

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-23 Thread Michal Hocko
On Mon 23-09-19 17:48:52, Peter Zijlstra wrote: > On Mon, Sep 23, 2019 at 05:28:56PM +0200, Michal Hocko wrote: > > On Mon 23-09-19 17:15:19, Peter Zijlstra wrote: > > > > > diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c > > > > index 4123100e..9859acb 100644 > > > > ---

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-23 Thread Peter Zijlstra
On Mon, Sep 23, 2019 at 05:28:56PM +0200, Michal Hocko wrote: > On Mon 23-09-19 17:15:19, Peter Zijlstra wrote: > > > diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c > > > index 4123100e..9859acb 100644 > > > --- a/arch/x86/mm/numa.c > > > +++ b/arch/x86/mm/numa.c > > > @@ -861,6 +861,9 @@

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-23 Thread Michal Hocko
On Mon 23-09-19 17:15:19, Peter Zijlstra wrote: > On Tue, Sep 17, 2019 at 08:48:54PM +0800, Yunsheng Lin wrote: > > When passing the return value of dev_to_node() to cpumask_of_node() > > without checking if the device's node id is NUMA_NO_NODE, there is > > global-out-of-bounds detected by KASAN.

Re: [PATCH v6] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-23 Thread Peter Zijlstra
On Tue, Sep 17, 2019 at 08:48:54PM +0800, Yunsheng Lin wrote: > When passing the return value of dev_to_node() to cpumask_of_node() > without checking if the device's node id is NUMA_NO_NODE, there is > global-out-of-bounds detected by KASAN. > > From the discussion [1], NUMA_NO_NODE really means

Re: [PATCH v12 05/12] namei: obey trailing magic-link DAC permissions

2019-09-18 Thread Aleksa Sarai
On 2019-09-18, Aleksa Sarai wrote: > On 2019-09-17, Jann Horn wrote: > > On Wed, Sep 4, 2019 at 10:21 PM Aleksa Sarai wrote: > > > The ability for userspace to "re-open" file descriptors through > > > /proc/self/fd has been a very useful tool for all sorts

Re: [PATCH v12 05/12] namei: obey trailing magic-link DAC permissions

2019-09-18 Thread Aleksa Sarai
On 2019-09-17, Jann Horn wrote: > On Wed, Sep 4, 2019 at 10:21 PM Aleksa Sarai wrote: > > The ability for userspace to "re-open" file descriptors through > > /proc/self/fd has been a very useful tool for all sorts of usecases > > (container runtimes are one common

Re: [PATCH v12 05/12] namei: obey trailing magic-link DAC permissions

2019-09-17 Thread Jann Horn
On Wed, Sep 4, 2019 at 10:21 PM Aleksa Sarai wrote: > The ability for userspace to "re-open" file descriptors through > /proc/self/fd has been a very useful tool for all sorts of usecases > (container runtimes are one common example). However, the current > interface for d

Re: [PATCH v5] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-17 Thread Yunsheng Lin
On 2019/9/17 18:08, Michal Hocko wrote: > On Tue 17-09-19 17:53:57, Yunsheng Lin wrote: >> On 2019/9/17 17:36, Michal Hocko wrote: >>> On Tue 17-09-19 14:20:11, Yunsheng Lin wrote: On 2019/9/17 13:28, Michael Ellerman wrote: > Yunsheng Lin writes: >>> [...] >> But we cannot really

Re: [PATCH v5] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-17 Thread Michal Hocko
On Tue 17-09-19 17:53:57, Yunsheng Lin wrote: > On 2019/9/17 17:36, Michal Hocko wrote: > > On Tue 17-09-19 14:20:11, Yunsheng Lin wrote: > >> On 2019/9/17 13:28, Michael Ellerman wrote: > >>> Yunsheng Lin writes: > > [...] > But we cannot really copy the page allocator logic. Simply because

Re: [PATCH v5] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-17 Thread Yunsheng Lin
On 2019/9/17 17:36, Michal Hocko wrote: > On Tue 17-09-19 14:20:11, Yunsheng Lin wrote: >> On 2019/9/17 13:28, Michael Ellerman wrote: >>> Yunsheng Lin writes: > [...] But we cannot really copy the page allocator logic. Simply because the page allocator doesn't enforce the near node

Re: [PATCH v5] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-17 Thread Michal Hocko
On Tue 17-09-19 14:20:11, Yunsheng Lin wrote: > On 2019/9/17 13:28, Michael Ellerman wrote: > > Yunsheng Lin writes: [...] > >> But we cannot really copy the page allocator logic. Simply because the > >> page allocator doesn't enforce the near node affinity. It just picks it > >> up as a

Re: [PATCH v5] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-17 Thread Yunsheng Lin
On 2019/9/17 13:28, Michael Ellerman wrote: > Yunsheng Lin writes: >> When passing the return value of dev_to_node() to cpumask_of_node() >> without checking if the device's node id is NUMA_NO_NODE, there is >> global-out-of-bounds detected by KASAN. >> >> From the discussion [1], NUMA_NO_NODE

Re: [PATCH v5] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-16 Thread Michael Ellerman
Yunsheng Lin writes: > When passing the return value of dev_to_node() to cpumask_of_node() > without checking if the device's node id is NUMA_NO_NODE, there is > global-out-of-bounds detected by KASAN. > > From the discussion [1], NUMA_NO_NODE really means no node affinity, > which also means all

Re: [PATCH v4] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-16 Thread Yunsheng Lin
On 2019/9/16 20:23, Michal Hocko wrote: > On Mon 16-09-19 20:07:22, Yunsheng Lin wrote: > [...] @@ -861,9 +861,12 @@ void numa_remove_cpu(int cpu) */ const struct cpumask *cpumask_of_node(int node) { - if (node >= nr_node_ids) { + if (node == NUMA_NO_NODE)

Re: [PATCH v4] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-16 Thread Michal Hocko
On Mon 16-09-19 20:07:22, Yunsheng Lin wrote: [...] > >> @@ -861,9 +861,12 @@ void numa_remove_cpu(int cpu) > >> */ > >> const struct cpumask *cpumask_of_node(int node) > >> { > >> - if (node >= nr_node_ids) { > >> + if (node == NUMA_NO_NODE) > >> + return cpu_online_mask; > >> + >

Re: [PATCH v4] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-16 Thread Yunsheng Lin
On 2019/9/16 16:43, Michal Hocko wrote: > On Sun 15-09-19 16:20:56, Yunsheng Lin wrote: >> When passing the return value of dev_to_node() to cpumask_of_node() >> without checking if the device's node id is NUMA_NO_NODE, there is >> global-out-of-bounds detected by KASAN. >> >> >From the discussion

Re: [PATCH v4] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-09-16 Thread Michal Hocko
On Sun 15-09-19 16:20:56, Yunsheng Lin wrote: > When passing the return value of dev_to_node() to cpumask_of_node() > without checking if the device's node id is NUMA_NO_NODE, there is > global-out-of-bounds detected by KASAN. > > >From the discussion [1], NUMA_NO_NODE really means no node

Re: [PATCH v3 7/8] mips: numa: make node_to_cpumask_map() NUMA_NO_NODE aware for mips

2019-09-15 Thread Yunsheng Lin
On 2019/9/15 14:46, Mike Rapoport wrote: > On Sun, Sep 15, 2019 at 02:13:51PM +0800, Yunsheng Lin wrote: >> On 2019/9/15 13:49, Mike Rapoport wrote: >>> Hi, >>> >>> On Thu, Sep 12, 2019 at 06:15:33PM +0800, Yunsheng Lin wrote: When passing the return value of dev_to_node() to

Re: [PATCH v3 7/8] mips: numa: make node_to_cpumask_map() NUMA_NO_NODE aware for mips

2019-09-15 Thread Mike Rapoport
On Sun, Sep 15, 2019 at 02:13:51PM +0800, Yunsheng Lin wrote: > On 2019/9/15 13:49, Mike Rapoport wrote: > > Hi, > > > > On Thu, Sep 12, 2019 at 06:15:33PM +0800, Yunsheng Lin wrote: > >> When passing the return value of dev_to_node() to cpumask_of_node() > >> without checking the node id if the

Re: [PATCH v3 7/8] mips: numa: make node_to_cpumask_map() NUMA_NO_NODE aware for mips

2019-09-15 Thread Yunsheng Lin
On 2019/9/15 13:49, Mike Rapoport wrote: > Hi, > > On Thu, Sep 12, 2019 at 06:15:33PM +0800, Yunsheng Lin wrote: >> When passing the return value of dev_to_node() to cpumask_of_node() >> without checking the node id if the node id is NUMA_NO_NODE, there is >> global-out-of-bounds detected by

Re: [PATCH v3 7/8] mips: numa: make node_to_cpumask_map() NUMA_NO_NODE aware for mips

2019-09-14 Thread Mike Rapoport
Hi, On Thu, Sep 12, 2019 at 06:15:33PM +0800, Yunsheng Lin wrote: > When passing the return value of dev_to_node() to cpumask_of_node() > without checking the node id if the node id is NUMA_NO_NODE, there is > global-out-of-bounds detected by KASAN. > > From the discussion [1], NUMA_NO_NODE

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-11 Thread Aleksa Sarai
On 2019-09-05, Peter Zijlstra wrote: > On Thu, Sep 05, 2019 at 11:43:05AM +0200, Peter Zijlstra wrote: > > On Thu, Sep 05, 2019 at 07:26:22PM +1000, Aleksa Sarai wrote: > > > On 2019-09-05, Peter Zijlstra wrote: > > > > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > > > > +/**

Re: [PATCH v12 11/12] open: openat2(2) syscall

2019-09-10 Thread Ingo Molnar
* Linus Torvalds wrote: > On Sat, Sep 7, 2019 at 10:42 AM Andy Lutomirski wrote: > > > > Linus, you rejected resolveat() because you wanted a *nice* API > > No. I rejected resoveat() because it was a completely broken garbage > API that couldn't do even basic stuff right (like O_CREAT). > >

Re: [PATCH v12 11/12] open: openat2(2) syscall

2019-09-08 Thread Aleksa Sarai
On 2019-09-07, Jeff Layton wrote: > On Thu, 2019-09-05 at 06:19 +1000, Aleksa Sarai wrote: > > + * @flags: O_* flags. > > + * @mode: O_CREAT/O_TMPFILE file mode. > > + * @upgrade_mask: UPGRADE_* flags (to restrict O_PATH re-opening). > > + * @resolve: RESOLVE_*

Re: [PATCH v12 11/12] open: openat2(2) syscall

2019-09-07 Thread Andy Lutomirski
> On Sep 7, 2019, at 10:45 AM, Linus Torvalds > wrote: > >> On Sat, Sep 7, 2019 at 10:42 AM Andy Lutomirski wrote: >> >> Linus, you rejected resolveat() because you wanted a *nice* API > > No. I rejected resoveat() because it was a completely broken garbage > API that couldn't do even

Re: [PATCH v12 11/12] open: openat2(2) syscall

2019-09-07 Thread Linus Torvalds
On Sat, Sep 7, 2019 at 10:42 AM Andy Lutomirski wrote: > > Linus, you rejected resolveat() because you wanted a *nice* API No. I rejected resoveat() because it was a completely broken garbage API that couldn't do even basic stuff right (like O_CREAT). We have a ton of flag space in the new

Re: [PATCH v12 11/12] open: openat2(2) syscall

2019-09-07 Thread Andy Lutomirski
> On Sep 7, 2019, at 9:58 AM, Linus Torvalds > wrote: > >> On Sat, Sep 7, 2019 at 5:40 AM Jeff Layton wrote: >> >> After thinking about this a bit, I wonder if we might be better served >> with a new set of OA2_* flags instead of repurposing the O_* flags? > > I'd hate to have yet

Re: [PATCH v12 11/12] open: openat2(2) syscall

2019-09-07 Thread Linus Torvalds
On Sat, Sep 7, 2019 at 5:40 AM Jeff Layton wrote: > > After thinking about this a bit, I wonder if we might be better served > with a new set of OA2_* flags instead of repurposing the O_* flags? I'd hate to have yet _another_ set of translation functions, and another chance of people just

Re: [PATCH v12 11/12] open: openat2(2) syscall

2019-09-07 Thread Jeff Layton
er than being hidden amongst O_* flags >which may result in it not being used by all the parties that might >want to use it (file servers, web servers, container runtimes, etc). > > * It gives us the opportunity to iterate on the O_PATH interface. In >particular, the new @how-

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-06 Thread Christian Brauner
On Fri, Sep 06, 2019 at 05:56:18AM +1000, Aleksa Sarai wrote: > On 2019-09-05, Al Viro wrote: > > On Thu, Sep 05, 2019 at 08:23:03PM +0200, Christian Brauner wrote: > > > > > Because every caller of that function right now has that limit set > > > anyway iirc. So we can either remove it from

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Al Viro
On Fri, Sep 06, 2019 at 12:49:44AM +0100, Al Viro wrote: > On Fri, Sep 06, 2019 at 09:00:03AM +1000, Aleksa Sarai wrote: > > > > + return -EFAULT; > > > > + } > > > > + /* Copy the interoperable parts of the struct. */ > > > > + if (__copy_to_user(dst, src,

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Aleksa Sarai
On 2019-09-06, Al Viro wrote: > On Fri, Sep 06, 2019 at 09:00:03AM +1000, Aleksa Sarai wrote: > > > > + return -EFAULT; > > > > + } > > > > + /* Copy the interoperable parts of the struct. */ > > > > + if (__copy_to_user(dst, src, size)) > > > > +

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Al Viro
On Fri, Sep 06, 2019 at 09:00:03AM +1000, Aleksa Sarai wrote: > > > + return -EFAULT; > > > + } > > > + /* Copy the interoperable parts of the struct. */ > > > + if (__copy_to_user(dst, src, size)) > > > + return -EFAULT; > > > > Why not simply clear_user() and

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Aleksa Sarai
On 2019-09-05, Al Viro wrote: > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > +/* > > + * "memset(p, 0, size)" but for user space buffers. Caller must have > > already > > + * checked access_ok(p, size). > > + */ > > +static int __memzero_user(void __user *p, size_t s) > > +{

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Al Viro
On Fri, Sep 06, 2019 at 05:56:18AM +1000, Aleksa Sarai wrote: > On 2019-09-05, Al Viro wrote: > > On Thu, Sep 05, 2019 at 08:23:03PM +0200, Christian Brauner wrote: > > > > > Because every caller of that function right now has that limit set > > > anyway iirc. So we can either remove it from

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Aleksa Sarai
On 2019-09-05, Al Viro wrote: > On Thu, Sep 05, 2019 at 08:23:03PM +0200, Christian Brauner wrote: > > > Because every caller of that function right now has that limit set > > anyway iirc. So we can either remove it from here and place it back for > > the individual callers or leave it in the

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Christian Brauner
On Thu, Sep 05, 2019 at 07:28:01PM +0100, Al Viro wrote: > On Thu, Sep 05, 2019 at 08:23:03PM +0200, Christian Brauner wrote: > > > Because every caller of that function right now has that limit set > > anyway iirc. So we can either remove it from here and place it back for > > the individual

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Al Viro
On Thu, Sep 05, 2019 at 08:23:03PM +0200, Christian Brauner wrote: > Because every caller of that function right now has that limit set > anyway iirc. So we can either remove it from here and place it back for > the individual callers or leave it in the helper. > Also, I'm really asking, why not?

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Christian Brauner
On Thu, Sep 05, 2019 at 07:07:50PM +0100, Al Viro wrote: > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > +/* > > + * "memset(p, 0, size)" but for user space buffers. Caller must have > > already > > + * checked access_ok(p, size). > > + */ > > +static int __memzero_user(void

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Al Viro
On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > +/* > + * "memset(p, 0, size)" but for user space buffers. Caller must have already > + * checked access_ok(p, size). > + */ > +static int __memzero_user(void __user *p, size_t s) > +{ > + const char zeros[BUFFER_SIZE] = {}; > +

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Aleksa Sarai
On 2019-09-05, Peter Zijlstra wrote: > On Thu, Sep 05, 2019 at 07:26:22PM +1000, Aleksa Sarai wrote: > > On 2019-09-05, Peter Zijlstra wrote: > > > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > > > + > > > > + while (rest > 0) { > > > > +

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Aleksa Sarai
On 2019-09-05, Christian Brauner wrote: > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > A common pattern for syscall extensions is increasing the size of a > > struct passed from userspace, such that the zero-value of the new fields > > result in the old kernel behaviour

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Aleksa Sarai
On 2019-09-05, Peter Zijlstra wrote: > On Thu, Sep 05, 2019 at 07:26:22PM +1000, Aleksa Sarai wrote: > > On 2019-09-05, Peter Zijlstra wrote: > > > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > > > +/** > > > > + * copy_struct_to_user: copy a struct to user space > > > > + *

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Christian Brauner
On Thu, Sep 05, 2019 at 09:27:18PM +1000, Aleksa Sarai wrote: > On 2019-09-05, Christian Brauner wrote: > > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > > A common pattern for syscall extensions is increasing the size of a > > > struct passed from userspace, such that the

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Christian Brauner
On Thu, Sep 05, 2019 at 01:17:38PM +0200, Rasmus Villemoes wrote: > On 05/09/2019 13.05, Christian Brauner wrote: > > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > >> + if (unlikely(!access_ok(dst, usize))) > >> + return -EFAULT; > >> + > >> + /* Deal with trailing

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Aleksa Sarai
On 2019-09-05, Christian Brauner wrote: > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > A common pattern for syscall extensions is increasing the size of a > > struct passed from userspace, such that the zero-value of the new fields > > result in the old kernel behaviour

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Rasmus Villemoes
On 05/09/2019 13.05, Christian Brauner wrote: > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: >> +if (unlikely(!access_ok(dst, usize))) >> +return -EFAULT; >> + >> +/* Deal with trailing bytes. */ >> +if (usize < ksize) { >> +if (memchr_inv(src

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Christian Brauner
On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > A common pattern for syscall extensions is increasing the size of a > struct passed from userspace, such that the zero-value of the new fields > result in the old kernel behaviour (allowing for a mix of userspace and > kernel vintages

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Christian Brauner
On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > A common pattern for syscall extensions is increasing the size of a > struct passed from userspace, such that the zero-value of the new fields > result in the old kernel behaviour (allowing for a mix of userspace and > kernel vintages

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Peter Zijlstra
On Thu, Sep 05, 2019 at 11:43:05AM +0200, Peter Zijlstra wrote: > On Thu, Sep 05, 2019 at 07:26:22PM +1000, Aleksa Sarai wrote: > > On 2019-09-05, Peter Zijlstra wrote: > > > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > > > +/** > > > > + * copy_struct_to_user: copy a struct

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Christian Brauner
about performance, but they would like their app to run. > > I'm not sure I agree that the limit is in place *forever* -- it's > generally not a break in compatibility to convert an error into a > success (though, there are counterexamples such as mknod(2) -- but that > was a ve

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to, from}_user helpers

2019-09-05 Thread Gabriel Paubert
On Thu, Sep 05, 2019 at 11:09:35AM +0200, Andreas Schwab wrote: > On Sep 05 2019, Aleksa Sarai wrote: > > > diff --git a/lib/struct_user.c b/lib/struct_user.c > > new file mode 100644 > > index ..7301ab1bbe98 > > --- /dev/null > > +++ b/lib/struct_user.c > > @@ -0,0 +1,182 @@ > > +//

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Aleksa Sarai
bably don't care > about performance, but they would like their app to run. I'm not sure I agree that the limit is in place *forever* -- it's generally not a break in compatibility to convert an error into a success (though, there are counterexamples such as mknod(2) -- but that was a very specifi

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Peter Zijlstra
On Thu, Sep 05, 2019 at 07:26:22PM +1000, Aleksa Sarai wrote: > On 2019-09-05, Peter Zijlstra wrote: > > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > > +/** > > > + * copy_struct_to_user: copy a struct to user space > > > + * @dst: Destination address, in user space. > > >

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Aleksa Sarai
On 2019-09-05, Peter Zijlstra wrote: > On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > > +/** > > + * copy_struct_to_user: copy a struct to user space > > + * @dst: Destination address, in user space. > > + * @usize: Size of @dst struct. > > + * @src: Source address, in kernel

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Andreas Schwab
On Sep 05 2019, Aleksa Sarai wrote: > diff --git a/lib/struct_user.c b/lib/struct_user.c > new file mode 100644 > index ..7301ab1bbe98 > --- /dev/null > +++ b/lib/struct_user.c > @@ -0,0 +1,182 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright (C) 2019 SUSE LLC

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Rasmus Villemoes
On 04/09/2019 22.19, Aleksa Sarai wrote: > A common pattern for syscall extensions is increasing the size of a > struct passed from userspace, such that the zero-value of the new fields > result in the old kernel behaviour (allowing for a mix of userspace and > kernel vintages to operate on one

Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers

2019-09-05 Thread Peter Zijlstra
On Thu, Sep 05, 2019 at 06:19:22AM +1000, Aleksa Sarai wrote: > +/** > + * copy_struct_to_user: copy a struct to user space > + * @dst: Destination address, in user space. > + * @usize: Size of @dst struct. > + * @src: Source address, in kernel space. > + * @ksize: Size of @src struct. > + * >

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Linus Torvalds
On Wed, Sep 4, 2019 at 4:29 PM Al Viro wrote: > > On Wed, Sep 04, 2019 at 03:38:20PM -0700, Linus Torvalds wrote: > > On Wed, Sep 4, 2019 at 3:31 PM David Howells wrote: > > > > > > It ought to be reasonably easy to make them per-sb at least, I think. We > > > don't allow cross-super rename,

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Al Viro
On Wed, Sep 04, 2019 at 03:38:20PM -0700, Linus Torvalds wrote: > On Wed, Sep 4, 2019 at 3:31 PM David Howells wrote: > > > > It ought to be reasonably easy to make them per-sb at least, I think. We > > don't allow cross-super rename, right? > > Right now the sequence count handling very much

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Linus Torvalds
On Wed, Sep 4, 2019 at 2:49 PM Aleksa Sarai wrote: > > Hinting to userspace to do a retry (with -EAGAIN as you mention in your > other mail) wouldn't be a bad thing at all, though you'd almost > certainly get quite a few spurious -EAGAINs -- &{mount,rename}_lock are > global for the entire

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread David Howells
Linus Torvalds wrote: > > Hinting to userspace to do a retry (with -EAGAIN as you mention in your > > other mail) wouldn't be a bad thing at all, though you'd almost > > certainly get quite a few spurious -EAGAINs -- &{mount,rename}_lock are > > global for the entire machine, after all. > > I'd

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Aleksa Sarai
;[*]. > > This is the only patch in the series that makes me go "umm". > > Why is it ok to re-initialize m_seq, which is used by other things > too? I think it's because we're out of RCU lookup, but there's no > comment about it, and it looks iffy to me. I'd rather ha

Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution

2019-09-04 Thread Linus Torvalds
On Wed, Sep 4, 2019 at 2:35 PM Linus Torvalds wrote: > > On Wed, Sep 4, 2019 at 2:09 PM Linus Torvalds > wrote: > > > > So you'd have three stages: > > > > 1) ".." always returns -EXDEV > > > > 2) ".." returns -EXDEV if there was a concurrent rename/mount > > > > 3) ".." returns -EXDEV if

<    1   2   3   4   5   6   7   8   9   10   >