[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4075b4dad9bedbc3def5dfe75f66f3e5d49ce6d5.camel@xry111.site>
Date: Wed, 08 Nov 2023 17:25:56 +0800
From: Xi Ruoyao <xry111@...111.site>
To: WANG Rui <wangrui@...ngson.cn>
Cc: Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>, linux-kernel@...r.kernel.org,
loongarch@...ts.linux.dev, linux-kbuild@...r.kernel.org,
llvm@...ts.linux.dev, loongson-kernel@...ts.loongnix.cn,
Fangrui Song <maskray@...gle.com>
Subject: Re: [PATCH] LoongArch: Disable module from accessing external data
directly
On Wed, 2023-11-08 at 17:20 +0800, WANG Rui wrote:
> > then the linked binary triggers a SIGBUS. Ideally this should be
> > detected by the linker at link time, but currently the BFD linker
> > fails
> > to detect this error (FWIW this flaw is caused by a really nasty
> > method
> > for the medium code model implementation). So to me -fno-direct-
> > access-
> > external-data is the default. I also grepped for -fdirect-access-
> > external-data in the kernel building system but I've not found any
> > match.
> >
> > Are you using a different version of Clang, or maybe Clang has some
> > configuration-time option to make -fdirect-access-external-data the
> > default?
>
> The clang enables `direct-access-external-data` by default in PIC and
> disables it by default in no-PIC. This also applies to PIE. [1]
Oh sh*t:
xry111@...men2 ~ $ clang t1.c -O2 -fno-pie -no-pie
xry111@...men2 ~ $ ./a.out
Bus error (core dumped)
I'll consider it a Clang bug then.
--
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists