From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id D64933858417 for ; Fri, 4 Mar 2022 12:42:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D64933858417 Received: by mail-ot1-x333.google.com with SMTP id j3-20020a9d7683000000b005aeed94f4e9so7315262otl.6 for ; Fri, 04 Mar 2022 04:42:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=ITfHZ9+kf6QI6G+nLkl8aPm3Y/0ys/Eu0YMQHj8M9qE=; b=l3uZLOpIJJQRDG+FF0m4U4nfarKvEAu0vbE1TbazQIWuF5hoHoJwa+RUx4peBF0sIG ZDkAeVfvugri3FfoqZjcSVZz5ILfX7eumWFqYUhzw5130TMNwLEMku/j6SSEmZYY+8Jx iIy/oZijvNMggyugoCPADIJIQaQ6WMtCGYikozx/LXSTJkvvUNECOkELT9zZBkCp8DmJ pNVQ+MnUEFLMzgoMcH7OnMK2zYnQRs1y7zR3e51YG4Oc+upcfnRXETaGfBhecCmnwEXS ma6Rcg2TUgIqbRhgkZi44QbrxygCIp7E1+/fZnHm++jwigiY+6ppiTPcvsAtucp9mZg7 odjA== X-Gm-Message-State: AOAM531Mpsql2cQqiE1diIv6Q9BHXvg9CPY9OYjz62gUe7zxzt8nj+Es Dy6T2VDibrqlFJ9Cp6yXU0FkbkDQbvl5PA== X-Google-Smtp-Source: ABdhPJybEBspFKU5Fh1z81h2En7DJvdCNNKLLONEuICufDb3tM0+LkAJbDJ7z6yLPz35L11YgtFJiQ== X-Received: by 2002:a05:6830:2b10:b0:5b0:2923:e2f8 with SMTP id l16-20020a0568302b1000b005b02923e2f8mr13147685otv.67.1646397751171; Fri, 04 Mar 2022 04:42:31 -0800 (PST) Received: from ?IPV6:2804:431:c7ca:2dcb:a992:742c:8048:43bc? ([2804:431:c7ca:2dcb:a992:742c:8048:43bc]) by smtp.gmail.com with ESMTPSA id y8-20020a544d88000000b002d525da014bsm2397820oix.42.2022.03.04.04.42.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Mar 2022 04:42:30 -0800 (PST) Message-ID: Date: Fri, 4 Mar 2022 09:42:28 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH 1/2] Remove kernel version check Content-Language: en-US To: Florian Weimer , Adhemerval Zanella via Libc-alpha References: <20220221175922.3909198-1-adhemerval.zanella@linaro.org> <20220221175922.3909198-2-adhemerval.zanella@linaro.org> <87v8wyrf3v.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella In-Reply-To: <87v8wyrf3v.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2022 12:42:33 -0000 On 28/02/2022 16:00, Florian Weimer wrote: > * Adhemerval Zanella via Libc-alpha: > >> The kernel version check is used to avoid glibc to run on older >> kernels where some syscall are not available and fallback code are >> not enabled to handle graciously fail. However, it does not prevent >> if the kernel does not correctly advertise its version through >> vDSO note, uname or procfs. >> >> Also kernel version checks are sometime not desirable by users, >> where they want to deploy on different system with different kernel >> version knowing the minimum set of syscall is always presented on >> such systems. >> >> The kernel version check has been removed along with the >> LD_ASSUME_KERNEL environment variable. The minimum kernel used to >> built glibc is still provided through NT_GNU_ABI_TAG ELF note and >> also printed when libc.so is issued. > > Missing Linux: prefix in the commit subject, I would. > >> diff --git a/NEWS b/NEWS >> index 626eeabf5d..bbbcc55b0c 100644 >> --- a/NEWS >> +++ b/NEWS >> @@ -17,6 +17,11 @@ Deprecated and removed features, and other changes affecting compatibility: >> removal of the LD_TRACE_PRELINKING, and LD_USE_LOAD_BIAS, environment >> variables and their functionality in the dynamic loader. >> >> +* The kernel version check has been removed along with the LD_ASSUME_KERNEL >> + environment variable. The minimum kernel used to built glibc is still >> + provided through NT_GNU_ABI_TAG ELF note and also printed when libc.so >> + is issued directly. > > Mention “Linux” here? I changed to "The Linux kernel version check ..." > >> index 892e8ef2f6..ba175a0035 100644 >> --- a/elf/dl-load.c >> +++ b/elf/dl-load.c >> @@ -1631,7 +1631,6 @@ open_verify (const char *name, int fd, >> ElfW(Phdr) *phdr, *ph; >> ElfW(Word) *abi_note; >> ElfW(Word) *abi_note_malloced = NULL; >> - unsigned int osversion; >> size_t maplength; >> >> /* We successfully opened the file. Now verify it is a file >> @@ -1695,13 +1694,16 @@ open_verify (const char *name, int fd, >> #endif >> ) >> errstring = N_("invalid ELF header"); >> + >> else if (ehdr->e_ident[EI_CLASS] != ELFW(CLASS)) >> { >> /* This is not a fatal error. On architectures where >> 32-bit and 64-bit binaries can be run this might >> happen. */ >> *found_other_class = true; >> - goto close_and_out; >> + __close_nocancel (fd); >> + __set_errno (ENOENT); >> + return -1; >> } >> else if (ehdr->e_ident[EI_DATA] != byteorder) >> { >> @@ -1736,7 +1738,11 @@ open_verify (const char *name, int fd, >> goto lose; >> } >> if (! __glibc_likely (elf_machine_matches_host (ehdr))) >> - goto close_and_out; >> + { >> + __close_nocancel (fd); >> + __set_errno (ENOENT); >> + return -1; >> + } >> else if (__glibc_unlikely (ehdr->e_type != ET_DYN >> && ehdr->e_type != ET_EXEC)) >> { >> @@ -1768,7 +1774,11 @@ open_verify (const char *name, int fd, >> if (__glibc_unlikely (elf_machine_reject_phdr_p >> (phdr, ehdr->e_phnum, fbp->buf, fbp->len, >> loader, fd))) >> - goto close_and_out; >> + { >> + __close_nocancel (fd); >> + __set_errno (ENOENT); >> + return -1; >> + } >> >> /* Check .note.ABI-tag if present. */ >> for (ph = phdr; ph < &phdr[ehdr->e_phnum]; ++ph) >> @@ -1820,18 +1830,6 @@ open_verify (const char *name, int fd, >> if (size == 0) >> continue; >> >> - osversion = (abi_note[5] & 0xff) * 65536 >> - + (abi_note[6] & 0xff) * 256 >> - + (abi_note[7] & 0xff); >> - if (abi_note[4] != __ABI_TAG_OS >> - || (GLRO(dl_osversion) && GLRO(dl_osversion) < osversion)) >> - { >> - close_and_out: >> - __close_nocancel (fd); >> - __set_errno (ENOENT); >> - fd = -1; >> - } >> - >> break; >> } >> free (abi_note_malloced); > > Hmm. I think you can delete the entire program header loop now? > Nothing reads abi_note after these changes. Indeed, I will removed it as well. > > And there's now an unused > > unsigned int _dl_osversion; > > in elf/dl-support.c. Ack. > > I assume you want to handle the ldconfig changes separately? I think we > discussed that during Monday's call last week. Yes, I forget to clean up this up. I will add another patch to do so.