Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5600630imu; Tue, 13 Nov 2018 08:57:18 -0800 (PST) X-Google-Smtp-Source: AJdET5ctziiZvQTppiAvw0YFd/hSScHrVhOryT27C9SjfBcIE7xkhBLHKN7NidMVwR1ZS1oTccqL X-Received: by 2002:a63:88c7:: with SMTP id l190mr5332508pgd.110.1542128238422; Tue, 13 Nov 2018 08:57:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542128238; cv=none; d=google.com; s=arc-20160816; b=dMX5navoawYVS7tRmJzEeMl3nz3dapFyKK0eFhIq28NyA+a7wD8kizIAm4sKrnUIES GqG7U2ozI7t+U7y9Ul9RGjahBRJhxy49q5rAT+M6QvDj3+q1ux1+Mfw95Ci+DzhvI0lQ eJek1te2kj1/EBf8qarAoAXALDALPos/6u/n/5ay9+ruCZB9wBP4zQObIRkS/N3QlMb0 PvshNejjUAsSLpq4VA964fF4EyJli5cvDATzLbSvmh103LvBPjWfrMQujEfCxSP6em6c hZwJM1qwrUx2kxgET1Q9TXpX4fcuL4SlbCBVeiABwQriusf9N+nrMCoGL1wFrumRIuXi 1FXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=B3EZ263oLF89eoYJxJPrVtogGfwcsvQND5OCojv9R68=; b=xzXy7i81sbTgT/XqijSWifZk3FpK6p3uHj8j7ffNmYkhCxysCYpUCD6kQ6uHgofhxL intceBV52/F3a1271sJPWXd6Dyc5SFOmvcMh+vweFBmxOJC6XWOW738o2BBtzuLbw07o i0JLJXXVckXiXG3+1bTp2utNdlmzEbSevb2teDqUlJ4w+BmG0XydMTZWqh+0431cynNc hVtpPFrEzGyLL/PwHV2g7HbiVrYaVqoD8RerhwgmqcwlMCBg+NCweV50Ck2Kv6PO4uVR OBctxkYaaCn3k9kFcfpSpzfdsYAuP+5JFzFPWo5+QROyMMN5g2fdyWO6QU/aIiAVhXxr yOPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u28-v6si21377303pfi.175.2018.11.13.08.56.57; Tue, 13 Nov 2018 08:57:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731174AbeKNCyz (ORCPT + 99 others); Tue, 13 Nov 2018 21:54:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41764 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726517AbeKNCyy (ORCPT ); Tue, 13 Nov 2018 21:54:54 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 448EE300156C; Tue, 13 Nov 2018 16:56:00 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.31]) by smtp.corp.redhat.com (Postfix) with SMTP id DEABA1A90C; Tue, 13 Nov 2018 16:55:58 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 13 Nov 2018 17:55:59 +0100 (CET) Date: Tue, 13 Nov 2018 17:55:58 +0100 From: Oleg Nesterov To: Andrew Morton Cc: Ben Woodard , "Eric W. Biederman" , Kees Cook , Michal Hocko , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] exec: increase BINPRM_BUF_SIZE to 256 Message-ID: <20181113165557.GG30990@redhat.com> References: <20181112160931.GA28463@redhat.com> <20181112160956.GA28472@redhat.com> <20181112155248.4dde2613979f4c176565629e@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181112155248.4dde2613979f4c176565629e@linux-foundation.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 13 Nov 2018 16:56:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/12, Andrew Morton wrote: > On Mon, 12 Nov 2018 17:09:56 +0100 Oleg Nesterov wrote: > > > /* sizeof(linux_binprm->buf) */ > > -#define BINPRM_BUF_SIZE 128 > > +#define BINPRM_BUF_SIZE 256 > > > > #endif /* _UAPI_LINUX_BINFMTS_H */ > > It does seem a rather silly restriction, and it's tempting to suggest > reworking the code so that linux_binprm.buf is dynamically sized to > accommodate even ludicrously large strings. I actually tried to do this ;) Of course this is possible, but we need some limits anyway, we need to read the file until we find '\n' or '\0' in kmalloc/vmalloc'ed buffer, then split and copy the strings to bprm->vma in reverse order. So I decided to make the trivial change for now and (hopefully) forget about this problem. > However it would be basically cost-free to increase > BINPRM_BUF_SIZE up to the point where sizeof(struct linux_binprm) == > PAGE_SIZE? I don't think we should take sizeof(struct linux_binprm) into account, the new members can come at any time and we can never decrease BINPRM_BUF_SIZE. Oleg.