Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9838136ybi; Wed, 24 Jul 2019 10:49:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3Re8CkV/qSrtRvEKN0YwzLafxFixIQBG9qVIG0ShORtVnfVFaUZPIRAO+5IOaESl5zfGW X-Received: by 2002:a62:3543:: with SMTP id c64mr12206856pfa.242.1563990590577; Wed, 24 Jul 2019 10:49:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563990590; cv=none; d=google.com; s=arc-20160816; b=EznLWYbO7ArrTdZ61MgnGR3mFTBfZNcUfJhdXTCjV8HYxPkn0rlYZ9+BwFxOFBTDs9 ZofUMy1kajkRoRkV8CzS0iSLYvwiQZCddehBLeg7kNPUVyTOEdgJswnceYgZtFdlq+va SMa+EEyD7CAlR1vLE1aCvyLIjjWZ21Y43+ZTQLkyVgy8JTIp7huztjdocQ9/DdFpi+m/ xJoNt6nXyrca+q0z172+BcTqM2cIHAk3c1WYesd8BAbfj+qRnYvRSmgZO3nTS91yBZ6P vaOxz/FwRr3Z4A0N2XO51WQKF0MjYG1Vntnj2oFjG0P4VNWgrg495WeTg/BNoumSJbps qjow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=156P/sv9kl3W4lzShHBiZ6Cb3GP3B3vD0ubCKwHKThU=; b=Yyf6qyKzWuIqWjXYB5prXRnK1XmYnSjxNd7bIr5RLmu5+zPFpEc4GPZHH9l9oBNX2j +AXYmyrc6IehS/KbnGTDsg7EdQmI3S43kVzWCKEQa+CF6Yfdwn+OfIUeg4bssV7gTOtM Unh/tpopWP463Xyy10unzQ8Ih7AAlchW3ncObvRuILy4JwcwHQgkFL4j5jlUjWGl7XaD mBTVoltUAEQ1bo4pZz8Q+4HU3JYaMbQ52b7ptHx+ZGttWFjkPuZqAvX7MOS8kjrawAaI Z/K/3PTM32WDQfTyTbIPlJl8ZcH01mhHIr8dLTXR3IXGtN7UF/YSabRLlwbgOXohlhz/ BuBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68si14378632plc.269.2019.07.24.10.49.35; Wed, 24 Jul 2019 10:49:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727962AbfGXRQx (ORCPT + 99 others); Wed, 24 Jul 2019 13:16:53 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:33055 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726074AbfGXRQv (ORCPT ); Wed, 24 Jul 2019 13:16:51 -0400 Received: by mail-pf1-f194.google.com with SMTP id g2so21278490pfq.0; Wed, 24 Jul 2019 10:16:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=156P/sv9kl3W4lzShHBiZ6Cb3GP3B3vD0ubCKwHKThU=; b=ogZkITl+R1w0hlSIWbPt04yOFXv9P1LNco/jXgKGy6aCdE5vvKx725w0Yn5VLJQsGT flYPS3UmtM44igz+SqHnUdE1uRJXIg7BOnlu+/LOWDPyT/j7pZ3dN7G7kWpS3ioASkTs 5Z5unLj5Uq2mFnJ8qvBvnVqCCzFn/gMLRjLq8TEDqaAiXAgUyYu/Psg5B2pTjRndZg7U QebIeliYQQczUaMNqVVoBwyp6vVOBfv1uDVsuRTr4h0DLnkrk6F3rlPdyAH3mmzBGxxC dB6WRBN691blgNgtINJ/cWxZPKv0VBvcCP0u8sEbgfXQGGSH+99KBbTD2tXP3P8jlcBz MSDg== X-Gm-Message-State: APjAAAXJbteQYt2/BlkRDh3PDcca0tn7Lv0JStjcMeM8Pyrp/2vdQHXP xVP/ku5ZyOBQMH4pIhJ1v4Q= X-Received: by 2002:a17:90a:8a91:: with SMTP id x17mr89006769pjn.95.1563988610289; Wed, 24 Jul 2019 10:16:50 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id n140sm49450927pfd.132.2019.07.24.10.16.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 24 Jul 2019 10:16:49 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id ADB7B402A1; Wed, 24 Jul 2019 17:16:48 +0000 (UTC) Date: Wed, 24 Jul 2019 17:16:48 +0000 From: Luis Chamberlain To: Alexandre Ghiti Cc: Andrew Morton , Christoph Hellwig , Russell King , Catalin Marinas , Will Deacon , Ralf Baechle , Paul Burton , James Hogan , Palmer Dabbelt , Albert Ou , Alexander Viro , Kees Cook , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH REBASE v4 12/14] mips: Replace arch specific way to determine 32bit task with generic version Message-ID: <20190724171648.GW19023@42.do-not-panic.com> References: <20190724055850.6232-1-alex@ghiti.fr> <20190724055850.6232-13-alex@ghiti.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190724055850.6232-13-alex@ghiti.fr> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 24, 2019 at 01:58:48AM -0400, Alexandre Ghiti wrote: > Mips uses TASK_IS_32BIT_ADDR to determine if a task is 32bit, but > this define is mips specific and other arches do not have it: instead, > use !IS_ENABLED(CONFIG_64BIT) || is_compat_task() condition. > > Signed-off-by: Alexandre Ghiti > Reviewed-by: Kees Cook > --- > arch/mips/mm/mmap.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c > index faa5aa615389..d4eafbb82789 100644 > --- a/arch/mips/mm/mmap.c > +++ b/arch/mips/mm/mmap.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > > unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */ > EXPORT_SYMBOL(shm_align_mask); > @@ -191,7 +192,7 @@ static inline unsigned long brk_rnd(void) > > rnd = rnd << PAGE_SHIFT; > /* 32MB for 32bit, 1GB for 64bit */ > - if (TASK_IS_32BIT_ADDR) > + if (!IS_ENABLED(CONFIG_64BIT) || is_compat_task()) > rnd = rnd & SZ_32M; > else > rnd = rnd & SZ_1G; > -- Since there are at least two users why not just create an inline for this which describes what we are looking for and remove the comments? Luis