From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E1EB33858D28 for ; Tue, 17 Jan 2023 14:16:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E1EB33858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673965018; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6/6wU9DQpzUkxGNDfRDW+vjboTvPvGNkAsEQMwJ2zuA=; b=RH9Z91aPy/nkqA+ABT+CQxCpMjDIxG/k8Bi7CD4KWOrkMtqnVMNJBVNJigl9QmECdIXhua dcDxmVxhh4Cbj7nCMYD1Cz73GPLR0VdmxIAeEGaLaobHcyeT/sOF7TW8YOstJ7Ab+BTiAn pQWCUSj05C39EUoBUez+jGlQiDzAnfY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-82-mFNYg2XmOSm2L0iOHUOcDw-1; Tue, 17 Jan 2023 09:16:49 -0500 X-MC-Unique: mFNYg2XmOSm2L0iOHUOcDw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A16C51C29D55; Tue, 17 Jan 2023 14:16:44 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1248C2026D2A; Tue, 17 Jan 2023 14:16:43 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Netto Cc: Joel Molin via Libc-help , Joel Molin Subject: Re: Why does _dl_protect_relro align the end address down? References: <87zgah7fv1.fsf@oldenburg.str.redhat.com> <6b782360-131f-df4c-9dc4-6765d0fb8c24@linaro.org> Date: Tue, 17 Jan 2023 15:16:42 +0100 In-Reply-To: <6b782360-131f-df4c-9dc4-6765d0fb8c24@linaro.org> (Adhemerval Zanella Netto's message of "Tue, 17 Jan 2023 11:11:10 -0300") Message-ID: <878ri15jqt.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Adhemerval Zanella Netto: > On 17/01/23 04:57, Florian Weimer via Libc-help wrote: >> * Joel Molin via Libc-help: >> >>> Since mprotect will protect entire pages anyway, wouldn't it make a lot >>> more sense here to say `end = ALIGN_UP(...)`? Apart from feeling more >>> intuitive, it also seems like it would avoid page size inconsistencies >>> between runtime and link editing like the one above. >> >> ALIGN_UP might make memory read-only that should not be. >> >> There's some discussion about the alignment here: >> >> PT_GNU_RELRO is somewhat broken >> >> >> I still think this is fairly broken, but there does not seem to be much >> desire to fix it. > > It was not clear to me from that discussion what you think it is still > broken with PT_GNU_RELRO. Using ALIGN_DOWN for the start address can't be right. Thanks, Florian