Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5922125pxb; Mon, 14 Feb 2022 10:45:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzsHSJj9ida0sxapS1yfzAhCsNybUXpHBnAosFI8b1jqhFtNCfpJPFVihyftKQD5Ywz9x1t X-Received: by 2002:a17:90a:e008:b0:1b9:2e0f:1e57 with SMTP id u8-20020a17090ae00800b001b92e0f1e57mr10202pjy.174.1644864335544; Mon, 14 Feb 2022 10:45:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644864335; cv=none; d=google.com; s=arc-20160816; b=N4z6ZDKPurglp5cViWSn4ldv77tx6jVv8PMUEz2tD8jbgnaHIBMs5w5wwmNHlpAgPV VYf9KSpoLS2NraFGYESzjjav3Qgai+tD4laYJQFhVJ3cN/QBFR/h5IKNES+rb8j2+p0X PKQTWBoXO32jMS1gl8g0NMj65V35ARkDRWn1NWU+K4hUgNV8f4FryZxF7+nka1FEHRPY UymzTUByRqdFi1YOc8RwhfAs1+0arZ3b6rnuzlJCIW4obvXS+8i/5WEapBiU1oKCb2PL UEQRaOeZPUuYB23iJDlH+Rwtd02SwtNN4ifZPeNTkBExQ2T3+0q8Swx4VEdlg1ffbaSB DDrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=u0lz2sBFTROYxYJ6eqMOWGm9UTJfyP61FYvgdnhkZ3I=; b=UtBhkMUi+GBV5nH/isPU3OHKUPY3Yyg9Pqy+8KP2TmU89xl9qSfP5sxOrwjoZVVSNI rI9ts8bil0Bi3aNa/WqlF16WtObVHqUX0elhWbGb63Nw/ot/VJvYFi1SM2Cr+VG/bnjd 9XdgF/6fmBvTg/JDqdBkmHAJf2UujPp9q+I9tnBbhAvG5rVgDTpG4GSC9j93Q1YJG7J8 dDXII/wu+8r88R3TRuDm7PkqkHjCWuPLJyfoD39ZRt40ZcyZFjqsQuM+RQiwmfdkF32G 6gEl6dEZn9apMmIkEa4p0kb5VmoUX4IPr77oRZjBTbzdjew8Uf2fcBeI4ahPbARxQ9EX P03g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=nEe1l0hd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f12si30998118pfv.107.2022.02.14.10.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 10:45:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=nEe1l0hd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9960A6E4ED; Mon, 14 Feb 2022 10:45:25 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353216AbiBNMe3 (ORCPT + 99 others); Mon, 14 Feb 2022 07:34:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231529AbiBNMe2 (ORCPT ); Mon, 14 Feb 2022 07:34:28 -0500 Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9184C4A3C5 for ; Mon, 14 Feb 2022 04:34:20 -0800 (PST) Received: by mail-ua1-x932.google.com with SMTP id 60so8055548uae.1 for ; Mon, 14 Feb 2022 04:34:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u0lz2sBFTROYxYJ6eqMOWGm9UTJfyP61FYvgdnhkZ3I=; b=nEe1l0hdXdSreWxGfYzOMAroXlhk6U0l82gHW3dPxeIq953C7Lp9jjLb2STTA6q91/ 3YQY4ptFY0W/xrLk7ftcOUEfF8rFpzdTQ8h3MQihF6t8uu5sJA7kA1+NwxRI5NEil3eQ Q7L5s5C16Ueci5KvTW8ZsSue/4M0Ez7bYUWbG/hnIbzmAHff0KFw2BjGyAJC7HyX2QIL VzfwopRLUvXhkwlC+oRzZ0vFHluU4tQarVn4+Mo337qqWn6gqsW6rvbqcvcEqOiJdybU a3MOgBj/AErLTKkCLaXkn/1IwVHXsI8YeZ05g/IrjegWXqgmhrCOjV+OkAiiHMSohxO7 qMvg== 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:cc; bh=u0lz2sBFTROYxYJ6eqMOWGm9UTJfyP61FYvgdnhkZ3I=; b=YSoB+3cLOXJ/Nw7zLh0XaOziok5kqwiYd0rau77S+FntDCqpk+0kaaH4ny/j3tiMOP gyueW8+Xp/ih8ny9nueAnXuyhPV8tWVhWEuJtxYD65tN6w/hBbixZbu3dXcDyroiY6Z7 SZ7dbWTAMJCnwSEQAPlzAXyuXYvOnuehjwTda7WKJ0c8bXQ42hHJW+PECG+SVlWtboxq t+hDjoYqQsW0Zf5XmXyhakkBrtykaaE6yiA7mkWkMR7mN5Ogm7l3sy7DbLW6sKw3isxQ mGcNcTI1MM1FJBscY9hEgzxuY58mt6B2472VihP+SvSsXylV4bPx7NruYTj00kEHamxp OmKQ== X-Gm-Message-State: AOAM531YDcXQDC+3NW4mEYedn1a1mvqSrN3G05eJte1jyAxU0HfrX5HV 9hPeL3v4J8EGAXcsyBXS4DzrwVxuzRJrcxU6rBYcxQ== X-Received: by 2002:ab0:6cb7:: with SMTP id j23mr3707418uaa.36.1644842059506; Mon, 14 Feb 2022 04:34:19 -0800 (PST) MIME-Version: 1.0 References: <20220130211838.8382-1-rick.p.edgecombe@intel.com> <20220130211838.8382-27-rick.p.edgecombe@intel.com> In-Reply-To: <20220130211838.8382-27-rick.p.edgecombe@intel.com> From: Jann Horn Date: Mon, 14 Feb 2022 13:33:53 +0100 Message-ID: Subject: Re: [PATCH 26/35] x86/process: Change copy_thread() argument 'arg' to 'stack_size' To: Rick Edgecombe Cc: x86@kernel.org, "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H . J . Lu" , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V . Shankar" , Dave Martin , Weijiang Yang , "Kirill A . Shutemov" , joao.moreira@intel.com, John Allen , kcc@google.com, eranian@google.com, Yu-cheng Yu Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL 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 Sun, Jan 30, 2022 at 10:22 PM Rick Edgecombe wrote: > > From: Yu-cheng Yu > > The single call site of copy_thread() passes stack size in 'arg'. To make > this clear and in preparation of using this argument for shadow stack > allocation, change 'arg' to 'stack_size'. No functional changes. Actually that name is misleading - the single caller copy_process() indeed does: retval = copy_thread(clone_flags, args->stack, args->stack_size, p, args->tls); but the member "stack_size" of "struct kernel_clone_args" can actually also be a pointer argument given to a kthread, see create_io_thread() and kernel_thread(): pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) { struct kernel_clone_args args = { .flags = ((lower_32_bits(flags) | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL), .exit_signal = (lower_32_bits(flags) & CSIGNAL), .stack = (unsigned long)fn, .stack_size = (unsigned long)arg, }; return kernel_clone(&args); } And then in copy_thread(), we have: kthread_frame_init(frame, sp, arg) So I'm not sure whether this name change really makes sense, or whether it just adds to the confusion.