Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6790707ybi; Wed, 29 May 2019 13:14:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxx3qdIMpxwRRpB8OTaX8Fm1+i8bAJMuCznDFTCpb+WKQbq57kGeCSCwJgtWoBW3dv3Nbv1 X-Received: by 2002:aa7:842f:: with SMTP id q15mr153874785pfn.161.1559160860752; Wed, 29 May 2019 13:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559160860; cv=none; d=google.com; s=arc-20160816; b=DL3tpK5cir5zHWEHCvN8zZrpVKvqDVC0Es5DglJoaLbSclFaE4X+Efw/RDMZT87aqe 6PdgF3p6/+h802v6D7fC4hSHgn99P53bZPR4Ls503c3kQ+oIUNTYusZtm9k1viA7JldV 0HKwGF52vnZziwAxWtaRVvLYxjP7AaFEF4KZ5OXU3MyYGLasDN0Fl6WtyW7hk9+TWIOz tM4xYJCtDFNqqVU2XFOaeK7CAOxGrvGgyY5HlKKdIE/6cqasT+GCSRlgsROBuetQ144G pMoTf5Kk/9aEmSMMWiuPAJsSYmFoD0+Rhj47P9FlouCaSslqBxNZ8v8aO6YpT7FVLyLc t+5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=0aft1pCaWtRYtnkCVrHz1gsURga5CiN4SjNK2Yoiqfs=; b=tjiJu7sTr1ZRbV3MAdp1xhfI25qHvj1Ac05uCV+wwa7RpmJhbByUdvxEJlIqL6PZwO 5gn2w7nlySrlhzPfileRiKym0ZxU8qt917i//mCcTMgw0RivcfZ4Vc4wUz787wiiK7Fz +svIjbThwEne9DfxoZdSAv9QySnkUDFCgy+tRWc5xob3nFca3AxptfvYe1WleVBFNYxr GMO89x6jXJt71nuF94+3r7tUN1JzbXV/QeclMZLCkibCTjWMldFPNP26lEL2qyfXwY5m DWoJ8uMHNf4Wgl+G6o0yHJsbCV7bImaev23dcuEa7n4VH6OAAanb3gsebtfwDnsufl6G sozQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XrzLaKA5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c20si725814pls.83.2019.05.29.13.14.05; Wed, 29 May 2019 13:14:20 -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; dkim=pass header.i=@chromium.org header.s=google header.b=XrzLaKA5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726723AbfE2UMc (ORCPT + 99 others); Wed, 29 May 2019 16:12:32 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41359 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726311AbfE2UMc (ORCPT ); Wed, 29 May 2019 16:12:32 -0400 Received: by mail-pf1-f196.google.com with SMTP id q17so2338191pfq.8 for ; Wed, 29 May 2019 13:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0aft1pCaWtRYtnkCVrHz1gsURga5CiN4SjNK2Yoiqfs=; b=XrzLaKA5MBHx0xlQKOcw3TIc85QvkhgJkO2JlDacDh+XCgUjABQyymyiZ/G560P5jJ HkAij558NkgyQQddecvDdQLSq5ZIicJMj+V7FdjS/5Qp/CTG9jIYFMaRFN3A7NFwUjgi FNTYdjrs48vkuDxAgacSirUU/cz2L2J9fobnY= 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; bh=0aft1pCaWtRYtnkCVrHz1gsURga5CiN4SjNK2Yoiqfs=; b=gX6fb4grNopRzpAxZbk2Qk/qEPbnTHYdH3dt+woH2oPE/zzsQOy54JVLSu81+U2+Tw 0EawgyRyGwz7Cz9yZGZnSmqZwSsxjSBDUyeCFnfCcQE9QEDCLaVXPvJo8zGHBI431/h2 NSVZI6J8YK2xRPupLDuHeFf20GoOd1CCq/nSGbuTeeQSOZ/W2ougyfH0aM7NcK4bp9pE ntbQTsekWoF/cXEY/w1oS3bhCc9v04lg6EEd3Q6pd9Rl6vGczQOgQJHTsK2TsgpqnNtC 70UJ2K8iwSdj8Od551E49yaUEHKbSb/ThkXtMm9bLiu+Lw2sX8wTVx5evEH2xJQ412AX Zfng== X-Gm-Message-State: APjAAAX3jZsLLVavsx6HBD90GWe63/ENOlI+QH1ZukrE9ASkeX5nvV8F PfbZ09jlB0W91VHtH1CunYnMdA== X-Received: by 2002:aa7:8d81:: with SMTP id i1mr126561827pfr.244.1559160746780; Wed, 29 May 2019 13:12:26 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d9sm220941pgj.34.2019.05.29.13.12.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 May 2019 13:12:25 -0700 (PDT) Date: Wed, 29 May 2019 13:12:25 -0700 From: Kees Cook 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 , Luis Chamberlain , 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 v4 12/14] mips: Replace arch specific way to determine 32bit task with generic version Message-ID: <201905291312.7B8EBE955@keescook> References: <20190526134746.9315-1-alex@ghiti.fr> <20190526134746.9315-13-alex@ghiti.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190526134746.9315-13-alex@ghiti.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 26, 2019 at 09:47:44AM -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 -Kees > --- > 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 c052565b76fb..900670ea8531 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; > -- > 2.20.1 > -- Kees Cook