Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2467022ybv; Fri, 21 Feb 2020 16:29:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyX4nGRegGbdU3ts544XSNGP/ZAQCCO0rDpIGjYZr/KAKoLaghHf63YkPxgQh/XbUpE4cY8 X-Received: by 2002:a9d:7852:: with SMTP id c18mr29275940otm.247.1582331398537; Fri, 21 Feb 2020 16:29:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582331398; cv=none; d=google.com; s=arc-20160816; b=SVrvFlMmF3hN1+jgClG5yihkzKRI+pmV8ndWi1l9W2COCgODZ6nJ3zhgUen3N87345 dRCE14Dh26ol1aoOdPouG0yLcWQ+rtBdldzGZmXOClr9X8Sq86s/bNZ1Ywp/p/IY/OUL ZCE/sP/nkKG8zlyqC9za5NBwHGeBim9q094bXbP0YGgwzsdeUSA1NrPsQP6MsRryxXk2 ZA99d570Aqc4Gl4ezfRCgX6Rz0EPiBFfmQb6r1UtDebte+2z5xv119iLzRme+uAEgRNe 5HopvysWc2j1VmwXuUx/ekaZQGVlvYw/JqRkyughHwKKlloKKgl3eWdyck9IiXHMCItt mnlA== 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=/3+ekiIDMOGmiDjrYAnNc8G9eXFhd69LzzwYliKSeDk=; b=J7fvAHfEj4uurN0ONZxV8y3BUBK/z7lbokSTMWMs82TH7K26n/YHZBFWzKdOqSGtR7 HaXN9tNFDf+oVdRnSCxJwXVVee1zYAojp4QgDmKkl2K8Guk38KIJaAq8xDy1O76DQg1T 2/k5919ND1yvowbor6TcgHhouhhMAJ/ZmI/Tb0i0l582ahyiCYWFK0S1/DKj3AuStXgk owBRPVO8jKCbWeBfBDSl1qg8nyE7IIG5eXZNwWkAODK5wpwZVa/HjSUj5Gsw7m69Q9zh mWNVSPh7I+OpYZ4+3Dv67Tn3OYktK64lFN/Ewp4cRmxb7V0w/IrhpN6c8gJC+f15/Kn9 vkQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UaeuT1T2; 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 69si2452666otv.190.2020.02.21.16.29.45; Fri, 21 Feb 2020 16:29:58 -0800 (PST) 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=UaeuT1T2; 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 S1727074AbgBVA3b (ORCPT + 99 others); Fri, 21 Feb 2020 19:29:31 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:35538 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726697AbgBVA3b (ORCPT ); Fri, 21 Feb 2020 19:29:31 -0500 Received: by mail-pj1-f66.google.com with SMTP id q39so1514006pjc.0 for ; Fri, 21 Feb 2020 16:29:31 -0800 (PST) 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=/3+ekiIDMOGmiDjrYAnNc8G9eXFhd69LzzwYliKSeDk=; b=UaeuT1T2xzPoXNPxlPuN7qgHSNKYaqFXhKAUALtPwg8DJgTO/AVDcCGa0WQzLMZBj6 ozTjHup3RowLqIjE0+/c9LeYRCxnA7HCkhT1nIb2BKK2fLUIVha0L9Wv2wsBpOxD3R2w QCDUb5IRlqbWRjl9Ud3gWtpP/Q71ObowauXB0= 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=/3+ekiIDMOGmiDjrYAnNc8G9eXFhd69LzzwYliKSeDk=; b=VHLT1kuCPXhhiEr43Eafwg+FIkfIo3KPdBJqAbeABcdRS4yp/BgYBGcnHH88zSwXha 00dqN8Baf69q7wFRfuH2hozYEY8kJaludS92a6oIz8WHsFWKvbkx5pFfHTmyKFVDLLli /lk6laFpHd+7mfmKM/uO0AoTeWQ2bn/Gi10Yp+xS9OCSsMw8q6R1ZNTYqxT0wTIVn7CF 4WeylEwXp3oxtwvkcdHiq5SYjl4Cl2TrrzSxL/qtwPe3PrxtqRVvKvRPAEE2JNe5pLbq +bCT9Cpn8FIXsTNI7Z7J/S6Vk5zqu94ChrMkba+5qPMEzzt78c/XXgo7tn7muLw2zaI5 +ZIQ== X-Gm-Message-State: APjAAAWJ3UIX7ObGOJBG6a5U8U5mXhi+hen4IfPR6wpsiZiEtjFLD1cM sUKtL7xO98vWKjSzQw652b/Jqw== X-Received: by 2002:a17:90a:8c0f:: with SMTP id a15mr6299848pjo.86.1582331371026; Fri, 21 Feb 2020 16:29:31 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id z5sm4213775pfq.3.2020.02.21.16.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 16:29:30 -0800 (PST) Date: Fri, 21 Feb 2020 16:29:29 -0800 From: Kees Cook To: Linus Torvalds Cc: Andy Lutomirski , Peter Zijlstra , Andrew Morton , Linux Kernel Mailing List , Jens Axboe , Jann Horn , Will Deacon Subject: Re: [PATCH] mm/tlb: Fix use_mm() vs TLB invalidate Message-ID: <202002211627.33D858AA@keescook> References: <6A09F721-0AD9-4B86-AB3E-563A1CF5ABDE@amacapital.net> <202002211506.2151CA26@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 21, 2020 at 03:57:21PM -0800, Linus Torvalds wrote: > On Fri, Feb 21, 2020 at 3:10 PM Kees Cook wrote: > > Why not just fail after the WARN -- I wrote the patch for the (very few) > > callers to handle the errors, clean up, and carry on. > > Can it actually fail? Or is this all just "let's add new error > conditions that make the code harder to read because they make no > actual sense"? I was just trying to see if there was a reasonable "do not continue and do stuff we just tested for". If this should just be WARN_ON_ONCE() and continue anyway, so be it. My general guideline is to avoid continuing a known-bad path. -- Kees Cook