From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5502 Path: news.gmane.org!not-for-mail From: Isaac Dunham Newsgroups: gmane.linux.lib.musl.general Subject: Re: More MIPS stat.h breakage...? Date: Wed, 16 Jul 2014 04:40:06 -0700 Message-ID: <20140716114005.GB2021@newbook> References: <20140716041556.GA26058@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1405486046 17695 80.91.229.3 (16 Jul 2014 04:47:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Jul 2014 04:47:26 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5507-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jul 16 06:47:20 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1X7H7b-000877-3n for gllmg-musl@plane.gmane.org; Wed, 16 Jul 2014 06:47:15 +0200 Original-Received: (qmail 25636 invoked by uid 550); 16 Jul 2014 04:47:14 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 25628 invoked from network); 16 Jul 2014 04:47:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=6RnGdfJyIndkbcjibafaFSkG6rjq2Vjor0RBEE43nxs=; b=zbos45sZZKONkjkrV9arPIHRwmysxvplVAivYOtFAAkFqg4+f6+Mi59+aqKxHv9KRQ yTEWzunGhIZ+5YtqNwsK4wykNnBxIWpOPp9ZAU7rtSxYtwB2pKa1/UBDIoPvsXdcsvg9 TxeEe+PN7GyYeb3/MsL/ha5I6sihvREA1dCmbsQPcvJtTCApFp7P/yzR9/U28Ng3YoNC w8EBKCz0p6nRJwRNOCEB7B7PNbOZkrWpJ1EjIIzFfFJUN1ON7q6sPUBnBcnDnCGZ6rmn E12D5MRnlbyTk066CBZ7HzmCNk+bjZADqC0sU33vaTIhJlLPJgczpMubVYjzVBkk540f 0QXg== X-Received: by 10.66.146.199 with SMTP id te7mr13741288pab.106.1405486021913; Tue, 15 Jul 2014 21:47:01 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20140716041556.GA26058@brightrain.aerifal.cx> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:5502 Archived-At: On Wed, Jul 16, 2014 at 12:15:56AM -0400, Rich Felker wrote: > I thought all of these issues were addressed a long time ago, but I > think we still may have at least one bits-header bug on MIPS big > endian: stat.h. The kernel version of this structure has: > > struct stat64 { > unsigned long st_dev; > unsigned long st_pad0[3]; /* Reserved for st_dev expansion */ > ... > > whereas st_dev needs to be dev_t, which is 64-bit. > > We're handling this now simply by using the following definition: > > struct stat > { > dev_t st_dev; > long __st_padding1[2]; > ... > > i.e. incorporating one of the padding slots into st_dev. But this only > yields the correct value for little endian. For big endian, I think > device numbers are appearing in the upper 32 bits rather than the > lower ones. This renders the major, minor, etc. macros incorrect. > > I think the cleanest fix for this is probably to add an arch-specific, > nop-by-default function __stat_fixup or similar that gets called > whenever any stat-family syscall succeeds in order to patch up the > results as needed. Alternatively, we clould do the patchup at the > syscall level for mips' syscall_arch.h, much like how x32 works. > > Anyone have strong opinions on how this should be handled? I seem to remember some comment about trying to work on kernels that predate stat64(). __stat_fixup would be a logical way to handle that, should that still be intended. The most precise information I can find is that stat64() dates to 2.4.18; I'm not sure about the accuracy of that. But I don't have a strong opinion; I just noticed a similarity to an idea that was mentioned some time back. Also, I'm not aware of any reasons 2.4.1x might be a major target for musl. ;-) Thanks, Isaac Dunham