From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75702C3A5A2 for ; Fri, 20 Sep 2019 16:30:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48AEE2086A for ; Fri, 20 Sep 2019 16:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568997012; bh=+PTnT10ZI2ZRJq/fO+rMaNRm4KIdJPYWzc2S039iTj0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=vdJ9s0gYDu4xsTRDYkYrmE/HjmWbVV+xv9GWhlW6An8xmXjR9mHzGK4AmMj7XTbV3 pjxhIfZY+5ZS4OWcl6v5UqibGlzGEAihSh32Vh4Tr9CJzhJePFJICX2q1kASWUwVZc yyfxh4wTPHrkfoVCxC8bAmSzJq/a3Cddy81w8uUU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387631AbfITQaM (ORCPT ); Fri, 20 Sep 2019 12:30:12 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:46297 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728861AbfITQaL (ORCPT ); Fri, 20 Sep 2019 12:30:11 -0400 Received: by mail-lf1-f67.google.com with SMTP id t8so5436156lfc.13 for ; Fri, 20 Sep 2019 09:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3qfHDj62HozW8w7YWwj9CkN9/sQfc3fOAZsNubcgArY=; b=ZQIGHEoM2VE/RUJCyR8wJqhG4SoL3m5ky7t1mnKhLv11uqJxbD6lRJm5k/4ajS8Sdo UMhvXa/MmA5zyCc/ENaP9s79+xZOTrHtnrS7z9ra7Xe2HT/ekZVmC2KO+GbdBvDc35H9 t5l05A8TLonE+2sI7SlSpw7F1/5/t4r9zscBw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3qfHDj62HozW8w7YWwj9CkN9/sQfc3fOAZsNubcgArY=; b=bOA08cnZpTWP5dwnMQqHHYrTR3yxG0YXBunch2D2/IBu9lRDpUKav6wyi7lD6IDt1X zR2R8xFNP0gVAl/KtCGTWoXrPTpzZHyV20cm6F7pfh1Z95utv1ds6gJJqSuxo458GK2D KMEEqcx13syTmaYfvOAI45ABvjmTfScTsDLJFnAw8tVm7Pf9GgMU6T3hCKwb02Hc1kXJ 6fSzHZzUoknPBjjuFoQxXQecsBfb8UFBZ1qMX0llIfK8xVf32qJQVvBWt/H0KUtBcy76 7YTK8rytv0QE+Z9egWsaV4aO84kQRQf5+6qLDzV9PvlyVgeXfDPVT8hT2OHJomi1gxAC 8mZg== X-Gm-Message-State: APjAAAWZ4CcIhcdlrmOatqV92DgDaln2fkz3P8uT4sKrMgW/3vC1UKux U7WhlKG8FENn/is+7pA/4KHuVe1iQ/8= X-Google-Smtp-Source: APXvYqwk+UYUHei5gEKhTZGzgrRXnQnFi7IxDK58NqGJTyF52i8MGhKkovPK+d4hZOHDVGU3gZg84g== X-Received: by 2002:a19:4a10:: with SMTP id x16mr10024873lfa.126.1568997009378; Fri, 20 Sep 2019 09:30:09 -0700 (PDT) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com. [209.85.208.172]) by smtp.gmail.com with ESMTPSA id 21sm544297ljq.15.2019.09.20.09.30.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Sep 2019 09:30:08 -0700 (PDT) Received: by mail-lj1-f172.google.com with SMTP id v24so7702586ljj.3 for ; Fri, 20 Sep 2019 09:30:07 -0700 (PDT) X-Received: by 2002:a2e:96d3:: with SMTP id d19mr411864ljj.165.1568997007674; Fri, 20 Sep 2019 09:30:07 -0700 (PDT) MIME-Version: 1.0 References: <20190912034421.GA2085@darwi-home-pc> <20190912082530.GA27365@mit.edu> <20190914122500.GA1425@darwi-home-pc> <008f17bc-102b-e762-a17c-e2766d48f515@gmail.com> <20190915052242.GG19710@mit.edu> <20190918211503.GA1808@darwi-home-pc> <20190918211713.GA2225@darwi-home-pc> <20190920134609.GA2113@pc> In-Reply-To: From: Linus Torvalds Date: Fri, 20 Sep 2019 09:29:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC v4 1/1] random: WARN on large getrandom() waits and introduce getrandom2() To: Andy Lutomirski Cc: "Ahmed S. Darwish" , Lennart Poettering , "Theodore Y. Ts'o" , "Eric W. Biederman" , "Alexander E. Patrakov" , Michael Kerrisk , Willy Tarreau , Matthew Garrett , lkml , Ext4 Developers List , Linux API , linux-man Content-Type: text/plain; charset="UTF-8" Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Sep 20, 2019 at 7:34 AM Andy Lutomirski wrote: > > What is this GRND_EXPLICIT thing? Your own email gives the explanation: > Linus, I disagree that blocking while waiting for randomness is an > error. Sometimes you want to generate a key That's *exactly* why GRND_EXPLICIT needs to be done regardless. The keyword there is "Sometimes". But people currently use "getrandom(0)" when they DO NOT want a key, they just want some miscellaneous random numbers for some totally non-security-related reason. And that will continue. Exactly because the people who do not want a key by definition aren't thinking about it very hard. So the interface was very much mis-designed from the get-go. It was designed purely for key people, even though generating keys is by no means the most common reason for wanting a block of "random" numbers. So GRND_EXPLICIT is there very much to make sure people who want true secure keys will say so, and five years from now we will not have the confusion between "Oh, I wasn't thinking about bootup". Because at a minimum, in the near future getrandom(0) will warn about the ambiguity. Or it will use some questionable jitter entropy that some real key users will look at sideways and go "I don't want that". This is an ABI design issue. The old ABI was fundamentally misdesigned and actively encouraged the current situation of mixing secure and insecure callers for that getrandom(0). And it's entirely orthogonal to _any_ actual technical change we will do (like removing the old GRND_RANDOM behavior entirely, which is insane for other reasons and nobody ever wanted or likely used). Linus