Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1221349ybk; Thu, 14 May 2020 03:39:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxY05W1fjTfPOMmn2HE8xH2km+HwvSuQm51WhVGuZuVod/vhL5sNgNbvvkqJA1ebUGbZuM9 X-Received: by 2002:a50:a7e4:: with SMTP id i91mr3174629edc.381.1589452761818; Thu, 14 May 2020 03:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589452761; cv=none; d=google.com; s=arc-20160816; b=XXaqluYMY9lK7yC1D9SeLgHEjLbm305fiFghuOM8IusNG2j37zhJj5vfttvQXBHP2Y 24L5HWtzMGm+d1C7N94bpVUsF9h8mqyycFYY4Hmz7PJuhb7mWMJLQ/hiTa/6HwTH8N3I hrMWC7F8rZpLUaZ5CePM0pcq7dFO1Qa3qSSDTHkizhZjKyup/r3unLxsT31uYexLGzFR 4ksGpswEPDe2vtj6XBpUHn0jjLTJPSPj3WI4x1tlHBXo2wltIVjzNpZElWlYBlkViHTo K1m0qhqX1rh+MIpyeqAtMxLOLaxOILMbphCE7e2MXZiE5VRdcgHIZOREoiph5iFBUBQv cArA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=nKu2JjEPrmVzxYSEBTR9PlBBmi2xzEKFDmmghHjuaZs=; b=UuC0b1UwuE5eQl9FMDOltApROU6jM7563yrF+DhuU21+/ki4m8xXiDCVyUTFKJz2hT SZANm00JpTaHg/AU2VNwuavBfJUfeSEOjbhUmyvfEqYaznlQ+RIrQdty54GFAO/aS73B Q+Dz/rIruJtO/f9RN/OMbMkKF2WtubHeBWcEonbmE6P+gOxzyBtW6srppDJW6H+ue4Jl G615lOT/7k5ihTn+Hz0S7qyD9MoTDK8kVcIXYgqtOUBZPPd5vw9rG+Sgarh736tyCInh hpRqL564+psaatVjuIp+TR3allQKJDpNerLalGYg7o6IzPG8JjbeOINY75yplfMW6xQV 7zZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d14si1521061eja.116.2020.05.14.03.38.58; Thu, 14 May 2020 03:39:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726190AbgENKhN (ORCPT + 99 others); Thu, 14 May 2020 06:37:13 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:34691 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725925AbgENKhN (ORCPT ); Thu, 14 May 2020 06:37:13 -0400 Received: from ip5f5af183.dynamic.kabel-deutschland.de ([95.90.241.131] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jZBEj-0001Gy-Aq; Thu, 14 May 2020 10:37:09 +0000 Date: Thu, 14 May 2020 12:37:08 +0200 From: Christian Brauner To: John Paul Adrian Glaubitz Cc: "Luck, Tony" , "Yu, Fenghua" , "linux-ia64@vger.kernel.org" , Al Viro , Arnd Bergmann , Thomas Gleixner , Ingo Molnar , Sebastian Andrzej Siewior , "Peter Zijlstra (Intel)" , Qais Yousef , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] ia64: enable HAVE_COPY_THREAD_TLS, switch to kernel_clone_args Message-ID: <20200514103708.zw3c5yaoumqpnxrm@wittgenstein> References: <79e58d9b-5a39-390c-2f0c-0d87b63442b4@physik.fu-berlin.de> <20200514074606.vkc35syhdep23rzh@wittgenstein> <6b298416-1e64-eee7-0bb4-3b1f7f67adc6@physik.fu-berlin.de> <20200514100459.pt7dxq2faghdds2c@wittgenstein> <2e22b0d2-b9ce-420d-48a0-0d9134108a5c@physik.fu-berlin.de> <20200514101540.25hvle74w63t66fs@wittgenstein> <20200514101914.fu7xhgaxtb5fy2ky@wittgenstein> <4aad9ad5-b0e9-12b0-0ad2-ac23fceae87b@physik.fu-berlin.de> <20200514103259.tdfjc5ds4igpmoxj@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200514103259.tdfjc5ds4igpmoxj@wittgenstein> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 14, 2020 at 12:33:00PM +0200, Christian Brauner wrote: > On Thu, May 14, 2020 at 12:21:13PM +0200, John Paul Adrian Glaubitz wrote: > > On 5/14/20 12:19 PM, Christian Brauner wrote: > > > Scratch that. It's even worse. On ia64 it is _invalid_ to pass a NULL > > > stack. That's at least what the glibc assembly assumes: > > > > > > cmp.eq p6,p0=0,in0 > > > cmp.eq p7,p0=0,in1 > > > mov r8=EINVAL > > > mov out0=in3 /* Flags are first syscall argument. */ > > > mov out1=in1 /* Stack address. */ > > > (p6) br.cond.spnt.many __syscall_error /* no NULL function pointers */ > > > (p7) br.cond.spnt.many __syscall_error /* no NULL stack pointers */ > > > ;; > > > mov out2=in2 /* Stack size. */ > > > > > > so newer systemd just works by accident on ia64 if at all correctly > > > afaict. > > > > Hmm, interesting. I really wasn't aware of that. Thanks for the heads-up. > > > > I'll ask Michael whether he can come up for a solution for that problem. > > > > Maybe that's also why systemd crashes. > > Do you have a very minimalistic ia64 userspace preferably without systemd where > you could simply test. That should give us an idea whether things work: > > #define _GNU_SOURCE > #include > #include > #include > #include > #include > #include > #include > #include > > #define STACK_SIZE (8 * 1024 * 1024) /* standard stack size for threads in glibc */ > > int main(int argc, char *argv[]) > { > char *stack; > pid_t pid; > > stack = mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE, > MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); > if (stack == MAP_FAILED) > exit(EXIT_FAILURE); > > /* > * Note that legacy clone() has different argument ordering on > * different architectures so this won't work everywhere. > */ > pid = syscall(189 /* __NR_clone2 */, SIGCHLD, stack, STACK_SIZE, NULL, NULL); Please note that even on ia64 the stack grows down but in contrast to all other architectures ia64 expects the _lowest_ address to be given and will add STACK_SIZE to stack itself in copy_thread{_tls}(). (This is all fixed in clone3() where you're always expected to pass down the lowest address and the kernel figures it out for you.) So this is intentional. Christian