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]
Date:   Fri, 18 Aug 2023 12:44:44 +0200
From:   Heiko Carstens <hca@...ux.ibm.com>
To:     "GONG, Ruiqi" <gongruiqi@...weicloud.com>
Cc:     Kees Cook <keescook@...omium.org>, Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org, gongruiqi1@...wei.com
Subject: Re: [PATCH] lkdtm: use the return value of strim()

On Fri, Aug 18, 2023 at 10:39:06AM +0800, GONG, Ruiqi wrote:
> 
> On 2023/08/18 0:55, Kees Cook wrote:
> > On Thu, Aug 17, 2023 at 10:21:17PM +0800, GONG, Ruiqi wrote:
> >> From: "GONG, Ruiqi" <gongruiqi1@...wei.com>
> >>
> >> Make use of the return value of strim() to achieve left-trim as well as
> >> right-trim, which prevents the following unusual fail case:
> >>
> >>  # echo " EXCEPTION" > /sys/kernel/debug/provoke-crash/DIRECT
> >>  sh: write error: Invalid argument
...
> >>  	/* NULL-terminate and remove enter */
> >>  	buf[count] = '\0';
> >> -	strim(buf);
> >> +	buf = strim(buf);
> >>  
> >>  	crashtype = find_crashtype(buf);
> >>  	free_page((unsigned long)buf);
> > 
> > Will free_page() still work in this case, though? The address won't
> > match the allocation any more...
> 
> Yes I noticed that, but I was under the impression that it's fine to do
> free_page(paddr + offset_in_page) since the offset is within the page,
> and its corresponding struct page can still be found when being freed.
> Please let me know if this thought is wrong and I will submit another
> version.

The question is rather why you think this patch makes any sense at
all. Nobody is doing what you described above - hence there is no
problem. The comments in the code even say strim() is used to remove the
trailing '\n'. If anybody passes a string with whitespace at the beginning
then that's just a user error.

There really is no point in patches like this.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ