Received: by 10.223.164.221 with SMTP id h29csp390320wrb; Fri, 3 Nov 2017 17:04:27 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Q9G7UGTARfJjSJyqWYgiNTYCwTNphnALaMF8hiFHQ+1G5NGQpKEwx6ivMqlw8OgJDtRlyo X-Received: by 10.84.128.70 with SMTP id 64mr8422525pla.329.1509753867571; Fri, 03 Nov 2017 17:04:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509753867; cv=none; d=google.com; s=arc-20160816; b=HsrxJwuN5Xd8YVqis+gvOHDTZ+uAv/pPxHQLfK9jKkTIg5S+vvYv3V1db+qkuo2dZ+ v4y9v8TYyulM7mY13ytVzWEyJBWRFWk42x9P4ek2/BiUHdfsVW0HF0QPKzOT8/57Tucf tGv8CYlrQPv0BJZNLb+APzYWTCo3fBJVyxdyqcbSHaZcppuln7am+9/ZN73MnzA3ykLR Qe29u+NJvP8zxehT018X+XplfMHo2Nt44ggASUZeMX6AStJz+GkUkU+bdWKaXV+gg7MV ThK/+m4owZjZ3mSiqhqzvGTwYTLHPyvnLSJvOitWXnGXg8q8zXvD6Go1SssO+3QLdRxv VEcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=lPs0ahzPSFz6e/Iz9O94HlqRnT1x/WpJ0UgpMeUxIQQ=; b=ayOJQ0wf+czHxZsQcQy7YpZ5pXbeRpA/ImCeFOMSIOC42tPGmtawXWpV13XDJ8JwxI 0NxT9+OolfI66JRHd7t3DaVwX9DxptJDYthiGyn9I4sWn50AC0BjOKqNkXWjvQ8X+S1Q 82SicrtdK88F1FUTESshZWPLBQ9Wq9riHrHKVkNYMEb8SZRlQkifDum5a4yg+9Kfc+Ql QzOTLXEyval6hiIazs0aYEV8hezZ7rkbBhZScutLRE8xHGsehwDsOgXMYcwSxGwKoVhr 9NscuzOssLOtDqZeltoRb1QhErXsQn7ex2MIF15Vbiv5jcMMcW+QHRn5rsvacCaL23/D SxOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Sw9NdaiW; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t184si7541175pfd.381.2017.11.03.17.04.14; Fri, 03 Nov 2017 17:04:27 -0700 (PDT) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=Sw9NdaiW; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755846AbdKDADg (ORCPT + 92 others); Fri, 3 Nov 2017 20:03:36 -0400 Received: from mail-ot0-f174.google.com ([74.125.82.174]:55234 "EHLO mail-ot0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752478AbdKDADe (ORCPT ); Fri, 3 Nov 2017 20:03:34 -0400 Received: by mail-ot0-f174.google.com with SMTP id 96so4032079otw.11 for ; Fri, 03 Nov 2017 17:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=lPs0ahzPSFz6e/Iz9O94HlqRnT1x/WpJ0UgpMeUxIQQ=; b=Sw9NdaiWalaVUgg5dcHKWtuorZvHyaFcjHEvtYjlQWbCCPjFd5g8FqGIoqpQ+nkpPp uVe681K+4f6tsd8+oJoZ1/JUJqt/VMQSrnJkwAYCtB+tFon2guGm6bXkEd98chG2v7bB 9MhVx2WTln3j1h/4WdZCtv4iUhc13ox24gBqjiwCUktHs/xQ34X1e44weMoJ+964+9Ad V2AYIzNfJOOhh1QYAxjtkzFz9DSdzQ3nzhjGAoKE/I2HxAQGkvJlxehOT0CakU3iQjE4 fSn/wW6zJoqPnVJy0YkHy/nbj1sqR36VPWJeChX0Uzr5/5wVOH8r2dRPTotbRkYpUd6o JTsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=lPs0ahzPSFz6e/Iz9O94HlqRnT1x/WpJ0UgpMeUxIQQ=; b=lw9NZrF9D8Gy4s2CHYR/fIU2XG/OHGy76elKmGfsAlbEhKINCs6b9+f2fSyddkmZXv UAp0L1xdXePd7nlYyh0StwB6u/naaAyHZ6p0KV82cBEKjFC4sDT6axaK7ZlENF1K8Git YsKORzoRHSnIvfQ8pWnjcrkd56KRcHfh7ho17bFebOQGs5CHwY0DLLEtYtVYgI6vDQ5k NQhnP8M8tBd+dPCA2OTjM1E53XnxFdYb36gNLksKh3RoQYSCc6ASNScZQdSvcjU24hBR 6OgbTQlvQ6doDMGJjiDG6h3nWVahOGshpxkyzIRnTQyWdDpufY3lEFnnmeHov+ievTGi DEHQ== X-Gm-Message-State: AJaThX4vQT2qItQrdNyrQ2wKsN0KlG0Z0vF4HYUGJqOPV9FLHPJlfqJw sYzxij/fG6rJJO4KBsr3kKYwt93MaSds0ECP9btr5A== X-Received: by 10.157.67.42 with SMTP id s39mr5911182ote.243.1509753813788; Fri, 03 Nov 2017 17:03:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.192.26 with HTTP; Fri, 3 Nov 2017 17:03:13 -0700 (PDT) In-Reply-To: <0b3a9bd0-3046-cdab-cfee-0ca45ee64e8d@landley.net> References: <0b3a9bd0-3046-cdab-cfee-0ca45ee64e8d@landley.net> From: enh Date: Fri, 3 Nov 2017 17:03:13 -0700 Message-ID: Subject: Re: [Toybox] Regression: commit da029c11e6b1 broke toybox xargs. To: Rob Landley Cc: Linus Torvalds , enh@gmail.com, Kees Cook , toybox@lists.landley.net, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 3, 2017 at 4:58 PM, Rob Landley wrote: > On 11/02/2017 10:40 AM, Linus Torvalds wrote: >> On Wed, Nov 1, 2017 at 9:28 PM, Linus Torvalds >> wrote: >>> >>> Behavior changed. Things that test particular limits will get different >>> results. That's not breakage. >>> >>> Did an actual user application or script break? > > Only due to getting the limit wrong. The actual failure's in the android > internal bugzilla I've never been able to read: > > http://lists.landley.net/pipermail/toybox-landley.net/2017-September/009167.html there was nothing secret or interesting in the original bug report. just someone trying to use find/xargs on the whole file system. here's a copy & paste: marlin:/ # find / /data -xdev -type f ! -name \*.jpg -exec grep -Fl belkin.a {} + find: exec grep: Argument list too long marlin:/ # find / /data -xdev -type f ! -name \*.jpg -print | xargs grep -Fl belkin.a xargs: exec grep: Argument list too long > But it boils down to "got the limit wrong, the exec failed after the > fork(), dynamic recovery from which is awkward so I'm trying to figure > out the right limit". > >> Ahh. I should have read that email more carefully. If xargs broke, >> that _will_ break actual scripts, yes. Do you actually set the stack >> limit to insane values? Anybody using toybox really shouldn't be doing >> 32MB stacks. > > Toybox is the default command line of android since M, which went 64 bit > in L, and the Pixel 2 phone has 4 gigs of ram. My goal with toybox is to > turn android into a self-hosting development environment no longer > cross-compiled from a PC (http://landley.net/talks/celf-2013.txt) so I'm > trying to implement a command line that can run the entire AOSP build. > > I.E. I have no idea what people will do with it, and try not to get in > their way. > > My problem here is it's hard to figure out what exec size the limit > _is_. There's a sysconf(_SC_ARG_MAX) which bionic and glibc are > currently returning as stack_limit/4, which is now too big and exec() > will error out after the fork. Musl is returning the 131072 limit from > 2011-ish, meaning "/bin/echo $(printf '%0*d' 131071)" works but > "printf '%0*d' 131071 | xargs" fails, an inconsistency I was trying to > avoid. Maybe I don't have that luxury... > > Each argument has its own limit separate from the argv+envp total limit, > but there's only one "size" you can query through sysconf, so the > querying API is insufficient at the design level. > > Meanwhile under bash you can allocate and dirty 256 megabytes from the > command line with: > > echo $(printf '%0*d' $((1<<28))) > > Because it's a shell builtin so there's no actual exec. (And if > https://sourceware.org/bugzilla/show_bug.cgi?id=17829 ever gets fixed > it'll go back to allowing INT_MAX.) > > Posix is its usual helpful self, read conservatively > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html > says to break the line at 2048 bytes. > >> So I still do wonder if this actually breaks anything real, or just a >> test-suite or something? > > I've cc'd Elliott, who would know. (He's the Android base os userspace > maintainer, he knows everything. Or can at least decode > http://b/65818597 .) > > But this just broke my _fix_, not the earlier deployed stuff. I removed > the size measuring code when the 131072 limit went away, the bug was > there's a new limit I need to not hit, I tried to figure out what the > limit is now, confirmed that the various libc implementations don't > agree, then the actual kernel limit changed again while I was looking at it. > >> Linus > > Should I just go back to hardwiring in 131072? It's no _less_ arbitrary > than 10 megs, and it sounds like getting it _right_ is unachievable. > > Thanks, > > Rob > > > _______________________________________________ > Toybox mailing list > Toybox@lists.landley.net > http://lists.landley.net/listinfo.cgi/toybox-landley.net -- Elliott Hughes - http://who/enh - http://jessies.org/~enh/ Android native code/tools questions? Mail me/drop by/add me as a reviewer. From 1583091369137192079@xxx Fri Nov 03 23:59:39 +0000 2017 X-GM-THRID: 1582908659593594930 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread