Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4442520pxb; Mon, 21 Feb 2022 21:45:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJydOttb+y7FVyB59Hp8O/WLYhYbCknvLY2t23JEoqOPHGr9HvWmH4rWZZRrsOi4x6v5CS12 X-Received: by 2002:a63:4c55:0:b0:36c:54eb:fc44 with SMTP id m21-20020a634c55000000b0036c54ebfc44mr18323019pgl.323.1645508757225; Mon, 21 Feb 2022 21:45:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645508757; cv=none; d=google.com; s=arc-20160816; b=k3QB6IjFGx8QHw8byyc3vETxhB7lc11GNCkSboBnMRtTSipGe2+0KtBwXjGvjHSMD0 PeC5G5UZ7oxJgPoZw2PdioKniiCgGvEDu8RROLdrsFG2fjlVDS/V7F558pPgnrBHYLHa 3tIAGzT/6iD/tmKHHA279e5HwOV5ZumZg0sGxWa5lFpZDaugENQCnkYC/4dwdZ7P82Ml oXO4PQGOA8RxUlNh8SL8unzS/XT4/wQ/IP/b8j0jhdQBZI1JPPVxXMMEA7i4akxPG2sL P/OtXMvEGSA0SaLruwLh56pm26FkNqV7YAxIALWgLPSughLLm5cM8OJk6FIBl1NfLE5m fctw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ZzLXG06RAH4GEiOUDV4e+gFBWzLUcxGvszmWjbhrw9Y=; b=XNvOAV46XnbvsPI5JQmW1FymI0IOPcotaRKil8rnNqwevept5YYsp58fP96auSuQZ6 /w4hcmYnKO46yHK7QC/BMuFIb5bcupyNDOVFpgCKcALHzt1mhACzde9Xd6uuzkGZFQe+ a43ADRUksW/suA7YuTuIbMQuDOYA2vTgHUMo4mCLlNXBLue9nT6kGfHap1AQmB8Fj+Z2 UeL4rYjebKPipKFexa2jC4eBGETQBcCn/+1y7oy2JcSHJ/ry1WOeAKUsZxSxb2MBDG5x kSwbcGjFJO+U2i7jHJ0MPSMtW8IE9+zS8qpSO2HTbTUeqL3j1kWQXu3hnR381JMxV1UL G2vA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q64-20020a17090a754600b001bc3872e96fsi1184562pjk.43.2022.02.21.21.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:45:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 40C79CCC66; Mon, 21 Feb 2022 21:10:59 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359063AbiBUN0L (ORCPT + 99 others); Mon, 21 Feb 2022 08:26:11 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359028AbiBUN0J (ORCPT ); Mon, 21 Feb 2022 08:26:09 -0500 Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0CE4F21E21; Mon, 21 Feb 2022 05:25:44 -0800 (PST) Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1nM8h9-0001Eo-00; Mon, 21 Feb 2022 14:25:39 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id E4525C25DD; Mon, 21 Feb 2022 14:24:56 +0100 (CET) Date: Mon, 21 Feb 2022 14:24:56 +0100 From: Thomas Bogendoerfer To: Arnd Bergmann Cc: Linus Torvalds , Christoph Hellwig , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, arnd@arndb.de, linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, linux@armlinux.org.uk, will@kernel.org, guoren@kernel.org, bcain@codeaurora.org, geert@linux-m68k.org, monstr@monstr.eu, nickhu@andestech.com, green.hu@gmail.com, dinguyen@kernel.org, shorne@gmail.com, deller@gmx.de, mpe@ellerman.id.au, peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, hca@linux.ibm.com, dalias@libc.org, davem@davemloft.net, richard@nod.at, x86@kernel.org, jcmvbkbc@gmail.com, ebiederm@xmission.com, akpm@linux-foundation.org, ardb@kernel.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org Subject: Re: [PATCH v2 09/18] mips: use simpler access_ok() Message-ID: <20220221132456.GA7139@alpha.franken.de> References: <20220216131332.1489939-1-arnd@kernel.org> <20220216131332.1489939-10-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220216131332.1489939-10-arnd@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 16, 2022 at 02:13:23PM +0100, Arnd Bergmann wrote: > > diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h > index db9a8e002b62..d7c89dc3426c 100644 > --- a/arch/mips/include/asm/uaccess.h > +++ b/arch/mips/include/asm/uaccess.h > @@ -19,6 +19,7 @@ > #ifdef CONFIG_32BIT > > #define __UA_LIMIT 0x80000000UL > +#define TASK_SIZE_MAX __UA_LIMIT > > #define __UA_ADDR ".word" > #define __UA_LA "la" > @@ -33,6 +34,7 @@ > extern u64 __ua_limit; > > #define __UA_LIMIT __ua_limit > +#define TASK_SIZE_MAX XKSSEG this doesn't work. For every access above maximum implemented virtual address space of the CPU an address error will be issued, but not a TLB miss. And address error isn't able to handle this situation. With this patch diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c index df4b708c04a9..3911f1481f3d 100644 --- a/arch/mips/kernel/unaligned.c +++ b/arch/mips/kernel/unaligned.c @@ -1480,6 +1480,13 @@ asmlinkage void do_ade(struct pt_regs *regs) prev_state = exception_enter(); perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, regs, regs->cp0_badvaddr); + + /* Are we prepared to handle this kernel fault? */ + if (fixup_exception(regs)) { + current->thread.cp0_baduaddr = regs->cp0_badvaddr; + return; + } + /* * Did we catch a fault trying to load an instruction? */ I at least get my simple test cases fixed, but I'm not sure this is correct. Is there a reason to not also #define TASK_SIZE_MAX __UA_LIMIT like for the 32bit case ? Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]