Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2101971ybl; Thu, 30 Jan 2020 11:23:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxKnmfaL5RyvDWwQPZsuj2v45S9NhlL2zm8hBw+0UP2oSy8pd2yiSiYDmUqhBlFJt1p+K2M X-Received: by 2002:a9d:f45:: with SMTP id 63mr4977657ott.0.1580412200721; Thu, 30 Jan 2020 11:23:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580412200; cv=none; d=google.com; s=arc-20160816; b=tI0tjcs/AESlbukzuieWhVJbRJCiDtHxoet/vi3tj07iFyQ5CDRrWe3DlSUtSIzpnc wRpx/p+Oa2KxYkHkv+3w0eTQCzHYggmg/9yuch+WhrQWNb4ubBlrMNUrHWsfFjMgfXbN ASLsKDux4R3eBx1hThARfq1Mt0Z2+8M+/PnKtadqjYrWYSZWyxwFhPhVTfQ3uEHplwaQ enfOiy8Si3AQ5rMlxcOlSWPF3AyL5ZnWWMz43aDHPfeF5Q+RpBDNFvukBXqSZND04zuv Nf2CPUp7gq+4Gwx0J9YHHJukCUIs4Yvd91+iGigOSfu9gV1VETjzem/kUV7sPFOOClY5 1/qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H6//7klDR09RZhkAa2Pebhc/kRuYN5tSs037jdNdpWU=; b=N4VBL7FrjxcC/SQRR9cdmnp1BYF+AiQZkGQwZ4QsFeKqTJm4+iq/T+L85R/EwT3S83 tWyBRckdhlwjdtpSDCiZ8tZmFfmV1EGp+2BWyycK0UzIoaydP5Cg7cRizfiba7n3DmKl ps66Rbx5esJTWOZaPscfGDne37e5HEtHUlGPHqb5gEd97GEGeRJuZy+5YZsTkxf9ZNqo jjiQ6Tnw49d0eQkgGe14+6hHw6FkwTDxUXac5JdrpyUPJfMIb0W6W/oCW0y+M1HKHt7S +lWWgKJ0Jd0P1VH//Xeo8MvbtM1FmCKOkh9O4NJFnzMuPdftb0HFinI7bvtg2pRF2v32 Oy6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KcdcZYsp; 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 37si3660642otl.76.2020.01.30.11.23.07; Thu, 30 Jan 2020 11:23:20 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=KcdcZYsp; 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 S1728159AbgA3Sxc (ORCPT + 99 others); Thu, 30 Jan 2020 13:53:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:49708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730217AbgA3Sll (ORCPT ); Thu, 30 Jan 2020 13:41:41 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2F6A02082E; Thu, 30 Jan 2020 18:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409700; bh=xHo0HUXMaKuIR8GNazyiMondTjXHwMlEX5W8bC5zkK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KcdcZYspE3UTHOdkkyC5BPAiQikVLUyN5yyMY/vLGyRrJyUQV/gHRaNqyvTxAxuDi RpMvDeXT8ylhELuWH6OhT0IYjhq8uyAZlRZlP7bAA9PyIdxLcQrWjO8GPaih4gWN6A E5p/u4VIjDf/vFwphGzeiBMphcLVulESGjrDICXk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anton Ivanov , Johannes Berg , Anton Ivanov , Richard Weinberger Subject: [PATCH 5.5 55/56] Revert "um: Enable CONFIG_CONSTRUCTORS" Date: Thu, 30 Jan 2020 19:39:12 +0100 Message-Id: <20200130183618.800456221@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183608.849023566@linuxfoundation.org> References: <20200130183608.849023566@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg commit 87c9366e17259040a9118e06b6dc8de986e5d3d1 upstream. This reverts commit 786b2384bf1c ("um: Enable CONFIG_CONSTRUCTORS"). There are two issues with this commit, uncovered by Anton in tests on some (Debian) systems: 1) I completely forgot to call any constructors if CONFIG_CONSTRUCTORS isn't set. Don't recall now if it just wasn't needed on my system, or if I never tested this case. 2) With that fixed, it works - with CONFIG_CONSTRUCTORS *unset*. If I set CONFIG_CONSTRUCTORS, it fails again, which isn't totally unexpected since whatever wanted to run is likely to have to run before the kernel init etc. that calls the constructors in this case. Basically, some constructors that gcc emits (libc has?) need to run very early during init; the failure mode otherwise was that the ptrace fork test already failed: ---------------------- $ ./linux mem=512M Core dump limits : soft - 0 hard - NONE Checking that ptrace can change system call numbers...check_ptrace : child exited with exitcode 6, while expecting 0; status 0x67f Aborted ---------------------- Thinking more about this, it's clear that we simply cannot support CONFIG_CONSTRUCTORS in UML. All the cases we need now (gcov, kasan) involve not use of the __attribute__((constructor)), but instead some constructor code/entry generated by gcc. Therefore, we cannot distinguish between kernel constructors and system constructors. Thus, revert this commit. Cc: stable@vger.kernel.org [5.4+] Fixes: 786b2384bf1c ("um: Enable CONFIG_CONSTRUCTORS") Reported-by: Anton Ivanov Signed-off-by: Johannes Berg Acked-by: Anton Ivanov Signed-off-by: Greg Kroah-Hartman Signed-off-by: Richard Weinberger --- arch/um/include/asm/common.lds.S | 2 +- arch/um/kernel/dyn.lds.S | 1 + init/Kconfig | 1 + kernel/gcov/Kconfig | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) --- a/arch/um/include/asm/common.lds.S +++ b/arch/um/include/asm/common.lds.S @@ -82,8 +82,8 @@ __preinit_array_end = .; } .init_array : { - /* dummy - we call this ourselves */ __init_array_start = .; + *(.init_array) __init_array_end = .; } .fini_array : { --- a/arch/um/kernel/dyn.lds.S +++ b/arch/um/kernel/dyn.lds.S @@ -103,6 +103,7 @@ SECTIONS be empty, which isn't pretty. */ . = ALIGN(32 / 8); .preinit_array : { *(.preinit_array) } + .init_array : { *(.init_array) } .fini_array : { *(.fini_array) } .data : { INIT_TASK_DATA(KERNEL_STACK_SIZE) --- a/init/Kconfig +++ b/init/Kconfig @@ -54,6 +54,7 @@ config CC_DISABLE_WARN_MAYBE_UNINITIALIZ config CONSTRUCTORS bool + depends on !UML config IRQ_WORK bool --- a/kernel/gcov/Kconfig +++ b/kernel/gcov/Kconfig @@ -4,7 +4,7 @@ menu "GCOV-based kernel profiling" config GCOV_KERNEL bool "Enable gcov-based kernel profiling" depends on DEBUG_FS - select CONSTRUCTORS + select CONSTRUCTORS if !UML default n ---help--- This option enables gcov-based code profiling (e.g. for code coverage