From patchwork Fri Sep 15 20:19:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 22907 Received: (qmail 63550 invoked by alias); 15 Sep 2017 20:19:59 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 63528 invoked by uid 89); 15 Sep 2017 20:19:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f173.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PyTGP+atNK5H6vFxpSYjD3YCSWn+yU/pAK1AGat39Yg=; b=glpA0HzT6zsS5bZr4KEI69HjjYoFzh5ZQpOs3gEeXfDpEe7kf3LdqM9OOe/QLMFehx KwbG2Ga0XyoUM9g05go7pShy01Ptf/k1hPbaIRrk9Gjhrr+g5taDNB8O+KkWpqcLOKwb wWYb8g5FwYuEEmF0fUFxRab7ZGjdlhpW2VQM4sk1/C4eRjY2sRuLTyxpGBFw6huJS0g3 5NKzRrrmfInNUrIBgsINo+lotZ5DCdD9DPZGjMLt9V9QfOtZROCqgQWYdZYo6HPaVnHH 6JO/DqUKBwwnr21o6m7lWfzZiVfrCs+rRgpFB4bcQV4Llz858i9EOAe8MOLQc72K9EV8 xCAg== X-Gm-Message-State: AHPjjUgtKRYKDdfMuW1pa77wOaLRBSI1Je5JmijL1m8P8+pTJBIvbNnR gLyTu3+2r6IfF5+Hwa03eQ== X-Google-Smtp-Source: AOwi7QBquurTa4vVisEG4B6NWxtoXLHbOUsGUE7L7GwKgFgL/QKE1HBqUGmsl4uZEo2JFkfgOIP20w== X-Received: by 10.200.41.117 with SMTP id z50mr36198131qtz.191.1505506795188; Fri, 15 Sep 2017 13:19:55 -0700 (PDT) Subject: Re: [PATCH] posix: Add compat glob symbol to not follow dangling symbols To: Joseph Myers Cc: libc-alpha@sourceware.org References: <1505503299-8646-1-git-send-email-adhemerval.zanella@linaro.org> From: Adhemerval Zanella Message-ID: <4b7bde54-34e8-38bf-a810-35fbd16e1b1b@linaro.org> Date: Fri, 15 Sep 2017 17:19:50 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: On 15/09/2017 17:01, Joseph Myers wrote: > On Fri, 15 Sep 2017, Adhemerval Zanella wrote: > >> This works as expected with the patch applied. Since it is for generic >> ABI, default compat symbols are added with override for Linux due LFS. >> Now we have two compat symbols for glob on Linux: >> >> 1. sysdeps/unix/sysv/linux/oldglob.c which implements glob64 with >> the old dirent layout. For this implementation I also set it to >> follow the no dangling symlinks which is the safest path. >> >> 2. sysdeps/unix/sysv/linux/glob{64}-lstat-compat.c which implements >> the compat symbol for dangling symlinks. As for generic glob, >> the implementation uses XSTAT_IS_XSTAT64 to define whether >> both __glob_lstat_compat and __glob64_lstat_compat should be >> different implementations. For archictures that define >> XSTAT_IS_XSTAT64, __glob_lstat_compat is aliased to >> __glob64_lstat_compat. > > 3. sysdeps/unix/sysv/linux/alpha/oldglob.c has another compat version for > a different glob_t layout. Presumably that one also should ignore > gl_lstat. For alpha old compat symbol I think setting gl_lstat to gl_stat would be suffice to follow old semantic: I will incorporate it to my initial patch. diff --git a/sysdeps/unix/sysv/linux/alpha/oldglob.c b/sysdeps/unix/sysv/linux/alpha/oldglob.c index 988c92b..b54624c 100644 --- a/sysdeps/unix/sysv/linux/alpha/oldglob.c +++ b/sysdeps/unix/sysv/linux/alpha/oldglob.c @@ -59,7 +59,9 @@ __old_glob (const char *pattern, int flags, correct.gl_closedir = pglob->gl_closedir; correct.gl_readdir = pglob->gl_readdir; correct.gl_opendir = pglob->gl_opendir; - correct.gl_lstat = pglob->gl_lstat; + /* Set gl_lstat and gl_stat for both gl_stat for compatibility with old + implementation that did not follow dangling symlinks. */ + correct.gl_lstat = pglob->gl_stat; correct.gl_stat = pglob->gl_stat; result = glob (pattern, flags, errfunc, &correct); @@ -72,7 +74,7 @@ __old_glob (const char *pattern, int flags, pglob->gl_closedir = correct.gl_closedir; pglob->gl_readdir = correct.gl_readdir; pglob->gl_opendir = correct.gl_opendir; - pglob->gl_lstat = correct.gl_lstat; + /* Only need to restore gl_stat. */ pglob->gl_stat = correct.gl_stat; return result;