Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2444768rwb; Fri, 11 Nov 2022 09:21:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf54gQmrmUuG6bfajPp4kWob4b3lc4Al2bc151e7kZmVQ/n0q+GpSYYtL8pRaddJUiY/eLRO X-Received: by 2002:a17:906:c185:b0:7ad:84d1:5b56 with SMTP id g5-20020a170906c18500b007ad84d15b56mr2822217ejz.205.1668187288270; Fri, 11 Nov 2022 09:21:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668187288; cv=none; d=google.com; s=arc-20160816; b=MHCpGWdswYC9R1sfGC5kuJHKir4H1Va1QUrEBnFLWOOcStPMrLWepph94RnJhiKTqj dNS5+arIp5TWJvJ3xoeR++7WpD7iTxcukjohDpikoVbtuLPH4zTbpDvSEEiMbnXuf+mU K9fnYZWnW0kht+cXwW9kb5Vfa3ihEyNqCi48Gq5H1JSAsdOb4vYBn/jNDz45JycIx+Zt yR0HlgCyeZxJ5icX2WvZieTyAJqxZnCbgMVnHI3y8IQHhVfLinpAg+ix19IDvjE3Vovx ackPW5hggQxbTIFWcR19LP9jY7t+/M/RccrzG51O6W58Y6dJKb1Vt7JZbnZW4EZ9H360 pEgw== 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:in-reply-to :references:mime-version:dkim-signature; bh=VaPoeYE4uEi9Lmo7p9yRpFWEg7l1U2uEZTo6yD3TkRM=; b=i26GDhPTM8Bv07TJKZO9wsu4U6zJP8XrRVOFBoKPGT/ryDo9Q3b+ba0v0c9gBjwh59 YkJgNY3p5XsWXR0mq/no9skhxMb0ZgAkOyBEdZhHbVJWd3/PWrLm9+A2BXRGhcyof1CS gARkWXIOUYGD1aiuNgm36GTk2SmykXp3RG7BYcjObCbaQcVnGlxDnvrJJWqCspF4ekur SZSVTmN2theemWOtNW+bvto7vyYiY060E90Zm32DKsUqbEhQuhaC59851Cs1FE4NmbB/ XawF40fhu9B6Q1yKLM5QTwrSRl81LfRL9L2nBAniwwGyHyuwncgaf2BxHCCaCPf5hyvn c9yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lghTviNW; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h10-20020a05640250ca00b00461540620f1si1429363edb.169.2022.11.11.09.21.05; Fri, 11 Nov 2022 09:21:28 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=lghTviNW; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234180AbiKKRPD (ORCPT + 91 others); Fri, 11 Nov 2022 12:15:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234229AbiKKRPA (ORCPT ); Fri, 11 Nov 2022 12:15:00 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BD493C6CF for ; Fri, 11 Nov 2022 09:14:59 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id gw22so4938204pjb.3 for ; Fri, 11 Nov 2022 09:14:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VaPoeYE4uEi9Lmo7p9yRpFWEg7l1U2uEZTo6yD3TkRM=; b=lghTviNWaq+AkqOQRd5UDvTAxXSEy7IeXOvFlezCg3KZ4VkOUh3Wn9AWjzmSqeMVPI 9tWkEXiZLMR/IpUAKuosI6h+Ykg6p/T0hfs0PxodRkgccD5nWAaZvyo86cvt7/d0Gqf/ tIMkuvVR+AnDBd4cGDrAGKwgGqHZMSSabod95GAhwceSSImLnx0AmzMJadnWp/a05+gd waUrejkaon/AJK/xfGprBQm2ML5Wr+cj/vSiP2zlcUjjCKLUc0imwHpPy+7VKWxOPLOp x+9cTL2iXG4G8PCQsgxeZsXYBkQNyPmgO4SpOvK604wJLBKbv7aiscKSOL8FNzai3zzO 4E/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VaPoeYE4uEi9Lmo7p9yRpFWEg7l1U2uEZTo6yD3TkRM=; b=jrVT/TrDKcFCl746ZP9rRB7xgkPnHChq2pXQBYDqQ/p7aEohKyxfnOoZYPvlBfhf+1 DCGm6rZebuxIITJNbX5CCnPZHU6cpdvtVj6FXdEaSZaoZ40C4Nnzo/p7qFEatFX894Ej wZ5ZMOx8jCww/2MKU4T2FnR3xecVB3A9B1aFUcP67SjKEGQFHk4XXX0wMeAsAzJ2zDk9 VKn6VwQM/swF6o4PHwk4gc1trEXT5cSdv8t+LlBwPfMy4rxBVCwRwFASCAV/jS127H+t KyUqj62tg4Vki9ZChzvHOdOeYwNHDImYLMBbQNUbM11Yeg+St4oEFA/actzKMnn3Ppqy RETw== X-Gm-Message-State: ANoB5plIGv0hO0m1/Ql9ATDzRaqqrf3R56Q+UbvKH8lfFg56mNfLVxvy DJQnkz7CUPcS6xjKc/FGEbbp5+r6kBbG2UOfCTk= X-Received: by 2002:a17:902:6ac6:b0:186:a8c1:884f with SMTP id i6-20020a1709026ac600b00186a8c1884fmr3630644plt.25.1668186899027; Fri, 11 Nov 2022 09:14:59 -0800 (PST) MIME-Version: 1.0 References: <20221108110715.227062-1-pedro.falcato@gmail.com> <202211101934.22CACD615@keescook> <202211102214.D764FAE21@keescook> In-Reply-To: <202211102214.D764FAE21@keescook> From: Pedro Falcato Date: Fri, 11 Nov 2022 17:14:47 +0000 Message-ID: Subject: Re: [PATCH v3] fs/binfmt_elf: Fix memsz > filesz handling To: Kees Cook Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, dalias@libc.org, ebiederm@xmission.com, sam@gentoo.org, viro@zeniv.linux.org.uk Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Fri, Nov 11, 2022 at 6:15 AM Kees Cook wrote: > > On Fri, Nov 11, 2022 at 03:59:08AM +0000, Pedro Falcato wrote: > > We could of course also just sort the program headers at load time, > > but I assume that's unwanted overhead for most well behaved ELF > > program headers :) > > Large refactoring of the ELF loader needs proper unit testing, and we're > still a bit away from that existing. In the meantime, we'll need to make > very very small changes to fix bugs. I've sent a minimal change which I > think should fix the problem (now at v2 since right after sending it I > realized I was trading one accidentally correct state for another in the > v1): > https://lore.kernel.org/linux-hardening/20221111061315.gonna.703-kees@kernel.org/ Got it. I understand you may be a bit nervous deploying this patch ATM. What are we missing for ELF loader kunit testing? How can one help? Note that my -v1 is still relatively safe and was already tested, you could just apply that. Thanks, Pedro