Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp927666ybe; Wed, 11 Sep 2019 06:55:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHhkoyQqhPCsVMKLwpAmm0Nv6bpMlH5PaInF36urcBFsjTyMCXirTruMnL4gFSNV7eoSJM X-Received: by 2002:a17:906:f189:: with SMTP id gs9mr30929357ejb.274.1568210147014; Wed, 11 Sep 2019 06:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568210147; cv=none; d=google.com; s=arc-20160816; b=Z6ZdhffoDFjaWtmRQIJaz8iVdr/XcdTp6weT5hM1f3ht43Vj4iUBeklGMxTu3nzIDF peV3Fv2ygx6YgBYS6JIIqJoo5wBzHbPuMsO+JwQ3n1NYXvz+G0wJjExOOMuTXd2pvbbu YtNDtHx2XKDEWqG5/fEVZM/jHwzvtqLgCXfD04Nv3TZdL2kF/8BLjctURRcZLz8cj8Xe t1mhADui4E37jjAe61eL+jv4bNHp2Epy0zH0HJTwdXMqgjoH+pyk6ungPDRBJXnThfb4 FnZeAHu4KMRLj21po/cOhHRG0RYNjaByo8diYBeJfhZesHb7GsLDohEs/naY4xOt9AFB MfoQ== 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=e92A6SchtVfVmnOKxgRKf0X8OtCxoRUEi0kqEyUDsJ8=; b=bN/yVK0ROukqv0FjBQR5jnoJHQJC/6wmdoPVrgyc6LoExpDE1jU6uAdwWyAOBJti7k Ql5e2gxNOnZJfPGwprL3y885Ga1onMEiDJFcv6nmAJ8mJIwCd/jUS0cCi3yl4V0kb2ap UyGHaUDRMh7BD2+hwTSLvvVNvQK8eyY8QvUpo8YWBsJT5DeFkAtt8lE145GWw3jZiZsL Na36xgrbn/xLbnKIRzxS7LTPLUA6zPJk4m5jkM53xto26qqrd7jClfDub61+ogvcNBuF /3oRjm+i+VwqXAELH2mfkXCm+jT9DlpPADHJ+A0MnssZEiyXz5TibnTwMyLU3mSvXXea 7cwQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b31si14621964ede.12.2019.09.11.06.55.23; Wed, 11 Sep 2019 06:55:47 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728250AbfIKNwk (ORCPT + 99 others); Wed, 11 Sep 2019 09:52:40 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:57122 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728090AbfIKNwj (ORCPT ); Wed, 11 Sep 2019 09:52:39 -0400 Received: from [148.69.85.38] (helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1i8330-0005t7-JG; Wed, 11 Sep 2019 13:52:38 +0000 Date: Wed, 11 Sep 2019 15:52:37 +0200 From: Christian Brauner To: Andrew Morton Cc: Eugene Syromiatnikov , linux-kernel@vger.kernel.org, Oleg Nesterov , "Peter Zijlstra (Intel)" , Ingo Molnar , "Dmitry V. Levin" , Eric Biederman Subject: Re: [PATCH v2] fork: check exit_signal passed in clone3() call Message-ID: <20190911135236.73l6icwxqff7fkw5@wittgenstein> References: <20190910175852.GA15572@asgard.redhat.com> <20190911064852.9f236d4c201b50e14d717c14@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190911064852.9f236d4c201b50e14d717c14@linux-foundation.org> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 11, 2019 at 06:48:52AM -0700, Andrew Morton wrote: > On Tue, 10 Sep 2019 18:58:52 +0100 Eugene Syromiatnikov wrote: > > > Previously, higher 32 bits of exit_signal fields were lost when > > copied to the kernel args structure (that uses int as a type for the > > respective field). Moreover, as Oleg has noted[1], exit_signal is used > > unchecked, so it has to be checked for sanity before use; for the legacy > > syscalls, applying CSIGNAL mask guarantees that it is at least non-negative; > > however, there's no such thing is done in clone3() code path, and that can > > break at least thread_group_leader. > > > > Checking user-passed exit_signal against ~CSIGNAL mask solves both > > of these problems. > > > > [1] https://lkml.org/lkml/2019/9/10/467 > > > > * kernel/fork.c (copy_clone_args_from_user): Fail with -EINVAL if > > args.exit_signal has bits set outside CSIGNAL mask. > > (_do_fork): Note that exit_signal is expected to be checked for the > > sanity by the caller. > > > > Fixes: 7f192e3cd316 ("fork: add clone3") > > What are the user-visible runtime effects of this bug? > > Relatedly, should this fix be backported into -stable kernels? If so, why? No, as I said in my other mail clone3() is not in any released kernel yet. clone3() is going to be released in v5.3. Christian