Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3051828rwe; Sun, 16 Apr 2023 10:33:51 -0700 (PDT) X-Google-Smtp-Source: AKy350agggMYJHttP1hDXNhEiak1XBK+jWTtzjdOREJAUo3VzZcm/Tt1xL9Xy+IalBDHs9mOoWab X-Received: by 2002:a17:902:e80f:b0:1a6:e27a:8a4d with SMTP id u15-20020a170902e80f00b001a6e27a8a4dmr72696plg.2.1681666431481; Sun, 16 Apr 2023 10:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681666431; cv=none; d=google.com; s=arc-20160816; b=0EgNwAY//sq6Upknu4m35gnppX9qnfxbDFe5lIV06QEHbyq6HIaqT1nKZHF/pzoOky 8fnEeayPqtUUtfiYhEFzh1JQVA5zvCQd1+q8WcyWP8WEc9h626ZRDFtlEP5zvSpMqcyP tiXKoNif7qpi2dytCGesBY9WUpvIFA5Gex6Thvy0imrYPPsN1e2YFVW92ZmbHUaPAu6S aQx00+STr2g6z/ceeBdMgcLrRkA/aRDHZVIKfxkyd9yLaaOgTPO+qxIMk4MJE/nhc2Ob 1xHKs7B8pegkNwBgnweSz0W+0B0gATPLsWF0nI5hhl/ltbvYSSCyGi9gI2rs7rADaOY8 aiIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:references :in-reply-to:mime-version:dkim-signature; bh=5YTV6RJSLLGsh4cCjIblt3GFNcM3RSEdifI1BEleZbs=; b=mlJqymtjPleKVcDuZrBlL83QMJWsrYOTi8qpeKY2wJ77P4NvSTuIHj/7+Z6u+OOE1+ gU7w5tqWGm9blzzoAAYt/zjOUdnEM56HHBj8DiGoJXa0ZwSL/RWQ3Qid5Z7BwmNtUqrU 27Rbmv4Yv6bVbkIdrTr0UX6TPPvj+oMeu8y7dd0/GfgvLSB5lMhopez4xVQEVF9jL4VW Z8HKvooJKCtuy5c+Z8/x4a3Se7Na4Q/HRjNimXSXP37OYiKbVy6PNzvBOmqi4sOs3eEV n7ea1H5H57L5AGtcc7Mhx5HZsQievPZTApvLbaaLGVGV5wlQGJKZ8IP/BfZotZzX64Lt KE7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=NvYyy6RX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a170902e85200b001a69f09867dsi1461902plg.570.2023.04.16.10.33.39; Sun, 16 Apr 2023 10:33:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=NvYyy6RX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229715AbjDPR0V (ORCPT + 99 others); Sun, 16 Apr 2023 13:26:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbjDPR0S (ORCPT ); Sun, 16 Apr 2023 13:26:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A41C30F4 for ; Sun, 16 Apr 2023 10:26:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0736B61BE6 for ; Sun, 16 Apr 2023 17:26:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 422E8C4339C for ; Sun, 16 Apr 2023 17:26:16 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="NvYyy6RX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1681665971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5YTV6RJSLLGsh4cCjIblt3GFNcM3RSEdifI1BEleZbs=; b=NvYyy6RXhM74TLQcpWzzhJgDUcpHwv/flgaFiK0ugy919JR+j+HROl5R0h0pPyZNO3XLB4 wr1cNCEXb96QqKwwwzYjVUdiwV3gmFc0nYreQ6WLQHAkKLs/kyj9DWFf8V7LGXf7YImUWu ewuQNiHpqUbDL4YML4RtU2S2xi0f9+c= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 1b548319 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Sun, 16 Apr 2023 17:26:10 +0000 (UTC) Received: by mail-ua1-f46.google.com with SMTP id a19so865231uan.1 for ; Sun, 16 Apr 2023 10:26:10 -0700 (PDT) X-Gm-Message-State: AAQBX9d9hNhX3MgmNunLJ9cPU9yGTYGyEFqJ9R4xHSso9teyPF6zx3FK lh3fzdYvY1C2uJXBOOOgQX7k2df2BubDzEDK+BE= X-Received: by 2002:a1f:ad91:0:b0:43f:df8d:cfe2 with SMTP id w139-20020a1fad91000000b0043fdf8dcfe2mr5740273vke.2.1681665969091; Sun, 16 Apr 2023 10:26:09 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:2799:0:b0:75c:e750:ab with HTTP; Sun, 16 Apr 2023 10:26:08 -0700 (PDT) In-Reply-To: <20230416172323.13278-1-david.keisarschm@mail.huji.ac.il> References: <20230416172323.13278-1-david.keisarschm@mail.huji.ac.il> From: "Jason A. Donenfeld" Date: Sun, 16 Apr 2023 19:26:08 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 3/3] arch/x86/mm/kaslr: use siphash instead of prandom_bytes_state To: david.keisarschm@mail.huji.ac.il Cc: linux-kernel@vger.kernel.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , keescook@chromium.org, ilay.bahat1@gmail.com, aksecurity@gmail.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham 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 4/16/23, david.keisarschm@mail.huji.ac.il wrote: > From: David Keisar Schmidt > > However, the seeding here is done by calling prandom_seed_state, > which effectively uses only 32bits of the seed, which means that observing > ONE > region's offset (say 30 bits) can provide the attacker with 2 possible > seeds > (from which the attacker can calculate the remaining two regions) > > In order to fix it, we have replaced the two invocations of > prandom_bytes_state and prandom_seed_state > with siphash, which is considered more secure. > Besides, the original code used the same pseudo-random number in every > iteration, > so to add some additional randomization > we call siphash every iteration, hashing the iteration index with the > described key. > > Nack. Please don't add bespoke new RNG constructions willy nilly. I just spent a while cleaning this kind of thing up.