From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) by sourceware.org (Postfix) with ESMTPS id 0FCB73858413 for ; Tue, 17 Jan 2023 14:30:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FCB73858413 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oo1-xc2f.google.com with SMTP id t15-20020a4a96cf000000b0049f7e18db0dso8012276ooi.10 for ; Tue, 17 Jan 2023 06:30:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=aTeRAo7hB4xrS9rvP47Uc19jM7q8TGNPLBvDDmDeT2o=; b=uZkn+pJ0GpIk+Lj1zeBH0lVq2sjpuKgy1c7XyWgIv9LCNczBNgybja4hHmakBnFUhC Y2g0S/VnkkWSNRxtYJxeVa0xj9Z3yXSxE+/K1Bqq2RG8J2Pzp5UpaSL1h6JkVDA4qvBF Vn8Bdlu49ZHBkuQchER3nBdNEof/K595tHai0nc50OpxVWlZGK32MRcwYeUeCLzW3O1z 6LqnfLoCMR57g5FQAFxGhR9+RxuDAHk2b87QTmiEYWTLfu7OtM5if40MSjVnPSXSAX1v fsc9epKyP8d0i1/rMX6cLQJOEWUJb5HkJpHZAgCjOYyxoO2uAt5vI48jtZqa3WFkvJC7 8EVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aTeRAo7hB4xrS9rvP47Uc19jM7q8TGNPLBvDDmDeT2o=; b=vWktX9oKiTpJH8vc5SAthtQM+NdK9HbAYq/jayV+ZWtOc7AeRJbbP/Hw9uJ0WV3ucG +tKX5x09FzBaA8hBiGO6bkfR9u3EADk8jP+5/fryQLednH3d+41aCuLG8pa/ICoMY79f EO5aXeM0QOBxKE2PkEbvHENqWXMudn5UAzGinwj+y/8AlbkLq3mCCTdj0fDmUbVAs49B OCBdaNk4RGf4um1e45MdNPUlBZLvGLTTIsI0ne95MK7uWExx0w9vt8x7FMs2bpbjNra2 2sJEYDRNY4b02104hnDW8wapIfDhK0IxFUZC2dXtPvFhmBnt1EcIQji9ETgcmjyDkw1b T8og== X-Gm-Message-State: AFqh2kphV5wV0reMD/vU4aHTWXIbKvuWFvA9AblLrp+Nwx1axqJjsb4X Bx6uzN2O+lJHxRfLBS/dgjqMOg== X-Google-Smtp-Source: AMrXdXt6VxUWID+Sbb0vob1Ja3oe9TSzS9bLCw2n5//6d+Xpwi2v14W6jirSrUFJKGZcMHWYgb3TFw== X-Received: by 2002:a4a:8883:0:b0:4f2:58d:693f with SMTP id j3-20020a4a8883000000b004f2058d693fmr9554163ooa.1.1673965837191; Tue, 17 Jan 2023 06:30:37 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c1:1652:49fa:2dd7:dbd:38f6? ([2804:1b3:a7c1:1652:49fa:2dd7:dbd:38f6]) by smtp.gmail.com with ESMTPSA id w16-20020a4ad030000000b004a382acad85sm14901421oor.15.2023.01.17.06.30.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Jan 2023 06:30:36 -0800 (PST) Message-ID: Date: Tue, 17 Jan 2023 11:30:34 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: Why does _dl_protect_relro align the end address down? Content-Language: en-US To: Florian Weimer , "H.J. Lu" Cc: Joel Molin via Libc-help , Joel Molin References: <87zgah7fv1.fsf@oldenburg.str.redhat.com> <6b782360-131f-df4c-9dc4-6765d0fb8c24@linaro.org> <878ri15jqt.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <878ri15jqt.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: On 17/01/23 11:16, Florian Weimer wrote: > * 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. > Do we have a bug report for this? Because H.J explanation [1] only describes ld support for the end of the RO segment. [1] https://sourceware.org/pipermail/libc-alpha/2022-May/138642.html