Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2052365rwb; Sun, 15 Jan 2023 08:26:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXsKuEdEIWU8jkj5FDbl2LIfdoOKw4DYDCx/6NYYoqwpIB6KLwO5Z8GYqF9Mp/arLsmdPwGt X-Received: by 2002:a17:907:d091:b0:7b5:911c:9b12 with SMTP id vc17-20020a170907d09100b007b5911c9b12mr10971831ejc.1.1673799972218; Sun, 15 Jan 2023 08:26:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673799972; cv=none; d=google.com; s=arc-20160816; b=GkDmpXGb6qm/joOxjWGp8TGGjx0x39vr6rPcdLJ1bLPs1vIvG4odB0D7k5PG8+dCXX oCl7rQ86dKgODMhSXejJ5BVL0jHWW9bS79SffRzeCw8qvS7glcCdtrx+3x4ng97OzW2j h56AjRV8xSfFCNxVJYk9MVSPMXPGZHPnDbfm/a4mOFwfjVDGdqMPzdNQRaZZf5HixM2w PvSO38Eht2GpPKwH7H8OWdIbQFAEBr82Ugo8N/Di9XqQUD9QfJn9cxgyldrURrRa5yGJ ry9OTd2UfQhQce2v6pUewUAQr+7pmmckdEj/0s/Iqzht5ca0QtaWGbh9RPxdlIc4v/3g 4/Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=c6L2+w1+TOwdLQfXTHaIeC07Bd/3qcn0fwQEu2pIwgg=; b=yW5KE9vJQ7HrZak9y5WIwx6VUBQzamw3mM6rdfLhauB+4W+FNu6RbLhEXiFzhcJvKE ABV2AEViwCm+XcB6aeY8njB7rYOkbglZsqzB4wTvYiv+6twPBSz9aotk/lEXR1WeI35a lCP8uryp3kum+Dj61o5sYi9VgaJKwKgwipE6SNB34sfMDPHr/vfVgQ8E8ssWbWFmbtI/ EO3gGR+bX+UPQ1MKHQhfUrfSDojWR8auQRiQYGNGa8tShUuORSu2/3Hx1A8fSVNtlViZ mPPvI1tigjOgHEBMsr2PvzoRk8oRnhR6vf9ijSngY7iGzdr/3fXNtbU85rkZHNDD6JXK 774w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b=dFsocE8E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnuweeb.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a50c88b000000b0046afd9f07b0si23883332edh.14.2023.01.15.08.25.59; Sun, 15 Jan 2023 08:26:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b=dFsocE8E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnuweeb.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231540AbjAOQDj (ORCPT + 52 others); Sun, 15 Jan 2023 11:03:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231605AbjAOQDF (ORCPT ); Sun, 15 Jan 2023 11:03:05 -0500 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A12B1815A; Sun, 15 Jan 2023 08:01:23 -0800 (PST) Received: from biznet-home.integral.gnuweeb.org (unknown [182.253.183.184]) by gnuweeb.org (Postfix) with ESMTPSA id 5318E7E795; Sun, 15 Jan 2023 16:01:10 +0000 (UTC) X-GW-Data: lPqxHiMPbJw1wb7CM9QUryAGzr0yq5atzVDdxTR0iA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1673798473; bh=CV1abQ9gGejZbJXQ/TOIyi+DJk5vgSgg0ar02f3kMKc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dFsocE8EW0qbhPz0n26OQwMnwu76IzrCvnr4FOc4u5uziFcMMynAhfQ4Zc6w+P4Tr aHymi2PXurC5HHVEt2e5UONi/CvZx+IKvg1En8NTgUTJkPH8XxNrFue57W6zpKdujz OPx4EcOS+7SUEau5p3KZ4PWQAea576m7P18DipeA9uWIxwNeGzkbsI+UQEZgjjCQ+T I9e7XgxNebR5TxGb2jQsDlz6uVGTSGI8eHpu5rEEz9pIhOsjqcjIddLUEIm/hr2/TG CBJ1xd+VdLgbkRZB2/NKeoEmOMAMnMWuoALxY2bFHgiAscBhP6/nhAjVcsDiu5XA44 ors9p4Tsg1y9g== Date: Sun, 15 Jan 2023 23:01:06 +0700 From: Ammar Faizi To: Willy Tarreau Cc: Shuah Khan , "Paul E. McKenney" , Gilang Fachrezy , Alviro Iskandar Setiawan , GNU/Weeb Mailing List , Linux Kernel Mailing List , Linux Kselftest Mailing List Subject: Re: [PATCH v3 0/5] nolibc signal handling support Message-ID: References: <20230108135904.851762-1-ammar.faizi@intel.com> <20230108175842.GB18859@1wt.eu> <20230108184930.GC18859@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230108184930.GC18859@1wt.eu> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham 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 08, 2023 at 07:49:30PM +0100, Willy Tarreau wrote: > On Mon, Jan 09, 2023 at 01:31:17AM +0700, Ammar Faizi wrote: > > I'll be pondering this code this week (to follow what actually the > > rt_sigaction wants on i386 and arm): > > > > https://github.com/torvalds/linux/blob/v6.2-rc3/kernel/signal.c#L4404-L4434 > > Seems like it could simply be a matter of sigsetsize, which is the > first one returning -EINVAL. > > > Hopefully, I can get it sorted before the weekend. > > OK! I couldn't dedicate much time to this, but I looked into it, and here's my report on the progress. I didn't manage to find a proper solution to this. But yes, you're right. It's a matter of 'sizeof(sigset_t)'. So here is my observation. Currently, nolibc's sys.h includes this: #include The definition of 'sigset_t' in that header is: typedef unsigned long sigset_t; On i386, 'sizeof(unsigned long)' is 4, but on x86-64 it's 8. That is not the 'sigset_t' that the kernel wants. The kernel wants the 'sigset_t' that is in : #define _NSIG 64 #define _NSIG_BPW __BITS_PER_LONG // this 64 on x86-64, but 32 on i386. #define _NSIG_WORDS (_NSIG / _NSIG_BPW) typedef struct { unsigned long sig[_NSIG_WORDS]; } sigset_t; The above struct is always 8 bytes in size. In other words: _NSIG_WORDS == 2 on i386 _NSIG_WORDS == 1 on x86-64 sizeof(unsigned long) == 4 on i386 sizeof(unsigned long) == 8 on x86-64 Therefore, sizeof(unsigned long [_NSIG_WORDS]) is always 8 on both architectures. That's the correct size. I tried to #include but it conflicts with the other 'sigset_t' definition. So I can't do that. Why are there two different definitions of 'sigset_t'? I don't know. I probably should read the story behind this syscall to get it implemented right. Let me ponder this again on Monday. But at least I tell what I have found so people can give some comments on it... -- Ammar Faizi