Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2427996pxj; Mon, 17 May 2021 01:01:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywuMjnQVjCZFjOOPwYPW9LYCGCmw2IctquRyWG4PEbb6JLLp6s5EbmE3YS7QBV1G1N3pA1 X-Received: by 2002:a17:906:1311:: with SMTP id w17mr63173470ejb.182.1621238460195; Mon, 17 May 2021 01:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621238460; cv=none; d=google.com; s=arc-20160816; b=rVkIyxu5SuR0WE58iJRZR96zrA97f5Ux7s869dfBdPmBt87HhW0NsOLSwc1rkbAgCd 9Yw6h1zolAl6ETsRtp7AfS2N60hzu+ZO7Q/Ug058t4av5RBiySyqdQM1anffYlI5d9b8 LUF5NLbIoO67nqKO/a9ZuvEaOhtHC/cZ7znPEbkC5jvXeik1D1vRE5vSgwn/VZ/KYAm3 T9H/KOZDj3oF0EGVCIm3glbRXWFqkhN742rxQ/nzub/mXADB/AyaTnaWXRimgoQieRPZ e4NUdnCzZtvzZxbbshQMee8jK1B75qsS3wV2N7SxmiTX3vNGCv3r037ZUli6UQksJVkn 4c+g== 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=Wqz88rsyx5loDebf/0f8TjMH001yyZ9yBPXBriVk+14=; b=Rkt6rtNNH/N+0DUqabD547AytwDl7C2XONBqQ4ZIbZmy5/6JdprSfVGvAfDyUxLkrD JPHKQbrW2s+X6OvbuHXLGkozG45/rnpZB/auB9hxPyZ/+B4o446R4AYc1knfAGeAG7xi Q+/dDqKxe6tJWYTO1yGztLa2sOfgQWiZmuJOzZ9cmZDXbiLuDLK761u3yK6g+u8yIQMb Suu4NtPcGZ3lGcQ7nkmLwiiln7AL7jYp/kyFjGvOs2T6i2OFlVaS4tCuNR2b7pb4rmMi 50Iqek/+7LylazMJyUA/gEI3a2qSTMJh8cC40lzeQxgRuzU9y1pg/07kbcXPgfzeolad dSzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rmy2En7G; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si13181880eja.590.2021.05.17.01.00.37; Mon, 17 May 2021 01:01:00 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rmy2En7G; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235456AbhEQH55 (ORCPT + 99 others); Mon, 17 May 2021 03:57:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:38530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231482AbhEQH55 (ORCPT ); Mon, 17 May 2021 03:57:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8ACC9600D4; Mon, 17 May 2021 07:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621238201; bh=Wqz88rsyx5loDebf/0f8TjMH001yyZ9yBPXBriVk+14=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Rmy2En7GXq7FJJ8ijNZSkU2j5oFf8dfd+3xtLvw3J6lL1Gr/yvJ3Q8Atf7+YNiw0N DJe+IIJBc5s5d6Cyj916u+i063Iz9fJt//dF9hyv0ZKv0Bo8gGjL0s08vMWUQcwt11 /ZRnW3dAyso9ko4Esw83Ra56hRvht/viGVisYVPJcuu2B8WK2GMtA5in06robQwvLj mS4H6d20lSZid0dG7AX+Xd6bDsFfCh1VdROFLnTHWURjXCIuSDocVqvU1qIt99LWf+ yWejoUEnuFOyvlZC4gNcN6xTFUPWJ8D8k/4EDs7A3cZEitfYmAcv87ZlL5/d8Q+MuY wt/7/t5qvps6g== Date: Mon, 17 May 2021 09:56:37 +0200 From: Jessica Yu To: "Russell King (Oracle)" Cc: linux-kernel@vger.kernel.org, Peter Zijlstra Subject: Re: [PATCH v2] module: check for exit sections in layout_sections() instead of module_init_section() Message-ID: References: <20210514160904.21989-1-jeyu@kernel.org> <20210514170930.GE12395@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20210514170930.GE12395@shell.armlinux.org.uk> X-OS: Linux p200300cbcf361a0029e37a38368d6727.dip0.t-ipconnect.de 5.12.0-2-default x86_64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +++ Russell King (Oracle) [14/05/21 18:09 +0100]: >On Fri, May 14, 2021 at 06:09:04PM +0200, Jessica Yu wrote: >> Previously, when CONFIG_MODULE_UNLOAD=n, the module loader just does not >> attempt to load exit sections since it never expects that any code in those >> sections will ever execute. However, dynamic code patching (alternatives, >> jump_label and static_call) can have sites in __exit code, even if __exit is >> never executed. Therefore __exit must be present at runtime, at least for as >> long as __init code is. >> >> Commit 33121347fb1c ("module: treat exit sections the same as init >> sections when !CONFIG_MODULE_UNLOAD") solves the requirements of >> jump_labels and static_calls by putting the exit sections in the init >> region of the module so that they are at least present at init, and >> discarded afterwards. It does this by including a check for exit >> sections in module_init_section(), so that it also returns true for exit >> sections, and the module loader will automatically sort them in the init >> region of the module. >> >> However, the solution there was not completely arch-independent. ARM is >> a special case where it supplies its own module_{init, exit}_section() >> functions. Instead of pushing the exit section checks into >> module_init_section(), just implement the exit section check in >> layout_sections(), so that we don't have to touch arch-dependent code. >> >> Fixes: 33121347fb1c ("module: treat exit sections the same as init sections when !CONFIG_MODULE_UNLOAD") >> Signed-off-by: Jessica Yu > >Looks good! > >Reviewed-by: Russell King (Oracle) > >Thanks! Queued, thanks for the review Russell! Jessica