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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9BE6C6FA82 for ; Sun, 18 Sep 2022 21:55:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229648AbiIRVz5 (ORCPT ); Sun, 18 Sep 2022 17:55:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbiIRVzw (ORCPT ); Sun, 18 Sep 2022 17:55:52 -0400 Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 848C317A94 for ; Sun, 18 Sep 2022 14:55:51 -0700 (PDT) Received: from in02.mta.xmission.com ([166.70.13.52]:43960) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oa2GQ-008ozR-Sj; Sun, 18 Sep 2022 15:55:46 -0600 Received: from ip68-110-29-46.om.om.cox.net ([68.110.29.46]:47224 helo=email.froward.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oa2GP-006HsH-VI; Sun, 18 Sep 2022 15:55:46 -0600 From: "Eric W. Biederman" To: Al Viro Cc: Zhaoyang Huang , "zhaoyang.huang" , LKML , Ke Wang , Oleg Nesterov References: <1661842523-26716-1-git-send-email-zhaoyang.huang@unisoc.com> Date: Sun, 18 Sep 2022 16:55:17 -0500 In-Reply-To: (Al Viro's message of "Sun, 18 Sep 2022 03:42:53 +0100") Message-ID: <87wna073ga.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1oa2GP-006HsH-VI;;;mid=<87wna073ga.fsf@email.froward.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.110.29.46;;;frm=ebiederm@xmission.com;;;spf=softfail X-XM-AID: U2FsdGVkX1/AkfaHDfpn6fLN77ooydSFsheLGKPGEa8= X-SA-Exim-Connect-IP: 68.110.29.46 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH] fs: use kvmalloc for big coredump file X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding Oleg as well. Al Viro writes: > On Sun, Sep 18, 2022 at 10:29:10AM +0800, Zhaoyang Huang wrote: >> loop Eric W >> >> On Tue, Aug 30, 2022 at 2:56 PM zhaoyang.huang >> wrote: >> > >> > From: Zhaoyang Huang >> > >> > High order page allocation observed which even introduce kernel panic when generating >> > coredump file, use kvmalloc_array instead of kmalloc_array > > Frankly, I would rather cap argc here - if you are trying to feed that many arguments > to your userland helper, your core_pattern is probably bogus. Yes. More than 512 arguments seems ridiculous. I only count 16 different values that can be place in corename so frankly a cap of about 20 seems sensible. I would suggest counting the number of spaces in core pattern and not allowing it to be set if the result would be more than "PAGE_SIZE/sizeof(void *)" arguments. I would reduce that by one more argument so that helper_argv is completely unnecessary. Unless I am misreading something the only reason for helper_argv is to add a NULL at the end of the argv array. It should be no problem to have format_corename do that work as well. If you have a real world case where that is a problem please post the useful corepattern so that we can stare in disbelief and finally come around to figuring out how to support such a core pattern. Thank you, Eric