<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>7390</bug_id>
          
          <creation_ts>2005-07-18 10:53:58 +0400</creation_ts>
          <short_desc>SysV shared memory support is unfunctional with CONFIG_HARDEN_SHM (Openwall patch)</short_desc>
          <delta_ts>2008-02-18 19:58:01 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>perl-base</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>blocker</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>7371</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Sir Raorn">raorn</reporter>
          <assigned_to name="viy">viy</assigned_to>
          <cc>at</cc>
    
    <cc>crux</cc>
    
    <cc>lakostis</cc>
    
    <cc>mike</cc>
    
    <cc>viy</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>27382</commentid>
    <comment_count>0</comment_count>
    <who name="Sir Raorn">raorn</who>
    <bug_when>2005-07-18 10:53:58 +0400</bug_when>
    <thetext>$ perldoc -f shmread
shmread ID,VAR,POS,SIZE
shmwrite ID,STRING,POS,SIZE
    Reads or writes the System V shared memory segment ID starting
    at position POS for size SIZE by attaching to it, copying
    in/out, and detaching from it. [...]

Shared memory segments are being destroyed after first shmread or shmwrite.
Steps to Reproduce:
1. Copypaste shared memory example from perldoc perlipc (SysV IPC section)
2. Run script
Actual Results:  
$ perl t.pl 
shm key 1223196686
wrote: &apos;Message #1&apos;
Invalid argument at t.pl line 10.

Expected Results:  
$ perl t.pl
shm key 1226932238
wrote: &apos;Message #1&apos;
read : &apos;Message #1&apos;
swell
deleting shm 1226932238</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27650</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2005-07-22 17:11:50 +0400</bug_when>
    <thetext>Date: Thu, 21 Jul 2005 19:43:08 +0400
From: Sergey Vlasov &lt;vsu@&gt;
To: ALT Linux Sisyphus &lt;sisyphus@&gt;
Subject: Re: [sisyphus] perl SysV IPC vs Owl

&gt; &gt; С этой багой надо идти в апстрим...  Это проблема дизайна
&gt; &gt; shmread/shmwrite...
&gt; В чей апастрим?  В чём суть проблемы?  Подробнее, пожалуйста...

В патче Openwall для ядер 2.4.x добавляется возможность автоматического
уничтожения неиспользуемых сегментов SysV shared memory (сегмент считается
неиспользуемым, если он не отображается в адресное пространство хотя бы
одного процесса).  В ядрах std-* эта опция конфигурации патча Openwall
(CONFIG_HARDEN_SHM) включена.

Функции shmread и shmwrite в Perl при каждом вызове выполняют shmat(),
осуществляют доступ к данным в разделяемой памяти, после чего выполняют
shmdt().  В результате выполнения этих действий, если отсутствуют другие
процессы, использующие этот сегмент, и при этом в ядре включена опция
CONFIG_HARDEN_SHM, при выполнении shmdt() сегмент уничтожается.

Настоящая проблема здесь даже не в Perl, а в самом SysV shared memory API, 
допускающем существование областей разделяемой памяти при отсутствии
ответственных за них процессов.  В большинстве случаев использования SysV
shm это свойство вызывает только проблемы (в частности, необходимость
ручного удаления сегментов после аварийного завершения использовавших их
процессов).

В случае, если автоматическое удаление сегментов разделяемой памяти 
всё-таки нужно выключить, это можно сделать командой

        echo 0 &gt;/proc/sys/kernel/shm_destroy_unused

(соответствующий патч есть в ядрах начиная с 2.4.25-std-*-alt3).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42456</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2006-11-24 13:02:35 +0300</bug_when>
    <thetext>Бишь WORKSFORME, поскольку есть workaround (задокументировано около 
http://www.freesource.info/wiki/AltLinux/Features).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63982</commentid>
    <comment_count>3</comment_count>
    <who name="Sir Raorn">raorn</who>
    <bug_when>2008-02-18 14:28:24 +0300</bug_when>
    <thetext>А ещё в 2.6 этого патча помойму вообще нет.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64087</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2008-02-18 19:58:01 +0300</bug_when>
    <thetext>(In reply to comment #3)
&gt; А ещё в 2.6 этого патча помойму вообще нет.
Ну... был altsec, но на .18 и тем более .24 Костик его не притащил, насколько
понимаю.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>