Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2360712ioo; Sat, 28 May 2022 11:14:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTjaYA/HTTkJCQw/3XRLmp3I1wJNKtI54qsxs4sdW2UkiQjUa5ngj+Y6P3OkjgnOPOuOi3 X-Received: by 2002:a63:5304:0:b0:3fb:92eb:8e90 with SMTP id h4-20020a635304000000b003fb92eb8e90mr9697139pgb.36.1653761693519; Sat, 28 May 2022 11:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653761693; cv=none; d=google.com; s=arc-20160816; b=h4ijNa95l/ON9fKl7wLDZDBRP6xE5R7Iy23QnUMrgRcNT30teHwDNxIKQctuKpVF6Z LBlNu1uWC7LLJXW5AztLIGKUEN2IWFe5Ts1sCctX8fZAEyf7+EdhXWRN1OkYx9etUpAV M9etQIGfJbKmvAVce8N8lB1cyjgi5FGajvxFAaoxVpjiqpdHm7ptwGrFwQhEzSceQLt+ r5b5Txhb9dnD6pt30boJwC/Jo4f3yIhhkf63+29siTOBH/+RpC73AiUcbXOBNdNYtre9 7NMSFkUG5XWyA+KSpbBgPrRx4Zj4OjTw3pRC5bplS1ZPwyxctSIhqSglzOh6RBVDyc+j MTkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=46Dlx32NeqKGFqR8tbrXUNfX16XzYXTLkkklq3uKPP0=; b=hr7mp5jFXc9SQNxNOilkhJ4fCs2diJ+is/PoflNUtHXDBYtzzsN7NqIJpXKGBt1/j8 HcEWeUzQ2tcSQPtW6dDqhHU2qFolBKHqy5QnE1R7le8ct5FjzKIe6gwux6V5PpY6v4l3 /5/VKmkMHNHfBw4UDytCr9dP1WZ9MvDd9c3NiAWw6lhlAyMo7OzfenPv+rTu8tlgxUsk aKpQs/7AuGEBz7ZBONw2w0xx/pNNCb+PLp88ISkTWe2QIhMx7HLYfuWlo0gSTm6AWBu5 r2iF7vjOyktyBk29YslByUX+xbwJpsa1rvZRpAEthpp9axJGREgdOnxfunilAbYqExkv Y/tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b="Q11Qs/nv"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id pg12-20020a17090b1e0c00b001e2ab1788fcsi2427734pjb.139.2022.05.28.11.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 11:14:53 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b="Q11Qs/nv"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C474413EBC; Sat, 28 May 2022 11:14:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbiE0BB5 (ORCPT + 99 others); Thu, 26 May 2022 21:01:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbiE0BB4 (ORCPT ); Thu, 26 May 2022 21:01:56 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E36BCFE24 for ; Thu, 26 May 2022 18:01:52 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id c93so2359457edf.7 for ; Thu, 26 May 2022 18:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=46Dlx32NeqKGFqR8tbrXUNfX16XzYXTLkkklq3uKPP0=; b=Q11Qs/nvN2wel2x5/i/9VjArjDYQjfKrAZ+fhH/W0+KOWfFkEi/xS/zr9F6Tq6iBgs vhx5bOOVc7xCOcb5Y6zHvq4ZRFL42ey5ZrtXhP+EU+URraJZWaUSgEA5RJnwtVYsMysC yn3a5qeWCuEq/69pgfEjfFTs28A35NpOfm5aQ5ENPMSeYfS4ux7exnMnt+GWLAPgNrYO 0hC7dFiPIKOB0JsnNy+AJPt4PNXns5ApBk2/EJmFsbAhveW5OwRgTnk/ikhvTrknIsP1 F7wWduPV44+NCTh+FR0e+bd4vuVoLXPdwj1HRfSEejgFyZky9MqwfvagfFkM8aFwC3m7 CszQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=46Dlx32NeqKGFqR8tbrXUNfX16XzYXTLkkklq3uKPP0=; b=TonpKLIYgqqbhTuZisVtYgLXK7IJR7KGi15QMJptdefL+Z+n6pJX3+4r9fzui1K2S3 kVzU5mts1d149cieCnzAuZ8s3Gw/SIGUZG/881QCOczHOpI2aQXaEYXZU/6VOm3AbpcY V43qZRQojux/NKGUfsKVLZs+/NPQa2dtjkS9vFFwkJvOZjfmq2S77wvD6IiauaMlKSmm IM1vTxO3oM1lVuhTI3phMbE6brG52Qm9GA8m2+13M5HFle7IeKOvwsa+GOqEMkV9YwDj d2h7r9qczoIFZMKen7CkkxrCS5R5ocdnGykDzRIMFKMgC7g1O8HOSvUns8JOMNhjDkib ET3w== X-Gm-Message-State: AOAM531n8zF5KJfepfGuXovLivtMUP1oHhZ2IGgiffGqcTp1rKjG996f aA7vL1cSdUC6siGK9sIBWoi8SQpqbuSZnH6dkCceqg== X-Received: by 2002:a50:ea8b:0:b0:428:7d05:eb7e with SMTP id d11-20020a50ea8b000000b004287d05eb7emr41396599edo.185.1653613310665; Thu, 26 May 2022 18:01:50 -0700 (PDT) MIME-Version: 1.0 References: <20220526203805.3659597-1-tatashin@google.com> In-Reply-To: From: Pasha Tatashin Date: Thu, 26 May 2022 21:01:14 -0400 Message-ID: Subject: Re: [PATCH] kexec_file: Increase maximum file size to 4G To: Pasha Tatashin , Sasha Levin , "Eric W. Biederman" , kexec mailing list , LKML , rburanyi@google.com, Greg Thelen Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, May 26, 2022 at 4:45 PM Pasha Tatashin wrote: > > On Thu, May 26, 2022 at 4:38 PM Pasha Tatashin > wrote: > > > > In some case initrd can be large. For example, it could be a netboot > > image loaded by u-root, that is kexec'ing into it. > > > > The maximum size of initrd is arbitrary set to 2G. Also, the limit is > > not very obvious because it is hidden behind a generic INT_MAX macro. > > > > Theoretically, we could make it LONG_MAX, but it is safer to keep it > > sane, and just increase it to 4G. > > > > Increase the size to 4G, and make it obvious by having a new macro > > that specifies the maximum file size supported by kexec_file_load() > > syscall: KEXEC_FILE_SIZE_MAX. It appears that since: f7a4f689bca6072492626938aad6dd2f32c5bf97 fs/kernel_read_file: Remove redundant size argument Introduced a change to kernel_read_file to limit the maximum file internally from SIZE_MAX to INT_MAX. Therefore, more changes will be needed. I will work on them and sent them in v2. > > > > Signed-off-by: Pasha Tatashin > > Should be instead: > Signed-off-by: Pasha Tatashin > > Thanks, > Pasha > > > --- > > kernel/kexec_file.c | 8 ++++++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c > > index 8347fc158d2b..1be2227b33e6 100644 > > --- a/kernel/kexec_file.c > > +++ b/kernel/kexec_file.c > > @@ -31,6 +31,9 @@ > > > > static int kexec_calculate_store_digests(struct kimage *image); > > > > +/* Maximum size in bytes for kernel/initrd files. */ > > +#define KEXEC_FILE_SIZE_MAX (4UL << 30) Also, I will address 32-bit, with picking minimum between SIZE_MAX and kexec max file. Thanks, Pasha