lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SG2PR01MB2951CE54262F791931F4AAE19FAA9@SG2PR01MB2951.apcprd01.prod.exchangelabs.com>
Date:   Tue, 14 Jun 2022 14:40:00 +0000
From:   Wenhu Wang <wenhu.wang@...mail.com>
To:     Christophe Leroy <christophe.leroy@...roup.eu>,
        Greg KH <gregkh@...uxfoundation.org>
CC:     "mpe@...erman.id.au" <mpe@...erman.id.au>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] uio:powerpc:mpc85xx: l2-cache-sram uio driver
 implementation

>>>
>>> I looked at that patch.
>>>
>>> I don't think you can just drop the #ifdef in function
>>> __access_remote_vm() in mm/memory.c
>>>
>>> You have to replace it with something like:
>>>
>>>      if (!IS_ENABLED(CONFIG_HAVE_IOREMAP_PROT))
>>>          break;
>>>
>>
>>
>>Another thing in that patch:
>>
>>By making generic_access_phys() a static inline, it means that everytime
>>you refer to the address of that function in a vm_operations_struct
>>struct, the compiler has to provide an outlined instance of the
>>function. It means you'll likely have several instances of a
>>generic_access_phys().
>>
>>What you could do instead is to add the following at the start of
>>generic_access_phys() in mm/memory.c :
>>
>>        if (!IS_ENABLED(CONFIG_HAVE_IOREMAP_PROT))
>>                return 0;
>>
>
>It is really a better chmoce, thanks for the advice.
>Multiple instances exist as you mentioned, the block returns 0 with no-op
>instance which makes no difference with the function return value.
>
>I will update the patch after a re-confirming.
>

I tried as adviced but when not defined, error happens on archectures such
as arm64. Actually the function generic_access_phys calls a lot of functions
that become undefined if we compile it with CONFIG_HAVE_IOREMAP_PROT disabled.
The archectures that support CONFIG_HAVE_IOREMAP_PROT are mips, x86, sh, arc,
s390, loongarch and powerpc.

So we may just define the function with static inline and add IS_ENABLED
condition branch in function __access_remote_vm in mm/memory.c. The executing
path breaks if CONFIG_HAVE_IOREMAP_PROT is disabled, and never goes into the
static no-op function.

In short, the static inline no-op function would never be executed, the only
difference is that there would be a lot of function code in compiled target.

Thanks,
Wenhu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ