lkml.org 
[lkml]   [2022]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/5] LoongArch: Add section of GOT for kernel module
From
Date
On Thu, 2022-07-28 at 17:21 +0800, Youling Tang wrote:
>
>
> On 07/28/2022 05:02 PM, Xi Ruoyao wrote:
> > On Thu, 2022-07-28 at 16:29 +0800, Youling Tang wrote:
> > > On 07/28/2022 12:26 AM, Xi Ruoyao wrote:
> > > > +       mod->arch.got.shdr->sh_type = SHT_NOBITS;
> > > > +       mod->arch.got.shdr->sh_flags = SHF_ALLOC;
> > > > +       mod->arch.got.shdr->sh_addralign = L1_CACHE_BYTES;
> > > > +       mod->arch.got.shdr->sh_size = (num_plts + 1) *
> > > > sizeof(struct plt_entry);
> > > > +       mod->arch.got.num_entries = 0;
> > > > +       mod->arch.got.max_entries = num_plts;
> > >  Hi, Ruoyao
> > >
> > >   We should use num_gots instead of num_plts when creating .got
> > > section.
> >
> > Yes, it's a stupid error and I'll fix it in V2.
> >
> > But why didn't this cause a malfunction on my system? :(.
>
> Maybe num_plts is greater than num_gots, and the size of plt_entry is
> equivalent to the size of four got_entry, so that when the module is
> loaded, it just allocates a larger space without causing the module to
> fail to load.

I'll write a module to load address of 10 kernel symbols with only one
printk call to test before sending V2 :).

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

\
 
 \ /
  Last update: 2022-07-28 12:54    [W:0.044 / U:3.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site