Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1207187lqo; Fri, 17 May 2024 14:28:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLtdTdfT+5JyWgtR7uT/v/XFTl40fLGS2hdXC0eiSn2lSLwSUEawftr0po09v73bQPLaPhWF1VsvRC3UlWhSXXi39we2jkZFhblu8XEw== X-Google-Smtp-Source: AGHT+IFKRXMagJVtqxN/ivZg+pFDCrqF/YVw33w4L6PCl8mIFKe76nBf5GGCm5PXL8cKm6Iu27vt X-Received: by 2002:a05:6a00:4fc6:b0:6ec:ed90:65ea with SMTP id d2e1a72fcca58-6f4e0385c30mr27197100b3a.32.1715981286088; Fri, 17 May 2024 14:28:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715981286; cv=pass; d=google.com; s=arc-20160816; b=ncf4LEvYgb9ei5ufYs0W0Jy/Opdj5czfuBsRuL3ePHkrJWmn3vAj5+Mkk1Xg6uBA3J IK2z4jqQjTRLWeo9KXQpRvIuTQNZTLMBo820HDVYmZqrJmndhz6y/YRo4sDvmJhpdE5u jhkDoYO018zlp4S9S2fx3IeDCgJuJEMUMX52NPji6Ejgmqwoo029W1L1p0mwSJaThoPi eo9ftZ6lEXIJ/RKsgys34ZMFZgZLsFau1qHfsl9wGcb6mDFyP6ejrLPr6mGMqYoYBSXd plYk6R/iH2x5TVQm7QjdpadPAMhHJGag1gBDFE03f2RKTj5jMvGY/Oxq8gj2VFh725Ja YugA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nwumsOFzLhcSRvtv4E4XIjWS9Wdw51QyanOFC9u3vrw=; fh=P7+V/u3Jcj6OGUCRk74QXZzxUoBNslYR/G7Ix0+4iU0=; b=TRe/uwQzqaX7/dZbxGW2vHDTUXNqsQj4Q+JzH2Mse6ITmO47V4Bg8ryCvb4StYP0+G Yiu4v6YvZi7fRaG9Vagr4msa4Mz2bkVkXEfM0khSkmBftfQDn8OpgT+9Lk75kxTTs4tY v4/SzKtBynDBvMQ7/M7g7qzi95RpNAMI0bM79Am+mzUQcrqpb7EF12b03CwE1I60oKvY Vclsoowh1hXyJ3cQ7n5NF7LHyvH2KeahlYlYE9V37R7jx86PPrw6BMnkIfZaiNyxgtDT 8bEXIDtufkSUe5VJH7KgeoSYUdbHEONtOepJnMSINm+2+vhtn5y0GTDz8j4pF3PNr6vy ksSw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b6Da8imk; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-182638-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182638-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2a972casi18272555b3a.120.2024.05.17.14.28.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 14:28:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182638-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b6Da8imk; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-182638-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182638-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 10EA3B22E30 for ; Fri, 17 May 2024 21:27:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2FE314198A; Fri, 17 May 2024 21:27:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="b6Da8imk" Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B316140E38 for ; Fri, 17 May 2024 21:27:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715981258; cv=none; b=bQucnRXAItYyuq9SR7YnCn6LvNq4J9T7lyLSupv7GDtOfYUA7g2EGRqf92i8eu1KR95BQHhZZgObRCIlfEp7bmkr2/OjQ9T5SB6T41HwqTjuXtRcDhFwNXps+PfOkI8+VV0n763snH/8KAR0SQKlu6oU0re+lY8dteV9FrV4m4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715981258; c=relaxed/simple; bh=mZcbn9pTbHdvbEiKdVCqeMJrWb4nqNiC86MZdFsD0r0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gf56E1mgRu7pa60vh/P5cNIzvSz7vn8SSGBTgmOjgXZvNaoq5p0sKcNxpOmAUl/+ACwIGDvF+FhT53Qq1ZYUvYlF/wDFzuIMhfOmzhlSkwtEeCFqryrlvnSyvMb023eI3Pumf+Om1j5s+aoSFNMXuDHuzyYEAOkp1wj1uF7Mo7g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=b6Da8imk; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1eca195a7c8so22456535ad.2 for ; Fri, 17 May 2024 14:27:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715981257; x=1716586057; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nwumsOFzLhcSRvtv4E4XIjWS9Wdw51QyanOFC9u3vrw=; b=b6Da8imk/8gNmVRmYGGLEwQhRFhk/mMpo33gVKEfmfcgQPdk0Zwys3suUOqqyu7Xys EE/ww405sMpTuu9o+efr9ZgadxYEdCkmU9QkNnYvm8efavBQGbxHx0h2/r/bc+MWQ7sT I+qcM9DR2v65iGT5xJE1h2aPz2B/l5t+uWaws= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715981257; x=1716586057; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nwumsOFzLhcSRvtv4E4XIjWS9Wdw51QyanOFC9u3vrw=; b=mO3FHOpbPiYyZIP7SNwtHP2KE2me02dcl497CWeMkWh/+zUG0pPuVlSlxQybgylGRz 95Mc5gG3/Zh8t/wK8X6BLSfuoNESMppQZaY/PQqwm5cAbP1o5b5Fhqp9igdrBhuXfzX5 SDUbYiVI34yzs/5UZhJdQMhfI8E0UxqpA0TbjYk2jPBbZ/stx72v4HYDPCOdbHOY+iDt xUVv4TBbHC/uv6A2Wm2bm0ynFQ+YP4bihpwPzme+JIh+Jx+Ez4bkXU2+css+M5U+U2sl 4lIUbyYkM4rHFjEvd/yzfAUJz9biTXk5lhawI/qEP3ogiufs5xzVrOtd39en9hUNvIeV Bo0Q== X-Forwarded-Encrypted: i=1; AJvYcCUY5m+KsTYlLr1oj9+imULO+felzE+lb/dbbLm7mlerZtsxjapW3hoQrEhVg7iFVu5IMJqS3zSrrSbv25R6gYT5G2AgBnizz90UgACF X-Gm-Message-State: AOJu0YzVJ4hMZiCI8+0eNuxPyTiRUH3nu2XhfA0C+UMXOB1hg5ZIODR+ YyfzVWTR2Fr/IU/GDth+UPG+bEmYqJk6nWl7p3YxuSoGQ92sZyGfQ5gZZ6X+bQ== X-Received: by 2002:a17:902:9886:b0:1e2:577:f694 with SMTP id d9443c01a7336-1ef440596a9mr187163085ad.61.1715981256849; Fri, 17 May 2024 14:27:36 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c2567absm160788595ad.297.2024.05.17.14.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 14:27:35 -0700 (PDT) Date: Fri, 17 May 2024 14:27:35 -0700 From: Kees Cook To: Masahiro Yamada Cc: Andy Lutomirski , Will Drewry , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Belloni , Benjamin Tissoires , Christian Borntraeger , Claudio Imbrenda , David Hildenbrand , Janosch Frank , Jiri Kosina , Shuah Khan , bpf@vger.kernel.org, kvm@vger.kernel.org, linux-input@vger.kernel.org, linux-rtc@vger.kernel.org Subject: Re: [PATCH 0/2] selftests: harness: refactor __constructor_order Message-ID: <202405171426.B1ED9AD@keescook> References: <20240517114506.1259203-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240517114506.1259203-1-masahiroy@kernel.org> On Fri, May 17, 2024 at 08:45:04PM +0900, Masahiro Yamada wrote: > > This series refactors __constructor_order because > __constructor_order_last() is unneeded. > > BTW, the comments in kselftest_harness.h was confusing to me. > > As far as I tested, all arches executed constructors in the forward > order. > > [test code] > > #include > > static int x; > > static void __attribute__((constructor)) increment(void) > { > x += 1; > } > > static void __attribute__((constructor)) multiply(void) > { > x *= 2; > } > > int main(void) > { > printf("foo = %d\n", x); > return 0; > } > > It should print 2 for forward order systems, 1 for reverse order systems. > > I executed it on some archtes by using QEMU. I always got 2. IIRC, and it was a long time ago now, it was actually a difference between libc implementations where I encountered the problem. Maybe glibc vs Bionic? -Kees -- Kees Cook