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-next>] [day] [month] [year] [list]
Message-Id: <200905110230.n4B2UUXk082125@www262.sakura.ne.jp>
Date:	Mon, 11 May 2009 11:30:30 +0900
From:	Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
To:	linux-kernel@...r.kernel.org
Subject: Q: semaphore and kmalloc(GFP_KERNEL)?

Hello.
I got a question.

When we use kmalloc(GFP_KERNEL), we cannot use spinlock.
We use semaphore instead.

What happens if a writer process got into sleep state at kmalloc()
without releasing a rw_semaphore for writing,

    down_write(&sem);
    list_for_each()
        ...;
    ptr = kmalloc(size, GFP_KERNEL);
    list_add();
    up_write(&sem);

and then reader processes tried to hold that rw_semaphore?

    down_read(&sem);
    list_for_each()
        ...;
    up_read(&sem);

Can the kernel detect that we need to let kmalloc() fail and
wake up the writer process so that the writer process releases
the rw_semaphore and reader processes can continue?

(If the kernel can't detect, I worry that we experience
all processes sleeping for undefined duration.)

Regards.
--
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