From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12921 Path: news.gmane.org!.POSTED!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: broken __kernel_mode_t affecting some big endian archs Date: Sat, 16 Jun 2018 02:14:24 +0200 Message-ID: <20180616001423.GS4418@port70.net> References: <20180614005442.GK1392@brightrain.aerifal.cx> <20180615020023.GM1392@brightrain.aerifal.cx> <20180615020154.GN1392@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1529107953 27190 195.159.176.226 (16 Jun 2018 00:12:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 16 Jun 2018 00:12:33 +0000 (UTC) User-Agent: Mutt/1.9.1 (2017-09-22) To: musl@lists.openwall.com Original-X-From: musl-return-12937-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jun 16 02:12:29 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1fTypR-000705-58 for gllmg-musl@m.gmane.org; Sat, 16 Jun 2018 02:12:29 +0200 Original-Received: (qmail 9258 invoked by uid 550); 16 Jun 2018 00:14:36 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 9235 invoked from network); 16 Jun 2018 00:14:35 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20180615020154.GN1392@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:12921 Archived-At: * Rich Felker [2018-06-14 22:01:54 -0400]: > diff --git a/src/ipc/shmctl.c b/src/ipc/shmctl.c > index e2879f2..9d723d9 100644 > --- a/src/ipc/shmctl.c > +++ b/src/ipc/shmctl.c > @@ -4,9 +4,23 @@ > > int shmctl(int id, int cmd, struct shmid_ds *buf) > { > +#ifdef SYSCALL_IPC_BROKEN_MODE > + struct shmid_ds tmp; > + if (cmd == IPC_SET) { > + tmp = *buf; > + tmp.shm_perm.mode *= 0x10000U; > + buf = &tmp; > + } > +#endif > #ifdef SYS_shmctl > - return syscall(SYS_shmctl, id, cmd | IPC_64, buf); > + int r = __syscall(SYS_shmctl, id, cmd | IPC_64, buf); > #else > - return syscall(SYS_ipc, IPCOP_shmctl, id, cmd | IPC_64, 0, buf, 0); > + int r = __syscall(SYS_ipc, IPCOP_shmctl, id, cmd | IPC_64, 0, buf, 0); > +#endif > +#ifdef SYSCALL_IPC_BROKEN_MODE > + if (r >= 0 && cmd == IPC_STAT) { > + buf->shm_perm.mode >>= 16; > + } > #endif > + return __syscall_ret(r); > } ugly but looks ok to me. i don't think there is a clean solution on the broken targets.