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: <CAM9d7cgY=nAxa-Az7BaZPUd0cmXK5e3stKw23VYMRxpyzGO6EA@mail.gmail.com>
Date:	Tue, 4 Nov 2014 00:01:26 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Jiri Olsa <jolsa@...hat.com>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...nel.org>,
	Paul Mackerras <paulus@...ba.org>,
	Namhyung Kim <namhyung.kim@....com>,
	LKML <linux-kernel@...r.kernel.org>,
	Adrian Hunter <adrian.hunter@...el.com>,
	David Ahern <dsahern@...il.com>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 1/8] perf tools: Preparation for compressed kernel module support

Hi Jiri,

On Mon, Nov 3, 2014 at 10:51 PM, Jiri Olsa <jolsa@...hat.com> wrote:
> On Mon, Nov 03, 2014 at 04:27:51PM +0900, Namhyung Kim wrote:
>
> SNIP
>
>> +static int decompress_dummy(const char *input __maybe_unused,
>> +                         int output __maybe_unused)
>> +{
>> +     return -1;
>> +}
>> +
>> +static const struct {
>> +     const char *fmt;
>> +     int (*decompress)(const char *input, int output);
>> +} compressions[] = {
>> +     { "gz", decompress_dummy },
>> +};
>> +
>> +bool is_supported_compression(const char *ext)
>> +{
>> +     unsigned i;
>> +
>> +     for (i = 0; i < ARRAY_SIZE(compressions); i++) {
>> +             if (!strcmp(ext, compressions[i].fmt))
>> +                     return true;
>> +     }
>> +     return false;
>> +}
>> +
>> +bool is_kmodule_extension(const char *ext)
>> +{
>> +     if (!strcmp(ext, "ko"))
>> +             return true;
>> +
>> +     if (ext[2] == '\0' || (ext[2] == '.' && is_supported_compression(ext+3)))
>> +             return true;
>
> I got stuck in here.. so any 2 chars string is kernel module extension?

Oops, the first check should be:

    if (strncmp(ext, "ko", 2))
        return false;


> plus how do u know ext[3] (or [2]) is valid memory?

Hmm.. if it ends at ext[0] or ext[1], it should be checked in the
first check above.  And I check ext[2] first, and then access ext[3]
and so on.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ