Re: [PATCH] LoongArch: Disable module from accessing external data directly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 8, 2023 at 5:26 PM Xi Ruoyao <xry111@xxxxxxxxxxx> wrote:
>
> 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@nanmen2 ~ $ clang t1.c -O2 -fno-pie -no-pie
> xry111@nanmen2 ~ $ ./a.out
> Bus error (core dumped)
>
> I'll consider it a Clang bug then.

That's it, no copy relocations. As far as I know, copying relocations
has some issues and is not recommended by Fangrui.

For modules, if distance is not a problem, `no-pic` and
`direct-access-external-data` can be together because the code is
writable. Does it seem reasonable to exist?

>
> --
> Xi Ruoyao <xry111@xxxxxxxxxxx>
> School of Aerospace Science and Technology, Xidian University
>


-- 
WANG Rui




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux